Helge Weissig created TORQUE-338:
------------------------------------

             Summary: Fix the saving of checksums when runOnlyOnSourceChange is 
set to true
                 Key: TORQUE-338
                 URL: https://issues.apache.org/jira/browse/TORQUE-338
             Project: Torque
          Issue Type: Bug
          Components: Generator
    Affects Versions: 4.1
            Reporter: Helge Weissig


The generator's Controller loops over a list of UnitDescriptors, each of which 
may have set the option to run only on a source change. Currently, the cached 
checksum file is overwritten by each successive call to 
processGenerationUnit(ControllerState, UnitConfiguration) resulting in only the 
last UnitDescriptor to be skipped on a subsequent run. The following patch to 
Checksums addresses this issue:
{code}
Index: 
torque-generator/src/main/java/org/apache/torque/generator/control/Checksums.java
===================================================================
--- 
torque-generator/src/main/java/org/apache/torque/generator/control/Checksums.java
   (revision 1689921)
+++ 
torque-generator/src/main/java/org/apache/torque/generator/control/Checksums.java
   (working copy)
@@ -128,6 +128,29 @@
         Set<String> keys = new HashSet<String>();
         keys.addAll(checksums.keySet());
         keys.addAll(modificationDates.keySet());
+        
+        Checksums existing = new Checksums();
+        existing.readFromFile(toWriteTo);
+        for (String key : existing.getChecksums().keySet())
+        {
+            if (keys.add(key))
+            {
+                checksums.put(key, existing.getChecksum(key));
+                if (existing.getModificationDate(key) != null)
+                {
+                    modificationDates.put(key, 
existing.getModificationDate(key));
+                }
+            }
+        }
+        
+        for (String key : existing.getModificationDates().keySet())
+        {
+            if (keys.add(key))
+            {
+                modificationDates.put(key, existing.getModificationDate(key));
+            }
+        }
+        
         StringBuilder content = new StringBuilder();
         for (String key : keys)
         {
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to