Changeset 11796 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2017-03-31T00:08:09+02:00 (7 years ago)
Author:
Don-vip
Message:

sonar - squid:S2259 - Null pointers should not be dereferenced

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r11559 r11796  
    184184                case SUCCESS:
    185185                    handleNoTileAtZoom();
    186                     int httpStatusCode = attributes.getResponseCode();
    187                     if (httpStatusCode >= 400 && !isNoTileAtZoom()) {
    188                         if (attributes.getErrorMessage() == null) {
    189                             tile.setError(tr("HTTP error {0} when loading tiles", httpStatusCode));
    190                         } else {
    191                             tile.setError(tr("Error downloading tiles: {0}", attributes.getErrorMessage()));
     186                    if (attributes != null) {
     187                        int httpStatusCode = attributes.getResponseCode();
     188                        if (httpStatusCode >= 400 && !isNoTileAtZoom()) {
     189                            if (attributes.getErrorMessage() == null) {
     190                                tile.setError(tr("HTTP error {0} when loading tiles", httpStatusCode));
     191                            } else {
     192                                tile.setError(tr("Error downloading tiles: {0}", attributes.getErrorMessage()));
     193                            }
     194                            status = false;
    192195                        }
    193                         status = false;
    194196                    }
    195197                    status &= tryLoadTileImage(object); //try to keep returned image as background
  • trunk/src/org/openstreetmap/josm/data/osm/Node.java

    r11397 r11796  
    403403            return true;
    404404        }
    405         if (hops > 0) {
     405        if (hops > 0 && visited != null) {
    406406            visited.add(this);
    407407            for (final Way w : Utils.filteredCollection(this.getReferrers(), Way.class)) {
  • trunk/src/org/openstreetmap/josm/data/osm/event/DatasetEventManager.java

    r10332 r11796  
    8686
    8787                // Fire consolidated event
    88                 fireConsolidatedEvents(inEDTListeners, consolidatedEvent);
     88                if (consolidatedEvent != null) {
     89                    fireConsolidatedEvents(inEDTListeners, consolidatedEvent);
     90                }
    8991            }
    9092        }
  • trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java

    r11553 r11796  
    1515import java.util.Collection;
    1616import java.util.Date;
     17import java.util.Objects;
    1718import java.util.Optional;
    1819import java.util.TreeSet;
     
    657658     */
    658659    public static String explainOsmTransferException(OsmTransferException e) {
     660        Objects.requireNonNull(e, "e");
    659661        if (getNestedException(e, SecurityException.class) != null)
    660662            return explainSecurityException(e);
Note: See TracChangeset for help on using the changeset viewer.