RFR (JAXP): 8144967: javax.xml.transform.Source and org.xml.sax.InputSource can be empty
Roger Riggs
Roger.Riggs at Oracle.com
Mon Dec 21 21:35:26 UTC 2015
Hi Joe,
A few comments:
InputSource:
- Should the default method return true? The default method is only
present
to allow source compatibility with unknown subtypes. I would expect
that without
any specific implementation knowledge it would need to be false.
All of the JDK provided Sources will implement isEmpty appropriately.
- Editorial: "Empty means that there is no input available from this
Source".
- from the definition and implementation it seems that isEmpty will be
true
when a stream (streamSource) is positioned just before EOF. Is that
intended?
stream/StreamSource:
- Does not need to check both sources; if the first source has any
input, return false immediately.
- the choice to return false when an IOException occurs seems odd;
if reading throws an exception then it seems unlikely that any
future read could work;
and hence there is no more input.
- Note also that you probably need separate try/catch handlers for the
stream vs the reader.
An exception from reading the inputStream should no preempt the reader.
sax/InputSource:
- ditto the comments above.
In the test:
- This test is duplicated:
+ "{new SAXSource(new InputSource(new StringReader("")))},
+ {new SAXSource(new InputSource(new StringReader("")))},
Roger
On 12/17/2015 7:25 PM, huizhe wang wrote:
> Hi,
>
> Adding a convenient method isEmpty to javax.xml.transform.Source and
> org.xml.sax.InputSource.
>
> JBS: https://bugs.openjdk.java.net/browse/JDK-8144967
> webrev: http://cr.openjdk.java.net/~joehw/jdk9/8144967/webrev/
>
> Thanks,
> Joe
>
More information about the core-libs-dev
mailing list