Changeset 5502 in josm


Ignore:
Timestamp:
2012-09-07T22:18:59+02:00 (7 years ago)
Author:
Don-vip
Message:

fix some compilation warnings

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r5498 r5502  
    121121    </target>
    122122    <target name="compile" depends="init,javacc">
    123         <javac srcdir="src" includes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.5" source="1.5" debug="on" encoding="iso-8859-1"/>
    124         <javac srcdir="src" excludes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.5" source="1.5" debug="on" encoding="UTF-8">
     123        <javac srcdir="src" includes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.6" source="1.6" debug="on" includeantruntime="false" encoding="iso-8859-1"/>
     124        <javac srcdir="src" excludes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.6" source="1.6" debug="on" includeantruntime="false" encoding="UTF-8">
    125125            <compilerarg value="-Xlint:deprecation"/>
    126126            <compilerarg value="-Xlint:unchecked"/>
  • trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java

    r1169 r5502  
    22package org.openstreetmap.josm.data.gpx;
    33
     4import java.util.Collection;
    45import java.util.HashMap;
    56import java.util.Map;
     
    78/**
    89 * Base class for various classes in the GPX model.
    9  * The "attr" hash is used to store the XML payload
    10  * (not only XML attributes!)
    1110 *
    1211 * @author Frederik Ramm <frederik@remote.org>
    13  *
     12 * @since 444
    1413 */
    1514public class WithAttributes {
    1615
     16    /**
     17     * The "attr" hash is used to store the XML payload (not only XML attributes!)
     18     */
    1719    public Map<String, Object> attr = new HashMap<String, Object>(0);
    1820
     21    /**
     22     * Returns the String value to which the specified key is mapped,
     23     * or {@code null} if this map contains no String mapping for the key.
     24     * 
     25     * @param key the key whose associated value is to be returned
     26     * @return the String value to which the specified key is mapped,
     27     *         or {@code null} if this map contains no String mapping for the key
     28     */
    1929    public String getString(String key) {
    2030        Object value = attr.get(key);
    2131        return (value instanceof String) ? (String)value : null;
    2232    }
     33   
     34    /**
     35     * Returns the Collection value to which the specified key is mapped,
     36     * or {@code null} if this map contains no Collection mapping for the key.
     37     * 
     38     * @param key the key whose associated value is to be returned
     39     * @return the Collection value to which the specified key is mapped,
     40     *         or {@code null} if this map contains no Collection mapping for the key
     41     * @since 5502
     42     */
     43    public Collection<?> getCollection(String key) {
     44        Object value = attr.get(key);
     45        return (value instanceof Collection<?>) ? (Collection<?>)value : null;
     46    }
    2347}
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java

    r5501 r5502  
    2525import javax.swing.JCheckBoxMenuItem;
    2626import javax.swing.JOptionPane;
    27 import javax.swing.SwingUtilities;
    2827
    2928import org.openstreetmap.josm.Main;
     
    8786            if (firstTime < 0 && wpt_has_link) {
    8887                firstTime = time;
    89                 for (GpxLink oneLink : (Collection<GpxLink>) wpt.attr.get(GpxData.META_LINKS)) {
    90                     lastLinkedFile = oneLink.uri;
    91                     break;
     88                for (Object oneLink : wpt.getCollection(GpxData.META_LINKS)) {
     89                    if (oneLink instanceof GpxLink) {
     90                        lastLinkedFile = ((GpxLink)oneLink).uri;
     91                        break;
     92                    }
    9293                }
    9394            }
    9495            if (wpt_has_link) {
    95                 for (GpxLink oneLink : (Collection<GpxLink>) wpt.attr.get(GpxData.META_LINKS)) {
    96                     if (!oneLink.uri.equals(lastLinkedFile)) {
    97                         firstTime = time;
     96                for (Object oneLink : wpt.getCollection(GpxData.META_LINKS)) {
     97                    if (oneLink instanceof GpxLink) {
     98                        String uri = ((GpxLink)oneLink).uri;
     99                        if (!uri.equals(lastLinkedFile)) {
     100                            firstTime = time;
     101                        }
     102                        lastLinkedFile = uri;
     103                        break;
    98104                    }
    99                     lastLinkedFile = oneLink.uri;
    100                     break;
    101105                }
    102106            }
Note: See TracChangeset for help on using the changeset viewer.