Changeset 5791 in josm for trunk


Ignore:
Timestamp:
2013-03-22T01:17:06+01:00 (11 years ago)
Author:
Don-vip
Message:

see #8530 - workaround for NPE when loading "Steps properties" presets ("No handrail" item) + various minor stuff

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r5475 r5791  
    304304                    if (i instanceof TaggingPreset.KeyedItem) {
    305305                        TaggingPreset.KeyedItem ky = (TaggingPreset.KeyedItem) i;
    306                         presetsValueData.putAll(ky.key, ky.getValues());
     306                        if (ky.key != null && ky.getValues() != null) {
     307                            try {
     308                                presetsValueData.putAll(ky.key, ky.getValues());
     309                            } catch (NullPointerException e) {
     310                                System.err.println(p+": Unable to initialize "+ky);
     311                            }
     312                        }
    307313                    }
    308314                }
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java

    r5452 r5791  
    3232    private boolean canceled;
    3333    private Exception lastException;
    34     private List<PrimitiveId> ids;
     34    private final List<PrimitiveId> ids;
    3535
    3636    private Set<PrimitiveId> missingPrimitives;
    3737
    38     private OsmDataLayer layer;
    39     private boolean fullRelation;
     38    private final OsmDataLayer layer;
     39    private final boolean fullRelation;
    4040    private MultiFetchServerObjectReader multiObjectReader;
    4141    private OsmServerObjectReader objectReader;
     
    4545     *
    4646     * @param layer the layer in which primitives are updated. Must not be null.
    47      * @param toUpdate a collection of primitives to update from the server. Set to
     47     * @param ids a collection of primitives to update from the server. Set to
    4848     * the empty collection if null.
    4949     * @param fullRelation true if a full download is required, i.e.,
     
    5151     * @throws IllegalArgumentException thrown if layer is null.
    5252     */
    53     public DownloadPrimitivesTask(OsmDataLayer layer, List<PrimitiveId>  ids, boolean fullRelation) throws IllegalArgumentException {
     53    public DownloadPrimitivesTask(OsmDataLayer layer, List<PrimitiveId> ids, boolean fullRelation) throws IllegalArgumentException {
    5454        super(tr("Download objects"), false /* don't ignore exception */);
    5555        ensureParameterNotNull(layer, "layer");
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r5675 r5791  
    261261            }
    262262        }
    263 
     263       
     264        @Override
     265        public String toString() {
     266            return "KeyedItem [key=" + key + ", text=" + text
     267                    + ", text_context=" + text_context + ", match=" + match
     268                    + "]";
     269        }
    264270    }
    265271
     
    669675
    670676        protected JComponent component;
    671         protected Map<String, PresetListEntry> lhm = new LinkedHashMap<String, PresetListEntry>();
     677        protected final Map<String, PresetListEntry> lhm = new LinkedHashMap<String, PresetListEntry>();
    672678        private boolean initialized = false;
    673679        protected Usage usage;
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java

    r5266 r5791  
    151151                if (item instanceof TaggingPreset.KeyedItem) {
    152152                    TaggingPreset.KeyedItem ki = (TaggingPreset.KeyedItem) item;
    153                     if (ki.key == null) {
    154                         continue;
     153                    if (ki.key != null && ki.getValues() != null) {
     154                        try {
     155                            presetTagCache.putAll(ki.key, ki.getValues());
     156                        } catch (NullPointerException e) {
     157                            System.err.println(p+": Unable to cache "+ki);
     158                        }
    155159                    }
    156                     presetTagCache.putAll(ki.key, ki.getValues());
    157160                } else if (item instanceof TaggingPreset.Roles) {
    158161                    TaggingPreset.Roles r = (TaggingPreset.Roles) item;
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r5772 r5791  
    591591        while (leadingWhite && start < end) {
    592592            char c = str.charAt(start);
    593             if (leadingWhite = (Character.isWhitespace(c) || Character.isSpaceChar(c))) {
     593            leadingWhite = (Character.isWhitespace(c) || Character.isSpaceChar(c));
     594            if (leadingWhite) {
    594595                start++;
    595596            }
     
    598599        while (trailingWhite && end > start+1) {
    599600            char c = str.charAt(end-1);
    600             if (trailingWhite = (Character.isWhitespace(c) || Character.isSpaceChar(c))) {
     601            trailingWhite = (Character.isWhitespace(c) || Character.isSpaceChar(c));
     602            if (trailingWhite) {
    601603                end--;
    602604            }
Note: See TracChangeset for help on using the changeset viewer.