You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:46:01 UTC
[sling-org-apache-sling-jcr-contentloader] 08/32: SLING-412: Remove
support for "name" property which defines the name of the root node
imported through json.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.jcr.contentloader-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentloader.git
commit 76f7b769214271b93035579a6b8a9b923e6f79af
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon May 5 10:16:45 2008 +0000
SLING-412: Remove support for "name" property which defines the name of the root node imported through json.
git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/trunk/jcr/contentloader@653413 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/jcr/contentloader/internal/JsonReader.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/apache/sling/jcr/contentloader/internal/JsonReader.java b/src/main/java/org/apache/sling/jcr/contentloader/internal/JsonReader.java
index 4b5a1e5..ef5c4b4 100644
--- a/src/main/java/org/apache/sling/jcr/contentloader/internal/JsonReader.java
+++ b/src/main/java/org/apache/sling/jcr/contentloader/internal/JsonReader.java
@@ -59,7 +59,7 @@ class JsonReader implements NodeReader {
return jsonReader;
}
};
-
+
public NodeDescription parse(InputStream ins) throws IOException {
try {
String jsonString = toString(ins).trim();
@@ -68,8 +68,7 @@ class JsonReader implements NodeReader {
}
JSONObject json = new JSONObject(jsonString);
- String name = json.optString("name", null); // allow for no name !
- return this.createNode(name, json);
+ return this.createNode(null, json);
} catch (JSONException je) {
throw (IOException) new IOException(je.getMessage()).initCause(je);
@@ -156,12 +155,12 @@ class JsonReader implements NodeReader {
// fall back to default
return PropertyType.TYPENAME_STRING;
}
-
+
private String toString(InputStream ins) throws IOException {
if (!ins.markSupported()) {
ins = new BufferedInputStream(ins);
}
-
+
String encoding;
ins.mark(5);
int c = ins.read();
@@ -184,7 +183,7 @@ class JsonReader implements NodeReader {
bos.write(buf, 0, rd);
}
bos.close(); // just to comply with the contract
-
+
return new String(bos.toByteArray(), encoding);
}
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.