Homework Problem:: I came across this question in a quiz of secure coding:
When creating a defensible method in java that accepts a string and compares it to a predefined value, what input validation would make the method defensible?
public static final String SLIDES="Slides";
public static final boolean isAcceptableType(String type){
if(________________________________){
return false;
}
if(!type.equals(SLIDES){
return false;
}
return true;
}
My goal is to fill the if condition that will make the method defensible. I can't change the other code.
According to my understanding we have to validate the method parameter to check if its a valid string. so that it will not throw any exception when it will be compared with SLIDES
I tried if(type==null) but I got incorrect result.
Please help me with this question. :)