I'm reading a File in Java and adding all the data to a Map. I'm using JSONParser to parse the result of posting that Map to a URL. Sometimes, it throws:
Exception in thread "Validate26" java.lang.Error: Error: could not match input
at org.json.simple.parser.Yylex.zzScanError(Yylex.java:474)
at org.json.simple.parser.Yylex.yylex(Yylex.java:681)
at org.json.simple.parser.JSONParser.nextToken(JSONParser.java:269)
at org.json.simple.parser.JSONParser.parse(JSONParser.java:118)
at org.json.simple.parser.JSONParser.parse(JSONParser.java:81)
at org.json.simple.parser.JSONParser.parse(JSONParser.java:75)
at com.faris.kingvalidator.ValidateRunnable.run(ValidateRunnable.java:78)
at java.lang.Thread.run(Thread.java:745)
"Validate26" is the name of my thread.
I read up somewhere that this means there's an illegal character somewhere. However, I'm not sure where as I cannot handle this Error, using a try {} and catch {} does not work for this error and the Map<> contains hundreds of strings so printing out every value would take ages to find the certain characters. Instead, I decided that I only want to parse the result, filtering out any characters other than A-Z (non-capital too), 0-9, *, _, -, /, comma and period. How may I do this? Thanks in advance.