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) {
9191
9292 @ Override
9393 public void process (final String json ) {
94- JSONObject object = null ;
94+ final JSONObject object ;
9595 try {
9696 object = new JSONObject (json ); // throws JSONException on syntax error
97+ validate (json , object );
9798 }
9899 catch (final JSONException e ) {
99100 handleInvalid (json , null , e .getMessage ());
100101 }
102+ }
103+
104+ private void validate (final String json , final JSONObject object ) {
101105 try {
102106 initSchema ();
103107 schema .validate (object ); // throws ValidationException if invalid
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ public void testShouldInvalidateSyntaxError() {
8787
8888 @ Test (expected = MetafactureException .class )
8989 public void testShouldCatchMissingSchemaFile () {
90- new JsonValidator ("" ).process ("" );
90+ new JsonValidator ("" ).process ("{} " );
9191 }
9292
9393 @ Test (expected = MetafactureException .class )
You can’t perform that action at this time.
0 commit comments