diff --git a/src/main/java/com/fasterxml/aalto/AaltoInputProperties.java b/src/main/java/com/fasterxml/aalto/AaltoInputProperties.java index b0842ca..cfa6a68 100644 --- a/src/main/java/com/fasterxml/aalto/AaltoInputProperties.java +++ b/src/main/java/com/fasterxml/aalto/AaltoInputProperties.java @@ -8,9 +8,9 @@ public final class AaltoInputProperties { /** - * Feature controlling whether general entities are retained. + * Feature controlling whether general entities in attributes are retained. * * @since 1.3 */ - public final static String P_RETAIN_GENERAL_ENTITIES = "com.fasterxml.aalto.retainGeneralEntities"; + public final static String P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES = "com.fasterxml.aalto.retainAttributeGeneralEntities"; } diff --git a/src/main/java/com/fasterxml/aalto/in/ReaderConfig.java b/src/main/java/com/fasterxml/aalto/in/ReaderConfig.java index 424b6ba..538052c 100644 --- a/src/main/java/com/fasterxml/aalto/in/ReaderConfig.java +++ b/src/main/java/com/fasterxml/aalto/in/ReaderConfig.java @@ -42,7 +42,7 @@ public final class ReaderConfig final static int F_AUTO_CLOSE_INPUT = 0x2000; // Custom flags: - final static int F_RETAIN_GENERAL_ENTITIES = 0x4000; + final static int F_RETAIN_ATTRIBUTE_GENERAL_ENTITIES = 0x4000; /** * These are the default settings for XMLInputFactory. @@ -101,7 +101,7 @@ public final class ReaderConfig sProperties.put(XMLInputFactory2.P_DTD_OVERRIDE, null); // Custom ones - sProperties.put(AaltoInputProperties.P_RETAIN_GENERAL_ENTITIES, Integer.valueOf(F_RETAIN_GENERAL_ENTITIES)); + sProperties.put(AaltoInputProperties.P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES, Integer.valueOf(F_RETAIN_ATTRIBUTE_GENERAL_ENTITIES)); } /** @@ -283,8 +283,8 @@ public void doReportCData(boolean state) { setFlag(F_REPORT_CDATA, state); } - public void doRetainGeneralEntities(boolean state) { - setFlag(F_RETAIN_GENERAL_ENTITIES, state); + public void doRetainAttributeGeneralEntities(boolean state) { + setFlag(F_RETAIN_ATTRIBUTE_GENERAL_ENTITIES, state); } /* @@ -421,7 +421,7 @@ public boolean willParseLazily() { // // // Custom properties - public boolean willRetainGeneralEntities() { return hasFlag(F_RETAIN_GENERAL_ENTITIES); } + public boolean willRetainAttributeGeneralEntities() { return hasFlag(F_RETAIN_ATTRIBUTE_GENERAL_ENTITIES); } /* /********************************************************************** diff --git a/src/main/java/com/fasterxml/aalto/in/ReaderScanner.java b/src/main/java/com/fasterxml/aalto/in/ReaderScanner.java index 51e67b3..074d9a9 100644 --- a/src/main/java/com/fasterxml/aalto/in/ReaderScanner.java +++ b/src/main/java/com/fasterxml/aalto/in/ReaderScanner.java @@ -830,7 +830,7 @@ protected final int handleStartElement(char c) * simplify main method, which makes code more maintainable * and possibly easier for JIT/HotSpot to optimize. */ - private final int collectValue(int attrPtr, char quoteChar, PName attrName) + private int collectValue(int attrPtr, char quoteChar, PName attrName) throws XMLStreamException { char[] attrBuffer = _attrCollector.startNewValue(attrName, attrPtr); @@ -896,7 +896,7 @@ private final int collectValue(int attrPtr, char quoteChar, PName attrName) throwUnexpectedChar(c, "'<' not allowed in attribute value"); case XmlCharTypes.CT_AMP: { - if (!_config.willRetainGeneralEntities()) { + if (!_config.willRetainAttributeGeneralEntities()) { int d = handleEntityInText(false); if (d == 0) { // unexpanded general entity... not good reportUnexpandedEntityInAttr(attrName, false); diff --git a/src/main/java/com/fasterxml/aalto/sax/SAXParserFactoryImpl.java b/src/main/java/com/fasterxml/aalto/sax/SAXParserFactoryImpl.java index 36e89f0..2494b1f 100644 --- a/src/main/java/com/fasterxml/aalto/sax/SAXParserFactoryImpl.java +++ b/src/main/java/com/fasterxml/aalto/sax/SAXParserFactoryImpl.java @@ -70,7 +70,7 @@ public boolean getFeature(String name) case IS_STANDALONE: // read-only, but only during parsing return true; case EXTERNAL_GENERAL_ENTITIES: - return !((Boolean) mStaxFactory.getProperty(AaltoInputProperties.P_RETAIN_GENERAL_ENTITIES)).booleanValue(); + return Boolean.FALSE.equals(mStaxFactory.getProperty(AaltoInputProperties.P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES)); default: } } else { @@ -98,7 +98,7 @@ public void setFeature(String name, boolean enabled) switch (stdFeat) { case EXTERNAL_GENERAL_ENTITIES: - mStaxFactory.setProperty(AaltoInputProperties.P_RETAIN_GENERAL_ENTITIES, !enabled); + mStaxFactory.setProperty(AaltoInputProperties.P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES, !enabled); ok = true; break; case EXTERNAL_PARAMETER_ENTITIES: diff --git a/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java b/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java index ca32d5d..9382a27 100644 --- a/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java +++ b/src/main/java/com/fasterxml/aalto/sax/SAXParserImpl.java @@ -264,7 +264,7 @@ public boolean getFeature(String name) // !!! TBI return true; case EXTERNAL_GENERAL_ENTITIES: - return !((Boolean) _staxFactory.getProperty(AaltoInputProperties.P_RETAIN_GENERAL_ENTITIES)).booleanValue(); + return Boolean.FALSE.equals(_staxFactory.getProperty(AaltoInputProperties.P_RETAIN_ATTRIBUTE_GENERAL_ENTITIES)); default: } } else {