-
Notifications
You must be signed in to change notification settings - Fork 601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassFormatException: Constant pool at index 0 is null #60
Comments
I will try to reproduce this in |
I'm still testing #61, which is necessary to test your class with our integration test. Here is current patch: diff --git a/findbugs/src/test/java/edu/umd/cs/findbugs/detect/FindUnsatisfiedObligationTest.java b/findbugs/src/test/java/edu/umd/cs/findbugs/detect/FindUnsatisfiedObligationTest.java
new file mode 100644
index 0000000..a767df9
--- /dev/null
+++ b/findbugs/src/test/java/edu/umd/cs/findbugs/detect/FindUnsatisfiedObligationTest.java
@@ -0,0 +1,22 @@
+package edu.umd.cs.findbugs.detect;
+
+import static org.junit.Assert.assertThat;
+
+import static org.hamcrest.core.Is.is;
+
+import static org.hamcrest.collection.IsEmptyIterable.*;
+import org.junit.Test;
+
+import edu.umd.cs.findbugs.AbstractIntegrationTest;
+
+public class FindUnsatisfiedObligationTest extends AbstractIntegrationTest {
+ /**
+ * @see <a href="https://github.com/spotbugs/spotbugs/issues/60">GitHub
+ * issue</a>
+ */
+ @Test
+ public void testIssue60() {
+ performAnalysis("Issue60.class");
+ assertThat(getBugCollection(), is(emptyIterable()));
+ }
+}
diff --git a/findbugsTestCases/src/java/Issue60.java b/findbugsTestCases/src/java/Issue60.java
new file mode 100644
index 0000000..b79f1b8
--- /dev/null
+++ b/findbugsTestCases/src/java/Issue60.java
@@ -0,0 +1,22 @@
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Properties;
+import java.util.stream.Stream;
+
+public class Issue60 {
+
+ public static void create(URL url) {
+ try (InputStream in = url.openStream()) {
+ Properties p1 = new Properties();
+ p1.load(in);
+ } catch (IOException e) {
+ }
+ }
+
+ public Stream<String> keys() {
+ return Stream.<Properties> of()
+ .flatMap(p -> p.stringPropertyNames().stream());
+ }
+
+} |
By #69, I confirmed that current |
@KengoTODA the exception does occur, but is managed and simply logged to stderr without the test failing. |
@jsotuyod Oh... I also confirmed this behaviour. I will try to update |
Running
And in the constant pool we can see:
This happens because the This is a bug on BCEL, that should override In the meantime, we may rewrite the detector to handle |
yeah, should add a bug here http://issues.apache.org/jira/browse/BCEL |
i suppose it should return Object?or....? i'll add it. |
You are amazing! Thanks for the quick fix I guess for the time being we can wait for a BCEL 6.1 release / use a snapshot until we reach the point of releasing Spotbugs 3.1.0 |
This problem should be solved by #69. I will close this issue. |
The problem described in findbugsproject/findbugs#141 also affects spotbugs, I just verified it with a current snapshot. The analysis of the following code fails:
Stacktrace:
Thanks!
The text was updated successfully, but these errors were encountered: