-
Enhancement
-
Resolution: Fixed
-
P5
-
None
-
b14
Method sun.awt.X11FontManager#registerFontDir contains huge try-finally block with big indentation:
FileReader fr = null;
try {
if (fontsDotDir.canRead()) {
fr = new FileReader(fontsDotDir);
//...
}
fr.close();
}
} catch (IOException ioe1) {
} finally {
if (fr != null) {
try {
fr.close();
} catch (IOException ioe2) {
}
}
}
Can be simplified if we move 'if (fontsDotDir.canRead()) {' outside of try-finally. And use try-with-resrouces for FileReader
FileReader fr = null;
try {
if (fontsDotDir.canRead()) {
fr = new FileReader(fontsDotDir);
//...
}
fr.close();
}
} catch (IOException ioe1) {
} finally {
if (fr != null) {
try {
fr.close();
} catch (IOException ioe2) {
}
}
}
Can be simplified if we move 'if (fontsDotDir.canRead()) {' outside of try-finally. And use try-with-resrouces for FileReader