Package org.openstreetmap.osmosis.core

Examples of org.openstreetmap.osmosis.core.OsmosisRuntimeException


      insertUserStatement.setString(prmIndex++, user.getName());
     
      insertUserStatement.executeUpdate();
     
    } catch (SQLException e) {
      throw new OsmosisRuntimeException(
        "Unable to insert user " + user.getId() + ".", e);
    }
   
    actionDao.addAction(ActionDataType.USER, ChangesetAction.CREATE, user.getId());
  }
View Full Code Here


      updateUserStatement.setInt(prmIndex++, user.getId());
     
      updateUserStatement.executeUpdate();
     
    } catch (SQLException e) {
      throw new OsmosisRuntimeException(
        "Unable to update user " + user.getId() + ".", e);
    }
   
    actionDao.addAction(ActionDataType.USER, ChangesetAction.MODIFY, user.getId());
  }
View Full Code Here

 
  /**
   * {@inheritDoc}
   */
  public DataType next() {
    throw new OsmosisRuntimeException("This iterator contains no data.");
  }
View Full Code Here

  @Override
  public void initialize(Map<String, Object> metaData) {
    // Get the replication state from the upstream task.
    if (!metaData.containsKey(ReplicationState.META_DATA_KEY)) {
      throw new OsmosisRuntimeException("No replication state has been provided in metadata key "
          + ReplicationState.META_DATA_KEY + ".");
    }
    state = (ReplicationState) metaData.get(ReplicationState.META_DATA_KEY);

    // Call the downstream initialize which will among other things
View Full Code Here

        int prmIndex;
        List<WayNode> nodeReferenceList;

        // We can't write an entity with a null timestamp.
        if (way.getTimestamp() == null) {
            throw new OsmosisRuntimeException("Way " + way.getId() + " does not have a timestamp set.");
        }

        // Add or update the user in the database.
        userManager.addOrUpdateUser(way.getUser());
       
        // Create the changeset in the database.
        changesetManager.addChangesetIfRequired(way.getChangesetId(), way.getUser());

        nodeReferenceList = way.getWayNodes();

        // If this is a deletion, the entity is not visible.
        visible = !action.equals(ChangeAction.Delete);

        // Create the prepared statements for way creation if necessary.
        if (insertWayStatement == null) {
            insertWayStatement = statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_WAY));
            updateWayStatement = statementContainer.add(dbCtx.prepareStatement(UPDATE_SQL_WAY));
            selectWayCountStatement = statementContainer.add(dbCtx.prepareStatement(SELECT_SQL_WAY_COUNT));
            insertWayCurrentStatement = statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_WAY_CURRENT));
            updateWayCurrentStatement = statementContainer.add(dbCtx.prepareStatement(UPDATE_SQL_WAY_CURRENT));
            selectWayCurrentCountStatement = statementContainer.add(dbCtx
                    .prepareStatement(SELECT_SQL_WAY_CURRENT_COUNT));
            insertWayTagStatement = statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_WAY_TAG));
            deleteWayTagStatement = statementContainer.add(dbCtx.prepareStatement(DELETE_SQL_WAY_TAG));
            insertWayTagCurrentStatement = statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_WAY_TAG_CURRENT));
            deleteWayTagCurrentStatement = statementContainer.add(dbCtx.prepareStatement(DELETE_SQL_WAY_TAG_CURRENT));
            insertWayNodeStatement = statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_WAY_NODE));
            deleteWayNodeStatement = statementContainer.add(dbCtx.prepareStatement(DELETE_SQL_WAY_NODE));
            insertWayNodeCurrentStatement = statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_WAY_NODE_CURRENT));
            deleteWayNodeCurrentStatement = statementContainer.add(dbCtx.prepareStatement(DELETE_SQL_WAY_NODE_CURRENT));
        }

        // Remove the existing tags of the way history item.
        try {
            prmIndex = 1;
            deleteWayTagStatement.setLong(prmIndex++, way.getId());
            deleteWayTagStatement.setInt(prmIndex++, way.getVersion());

            deleteWayTagStatement.execute();

        } catch (SQLException e) {
            throw new OsmosisRuntimeException("Unable to delete way history tags for way with id=" + way.getId() + ".",
                    e);
        }

        // Remove the existing way nodes of the way history item.
        try {
            prmIndex = 1;
            deleteWayNodeStatement.setLong(prmIndex++, way.getId());
            deleteWayNodeStatement.setInt(prmIndex++, way.getVersion());

            deleteWayNodeStatement.execute();

        } catch (SQLException e) {
            throw new OsmosisRuntimeException(
                    "Unable to delete way history nodes for way with id=" + way.getId() + ".", e);
        }

        // Update the way if it already exists in the history table, otherwise insert it.
        try {
            exists = checkIfEntityHistoryExists(selectWayCountStatement, way.getId(), way.getVersion());

        } catch (SQLException e) {
            throw new OsmosisRuntimeException("Unable to check if current way with id=" + way.getId() + " exists.", e);
        }
        if (exists) {
            // Update the way in the history table.
            try {
                prmIndex = 1;
                updateWayStatement.setTimestamp(prmIndex++, new Timestamp(way.getTimestamp().getTime()));
                updateWayStatement.setBoolean(prmIndex++, visible);
                updateWayStatement.setLong(prmIndex++, way.getChangesetId());
                updateWayStatement.setLong(prmIndex++, way.getId());
                updateWayStatement.setInt(prmIndex++, way.getVersion());

                updateWayStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to update history way with id=" + way.getId() + ".", e);
            }
        } else {
            // Insert the new way into the history table.
            try {
                prmIndex = 1;
                insertWayStatement.setLong(prmIndex++, way.getId());
                insertWayStatement.setInt(prmIndex++, way.getVersion());
                insertWayStatement.setTimestamp(prmIndex++, new Timestamp(way.getTimestamp().getTime()));
                insertWayStatement.setBoolean(prmIndex++, visible);
                insertWayStatement.setLong(prmIndex++, way.getChangesetId());

                insertWayStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to insert history way with id=" + way.getId() + ".", e);
            }
        }

        // Insert the tags of the new way into the history table.
        for (Tag tag : way.getTags()) {
            try {
                prmIndex = 1;
                insertWayTagStatement.setLong(prmIndex++, way.getId());
                insertWayTagStatement.setInt(prmIndex++, way.getVersion());
                insertWayTagStatement.setString(prmIndex++, tag.getKey());
                insertWayTagStatement.setString(prmIndex++, tag.getValue());

                insertWayTagStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to insert history way tag with id=" + way.getId()
                        + " and key=(" + tag.getKey() + ").", e);
            }
        }

        // Insert the nodes of the new way into the history table.
        for (int i = 0; i < nodeReferenceList.size(); i++) {
            WayNode nodeReference;

            nodeReference = nodeReferenceList.get(i);

            try {
                prmIndex = 1;
                insertWayNodeStatement.setLong(prmIndex++, way.getId());
                insertWayNodeStatement.setInt(prmIndex++, way.getVersion());
                insertWayNodeStatement.setLong(prmIndex++, nodeReference.getNodeId());
                insertWayNodeStatement.setLong(prmIndex++, i + 1);

                insertWayNodeStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to insert history way node with way id=" + way.getId()
                        + " and node id=" + nodeReference.getNodeId() + ".", e);
            }
        }

        if (populateCurrentTables) {
            // Delete the existing way tags from the current table.
            try {
                deleteWayTagCurrentStatement.setLong(1, way.getId());

                deleteWayTagCurrentStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to delete current way tags with id=" + way.getId() + ".", e);
            }
            // Delete the existing way nodes from the current table.
            try {
                deleteWayNodeCurrentStatement.setLong(1, way.getId());

                deleteWayNodeCurrentStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to delete current way nodes with id=" + way.getId() + ".", e);
            }

            // Update the node if it already exists in the current table, otherwise insert it.
            try {
                exists = checkIfEntityExists(selectWayCurrentCountStatement, way.getId());

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to check if current way with id=" + way.getId() + " exists.",
                        e);
            }
            if (exists) {
                // Update the way in the current table.
                try {
                    prmIndex = 1;
                    updateWayCurrentStatement.setInt(prmIndex++, way.getVersion());
                    updateWayCurrentStatement.setTimestamp(prmIndex++, new Timestamp(way.getTimestamp().getTime()));
                    updateWayCurrentStatement.setBoolean(prmIndex++, visible);
                    updateWayCurrentStatement.setLong(prmIndex++, way.getChangesetId());
                    updateWayCurrentStatement.setLong(prmIndex++, way.getId());

                    updateWayCurrentStatement.execute();

                } catch (SQLException e) {
                    throw new OsmosisRuntimeException("Unable to update current way with id=" + way.getId() + ".", e);
                }
            } else {
                // Insert the new way into the current table.
                try {
                    prmIndex = 1;
                    insertWayCurrentStatement.setLong(prmIndex++, way.getId());
                    insertWayCurrentStatement.setInt(prmIndex++, way.getVersion());
                    insertWayCurrentStatement.setTimestamp(prmIndex++, new Timestamp(way.getTimestamp().getTime()));
                    insertWayCurrentStatement.setBoolean(prmIndex++, visible);
                    insertWayCurrentStatement.setLong(prmIndex++, way.getChangesetId());

                    insertWayCurrentStatement.execute();

                } catch (SQLException e) {
                    throw new OsmosisRuntimeException("Unable to insert current way with id=" + way.getId() + ".", e);
                }
            }

            // Insert the tags of the new way into the current table.
            for (Tag tag : way.getTags()) {
                try {
                    prmIndex = 1;
                    insertWayTagCurrentStatement.setLong(prmIndex++, way.getId());
                    insertWayTagCurrentStatement.setString(prmIndex++, tag.getKey());
                    insertWayTagCurrentStatement.setString(prmIndex++, tag.getValue());

                    insertWayTagCurrentStatement.execute();

                } catch (SQLException e) {
                    throw new OsmosisRuntimeException("Unable to insert current way tag with id=" + way.getId()
                            + " and key=(" + tag.getKey() + ").", e);
                }
            }

            // Insert the nodes of the new way into the current table.
            for (int i = 0; i < nodeReferenceList.size(); i++) {
                WayNode nodeReference;

                nodeReference = nodeReferenceList.get(i);

                try {
                    prmIndex = 1;
                    insertWayNodeCurrentStatement.setLong(prmIndex++, way.getId());
                    insertWayNodeCurrentStatement.setLong(prmIndex++, nodeReference.getNodeId());
                    insertWayNodeCurrentStatement.setLong(prmIndex++, i);

                    insertWayNodeCurrentStatement.execute();

                } catch (SQLException e) {
                    throw new OsmosisRuntimeException("Unable to insert current way node with way id=" + way.getId()
                            + " and node id=" + nodeReference.getNodeId() + ".", e);
                }
            }
        }
    }
