Replace deprecated constructors of boxed primitive types. [#2956]

This commit is contained in:
Mark H. Wood
2020-09-18 13:06:21 -04:00
parent ff02474423
commit d5d3b55457
4 changed files with 30 additions and 29 deletions

View File

@@ -22,6 +22,7 @@ import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
@@ -59,28 +60,28 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
/**
* Class Logger
*/
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(CitationDocumentServiceImpl.class);
private static final Logger log = LogManager.getLogger(CitationDocumentServiceImpl.class);
/**
* A set of MIME types that can have a citation page added to them. That is,
* MIME types in this set can be converted to a PDF which is then prepended
* with a citation page.
*/
protected final Set<String> VALID_TYPES = new HashSet<String>(2);
protected final Set<String> VALID_TYPES = new HashSet<>(2);
/**
* A set of MIME types that refer to a PDF
*/
protected final Set<String> PDF_MIMES = new HashSet<String>(2);
protected final Set<String> PDF_MIMES = new HashSet<>(2);
/**
* A set of MIME types that refer to a JPEG, PNG, or GIF
*/
protected final Set<String> RASTER_MIMES = new HashSet<String>();
protected final Set<String> RASTER_MIMES = new HashSet<>();
/**
* A set of MIME types that refer to a SVG
*/
protected final Set<String> SVG_MIMES = new HashSet<String>();
protected final Set<String> SVG_MIMES = new HashSet<>();
/**
* List of all enabled collections, inherited/determined for those under communities.
@@ -146,7 +147,7 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
String[] citationEnabledCommunities = configurationService
.getArrayProperty("citation-page.enabled_communities");
if (citationEnabledCollectionsList == null) {
citationEnabledCollectionsList = new ArrayList<String>();
citationEnabledCollectionsList = new ArrayList<>();
}
if (citationEnabledCommunities != null && citationEnabledCommunities.length > 0) {
@@ -239,7 +240,7 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
protected boolean isCitationEnabledThroughCollection(Context context, Bitstream bitstream) throws SQLException {
//Reject quickly if no-enabled collections
if (citationEnabledCollectionsList.size() == 0) {
if (citationEnabledCollectionsList.isEmpty()) {
return false;
}
@@ -312,7 +313,7 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
document.save(out);
byte[] data = out.toByteArray();
return Pair.of((InputStream) new ByteArrayInputStream(data), new Long(data.length));
return Pair.of((InputStream) new ByteArrayInputStream(data), Long.valueOf(data.length));
}
} finally {
@@ -480,7 +481,7 @@ public class CitationDocumentServiceImpl implements CitationDocumentService, Ini
public String getAllMetadataSeparated(Item item, String metadataKey) {
List<MetadataValue> dcValues = itemService.getMetadataByMetadataString(item, metadataKey);
ArrayList<String> valueArray = new ArrayList<String>();
ArrayList<String> valueArray = new ArrayList<>();
for (MetadataValue dcValue : dcValues) {
if (StringUtils.isNotBlank(dcValue.getValue())) {