Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile warnings #21

Merged
merged 1 commit into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/org/spdx/library/model/ModelObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,9 @@ protected Optional<Boolean> getBooleanPropertyValue(String propertyName) throws
// try to convert
String sResult = ((String)result.get()).toLowerCase();
if ("true".equals(sResult)) {
return Optional.of(new Boolean(true));
return Optional.of(Boolean.valueOf(true));
} else if ("false".equals(sResult)) {
return Optional.of(new Boolean(false));
return Optional.of(Boolean.valueOf(false));
} else {
throw new SpdxInvalidTypeException("Property "+propertyName+" is not of type Boolean");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void testStoredObjectToModelObject() throws InvalidSPDXAnalysisException
new SpdxDocument(gmo.getModelStore(), gmo.getDocumentUri(), gmo.getCopyManager(), true);
String externalDocUri = "http://externalDoc";
Checksum checksum = gmo.createChecksum(ChecksumAlgorithm.SHA1, "A94A8FE5CCB19BA61C4C0873D391E987982FBBD3");
ExternalDocumentRef ref = gmo.createExternalDocumentRef(gmo.getModelStore().getNextId(IdType.DocumentRef, gmo.getDocumentUri()),
gmo.createExternalDocumentRef(gmo.getModelStore().getNextId(IdType.DocumentRef, gmo.getDocumentUri()),
externalDocUri, checksum);
String externalDocElementId = SpdxConstants.SPDX_ELEMENT_REF_PRENUM + "11";
String externalRefUri = externalDocUri + "#" + externalDocElementId;
Expand Down Expand Up @@ -97,7 +97,7 @@ public void testOptionalStoredObjectToModelObject() throws InvalidSPDXAnalysisEx
new SpdxDocument(gmo.getModelStore(), gmo.getDocumentUri(), gmo.getCopyManager(), true);
String externalDocUri = "http://externalDoc";
Checksum checksum = gmo.createChecksum(ChecksumAlgorithm.SHA1, "A94A8FE5CCB19BA61C4C0873D391E987982FBBD3");
ExternalDocumentRef ref = gmo.createExternalDocumentRef(gmo.getModelStore().getNextId(IdType.DocumentRef, gmo.getDocumentUri()),
gmo.createExternalDocumentRef(gmo.getModelStore().getNextId(IdType.DocumentRef, gmo.getDocumentUri()),
externalDocUri, checksum);
String externalDocElementId = SpdxConstants.SPDX_ELEMENT_REF_PRENUM + "11";
String externalRefUri = externalDocUri + "#" + externalDocElementId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ public void testSetHeaderTemplateHtml() throws InvalidSPDXAnalysisException, Inv
SpdxListedLicense stdl = new SpdxListedLicense(name, id, text,
sourceUrls, notes, standardLicenseHeader, template, false,
true, textHtml, false, null);
stdl.setStandardLicenseHeaderTemplate(standardLicenseHeaderTemplate);
stdl.setLicenseHeaderHtml(standardLicenseHeaderHtml);
assertEquals(textHtml, stdl.getLicenseTextHtml());
assertEquals(standardLicenseHeaderHtml, stdl.getLicenseHeaderHtml());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ public void testGetSetPrimativeValue() throws InvalidSpdxPropertyException {
* Test method for {@link org.spdx.storage.listedlicense.LicenseJson#clearPropertyValueList(java.lang.String)}.
* @throws InvalidSpdxPropertyException
*/
@SuppressWarnings("unchecked")
public void testAddClearGetPropertyValueList() throws InvalidSpdxPropertyException {
String licenseId = "SpdxLicenseId1";
LicenseJson lj = new LicenseJson(licenseId);
Expand Down Expand Up @@ -195,7 +194,6 @@ public void testJson() throws Exception {
for (String valueName:BOOLEAN_PROPERTY_VALUE_NAMES) {
assertEquals(booleanValues.get(valueName), lj.getValue(valueName));
}
@SuppressWarnings("unchecked")
List<String> seeAlsoResult = (List<String>)lj.getValueList("seeAlso");
assertEquals(seeAlsoValues.size(), seeAlsoResult.size());
for (String seeAlsoValue:seeAlsoValues) {
Expand Down Expand Up @@ -246,7 +244,6 @@ public void testLegacyJson() throws Exception {
for (String valueName:BOOLEAN_PROPERTY_VALUE_NAMES) {
assertEquals(booleanValues.get(valueName), lj.getValue(valueName));
}
@SuppressWarnings("unchecked")
List<String> seeAlsoResult = (List<String>)lj.getValueList("seeAlso");
assertEquals(seeAlsoValues.size(), seeAlsoResult.size());
for (String seeAlsoValue:seeAlsoValues) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void testCreateLicense() throws InvalidSPDXAnalysisException, InvalidLice
String licenseText = result.getLicenseText();
assertTrue(licenseText.length() > 100);
assertTrue(result.getComment().length() > 5);
String sResult = result.getDeprecatedVersion();
result.getDeprecatedVersion();
assertEquals(LICENSE_LIST_URI, result.getDocumentUri());
assertTrue(result.getFsfLibre());
assertFalse(result.isDeprecated());
Expand All @@ -200,16 +200,17 @@ public void testCreateLicense() throws InvalidSPDXAnalysisException, InvalidLice
assertEquals(SpdxConstants.CLASS_SPDX_LISTED_LICENSE, (result.getType()));
}

@SuppressWarnings("deprecation")
public void testCreateException() throws InvalidSPDXAnalysisException, InvalidLicenseTemplateException {
SpdxListedLicenseWebStore sllw = new SpdxListedLicenseWebStore();
LicenseException result = (LicenseException)SpdxModelFactory.createModelObject(sllw, LICENSE_LIST_URI, ECOS_EXCEPTION_ID, SpdxConstants.CLASS_SPDX_LICENSE_EXCEPTION, null);
assertEquals(ECOS_EXCEPTION_ID, result.getLicenseExceptionId());
assertEquals(ECOS_EXCEPTION_ID, result.getId());
assertTrue(result.getComment().length() > 5);
String sResult = result.getDeprecatedVersion();
result.getDeprecatedVersion();
assertEquals(LICENSE_LIST_URI, result.getDocumentUri());
sResult = result.getExample();
sResult = result.getLicenseExceptionTemplate();
result.getExample();
result.getLicenseExceptionTemplate();
assertTrue(result.getLicenseExceptionText().length() > 100);
assertEquals(ECOS_LICENSE_NAME, result.getName());
List<String> lResult = new ArrayList<String>(result.getSeeAlso());
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/spdx/storage/simple/InMemSpdxStoreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ public void testLock() throws InvalidSPDXAnalysisException, IOException, Interru
* step4: thread2 completes the write transaction, both threads verify value updated
*/
final Waiter waiter = new Waiter();
@SuppressWarnings("unused")
final Thread thread1 = new Thread(null, null, "Thread1") {
@Override
public void run() {
Expand Down Expand Up @@ -439,6 +440,7 @@ public void run() {
}
};

@SuppressWarnings("unused")
final Thread thread2 = new Thread(null ,null, "thread2") {
@Override
public void run() {
Expand Down
16 changes: 8 additions & 8 deletions src/test/java/org/spdx/utility/compare/SpdxComparerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,21 @@ public class SpdxComparerTest extends TestCase {
LICENSE_XLATION_MAP.put("LicenseRef-3", "LicenseRef-6");
}

Integer OFFSET1_1 = new Integer(2342);
Integer OFFSET1_1 = Integer.valueOf(2342);
ByteOffsetPointer BOP_POINTER1_1;
Integer LINE1_1 = new Integer(113);
Integer LINE1_1 = Integer.valueOf(113);
LineCharPointer LCP_POINTER1_1;
Integer OFFSET2_1 = new Integer(444);
Integer OFFSET2_1 = Integer.valueOf(444);
ByteOffsetPointer BOP_POINTER2_1;
Integer LINE2_1 = new Integer(23422);
Integer LINE2_1 = Integer.valueOf(23422);
LineCharPointer LCP_POINTER2_1;
Integer OFFSET1_2 = new Integer(3542);
Integer OFFSET1_2 = Integer.valueOf(3542);
ByteOffsetPointer BOP_POINTER1_2;
Integer LINE1_2 = new Integer(555);
Integer LINE1_2 = Integer.valueOf(555);
LineCharPointer LCP_POINTER1_2;
Integer OFFSET2_2 = new Integer(2444);
Integer OFFSET2_2 = Integer.valueOf(2444);
ByteOffsetPointer BOP_POINTER2_2;
Integer LINE2_2 = new Integer(23428);
Integer LINE2_2 = Integer.valueOf(23428);

private ExtractedLicenseInfo LICENSEA1;
private ExtractedLicenseInfo LICENSEA2;
Expand Down