Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#13 IllegalArgumentException during analysis

closed
Keith Lea
None
5
2010-04-03
2009-12-03
Anderl
No

I've got Exceptions (java.lang.IllegalArgumentException: Didn't reach pc 51 of public static) during analyzing this source code.

public static WarehousePpc[] getDefinedStates() {
Field[] fields = WarehousePpc.class.getDeclaredFields();
ArrayList list = new ArrayList();
for (int i = 0; i < fields.length; i++) {
fields[i].setAccessible(true);
WarehousePpc value;
try {
// collect all constants in a list
if (fields[i].get(WarehousePpc.class) instanceof WarehousePpc) {
value = (WarehousePpc) fields[i].get(WarehousePpc.class);
if (value != null) {
list.add(value);
}
}
} catch (IllegalArgumentException e) {
// only catched
} catch (IllegalAccessException e) {
// only catched
}
}
return (WarehousePpc[]) list.toArray(new WarehousePpc[0]);
}

Stacktrace:
findbugs:
[findbugs] Executing findbugs from ant task
[findbugs] Running FindBugs...
[findbugs] The following errors occurred during analysis:
[findbugs] Exception analyzing de.klug_is.iwacs.ppc.communication.constants.WarehousePpc using detector edu.umd.cs.findbugs.detect.FindNullDeref
[findbugs] java.lang.IllegalArgumentException: Didn't reach pc 51 of public static de.klug_is.iwacs.ppc.communication.constants.WarehousePpc[] getDefinedStates()
[findbugs] At edu.umd.cs.findbugs.ba.OpcodeStackScanner.getStackAt(OpcodeStackScanner.java:51)
[findbugs] At edu.umd.cs.findbugs.detect.FindNullDeref.foundRedundantNullCheck(FindNullDeref.java:1063)
[findbugs] At edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder.examineRedundantBranches(NullDerefAndRedundantComparisonFinder.java:578)
[findbugs] At edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder.execute(NullDerefAndRedundantComparisonFinder.java:152)
[findbugs] At edu.umd.cs.findbugs.detect.FindNullDeref.analyzeMethod(FindNullDeref.java:278)
[findbugs] At edu.umd.cs.findbugs.detect.FindNullDeref.visitClassContext(FindNullDeref.java:205)
[findbugs] At edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:68)
[findbugs] At edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:979)
[findbugs] At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:230)
[findbugs] At edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:348)
[findbugs] At edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1057)
[findbugs] Warnings generated: 18
[findbugs] Calculating exit code...
[findbugs] Setting 'bugs found' flag (1)
[findbugs] Exit code set to: 1
[findbugs] Java Result: 1

Discussion

  • Keith Lea
    Keith Lea
    2010-03-17

    • assigned_to: nobody --> kano
    • status: open --> pending
     
  • Keith Lea
    Keith Lea
    2010-03-17

    I can't reproduce this - could you send a sample class file? What version of FindBugs?

     
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
    • status: pending --> closed