Author: rombert
Date: Thu Jun 5 11:36:54 2014
New Revision: 1600611
URL: http://svn.apache.org/r1600611
Log:
SLING-3609 - StringIndexOutOfBoundsException with empty {Binary}
property
Ignore binary properties when parsing .content.xml files. We will
revisit this later.
Added:
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/bin.binary
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/binary-property.xml
(with props)
Modified:
sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java
Modified:
sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java?rev=1600611&r1=1600610&r2=1600611&view=diff
==============================================================================
---
sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java
(original)
+++
sling/trunk/tooling/ide/impl-vlt-test/src/test/java/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandlerTest.java
Thu Jun 5 11:36:54 2014
@@ -19,7 +19,7 @@ package org.apache.sling.ide.impl.vlt.se
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.array;
import static org.hamcrest.Matchers.hasEntry;
-import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
import java.io.IOException;
@@ -148,6 +148,14 @@ public class ContentXmlHandlerTest {
assertThat("node contains /50-50", root.getChildren(),
hasChildPath("/50-50"));
}
+ @Test
+ public void parseContentXmlWithBinaryProperty() throws
ParserConfigurationException, SAXException, IOException {
+
+ ResourceProxy root = parseContentXmlFile("binary-property.xml", "/");
+
+ assertThat("root has 1 property, binary property is ignored",
root.getProperties().entrySet(), hasSize(1));
+ }
+
private static Matcher<Calendar> millis(long millis) {
return new CalendarTimeInMillisMatcher(millis);
Added:
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/bin.binary
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/bin.binary?rev=1600611&view=auto
==============================================================================
---
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/bin.binary
(added)
+++
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/bin.binary
Thu Jun 5 11:36:54 2014
@@ -0,0 +1 @@
+
\ No newline at end of file
Added:
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/binary-property.xml
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/binary-property.xml?rev=1600611&view=auto
==============================================================================
---
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/binary-property.xml
(added)
+++
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/binary-property.xml
Thu Jun 5 11:36:54 2014
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ jcr:primaryType="nt:unstructured"
+ bin="{Binary}"/>
\ No newline at end of file
Propchange:
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/binary-property.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sling/trunk/tooling/ide/impl-vlt-test/src/test/resources/org/apache/sling/ide/impl/vlt/serialization/binary-property.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified:
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java
URL:
http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java?rev=1600611&r1=1600610&r2=1600611&view=diff
==============================================================================
---
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java
(original)
+++
sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/serialization/ContentXmlHandler.java
Thu Jun 5 11:36:54 2014
@@ -66,6 +66,11 @@ public class ContentXmlHandler extends D
String value = attributes.getValue(i);
Object typedValue = TypeHint.parsePossiblyTypedValue(value);
+ // unsupported
+ if (typedValue == null) {
+ continue;
+ }
+
current.addProperty(attributeQName, typedValue);
}
@@ -84,6 +89,12 @@ public class ContentXmlHandler extends D
// TODO - validate that this is comprehensive
static enum TypeHint {
+ BINARY("Binary") {
+ @Override
+ Object parseValues(String[] values) {
+ return null;
+ }
+ },
BOOLEAN("Boolean") {
@Override
Object parseValues(String[] values) {