Uploaded image for project: 'BlueJ'
  1. BlueJ
  2. BLUEJ-949

Deleting class without source throws NPE

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: 4.0.1
    • Fix Version/s: 4.1.0
    • Component/s: ClassMgr
    • Sprint:
      4.1.0

      Description

      Attempting to delete from a project a class without source code throws a NullPointerException:

      Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
      	at bluej.pkgmgr.target.ClassTarget.prepareFilesForRemoval(ClassTarget.java:2351)
      	at bluej.pkgmgr.target.ClassTarget.prepareForRemoval(ClassTarget.java:2342)
      	at bluej.pkgmgr.target.ClassTarget.remove(ClassTarget.java:2379)
      	at bluej.pkgmgr.PkgMgrFrame.targetEvent(PkgMgrFrame.java:1575)
      	at bluej.pkgmgr.PackageEditor.fireTargetEvent(PackageEditor.java:213)
      	at bluej.pkgmgr.PackageEditor.raiseRemoveTargetEvent(PackageEditor.java:227)
      	at bluej.pkgmgr.target.ClassTarget$RemoveAction.lambda$3(ClassTarget.java:2121)
      	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
      	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
      	at java.awt.EventQueue.access$500(EventQueue.java:97)
      	at java.awt.EventQueue$3.run(EventQueue.java:709)
      	at java.awt.EventQueue$3.run(EventQueue.java:703)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
      	at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
      	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
      	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
      	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
      	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
      	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
      

      From a quick investigation it looks like the geSourceFile() method in ClassTarget has been changed so that it potentially returns null, but the callers have not been checked to see whether they need to handle a null return. I think there may be several potential problems due to this.

        Attachments

          Activity

            People

            • Assignee:
              hitech Hamza Hamza
              Reporter:
              davmac Davin McCall
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: