
hudson.plugins.checkstyle.util.AbstractPackageDetector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of checkstyle Show documentation
Show all versions of checkstyle Show documentation
This plug-in generates the trend report for
Checkstyle, an open source static code analysis program.
package hudson.plugins.checkstyle.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