Skip to content

Commit

Permalink
Architectural improvement and update on Gson JsonParser implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariana Azevedo committed Apr 21, 2020
1 parent d454c92 commit 167c02f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void setValidJson(JsonElement validJson) {
public boolean isValidJson(Object json, boolean muteLog){

if(json instanceof BufferedReader){
JsonElement res = new JsonParser().parse((BufferedReader)json);
JsonElement res = JsonParser.parseReader((BufferedReader)json);
this.validJson = res;
return true;
}
Expand Down Expand Up @@ -96,7 +96,7 @@ public void parseJSONObject(Object json, boolean muteException) {

if(json instanceof String){
try {
res = new JsonParser().parse((String)json);
res = JsonParser.parseString((String)json);
}catch(JsonSyntaxException e) {
if(!muteException) {
throw new JsonSyntaxException("Error: JSON with more invalid characters than commas and quotes on keys and values.");
Expand All @@ -107,7 +107,7 @@ public void parseJSONObject(Object json, boolean muteException) {
}

if(json instanceof BufferedReader){
res = new JsonParser().parse((BufferedReader)json);
res = JsonParser.parseReader((BufferedReader)json);
}

if (res != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.mariazevedo88.jfv.enumeration;
package io.github.mariazevedo88.jfv.model.enumeration;

/**
* Enum that lists the items used as delimiters in the application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;

import io.github.mariazevedo88.jfv.enumeration.DelimitersEnum;
import io.github.mariazevedo88.jfv.model.CustomJSON;
import io.github.mariazevedo88.jfv.model.enumeration.DelimitersEnum;

/**
* Class that verify a JSON and format in cases of invalid JSON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import io.github.mariazevedo88.jfv.enumeration.DelimitersEnum;
import io.github.mariazevedo88.jfv.model.enumeration.DelimitersEnum;

/**
* Class with method that verify, validates and filters a JSON
Expand Down

0 comments on commit 167c02f

Please sign in to comment.