Skip to content

Commit 86d2084

Browse files
issue_825: Successfully merged main into this branch
2 parents 2291263 + d0faa39 commit 86d2084

File tree

109 files changed

+1803
-3628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1803
-3628
lines changed

HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/userdefined/rim/BaseReferenceManifest.java

+31-24
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ public BaseReferenceManifest(final byte[] rimBytes) throws UnmarshalException {
103103
* @param rimBytes byte array representation of the RIM
104104
* @throws IOException if unable to unmarshal the string
105105
*/
106-
@SuppressWarnings("checkstyle:AvoidInlineConditionals")
107106
public BaseReferenceManifest(final String fileName, final byte[] rimBytes)
108107
throws UnmarshalException {
109108
super(rimBytes);
@@ -127,9 +126,11 @@ public BaseReferenceManifest(final String fileName, final byte[] rimBytes)
127126
SwidTagConstants.SWIDTAG_NAMESPACE, SwidTagConstants.META).item(0);
128127
setTagId(softwareIdentity.getAttribute(SwidTagConstants.TAGID));
129128
this.swidName = softwareIdentity.getAttribute(SwidTagConstants.NAME);
130-
this.swidCorpus = Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.CORPUS)) ? 1 : 0;
129+
this.swidCorpus =
130+
Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.CORPUS)) ? 1 : 0;
131131
this.setSwidPatch(Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.PATCH)));
132-
this.setSwidSupplemental(Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.SUPPLEMENTAL)));
132+
this.setSwidSupplemental(
133+
Boolean.parseBoolean(softwareIdentity.getAttribute(SwidTagConstants.SUPPLEMENTAL)));
133134
this.setSwidVersion(softwareIdentity.getAttribute(SwidTagConstants.VERSION));
134135
this.setSwidTagVersion(softwareIdentity.getAttribute(SwidTagConstants.TAGVERSION));
135136

