Index: /trunk/build.xml
===================================================================
--- /trunk/build.xml	(revision 5501)
+++ /trunk/build.xml	(revision 5502)
@@ -121,6 +121,6 @@
     </target>
     <target name="compile" depends="init,javacc">
-        <javac srcdir="src" includes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.5" source="1.5" debug="on" encoding="iso-8859-1"/>
-        <javac srcdir="src" excludes="com/**,oauth/**,org/apache/commons/codec/**" destdir="build" target="1.5" source="1.5" debug="on" encoding="UTF-8">
+        <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"/>
+        <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">
             <compilerarg value="-Xlint:deprecation"/>
             <compilerarg value="-Xlint:unchecked"/>
Index: /trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java	(revision 5501)
+++ /trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java	(revision 5502)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.data.gpx;
 
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
@@ -7,17 +8,40 @@
 /**
  * Base class for various classes in the GPX model.
- * The "attr" hash is used to store the XML payload
- * (not only XML attributes!)
  *
  * @author Frederik Ramm <frederik@remote.org>
- *
+ * @since 444
  */
 public class WithAttributes {
 
+    /**
+     * The "attr" hash is used to store the XML payload (not only XML attributes!)
+     */
     public Map<String, Object> attr = new HashMap<String, Object>(0);
 
+    /**
+     * Returns the String value to which the specified key is mapped, 
+     * or {@code null} if this map contains no String mapping for the key.
+     *  
+     * @param key the key whose associated value is to be returned
+     * @return the String value to which the specified key is mapped, 
+     *         or {@code null} if this map contains no String mapping for the key
+     */
     public String getString(String key) {
         Object value = attr.get(key);
         return (value instanceof String) ? (String)value : null;
     }
+    
+    /**
+     * Returns the Collection value to which the specified key is mapped, 
+     * or {@code null} if this map contains no Collection mapping for the key.
+     *  
+     * @param key the key whose associated value is to be returned
+     * @return the Collection value to which the specified key is mapped, 
+     *         or {@code null} if this map contains no Collection mapping for the key
+     * @since 5502
+     */
+    public Collection<?> getCollection(String key) {
+        Object value = attr.get(key);
+        return (value instanceof Collection<?>) ? (Collection<?>)value : null;
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java	(revision 5501)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java	(revision 5502)
@@ -25,5 +25,4 @@
 import javax.swing.JCheckBoxMenuItem;
 import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
 
 import org.openstreetmap.josm.Main;
@@ -87,16 +86,21 @@
             if (firstTime < 0 && wpt_has_link) {
                 firstTime = time;
-                for (GpxLink oneLink : (Collection<GpxLink>) wpt.attr.get(GpxData.META_LINKS)) {
-                    lastLinkedFile = oneLink.uri;
-                    break;
+                for (Object oneLink : wpt.getCollection(GpxData.META_LINKS)) {
+                    if (oneLink instanceof GpxLink) {
+                        lastLinkedFile = ((GpxLink)oneLink).uri;
+                        break;
+                    }
                 }
             }
             if (wpt_has_link) {
-                for (GpxLink oneLink : (Collection<GpxLink>) wpt.attr.get(GpxData.META_LINKS)) {
-                    if (!oneLink.uri.equals(lastLinkedFile)) {
-                        firstTime = time;
+                for (Object oneLink : wpt.getCollection(GpxData.META_LINKS)) {
+                    if (oneLink instanceof GpxLink) {
+                        String uri = ((GpxLink)oneLink).uri;
+                        if (!uri.equals(lastLinkedFile)) {
+                            firstTime = time;
+                        }
+                        lastLinkedFile = uri;
+                        break;
                     }
-                    lastLinkedFile = oneLink.uri;
-                    break;
                 }
             }
