Clean up more warnings. #8320

This commit is contained in:
Mark H. Wood
2022-07-13 16:49:18 -04:00
parent e9313acd24
commit 41e1d8506b
26 changed files with 174 additions and 151 deletions

View File

@@ -138,6 +138,7 @@ public class StructBuilder {
* @throws SQLException passed through. * @throws SQLException passed through.
* @throws FileNotFoundException if input or output could not be opened. * @throws FileNotFoundException if input or output could not be opened.
* @throws TransformerException if the input document is invalid. * @throws TransformerException if the input document is invalid.
* @throws XPathExpressionException passed through.
*/ */
public static void main(String[] argv) public static void main(String[] argv)
throws ParserConfigurationException, SQLException, throws ParserConfigurationException, SQLException,
@@ -209,6 +210,7 @@ public class StructBuilder {
// Export? Import? // Export? Import?
if (line.hasOption('x')) { // export if (line.hasOption('x')) { // export
exportStructure(context, outputStream); exportStructure(context, outputStream);
outputStream.close();
} else { // Must be import } else { // Must be import
String input = line.getOptionValue('f'); String input = line.getOptionValue('f');
if (null == input) { if (null == input) {
@@ -224,6 +226,10 @@ public class StructBuilder {
} }
importStructure(context, inputStream, outputStream); importStructure(context, inputStream, outputStream);
inputStream.close();
outputStream.close();
// save changes from import // save changes from import
context.complete(); context.complete();
} }

View File

@@ -630,11 +630,9 @@ public class ItemExportServiceImpl implements ItemExportService {
Thread go = new Thread() { Thread go = new Thread() {
@Override @Override
public void run() { public void run() {
Context context = null; Context context = new Context();
Iterator<Item> iitems = null; Iterator<Item> iitems = null;
try { try {
// create a new dspace context
context = new Context();
// ignore auths // ignore auths
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();

View File

@@ -1665,26 +1665,27 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
.trim(); .trim();
} }
if (isTest) {
continue;
}
Bitstream bs = null; Bitstream bs = null;
boolean notfound = true;
boolean updateRequired = false; boolean updateRequired = false;
if (!isTest) {
// find bitstream // find bitstream
List<Bitstream> bitstreams = itemService.getNonInternalBitstreams(c, myItem); List<Bitstream> bitstreams = itemService.getNonInternalBitstreams(c, myItem);
for (int j = 0; j < bitstreams.size() && notfound; j++) { for (Bitstream bitstream : bitstreams) {
if (bitstreams.get(j).getName().equals(bitstreamName)) { if (bitstream.getName().equals(bitstreamName)) {
bs = bitstreams.get(j); bs = bitstream;
notfound = false; break;
}
} }
} }
if (notfound && !isTest) { if (null == bs) {
// this should never happen // this should never happen
System.out.println("\tdefault permissions set for " System.out.printf("\tdefault permissions set for %s%n",
+ bitstreamName); bitstreamName);
} else if (!isTest) { } else {
if (permissionsExist) { if (permissionsExist) {
if (myGroup == null) { if (myGroup == null) {
System.out.println("\t" + groupName System.out.println("\t" + groupName
@@ -2025,15 +2026,11 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
Thread go = new Thread() { Thread go = new Thread() {
@Override @Override
public void run() { public void run() {
Context context = null; Context context = new Context();
String importDir = null; String importDir = null;
EPerson eperson = null; EPerson eperson = null;
try { try {
// create a new dspace context
context = new Context();
eperson = ePersonService.find(context, oldEPerson.getID()); eperson = ePersonService.find(context, oldEPerson.getID());
context.setCurrentUser(eperson); context.setCurrentUser(eperson);
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
@@ -2044,7 +2041,8 @@ public class ItemImportServiceImpl implements ItemImportService, InitializingBea
if (theOtherCollections != null) { if (theOtherCollections != null) {
for (String colID : theOtherCollections) { for (String colID : theOtherCollections) {
UUID colId = UUID.fromString(colID); UUID colId = UUID.fromString(colID);
if (!theOwningCollection.getID().equals(colId)) { if (theOwningCollection != null
&& !theOwningCollection.getID().equals(colId)) {
Collection col = collectionService.find(context, colId); Collection col = collectionService.find(context, colId);
if (col != null) { if (col != null) {
collectionList.add(col); collectionList.add(col);

View File

@@ -77,7 +77,7 @@ public class AddBitstreamsAction extends UpdateBitstreamsAction {
ItemUpdate.pr("Contents bitstream count: " + contents.size()); ItemUpdate.pr("Contents bitstream count: " + contents.size());
String[] files = dir.list(ItemUpdate.fileFilter); String[] files = dir.list(ItemUpdate.fileFilter);
List<String> fileList = new ArrayList<String>(); List<String> fileList = new ArrayList<>();
for (String filename : files) { for (String filename : files) {
fileList.add(filename); fileList.add(filename);
ItemUpdate.pr("file: " + filename); ItemUpdate.pr("file: " + filename);
@@ -134,9 +134,6 @@ public class AddBitstreamsAction extends UpdateBitstreamsAction {
ItemUpdate.pr("contents entry for bitstream: " + ce.toString()); ItemUpdate.pr("contents entry for bitstream: " + ce.toString());
File f = new File(dir, ce.filename); File f = new File(dir, ce.filename);
// get an input stream
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(f));
Bitstream bs = null; Bitstream bs = null;
String newBundleName = ce.bundlename; String newBundleName = ce.bundlename;
@@ -173,7 +170,9 @@ public class AddBitstreamsAction extends UpdateBitstreamsAction {
targetBundle = bundles.iterator().next(); targetBundle = bundles.iterator().next();
} }
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(f));) {
bs = bitstreamService.create(context, targetBundle, bis); bs = bitstreamService.create(context, targetBundle, bis);
}
bs.setName(context, ce.filename); bs.setName(context, ce.filename);
// Identify the format // Identify the format

View File

@@ -290,7 +290,7 @@ public class BrowseEngine {
// now, if we don't have any results, we are at the end of the browse. This will // now, if we don't have any results, we are at the end of the browse. This will
// be because a starts_with value has been supplied for which we don't have // be because a starts_with value has been supplied for which we don't have
// any items. // any items.
if (results.size() == 0) { if (results.isEmpty()) {
// In this case, we will calculate a new offset for the last page of results // In this case, we will calculate a new offset for the last page of results
offset = total - scope.getResultsPerPage(); offset = total - scope.getResultsPerPage();
if (offset < 0) { if (offset < 0) {
@@ -450,7 +450,7 @@ public class BrowseEngine {
// now, if we don't have any results, we are at the end of the browse. This will // now, if we don't have any results, we are at the end of the browse. This will
// be because a starts_with value has been supplied for which we don't have // be because a starts_with value has been supplied for which we don't have
// any items. // any items.
if (results.size() == 0) { if (results.isEmpty()) {
// In this case, we will calculate a new offset for the last page of results // In this case, we will calculate a new offset for the last page of results
offset = total - scope.getResultsPerPage(); offset = total - scope.getResultsPerPage();
if (offset < 0) { if (offset < 0) {
@@ -463,7 +463,7 @@ public class BrowseEngine {
} }
} else { } else {
// No records, so make an empty list // No records, so make an empty list
results = new ArrayList<String[]>(); results = new ArrayList<>();
} }
// construct the BrowseInfo object to pass back // construct the BrowseInfo object to pass back
@@ -554,7 +554,7 @@ public class BrowseEngine {
} }
String col = "sort_1"; String col = "sort_1";
if (so.getNumber() > 0) { if (so != null && so.getNumber() > 0) {
col = "sort_" + Integer.toString(so.getNumber()); col = "sort_" + Integer.toString(so.getNumber());
} }
@@ -591,7 +591,7 @@ public class BrowseEngine {
} }
String col = "sort_1"; String col = "sort_1";
if (so.getNumber() > 0) { if (so != null && so.getNumber() > 0) {
col = "sort_" + Integer.toString(so.getNumber()); col = "sort_" + Integer.toString(so.getNumber());
} }

View File

@@ -100,8 +100,9 @@ public class CitationPage extends AbstractCurationTask {
try { try {
dBundle = bundleService.create(Curator.curationContext(), item, CitationPage.DISPLAY_BUNDLE_NAME); dBundle = bundleService.create(Curator.curationContext(), item, CitationPage.DISPLAY_BUNDLE_NAME);
} catch (AuthorizeException e) { } catch (AuthorizeException e) {
log.error("User not authroized to create bundle on item \"" log.error("User not authroized to create bundle on item \"{}\": {}",
+ item.getName() + "\": " + e.getMessage()); item::getName, e::getMessage);
return;
} }
} else { } else {
dBundle = dBundles.get(0); dBundle = dBundles.get(0);
@@ -120,7 +121,7 @@ public class CitationPage extends AbstractCurationTask {
List<Bundle> pBundles = itemService.getBundles(item, CitationPage.PRESERVATION_BUNDLE_NAME); List<Bundle> pBundles = itemService.getBundles(item, CitationPage.PRESERVATION_BUNDLE_NAME);
Bundle pBundle = null; Bundle pBundle = null;
List<Bundle> bundles = new ArrayList<>(); List<Bundle> bundles = new ArrayList<>();
if (pBundles != null && pBundles.size() > 0) { if (pBundles != null && !pBundles.isEmpty()) {
pBundle = pBundles.get(0); pBundle = pBundles.get(0);
bundles.addAll(itemService.getBundles(item, "ORIGINAL")); bundles.addAll(itemService.getBundles(item, "ORIGINAL"));
bundles.addAll(pBundles); bundles.addAll(pBundles);

View File

@@ -144,8 +144,6 @@ var CollReport = function() {
self.myHtmlUtil.addTd(tr, parval).addClass("title comm"); self.myHtmlUtil.addTd(tr, parval).addClass("title comm");
self.myHtmlUtil.addTdAnchor(tr, coll.name, self.ROOTPATH + coll.handle).addClass("title"); self.myHtmlUtil.addTdAnchor(tr, coll.name, self.ROOTPATH + coll.handle).addClass("title");
var td = self.myHtmlUtil.addTd(tr, "").addClass("num").addClass("link").addClass("numCount");
td = self.myHtmlUtil.addTd(tr, "").addClass("num").addClass("numFiltered");
}; };

View File

@@ -29,13 +29,13 @@ THE SOFTWARE.
(function(root, factory) { (function(root, factory) {
/* CommonJS */ /* CommonJS */
if (typeof exports == 'object') module.exports = factory() if (typeof exports == 'object') module.exports = factory();
/* AMD module */ /* AMD module */
else if (typeof define == 'function' && define.amd) define(factory) else if (typeof define == 'function' && define.amd) define(factory);
/* Browser global */ /* Browser global */
else root.Spinner = factory() else root.Spinner = factory();
} }
(this, function() { (this, function() {
"use strict"; "use strict";
@@ -43,6 +43,7 @@ THE SOFTWARE.
var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */ var prefixes = ['webkit', 'Moz', 'ms', 'O'] /* Vendor prefixes */
, animations = {} /* Animation rules keyed by their name */ , animations = {} /* Animation rules keyed by their name */
, useCssAnimations /* Whether to use CSS animations or setTimeout */ , useCssAnimations /* Whether to use CSS animations or setTimeout */
;
/** /**
* Utility function to create elements. If no tag name is given, * Utility function to create elements. If no tag name is given,
@@ -51,9 +52,10 @@ THE SOFTWARE.
function createEl(tag, prop) { function createEl(tag, prop) {
var el = document.createElement(tag || 'div') var el = document.createElement(tag || 'div')
, n , n
;
for(n in prop) el[n] = prop[n] for(n in prop) el[n] = prop[n];
return el return el;
} }
/** /**
@@ -63,17 +65,17 @@ THE SOFTWARE.
for (var i=1, n=arguments.length; i<n; i++) for (var i=1, n=arguments.length; i<n; i++)
parent.appendChild(arguments[i]) parent.appendChild(arguments[i])
return parent return parent;
} }
/** /**
* Insert a new stylesheet to hold the @keyframe or VML rules. * Insert a new stylesheet to hold the @keyframe or VML rules.
*/ */
var sheet = (function() { var sheet = (function() {
var el = createEl('style', {type : 'text/css'}) var el = createEl('style', {type : 'text/css'});
ins(document.getElementsByTagName('head')[0], el) ins(document.getElementsByTagName('head')[0], el);
return el.sheet || el.styleSheet return el.sheet || el.styleSheet;
}()) }());
/** /**
* Creates an opacity keyframe animation rule and returns its name. * Creates an opacity keyframe animation rule and returns its name.
@@ -86,6 +88,7 @@ THE SOFTWARE.
, z = Math.max(1 - (1-alpha) / trail * (100-start), alpha) , z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)
, prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase() , prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()
, pre = prefix && '-' + prefix + '-' || '' , pre = prefix && '-' + prefix + '-' || ''
;
if (!animations[name]) { if (!animations[name]) {
sheet.insertRule( sheet.insertRule(
@@ -95,12 +98,12 @@ THE SOFTWARE.
(start+0.01) + '%{opacity:1}' + (start+0.01) + '%{opacity:1}' +
(start+trail) % 100 + '%{opacity:' + alpha + '}' + (start+trail) % 100 + '%{opacity:' + alpha + '}' +
'100%{opacity:' + z + '}' + '100%{opacity:' + z + '}' +
'}', sheet.cssRules.length) '}', sheet.cssRules.length);
animations[name] = 1 animations[name] = 1;
} }
return name return name;
} }
/** /**
@@ -110,13 +113,14 @@ THE SOFTWARE.
var s = el.style var s = el.style
, pp , pp
, i , i
;
prop = prop.charAt(0).toUpperCase() + prop.slice(1) prop = prop.charAt(0).toUpperCase() + prop.slice(1);
for(i=0; i<prefixes.length; i++) { for(i=0; i<prefixes.length; i++) {
pp = prefixes[i]+prop pp = prefixes[i]+prop;
if(s[pp] !== undefined) return pp if(s[pp] !== undefined) return pp;
} }
if(s[prop] !== undefined) return prop if(s[prop] !== undefined) return prop;
} }
/** /**
@@ -124,9 +128,9 @@ THE SOFTWARE.
*/ */
function css(el, prop) { function css(el, prop) {
for (var n in prop) for (var n in prop)
el.style[vendor(el, n)||n] = prop[n] el.style[vendor(el, n)||n] = prop[n];
return el return el;
} }
/** /**
@@ -134,18 +138,18 @@ THE SOFTWARE.
*/ */
function merge(obj) { function merge(obj) {
for (var i=1; i < arguments.length; i++) { for (var i=1; i < arguments.length; i++) {
var def = arguments[i] var def = arguments[i];
for (var n in def) for (var n in def)
if (obj[n] === undefined) obj[n] = def[n] if (obj[n] === undefined) obj[n] = def[n];
} }
return obj return obj;
} }
/** /**
* Returns the line color from the given string or array. * Returns the line color from the given string or array.
*/ */
function getColor(color, idx) { function getColor(color, idx) {
return typeof color == 'string' ? color : color[idx % color.length] return typeof color == 'string' ? color : color[idx % color.length];
} }
// Built-in defaults // Built-in defaults
@@ -168,15 +172,15 @@ THE SOFTWARE.
top: '50%', // center vertically top: '50%', // center vertically
left: '50%', // center horizontally left: '50%', // center horizontally
position: 'absolute' // element position position: 'absolute' // element position
} };
/** The constructor */ /** The constructor */
function Spinner(o) { function Spinner(o) {
this.opts = merge(o || {}, Spinner.defaults, defaults) this.opts = merge(o || {}, Spinner.defaults, defaults);
} }
// Global defaults that override the built-ins: // Global defaults that override the built-ins:
Spinner.defaults = {} Spinner.defaults = {};
merge(Spinner.prototype, { merge(Spinner.prototype, {
@@ -186,23 +190,24 @@ THE SOFTWARE.
* stop() internally. * stop() internally.
*/ */
spin: function(target) { spin: function(target) {
this.stop() this.stop();
var self = this var self = this
, o = self.opts , o = self.opts
, el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex}) , el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
;
css(el, { css(el, {
left: o.left, left: o.left,
top: o.top top: o.top
}) });
if (target) { if (target) {
target.insertBefore(el, target.firstChild||null) target.insertBefore(el, target.firstChild||null);
} }
el.setAttribute('role', 'progressbar') el.setAttribute('role', 'progressbar');
self.lines(el, self.opts) self.lines(el, self.opts);
if (!useCssAnimations) { if (!useCssAnimations) {
// No CSS animation support, use setTimeout() instead // No CSS animation support, use setTimeout() instead
@@ -217,27 +222,27 @@ THE SOFTWARE.
;(function anim() { ;(function anim() {
i++; i++;
for (var j = 0; j < o.lines; j++) { for (var j = 0; j < o.lines; j++) {
alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity) alpha = Math.max(1 - (i + (o.lines - j) * astep) % f * ostep, o.opacity);
self.opacity(el, j * o.direction + start, alpha, o) self.opacity(el, j * o.direction + start, alpha, o);
} }
self.timeout = self.el && setTimeout(anim, ~~(1000/fps)) self.timeout = self.el && setTimeout(anim, ~~(1000/fps));
})() })();
} }
return self return self;
}, },
/** /**
* Stops and removes the Spinner. * Stops and removes the Spinner.
*/ */
stop: function() { stop: function() {
var el = this.el var el = this.el;
if (el) { if (el) {
clearTimeout(this.timeout) clearTimeout(this.timeout);
if (el.parentNode) el.parentNode.removeChild(el) if (el.parentNode) el.parentNode.removeChild(el);
this.el = undefined this.el = undefined;
} }
return this return this;
}, },
/** /**
@@ -248,6 +253,7 @@ THE SOFTWARE.
var i = 0 var i = 0
, start = (o.lines - 1) * (1 - o.direction) / 2 , start = (o.lines - 1) * (1 - o.direction) / 2
, seg , seg
;
function fill(color, shadow) { function fill(color, shadow) {
return css(createEl(), { return css(createEl(), {
@@ -259,7 +265,7 @@ THE SOFTWARE.
transformOrigin: 'left', transformOrigin: 'left',
transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)', transform: 'rotate(' + ~~(360/o.lines*i+o.rotate) + 'deg) translate(' + o.radius+'px' +',0)',
borderRadius: (o.corners * o.width>>1) + 'px' borderRadius: (o.corners * o.width>>1) + 'px'
}) });
} }
for (; i < o.lines; i++) { for (; i < o.lines; i++) {
@@ -269,12 +275,12 @@ THE SOFTWARE.
transform: o.hwaccel ? 'translate3d(0,0,0)' : '', transform: o.hwaccel ? 'translate3d(0,0,0)' : '',
opacity: o.opacity, opacity: o.opacity,
animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1/o.speed + 's linear infinite' animation: useCssAnimations && addAnimation(o.opacity, o.trail, start + i * o.direction, o.lines) + ' ' + 1/o.speed + 's linear infinite'
}) });
if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'})) if (o.shadow) ins(seg, css(fill('#000', '0 0 4px ' + '#000'), {top: 2+'px'}));
ins(el, ins(seg, fill(getColor(o.color, i), '0 0 1px rgba(0,0,0,.1)'))) ins(el, ins(seg, fill(getColor(o.color, i), '0 0 1px rgba(0,0,0,.1)')));
} }
return el return el;
}, },
/** /**
@@ -282,25 +288,26 @@ THE SOFTWARE.
* Will be overwritten in VML fallback mode below. * Will be overwritten in VML fallback mode below.
*/ */
opacity: function(el, i, val) { opacity: function(el, i, val) {
if (i < el.childNodes.length) el.childNodes[i].style.opacity = val if (i < el.childNodes.length) el.childNodes[i].style.opacity = val;
} }
}) });
function initVML() { function initVML() {
/* Utility function to create a VML tag */ /* Utility function to create a VML tag */
function vml(tag, attr) { function vml(tag, attr) {
return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr) return createEl('<' + tag + ' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">', attr);
} }
// No CSS transforms but VML support, add a CSS rule for VML elements: // No CSS transforms but VML support, add a CSS rule for VML elements:
sheet.addRule('.spin-vml', 'behavior:url(#default#VML)') sheet.addRule('.spin-vml', 'behavior:url(#default#VML)');
Spinner.prototype.lines = function(el, o) { Spinner.prototype.lines = function(el, o) {
var r = o.length+o.width var r = o.length+o.width
, s = 2*r , s = 2*r
;
function grp() { function grp() {
return css( return css(
@@ -309,12 +316,13 @@ THE SOFTWARE.
coordorigin: -r + ' ' + -r coordorigin: -r + ' ' + -r
}), }),
{ width: s, height: s } { width: s, height: s }
) );
} }
var margin = -(o.width+o.length)*2 + 'px' var margin = -(o.width+o.length)*2 + 'px'
, g = css(grp(), {position: 'absolute', top: margin, left: margin}) , g = css(grp(), {position: 'absolute', top: margin, left: margin})
, i , i
;
function seg(i, dx, filter) { function seg(i, dx, filter) {
ins(g, ins(g,
@@ -330,32 +338,32 @@ THE SOFTWARE.
vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change vml('stroke', {opacity: 0}) // transparent stroke to fix color bleeding upon opacity change
) )
) )
) );
} }
if (o.shadow) if (o.shadow)
for (i = 1; i <= o.lines; i++) for (i = 1; i <= o.lines; i++)
seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)') seg(i, -2, 'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)');
for (i = 1; i <= o.lines; i++) seg(i) for (i = 1; i <= o.lines; i++) seg(i);
return ins(el, g) return ins(el, g);
} };
Spinner.prototype.opacity = function(el, i, val, o) { Spinner.prototype.opacity = function(el, i, val, o) {
var c = el.firstChild var c = el.firstChild;
o = o.shadow && o.lines || 0 o = o.shadow && o.lines || 0;
if (c && i+o < c.childNodes.length) { if (c && i+o < c.childNodes.length) {
c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild c = c.childNodes[i+o]; c = c && c.firstChild; c = c && c.firstChild;
if (c) c.opacity = val if (c) c.opacity = val;
}
} }
};
} }
var probe = css(createEl('group'), {behavior: 'url(#default#VML)'}) var probe = css(createEl('group'), {behavior: 'url(#default#VML)'});
if (!vendor(probe, 'transform') && probe.adj) initVML() if (!vendor(probe, 'transform') && probe.adj) initVML();
else useCssAnimations = vendor(probe, 'animation') else useCssAnimations = vendor(probe, 'animation');
return Spinner return Spinner;
})); }));

View File

@@ -21,7 +21,7 @@ import org.springframework.hateoas.Link;
* This Projection will allow us to specify how many levels deep we're going to embed resources onto the requested * This Projection will allow us to specify how many levels deep we're going to embed resources onto the requested
* HalResource. * HalResource.
* The projection is used by using the name combined with the embedLevelDepth parameter to specify how deep the embeds * The projection is used by using the name combined with the embedLevelDepth parameter to specify how deep the embeds
* have to go. There is an upperlimit in place for this, which is specified on the bean through the maxEmbed property * have to go. There is an upper limit in place for this, which is specified on the bean through the maxEmbed property.
*/ */
public class SpecificLevelProjection extends AbstractProjection { public class SpecificLevelProjection extends AbstractProjection {
@@ -55,7 +55,7 @@ public class SpecificLevelProjection extends AbstractProjection {
throw new MissingParameterException("The embedLevelDepth parameter needs to be specified" + throw new MissingParameterException("The embedLevelDepth parameter needs to be specified" +
" for this Projection"); " for this Projection");
} }
Integer embedLevelDepth = Integer.parseInt(embedLevelDepthString); int embedLevelDepth = Integer.parseInt(embedLevelDepthString);
if (embedLevelDepth > maxEmbed) { if (embedLevelDepth > maxEmbed) {
throw new IllegalArgumentException("The embedLevelDepth may not exceed the configured max: " + maxEmbed); throw new IllegalArgumentException("The embedLevelDepth may not exceed the configured max: " + maxEmbed);
} }

View File

@@ -136,7 +136,7 @@ public class BrowseItemLinkRepository extends AbstractDSpaceRestRepository
} }
// For second level browses on metadata indexes, we need to adjust the default sorting // For second level browses on metadata indexes, we need to adjust the default sorting
if (bi != null && bi.isMetadataIndex() && bs.isSecondLevel() && bs.getSortBy() <= 0) { if (bi.isMetadataIndex() && bs.isSecondLevel() && bs.getSortBy() <= 0) {
bs.setSortBy(1); bs.setSortBy(1);
} }
@@ -144,7 +144,7 @@ public class BrowseItemLinkRepository extends AbstractDSpaceRestRepository
Pageable pageResultInfo = Pageable pageResultInfo =
PageRequest.of((binfo.getStart() - 1) / binfo.getResultsPerPage(), binfo.getResultsPerPage()); PageRequest.of((binfo.getStart() - 1) / binfo.getResultsPerPage(), binfo.getResultsPerPage());
List<Item> tmpResult = new ArrayList<Item>(); List<Item> tmpResult = new ArrayList<>();
for (Item bb : binfo.getBrowseItemResults()) { for (Item bb : binfo.getBrowseItemResults()) {
tmpResult.add(bb); tmpResult.add(bb);
} }

View File

@@ -62,14 +62,14 @@ public class ClaimedTaskRestPermissionEvaluatorPlugin extends RestObjectPermissi
if (ePerson == null) { if (ePerson == null) {
return false; return false;
} }
Integer dsoId = Integer.parseInt(targetId.toString()); int dsoId = Integer.parseInt(targetId.toString());
ClaimedTask claimedTask = claimedTaskService.find(context, dsoId); ClaimedTask claimedTask = claimedTaskService.find(context, dsoId);
// If the claimed task is null then we give permission so we can throw another status code instead // If the claimed task is null then we give permission so we can throw another status code instead
if (claimedTask == null) { if (claimedTask == null) {
return true; return true;
} }
// task's owner can interact with it // task's owner can interact with it
if (claimedTask != null && ePerson.equals(claimedTask.getOwner())) { if (ePerson.equals(claimedTask.getOwner())) {
return true; return true;
} }

View File

@@ -64,7 +64,7 @@ public class PoolTaskRestPermissionEvaluatorPlugin extends RestObjectPermissionE
if (ePerson == null) { if (ePerson == null) {
return false; return false;
} }
Integer dsoId = Integer.parseInt(targetId.toString()); int dsoId = Integer.parseInt(targetId.toString());
PoolTask poolTask = poolTaskService.find(context, dsoId); PoolTask poolTask = poolTaskService.find(context, dsoId);
// If the pool task is null then we give permission so we can throw another status code instead // If the pool task is null then we give permission so we can throw another status code instead

View File

@@ -64,7 +64,7 @@ public class ResourcePolicyAdminPermissionEvalutatorPlugin extends RestObjectPer
Context context = ContextUtil.obtainContext(request.getHttpServletRequest()); Context context = ContextUtil.obtainContext(request.getHttpServletRequest());
try { try {
Integer resourcePolicyID = Integer.parseInt(targetId.toString()); int resourcePolicyID = Integer.parseInt(targetId.toString());
ResourcePolicy resourcePolicy = resourcePolicyService.find(context, resourcePolicyID); ResourcePolicy resourcePolicy = resourcePolicyService.find(context, resourcePolicyID);
if (resourcePolicy == null) { if (resourcePolicy == null) {
throw new ResourceNotFoundException( throw new ResourceNotFoundException(

View File

@@ -75,7 +75,7 @@ public class WorkflowRestPermissionEvaluatorPlugin extends RestObjectPermissionE
if (ePerson == null) { if (ePerson == null) {
return false; return false;
} }
Integer dsoId = Integer.parseInt(targetId.toString()); int dsoId = Integer.parseInt(targetId.toString());
XmlWorkflowItem workflowItem = workflowItemService.find(context, dsoId); XmlWorkflowItem workflowItem = workflowItemService.find(context, dsoId);
// submitter can see their inprogress submission // submitter can see their inprogress submission
if (ePerson.equals(workflowItem.getSubmitter())) { if (ePerson.equals(workflowItem.getSubmitter())) {

View File

@@ -62,7 +62,7 @@ public class WorkspaceItemRestPermissionEvaluatorPlugin extends RestObjectPermis
WorkspaceItem witem = null; WorkspaceItem witem = null;
try { try {
ePerson = context.getCurrentUser(); ePerson = context.getCurrentUser();
Integer dsoId = Integer.parseInt(targetId.toString()); int dsoId = Integer.parseInt(targetId.toString());
// anonymous user // anonymous user
if (ePerson == null) { if (ePerson == null) {

View File

@@ -49,7 +49,7 @@ public class BitstreamMetadataValueRemovePatchOperation extends MetadataValueRem
bitstreamMetadataValuePathUtils.validate(absolutePath); bitstreamMetadataValuePathUtils.validate(absolutePath);
Item item = source.getItem(); Item item = source.getItem();
List<Bundle> bundle = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME); List<Bundle> bundle = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME);
;
for (Bundle bb : bundle) { for (Bundle bb : bundle) {
int idx = 0; int idx = 0;
for (Bitstream b : bb.getBitstreams()) { for (Bitstream b : bb.getBitstreams()) {
@@ -58,7 +58,7 @@ public class BitstreamMetadataValueRemovePatchOperation extends MetadataValueRem
if (split.length == 4) { if (split.length == 4) {
deleteValue(context, b, split[3], -1); deleteValue(context, b, split[3], -1);
} else { } else {
Integer toDelete = Integer.parseInt(split[4]); int toDelete = Integer.parseInt(split[4]);
deleteValue(context, b, split[3], toDelete); deleteValue(context, b, split[3], toDelete);
} }
} }

View File

@@ -65,7 +65,7 @@ public class BitstreamResourcePolicyRemovePatchOperation
ResourcePolicy.TYPE_CUSTOM); ResourcePolicy.TYPE_CUSTOM);
int index = 0; int index = 0;
for (ResourcePolicy policy : policies) { for (ResourcePolicy policy : policies) {
Integer toDelete = Integer.parseInt(rpIdx); int toDelete = Integer.parseInt(rpIdx);
if (index == toDelete) { if (index == toDelete) {
b.getResourcePolicies().remove(policy); b.getResourcePolicies().remove(policy);
bitstream = b; bitstream = b;

View File

@@ -56,7 +56,7 @@ public class BitstreamResourcePolicyReplacePatchOperation extends ReplacePatchOp
Item item = source.getItem(); Item item = source.getItem();
List<Bundle> bundle = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME); List<Bundle> bundle = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME);
;
Collection<UploadConfiguration> uploadConfigsCollection = uploadConfigurationService.getMap().values(); Collection<UploadConfiguration> uploadConfigsCollection = uploadConfigurationService.getMap().values();
Iterator<UploadConfiguration> uploadConfigs = uploadConfigsCollection.iterator(); Iterator<UploadConfiguration> uploadConfigs = uploadConfigsCollection.iterator();
for (Bundle bb : bundle) { for (Bundle bb : bundle) {
@@ -70,7 +70,7 @@ public class BitstreamResourcePolicyReplacePatchOperation extends ReplacePatchOp
int index = 0; int index = 0;
for (ResourcePolicy policy : policies) { for (ResourcePolicy policy : policies) {
Integer toReplace = Integer.parseInt(rpIdx); int toReplace = Integer.parseInt(rpIdx);
if (index == toReplace) { if (index == toReplace) {
b.getResourcePolicies().remove(policy); b.getResourcePolicies().remove(policy);
break; break;

View File

@@ -50,7 +50,7 @@ public class ItemMetadataValueRemovePatchOperation extends MetadataValueRemovePa
if (split.length == 1) { if (split.length == 1) {
deleteValue(context, source.getItem(), split[0], -1); deleteValue(context, source.getItem(), split[0], -1);
} else { } else {
Integer toDelete = Integer.parseInt(split[1]); int toDelete = Integer.parseInt(split[1]);
deleteValue(context, source.getItem(), split[0], toDelete); deleteValue(context, source.getItem(), split[0], toDelete);
} }
} }

View File

@@ -370,9 +370,10 @@ public class Utils {
} }
} }
File file = File.createTempFile(prefixTempName + "-" + suffixTempName, ".temp", uploadDir); File file = File.createTempFile(prefixTempName + "-" + suffixTempName, ".temp", uploadDir);
InputStream io = new BufferedInputStream(multipartFile.getInputStream()); try (InputStream io = new BufferedInputStream(multipartFile.getInputStream());
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file)); BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));) {
org.dspace.core.Utils.bufferedCopy(io, out); org.dspace.core.Utils.bufferedCopy(io, out);
}
return file; return file;
} }

View File

@@ -121,6 +121,7 @@ public class Author extends XmlElement implements SwordElementInterface {
* *
* @return A XOM Element. * @return A XOM Element.
*/ */
@Override
public Element marshall() { public Element marshall() {
Element element = new Element(getQualifiedName(), xmlName.getNamespace()); Element element = new Element(getQualifiedName(), xmlName.getNamespace());
@@ -155,8 +156,8 @@ public class Author extends XmlElement implements SwordElementInterface {
handleIncorrectElement(author, validationProperties); handleIncorrectElement(author, validationProperties);
} }
ArrayList<SwordValidationInfo> validationItems = new ArrayList<SwordValidationInfo>(); ArrayList<SwordValidationInfo> validationItems = new ArrayList<>();
ArrayList<SwordValidationInfo> attributeItems = new ArrayList<SwordValidationInfo>(); ArrayList<SwordValidationInfo> attributeItems = new ArrayList<>();
processUnexpectedAttributes(author, attributeItems); processUnexpectedAttributes(author, attributeItems);
@@ -194,6 +195,7 @@ public class Author extends XmlElement implements SwordElementInterface {
return result; return result;
} }
@Override
public SwordValidationInfo validate(Properties validationContext) { public SwordValidationInfo validate(Properties validationContext) {
return validate(null, null, validationContext); return validate(null, null, validationContext);
} }
@@ -208,7 +210,7 @@ public class Author extends XmlElement implements SwordElementInterface {
SwordValidationInfo.MISSING_ELEMENT_ERROR, SwordValidationInfo.MISSING_ELEMENT_ERROR,
SwordValidationInfoType.ERROR); SwordValidationInfoType.ERROR);
result.addValidationInfo(info); result.addValidationInfo(info);
} else if (elements == null && name != null) { } else if (elements == null) {
result.addValidationInfo(name.validate(validationContext)); result.addValidationInfo(name.validate(validationContext));
} }
@@ -230,6 +232,7 @@ public class Author extends XmlElement implements SwordElementInterface {
* *
* @param author The element to unmarshall. * @param author The element to unmarshall.
*/ */
@Override
public void unmarshall(Element author) public void unmarshall(Element author)
throws UnmarshallException { throws UnmarshallException {
unmarshall(author, null); unmarshall(author, null);

View File

@@ -215,10 +215,10 @@ public class Entry extends XmlElement implements SwordElementInterface {
* *
*/ */
protected void initialise() { protected void initialise() {
authors = new ArrayList<Author>(); authors = new ArrayList<>();
categories = new ArrayList<Category>(); categories = new ArrayList<>();
contributors = new ArrayList<Contributor>(); contributors = new ArrayList<>();
links = new ArrayList<Link>(); links = new ArrayList<>();
} }
/** /**
@@ -226,6 +226,7 @@ public class Entry extends XmlElement implements SwordElementInterface {
* *
* @return An element that holds the data associated with this object. * @return An element that holds the data associated with this object.
*/ */
@Override
public Element marshall() { public Element marshall() {
Element entry = new Element(getQualifiedName(), Namespaces.NS_ATOM); Element entry = new Element(getQualifiedName(), Namespaces.NS_ATOM);
entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD); entry.addNamespaceDeclaration(Namespaces.PREFIX_SWORD, Namespaces.NS_SWORD);
@@ -297,6 +298,7 @@ public class Entry extends XmlElement implements SwordElementInterface {
* element, or if there is a problem processing the element or any * element, or if there is a problem processing the element or any
* subelements. * subelements.
*/ */
@Override
public void unmarshall(Element entry) public void unmarshall(Element entry)
throws UnmarshallException { throws UnmarshallException {
unmarshall(entry, null); unmarshall(entry, null);
@@ -472,8 +474,10 @@ public class Entry extends XmlElement implements SwordElementInterface {
} }
/** /**
* * @param validationContext FIXME: PLEASE DOCUMENT.
* @return SWORD validation info.
*/ */
@Override
public SwordValidationInfo validate(Properties validationContext) { public SwordValidationInfo validate(Properties validationContext) {
return validate(null, validationContext); return validate(null, validationContext);
} }
@@ -498,7 +502,7 @@ public class Entry extends XmlElement implements SwordElementInterface {
result.addValidationInfo(new SwordValidationInfo(Id.elementName(), result.addValidationInfo(new SwordValidationInfo(Id.elementName(),
SwordValidationInfo.MISSING_ELEMENT_ERROR, SwordValidationInfo.MISSING_ELEMENT_ERROR,
SwordValidationInfoType.ERROR)); SwordValidationInfoType.ERROR));
} else if (id != null && validateAll) { } else if (validateAll) {
result.addValidationInfo(id.validate(validationContext)); result.addValidationInfo(id.validate(validationContext));
} }
@@ -506,7 +510,7 @@ public class Entry extends XmlElement implements SwordElementInterface {
result.addValidationInfo(new SwordValidationInfo(Title.elementName(), result.addValidationInfo(new SwordValidationInfo(Title.elementName(),
SwordValidationInfo.MISSING_ELEMENT_ERROR, SwordValidationInfo.MISSING_ELEMENT_ERROR,
SwordValidationInfoType.ERROR)); SwordValidationInfoType.ERROR));
} else if (title != null && validateAll) { } else if (validateAll) {
result.addValidationInfo(title.validate(validationContext)); result.addValidationInfo(title.validate(validationContext));
} }
@@ -514,7 +518,7 @@ public class Entry extends XmlElement implements SwordElementInterface {
result.addValidationInfo(new SwordValidationInfo(Updated.elementName(), result.addValidationInfo(new SwordValidationInfo(Updated.elementName(),
SwordValidationInfo.MISSING_ELEMENT_ERROR, SwordValidationInfo.MISSING_ELEMENT_ERROR,
SwordValidationInfoType.ERROR)); SwordValidationInfoType.ERROR));
} else if (updated != null && validateAll) { } else if (validateAll) {
result.addValidationInfo(updated.validate(validationContext)); result.addValidationInfo(updated.validate(validationContext));
} }
@@ -543,7 +547,7 @@ public class Entry extends XmlElement implements SwordElementInterface {
" SHOULD contain the URI and version of the server " + " SHOULD contain the URI and version of the server " +
"software.", "software.",
SwordValidationInfoType.ERROR)); SwordValidationInfoType.ERROR));
} else if (generator != null && validateAll) { } else if (validateAll) {
result.addValidationInfo(generator.validate(validationContext)); result.addValidationInfo(generator.validate(validationContext));
} }
@@ -619,7 +623,7 @@ public class Entry extends XmlElement implements SwordElementInterface {
* @return An iterator. * @return An iterator.
*/ */
public Iterator<String> getCategories() { public Iterator<String> getCategories() {
ArrayList<String> items = new ArrayList<String>(); ArrayList<String> items = new ArrayList<>();
for (int i = 0; i < categories.size(); i++) { for (int i = 0; i < categories.size(); i++) {
items.add(categories.get(i).getContent()); items.add(categories.get(i).getContent());
} }

View File

@@ -13,6 +13,7 @@ import java.util.Properties;
import nu.xom.Attribute; import nu.xom.Attribute;
import nu.xom.Element; import nu.xom.Element;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.purl.sword.base.Namespaces; import org.purl.sword.base.Namespaces;
import org.purl.sword.base.SwordElementInterface; import org.purl.sword.base.SwordElementInterface;
@@ -62,7 +63,7 @@ public class Generator extends XmlElement implements SwordElementInterface {
/** /**
* The logger. * The logger.
*/ */
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(Generator.class); private static final Logger log = LogManager.getLogger();
/** /**
* The Xml name details for the element. * The Xml name details for the element.
@@ -94,6 +95,7 @@ public class Generator extends XmlElement implements SwordElementInterface {
* *
* @return The element. * @return The element.
*/ */
@Override
public Element marshall() { public Element marshall() {
Element element = new Element(getQualifiedName(), xmlName.getNamespace()); Element element = new Element(getQualifiedName(), xmlName.getNamespace());
@@ -122,6 +124,7 @@ public class Generator extends XmlElement implements SwordElementInterface {
* @throws UnmarshallException If the specified element is not an atom:generator * @throws UnmarshallException If the specified element is not an atom:generator
* element, or if there is an error accessing the data. * element, or if there is an error accessing the data.
*/ */
@Override
public void unmarshall(Element generator) public void unmarshall(Element generator)
throws UnmarshallException { throws UnmarshallException {
unmarshall(generator, null); unmarshall(generator, null);
@@ -133,8 +136,8 @@ public class Generator extends XmlElement implements SwordElementInterface {
return handleIncorrectElement(generator, validationProperties); return handleIncorrectElement(generator, validationProperties);
} }
ArrayList<SwordValidationInfo> validationItems = new ArrayList<SwordValidationInfo>(); ArrayList<SwordValidationInfo> validationItems = new ArrayList<>();
ArrayList<SwordValidationInfo> attributeValidationItems = new ArrayList<SwordValidationInfo>(); ArrayList<SwordValidationInfo> attributeValidationItems = new ArrayList<>();
try { try {
initialise(); initialise();
@@ -228,7 +231,7 @@ public class Generator extends XmlElement implements SwordElementInterface {
new SwordValidationInfo(xmlName, attributeName, new SwordValidationInfo(xmlName, attributeName,
SwordValidationInfo.MISSING_ATTRIBUTE_WARNING, SwordValidationInfo.MISSING_ATTRIBUTE_WARNING,
SwordValidationInfoType.WARNING)); SwordValidationInfoType.WARNING));
} else if (validateAll && uri != null) { } else if (validateAll) {
result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_URI, uri)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_URI, uri));
} }
@@ -241,7 +244,7 @@ public class Generator extends XmlElement implements SwordElementInterface {
new SwordValidationInfo(xmlName, attributeName, new SwordValidationInfo(xmlName, attributeName,
SwordValidationInfo.MISSING_ATTRIBUTE_WARNING, SwordValidationInfo.MISSING_ATTRIBUTE_WARNING,
SwordValidationInfoType.WARNING)); SwordValidationInfoType.WARNING));
} else if (validateAll && version != null) { } else if (validateAll) {
result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_VERSION, version)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_VERSION, version));
} }
@@ -306,6 +309,7 @@ public class Generator extends XmlElement implements SwordElementInterface {
/** /**
* Get a string representation. * Get a string representation.
*/ */
@Override
public String toString() { public String toString() {
return "Generator - content: " + getContent() + return "Generator - content: " + getContent() +
" version: " + getVersion() + " version: " + getVersion() +

View File

@@ -76,6 +76,7 @@ public class SWORDEntry extends Entry {
super(name); super(name);
} }
@Override
protected void initialise() { protected void initialise() {
super.initialise(); super.initialise();
swordNoOp = null; swordNoOp = null;
@@ -207,6 +208,7 @@ public class SWORDEntry extends Entry {
this.swordPackaging = new SwordPackaging(packaging); this.swordPackaging = new SwordPackaging(packaging);
} }
@Override
protected void marshallElements(Element entry) { protected void marshallElements(Element entry) {
super.marshallElements(entry); super.marshallElements(entry);
@@ -329,6 +331,7 @@ public class SWORDEntry extends Entry {
return result; return result;
} }
@Override
public SwordValidationInfo unmarshall(Element entry, Properties validationProperties) public SwordValidationInfo unmarshall(Element entry, Properties validationProperties)
throws UnmarshallException { throws UnmarshallException {
@@ -343,6 +346,7 @@ public class SWORDEntry extends Entry {
* @param elementName name of element to check * @param elementName name of element to check
* @return true if element is checked * @return true if element is checked
*/ */
@Override
protected boolean isElementChecked(XmlName elementName) { protected boolean isElementChecked(XmlName elementName) {
if (elementName == null) { if (elementName == null) {
return false; return false;
@@ -356,10 +360,12 @@ public class SWORDEntry extends Entry {
super.isElementChecked(elementName); super.isElementChecked(elementName);
} }
@Override
public SwordValidationInfo validate(Properties validationContext) { public SwordValidationInfo validate(Properties validationContext) {
return validate(null, validationContext); return validate(null, validationContext);
} }
@Override
protected SwordValidationInfo validate(SwordValidationInfo info, protected SwordValidationInfo validate(SwordValidationInfo info,
Properties validationContext) { Properties validationContext) {
boolean validateAll = (info == null); boolean validateAll = (info == null);
@@ -379,7 +385,7 @@ public class SWORDEntry extends Entry {
"element.", "element.",
SwordValidationInfoType.WARNING)); SwordValidationInfoType.WARNING));
} }
} else if (swordUserAgent != null && validateAll) { } else if (validateAll) {
swordEntry.addValidationInfo(swordUserAgent.validate(validationContext)); swordEntry.addValidationInfo(swordUserAgent.validate(validationContext));
} }
@@ -392,7 +398,7 @@ public class SWORDEntry extends Entry {
"resource has received or a URI that " + "resource has received or a URI that " +
"dereferences to such a description.", "dereferences to such a description.",
SwordValidationInfoType.ERROR)); SwordValidationInfoType.ERROR));
} else if (swordTreatment != null && validateAll) { } else if (validateAll) {
swordEntry.addValidationInfo(swordTreatment.validate(validationContext)); swordEntry.addValidationInfo(swordTreatment.validate(validationContext));
} }
@@ -408,7 +414,7 @@ public class SWORDEntry extends Entry {
" process.", " process.",
SwordValidationInfoType.WARNING)); SwordValidationInfoType.WARNING));
} }
} else if (swordVerboseDescription != null && validateAll) { } else if (validateAll) {
swordEntry.addValidationInfo(swordVerboseDescription.validate(validationContext)); swordEntry.addValidationInfo(swordVerboseDescription.validate(validationContext));
} }
@@ -427,7 +433,7 @@ public class SWORDEntry extends Entry {
"this element to signify an error.", "this element to signify an error.",
SwordValidationInfoType.WARNING)); SwordValidationInfoType.WARNING));
} }
} else if (swordNoOp != null && validateAll) { } else if (validateAll) {
swordEntry.addValidationInfo(swordNoOp.validate(validationContext)); swordEntry.addValidationInfo(swordNoOp.validate(validationContext));
} }
@@ -439,7 +445,7 @@ public class SWORDEntry extends Entry {
"element to declare the packaging type. If used " + "element to declare the packaging type. If used " +
"it SHOULD take a value from [SWORD-TYPES].", "it SHOULD take a value from [SWORD-TYPES].",
SwordValidationInfoType.INFO)); SwordValidationInfoType.INFO));
} else if (swordPackaging != null && validateAll) { } else if (validateAll) {
swordEntry.addValidationInfo(swordPackaging.validate(validationContext)); swordEntry.addValidationInfo(swordPackaging.validate(validationContext));
} }

View File

@@ -71,7 +71,7 @@ public class SWORDComboBox extends JComboBox {
public void updateList() { public void updateList() {
Object s = getSelectedItem(); Object s = getSelectedItem();
if (!isEditable() || s == null || (s != null && ((String) s).trim().length() == 0)) { if (!isEditable() || s == null || ((String) s).trim().length() == 0) {
// don't update with an empty item or if the combo box is not editable. // don't update with an empty item or if the combo box is not editable.
return; return;
} }

View File

@@ -358,17 +358,14 @@ public class DepositServlet extends HttpServlet {
request, request,
response); response);
return; return;
} catch (SWORDException se) { } catch (SWORDException | NoSuchAlgorithmException se) {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
log.error(se.toString()); log.error(se.toString());
} catch (NoSuchAlgorithmException nsae) {
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
log.error(nsae.toString());
} finally { } finally {
// Try deleting the temp file // Try deleting the temp file
if (filename != null) { if (filename != null) {
File f = new File(filename); File f = new File(filename);
if (f != null && !f.delete()) { if (!f.delete()) {
log.error("Unable to delete file: " + filename); log.error("Unable to delete file: " + filename);
} }
} }