View Full Code Here

        int prmIndex;
        List<RelationMember> relationMemberList;

        // We can't write an entity with a null timestamp.
        if (relation.getTimestamp() == null) {
            throw new OsmosisRuntimeException("Relation " + relation.getId() + " does not have a timestamp set.");
        }

        // Add or update the user in the database.
        userManager.addOrUpdateUser(relation.getUser());
       
        // Create the changeset in the database.
        changesetManager.addChangesetIfRequired(relation.getChangesetId(), relation.getUser());

        relationMemberList = relation.getMembers();

        // If this is a deletion, the entity is not visible.
        visible = !action.equals(ChangeAction.Delete);

        // Create the prepared statements for relation creation if necessary.
        if (insertRelationStatement == null) {
            insertRelationStatement = statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_RELATION));
            updateRelationStatement = statementContainer.add(dbCtx.prepareStatement(UPDATE_SQL_RELATION));
            selectRelationCountStatement = statementContainer.add(dbCtx.prepareStatement(SELECT_SQL_RELATION_COUNT));
            insertRelationCurrentStatement = statementContainer
                    .add(dbCtx.prepareStatement(INSERT_SQL_RELATION_CURRENT));
            updateRelationCurrentStatement = statementContainer
                    .add(dbCtx.prepareStatement(UPDATE_SQL_RELATION_CURRENT));
            selectRelationCurrentCountStatement = statementContainer.add(dbCtx
                    .prepareStatement(SELECT_SQL_RELATION_CURRENT_COUNT));
            insertRelationTagStatement = statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_RELATION_TAG));
            deleteRelationTagStatement = statementContainer.add(dbCtx.prepareStatement(DELETE_SQL_RELATION_TAG));
            insertRelationTagCurrentStatement = statementContainer.add(dbCtx
                    .prepareStatement(INSERT_SQL_RELATION_TAG_CURRENT));
            deleteRelationTagCurrentStatement = statementContainer.add(dbCtx
                    .prepareStatement(DELETE_SQL_RELATION_TAG_CURRENT));
            switch (dbCtx.getDatabaseType()) {
            case POSTGRESQL:
              insertRelationMemberStatement =
                statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_RELATION_MEMBER_PGSQL));
                break;
            case MYSQL:
              insertRelationMemberStatement =
                statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_RELATION_MEMBER_MYSQL));
                break;
            default:
                throw new OsmosisRuntimeException("Unknown database type " + dbCtx.getDatabaseType() + ".");
            }
            deleteRelationMemberStatement = statementContainer.add(dbCtx.prepareStatement(DELETE_SQL_RELATION_MEMBER));
            switch (dbCtx.getDatabaseType()) {
            case POSTGRESQL:
              insertRelationMemberCurrentStatement =
                statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_RELATION_MEMBER_CURRENT_PGSQL));
                break;
            case MYSQL:
              insertRelationMemberCurrentStatement =
                statementContainer.add(dbCtx.prepareStatement(INSERT_SQL_RELATION_MEMBER_CURRENT_MYSQL));
                break;
            default:
                throw new OsmosisRuntimeException("Unknown database type " + dbCtx.getDatabaseType() + ".");
            }
            deleteRelationMemberCurrentStatement = statementContainer.add(dbCtx
                    .prepareStatement(DELETE_SQL_RELATION_MEMBER_CURRENT));
        }

        // Remove the existing tags of the relation history item.
        try {
            prmIndex = 1;
            deleteRelationTagStatement.setLong(prmIndex++, relation.getId());
            deleteRelationTagStatement.setInt(prmIndex++, relation.getVersion());

            deleteRelationTagStatement.execute();

        } catch (SQLException e) {
            throw new OsmosisRuntimeException("Unable to delete relation history tags for relation with id="
                    + relation.getId() + ".", e);
        }

        // Remove the existing relation members of the relation history item.
        try {
            prmIndex = 1;
            deleteRelationMemberStatement.setLong(prmIndex++, relation.getId());
            deleteRelationMemberStatement.setInt(prmIndex++, relation.getVersion());

            deleteRelationMemberStatement.execute();

        } catch (SQLException e) {
            throw new OsmosisRuntimeException("Unable to delete relation history members for relation with id="
                    + relation.getId() + ".", e);
        }

        // Update the relation if it already exists in the history table, otherwise insert it.
        try {
            exists = checkIfEntityHistoryExists(selectRelationCountStatement, relation.getId(), relation.getVersion());

        } catch (SQLException e) {
            throw new OsmosisRuntimeException("Unable to check if current relation with id=" + relation.getId()
                    + " exists.", e);
        }
        if (exists) {
            // Update the relation in the history table.
            try {
                prmIndex = 1;
                updateRelationStatement.setTimestamp(prmIndex++, new Timestamp(relation.getTimestamp().getTime()));
                updateRelationStatement.setBoolean(prmIndex++, visible);
                updateRelationStatement.setLong(prmIndex++, relation.getChangesetId());
                updateRelationStatement.setLong(prmIndex++, relation.getId());
                updateRelationStatement.setInt(prmIndex++, relation.getVersion());

                updateRelationStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException(
                        "Unable to update history relation with id=" + relation.getId() + ".", e);
            }
        } else {
            // Insert the new relation into the history table.
            try {
                prmIndex = 1;
                insertRelationStatement.setLong(prmIndex++, relation.getId());
                insertRelationStatement.setInt(prmIndex++, relation.getVersion());
                insertRelationStatement.setTimestamp(prmIndex++, new Timestamp(relation.getTimestamp().getTime()));
                insertRelationStatement.setBoolean(prmIndex++, visible);
                insertRelationStatement.setLong(prmIndex++, relation.getChangesetId());

                insertRelationStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException(
                        "Unable to insert history relation with id=" + relation.getId() + ".", e);
            }
        }

        // Insert the tags of the new relation into the history table.
        for (Tag tag : relation.getTags()) {
            try {
                prmIndex = 1;
                insertRelationTagStatement.setLong(prmIndex++, relation.getId());
                insertRelationTagStatement.setInt(prmIndex++, relation.getVersion());
                insertRelationTagStatement.setString(prmIndex++, tag.getKey());
                insertRelationTagStatement.setString(prmIndex++, tag.getValue());

                insertRelationTagStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to insert history relation tag with id=" + relation.getId()
                        + " and key=(" + tag.getKey() + ").", e);
            }
        }

        // Insert the members of the new relation into the history table.
        for (int i = 0; i < relationMemberList.size(); i++) {
            RelationMember relationMember;

            relationMember = relationMemberList.get(i);

            try {
                prmIndex = 1;
                insertRelationMemberStatement.setLong(prmIndex++, relation.getId());
                insertRelationMemberStatement.setInt(prmIndex++, relation.getVersion());
                insertRelationMemberStatement.setString(prmIndex++, memberTypeRenderer.render(relationMember
                        .getMemberType()));
                insertRelationMemberStatement.setLong(prmIndex++, relationMember.getMemberId());
                insertRelationMemberStatement.setString(prmIndex++, relationMember.getMemberRole());
                insertRelationMemberStatement.setInt(prmIndex++, i + 1);

                insertRelationMemberStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to insert history relation member with relation id="
                        + relation.getId() + ", member type=" + relationMember.getMemberId() + " and member id="
                        + relationMember.getMemberId() + ".", e);
            }
        }

        if (populateCurrentTables) {
            // Delete the existing relation tags from the current table.
            try {
                deleteRelationTagCurrentStatement.setLong(1, relation.getId());

                deleteRelationTagCurrentStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to delete current relation tags with id=" + relation.getId()
                        + ".", e);
            }
            // Delete the existing relation members from the current table.
            try {
                deleteRelationMemberCurrentStatement.setLong(1, relation.getId());

                deleteRelationMemberCurrentStatement.execute();

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to delete current relation members with id="
                        + relation.getId() + ".", e);
            }

            // Update the relation if it already exists in the current table, otherwise insert it.
            try {
                exists = checkIfEntityExists(selectRelationCurrentCountStatement, relation.getId());

            } catch (SQLException e) {
                throw new OsmosisRuntimeException("Unable to check if current relation with id=" + relation.getId()
                        + " exists.", e);
            }
            if (exists) {
                // Update the relation in the current table.
                try {
                    prmIndex = 1;
                    updateRelationCurrentStatement.setInt(prmIndex++, relation.getVersion());
                    updateRelationCurrentStatement.setTimestamp(prmIndex++, new Timestamp(relation.getTimestamp()
                            .getTime()));
                    updateRelationCurrentStatement.setBoolean(prmIndex++, visible);
                    updateRelationCurrentStatement.setLong(prmIndex++, relation.getChangesetId());
                    updateRelationCurrentStatement.setLong(prmIndex++, relation.getId());

                    updateRelationCurrentStatement.execute();

                } catch (SQLException e) {
                    throw new OsmosisRuntimeException("Unable to update current relation with id=" + relation.getId()
                            + ".", e);
                }
            } else {
                // Insert the new node into the current table.
                try {
                    prmIndex = 1;
                    insertRelationCurrentStatement.setLong(prmIndex++, relation.getId());
                    insertRelationCurrentStatement.setInt(prmIndex++, relation.getVersion());
                    insertRelationCurrentStatement.setTimestamp(prmIndex++, new Timestamp(relation.getTimestamp()
                            .getTime()));
                    insertRelationCurrentStatement.setBoolean(prmIndex++, visible);
                    insertRelationCurrentStatement.setLong(prmIndex++, relation.getChangesetId());

                    insertRelationCurrentStatement.execute();

                } catch (SQLException e) {
                    throw new OsmosisRuntimeException("Unable to insert current relation with id=" + relation.getId()
                            + ".", e);
                }
            }

            // Insert the tags of the new relation into the current table.
            for (Tag tag : relation.getTags()) {
                try {
                    prmIndex = 1;
                    insertRelationTagCurrentStatement.setLong(prmIndex++, relation.getId());
                    insertRelationTagCurrentStatement.setString(prmIndex++, tag.getKey());
                    insertRelationTagCurrentStatement.setString(prmIndex++, tag.getValue());

                    insertRelationTagCurrentStatement.execute();

                } catch (SQLException e) {
                    throw new OsmosisRuntimeException("Unable to insert current relation tag with id="
                            + relation.getId() + " and key=(" + tag.getKey() + ").", e);
                }
            }

            // Insert the members of the new relation into the current table.
            for (int i = 0; i < relationMemberList.size(); i++) {
                RelationMember relationMember;

                relationMember = relationMemberList.get(i);

                try {
                    prmIndex = 1;
                    insertRelationMemberCurrentStatement.setLong(prmIndex++, relation.getId());
                    insertRelationMemberCurrentStatement.setString(prmIndex++, memberTypeRenderer.render(relationMember
                            .getMemberType()));
                    insertRelationMemberCurrentStatement.setLong(prmIndex++, relationMember.getMemberId());
                    insertRelationMemberCurrentStatement.setString(prmIndex++, relationMember.getMemberRole());
                    insertRelationMemberCurrentStatement.setInt(prmIndex++, i + 1);

                    insertRelationMemberCurrentStatement.execute();

                } catch (SQLException e) {
                    throw new OsmosisRuntimeException("Unable to insert current relation member with relation id="
                            + relation.getId() + ", member type=" + relationMember.getMemberId() + " and member id="
                            + relationMember.getMemberId() + ".", e);
                }
            }
        }
