History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CASTOR-1964
Type: Sub-task Sub-task
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Werner Guttmann
Reporter: Anti Orgla
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
castor
CASTOR-535

Local castor.properties sax features are never read

Created: 06/May/07 07:39 AM   Updated: 14/Mar/08 06:40 AM
Component/s: XML
Affects Version/s: 1.1.1
Fix Version/s: 1.2

Time Tracking:
Not Specified

File Attachments: 1. Text File patch.c1964.20070506.txt (3 kb)

Environment: Java 1.5, Windows XP


 Description  « Hide
Configuration.java: 631

features = getDefault().getProperty(Property.ParserFeatures, features);

getDefault() returns default conf, so features that I spesify in my own castor.properties are never read and can't be used.

should be something like getProperties().getProperty(Property.ParserFeatures, features);

It was fixed in 2003 as I see, but it sure does not work in 1.1.1



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Werner Guttmann - 06/May/07 09:40 AM
No, it shouldn't, as you are referring to Configuration.java. In LocalConfiguration.java, the code your are looking for is actually implemented. To me it looks like you are putting your custom castor.properties to the wrong location. Have you made sure that it is available on the CLASSPATH ?

Anti Orgla - 06/May/07 09:49 AM
castor.properties is on my root directory and other properties apply nicely, exept features like:

org.exolab.castor.sax.features=http://xml.org/sax/features/validation,http://apache.org/xml/features/validation/schema

Following code:

Unmarshaller unmarshaller = new Unmarshaller(GameData.class);
....
data = (GameData)unmarshaller.unmarshal(src);

Leads to Unmarshaller.java: 697:


Werner Guttmann - 06/May/07 09:50 AM
Actually, sorry, there's a problem with this code. I think I know what's going wrong.

Anti Orgla - 06/May/07 09:52 AM
castor.properties is on my root directory and other properties apply nicely, exept features like:
org.exolab.castor.sax.features=http://xml.org/sax/features/validation,http://apache.org/xml/features/validation/schema

Following code:

Unmarshaller unmarshaller = new Unmarshaller(GameData.class);
....
data = (GameData)unmarshaller.unmarshal(src);

Leads to Unmarshaller.java: 697:
reader = _config.getXMLReader();

which lead to Configuration class:
return getDefaultXMLReader( null ) ;

which deals with props from my castor.properties, but then it goes to
Configuration.java: 623 ->setFeaturesOnXmlReader
and this method does
features = getDefault().getProperty(Property.ParserFeatures, features);

which returns features as null
And features do not apply for sax parser.

I have added following hack to get it done in my project:

Configuration.getDefault().setProperty(Property.ParserFeatures,"http://xml.org/sax/features/validation,http://apache.org/xml/features/validation/schema");


Werner Guttmann - 06/May/07 10:01 AM
Final patch for review.

Paolo Bettini - 10/Oct/07 04:53 AM
Hi Werner,
I see you fixed the bug for "features" (to enable) but you didn't for "featuresToDisable".
Am I seeing right?

In "patch.c1964.20070506.txt" i find that "features" is set with
features = properties.getProperty(Property.ParserFeatures, features);
instead of
features = getDefault().getProperty(Property.ParserFeatures, features);
and it's ok, but "featuresToDisable" is still set with
String featuresToDisable = getDefault().getProperty(Property.ParserFeaturesToDisable, "");

Of course, my need is for "featuresToDisable"...
Thanks, see ya.


Werner Guttmann - 10/Oct/07 04:58 AM
Will be dealing with this ....

Werner Guttmann - 10/Oct/07 05:00 AM
Please keep in mind that a lot of code in this area has changed over the past few days ... and as such, things might work out of the box. Are you in a position to check out SVN trunk and build a JAR yourself ? The current XML configuration lives in XMLConfiguration.java, and not in (Local)Configuration anymore.

Werner Guttmann - 07/Jan/08 05:33 PM
Marking this as resolved as the complete code to handle property files has been rewritten.