You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Artem Aliev (JIRA)" <ji...@apache.org> on 2006/12/04 13:55:23 UTC

[jira] Created: (HARMONY-2420) [luni] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

[luni]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-2420
                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Artem Aliev
            Priority: Minor


exportNode(OutputStream) and exportSubtree(OutputStream) throws
AssertionError not NullPointerException in a case when OutputStream is null.

Test to reproduce:
import junit.framework.TestCase;

import java.io.IOException;
import java.util.prefs.*;

class AbstractPreferencesImpl extends AbstractPreferences{

        protected AbstractPreferencesImpl(AbstractPreferences arg0, String
arg1) {
                super(arg0, arg1);
        }

        protected AbstractPreferences childSpi(String arg0) {
                return null;
        }

        protected String[] childrenNamesSpi() throws BackingStoreException {
                return null;
        }

        protected void flushSpi() throws BackingStoreException {
        }

        protected String getSpi(String arg0) {
                return null;
        }

        protected String[] keysSpi() throws BackingStoreException {
                return null;
        }

        protected void putSpi(String arg0, String arg1) {
        }

        protected void removeNodeSpi() throws BackingStoreException {
        }

        protected void removeSpi(String arg0) {
        }

        protected void syncSpi() throws BackingStoreException {
        }
}

public class Test extends TestCase {

