jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1330275 - /jmeter/trunk/src/core/org/apache/jmeter/gui/action/Save.java
Date Wed, 25 Apr 2012 13:26:17 GMT
Author: sebb
Date: Wed Apr 25 13:26:16 2012
New Revision: 1330275

URL: http://svn.apache.org/viewvc?rev=1330275&view=rev
Log:
Bug 52997 - Jmeter should not exit without saving Test Plan if saving before exit fails
Fix crash with larger trees; only update saved copy of tree if we wrote the whole tree

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=1330275&r1=1330274&r2=1330275&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 Wed Apr 25 13:26:16 2012
@@ -78,6 +78,7 @@ public class Save implements Command {
 
     public void doAction(ActionEvent e) throws IllegalUserActionException {
         HashTree subTree = null;
+        boolean fullSave = false; // are we saving the whole tree?
         if (!commands.contains(e.getActionCommand())) {
             throw new IllegalUserActionException("Invalid user command:" + e.getActionCommand());
         }
@@ -91,6 +92,7 @@ public class Save implements Command {
             }
             subTree = GuiPackage.getInstance().getCurrentSubTree();
         } else {
+            fullSave = true;
             subTree = GuiPackage.getInstance().getTreeModel().getTestPlan();
         }
 
@@ -135,9 +137,12 @@ public class Save implements Command {
         try {
             ostream = new FileOutputStream(updateFile);
             SaveService.saveTree(subTree, ostream);
-            ActionRouter.getInstance().doActionNow(new ActionEvent(subTree, e.getID(), ActionNames.SUB_TREE_SAVED));
+            if (fullSave) { // Only update the stored copy of the tree for a full save
+                subTree = GuiPackage.getInstance().getTreeModel().getTestPlan(); // refetch,
because convertSubTree affects it
+                ActionRouter.getInstance().doActionNow(new ActionEvent(subTree, e.getID(),
ActionNames.SUB_TREE_SAVED));
+            }
         } catch (Throwable ex) {
-            log.error("", ex);
+            log.error("Error saving tree:", ex);
             if (ex instanceof Error){
                 throw (Error) ex;
             }



Mime
View raw message