Changeset 30726 in osm for applications


Ignore:
Timestamp:
2014-10-16T20:31:07+02:00 (10 years ago)
Author:
donvip
Message:

[josm_pbf] fix #josm10641 - NPE when saving large dataset

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pbf/src/org/openstreetmap/josm/plugins/pbf/io/PbfWriter.java

    r30664 r30726  
    350350            }
    351351
    352             public void processNodes(Collection<Node> node) {
     352            public void processNode(Node node) {
    353353                if (nodes == null) {
    354354                    writeEmptyHeaderIfNeeded();
     
    356356                    nodes = new NodeGroup();
    357357                }
    358                 for (Node n : node) {
    359                     if (n.getCoor() != null) {
    360                         nodes.add(n);
    361                         checkLimit();
    362                     }
    363                 }
    364             }
    365 
    366             public void processWays(Collection<Way> way) {
     358                if (node.getCoor() != null) {
     359                    nodes.add(node);
     360                    checkLimit();
     361                }
     362            }
     363
     364            public void processWay(Way way) {
    367365                if (ways == null) {
    368366                    writeEmptyHeaderIfNeeded();
     
    370368                    ways = new WayGroup();
    371369                }
    372                 for (Way w : way) {
    373                     ways.add(w);
    374                     checkLimit();
    375                 }
    376             }
    377 
    378             public void processRelations(Collection<Relation> relation) {
     370                ways.add(way);
     371                checkLimit();
     372            }
     373
     374            public void processRelation(Relation relation) {
    379375                if (relations == null) {
    380376                    writeEmptyHeaderIfNeeded();
     
    382378                    relations = new RelationGroup();
    383379                }
    384                 for (Relation r : relation) {
    385                     relations.add(r);
    386                     checkLimit();
    387                 }
     380                relations.add(relation);
     381                checkLimit();
    388382            }
    389383        }
     
    455449        public void process(DataSet ds) {
    456450            processor.processSources(ds.dataSources);
    457             processor.processNodes(ds.getNodes());
    458             processor.processWays(ds.getWays());
    459             processor.processRelations(ds.getRelations());
     451            for (Node n : ds.getNodes()) {
     452                processor.processNode(n);
     453            }
     454            for (Way w : ds.getWays()) {
     455                processor.processWay(w);
     456            }
     457            for (Relation r : ds.getRelations()) {
     458                processor.processRelation(r);
     459            }
    460460        }
    461461
Note: See TracChangeset for help on using the changeset viewer.