adnanaziz / EPIJudge

EPI Judge - Preview Release
Other
2.83k stars 1.88k forks source link

Critical Exception thrown with Java code on Intellij Idea 2021 #215

Closed ashaychangwani closed 3 years ago

ashaychangwani commented 3 years ago
Critical error(epi.test_framework.minimal_json.ParseException): Unexpected end of input at 1:1
epi.test_framework.minimal_json.ParseException: Unexpected end of input at 1:1
    at epi.test_framework.minimal_json.JsonParser.error(JsonParser.java:478)
    at epi.test_framework.minimal_json.JsonParser.expected(JsonParser.java:472)
    at epi.test_framework.minimal_json.JsonParser.readValue(JsonParser.java:181)
    at epi.test_framework.minimal_json.JsonParser.parse(JsonParser.java:140)
    at epi.test_framework.minimal_json.JsonParser.parse(JsonParser.java:73)
    at epi.test_framework.minimal_json.Json.parse(Json.java:286)
    at epi.test_framework.GenericTest.updateTestPassed(GenericTest.java:181)
    at epi.test_framework.GenericTest.runTests(GenericTest.java:152)
    at epi.test_framework.GenericTest.genericTestMain(GenericTest.java:67)
    at epi.test_framework.GenericTest.runFromAnnotations(GenericTest.java:233)
    at epi.ValidIpAddresses.main(ValidIpAddresses.java:47)

The above error is thrown when I run the following code:

@EpiTest(testDataFile = "valid_ip_addresses.tsv")

  public static List<String> getValidIpAddress(String s) {
    return helper(new StringBuilder(s), 0, 0);
  }
  static List<String> helper(StringBuilder s, int done, int index){
    List<String> list = new ArrayList<>();
    if(index>=s.length())
      return list;
    if(done==3) {
      if (s.substring(index).length()<=3 && Integer.parseInt(s.substring(index)) < 256 && !(s.charAt(index)=='0' && s.substring(index).length()>1))
        list = List.of(s.toString());
      return list;
    }
    for(int i=1;i<=3;i++){
      if(index+i<s.length() && Integer.parseInt(s.substring(index, index+i))<256){
        list.addAll(helper(new StringBuilder(s).insert(index+i,"."), done+1, index+i+1));
      }
      if(s.charAt(index)=='0')
        break;
    }
    return list;
  }

All test cases pass, but during the calculation of the result, the error gets thrown. Please let me know if anymore details are required.

ashaychangwani commented 3 years ago

My apologies, seemed to happen because problem_mapping.js got replaced with a blank file. No clue how that happened. Not an issue with the repo.

zorro786 commented 2 years ago

@ashaychangwani This looks like an actual issue, happened with me too several times. Even after replacing the file, over time this error appears again - I verified today after replacing the mapping file.