Changeset 16407 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2020-05-13T15:24:14+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r15089 r16407 26 26 import org.openstreetmap.josm.data.osm.Node; 27 27 import org.openstreetmap.josm.data.osm.OsmPrimitive; 28 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 28 29 import org.openstreetmap.josm.data.osm.Relation; 29 30 import org.openstreetmap.josm.data.osm.Way; … … 135 136 return Pair.create(n, refs); 136 137 } 137 m = Pattern.compile(".*Way ( \\d+) requires the nodes with id in " + ids + ".*").matcher(msg);138 m = Pattern.compile(".*Way ([-]*\\d+) requires the nodes with id in " + ids + ".*").matcher(msg); 138 139 // ... ", which either do not exist, or are not visible" 139 140 if (m.matches()) { 140 OsmPrimitive n = new Way(Long.parseLong(m.group(1)));141 OsmPrimitive n = OsmPrimitiveType.WAY.newInstance(Long.parseLong(m.group(1)), true); 141 142 for (String s : m.group(2).split(",")) { 142 143 refs.add(new Node(Long.parseLong(s))); 144 } 145 return Pair.create(n, refs); 146 } 147 m = Pattern.compile(".*Relation ([-]*\\d+) requires the nodes with id in " + ids + ".*").matcher(msg); 148 // ... ", which either do not exist, or are not visible" 149 if (m.matches()) { 150 OsmPrimitive n = OsmPrimitiveType.RELATION.newInstance(Long.parseLong(m.group(1)), true); 151 for (String s : m.group(2).split(",")) { 152 refs.add(new Node(Long.parseLong(s))); 153 } 154 return Pair.create(n, refs); 155 } 156 m = Pattern.compile(".*Relation ([-]*\\d+) requires the ways with id in " + ids + ".*").matcher(msg); 157 // ... ", which either do not exist, or are not visible" 158 if (m.matches()) { 159 OsmPrimitive n = OsmPrimitiveType.RELATION.newInstance(Long.parseLong(m.group(1)), true); 160 for (String s : m.group(2).split(",")) { 161 refs.add(new Way(Long.parseLong(s))); 143 162 } 144 163 return Pair.create(n, refs); … … 158 177 if (conflict != null) { 159 178 OsmPrimitive firstRefs = conflict.b.iterator().next(); 160 String objId = Long.toString(conflict.a.get Id());179 String objId = Long.toString(conflict.a.getUniqueId()); 161 180 Collection<Long> refIds = Utils.transform(conflict.b, OsmPrimitive::getId); 162 181 String refIdsString = refIds.size() == 1 ? refIds.iterator().next().toString() : refIds.toString(); 163 182 if (conflict.a instanceof Node) { 164 if (firstRefs instanceof Node) { 165 return "<html>" + trn( 166 "<strong>Failed</strong> to delete <strong>node {0}</strong>." 167 + " It is still referred to by node {1}.<br>" 168 + "Please load the node, remove the reference to the node, and upload again.", 169 "<strong>Failed</strong> to delete <strong>node {0}</strong>." 170 + " It is still referred to by nodes {1}.<br>" 171 + "Please load the nodes, remove the reference to the node, and upload again.", 172 conflict.b.size(), objId, refIdsString) + "</html>"; 173 } else if (firstRefs instanceof Way) { 183 if (firstRefs instanceof Way) { 174 184 return "<html>" + trn( 175 185 "<strong>Failed</strong> to delete <strong>node {0}</strong>." … … 194 204 } else if (conflict.a instanceof Way) { 195 205 if (firstRefs instanceof Node) { 206 // way p1 requires nodes 196 207 return "<html>" + trn( 197 "<strong>Failed</strong> to delete <strong>way {0}</strong>." 198 + " It is still referred to by node {1}.<br>" 199 + "Please load the node, remove the reference to the way, and upload again.", 200 "<strong>Failed</strong> to delete <strong>way {0}</strong>." 201 + " It is still referred to by nodes {1}.<br>" 202 + "Please load the nodes, remove the reference to the way, and upload again.", 203 conflict.b.size(), objId, refIdsString) + "</html>"; 204 } else if (firstRefs instanceof Way) { 205 return "<html>" + trn( 206 "<strong>Failed</strong> to delete <strong>way {0}</strong>." 207 + " It is still referred to by way {1}.<br>" 208 + "Please load the way, remove the reference to the way, and upload again.", 209 "<strong>Failed</strong> to delete <strong>way {0}</strong>." 210 + " It is still referred to by ways {1}.<br>" 211 + "Please load the ways, remove the reference to the way, and upload again.", 208 "<strong>Failed</strong> to upload <strong>way {0}</strong>." 209 + " It refers to deleted node {1}.<br>" 210 + "Please load the node, remove the reference in the way, and upload again.", 211 "<strong>Failed</strong> to upload <strong>way {0}</strong>." 212 + " It refers to deleted nodes {1}.<br>" 213 + "Please load the nodes, remove the reference in the way, and upload again.", 212 214 conflict.b.size(), objId, refIdsString) + "</html>"; 213 215 } else if (firstRefs instanceof Relation) { 216 // way is used by relation 214 217 return "<html>" + trn( 215 218 "<strong>Failed</strong> to delete <strong>way {0}</strong>." … … 226 229 if (firstRefs instanceof Node) { 227 230 return "<html>" + trn( 228 "<strong>Failed</strong> to delete<strong>relation {0}</strong>."229 + " It is still referred to bynode {1}.<br>"230 + "Please load the node, remove the reference tothe relation, and upload again.",231 "<strong>Failed</strong> to delete<strong>relation {0}</strong>."232 + " It is still referred to bynodes {1}.<br>"233 + "Please load the nodes, remove the reference tothe relation, and upload again.",231 "<strong>Failed</strong> to upload <strong>relation {0}</strong>." 232 + " it refers to deleted node {1}.<br>" 233 + "Please load the node, remove the reference in the relation, and upload again.", 234 "<strong>Failed</strong> to upload <strong>relation {0}</strong>." 235 + " it refers to deleted nodes {1}.<br>" 236 + "Please load the nodes, remove the reference in the relation, and upload again.", 234 237 conflict.b.size(), objId, refIdsString) + "</html>"; 235 238 } else if (firstRefs instanceof Way) { 236 239 return "<html>" + trn( 237 "<strong>Failed</strong> to delete<strong>relation {0}</strong>."238 + " It is still referred to byway {1}.<br>"239 + "Please load the way, remove the reference tothe relation, and upload again.",240 "<strong>Failed</strong> to delete<strong>relation {0}</strong>."241 + " It is still referred to byways {1}.<br>"242 + "Please load the ways, remove the reference tothe relation, and upload again.",240 "<strong>Failed</strong> to upload <strong>relation {0}</strong>." 241 + " It refers to deleted way {1}.<br>" 242 + "Please load the way, remove the reference in the relation, and upload again.", 243 "<strong>Failed</strong> to upload <strong>relation {0}</strong>." 244 + " It refers to deleted ways {1}.<br>" 245 + "Please load the ways, remove the reference in the relation, and upload again.", 243 246 conflict.b.size(), objId, refIdsString) + "</html>"; 244 247 } else if (firstRefs instanceof Relation) {
Note:
See TracChangeset
for help on using the changeset viewer.