|
|
@@ -16,7 +16,7 @@ package de.jplag.cpp;
|
|
|
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
-import java.io.FileNotFoundException;
|
|
|
+import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
public class CPPScanner implements CPPTokenConstants {
|
|
|
@@ -24,11 +24,10 @@ public class CPPScanner implements CPPTokenConstants {
|
|
|
|
|
|
public static boolean scanFile(File dir, String fileName, Scanner delegatingScanner) {
|
|
|
CPPScanner scanner;
|
|
|
- try {
|
|
|
- InputStream input = new NewlineStream(new FileInputStream(new File(dir, fileName)));
|
|
|
+ try(InputStream input = new NewlineStream(new FileInputStream(new File(dir, fileName)))) {
|
|
|
scanner = new CPPScanner(input, "UTF-8");
|
|
|
scanner.delegatingScanner = delegatingScanner;
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
+ } catch (IOException e) {
|
|
|
System.out.println("C/C++ Scanner: File " + fileName + " not found.");
|
|
|
return false;
|
|
|
}
|