public TestDataflowAnalysis(BugReporter bugReporter) { dataflowClassName = SystemProperties.getProperty("dataflow.classname"); methodName = SystemProperties.getProperty("dataflow.method"); }
/** * @param name * property name * @return string value (or null if the property does not exist) */ public static String getOSDependentProperty(String name) { String osDependentName = name + OS_NAME; String value = getProperty(osDependentName); if (value != null) { return value; } return getProperty(name); }
/** * @param name * property name * @param defaultValue * default value * @return the int value (or defaultValue if the property does not exist) */ public static int getInt(String name, int defaultValue) { try { String value = getProperty(name); if (value != null) { return Integer.decode(value); } } catch (Exception e) { assert true; } return defaultValue; }
/** * @param name * property name * @return string value (or null if the property does not exist) */ public String getProperty(String name) { try { String value = SystemProperties.getProperty(name); if (value != null) { return value; } return properties.getProperty(name); } catch (Exception e) { return null; } }
private boolean runningFindBugsFullJar() { String findbugsFullJar = ClassPathUtil.findCodeBaseInClassPath("findbugs-full.jar", SystemProperties.getProperty("java.class.path")); return findbugsFullJar != null; }
public static void main(String args[]) throws Exception { String u = SystemProperties.getProperty("findbugs.browserTestURL", "http://findbugs.sourceforge.net/"); url = new URL(u); SwingUtilities.invokeLater(() -> createAndShowGUI()); }
/** * Write persistent global UserPreferences to file in user's home directory. */ public void write() { try { File prefFile = new File(SystemProperties.getProperty("user.home"), PREF_FILE_NAME); write(new FileOutputStream(prefFile)); } catch (IOException e) { if (FindBugs.DEBUG) { e.printStackTrace(); // Ignore } } }
public static boolean getBoolean(String name, boolean defaultValue) { boolean result = defaultValue; try { String value = getProperty(name); if (value == null) { return defaultValue; } result = toBoolean(value); } catch (IllegalArgumentException e) { } catch (NullPointerException e) { } return result; }
/** * Read persistent global UserPreferences from file in the user's home * directory. */ public void read() { File prefFile = new File(SystemProperties.getProperty("user.home"), PREF_FILE_NAME); if (!prefFile.exists() || !prefFile.isFile()) { return; } try { read(new FileInputStream(prefFile)); } catch (IOException e) { // Ignore - just use default preferences } }
public FindRefComparison(BugReporter bugReporter) { this.bugReporter = bugReporter; this.bugAccumulator = new BugAccumulator(bugReporter); this.suspiciousSet = new HashSet<>(DEFAULT_SUSPICIOUS_SET); // Check frc.suspicious system property for additional suspicious types // to check String extraSuspiciousTypes = SystemProperties.getProperty("frc.suspicious"); if (extraSuspiciousTypes != null) { StringTokenizer tok = new StringTokenizer(extraSuspiciousTypes, ","); while (tok.hasMoreTokens()) { suspiciousSet.add(tok.nextToken()); } } testingEnabled = SystemProperties.getBoolean("report_TESTING_pattern_in_standard_detectors"); }
private LinkedList<WorkListItem> buildSystemCodebaseList() { // This method is based on the // org.apache.bcel.util.ClassPath.getClassPath() // method. LinkedList<WorkListItem> workList = new LinkedList<>(); String bootClassPath = SystemProperties.getProperty("sun.boot.class.path"); // Seed worklist with system codebases. // addWorkListItemsForClasspath(workList, // SystemProperties.getProperty("java.class.path")); addWorkListItemsForClasspath(workList, bootClassPath); String extPath = SystemProperties.getProperty("java.ext.dirs"); if (extPath != null) { StringTokenizer st = new StringTokenizer(extPath, File.pathSeparator); while (st.hasMoreTokens()) { String extDir = st.nextToken(); addWorkListItemsForExtDir(workList, extDir); } } if(isJava9orLater()){ Path jrtFsJar = Paths.get(System.getProperty("java.home", ""), "lib/jrt-fs.jar"); if(Files.isRegularFile(jrtFsJar)){ addWorkListItemsForClasspath(workList, jrtFsJar.toString()); } } return workList; }
String slash = SystemProperties.getProperty("file.separator"); if (root.equals(base)) { return "." + SystemProperties.getProperty("file.separator") + srcFile.substring(base.length());
private LinkedList<WorkListItem> buildFindBugsFullJarCodebaseList() { String findbugsFullJar = ClassPathUtil.findCodeBaseInClassPath("findbugs-full.jar", SystemProperties.getProperty("java.class.path")); LinkedList<WorkListItem> workList = new LinkedList<>(); if (findbugsFullJar != null) { // // Found findbugs-full.jar: add it to the aux classpath. // (This is a bit weird, since we only want to resolve a subset // of its classes.) // ICodeBaseLocator loc = new FilesystemCodeBaseLocator(findbugsFullJar); workList.addLast(new WorkListItem(loc, false, ICodeBase.Discovered.IN_SYSTEM_CLASSPATH)); } return workList; }
SystemProperties.getProperty("java.class.path")); if (findbugsJarCodeBase != null) { File findbugsJar = new File(findbugsJarCodeBase);
String javaClassPath = SystemProperties.getProperty("java.class.path"); StringTokenizer t = new StringTokenizer(javaClassPath, File.pathSeparator); while (t.hasMoreTokens()) {
private static File getFindbugsTestCases() { final File f = new File(SystemProperties.getProperty("spotbugsTestCases.home", "../spotbugsTestCases")); assertTrue("'spotbugsTestCases' directory not found", f.exists()); assertTrue(f.isDirectory()); assertTrue(f.canRead()); return f; }
public File getFindbugsTestCases() { if (spotbugsTestCases != null) { return spotbugsTestCases; } File f = new File(SystemProperties.getProperty("spotbugsTestCases.home", "../spotbugsTestCases")); Assume.assumeTrue(f.exists()); Assume.assumeTrue(f.isDirectory()); Assume.assumeTrue(f.canRead()); spotbugsTestCases = f; return f; }
String methodName = SystemProperties.getProperty("cfgbuilder.method");
public static void main(String args[]) throws Exception { String u = SystemProperties.getProperty("findbugs.browserTestURL", "http://findbugs.sourceforge.net/"); url = new URL(u); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); }
private String getMajorJavaVersion() { String ver = SystemProperties.getProperty("java.version", ""); Matcher m = Pattern.compile("^\\d+\\.\\d+").matcher(ver); if (m.find()) { return m.group(); } return ""; }