harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sian January (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-5986) [classlib][beans] XMLEncoder should check for null stat in recordStatement
Date Mon, 27 Oct 2008 15:26:44 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-5986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12642941#action_12642941
] 

Sian January commented on HARMONY-5986:
---------------------------------------

Hi Andrew,

If I try this small test case on the RI:

XMLEncoder encoder = new XMLEncoder(System.out);
encoder.writeStatement(null);

then I get the following output:

java.lang.Exception: XMLEncoder: discarding statement null
Continuing ...

and with your patch I don't get any output.  We obviously do need to handle the null case
and not throw a NullPointerException like it was doing before, but I think we should probably
follow the RI and print some output.  If you agree with this, do you think you could re-do
the patch to print out the same statement?  Otherwise we can discuss it further on the dev
list.  
Thanks!


> [classlib][beans] XMLEncoder should check for null stat in recordStatement
> --------------------------------------------------------------------------
>
>                 Key: HARMONY-5986
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5986
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M6
>         Environment: HEAD - all platforms
>            Reporter: Andrew Cornwall
>            Assignee: Sian January
>            Priority: Minor
>         Attachments: xmlencoder.patch2
>
>
> In XMLEncoder.recordStatement(Statement), it's possible to pass in a null stat. This
means there will be a NullPointerException on this code:
> 	private void recordStatement(Statement stat) {
> 		// deal with 'owner' property
> 		if (stat.getTarget() == owner && owner != null) {
> 			needOwner = true;
> 		}
> A workaround is to test for the null pointer explicitly:
> 	    if(null==stat) return;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message