Ticket #8902: instanceofnullcheck.diff
File instanceofnullcheck.diff, 9.0 KB (added by , 11 years ago) |
---|
-
src/org/openstreetmap/josm/data/osm/Node.java
266 266 267 267 @Override 268 268 public boolean hasEqualSemanticAttributes(OsmPrimitive other) { 269 if ( other == null || ! (other instanceof Node))269 if (!(other instanceof Node)) 270 270 return false; 271 271 if (! super.hasEqualSemanticAttributes(other)) 272 272 return false; -
src/org/openstreetmap/josm/data/osm/Relation.java
280 280 281 281 @Override 282 282 public boolean hasEqualSemanticAttributes(OsmPrimitive other) { 283 if ( other == null || ! (other instanceof Relation))283 if (!(other instanceof Relation)) 284 284 return false; 285 285 if (! super.hasEqualSemanticAttributes(other)) 286 286 return false; -
src/org/openstreetmap/josm/data/osm/Way.java
326 326 327 327 @Override 328 328 public boolean hasEqualSemanticAttributes(OsmPrimitive other) { 329 if ( other == null || ! (other instanceof Way))329 if (!(other instanceof Way)) 330 330 return false; 331 331 if (! super.hasEqualSemanticAttributes(other)) 332 332 return false; -
src/org/openstreetmap/josm/gui/MapMover.java
223 223 * @return true if we are currently running on OSX 224 224 */ 225 225 public static boolean isPlatformOsx() { 226 return Main.platform != null && Main.platforminstanceof PlatformHookOsx;226 return Main.platform instanceof PlatformHookOsx; 227 227 } 228 228 229 229 @Override -
src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
227 227 * @param layer the layer. May be null. 228 228 */ 229 229 protected void initFromLayer(Layer layer) { 230 if ( layer == null || !(layer instanceof OsmDataLayer)) {230 if (!(layer instanceof OsmDataLayer)) { 231 231 model.setRelations(null); 232 232 return; 233 233 } … … 676 676 @Override 677 677 public void tagsChanged(TagsChangedEvent event) { 678 678 OsmPrimitive prim = event.getPrimitive(); 679 if ( prim == null || !(prim instanceof Relation))679 if (!(prim instanceof Relation)) 680 680 return; 681 681 // trigger a sort of the relation list because the display name may 682 682 // have changed -
src/org/openstreetmap/josm/gui/dialogs/relation/RelationDialogManager.java
184 184 */ 185 185 @Override 186 186 public void layerRemoved(Layer oldLayer) { 187 if ( oldLayer == null || !(oldLayer instanceof OsmDataLayer))187 if (!(oldLayer instanceof OsmDataLayer)) 188 188 return; 189 189 OsmDataLayer dataLayer = (OsmDataLayer)oldLayer; 190 190 -
src/org/openstreetmap/josm/gui/help/HelpBrowser.java
580 580 protected String getUrlFragment(HyperlinkEvent e) { 581 581 AttributeSet set = e.getSourceElement().getAttributes(); 582 582 Object value = set.getAttribute(Tag.A); 583 if ( value == null || !(value instanceof SimpleAttributeSet)) return null;583 if (!(value instanceof SimpleAttributeSet)) return null; 584 584 SimpleAttributeSet atts = (SimpleAttributeSet)value; 585 585 value = atts.getAttribute(javax.swing.text.html.HTML.Attribute.HREF); 586 586 if (value == null) return null; -
src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java
251 251 protected void refresh() { 252 252 HistoryOsmPrimitive p = getPrimitive(); 253 253 HistoryOsmPrimitive opposite = getOppositePrimitive(); 254 if ( p == null || ! (p instanceof HistoryNode)) return;255 if ( opposite == null || !(opposite instanceof HistoryNode)) return;254 if (!(p instanceof HistoryNode)) return; 255 if (!(opposite instanceof HistoryNode)) return; 256 256 HistoryNode node = (HistoryNode)p; 257 257 HistoryNode oppositeNode = (HistoryNode) opposite; 258 258 … … 324 324 protected void refresh() { 325 325 HistoryOsmPrimitive p = getPrimitive(); 326 326 HistoryOsmPrimitive opposite = getOppositePrimitive(); 327 if ( p == null || ! (p instanceof HistoryNode)) return;328 if ( opposite == null || !(opposite instanceof HistoryNode)) return;327 if (!(p instanceof HistoryNode)) return; 328 if (!(opposite instanceof HistoryNode)) return; 329 329 HistoryNode node = (HistoryNode) p; 330 330 HistoryNode oppositeNode = (HistoryNode) opposite; 331 331 -
src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
754 754 /* ---------------------------------------------------------------------- */ 755 755 @Override 756 756 public void activeLayerChange(Layer oldLayer, Layer newLayer) { 757 if (oldLayer != null && oldLayerinstanceof OsmDataLayer) {757 if (oldLayer instanceof OsmDataLayer) { 758 758 OsmDataLayer l = (OsmDataLayer)oldLayer; 759 759 l.data.removeDataSetListener(this); 760 760 } 761 if ( newLayer == null || !(newLayer instanceof OsmDataLayer)) {761 if (!(newLayer instanceof OsmDataLayer)) { 762 762 latest = null; 763 763 fireModelChange(); 764 764 return; -
src/org/openstreetmap/josm/gui/mappaint/BoxTextElemStyle.java
68 68 69 69 @Override 70 70 public boolean equals(Object obj) { 71 if ( obj == null ||!(obj instanceof BoxProvider))71 if (!(obj instanceof BoxProvider)) 72 72 return false; 73 73 final BoxProvider other = (BoxProvider) obj; 74 74 BoxProviderResult resultOther = other.get(); -
src/org/openstreetmap/josm/gui/mappaint/Environment.java
106 106 } 107 107 108 108 public boolean hasParentRelation() { 109 return parent != null && parentinstanceof Relation;109 return parent instanceof Relation; 110 110 } 111 111 112 112 /** … … 122 122 if (getContext().equals(Context.PRIMITIVE)) 123 123 return null; 124 124 125 if (parent != null && parentinstanceof Relation)125 if (parent instanceof Relation) 126 126 return ((Relation) parent).getMember(index).getRole(); 127 127 if (child != null && osm instanceof Relation) 128 128 return ((Relation) osm).getMember(index).getRole(); -
src/org/openstreetmap/josm/gui/mappaint/MapImage.java
129 129 130 130 @Override 131 131 public boolean equals(Object obj) { 132 if ( obj == null ||!(obj instanceof BoxProvider))132 if (!(obj instanceof BoxProvider)) 133 133 return false; 134 134 if (obj instanceof MapImageBoxProvider) { 135 135 MapImageBoxProvider other = (MapImageBoxProvider) obj;