@@ -147,20 +148,22 @@ public BaseReferenceManifest(final String fileName, final byte[] rimBytes)
147148
*/
148149
private void parseSoftwareMeta(final Element softwareMeta) {
149150
if (softwareMeta != null) {
150-
this.colloquialVersion = softwareMeta.getAttribute(SwidTagConstants._COLLOQUIAL_VERSION_STR);
151-
this.product = softwareMeta.getAttribute(SwidTagConstants._PRODUCT_STR);
152-
this.revision = softwareMeta.getAttribute(SwidTagConstants._REVISION_STR);
153-
this.edition = softwareMeta.getAttribute(SwidTagConstants._EDITION_STR);
154-
this.rimLinkHash = softwareMeta.getAttribute(SwidTagConstants._RIM_LINK_HASH_STR);
155-
this.bindingSpec = softwareMeta.getAttribute(SwidTagConstants._BINDING_SPEC_STR);
156-
this.bindingSpecVersion = softwareMeta.getAttribute(SwidTagConstants._BINDING_SPEC_VERSION_STR);
157-
this.setPlatformManufacturerId(softwareMeta.getAttribute(SwidTagConstants._PLATFORM_MANUFACTURER_ID_STR));
158-
this.setPlatformManufacturer(softwareMeta.getAttribute(SwidTagConstants._PLATFORM_MANUFACTURER_STR));
159-
this.setPlatformModel(softwareMeta.getAttribute(SwidTagConstants._PLATFORM_MODEL_STR));
160-
this.platformVersion = softwareMeta.getAttribute(SwidTagConstants._PLATFORM_VERSION_STR);
161-
this.payloadType = softwareMeta.getAttribute(SwidTagConstants._PAYLOAD_TYPE_STR);
162-
this.pcURIGlobal = softwareMeta.getAttribute(SwidTagConstants._PC_URI_GLOBAL_STR);
163-
this.pcURILocal = softwareMeta.getAttribute(SwidTagConstants._PC_URI_LOCAL_STR);
151+
this.colloquialVersion = softwareMeta.getAttribute(SwidTagConstants.COLLOQUIAL_VERSION_STR);
152+
this.product = softwareMeta.getAttribute(SwidTagConstants.PRODUCT_STR);
153+
this.revision = softwareMeta.getAttribute(SwidTagConstants.REVISION_STR);
154+
this.edition = softwareMeta.getAttribute(SwidTagConstants.EDITION_STR);
155+
this.rimLinkHash = softwareMeta.getAttribute(SwidTagConstants.RIM_LINK_HASH_STR);
156+
this.bindingSpec = softwareMeta.getAttribute(SwidTagConstants.BINDING_SPEC_STR);
157+
this.bindingSpecVersion = softwareMeta.getAttribute(SwidTagConstants.BINDING_SPEC_VERSION_STR);
158+
this.setPlatformManufacturerId(
159+
softwareMeta.getAttribute(SwidTagConstants.PLATFORM_MANUFACTURER_ID_STR));
160+
this.setPlatformManufacturer(
161+
softwareMeta.getAttribute(SwidTagConstants.PLATFORM_MANUFACTURER_FULL_STR));
162+
this.setPlatformModel(softwareMeta.getAttribute(SwidTagConstants.PLATFORM_MODEL_STR));
163+
this.platformVersion = softwareMeta.getAttribute(SwidTagConstants.PLATFORM_VERSION_STR);
164+
this.payloadType = softwareMeta.getAttribute(SwidTagConstants.PAYLOAD_TYPE_STR);
165+
this.pcURIGlobal = softwareMeta.getAttribute(SwidTagConstants.PC_URI_GLOBAL_STR);
166+
this.pcURILocal = softwareMeta.getAttribute(SwidTagConstants.PC_URI_LOCAL_STR);
164167
} else {
165168
log.warn("SoftwareMeta Tag not found.");
166169
}
@@ -202,7 +205,6 @@ private void parseLink(final Element link) {
202205
* This method validates the .swidtag file at the given filepath against the
203206
* schema. A successful validation results in the output of the tag's name
204207
* and tagId attributes, otherwise a generic error message is printed.
205-
*
206208
*/
207209
private Element getDirectoryTag(final byte[] rimBytes) {
208210
if (rimBytes == null || rimBytes.length == 0) {
@@ -254,7 +256,6 @@ public List<SwidResource> getFileResources() {
254256
* This method iterates over the list of File elements under the directory.
255257
*
256258
* @param rimBytes the bytes to find the files
257-
*
258259
*/
259260
public List<SwidResource> getFileResources(final byte[] rimBytes) {
260261
Element directoryTag = getDirectoryTag(rimBytes);
@@ -267,8 +268,8 @@ public List<SwidResource> getFileResources(final byte[] rimBytes) {
267268
swidResource = new SwidResource();
268269
swidResource.setName(file.getAttribute(SwidTagConstants.NAME));
269270
swidResource.setSize(file.getAttribute(SwidTagConstants.SIZE));
270-
swidResource.setHashValue(file.getAttribute(SwidTagConstants._SHA256_HASH.getPrefix() + ":"
271-
+ SwidTagConstants._SHA256_HASH.getLocalPart()));
271+
swidResource.setHashValue(file.getAttribute(SwidTagConstants.SHA_256_HASH.getPrefix() + ":"
272+
+ SwidTagConstants.SHA_256_HASH.getLocalPart()));
272273
validHashes.add(swidResource);
273274
}
274275

@@ -353,9 +354,15 @@ private Document removeXMLWhitespace(final ByteArrayInputStream byteArrayInputSt
353354

354355
@Override
355356
public boolean equals(Object o) {
356-
if (this == o) return true;
357-
if (o == null || getClass() != o.getClass()) return false;
358-
if (!super.equals(o)) return false;
357+
if (this == o) {
358+
return true;
359+
}
360+
if (o == null || getClass() != o.getClass()) {
361+
return false;
362+
}
363+
if (!super.equals(o)) {
364+
return false;
365+
}
359366
BaseReferenceManifest that = (BaseReferenceManifest) o;
360367
return swidCorpus == that.swidCorpus && Objects.equals(swidName, that.swidName)
361368
&& Objects.equals(colloquialVersion, that.colloquialVersion)

0 commit comments

Comments
 (0)