Hi! I got today this Java parser failure rule triggered and it is hard to tell what is the actual issue. I have this record
import com.fasterxml.jackson.annotation.JsonProperty;
public record Person (@JsonProperty("person_id") String id,
@JsonProperty("person_name") String name){
}
And it returns a “Parse error” on line “public record Person”
The description of the rule says:
When the Java parser fails, it is possible to record the failure as a violation on the file. This way, not only it is possible to track the number of files that do not parse but also to easily find out why they do not parse.
It is not clear if it is actually a vulnerability or if it is a problem of the scanner reading the java file.
I converted the record to a regular class like the following and the issue went away
import com.fasterxml.jackson.annotation.JsonProperty;
public final class Person {
@JsonProperty("person_id")
private final String id;
@JsonProperty("persin_name")
private final String name;
public Person(String id,
String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
}
Thanks!