Skip to content
This repository was archived by the owner on Jun 26, 2021. It is now read-only.

Commit 31ff0e8

Browse files
committed
Merge branch 'master' of git://github.com/DataInMotion/emfjson-jackson into DataInMotion-master
2 parents 8890f21 + 515029a commit 31ff0e8

4 files changed

Lines changed: 103 additions & 46 deletions

File tree

src/main/java/org/emfjson/jackson/databind/deser/EObjectDeserializer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ private void readFeature(JsonParser jp,
209209
if (jp.getCurrentToken() == JsonToken.FIELD_NAME) {
210210
jp.nextToken();
211211
}
212+
213+
if (jp.getCurrentToken() == JsonToken.VALUE_NULL) {
214+
return;
215+
}
212216

213217
if (feature instanceof EAttribute) {
214218
readAttribute(jp, current, (EAttribute) feature, resource, ctxt);
Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,47 @@
1-
/*
2-
* Copyright (c) 2015 Guillaume Hillairet.
3-
* All rights reserved. This program and the accompanying materials
4-
* are made available under the terms of the Eclipse Public License v1.0
5-
* which accompanies this distribution, and is available at
6-
* http://www.eclipse.org/legal/epl-v10.html
7-
*
8-
* Contributors:
9-
* Guillaume Hillairet - initial API and implementation
10-
*
11-
*/
12-
package org.emfjson.jackson.junit;
13-
14-
import org.junit.runner.RunWith;
15-
import org.junit.runners.Suite;
16-
import org.junit.runners.Suite.SuiteClasses;
17-
18-
import org.emfjson.jackson.junit.tests.*;
19-
20-
@RunWith(Suite.class)
21-
@SuiteClasses({
22-
AnnotationTest.class,
23-
ContainmentTest.class,
24-
CustomDeserializersTest.class,
25-
CustomSerializersTest.class,
26-
DynamicInstanceTest.class,
27-
DynamicMapTest.class,
28-
DynamicPackageTest.class,
29-
EnumTest.class,
30-
ExternalReferencesTest.class,
31-
FeatureMapTest.class,
32-
GenericTest.class,
33-
IdTest.class,
34-
JacksonOptionTest.class,
35-
MapTest.class,
36-
ModuleTest.class,
37-
NoTypeTest.class,
38-
PolymorphicTest.class,
39-
ProxyAttributeTest.class,
40-
ReaderTest.class,
41-
ReferenceTest.class,
42-
UuidLoadTest.class,
43-
UuidSaveTest.class,
44-
ValueTest.class
45-
})
46-
public class TestSuite {}
1+
/*
2+
* Copyright (c) 2015 Guillaume Hillairet.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Guillaume Hillairet - initial API and implementation
10+
*
11+
*/
12+
package org.emfjson.jackson.junit;
13+
14+
import org.junit.runner.RunWith;
15+
import org.junit.runners.Suite;
16+
import org.junit.runners.Suite.SuiteClasses;
17+
18+
import org.emfjson.jackson.junit.tests.*;
19+
20+
@RunWith(Suite.class)
21+
@SuiteClasses({
22+
AnnotationTest.class,
23+
ContainmentTest.class,
24+
CustomDeserializersTest.class,
25+
CustomSerializersTest.class,
26+
DynamicInstanceTest.class,
27+
DynamicMapTest.class,
28+
DynamicPackageTest.class,
29+
EnumTest.class,
30+
ExternalReferencesTest.class,
31+
FeatureMapTest.class,
32+
GenericTest.class,
33+
IdTest.class,
34+
JacksonOptionTest.class,
35+
MapTest.class,
36+
ModuleTest.class,
37+
NoTypeTest.class,
38+
PolymorphicTest.class,
39+
ProxyAttributeTest.class,
40+
ReaderTest.class,
41+
ReferenceTest.class,
42+
UuidLoadTest.class,
43+
UuidSaveTest.class,
44+
ValueTest.class,
45+
NullValueInBetweenTest.class
46+
})
47+
public class TestSuite {}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) 2016 Data In Motion UG.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Juergen Albert - initial API and implementation
10+
*
11+
*/
12+
package org.emfjson.jackson.junit.tests;
13+
14+
import static org.junit.Assert.assertNotNull;
15+
import static org.junit.Assert.assertNull;
16+
import static org.junit.Assert.assertTrue;
17+
18+
import java.io.IOException;
19+
20+
import org.eclipse.emf.common.util.URI;
21+
import org.eclipse.emf.ecore.resource.Resource;
22+
import org.emfjson.jackson.junit.model.PrimaryObject;
23+
import org.emfjson.jackson.junit.support.TestSupport;
24+
import org.junit.Test;
25+
26+
public class NullValueInBetweenTest extends TestSupport {
27+
28+
@Test
29+
public void testSaveOneRootObjectWithAttributes() throws IOException {
30+
31+
Resource resource = resourceSet.createResource(URI.createURI("src/test/resources/tests/test-load-null-value-in-between.json"));
32+
assertNotNull(resource);
33+
34+
resource.load(null);
35+
36+
assertTrue(!resource.getContents().isEmpty());
37+
PrimaryObject type = (PrimaryObject) resource.getContents().get(0);
38+
39+
assertNull(type.getName());
40+
assertNotNull(type.getFeatureMapAttributeType1());
41+
assertNotNull(type.getFeatureMapAttributeType2());
42+
}
43+
44+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"eClass": "http://www.emfjson.org/jackson/model#//PrimaryObject",
3+
"name": null,
4+
"featureMapAttributeType1": "Hello",
5+
"featureMapAttributeType2": "World"
6+
}
7+
8+

0 commit comments

Comments
 (0)