Index: trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java	(revision 6289)
@@ -189,5 +189,4 @@
      */
     protected Layer getFirstSelectedLayer() {
-        if (LayerListDialog.getInstance() == null) return null;
         List<Layer> layers = LayerListDialog.getInstance().getModel().getSelectedLayers();
         if (layers.isEmpty()) return null;
Index: trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java	(revision 6289)
@@ -368,5 +368,5 @@
             }
             if (wayWithSelectedNode == null) {
-                wayWithSelectedNode = parentWays.removeFirst();
+                parentWays.removeFirst();
             }
             for (Way w : parentWays) {
Index: trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java	(revision 6289)
@@ -1170,5 +1170,5 @@
     @Override
     public String getModeHelpText() {
-        String rv = "";
+        StringBuilder rv;
         /*
          *  No modifiers: all (Connect, Node Re-Use, Auto-Weld)
@@ -1193,13 +1193,13 @@
         // list is empty we can assume that we won't do any joins
         if (ctrl || oldHighlights.isEmpty()) {
-            rv = tr("Create new node.");
+            rv = new StringBuilder(tr("Create new node."));
         } else {
             // oldHighlights may store a node or way, check if it's a node
             OsmPrimitive x = oldHighlights.iterator().next();
             if (x instanceof Node) {
-                rv = tr("Select node under cursor.");
+                rv = new StringBuilder(tr("Select node under cursor."));
             } else {
-                rv = trn("Insert new node into way.", "Insert new node into {0} ways.",
-                        oldHighlights.size(), oldHighlights.size());
+                rv = new StringBuilder(trn("Insert new node into way.", "Insert new node into {0} ways.",
+                        oldHighlights.size(), oldHighlights.size()));
             }
         }
@@ -1210,10 +1210,10 @@
         if (currentBaseNode != null && !wayIsFinished) {
             if (alt) {
-                rv += " " + tr("Start new way from last node.");
+                rv.append(" ").append(tr("Start new way from last node."));
             } else {
-                rv += " " + tr("Continue way from last node.");
+                rv.append(" ").append(tr("Continue way from last node."));
             }
             if (snapHelper.isSnapOn()) {
-                rv += " "+ tr("Angle snapping active.");
+                rv.append(" ").append(tr("Angle snapping active."));
             }
         }
@@ -1225,7 +1225,7 @@
         if (n != null && getCurrentDataSet() != null && getCurrentDataSet().getSelectedNodes().contains(n)) {
             if (wayIsFinished) {
-                rv = tr("Select node under cursor.");
+                rv = new StringBuilder(tr("Select node under cursor."));
             } else {
-                rv = tr("Finish drawing.");
+                rv = new StringBuilder(tr("Finish drawing."));
             }
         }
@@ -1238,10 +1238,10 @@
             for (Node m : w.getNodes()) {
                 if (m.equals(mouseOnExistingNode) || mouseOnExistingWays.contains(w)) {
-                    rv += " " + tr("Finish drawing.");
+                    rv.append(" ").append(tr("Finish drawing."));
                     break;
                 }
             }
         }
-        return rv;
+        return rv.toString();
     }
 
Index: trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 6289)
@@ -76,4 +76,29 @@
         public List<Shape> getShapes() {
             return shapes;
+        }
+
+        @Override
+        public int hashCode() {
+            final int prime = 31;
+            int result = super.hashCode();
+            result = prime * result + ((shapes == null) ? 0 : shapes.hashCode());
+            return result;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj)
+                return true;
+            if (!super.equals(obj))
+                return false;
+            if (getClass() != obj.getClass())
+                return false;
+            ImageryBounds other = (ImageryBounds) obj;
+            if (shapes == null) {
+                if (other.shapes != null)
+                    return false;
+            } else if (!shapes.equals(other.shapes))
+                return false;
+            return true;
         }
     }
Index: trunk/src/org/openstreetmap/josm/data/osm/Filter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Filter.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/data/osm/Filter.java	(revision 6289)
@@ -20,7 +20,11 @@
     public boolean inverted = false;
 
+    /**
+     * Constructs a new {@code Filter}.
+     */
     public Filter() {
         super("", SearchMode.add, false, false, false);
     }
+    
     public Filter(String text, SearchMode mode, boolean caseSensitive,
             boolean regexSearch, boolean allElements) {
Index: trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java	(revision 6289)
@@ -203,5 +203,5 @@
     public static Map<String, Test> getAllTestsMap() {
         Map<String, Test> tests = new HashMap<String, Test>();
-        for (Class<Test> testClass : getAllAvailableTests()) {
+        for (Class<Test> testClass : allAvailableTests) {
             try {
                 Test test = testClass.newInstance();
@@ -258,5 +258,5 @@
      */
     public static Class<Test>[] getAllAvailableTests() {
-        return allAvailableTests;
+        return Arrays.copyOf(allAvailableTests, allAvailableTests.length);
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java	(revision 6289)
@@ -534,10 +534,15 @@
                 BufferedOutputStream bos = null;
                 try {
-                    bis = new BufferedInputStream(s.getSourceInputStream());
-                    bos = new BufferedOutputStream(new FileOutputStream(file));
-                    byte[] buffer = new byte[4096];
-                    int length;
-                    while ((length = bis.read(buffer)) > -1 && !canceled) {
-                        bos.write(buffer, 0, length);
+                    InputStream in = s.getSourceInputStream();
+                    try {
+                        bis = new BufferedInputStream(in);
+                        bos = new BufferedOutputStream(new FileOutputStream(file));
+                        byte[] buffer = new byte[4096];
+                        int length;
+                        while ((length = bis.read(buffer)) > -1 && !canceled) {
+                            bos.write(buffer, 0, length);
+                        }
+                    } finally {
+                        s.closeSourceInputStream(in);
                     }
                 } catch (IOException e) {
@@ -666,17 +671,21 @@
             p.add(new JScrollPane(txtSource), GBC.std().fill());
 
-            InputStream is = null;
             try {
-                is = s.getSourceInputStream();
-                BufferedReader reader = new BufferedReader(new InputStreamReader(is));
-                String line;
-                while ((line = reader.readLine()) != null) {
-                    txtSource.append(line + "\n");
+                InputStream is = s.getSourceInputStream();
+                try {
+                    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+                    try {
+                        String line;
+                        while ((line = reader.readLine()) != null) {
+                            txtSource.append(line + "\n");
+                        }
+                    } finally {
+                        reader.close();
+                    }
+                } finally {
+                    s.closeSourceInputStream(is);
                 }
-                reader.close();
             } catch (IOException ex) {
                 txtSource.append("<ERROR: failed to read file!>");
-            } finally {
-                Utils.close(is);
             }
         }
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java	(revision 6289)
@@ -41,5 +41,5 @@
             final RelationMember m = members.get(i);
             if (!m.isWay() || m.getWay() == null || m.getWay().isIncomplete()) {
-                if(i > 0) {
+                if (i > 0) {
                     makeLoopIfNeeded(con, i-1);
                 }
@@ -53,9 +53,9 @@
             wct.direction = NONE;
 
-            if(RelationSortUtils.isOneway(m)){
-                if(lastWct != null && lastWct.isOnewayTail) {
+            if (RelationSortUtils.isOneway(m)){
+                if (lastWct != null && lastWct.isOnewayTail) {
                     wct.isOnewayHead = true;
                 }
-                if(lastBackwardWay == UNCONNECTED && lastForwardWay == UNCONNECTED){ //Beginning of new oneway
+                if (lastBackwardWay == UNCONNECTED && lastForwardWay == UNCONNECTED){ //Beginning of new oneway
                     wct.isOnewayHead = true;
                     lastForwardWay = i-1;
@@ -66,12 +66,12 @@
 
             if (wct.linkPrev) {
-                if(lastBackwardWay != UNCONNECTED && lastForwardWay != UNCONNECTED) {
+                if (lastBackwardWay != UNCONNECTED && lastForwardWay != UNCONNECTED) {
                     wct = determineOnewayConnectionType(con, m, i, wct);
-                    if(!wct.linkPrev) {
+                    if (!wct.linkPrev) {
                         firstGroupIdx = i;
                     }
                 }
 
-                if(!RelationSortUtils.isOneway(m)) {
+                if (!RelationSortUtils.isOneway(m)) {
                     wct.direction = determineDirection(i-1, lastWct.direction, i);
                     wct.linkPrev = (wct.direction != NONE);
@@ -81,5 +81,5 @@
             if (!wct.linkPrev) {
                 wct.direction = determineDirectionOfFirst(i, m);
-                if(RelationSortUtils.isOneway(m)){
+                if (RelationSortUtils.isOneway(m)){
                     wct.isOnewayLoopForwardPart = true;
                     lastForwardWay = i;
@@ -88,5 +88,5 @@
 
             wct.linkNext = false;
-            if(lastWct != null) {
+            if (lastWct != null) {
                 lastWct.linkNext = wct.linkPrev;
             }
@@ -94,6 +94,6 @@
             lastWct = wct;
 
-            if(!wct.linkPrev) {
-                if(i > 0) {
+            if (!wct.linkPrev) {
+                if (i > 0) {
                     makeLoopIfNeeded(con, i-1);
                 }
@@ -127,9 +127,9 @@
 
         if (RelationSortUtils.isOneway(m)){
-            if(RelationSortUtils.isBackward(m)) return BACKWARD;
+            if (RelationSortUtils.isBackward(m)) return BACKWARD;
             else return FORWARD;
         } else { /** guess the direction and see if it fits with the next member */
-            if(determineDirection(i, FORWARD, i+1) != NONE) return FORWARD;
-            if(determineDirection(i, BACKWARD, i+1) != NONE) return BACKWARD;
+            if (determineDirection(i, FORWARD, i+1) != NONE) return FORWARD;
+            if (determineDirection(i, BACKWARD, i+1) != NONE) return BACKWARD;
         }
         return NONE;
@@ -142,6 +142,6 @@
         Direction dirFW = determineDirection(lastForwardWay, con.get(lastForwardWay).direction, i);
         Direction dirBW = NONE;
-        if(onewayBeginning) {
-            if(lastBackwardWay < 0) {
+        if (onewayBeginning) {
+            if (lastBackwardWay < 0) {
                 dirBW = determineDirection(firstGroupIdx, reverse(con.get(firstGroupIdx).direction), i, true);
             } else {
@@ -149,5 +149,5 @@
             }
 
-            if(dirBW != NONE) {
+            if (dirBW != NONE) {
                 onewayBeginning = false;
             }
@@ -156,20 +156,20 @@
         }
 
-        if(RelationSortUtils.isOneway(m)) {
-            if(dirBW != NONE){
+        if (RelationSortUtils.isOneway(m)) {
+            if (dirBW != NONE){
                 wct.direction = dirBW;
                 lastBackwardWay = i;
                 wct.isOnewayLoopBackwardPart = true;
             }
-            if(dirFW != NONE){
+            if (dirFW != NONE){
                 wct.direction = dirFW;
                 lastForwardWay = i;
                 wct.isOnewayLoopForwardPart = true;
             }
-            if(dirFW == NONE && dirBW == NONE) { //Not connected to previous
+            if (dirFW == NONE && dirBW == NONE) { //Not connected to previous
                 //                        unconnectPreviousLink(con, i, true);
                 //                        unconnectPreviousLink(con, i, false);
                 wct.linkPrev = false;
-                if(RelationSortUtils.isOneway(m)){
+                if (RelationSortUtils.isOneway(m)){
                     wct.isOnewayHead = true;
                     lastForwardWay = i-1;
@@ -182,12 +182,10 @@
             }
 
-            if(dirFW != NONE && dirBW != NONE) { //End of oneway loop
-                if(i+1<members.size() && determineDirection(i, dirFW, i+1) != NONE) {
+            if (dirFW != NONE && dirBW != NONE) { //End of oneway loop
+                if (i+1<members.size() && determineDirection(i, dirFW, i+1) != NONE) {
                     wct.isOnewayLoopBackwardPart = false;
-                    dirBW = NONE;
                     wct.direction = dirFW;
                 } else {
                     wct.isOnewayLoopForwardPart = false;
-                    dirFW = NONE;
                     wct.direction = dirBW;
                 }
@@ -199,5 +197,5 @@
             lastForwardWay = UNCONNECTED;
             lastBackwardWay = UNCONNECTED;
-            if(dirFW == NONE || dirBW == NONE) {
+            if (dirFW == NONE || dirBW == NONE) {
                 wct.linkPrev = false;
             }
@@ -207,6 +205,6 @@
 
     private static Direction reverse(final Direction dir){
-        if(dir == FORWARD) return BACKWARD;
-        if(dir == BACKWARD) return FORWARD;
+        if (dir == FORWARD) return BACKWARD;
+        if (dir == BACKWARD) return FORWARD;
         return dir;
     }
@@ -273,7 +271,7 @@
                         return RelationSortUtils.roundaboutType(members.get(k));
                 }
-            } else if(RelationSortUtils.isOneway(m)) {
+            } else if (RelationSortUtils.isOneway(m)) {
                 if (n == RelationNodeMap.firstOnewayNode(m) && !reversed) {
-                    if(RelationSortUtils.isBackward(m))
+                    if (RelationSortUtils.isBackward(m))
                         return BACKWARD;
                     else
@@ -281,5 +279,5 @@
                 }
                 if (n == RelationNodeMap.lastOnewayNode(m) && reversed) {
-                    if(RelationSortUtils.isBackward(m))
+                    if (RelationSortUtils.isBackward(m))
                         return FORWARD;
                     else
@@ -295,4 +293,3 @@
         return NONE;
     }
-
 }
Index: trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 6289)
@@ -736,6 +736,9 @@
     }
 
-
     public static class ChangeResolutionAction extends AbstractAction implements LayerAction {
+        
+        /**
+         * Constructs a new {@code ChangeResolutionAction}
+         */
         public ChangeResolutionAction() {
             super(tr("Change resolution"));
@@ -744,8 +747,4 @@
         @Override
         public void actionPerformed(ActionEvent ev) {
-
-            if (LayerListDialog.getInstance() == null)
-                return;
-
             List<Layer> layers = LayerListDialog.getInstance().getModel().getSelectedLayers();
             for (Layer l: layers) {
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 6289)
@@ -42,6 +42,5 @@
     private static ElemStyles styles = new ElemStyles();
 
-    public static ElemStyles getStyles()
-    {
+    public static ElemStyles getStyles() {
         return styles;
     }
@@ -57,5 +56,5 @@
     public static class TagKeyReference {
         public final String key;
-        public TagKeyReference(String key){
+        public TagKeyReference(String key) {
             this.key = key;
         }
@@ -226,19 +225,23 @@
             else {
                 InputStreamReader reader = new InputStreamReader(in);
-                WHILE: while (true) {
-                    int c = reader.read();
-                    switch (c) {
-                        case -1:
-                            break WHILE;
-                        case ' ':
-                        case '\t':
-                        case '\n':
-                        case '\r':
-                            continue;
-                        case '<':
-                            return new XmlStyleSource(entry);
-                        default:
-                            return new MapCSSStyleSource(entry);
+                try {
+                    WHILE: while (true) {
+                        int c = reader.read();
+                        switch (c) {
+                            case -1:
+                                break WHILE;
+                            case ' ':
+                            case '\t':
+                            case '\n':
+                            case '\r':
+                                continue;
+                            case '<':
+                                return new XmlStyleSource(entry);
+                            default:
+                                return new MapCSSStyleSource(entry);
+                        }
                     }
+                } finally {
+                    reader.close();
                 }
                 Main.warn("Could not detect style type. Using default (xml).");
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java	(revision 6289)
@@ -19,4 +19,5 @@
 import org.openstreetmap.josm.gui.preferences.SourceEntry;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.Utils;
 
 abstract public class StyleSource extends SourceEntry {
@@ -47,5 +48,21 @@
     abstract public void loadStyleSource();
 
+    /**
+     * Returns a new {@code InputStream} to the style source. When finished, {@link #closeSourceInputStream(InputStream)} must be called.
+     * @return A new {@code InputStream} to the style source that must be closed by the caller
+     * @throws IOException if any I/O error occurs.
+     * @see #closeSourceInputStream(InputStream)
+     */
     abstract public InputStream getSourceInputStream() throws IOException;
+
+    /**
+     * Closes the source input stream previously returned by {@link #getSourceInputStream()} and other linked resources, if applicable.
+     * @param is The source input stream that must be closed
+     * @since 6289
+     * @see #getSourceInputStream()
+     */
+    public void closeSourceInputStream(InputStream is) {
+        Utils.close(is);
+    }
 
     public void logError(Throwable e) {
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java	(revision 6289)
@@ -37,4 +37,5 @@
     private Color backgroundColorOverride;
     private String css = null;
+    private ZipFile zipFile;
 
     public MapCSSStyleSource(String url, String name, String shortdescription) {
@@ -67,8 +68,13 @@
         rules.clear();
         try {
-            MapCSSParser parser = new MapCSSParser(getSourceInputStream(), "UTF-8");
-            parser.sheet(this);
-            loadMeta();
-            loadCanvas();
+            InputStream in = getSourceInputStream();
+            try {
+                MapCSSParser parser = new MapCSSParser(in, "UTF-8");
+                parser.sheet(this);
+                loadMeta();
+                loadCanvas();
+            } finally {
+                closeSourceInputStream(in);
+            }
         } catch (IOException e) {
             Main.warn(tr("Failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
@@ -88,18 +94,27 @@
     @Override
     public InputStream getSourceInputStream() throws IOException {
-        if (css != null)
+        if (css != null) {
             return new ByteArrayInputStream(css.getBytes("UTF-8"));
-
+        }
         MirroredInputStream in = new MirroredInputStream(url);
         if (isZip) {
             File file = in.getFile();
             Utils.close(in);
-            ZipFile zipFile = new ZipFile(file);
+            zipFile = new ZipFile(file);
             zipIcons = file;
             ZipEntry zipEntry = zipFile.getEntry(zipEntryPath);
             return zipFile.getInputStream(zipEntry);
         } else {
+            zipFile = null;
             zipIcons = null;
             return in;
+        }
+    }
+
+    @Override
+    public void closeSourceInputStream(InputStream is) {
+        super.closeSourceInputStream(is);
+        if (isZip) {
+            Utils.close(zipFile);
         }
     }
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java	(revision 6289)
@@ -68,10 +68,15 @@
         init();
         try {
-            InputStreamReader reader = new InputStreamReader(getSourceInputStream());
-            XmlObjectParser parser = new XmlObjectParser(new XmlStyleSourceHandler(this));
-            parser.startWithValidation(reader,
-                    Main.JOSM_WEBSITE+"/mappaint-style-1.0",
-                    "resource://data/mappaint-style.xsd");
-            while(parser.hasNext()) {
+            InputStream in = getSourceInputStream();
+            try {
+                InputStreamReader reader = new InputStreamReader(in);
+                XmlObjectParser parser = new XmlObjectParser(new XmlStyleSourceHandler(this));
+                parser.startWithValidation(reader,
+                        Main.JOSM_WEBSITE+"/mappaint-style-1.0",
+                        "resource://data/mappaint-style.xsd");
+                while (parser.hasNext()) {
+                }
+            } finally {
+                closeSourceInputStream(in);
             }
 
Index: trunk/src/org/openstreetmap/josm/io/OsmBzip2Exporter.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/OsmBzip2Exporter.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/io/OsmBzip2Exporter.java	(revision 6289)
@@ -9,6 +9,11 @@
 
 import org.apache.tools.bzip2.CBZip2OutputStream;
+import org.openstreetmap.josm.tools.Utils;
+
 public class OsmBzip2Exporter extends OsmExporter {
 
+    /**
+     * Constructs a new {@code OsmBzip2Exporter}.
+     */
     public OsmBzip2Exporter() {
         super(OsmBzip2Importer.FILE_FILTER);
@@ -18,8 +23,12 @@
     protected OutputStream getOutputStream(File file) throws FileNotFoundException, IOException {
         OutputStream out = new FileOutputStream(file);
-        out.write('B');
-        out.write('Z');
-        out = new CBZip2OutputStream(out);
-        return out;
+        try {
+            out.write('B');
+            out.write('Z');
+            return new CBZip2OutputStream(out);
+        } catch (IOException e) {
+            Utils.close(out);
+            throw e;
+        }
     }
 }
Index: trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 6288)
+++ trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java	(revision 6289)
@@ -228,5 +228,5 @@
         for (Element child : crsChildren) {
             String crs = (String) getContent(child);
-            if (crs != null) {
+            if (!crs.isEmpty()) {
                 String upperCase = crs.trim().toUpperCase();
                 crsList.add(upperCase);
@@ -280,5 +280,5 @@
         else {
             String content = (String) getContent(child);
-            return (content != null) ? content : empty;
+            return (!content.isEmpty()) ? content : empty;
         }
     }
