You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by "Helge Weissig (JIRA)" <ji...@apache.org> on 2015/07/09 00:16:05 UTC

[jira] [Created] (TORQUE-338) Fix the saving of checksums when runOnlyOnSourceChange is set to true

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: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org