public SAXBugCollectionHandler(BugCollection bugCollection) { this(BUG_COLLECTION, bugCollection, bugCollection.getProject(), null); }
public SAXBugCollectionHandler(BugCollection bugCollection, @CheckForNull File base) { this(BUG_COLLECTION, bugCollection, bugCollection.getProject(), base); }
public Project getProject() { return bugCollection.getProject(); }
public SAXBugCollectionHandler(BugCollection bugCollection) { this(BUG_COLLECTION, bugCollection, bugCollection.getProject(), null); }
public SAXBugCollectionHandler(BugCollection bugCollection, @CheckForNull File base) { this(BUG_COLLECTION, bugCollection, bugCollection.getProject(), base); }
public static Cloud handleInitializationException(BugCollection bc, CloudPlugin plugin, Throwable e) { if (DEBUG) { bc.getProject().getGuiCallback().showMessageDialog("failed " + e.getMessage() + e.getClass().getName()); } LOGGER.log(Level.WARNING, "Could not load cloud plugin " + plugin, e); if (SystemProperties.getBoolean("findbugs.failIfUnableToConnectToCloud")) { System.exit(1); } return getPlainCloud(bc); }
@SwingThread void setBugCollection(BugCollection bugCollection) { setProjectAndBugCollection(bugCollection.getProject(), bugCollection); }
private Project getCurrentProject() { BugCollection bugCollection = MainFrame.getInstance().getBugCollection(); return bugCollection == null ? null : bugCollection.getProject(); }
@Override public IGuiCallback getGuiCallback() { return getBugCollection().getProject().getGuiCallback(); }
@Override public void analysisFinished(BugCollection results) { MainFrame instance = MainFrame.getInstance(); assert results.getProject() == project; instance.setBugCollection(results); try { instance.releaseDisplayWait(); } catch (Exception e) { Logger.getLogger(AnalyzingDialog.class.getName()).log(Level.FINE, "", e); } results.reinitializeCloud(); }
public boolean init() { Preferences prefs = Preferences.userNodeForPackage(PromptForNameLookup.class); String findbugsUser = prefs.get(USER_NAME, null); findbugsUser = bugCollection .getProject() .getGuiCallback() .showQuestionDialog( "Name/handle/email for recording your reviews?\n" + "(sorry, no authentication or confidentiality currently provided)", "Name for recording your reviews", findbugsUser == null ? "" : findbugsUser); if (findbugsUser != null) { prefs.put(USER_NAME, findbugsUser); username = findbugsUser; return true; } return false; }
static void addDeadBugMatcher(BugCollection bugCollection) { if (bugCollection == null || !bugCollection.hasDeadBugs()) { return; } Filter suppressionMatcher = bugCollection.getProject().getSuppressionFilter(); suppressionMatcher.softAdd(LastVersionMatcher.DEAD_BUG_MATCHER); }
public static void initializeCloud(BugCollection bc, Cloud cloud) throws IOException { IGuiCallback callback = bc.getProject().getGuiCallback(); if (!cloud.availableForInitialization()) { return; } if (DEBUG) { callback.showMessageDialog("attempting to initialize " + cloud.getClass().getName()); } if (!cloud.initialize()) { throw new IOException("Unable to connect to " + cloud.getCloudName()); } if (DEBUG) { callback.showMessageDialog("initialized " + cloud.getClass().getName()); } }
public static @Nonnull Cloud createCloudWithoutInitializing(BugCollection bc) { CloudPlugin plugin = getCloudPlugin(bc); if (plugin == null) { LOGGER.log(Level.FINE, "default cloud " + DEFAULT_CLOUD + " not registered"); return getPlainCloud(bc); } LOGGER.log(Level.FINE, "Using cloud plugin " + plugin.getId()); try { Class<? extends Cloud> cloudClass = plugin.getCloudClass(); Properties properties = bc.getProject().getCloudProperties(); Constructor<? extends Cloud> constructor = cloudClass.getConstructor(CloudPlugin.class, BugCollection.class, Properties.class); Cloud cloud = constructor.newInstance(plugin, bc, properties); if (DEBUG) { bc.getProject().getGuiCallback().showMessageDialog("constructed " + cloud.getClass().getName()); } LOGGER.log(Level.FINE, "constructed cloud plugin " + plugin.getId()); if (!cloud.availableForInitialization()) { handleInitializationException(bc, plugin, new IllegalStateException(cloud.getClass().getName() + " cloud " + plugin.getId()+ " doesn't have information needed for initialization")); } return cloud; } catch (InvocationTargetException e) { return handleInitializationException(bc, plugin, e.getCause()); } catch (Exception e) { return handleInitializationException(bc, plugin, e); } }
public static CloudPlugin getCloudPlugin(BugCollection bc) { CloudPlugin plugin = null; Project project = bc.getProject(); assert project != null; String cloudId = project.getCloudId(); if (cloudId != null) { plugin = DetectorFactoryCollection.instance().getRegisteredClouds().get(cloudId); if (plugin == null && FAIL_ON_CLOUD_ERROR) { throw new IllegalArgumentException("Cannot find registered cloud for " + cloudId); } } // is the desired plugin disabled for this project (and/or globally)? if so, skip it. if (plugin != null) { Plugin fbplugin = Plugin.getByPluginId(plugin.getFindbugsPluginId()); //noinspection PointlessBooleanExpression if (fbplugin != null && Boolean.FALSE.equals(project.getPluginStatus(fbplugin))) { plugin = null; // use default cloud below } } if (plugin == null) { if (DEFAULT_CLOUD != null) { LOGGER.log(Level.FINE, "Trying default cloud " + DEFAULT_CLOUD); } cloudId = DEFAULT_CLOUD; plugin = DetectorFactoryCollection.instance().getRegisteredClouds().get(cloudId); } return plugin; }
BufferedReader in = null; try { Project project = cloud.getBugCollection().getProject(); SourceFile sourceFile = project.getSourceFinder().findSourceFile(primarySource); in = UTF8.bufferedReader(sourceFile.getInputStream());
protected void changeCloud(String newCloudId) { final String oldCloudId = _bugCollection.getCloud().getPlugin().getId(); if (!oldCloudId.equals(newCloudId)) { _bugCollection.getProject().setCloudId(newCloudId); MainFrame.getInstance().setProjectChanged(true); backgroundExecutor.execute(new Runnable() { @Override public void run() { _bugCollection.reinitializeCloud(); Cloud cloud = _bugCollection.getCloud(); if (cloud != null) { cloud.waitUntilIssueDataDownloaded(); } updateCloudListeners(_bugCollection); refresh(); } }); refresh(); } }
@Override public void run() { try { cloud.signIn(); } catch (Exception e) { _bugCollection .getProject() .getGuiCallback() .showMessageDialog( "The FindBugs Cloud could not be contacted at this time.\n\n" + Util.getNetworkErrorMessage(e)); } refresh(); } });
if (bugCollection != null && bugCollection.getProject() != project) { Project p2 = bugCollection.getProject(); throw new IllegalArgumentException(String.format("project %x and bug collection %x don't match", System.identityHashCode(project), System.identityHashCode(p2)));
origCollection = new SortedBugCollection(); origCollection.readXML(args[0]); SourceFinder sourceFinder = new SourceFinder(origCollection.getProject());