Changeset 13453 in josm for trunk/src/org/openstreetmap/josm/io
- Timestamp:
- 2018-02-24T18:58:28+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java
r13440 r13453 123 123 boolean readOnly = false; 124 124 if (ds != null) { 125 readOnly = ds.is ReadOnly();125 readOnly = ds.isLocked(); 126 126 if (readOnly) { 127 ds.un setReadOnly();127 ds.unlock(); 128 128 } 129 129 ds.beginUpdate(); … … 158 158 ds.endUpdate(); 159 159 if (readOnly) { 160 ds. setReadOnly();160 ds.lock(); 161 161 } 162 162 } -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r13434 r13453 12 12 import java.util.List; 13 13 import java.util.Objects; 14 import java.util.function.Consumer; 14 15 import java.util.regex.Matcher; 15 16 import java.util.regex.Pattern; … … 27 28 import org.openstreetmap.josm.data.osm.Changeset; 28 29 import org.openstreetmap.josm.data.osm.DataSet; 30 import org.openstreetmap.josm.data.osm.DataSet.DownloadPolicy; 29 31 import org.openstreetmap.josm.data.osm.DataSet.UploadPolicy; 30 32 import org.openstreetmap.josm.data.osm.Node; … … 139 141 } 140 142 ds.setVersion(v); 141 String upload = parser.getAttributeValue(null, "upload"); 142 if (upload != null) { 143 try { 144 ds.setUploadPolicy(UploadPolicy.of(upload)); 145 } catch (IllegalArgumentException e) { 146 throwException(MessageFormat.format("Illegal value for attribute ''upload''. Got ''{0}''.", upload), e); 147 } 148 } 149 if ("true".equalsIgnoreCase(parser.getAttributeValue(null, "read-only"))) { 150 ds.setReadOnly(); 143 parsePolicy("download", policy -> ds.setDownloadPolicy(DownloadPolicy.of(policy))); 144 parsePolicy("upload", policy -> ds.setUploadPolicy(UploadPolicy.of(policy))); 145 if ("true".equalsIgnoreCase(parser.getAttributeValue(null, "locked"))) { 146 ds.lock(); 151 147 } 152 148 String generator = parser.getAttributeValue(null, "generator"); … … 185 181 } else if (event == XMLStreamConstants.END_ELEMENT) { 186 182 return; 183 } 184 } 185 } 186 187 private void parsePolicy(String key, Consumer<String> consumer) throws XMLStreamException { 188 String policy = parser.getAttributeValue(null, key); 189 if (policy != null) { 190 try { 191 consumer.accept(policy); 192 } catch (IllegalArgumentException e) { 193 throwException(MessageFormat.format("Illegal value for attribute ''{0}''. Got ''{1}''.", key, policy), e); 187 194 } 188 195 } … … 621 628 progressMonitor.worked(1); 622 629 623 boolean readOnly = getDataSet().is ReadOnly();630 boolean readOnly = getDataSet().isLocked(); 624 631 625 632 progressMonitor.indeterminateSubTask(tr("Preparing data set...")); 626 633 if (readOnly) { 627 getDataSet().un setReadOnly();634 getDataSet().unlock(); 628 635 } 629 636 prepareDataSet(); 630 637 if (readOnly) { 631 getDataSet(). setReadOnly();638 getDataSet().lock(); 632 639 } 633 640 progressMonitor.worked(1); … … 641 648 } 642 649 // Make sure postprocessors did not change the read-only state 643 if (readOnly && !getDataSet().is ReadOnly()) {644 getDataSet(). setReadOnly();650 if (readOnly && !getDataSet().isLocked()) { 651 getDataSet().lock(); 645 652 } 646 653 return getDataSet();
Note:
See TracChangeset
for help on using the changeset viewer.