jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: rev 47490 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: . state/xml
Date Wed, 29 Sep 2004 16:43:12 GMT
Author: stefan
Date: Wed Sep 29 09:43:11 2004
New Revision: 47490

Modified:
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java
   incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
Log:
minor/cosmetical changes

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java	(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/Test.java	Wed Sep 29 09:43:11
2004
@@ -78,8 +78,8 @@
 	    root.addNode(importTargetName, "nt:unstructured");
 	}
 	FileInputStream fin = new FileInputStream(svExportFilePath);
-	t.importXML("/" + importTargetName, fin);
-	t.save();
+	session.importXML("/" + importTargetName, fin);
+	session.save();
 */
 	String ntName = root.getProperty("jcr:primaryType").getString();
 	session.setNamespacePrefix("bla", "http://www.jcp.org/jcr/nt/1.0");
@@ -90,7 +90,6 @@
 	System.out.println();
 	dumpTree(root, System.out);
 
-	//t.move("/foo", "/misc/bla");
 	System.out.println("after move...");
 	System.out.println();
 	dumpTree(root, System.out);

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
Wed Sep 29 09:43:11 2004
@@ -944,7 +944,7 @@
 	    NodeReferences refs = createNodeReferencesInstance(uuid);
 
 	    InputStream in = itemStateStore.getInputStream(refsFilePath);
-	    Reader reader = null;
+	    BufferedReader reader = null;
 	    try {
 		String encoding = DEFAULT_ENCODING;
 		try {
@@ -956,25 +956,13 @@
 		    reader = new BufferedReader(isw);
 		}
 		// read references (i.e. the id's of the REFERENCE properties)
-		StringBuffer tmp = new StringBuffer();
-		int c;
-		while ((c = reader.read()) != -1) {
-		    if (c != '\n') {
-			tmp.append((char) c);
-			continue;
-		    }
-		    String s = tmp.toString();
+		String s;
+		while ((s = reader.readLine()) != null) {
 		    if (s.length() > 0) {
 			PropertyId propId = PropertyId.valueOf(s);
 			refs.addReference(propId);
-			tmp.setLength(0);
 		    }
 		}
-		String s = tmp.toString();
-		if (s.length() > 0) {
-		    PropertyId propId = PropertyId.valueOf(s);
-		    refs.addReference(propId);
-		}
 	    } finally {
 		reader.close();
 	    }
@@ -1011,7 +999,7 @@
 	    refs.clearAllReferences();
 
 	    InputStream in = itemStateStore.getInputStream(refsFilePath);
-	    Reader reader = null;
+	    BufferedReader reader = null;
 	    try {
 		String encoding = DEFAULT_ENCODING;
 		try {
@@ -1023,25 +1011,13 @@
 		    reader = new BufferedReader(isw);
 		}
 		// read references (i.e. the id's of the REFERENCE properties)
-		StringBuffer tmp = new StringBuffer();
-		int c;
-		while ((c = reader.read()) != -1) {
-		    if (c != '\n') {
-			tmp.append((char) c);
-			continue;
-		    }
-		    String s = tmp.toString();
+		String s;
+		while ((s = reader.readLine()) != null) {
 		    if (s.length() > 0) {
 			PropertyId propId = PropertyId.valueOf(s);
 			refs.addReference(propId);
-			tmp.setLength(0);
 		    }
 		}
-		String s = tmp.toString();
-		if (s.length() > 0) {
-		    PropertyId propId = PropertyId.valueOf(s);
-		    refs.addReference(propId);
-		}
 	    } finally {
 		reader.close();
 	    }
@@ -1073,7 +1049,7 @@
 	try {
 	    refsFile.makeParentDirs();
 	    OutputStream os = refsFile.getOutputStream();
-	    Writer writer = null;
+	    BufferedWriter writer = null;
 	    try {
 		String encoding = DEFAULT_ENCODING;
 		try {
@@ -1088,7 +1064,9 @@
 		Iterator iter = refs.getReferences().iterator();
 		while (iter.hasNext()) {
 		    PropertyId propId = (PropertyId) iter.next();
-		    writer.write(propId.toString() + '\n');
+		    writer.write(propId.toString());
+		    writer.newLine();
+
 		}
 	    } finally {
 		writer.close();

Mime
View raw message