jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1329669 - /jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java
Date Tue, 24 Apr 2012 12:24:25 GMT
Author: sebb
Date: Tue Apr 24 12:24:25 2012
New Revision: 1329669

URL: http://svn.apache.org/viewvc?rev=1329669&view=rev
Log:
Bug 52997 - Jmeter should not exit without saving Test Plan if saving before exit fails

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java?rev=1329669&r1=1329668&r2=1329669&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java Tue Apr 24 12:24:25 2012
@@ -124,34 +124,27 @@ public class Save implements Command {
                 GuiPackage.getInstance().setTestPlanFile(updateFile);
             }
         }
-        // TODO: doesn't putting this here mark the tree as
-        // saved even though a failure may occur later?
 
-        ActionRouter.getInstance().doActionNow(new ActionEvent(subTree, e.getID(), ActionNames.SUB_TREE_SAVED));
         try {
             convertSubTree(subTree);
         } catch (Exception err) {
+            log.warn("Error converting subtree "+err);
         }
+
         FileOutputStream ostream = null;
         try {
-            File outFile = new File(updateFile);
-            if(!outFile.canWrite()) {
-                throw new IllegalUserActionException("File cannot be written: " + outFile.getAbsolutePath());
-            }
             ostream = new FileOutputStream(updateFile);
             SaveService.saveTree(subTree, ostream);
+            ActionRouter.getInstance().doActionNow(new ActionEvent(subTree, e.getID(), ActionNames.SUB_TREE_SAVED));
         } catch (Throwable ex) {
             log.error("", ex);
             if (ex instanceof Error){
                 throw (Error) ex;
             }
-            GuiPackage guiPack = GuiPackage.getInstance();
-            guiPack.setDirty(true);
-            guiPack.setTestPlanFile(null);
             if (ex instanceof RuntimeException){
                 throw (RuntimeException) ex;
             }
-            throw new IllegalUserActionException("Couldn't save test plan to file: " + updateFile);
+            throw new IllegalUserActionException("Couldn't save test plan to file: " + updateFile,
ex);
         } finally {
             JOrphanUtils.closeQuietly(ostream);
         }



Mime
View raw message