All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hudson.plugins.tasks.util.AbstractPackageDetector Maven / Gradle / Ivy

Go to download

This plug-in scans the workspace files for open tasks and generates a trend report.

There is a newer version: 4.13
Show newest version
package hudson.plugins.tasks.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * Base class for package detectors.
 *
 * @author Ulli Hafner
 */
public abstract class AbstractPackageDetector implements PackageDetector {
    /** Identifies an unknown package. */
    protected static final String UNKNOWN_PACKAGE = "-";

    /** {@inheritDoc} */
    public String detectPackageName(final String fileName) {
        try {
            if (accepts(fileName)) {
                return detectPackageName(new FileInputStream(new File(fileName)));
            }
        }
        catch (FileNotFoundException exception) {
            // ignore and return empty string
        }
        return UNKNOWN_PACKAGE;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy