File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
main/java/org/metafacture/json
test/java/org/metafacture/json Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -91,13 +91,17 @@ public void setWriteInvalid(final String writeInvalid) {
91
91
92
92
@ Override
93
93
public void process (final String json ) {
94
- JSONObject object = null ;
94
+ final JSONObject object ;
95
95
try {
96
96
object = new JSONObject (json ); // throws JSONException on syntax error
97
+ validate (json , object );
97
98
}
98
99
catch (final JSONException e ) {
99
100
handleInvalid (json , null , e .getMessage ());
100
101
}
102
+ }
103
+
104
+ private void validate (final String json , final JSONObject object ) {
101
105
try {
102
106
initSchema ();
103
107
schema .validate (object ); // throws ValidationException if invalid
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ public void testShouldInvalidateSyntaxError() {
87
87
88
88
@ Test (expected = MetafactureException .class )
89
89
public void testShouldCatchMissingSchemaFile () {
90
- new JsonValidator ("" ).process ("" );
90
+ new JsonValidator ("" ).process ("{} " );
91
91
}
92
92
93
93
@ Test (expected = MetafactureException .class )
You can’t perform that action at this time.
0 commit comments