Inspection Gadgets: NullPointer

private method AllowedListValue loadFromResultSet(ResultSet rs)

Problem synopsis:
          Boolean constructor call new Boolean(rs.getInt(7) ==1) at line 105
Problem resolution:
          Replace with Boolean.valueOf()

Doing the automated replace through the exception :(



java.lang.NullPointerException
at com.intellij.psi.impl.source.e.e.c(e.java:149)
at com.intellij.psi.impl.source.a.r.a(r.java:65)
at com.intellij.psi.impl.source.a.s.replace(s.java:77)
at com.siyeh.ig.InspectionGadgetsFix.replaceExpression(InspectionGadgetsFix.java:20)
at com.siyeh.ig.performance.BooleanConstructorInspection$BooleanConstructorFix.applyFix(BooleanConstructorInspection.java:58)
at com.intellij.codeInspection.r.e$10.run(e$10.java:0)
at com.intellij.openapi.command.impl.a.executeCommand(a.java:12)
at com.intellij.codeInspection.r.e$3.run(e$3.java:2)
at com.intellij.openapi.application.a.b.runWriteAction(b.java:290)
at com.intellij.codeInspection.r.e.b(e.java:129)
at com.intellij.codeInspection.r.e.l(e.java:267)
at com.intellij.codeInspection.r.d$3.hyperlinkUpdate(d$3.java:16)
at javax.swing.JEditorPane.fireHyperlinkUpdate(JEditorPane.java:318)
at javax.swing.text.html.HTMLEditorKit$LinkController.activateLink(HTMLEditorKit.java:798)
at javax.swing.text.html.HTMLEditorKit$LinkController.mouseClicked(HTMLEditorKit.java:608)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
at java.awt.Component.processMouseEvent(Component.java:5103)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3207)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at com.intellij.ide.q.b(q.java:61)
at com.intellij.ide.q.a(q.java:9)
at com.intellij.ide.q.dispatchEvent(q.java:50)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

1 comment

Got an NPE here too but with:

Name: private method void scrape() Location:
CurrentConditions (gov.hhs.portal.weather) Problem
synopsis: " " can be replaced by ' ' at line 332 Problem
resolution: Replace with character

NPE:

java.lang.NullPointerException

at com.intellij.psi.impl.source.e.e.c(e.java:149)

at com.intellij.psi.impl.source.a.r.a(r.java:65)

at com.intellij.psi.impl.source.a.s.replace(s.java:77)

at
com.siyeh.ig.InspectionGadgetsFix.replaceExpression(InspectionGadgetsFix.java:20)

at
com.siyeh.ig.performance.LengthOneStringsInConcatenationInspection$ReplaceStringsWithCharsFix.applyFix(LengthOneStringsInConcatenationInspection.java:68)

at com.intellij.codeInspection.r.e$10.run(e$10.java:0)

at com.intellij.openapi.command.impl.a.executeCommand(a.java:12)

at com.intellij.codeInspection.r.e$3.run(e$3.java:2)

at com.intellij.openapi.application.a.b.runWriteAction(b.java:290)

at com.intellij.codeInspection.r.e.b(e.java:129)

at com.intellij.codeInspection.r.e.l(e.java:281)

at com.intellij.codeInspection.r.d$3.hyperlinkUpdate(d$3.java:16)

at javax.swing.JEditorPane.fireHyperlinkUpdate(JEditorPane.java:318)

at
javax.swing.text.html.HTMLEditorKit$LinkController.activateLink(HTMLEditorKit.java:798)

at
javax.swing.text.html.HTMLEditorKit$LinkController.mouseClicked(HTMLEditorKit.java:608)

at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)

at java.awt.Component.processMouseEvent(Component.java:5103)

at java.awt.Component.processEvent(Component.java:4897)

at java.awt.Container.processEvent(Container.java:1569)

at java.awt.Component.dispatchEventImpl(Component.java:3615)

at java.awt.Container.dispatchEventImpl(Container.java:1627)

at java.awt.Component.dispatchEvent(Component.java:3477)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3207)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)

at java.awt.Container.dispatchEventImpl(Container.java:1613)

at java.awt.Window.dispatchEventImpl(Window.java:1606)

at java.awt.Component.dispatchEvent(Component.java:3477)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)

at com.intellij.ide.q.b(q.java:61)

at com.intellij.ide.q.a(q.java:9)

at com.intellij.ide.q.dispatchEvent(q.java:50)

at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)

at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

0

Please sign in to leave a comment.