[java-xmltooling COMMIT] in /branches/REL_1: doc/RELEASE-NOTES.txt src/main/java/org/opensaml/xml/AbstractXMLObject.java

noreply at shibboleth.net noreply at shibboleth.net
Fri Jan 15 14:17:45 EST 2016


Author: putmanb
Date: Fri Jan 15 14:17:45 2016
New Revision: 858

URL: http://svn.shibboleth.net/view/java-xmltooling?rev=858&view=rev
Log:
JXT-123: AbstractXMLObject prepareForAssignment(String, String) should have variant that doesn't normalize input

Modified:
    branches/REL_1/doc/RELEASE-NOTES.txt
    branches/REL_1/src/main/java/org/opensaml/xml/AbstractXMLObject.java

Modified: branches/REL_1/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/doc/RELEASE-NOTES.txt?rev=858&r1=857&r2=858&view=diff
==============================================================================
--- branches/REL_1/doc/RELEASE-NOTES.txt	(original)
+++ branches/REL_1/doc/RELEASE-NOTES.txt	Fri Jan 15 14:17:45 2016
@@ -3,6 +3,7 @@
 [JXT-118] - ParserPool impls are not correctly resetting builder ErrorHandler and EntityResolver on second and subsequent checkout 
 [JXT-119] - Various ParserPool interface methods should never return null 
 [JXT-120] - Symmetric key generation for Triple DES keys fails with invalid key size
+[JXT-123] - AbstractXMLObject prepareForAssignment(String, String) should have variant that doesn't normalize input
 
 Changes in Release 1.4.5
 =============================================

Modified: branches/REL_1/src/main/java/org/opensaml/xml/AbstractXMLObject.java
URL: http://svn.shibboleth.net/view/java-xmltooling/branches/REL_1/src/main/java/org/opensaml/xml/AbstractXMLObject.java?rev=858&r1=857&r2=858&view=diff
==============================================================================
--- branches/REL_1/src/main/java/org/opensaml/xml/AbstractXMLObject.java	(original)
+++ branches/REL_1/src/main/java/org/opensaml/xml/AbstractXMLObject.java	Fri Jan 15 14:17:45 2016
@@ -290,7 +290,25 @@
      * @return the value that should be assigned
      */
     protected String prepareForAssignment(String oldValue, String newValue) {
-        String newString = DatatypeHelper.safeTrimOrNullString(newValue);
+        return prepareForAssignment(oldValue, newValue, true);
+    }
+    
+    /**
+     * A helper function for derived classes. This 'nornmalizes' newString if <code>normalize=true</code>,
+     * and then if it is different from oldString invalidates the DOM. It returns the new effective value so 
+     * subclasses just have to go. this.foo = * prepareForAssignment(this.foo, foo);
+     * 
+     * @param oldValue - the current value
+     * @param newValue - the new value
+     * @param normalize - whether the newValue should be normalized
+     * 
+     * @return the value that should be assigned
+     */
+    protected String prepareForAssignment(String oldValue, String newValue, boolean normalize) {
+        String newString = newValue;
+        if (normalize) {
+            newString = DatatypeHelper.safeTrimOrNullString(newString);
+        }
 
         if (!DatatypeHelper.safeEquals(oldValue, newString)) {
             releaseThisandParentDOM();



More information about the commits mailing list