Kevin Archie avatar Kevin Archie committed ef29d00

assigment value should be evaluated on pre-modification object

Comments (0)

Files changed (3)

   <groupId>org.nrg</groupId>
   <artifactId>DicomEdit</artifactId>
   <packaging>jar</packaging>
-  <version>2.1.1</version>
+  <version>2.1.2</version>
   <name>DicomEdit</name>
   <description>Language for modifying DICOM metadata</description>
   <url>http://nrg.wustl.edu</url>
       <url>http://maven.xnat.org/libs-release</url>
     </repository>
   </repositories>
+  <distributionManagement>
+    <repository>
+      <id>XNAT Server</id>
+      <name>XNAT Maven Library Release</name>
+      <url>http://maven.xnat.org/libs-release-local</url>
+    </repository>
+  </distributionManagement>
   <dependencies>
     <dependency>
       <groupId>junit</groupId>

src/main/java/org/nrg/dcm/edit/Assignment.java

      * (non-Javadoc)
      * @see org.nrg.dcm.edit.Operation#makeAction(org.dcm4che2.data.DicomObject)
      */
-    public Action makeAction(final DicomObject o) throws AttributeException {
+    public Action makeAction(final DicomObject o) throws ScriptEvaluationException {
+        final String v = value.on(o);
         return new Action() {
             public void apply() throws ScriptEvaluationException {
                 try {
-                    o.putString(new int[]{tag}, o.vrOf(tag), value.on(o));
+                    o.putString(new int[]{tag}, o.vrOf(tag), v);
                 } catch (UnsupportedOperationException e) {
                     throw new ScriptEvaluationException("Unable to set attribute "
-                            + TagUtils.toString(tag) + " to \"" + value.on(o) + "\"", e);
+                            + TagUtils.toString(tag) + " to \"" + v + "\"", e);
                 }
             }
 

src/main/java/org/nrg/dcm/edit/Operation.java

      * @return
      * @throws AttributeException
      */
-    Action makeAction(DicomObject o) throws AttributeException;
+    Action makeAction(DicomObject o) throws AttributeException,ScriptEvaluationException;
 
     /**
      * Compute the value that results from applying this Operation to
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.