RFR (JAXP) 8158619: Very large CDATA section in XML document causes OOME

Daniel Fuchs daniel.fuchs at oracle.com
Thu Nov 17 10:59:14 UTC 2016


Hi Joe,

Good to see some raw type uses corrected :-)

nit: there are some very long lines that could be split
      to help side-by-side reviewing, like e.g. in
       XSDHandler.java, Parser.java, etc...

I know that most of these files already have long lines
(and some of them would probably benefit from an automatic
  reformatting & cleanup sometime), but maybe the new code
ought to try to fit the 80 columns convention :-)

XMLDocumentFragmentScannerImpl.java:

should lines 1715 - 1723 be removed as well?

JdkXmlUtils.java

   85         if (value.getClass().isAssignableFrom(Integer.class)) {
   86             return (Integer)value;
   87         } else {
   88             return Integer.parseInt((String) value);
   89         }

I think you got the comparison wrong. Anyway I'd suggest something
simpler here: the code above is a bit bizarre.

if (value instanceof Number) {
     return ((Number) value).intValue();
} else if (value instanceof String) {
     return Integer.parseInt(String.valueOf(value));
} else {
     throw IllegalArgumentException("Unexpected class: "
                                    + value.getClass());
}

best regards,

-- daniel

On 16/11/16 22:12, Joe Wang wrote:
> Hi,
>
> Please review an enhancement adding a property to allow for specifying
> the chunk size of CDATA.
>
> JBS: https://bugs.openjdk.java.net/browse/JDK-8158619
> webrevs: http://cr.openjdk.java.net/~joehw/jdk9/8158619/webrev/
>
> Thanks,
> Joe
>



More information about the core-libs-dev mailing list