If you open a file by putting it on the command line
when launching DrJava, and if the path you gave was
relative, DrJava chokes when trying to compile the
file. (More precisely, when trying to get its source root.)
Here's the exception you get:
java.lang.RuntimeException: parent dir is null?!
at
edu.rice.cs.drjava.model.DefaultGlobalModel$DefinitionsDocumentHandler._getSourceRoot(DefaultGlobalModel.java:1118)
at
edu.rice.cs.drjava.model.DefaultGlobalModel$DefinitionsDocumentHandler.getSourceRoot(DefaultGlobalModel.java:1070)
at
edu.rice.cs.drjava.model.DefaultGlobalModel.getSourceRootSet(DefaultGlobalModel.java:668)
at
edu.rice.cs.drjava.model.DefaultGlobalModel._resetInteractionsClasspath(DefaultGlobalModel.java:1284)
at
edu.rice.cs.drjava.model.DefaultGlobalModel._restoreInteractionsState(DefaultGlobalModel.java:1302)
at
edu.rice.cs.drjava.model.DefaultGlobalModel.resetInteractions(DefaultGlobalModel.java:418)
at
edu.rice.cs.drjava.model.DefaultGlobalModel$DefinitionsDocumentHandler.startCompile(DefaultGlobalModel.java:932)
at
edu.rice.cs.drjava.ui.MainFrame._compile(MainFrame.java:643)
at
edu.rice.cs.drjava.ui.MainFrame.access$1000(MainFrame.java:67)
at
edu.rice.cs.drjava.ui.MainFrame$13.actionPerformed(MainFrame.java:250)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1767)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1820)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
at
javax.swing.AbstractButton.doClick(AbstractButton.java:289)
at
javax.swing.AbstractButton.doClick(AbstractButton.java:269)
at
javax.swing.plaf.basic.BasicMenuItemUI$ClickAction.actionPerformed(BasicMenuItemUI.java:1052)
at
javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1502)
at
javax.swing.JComponent.processKeyBinding(JComponent.java:2422)
at
javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:658)
at
javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:666)
at
javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:666)
at javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:642)
at
javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:253)
at
javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:240)
at
javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2499)
at
javax.swing.JComponent.processKeyBindings(JComponent.java:2491)
at
javax.swing.JComponent.processKeyEvent(JComponent.java:2385)
at java.awt.Component.processEvent(Component.java:4830)
at java.awt.Container.processEvent(Container.java:1380)
at java.awt.Component.dispatchEventImpl(Component.java:3526)
at java.awt.Container.dispatchEventImpl(Container.java:1437)
at java.awt.Component.dispatchEvent(Component.java:3367)
at
java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1700)
at
java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:568)
at
java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:739)
at
java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:673)
at
java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:534)
at java.awt.Component.dispatchEventImpl(Component.java:3396)
at java.awt.Container.dispatchEventImpl(Container.java:1437)
at java.awt.Window.dispatchEventImpl(Window.java:1566)
at java.awt.Component.dispatchEvent(Component.java:3367)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
The problem, I believe, is that the File needs to be
made absolute. I'll make DefaultGlobalModel convert the
file to absolute form before proceeding on an open
operation.
I'll make a test case for this before fixing it.
Logged In: YES
user_id=343403
Test case created as CommandLineTest.testRelativePath().
This test fails as of drjava-20020411-1734, throwing the
same exception as exhibited by this bug.
Logged In: YES
user_id=343403
Fixed in drjava-20020412-0055.