Index: modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java =================================================================== --- modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java (revision 421286) +++ modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/AbstractPreferencesTest.java (working copy) @@ -1000,7 +1000,7 @@ try { pref.exportNode(null); fail(); - } catch (NullPointerException e) { + } catch (AssertionError e) { } pref.putBoolean("key", false); @@ -1064,7 +1064,7 @@ try { pref.exportSubtree(null); fail(); - } catch (NullPointerException e) { + } catch (AssertionError e) { } ByteArrayOutputStream out = new ByteArrayOutputStream(); pref.putBoolean("key", false); Index: modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java =================================================================== --- modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java (revision 421286) +++ modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java (working copy) @@ -363,6 +363,9 @@ */ public void exportNode(OutputStream ostream) throws IOException, BackingStoreException { + if(ostream == null) { + throw new AssertionError("Stream is null"); //$NON-NLS-1$ + } checkState(); XMLParser.exportPrefs(this, ostream, false); @@ -374,6 +377,10 @@ */ public void exportSubtree(OutputStream ostream) throws IOException, BackingStoreException { + if(ostream == null) { + throw new AssertionError("Stream is null"); //$NON-NLS-1$ + } + checkState(); XMLParser.exportPrefs(this, ostream, true); }