Bug #6634
closedError message popup not generated when saving to a write protected directory.
Description
In the Kepler GUI a message popup window should appear when the saving of a file fails.
To reproduce the problem, run the following commands in a POSIX terminal (on Fedora 20 in this case):
curl https://code.kepler-project.org/code/kepler/releases/installers/2.4/kepler-2.4-linux.tar.gz | tar xzf -
mkdir my_workspace
chmod -w my_workspace
cp ./kepler-2.4/common-2.4.0/configs/ptolemy/configs/kepler/configuration.xml original_configuration.xml
cat original_configuration.xml | head -n 257 > ./kepler-2.4/common-2.4.0/configs/ptolemy/configs/kepler/configuration.xml
echo " <property name=\"_alternateDefaultOpenDirectory\" value=\"`pwd`/my_workspace\" class=\"ptolemy.kernel.util.StringAttribute\"/>" >> ./kepler-2.4/common-2.4.0/configs/ptolemy/configs/kepler/configuration.xml
cat original_configuration.xml | tail -n 1 >> ./kepler-2.4/common-2.4.0/configs/ptolemy/configs/kepler/configuration.xml
./kepler-2.4/kepler.sh
Once Kepler has started (you might have to close the initial "welcome"/"upgrade" popup windows), follow these instructions:
Click on the "File->Save" item from the menu bar.
Click on the "OK" button in the "Please enter a name for this workflow" pupup window.
Click on the "Save" button in the "Save" popup window.
No error message popup appears, even though there is a log message in the terminal about "permission denied".
Updated by Artur Szostak about 10 years ago
Note: got the formatting wrong in the previous post. The terminal commands should be:
curl https://code.kepler-project.org/code/kepler/releases/installers/2.4/kepler-2.4-linux.tar.gz | tar xzf -
mkdir my_workspace
chmod -w my_workspace
cp ./kepler-2.4/common-2.4.0/configs/ptolemy/configs/kepler/configuration.xml original_configuration.xml
cat original_configuration.xml | head -n 257 > ./kepler-2.4/common-2.4.0/configs/ptolemy/configs/kepler/configuration.xml
echo " <property name=\"_alternateDefaultOpenDirectory\" value=\"`pwd`/my_workspace\" class=\"ptolemy.kernel.util.StringAttribute\"/>" >> ./kepler-2.4/common-2.4.0/configs/ptolemy/configs/kepler/configuration.xml
cat original_configuration.xml | tail -n 1 >> ./kepler-2.4/common-2.4.0/configs/ptolemy/configs/kepler/configuration.xml
./kepler-2.4/kepler.sh
Updated by Christopher Brooks almost 9 years ago
- Assignee set to Christopher Brooks
- Target version changed from 2.4.0 to 2.6.0
I verified that Kepler-2.5 conntinues exhibit this bug where saving to a read-only directory results in a message to stdout.
Ptolemy II does not have this problem.
I just fixed this problem in the Kepler devel head.
To replicate with Kepler-2.5 (note that the case of the file and directory changed from kepler-2.4 to Kepler-2.5), use:
curl https://code.kepler-project.org/code/kepler/releases/installers/2.5/Kepler-2.5-linux.tar.gz | tar xzf - mkdir my_workspace chmod -w my_workspace cp ./Kepler-2.5/common-2.5.0/configs/ptolemy/configs/kepler/configuration.xml original_configuration.xml cat original_configuration.xml | head -n 257 > ./Kepler-2.5/common-2.5.0/configs/ptolemy/configs/kepler/configuration.xml echo " <property name=\"_alternateDefaultOpenDirectory\" value=\"`pwd`/my_workspace\" class=\"ptolemy.kernel.util.StringAttribute\"/>" >> ./Kepler-2.5/common-2.5.0/configs/ptolemy/configs/kepler/configuration.xml cat original_configuration.xml | tail -n 1 >> ./Kepler-2.5/common-2.5.0/configs/ptolemy/configs/kepler/configuration.xml ./Kepler-2.5/kepler.sh
See the original bug report for how to replicate.
The error is that when a workflow is stored in a unwritable directory the following appears in the console, but no dialog is popped up:
[run] Initializing Library Panel. [run] *** Attempting to get ResourceBundle for SVG defaults *** [run] *** svgRenderingMethod = SVG_BATIK_RENDERING *** [run] Checking for patches... [run] java.io.FileNotFoundException: /home/cxh/src/keplerbug2/my_workspace/Unnamed1.kar (Permission denied) [run] at java.io.FileOutputStream.open0(Native Method) [run] at java.io.FileOutputStream.open(FileOutputStream.java:270) [run] at java.io.FileOutputStream.<init>(FileOutputStream.java:213) [run] at java.io.FileOutputStream.<init>(FileOutputStream.java:162) [run] at org.kepler.kar.KARBuilder.writeKARFile(KARBuilder.java:457) [run] at org.kepler.kar.KARBuilder.generateKAR(KARBuilder.java:380) [run] at org.kepler.kar.SaveKAR.saveToDisk(SaveKAR.java:154) [run] at org.kepler.gui.kar.ExportArchiveAction.actionPerformed(ExportArchiveAction.java:432) [run] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) [run] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) [run] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) [run] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) [run] at javax.swing.AbstractButton.doClick(AbstractButton.java:376) [run] at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833) [run] at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877) [run] at java.awt.Component.processMouseEvent(Component.java:6535) [run] at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) [run] at java.awt.Component.processEvent(Component.java:6300) [run] at java.awt.Container.processEvent(Container.java:2236) [run] at java.awt.Component.dispatchEventImpl(Component.java:4891) [run] at java.awt.Container.dispatchEventImpl(Container.java:2294) [run] at java.awt.Component.dispatchEvent(Component.java:4713) [run] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) [run] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) [run] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) [run] at java.awt.Container.dispatchEventImpl(Container.java:2280) [run] at java.awt.Window.dispatchEventImpl(Window.java:2750) [run] at java.awt.Component.dispatchEvent(Component.java:4713) [run] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) [run] at java.awt.EventQueue.access$500(EventQueue.java:97) [run] at java.awt.EventQueue$3.run(EventQueue.java:709) [run] at java.awt.EventQueue$3.run(EventQueue.java:703) [run] at java.security.AccessController.doPrivileged(Native Method) [run] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) [run] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) [run] at java.awt.EventQueue$4.run(EventQueue.java:731) [run] at java.awt.EventQueue$4.run(EventQueue.java:729) [run] at java.security.AccessController.doPrivileged(Native Method) [run] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) [run] at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) [run] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) [run] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) [run] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) [run] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [run] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) [run] at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) [run] ptolemy.kernel.util.IllegalActionException: Error building the KAR file.: /home/cxh/src/keplerbug2/my_workspace/Unnamed1.kar (Permission denied) [run] at org.kepler.kar.KARBuilder.generateKAR(KARBuilder.java:384) [run] at org.kepler.kar.SaveKAR.saveToDisk(SaveKAR.java:154) [run] at org.kepler.gui.kar.ExportArchiveAction.actionPerformed(ExportArchiveAction.java:432) [run] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) [run] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) [run] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) [run] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) [run] at javax.swing.AbstractButton.doClick(AbstractButton.java:376) [run] at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833) [run] at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877) [run] at java.awt.Component.processMouseEvent(Component.java:6535) [run] at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) [run] at java.awt.Component.processEvent(Component.java:6300) [run] at java.awt.Container.processEvent(Container.java:2236) [run] at java.awt.Component.dispatchEventImpl(Component.java:4891) [run] at java.awt.Container.dispatchEventImpl(Container.java:2294) [run] at java.awt.Component.dispatchEvent(Component.java:4713) [run] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) [run] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) [run] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) [run] at java.awt.Container.dispatchEventImpl(Container.java:2280) [run] at java.awt.Window.dispatchEventImpl(Window.java:2750) [run] at java.awt.Component.dispatchEvent(Component.java:4713) [run] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) [run] at java.awt.EventQueue.access$500(EventQueue.java:97) [run] at java.awt.EventQueue$3.run(EventQueue.java:709) [run] at java.awt.EventQueue$3.run(EventQueue.java:703) [run] at java.security.AccessController.doPrivileged(Native Method) [run] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) [run] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) [run] at java.awt.EventQueue$4.run(EventQueue.java:731) [run] at java.awt.EventQueue$4.run(EventQueue.java:729) [run] at java.security.AccessController.doPrivileged(Native Method) [run] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) [run] at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) [run] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) [run] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) [run] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) [run] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [run] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) [run] at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) [run] ERROR (org.kepler.kar.SaveKAR:saveToDisk:163) Failed to create kar file: Error building the KAR file.: /home/cxh/src/keplerbug2/my_workspace/Unnamed1.kar (Permission denied) [run] INFO (org.kepler.objectmanager.repository.RepositoryManager:<init>:118) adding repository localRepository [run] INFO (org.kepler.objectmanager.repository.RepositoryManager:<init>:118) adding repository keplerRepository [run] java.io.FileNotFoundException: /home/cxh/src/keplerbug2/my_workspace/Unnamed1.kar (No such file or directory) [run] at java.util.zip.ZipFile.open(Native Method) [run] at java.util.zip.ZipFile.<init>(ZipFile.java:219) [run] at java.util.zip.ZipFile.<init>(ZipFile.java:149) [run] at java.util.jar.JarFile.<init>(JarFile.java:166) [run] at java.util.jar.JarFile.<init>(JarFile.java:130) [run] at org.kepler.kar.KARFile.<init>(KARFile.java:192) [run] at org.kepler.gui.kar.ExportArchiveAction.actionPerformed(ExportArchiveAction.java:537) [run] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) [run] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) [run] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) [run] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) [run] at javax.swing.AbstractButton.doClick(AbstractButton.java:376) [run] at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833) [run] at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877) [run] at java.awt.Component.processMouseEvent(Component.java:6535) [run] at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) [run] at java.awt.Component.processEvent(Component.java:6300) [run] at java.awt.Container.processEvent(Container.java:2236) [run] at java.awt.Component.dispatchEventImpl(Component.java:4891) [run] at java.awt.Container.dispatchEventImpl(Container.java:2294) [run] at java.awt.Component.dispatchEvent(Component.java:4713) [run] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) [run] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) [run] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) [run] at java.awt.Container.dispatchEventImpl(Container.java:2280) [run] at java.awt.Window.dispatchEventImpl(Window.java:2750) [run] at java.awt.Component.dispatchEvent(Component.java:4713) [run] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) [run] at java.awt.EventQueue.access$500(EventQueue.java:97) [run] at java.awt.EventQueue$3.run(EventQueue.java:709) [run] at java.awt.EventQueue$3.run(EventQueue.java:703) [run] at java.security.AccessController.doPrivileged(Native Method) [run] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) [run] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) [run] at java.awt.EventQueue$4.run(EventQueue.java:731) [run] at java.awt.EventQueue$4.run(EventQueue.java:729) [run] at java.security.AccessController.doPrivileged(Native Method) [run] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) [run] at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) [run] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) [run] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) [run] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) [run] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [run] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) [run] at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Ptolemy II correctly handles this by popping up a dialog with the stack trace button. The Ptolemy II Vergil exception that is displayed in a stack trace dialog is:
java.io.FileNotFoundException: /home/cxh/src/keplerbug2/my_workspace/model.xml (Permission denied) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(FileOutputStream.java:270) at java.io.FileOutputStream.<init>(FileOutputStream.java:213) at java.io.FileOutputStream.<init>(FileOutputStream.java:162) at java.io.FileWriter.<init>(FileWriter.java:90) at ptolemy.actor.gui.PtolemyEffigy.writeFile(PtolemyEffigy.java:215) at ptolemy.actor.gui.PtolemyFrame._writeFile(PtolemyFrame.java:493) at ptolemy.vergil.basic.BasicGraphFrame._writeFile(BasicGraphFrame.java:3313) at ptolemy.actor.gui.TableauFrame._saveAsHelperCommon(TableauFrame.java:1289) at ptolemy.actor.gui.TableauFrame._saveAsHelperJFileChooser(TableauFrame.java:1482) at ptolemy.actor.gui.TableauFrame._saveAsHelper(TableauFrame.java:1165) at ptolemy.actor.gui.TableauFrame._saveAs(TableauFrame.java:1139) at ptolemy.actor.gui.PtolemyFrame._saveAs(PtolemyFrame.java:390) at ptolemy.gui.Top$FileMenuListener.actionPerformed(Top.java:1446) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.AbstractButton.doClick(AbstractButton.java:376) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877) at java.awt.Component.processMouseEvent(Component.java:6535) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6300) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4891) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4713) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2750) at java.awt.Component.dispatchEvent(Component.java:4713) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) 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:76) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.awt.EventQueue$4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) 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)
ptolemy.actor.Top.FileMenuListener.actionPerformed() looks like:
try { if (actionCommand.equals("Open File")) { _open(); } else if (actionCommand.equals("Open URL")) { _openURL(); } else if (actionCommand.equals("Save")) { _save(); } else if (actionCommand.equals("Save As")) { _saveAs(); } else if (actionCommand.equals("Print")) { _print(); } else if (actionCommand.equals("Close")) { if (!isDisposed()) { Window thisWindow = Top.this; WindowEvent wev = new WindowEvent(thisWindow, WindowEvent.WINDOW_CLOSING); Toolkit toolkit = Toolkit.getDefaultToolkit(); EventQueue queue = toolkit.getSystemEventQueue(); queue.postEvent(wev); } } else if (actionCommand.equals("Exit")) { _exit(); } } catch (Throwable throwable) { // If we do not catch exceptions here, then they // disappear to stdout, which is bad if we launched // where there is no stdout visible. MessageHandler.error("File Menu Exception:", throwable); }
kepler/gui/src/org/kepler/gui/kar/ExportArchiveAction.java has:
try { for (ComponentEntity initiator : _saveInitiatorObjs) { karBuilder.addSaveInitiator(initiator); } karBuilder.setRegisterLSID(false); karBuilder.setRevision(false); if (_specificLSID != null) { karBuilder.setKarLSID(_specificLSID); } karBuilder.generateKAR(tableauFrame, overrideModDeps); // Update the File in case KARBuilder changes it for some reason _karFile = karBuilder.getKarFile(); // return the new lsid return karBuilder.getKarLSID(); } catch (Exception ex) { log.error("Failed to create kar file: " + ex.getMessage()); ex.printStackTrace(); } return null;
I added the above to the catch block:
// If we do not catch exceptions here, then they // disappear to stdout, which is bad if we launched // where there is no stdout visible. // See https://projects.ecoinformatics.org/ecoinfo/issues/6634 MessageHandler.error("Failed to create KAR file:", ex);
In general, there are many printStackTrace() calls in this code, which means that the user will not see the exception when the error occurs when Kepler is started from an icon.
Updated by Christopher Brooks almost 9 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
I'm closing this bug.