Commit 62369710 authored by Peter Harrison's avatar Peter Harrison

Changing loops on Lists to use EntrySet rather than KeySet.

Removing redundant null checks after calls that never return null.
parent 27c0217d
......@@ -73,9 +73,6 @@ public class SpawnPlugin implements Plugin {
String targetTemplateId = (String) variableInterpreter.resolve(context, action.getMethod());
Board targetBoard = boardCache.getItem(targetBoardId);
if( targetBoard==null){
logger.warn("Board Not Found - board: " + targetBoardId);
}
String targetPhase = null;
for( Phase phase : targetBoard.getPhases().values()){
......
......@@ -89,7 +89,6 @@ public class BoardsCache extends CacheImpl<Board> implements MessageListener {
private Phase getPhase( String boardId, String phaseId) throws Exception{
Board board = getItem(boardId);
if( board==null) return null;
return board.getPhases().get(phaseId);
}
......
......@@ -293,7 +293,7 @@ public class PhaseController {
complete++;
}
}
card.setCompleteTasks(new Long(complete));
card.setCompleteTasks(Long.valueOf(complete));
} finally {
ocm.logout();
......
......@@ -147,11 +147,7 @@ public class TemplateCache extends CacheImpl<Template>{
Map<String,Object> fields = card.getFields();
Map<String,Object> newFields = new LinkedHashMap<String,Object>();
Template template = getItem(card.getBoard(),card.getTemplate());
if( template==null){
return;
}
for( Entry<String,TemplateGroup> entry : template.getGroups().entrySet()){
TemplateGroup group = entry.getValue();
boolean groupHeader = false;
......
......@@ -72,11 +72,7 @@ public class XmlFileController {
@RequestMapping(value = "/{boardId}", method=RequestMethod.GET)
public @ResponseBody void getXmlFile(@PathVariable String boardId,@RequestParam(required=false) boolean includeArchive, HttpServletResponse response) throws Exception{
Board board = boardsCache.getItem(boardId);
if(board == null){
logger.warn("No such board exists with name : " + boardId);
response.setStatus(404);
return;
}
ObjectContentManager ocm = null;
Collection<Card> cardList = null;
try{
......
......@@ -25,6 +25,7 @@ import java.io.Serializable;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.SortedMap;
import java.util.TreeMap;
......@@ -59,16 +60,16 @@ public class Template extends AbstractNamedModelClass implements Serializable, S
return;
}
SortedMap< Integer, TemplateGroup> sorted = new TreeMap< Integer, TemplateGroup>();
for( String key: newGroups.keySet()){
TemplateGroup group = newGroups.get(key);
for( Entry<String, TemplateGroup> entry: newGroups.entrySet()){
TemplateGroup group = entry.getValue();
if( group.getPath()==null){
group.setPath(key);
group.setPath(entry.getKey());
}
sorted.put(group.getIndex(), group);
}
for( Integer key: sorted.keySet()){
TemplateGroup group = sorted.get(key);
for( Entry<Integer, TemplateGroup> entry: sorted.entrySet()){
TemplateGroup group = entry.getValue();
this.groups.put(group.getId(), group);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment