From: SourceForge.net <no...@so...> - 2006-11-24 21:27:27
|
Bugs item #1602469, was opened at 2006-11-24 21:27 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1602469&group_id=44253 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: User interface Group: 4: Serious Status: Open Resolution: None Priority: 5 Private: No Submitted By: anthonl (anthonl) Assigned to: Nobody/Anonymous (nobody) Summary: Null Pointer Exception Initial Comment: After downloading the DrJava source code, the bug can be found in the src directory in edu.rice.cs.drjava.ui.ProjectPropertiesFrame.saveSettings() at lines 211-212. That code is: if (_projRootSelector.getFileField().getText().equals("")) pr = null; if (!pr.equals(_model.getProjectRoot())) { If the body of the first if statement were to execute, the variable pr will be set to null. In the condition of the second if statement, a null pointer dereference will occur. A possible fix is to insert an if statement in between the two to check if the variable pr is null. The fixed code is: if (_projRootSelector.getFileField().getText().equals("")) pr = null; if ( pr != null ) { if (!pr.equals(_model.getProjectRoot())) { _model.setProjectRoot(pr); projRootChanged = true; } } Attached is the test case (named ProjectPropertiesFrameTest.java) that fails without the patch and passes with the patch. Put the test case in the src/edu/rice/cs/drjava/ui directory. Try to build DrJava. The build should fail because the test case that was just added should fail. Now fix the bug. Try to build DrJava. The test case should pass and the build should succeed. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=438935&aid=1602469&group_id=44253 |