        public void testcase() {
                AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
                boolean res1 = false, res2 = false;
                try {
                        ap.exportNode(null);
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (BackingStoreException e) {
                        e.printStackTrace();
                }catch (NullPointerException e) {
                        e.printStackTrace();
                        System.out.println("Got Expected
NullPointerException");
                } catch (AssertionError ae) {
                        ae.printStackTrace();
                        res1 = true;
                        System.out.println("Got Unexpected AssertionError");
                } 
                try {
                        ap.exportSubtree(null);
                } catch (IOException e) {
                        e.printStackTrace();
                } catch (BackingStoreException e) {
                        e.printStackTrace();
                }catch (NullPointerException e) {
                        e.printStackTrace();
                        System.out.println("Got Expected
NullPointerException");
                } catch (AssertionError ae) {
                        ae.printStackTrace();
                        res2 = true;
                        System.out.println("Got Unexpected AssertionError");
                } 
                if (res1 || res2) {
                        fail();
                }
    }
}

Output on Harmony:
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
Foundation or its licensors, as applicable.
java version "1.5.0" 
pre-alpha : not complete or compatible
svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
release build
http://incubator.apache.org/harmony

.java.lang.AssertionError: Stream is null
        at
java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
        at Test.testcase(Test.java:50)
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.textui.TestRunner.doRun(TestRunner.java:115)
        at junit.textui.TestRunner.start(TestRunner.java:172)
        at junit.textui.TestRunner.main(TestRunner.java:138)
Got Unexpected AssertionError
java.lang.AssertionError: Stream is null
        at
java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
        at Test.testcase(Test.java:64)
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.textui.TestRunner.doRun(TestRunner.java:115)
        at junit.textui.TestRunner.start(TestRunner.java:172)
        at junit.textui.TestRunner.main(TestRunner.java:138)
Got Unexpected AssertionError
F
Time: 0.125
There was 1 failure:
1) testcase(Test)junit.framework.AssertionFailedError
        at Test.testcase(Test.java:78)
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)

FAILURES!!!
Tests run: 1,  Failures: 1,  Errors: 0

res = 1


Output on RI:
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
.java.lang.NullPointerException
        at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
        at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
        at
java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
        at Test.testcase(Test.java:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.textui.TestRunner.doRun(TestRunner.java:116)
        at junit.textui.TestRunner.start(TestRunner.java:172)
        at junit.textui.TestRunner.main(TestRunner.java:138)
Got Expected NullPointerException
java.lang.NullPointerException
        at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
        at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
        at
java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
        at Test.testcase(Test.java:64)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at junit.textui.TestRunner.doRun(TestRunner.java:116)
        at junit.textui.TestRunner.start(TestRunner.java:172)
        at junit.textui.TestRunner.main(TestRunner.java:138)
Got Expected NullPointerException

Time: 0.078

OK (1 test)

res = 0


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[classlib][compatibility] Do we need to use assert like RI (Re: [jira] Created: (HARMONY-2420) [luni] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null)

Posted by Paulex Yang <pa...@gmail.com>.
This incompatibility is obviously caused by RI's assert usage, whether 
or not we need to be "assert compatible" with RI? assert on/off in Java 
is runtime decided, so that it's still possible that user application 
run JRE in assert enable mode. And if we do want to "assert compatible", 
we need to run our test suites in both mode.

IMHO, "assert compatibility" is not necessary, because it is not likely 
to cause user application fail, it seems crazy to expect assert error in 
the application logic. And I don't believe there are JCK test cases 
against assert, but I'm open to other's comments.

Artem Aliev (JIRA) wrote:
> [luni]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                  Key: HARMONY-2420
>                  URL: http://issues.apache.org/jira/browse/HARMONY-2420
>              Project: Harmony
>           Issue Type: Bug
>           Components: Classlib
>             Reporter: Artem Aliev
>             Priority: Minor
>
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
>
> Test to reproduce:
> import junit.framework.TestCase;
>
> import java.io.IOException;
> import java.util.prefs.*;
>
> class AbstractPreferencesImpl extends AbstractPreferences{
>
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>
>         protected void flushSpi() throws BackingStoreException {
>         }
>
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>
>         protected void putSpi(String arg0, String arg1) {
>         }
>
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>
>         protected void removeSpi(String arg0) {
>         }
>
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
>
> public class Test extends TestCase {
>
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
>
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
>
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
>
> res = 1
>
>
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
>
> Time: 0.078
>
> OK (1 test)
>
> res = 0
>
>
>   


-- 
Paulex Yang
China Software Development Lab
IBM



[jira] Updated: (HARMONY-2420) [classlib][prefs] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2420?page=all ]

Vasily Zakharov updated HARMONY-2420:
-------------------------------------

    Attachment: Harmony2420.patch

Attached a fix patch.


> [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2420
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>            Priority: Minor
>         Attachments: Harmony2420.patch, Test.java
>
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.prefs.*;
> class AbstractPreferencesImpl extends AbstractPreferences{
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void flushSpi() throws BackingStoreException {
>         }
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void putSpi(String arg0, String arg1) {
>         }
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>         protected void removeSpi(String arg0) {
>         }
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
> public class Test extends TestCase {
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> Time: 0.078
> OK (1 test)
> res = 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (HARMONY-2420) [classlib][prefs] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2420?page=all ]

Nathan Beyer closed HARMONY-2420.
---------------------------------


> [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2420
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Assigned To: Nathan Beyer
>            Priority: Minor
>         Attachments: Harmony2420-Test.patch, Harmony2420.patch, Test.java
>
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.prefs.*;
> class AbstractPreferencesImpl extends AbstractPreferences{
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void flushSpi() throws BackingStoreException {
>         }
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void putSpi(String arg0, String arg1) {
>         }
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>         protected void removeSpi(String arg0) {
>         }
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
> public class Test extends TestCase {
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> Time: 0.078
> OK (1 test)
> res = 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2420) [classlib][prefs] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

Posted by "Stepan Mishura (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2420?page=all ]

Stepan Mishura updated HARMONY-2420:
------------------------------------

    Summary: [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null  (was: [luni]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null)

> [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2420
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>            Priority: Minor
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.prefs.*;
> class AbstractPreferencesImpl extends AbstractPreferences{
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void flushSpi() throws BackingStoreException {
>         }
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void putSpi(String arg0, String arg1) {
>         }
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>         protected void removeSpi(String arg0) {
>         }
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
> public class Test extends TestCase {
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> Time: 0.078
> OK (1 test)
> res = 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2420) [classlib][prefs] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

Posted by "Artem Aliev (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2420?page=all ]

Artem Aliev updated HARMONY-2420:
---------------------------------

    Attachment: Test.java

Standalong test is attached.

> [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2420
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>            Priority: Minor
>         Attachments: Test.java
>
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.prefs.*;
> class AbstractPreferencesImpl extends AbstractPreferences{
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void flushSpi() throws BackingStoreException {
>         }
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void putSpi(String arg0, String arg1) {
>         }
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>         protected void removeSpi(String arg0) {
>         }
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
> public class Test extends TestCase {
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> Time: 0.078
> OK (1 test)
> res = 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2420) [classlib][prefs] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2420?page=all ]

Vasily Zakharov updated HARMONY-2420:
-------------------------------------

    Attachment: Harmony2420-Test.patch

Attached a test patch.

Regression is provided with org.apache.harmony.prefs.tests.java.util.prefs.AbstractPreferencesTest test cases testExportNode() and testExportSubtree(), with this patch applied.


> [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2420
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>            Priority: Minor
>         Attachments: Harmony2420-Test.patch, Harmony2420.patch, Test.java
>
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.prefs.*;
> class AbstractPreferencesImpl extends AbstractPreferences{
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void flushSpi() throws BackingStoreException {
>         }
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void putSpi(String arg0, String arg1) {
>         }
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>         protected void removeSpi(String arg0) {
>         }
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
> public class Test extends TestCase {
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> Time: 0.078
> OK (1 test)
> res = 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2420) [classlib][prefs] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2420?page=comments#action_12455846 ] 
            
Nathan Beyer commented on HARMONY-2420:
---------------------------------------

Could you create a patch the test case, so we can add a regression test?

Thanks.

> [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2420
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>            Priority: Minor
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.prefs.*;
> class AbstractPreferencesImpl extends AbstractPreferences{
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void flushSpi() throws BackingStoreException {
>         }
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void putSpi(String arg0, String arg1) {
>         }
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>         protected void removeSpi(String arg0) {
>         }
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
> public class Test extends TestCase {
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> Time: 0.078
> OK (1 test)
> res = 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (HARMONY-2420) [classlib][prefs] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2420?page=all ]

Nathan Beyer reassigned HARMONY-2420:
-------------------------------------

    Assignee: Nathan Beyer

> [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2420
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Assigned To: Nathan Beyer
>            Priority: Minor
>         Attachments: Harmony2420-Test.patch, Harmony2420.patch, Test.java
>
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.prefs.*;
> class AbstractPreferencesImpl extends AbstractPreferences{
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void flushSpi() throws BackingStoreException {
>         }
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void putSpi(String arg0, String arg1) {
>         }
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>         protected void removeSpi(String arg0) {
>         }
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
> public class Test extends TestCase {
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> Time: 0.078
> OK (1 test)
> res = 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (HARMONY-2420) [classlib][prefs] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

Posted by "Nathan Beyer (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2420?page=all ]

Nathan Beyer resolved HARMONY-2420.
-----------------------------------

    Resolution: Fixed

Patch applied. Thanks.

Can someone please verify this issue?

> [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2420
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Assigned To: Nathan Beyer
>            Priority: Minor
>         Attachments: Harmony2420-Test.patch, Harmony2420.patch, Test.java
>
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.prefs.*;
> class AbstractPreferencesImpl extends AbstractPreferences{
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void flushSpi() throws BackingStoreException {
>         }
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void putSpi(String arg0, String arg1) {
>         }
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>         protected void removeSpi(String arg0) {
>         }
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
> public class Test extends TestCase {
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> Time: 0.078
> OK (1 test)
> res = 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2420) [classlib][prefs] java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a case when OutputStream is null

Posted by "Vasily Zakharov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2420?page=comments#action_12460682 ] 
            
Vasily Zakharov commented on HARMONY-2420:
------------------------------------------

Verified ok.


> [classlib][prefs]  java.util.prefs.AbstractPreferences.exportNode(OutputStream) and java.util.prefs.AbstractPreferences.exportSubtree(OutputStream) throws AssertionError instead of NPE in a  case when OutputStream is null
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2420
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2420
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Artem Aliev
>         Assigned To: Nathan Beyer
>            Priority: Minor
>         Attachments: Harmony2420-Test.patch, Harmony2420.patch, Test.java
>
>
> exportNode(OutputStream) and exportSubtree(OutputStream) throws
> AssertionError not NullPointerException in a case when OutputStream is null.
> Test to reproduce:
> import junit.framework.TestCase;
> import java.io.IOException;
> import java.util.prefs.*;
> class AbstractPreferencesImpl extends AbstractPreferences{
>         protected AbstractPreferencesImpl(AbstractPreferences arg0, String
> arg1) {
>                 super(arg0, arg1);
>         }
>         protected AbstractPreferences childSpi(String arg0) {
>                 return null;
>         }
>         protected String[] childrenNamesSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void flushSpi() throws BackingStoreException {
>         }
>         protected String getSpi(String arg0) {
>                 return null;
>         }
>         protected String[] keysSpi() throws BackingStoreException {
>                 return null;
>         }
>         protected void putSpi(String arg0, String arg1) {
>         }
>         protected void removeNodeSpi() throws BackingStoreException {
>         }
>         protected void removeSpi(String arg0) {
>         }
>         protected void syncSpi() throws BackingStoreException {
>         }
> }
> public class Test extends TestCase {
>         public void testcase() {
>                 AbstractPreferences ap = new AbstractPreferencesImpl(null, "");
>                 boolean res1 = false, res2 = false;
>                 try {
>                         ap.exportNode(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res1 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 try {
>                         ap.exportSubtree(null);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (BackingStoreException e) {
>                         e.printStackTrace();
>                 }catch (NullPointerException e) {
>                         e.printStackTrace();
>                         System.out.println("Got Expected
> NullPointerException");
>                 } catch (AssertionError ae) {
>                         ae.printStackTrace();
>                         res2 = true;
>                         System.out.println("Got Unexpected AssertionError");
>                 } 
>                 if (res1 || res2) {
>                         fail();
>                 }
>     }
> }
> Output on Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software
> Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = rsvn: '.' is not a working copy, (Sep 20 2006), Windows/ia32/msvc 1310,
> release build
> http://incubator.apache.org/harmony
> .java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:373)
>         at Test.testcase(Test.java:50)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> java.lang.AssertionError: Stream is null
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:388)
>         at Test.testcase(Test.java:64)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:115)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Unexpected AssertionError
> F
> Time: 0.125
> There was 1 failure:
> 1) testcase(Test)junit.framework.AssertionFailedError
>         at Test.testcase(Test.java:78)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0
> res = 1
> Output on RI:
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> .java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportNode(AbstractPreferences.java:1575)
>         at Test.testcase(Test.java:50)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> java.lang.NullPointerException
>         at java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:140)
>         at java.util.prefs.XmlSupport.export(XmlSupport.java:104)
>         at
> java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1591)
>         at Test.testcase(Test.java:64)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at junit.framework.TestCase.runTest(TestCase.java:154)
>         at junit.framework.TestCase.runBare(TestCase.java:127)
>         at junit.framework.TestResult$1.protect(TestResult.java:106)
>         at junit.framework.TestResult.runProtected(TestResult.java:124)
>         at junit.framework.TestResult.run(TestResult.java:109)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at junit.textui.TestRunner.doRun(TestRunner.java:116)
>         at junit.textui.TestRunner.start(TestRunner.java:172)
>         at junit.textui.TestRunner.main(TestRunner.java:138)
> Got Expected NullPointerException
> Time: 0.078
> OK (1 test)
> res = 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira