Clean up warnings, suggestions, and an unthrown and incorrect Throwable.

This commit is contained in:
Mark H. Wood
2015-11-13 20:27:39 -05:00
committed by Mark H. Wood
parent 6d2e3b3ea3
commit e61352ef29

View File

@@ -41,7 +41,7 @@ import java.util.*;
public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> implements CollectionService {
/** log4j category */
private static Logger log = Logger.getLogger(CollectionServiceImpl.class);
private static final Logger log = Logger.getLogger(CollectionServiceImpl.class);
@Autowired(required = true)
protected CollectionDAO collectionDAO;
@@ -132,7 +132,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
return findAuthorized(context, null, actionID);
}
List<Collection> myResults = new ArrayList<Collection>();
List<Collection> myResults = new ArrayList<>();
if(authorizeService.isAdmin(context))
{
@@ -359,6 +359,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
/**
* Get the value of a metadata field
*
* @param collection
* @param field
* the name of the metadata field to get
*
@@ -533,7 +534,7 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
}
context.addEvent(new Event(Event.ADD, Constants.COLLECTION, collection.getID(),
Constants.ITEM, item.getID(), item.getHandle(),
Constants.ITEM, item.getID(), item.getHandle(),
getIdentifiers(context, collection)));
}
@@ -546,13 +547,13 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
item.removeCollection(collection);
//Check if we orphaned our poor item
if (item.getCollections().size() == 0)
if (item.getCollections().isEmpty())
{
// Orphan; delete it
itemService.delete(context, item);
}
context.addEvent(new Event(Event.REMOVE, Constants.COLLECTION,
context.addEvent(new Event(Event.REMOVE, Constants.COLLECTION,
collection.getID(), Constants.ITEM, item.getID(), item.getHandle(),
getIdentifiers(context, collection)));
}
@@ -733,9 +734,9 @@ public class CollectionServiceImpl extends DSpaceObjectServiceImpl<Collection> i
@Override
public List<Collection> findAuthorized(Context context, Community community, int actionID) throws SQLException {
List<Collection> myResults = new ArrayList<Collection>();
List<Collection> myResults = new ArrayList<>();
List<Collection> myCollections = null;
List<Collection> myCollections;
if (community != null)
{