castor

Local castor.properties sax features are never read

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.1.1
  • Fix Version/s: 1.2
  • Component/s: XML
  • Labels:
    None
  • Environment:
    Java 1.5, Windows XP
  • Number of attachments :
    1

Description

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

Activity

Hide
Werner Guttmann added a comment -

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 ?

Show
Werner Guttmann added a comment - 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 ?
Hide
Anti Orgla added a comment -

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:

Show
Anti Orgla added a comment - 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:
Hide
Werner Guttmann added a comment -

Actually, sorry, there's a problem with this code. I think I know what's going wrong.

Show
Werner Guttmann added a comment - Actually, sorry, there's a problem with this code. I think I know what's going wrong.
Hide
Anti Orgla added a comment -

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");

Show
Anti Orgla added a comment - 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");
Hide
Werner Guttmann added a comment -

Final patch for review.

Show
Werner Guttmann added a comment - Final patch for review.
Hide
Paolo Bettini added a comment -

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.

Show
Paolo Bettini added a comment - 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.
Hide
Werner Guttmann added a comment -

Will be dealing with this ....

Show
Werner Guttmann added a comment - Will be dealing with this ....
Hide
Werner Guttmann added a comment -

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.

Show
Werner Guttmann added a comment - 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.
Hide
Werner Guttmann added a comment -

Marking this as resolved as the complete code to handle property files has been rewritten.

Show
Werner Guttmann added a comment - Marking this as resolved as the complete code to handle property files has been rewritten.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: