HDDS-2179. ConfigFileGenerator fails with Java 10 or newer

Signed-off-by: Anu Engineer <aengineer@apache.org>
This commit is contained in:
Doroszlai, Attila 2019-09-25 21:43:33 +02:00 committed by Anu Engineer
parent b6ef8cc120
commit 0371e953ac

View File

@ -33,6 +33,7 @@
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.Writer; import java.io.Writer;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.NoSuchFileException;
import java.util.Set; import java.util.Set;
/** /**
@ -60,7 +61,7 @@ public boolean process(Set<? extends TypeElement> annotations,
.getResource(StandardLocation.CLASS_OUTPUT, "", .getResource(StandardLocation.CLASS_OUTPUT, "",
OUTPUT_FILE_NAME).openInputStream()) { OUTPUT_FILE_NAME).openInputStream()) {
appender.load(input); appender.load(input);
} catch (FileNotFoundException ex) { } catch (FileNotFoundException | NoSuchFileException ex) {
appender.init(); appender.init();
} }
@ -105,7 +106,7 @@ public boolean process(Set<? extends TypeElement> annotations,
} catch (IOException e) { } catch (IOException e) {
processingEnv.getMessager().printMessage(Kind.ERROR, processingEnv.getMessager().printMessage(Kind.ERROR,
"Can't generate the config file from annotation: " + e.getMessage()); "Can't generate the config file from annotation: " + e);
} }
return false; return false;
} }