Ignore:
Timestamp:
2014-04-16T02:29:53+02:00 (10 years ago)
Author:
Don-vip
Message:

sonar - fix some more issues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r6920 r6987  
    457457                    }
    458458
    459                     String full_name = subdir + name + ext;
    460                     String cache_name = full_name;
     459                    String fullName = subdir + name + ext;
     460                    String cacheName = fullName;
    461461                    /* cache separately */
    462462                    if (dirs != null && !dirs.isEmpty()) {
    463                         cache_name = "id:" + id + ":" + full_name;
     463                        cacheName = "id:" + id + ":" + fullName;
    464464                        if(archive != null) {
    465                             cache_name += ":" + archive.getName();
     465                            cacheName += ":" + archive.getName();
    466466                        }
    467467                    }
    468468
    469                     ImageResource ir = cache.get(cache_name);
     469                    ImageResource ir = cache.get(cacheName);
    470470                    if (ir != null) return ir;
    471471
     
    473473                    case ARCHIVE:
    474474                        if (archive != null) {
    475                             ir = getIfAvailableZip(full_name, archive, inArchiveDir, type);
     475                            ir = getIfAvailableZip(fullName, archive, inArchiveDir, type);
    476476                            if (ir != null) {
    477                                 cache.put(cache_name, ir);
     477                                cache.put(cacheName, ir);
    478478                                return ir;
    479479                            }
     
    486486                        // and don't bother to create a URL unless we're actually
    487487                        // creating the image.
    488                         URL path = getImageUrl(full_name, dirs, additionalClassLoaders);
     488                        URL path = getImageUrl(fullName, dirs, additionalClassLoaders);
    489489                        if (path == null) {
    490490                            continue;
     
    492492                        ir = getIfAvailableLocalURL(path, type);
    493493                        if (ir != null) {
    494                             cache.put(cache_name, ir);
     494                            cache.put(cacheName, ir);
    495495                            return ir;
    496496                        }
     
    602602    }
    603603
    604     private static ImageResource getIfAvailableZip(String full_name, File archive, String inArchiveDir, ImageType type) {
     604    private static ImageResource getIfAvailableZip(String fullName, File archive, String inArchiveDir, ImageType type) {
    605605        ZipFile zipFile = null;
    606         try
    607         {
     606        try {
    608607            zipFile = new ZipFile(archive);
    609608            if (inArchiveDir == null || inArchiveDir.equals(".")) {
     
    612611                inArchiveDir += "/";
    613612            }
    614             String entry_name = inArchiveDir + full_name;
    615             ZipEntry entry = zipFile.getEntry(entry_name);
     613            String entryName = inArchiveDir + fullName;
     614            ZipEntry entry = zipFile.getEntry(entryName);
    616615            if(entry != null)
    617616            {
     
    624623                    switch (type) {
    625624                    case SVG:
    626                         URI uri = getSvgUniverse().loadSVG(is, entry_name);
     625                        URI uri = getSvgUniverse().loadSVG(is, entryName);
    627626                        SVGDiagram svg = getSvgUniverse().getDiagram(uri);
    628627                        return svg == null ? null : new ImageResource(svg);
     
    755754        /** Quit parsing, when a certain condition is met */
    756755        class SAXReturnException extends SAXException {
    757             private String result;
     756            private final String result;
    758757
    759758            public SAXReturnException(String result) {
Note: See TracChangeset for help on using the changeset viewer.