### Eclipse Workspace Patch 1.0
#P josm-2
|
|
|
|
| 9 | 9 | import java.util.stream.Collectors; |
| 10 | 10 | import java.util.stream.Stream; |
| 11 | 11 | |
| 12 | | import org.apache.commons.jcs3.access.exception.InvalidArgumentException; |
| 13 | 12 | import org.openstreetmap.josm.io.GpxReader; |
| | 13 | import org.openstreetmap.josm.tools.Logging; |
| 14 | 14 | import org.xml.sax.Attributes; |
| 15 | 15 | |
| 16 | 16 | /** |
| … |
… |
|
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * Sets the value for the last child and pops it from the stack, so the next one will be added to its parent. |
| 63 | | * The qualified name is verified. |
| | 63 | * A warning is issued if the qualified name does not equal the currently opened child. |
| 64 | 64 | * @param qName the qualified name |
| 65 | 65 | * @param value the value |
| 66 | 66 | */ |
| 67 | 67 | public void closeChild(String qName, String value) { |
| 68 | | if (childStack == null || childStack.isEmpty()) |
| 69 | | throw new InvalidArgumentException("Can't close child " + qName + ", no element in stack."); |
| | 68 | if (childStack == null || childStack.isEmpty()) { |
| | 69 | Logging.warn("Can't close child \"" + qName + "\", no element in stack."); |
| | 70 | return; |
| | 71 | } |
| 70 | 72 | |
| 71 | 73 | GpxExtension child = childStack.pop(); |
| 72 | | |
| 73 | 74 | String childQN = child.getQualifiedName(); |
| 74 | 75 | |
| 75 | 76 | if (!childQN.equals(qName)) |
| 76 | | throw new InvalidArgumentException("Can't close child " + qName + ", must close " + childQN + " first."); |
| | 77 | Logging.warn("Couldn't close child \"" + qName + "\", closed \"" + childQN + "\" instead."); |
| 77 | 78 | |
| 78 | 79 | child.setValue(value); |
| 79 | 80 | } |