In BatchSearch.getVerifiedSpans, catch all exceptions so if processing of one file breaks, the processing of other files continues.
1.1 --- a/api/src/org/netbeans/modules/jackpot30/impl/batch/BatchSearch.java Tue Jan 25 19:49:03 2011 +0100
1.2 +++ b/api/src/org/netbeans/modules/jackpot30/impl/batch/BatchSearch.java Tue Jan 25 19:49:04 2011 +0100
1.3 @@ -495,27 +495,38 @@
1.4 if (parameter.toPhase(Phase.PARSED).compareTo(Phase.PARSED) < 0)
1.5 return ;
1.6
1.7 - Context ctx = JavaSourceAccessor.getINSTANCE().getJavacTask(parameter).getContext();
1.8 - ClassReader reader = ClassReader.instance(ctx);
1.9 - Field attributeReaders = ClassReader.class.getDeclaredField("attributeReaders");
1.10 + boolean cont = true;
1.11
1.12 - attributeReaders.setAccessible(true);
1.13 - ((Map) attributeReaders.get(reader)).remove(Names.instance(ctx)._org_netbeans_ParameterNames);
1.14 - //workaround for #192481 end
1.15 + try {
1.16 + Context ctx = JavaSourceAccessor.getINSTANCE().getJavacTask(parameter).getContext();
1.17 + ClassReader reader = ClassReader.instance(ctx);
1.18 + Field attributeReaders = ClassReader.class.getDeclaredField("attributeReaders");
1.19
1.20 - if (parameter.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0)
1.21 - return ;
1.22 + attributeReaders.setAccessible(true);
1.23 + ((Map) attributeReaders.get(reader)).remove(Names.instance(ctx)._org_netbeans_ParameterNames);
1.24 + //workaround for #192481 end
1.25
1.26 - progress.setMessage("processing: " + FileUtil.getFileDisplayName(parameter.getFileObject()));
1.27 - Resource r = file2Resource.get(parameter.getFileObject());
1.28 - Map<PatternDescription, List<HintDescription>> sortedHintsPatterns = new HashMap<PatternDescription, List<HintDescription>>();
1.29 - Map<Kind, List<HintDescription>> sortedHintsKinds = new HashMap<Kind, List<HintDescription>>();
1.30 + if (parameter.toPhase(Phase.RESOLVED).compareTo(Phase.RESOLVED) < 0)
1.31 + return ;
1.32
1.33 - RulesManager.sortOut(r.hints, sortedHintsKinds, sortedHintsPatterns);
1.34 + progress.setMessage("processing: " + FileUtil.getFileDisplayName(parameter.getFileObject()));
1.35 + Resource r = file2Resource.get(parameter.getFileObject());
1.36 + Map<PatternDescription, List<HintDescription>> sortedHintsPatterns = new HashMap<PatternDescription, List<HintDescription>>();
1.37 + Map<Kind, List<HintDescription>> sortedHintsKinds = new HashMap<Kind, List<HintDescription>>();
1.38
1.39 - List<ErrorDescription> hints = new HintsInvoker(parameter, new AtomicBoolean()).computeHints(parameter, sortedHintsKinds, sortedHintsPatterns, problems);
1.40 + RulesManager.sortOut(r.hints, sortedHintsKinds, sortedHintsPatterns);
1.41
1.42 - if (callback.spansVerified(parameter, r, hints)) {
1.43 + List<ErrorDescription> hints = new HintsInvoker(parameter, new AtomicBoolean()).computeHints(parameter, sortedHintsKinds, sortedHintsPatterns, problems);
1.44 +
1.45 + cont = callback.spansVerified(parameter, r, hints);
1.46 + } catch (ThreadDeath td) {
1.47 + throw td;
1.48 + } catch (Throwable t) {
1.49 + LOG.log(Level.INFO, "Exception while performing batch processing in " + FileUtil.getFileDisplayName(parameter.getFileObject()), t);
1.50 + problems.add(new MessageImpl(MessageKind.WARNING, "An exception occurred while processing file: " + FileUtil.getFileDisplayName(parameter.getFileObject()) + " (" + t.getLocalizedMessage() + ")."));
1.51 + }
1.52 +
1.53 + if (cont) {
1.54 progress.tick();
1.55 currentPointer.incrementAndGet();
1.56 } else {