< prev index next >
test/jdk/java/util/prefs/ExportSubtree.java
Print this page
@@ -32,13 +32,10 @@
import java.io.*;
import java.util.prefs.*;
public class ExportSubtree {
public static void main(String[] args) throws Exception {
- try
- {
- //File f = new File(System.getProperty("test.src", "."), "TestPrefs.xml");
ByteArrayInputStream bais = new ByteArrayInputStream(importPrefs.getBytes("utf-8"));
Preferences.importPreferences(bais);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Preferences.userRoot().node("testExportSubtree").exportSubtree(baos);
Preferences.userRoot().node("testExportSubtree").removeNode();
@@ -46,14 +43,10 @@
//System.out.print(baos.toString());
//System.out.print(expectedResult);
throw new IOException("exportSubtree does not output expected result");
}
}
- catch( Exception e ) {
- e.printStackTrace();
- }
- }
static String ls = System.getProperty("line.separator");
static String importPrefs =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<!DOCTYPE preferences SYSTEM \"http://java.sun.com/dtd/preferences.dtd\">"
@@ -74,11 +67,11 @@
+ " </node>"
+ " </root>"
+ "</preferences>";
static String expectedResult =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
+ ls + "<!DOCTYPE preferences SYSTEM \"http://java.sun.com/dtd/preferences.dtd\">"
+ ls + "<preferences EXTERNAL_XML_VERSION=\"1.0\">"
+ ls + " <root type=\"user\">"
+ ls + " <map/>"
+ ls + " <node name=\"testExportSubtree\">"
< prev index next >