View Full Code Here

  private static Map<String, EntityType> memberToEntityMap;
 
 
  private static void addEntityTypeMapping(EntityType entityType, String memberType) {
    if (entityToMemberMap.containsKey(entityType)) {
      throw new OsmosisRuntimeException("Entity type (" + entityType + ") already has a mapping.");
    }
   
    entityToMemberMap.put(entityType, memberType);
    memberToEntityMap.put(memberType, entityType);
  }
View Full Code Here

   */
  public String getMemberType(EntityType entityType) {
    if (entityToMemberMap.containsKey(entityType)) {
      return entityToMemberMap.get(entityType);
    } else {
      throw new OsmosisRuntimeException("The entity type " + entityType + " is not recognised.");
    }
  }
View Full Code Here

   */
  public EntityType getEntityType(String memberType) {
    if (memberToEntityMap.containsKey(memberType)) {
      return memberToEntityMap.get(memberType);
    } else {
      throw new OsmosisRuntimeException("The member type " + memberType + " is not recognised.");
    }
  }
View Full Code Here

    Double bottom;
   
    boxString = reader.getAttributeValue(null, ATTRIBUTE_NAME_BOX);
   
    if (boxString == null) {
      throw new OsmosisRuntimeException("Missing required box attribute of bound element");
    }
    boundStrings = boxString.split(",");
    if (boundStrings.length != 4) {
      throw new OsmosisRuntimeException("Badly formed box attribute of bound element");
    }
    try {
      bottom = Double.parseDouble(boundStrings[0]);
      left = Double.parseDouble(boundStrings[1]);
      top = Double.parseDouble(boundStrings[2]);
      right = Double.parseDouble(boundStrings[3]);
    } catch (NumberFormatException e) {
      throw new OsmosisRuntimeException("Can't parse box attribute of bound element", e);
    }
    origin = reader.getAttributeValue(null, ATTRIBUTE_NAME_ORIGIN);
    if (origin == null || origin.equals("")) {
      throw new OsmosisRuntimeException("Origin attribute of bound element is empty or missing.");
    }
    Bound bound = new Bound(right, left, top, bottom, origin);
   
    reader.nextTag();
    reader.nextTag();
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.core.OsmosisRuntimeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.