Use try-with-resources language construct where feasible
Closes gh-2063 Co-authored-by: igor-suhorukov <igor.suhorukov@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -146,13 +146,9 @@ public class ConfigurableMimeFileTypeMap extends FileTypeMap implements Initiali
|
||||
protected FileTypeMap createFileTypeMap(@Nullable Resource mappingLocation, @Nullable String[] mappings) throws IOException {
|
||||
MimetypesFileTypeMap fileTypeMap = null;
|
||||
if (mappingLocation != null) {
|
||||
InputStream is = mappingLocation.getInputStream();
|
||||
try {
|
||||
try (InputStream is = mappingLocation.getInputStream()) {
|
||||
fileTypeMap = new MimetypesFileTypeMap(is);
|
||||
}
|
||||
finally {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
else {
|
||||
fileTypeMap = new MimetypesFileTypeMap();
|
||||
|
||||
Reference in New Issue
Block a user