Ignore:
Timestamp:
2016-12-13T02:16:07+01:00 (3 years ago)
Author:
Don-vip
Message:

sonar - squid:S1066 - Collapsible "if" statements should be merged

Location:
trunk/src/org/openstreetmap/josm/io
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/CachedFile.java

    r11288 r11386  
    339339            while (entries.hasMoreElements()) {
    340340                ZipEntry entry = entries.nextElement();
    341                 if (entry.getName().endsWith('.' + extension)) {
    342                     /* choose any file with correct extension. When more than
    343                         one file, prefer the one which matches namepart */
    344                     if (resentry == null || entry.getName().indexOf(namepart) >= 0) {
    345                         resentry = entry;
    346                     }
     341                // choose any file with correct extension. When more than one file, prefer the one which matches namepart
     342                if (entry.getName().endsWith('.' + extension) && (resentry == null || entry.getName().indexOf(namepart) >= 0)) {
     343                    resentry = entry;
    347344                }
    348345            }
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r10755 r11386  
    193193        remember(relation.getPrimitiveId());
    194194        for (RelationMember member : !recursesDown() ? relation.getMembers() : Collections.<RelationMember>emptyList()) {
    195             if (OsmPrimitiveType.from(member.getMember()).equals(OsmPrimitiveType.RELATION)) {
    196                 // avoid infinite recursion in case of cyclic dependencies in relations
    197                 //
    198                 if (relations.contains(member.getMember().getId())) {
    199                     continue;
    200                 }
     195            // avoid infinite recursion in case of cyclic dependencies in relations
     196            if (OsmPrimitiveType.from(member.getMember()).equals(OsmPrimitiveType.RELATION)
     197                    && relations.contains(member.getMember().getId())) {
     198                continue;
    201199            }
    202200            if (!member.getMember().isIncomplete()) {
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r11381 r11386  
    667667                int retCode = response.getResponseCode();
    668668
    669                 if (retCode >= 500) {
    670                     if (retries-- > 0) {
    671                         sleepAndListen(retries, monitor);
    672                         Main.info(tr("Starting retry {0} of {1}.", getMaxRetries() - retries, getMaxRetries()));
    673                         continue;
    674                     }
     669                if (retCode >= 500 && retries-- > 0) {
     670                    sleepAndListen(retries, monitor);
     671                    Main.info(tr("Starting retry {0} of {1}.", getMaxRetries() - retries, getMaxRetries()));
     672                    continue;
    675673                }
    676674
  • trunk/src/org/openstreetmap/josm/io/OsmExporter.java

    r11098 r11386  
    8282        File tmpFile = null;
    8383        try {
    84             // use a tmp file because if something errors out in the
    85             // process of writing the file, we might just end up with
    86             // a truncated file.  That can destroy lots of work.
     84            // use a tmp file because if something errors out in the process of writing the file,
     85            // we might just end up with a truncated file.  That can destroy lots of work.
    8786            if (file.exists()) {
    8887                tmpFile = new File(file.getPath() + '~');
     
    9190
    9291            doSave(file, layer);
    93             if (noBackup || !Main.pref.getBoolean("save.keepbackup", false)) {
    94                 if (tmpFile != null) {
    95                     Utils.deleteFile(tmpFile);
    96                 }
     92            if ((noBackup || !Main.pref.getBoolean("save.keepbackup", false)) && tmpFile != null) {
     93                Utils.deleteFile(tmpFile);
    9794            }
    9895            layer.onPostSaveToFile();
     
    107104
    108105            try {
    109                 // if the file save failed, then the tempfile will not
    110                 // be deleted.  So, restore the backup if we made one.
     106                // if the file save failed, then the tempfile will not be deleted. So, restore the backup if we made one.
    111107                if (tmpFile != null && tmpFile.exists()) {
    112108                    Utils.copyFile(tmpFile, file);
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r11374 r11386  
    291291                break;
    292292            case MIRROR:
    293                 if ("mirror".equals(qName)) {
    294                     if (mirrorEntry != null) {
    295                         entry.addMirror(mirrorEntry);
    296                         mirrorEntry = null;
    297                     }
     293                if ("mirror".equals(qName) && mirrorEntry != null) {
     294                    entry.addMirror(mirrorEntry);
     295                    mirrorEntry = null;
    298296                }
    299297                break;
Note: See TracChangeset for help on using the changeset viewer.