21
21
import java .util .Collections ;
22
22
import java .util .List ;
23
23
24
- import static hirs .utils .tpm .eventlog .uefi .UefiConstants .FILESTATUS_NOT_ACCESSIBLE ;
25
-
26
24
/**
27
25
* Provide Java access to PCI IDs.
28
26
*/
@@ -33,7 +31,7 @@ public final class PciIds {
33
31
* Track status of pciids file.
34
32
*/
35
33
@ Getter
36
- private static String pciidsFileStatus = FILESTATUS_NOT_ACCESSIBLE ;
34
+ private static String pciidsFileStatus = UefiConstants . FILESTATUS_NOT_ACCESSIBLE ;
37
35
38
36
/**
39
37
* Name of pciids file in code.
@@ -59,16 +57,12 @@ public final class PciIds {
59
57
60
58
/**
61
59
* The PCI IDs Database object.
62
- *
63
60
* This only needs to be loaded one time.
64
- *
65
61
* The pci ids library protects the data inside the object by making it immutable.
66
62
*/
67
63
public static final PciIdsDatabase DB = new PciIdsDatabase ();
68
64
69
- /**
70
- * Configure the PCI IDs Database object.
71
- */
65
+ //Configure the PCI IDs Database object.
72
66
static {
73
67
if (!DB .isReady ()) {
74
68
String dbFile = null ;
@@ -87,7 +81,7 @@ public final class PciIds {
87
81
dbFile = PciIds .class .getResource (PCIIDS_FILENAME ).getPath ();
88
82
}
89
83
if (dbFile != null ) {
90
- if (pciidsFileStatus != UefiConstants .FILESTATUS_FROM_FILESYSTEM ) {
84
+ if (! pciidsFileStatus . equals ( UefiConstants .FILESTATUS_FROM_FILESYSTEM ) ) {
91
85
pciidsFileStatus = UefiConstants .FILESTATUS_FROM_CODE ;
92
86
}
93
87
InputStream is = null ;
@@ -126,7 +120,7 @@ private PciIds() { }
126
120
*/
127
121
public static ASN1UTF8String translateVendor (final ASN1UTF8String refManufacturer ) {
128
122
ASN1UTF8String manufacturer = refManufacturer ;
129
- if (pciidsFileStatus != FILESTATUS_NOT_ACCESSIBLE
123
+ if (! pciidsFileStatus . equals ( UefiConstants . FILESTATUS_NOT_ACCESSIBLE )
130
124
&& manufacturer != null
131
125
&& manufacturer .getString ().trim ().matches ("^[0-9A-Fa-f]{4}$" )) {
132
126
Vendor ven = DB .findVendor (manufacturer .getString ().toLowerCase ());
@@ -145,7 +139,7 @@ public static ASN1UTF8String translateVendor(final ASN1UTF8String refManufacture
145
139
*/
146
140
public static String translateVendor (final String refManufacturer ) {
147
141
String manufacturer = refManufacturer ;
148
- if (pciidsFileStatus != FILESTATUS_NOT_ACCESSIBLE
142
+ if (! pciidsFileStatus . equals ( UefiConstants . FILESTATUS_NOT_ACCESSIBLE )
149
143
&& manufacturer != null
150
144
&& manufacturer .trim ().matches ("^[0-9A-Fa-f]{4}$" )) {
151
145
Vendor ven = DB .findVendor (manufacturer .toLowerCase ());
@@ -168,7 +162,7 @@ public static ASN1UTF8String translateDevice(final ASN1UTF8String refManufacture
168
162
final ASN1UTF8String refModel ) {
169
163
ASN1UTF8String manufacturer = refManufacturer ;
170
164
ASN1UTF8String model = refModel ;
171
- if (pciidsFileStatus != FILESTATUS_NOT_ACCESSIBLE
165
+ if (! pciidsFileStatus . equals ( UefiConstants . FILESTATUS_NOT_ACCESSIBLE )
172
166
&& manufacturer != null
173
167
&& model != null
174
168
&& manufacturer .getString ().trim ().matches ("^[0-9A-Fa-f]{4}$" )
@@ -193,7 +187,7 @@ public static ASN1UTF8String translateDevice(final ASN1UTF8String refManufacture
193
187
public static String translateDevice (final String refManufacturer ,
194
188
final String refModel ) {
195
189
String model = refModel ;
196
- if (pciidsFileStatus != FILESTATUS_NOT_ACCESSIBLE
190
+ if (! pciidsFileStatus . equals ( UefiConstants . FILESTATUS_NOT_ACCESSIBLE )
197
191
&& refManufacturer != null
198
192
&& model != null
199
193
&& refManufacturer .trim ().matches ("^[0-9A-Fa-f]{4}$" )
@@ -224,7 +218,7 @@ public static List<String> translateDeviceClass(final String refClassCode) {
224
218
List <String > translatedClassCode = new ArrayList <>();
225
219
226
220
String classCode = refClassCode ;
227
- if (pciidsFileStatus != FILESTATUS_NOT_ACCESSIBLE
221
+ if (! pciidsFileStatus . equals ( UefiConstants . FILESTATUS_NOT_ACCESSIBLE )
228
222
&& classCode != null
229
223
&& classCode .trim ().matches ("^[0-9A-Fa-f]{6}$" )) {
230
224
String deviceClass = classCode .substring (0 , 2 ).toLowerCase ();
0 commit comments