[ http://issues.apache.org/jira/browse/XALANJ-1756?page=all ]
Brian Minchau closed XALANJ-1756:
---------------------------------
Assign To: (was: Xalan Developers Mailing List)
Closing issue.
> Serializer default output properties are not immutable
> ------------------------------------------------------
>
> Key: XALANJ-1756
> URL: http://issues.apache.org/jira/browse/XALANJ-1756
> Project: XalanJ2
> Type: Bug
> Components: Serialization
> Versions: Latest Development Code
> Environment: Operating System: Other
> Platform: Other
> Reporter: Brian Minchau
> Attachments: apache.25816.patch.txt
>
> Code like this, which calls the factory in org.apache.xml.serializer:
> java.util.Properties prop0 =
> OutputPropertiesFactory.getDefaultMethodProperties("xml");
> String val = prop0.getProperty("encoding");
> System.out.println("enc = " + val);
> prop0.setProperty("encoding","UTF-BRIAN");
> val = prop0.getProperty("encoding");
> System.out.println("enc = " + val);
>
> // DEFAULT VALUE IS CHANGED ! THIS IS BAD, ISN'T IT ?
> java.util.Properties prop1 =
> OutputPropertiesFactory.getDefaultMethodProperties("xml");
> val = prop1.getProperty("encoding");
> System.out.println("enc = " + val);
> return new Properties(defaultProperties);
> -------------------------------------
> Will write this out:
> enc = UTF-8
> enc = UTF-BRIAN
> enc = UTF-BRIAN
> The last line shows that we have changed the default value within the factory.
> I think this is bad. The simplest solution I can see is that the last line of
> OutputPropertiesFactory.getDefaultMethodProperties(String method) should be:
> return new Properties(defaultProperties);
> rather than
> return defaultProperties;
> In this way properties can be changed by the caller in the Properties object,
> but the default values are unchanged for the next call to the factory.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]