using jdk 1.7 (so i can use String switches and the multicatch)
when running my code through sonar i got the following message:
switch (extension) {
Switch statement found where default case is missing
i understand what its saying but it is not right see my code below:
Why am i getting this error.
private void handlefileformats(String location) {
try {
String extension = location.substring(location.length() - 4);
switch (extension) {
case ".xml":
logger.info(LoggerMessages.getLoadxml());
break;
case ".txt":
case ".csv":
logger.info(LoggerMessages.getLoadcsv());
break;
default:
throw new IncorrectFileException(location, sets);
}
} catch (IOException || IncorrectFileExceptione) {
logger.fatal(LoggerMessages.getException(), e);
return null;
}
}
p.s. the code above is a simplified version of the original thats why i do not use the else if.
thanks in advance
Indeed Java7 will be supported in Sonar 2.12.