mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
Use try-with-resources; other warnings fixed
GitOrigin-RevId: 57e9bbb62af11b0629f9d02534b07e7a921c55af
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b993d39371
commit
3df143dfe6
@@ -112,22 +112,17 @@ public class PythonFileType extends LanguageFileType {
|
||||
if (content == null || content.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
final BufferedReader reader = new BufferedReader(new CharSequenceReader(content));
|
||||
try {
|
||||
for (int i = 0; i < MAX_CHARSET_ENCODING_LINE; i++) {
|
||||
final String line = reader.readLine();
|
||||
if (line == null) {
|
||||
return null;
|
||||
}
|
||||
final Matcher matcher = ENCODING_PATTERN.matcher(line);
|
||||
if (matcher.find()) {
|
||||
final String charset = matcher.group(1);
|
||||
return normalizeCharset(charset);
|
||||
}
|
||||
try (BufferedReader reader = new BufferedReader(new CharSequenceReader(content))) {
|
||||
for (int i = 0; i < MAX_CHARSET_ENCODING_LINE; i++) {
|
||||
final String line = reader.readLine();
|
||||
if (line == null) {
|
||||
return null;
|
||||
}
|
||||
final Matcher matcher = ENCODING_PATTERN.matcher(line);
|
||||
if (matcher.find()) {
|
||||
final String charset = matcher.group(1);
|
||||
return normalizeCharset(charset);
|
||||
}
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
|
||||
Reference in New Issue
Block a user