@@ -66,7 +66,7 @@ public final class PciIds {
66
66
static {
67
67
if (!DB .isReady ()) {
68
68
69
- // if pciids file is found on the system, then process using this
69
+ // if pciids file is found on the system, then process using this file
70
70
String dbFile = null ;
71
71
for (final String path : PCI_IDS_PATH ) {
72
72
if ((new File (path )).exists ()) {
@@ -79,7 +79,7 @@ public final class PciIds {
79
79
if (dbFile != null ) {
80
80
InputStream is = null ;
81
81
try {
82
- is = new FileInputStream (new File ( dbFile ) );
82
+ is = new FileInputStream (dbFile );
83
83
DB .loadStream (is );
84
84
pciidsFileStatus = UefiConstants .FILESTATUS_FROM_FILESYSTEM ;
85
85
} catch (IOException e ) {
@@ -98,17 +98,19 @@ public final class PciIds {
98
98
99
99
// if pciids file is not found on the system or not accessible, then attempt to grab it from code
100
100
if (pciidsFileStatus == UefiConstants .FILESTATUS_NOT_ACCESSIBLE ) {
101
- InputStream istemp = PciIds .class .getResourceAsStream (PCIIDS_FILENAME );
102
- try {
103
- DB .loadStream (istemp );
104
- pciidsFileStatus = UefiConstants .FILESTATUS_FROM_CODE ;
105
- } catch (IOException e ) {
106
- // DB will not be ready, hardware IDs will not be translated
107
- } finally {
108
- if (istemp != null ) {
109
- try {
110
- istemp .close ();
111
- } catch (IOException e ) {
101
+ InputStream isFromCode = PciIds .class .getResourceAsStream (PCIIDS_FILENAME );
102
+ if (isFromCode != null ) {
103
+ try {
104
+ DB .loadStream (isFromCode );
105
+ pciidsFileStatus = UefiConstants .FILESTATUS_FROM_CODE ;
106
+ } catch (IOException e ) {
107
+ // DB will not be ready, hardware IDs will not be translated
108
+ } finally {
109
+ if (isFromCode != null ) {
110
+ try {
111
+ isFromCode .close ();
112
+ } catch (IOException e ) {
113
+ }
112
114
}
113
115
}
114
116
}
0 commit comments