You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/05/15 21:42:43 UTC
svn commit: r1679636 [5/5] - in /sis/trunk: ./
application/sis-console/src/main/java/org/apache/sis/console/
application/sis-console/src/test/java/org/apache/sis/console/
core/sis-feature/src/main/java/org/apache/sis/feature/
core/sis-metadata/src/main...
Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java [UTF-8] Fri May 15 19:42:41 2015
@@ -25,6 +25,7 @@ import java.util.*;
import org.apache.sis.feature.DefaultAttributeType;
import org.apache.sis.feature.DefaultFeatureType;
import org.apache.sis.internal.shapefile.jdbc.*;
+import org.apache.sis.storage.shapefile.InvalidShapefileFormatException;
import org.apache.sis.storage.shapefile.ShapeTypeEnum;
import org.apache.sis.feature.AbstractFeature;
@@ -42,7 +43,7 @@ import org.apache.sis.internal.jdk7.Obje
* @since 0.5
* @module
*/
-public class ShapefileByteReader extends CommonByteReader<InvalidShapefileFormatException, ShapefileNotFoundException> {
+public class ShapefileByteReader extends CommonByteReader<InvalidShapefileFormatException, SQLShapefileNotFoundException> {
/** Name of the Geometry field. */
private static final String GEOMETRY_NAME = "geometry";
@@ -60,12 +61,12 @@ public class ShapefileByteReader extends
* @param shapefile Shapefile.
* @param dbaseFile underlying database file name.
* @throws InvalidShapefileFormatException if the shapefile format is invalid.
- * @throws InvalidDbaseFileFormatException if the database file format is invalid.
- * @throws ShapefileNotFoundException if the shapefile has not been found.
- * @throws DbaseFileNotFoundException if the database file has not been found.
+ * @throws SQLInvalidDbaseFileFormatException if the database file format is invalid.
+ * @throws SQLShapefileNotFoundException if the shapefile has not been found.
+ * @throws SQLDbaseFileNotFoundException if the database file has not been found.
*/
- public ShapefileByteReader(File shapefile, File dbaseFile) throws InvalidShapefileFormatException, InvalidDbaseFileFormatException, ShapefileNotFoundException, DbaseFileNotFoundException {
- super(shapefile, InvalidShapefileFormatException.class, ShapefileNotFoundException.class);
+ public ShapefileByteReader(File shapefile, File dbaseFile) throws InvalidShapefileFormatException, SQLInvalidDbaseFileFormatException, SQLShapefileNotFoundException, SQLDbaseFileNotFoundException {
+ super(shapefile, InvalidShapefileFormatException.class, SQLShapefileNotFoundException.class);
loadDatabaseFieldDescriptors(dbaseFile);
loadDescriptor();
@@ -133,10 +134,10 @@ public class ShapefileByteReader extends
/**
* Load database field descriptors.
* @param dbaseFile Database file.
- * @throws InvalidDbaseFileFormatException if the database format is incorrect.
- * @throws DbaseFileNotFoundException if the database file cannot be found.
+ * @throws SQLInvalidDbaseFileFormatException if the database format is incorrect.
+ * @throws SQLDbaseFileNotFoundException if the database file cannot be found.
*/
- private void loadDatabaseFieldDescriptors(File dbaseFile) throws InvalidDbaseFileFormatException, DbaseFileNotFoundException {
+ private void loadDatabaseFieldDescriptors(File dbaseFile) throws SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException {
MappedByteReader databaseReader = null;
try {
Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java [UTF-8] Fri May 15 19:42:41 2015
@@ -35,7 +35,7 @@ import org.apache.sis.internal.jdk7.Obje
* @since 0.5
* @module
*/
-abstract class AbstractDbase3ByteReader extends CommonByteReader<InvalidDbaseFileFormatException, DbaseFileNotFoundException> implements Dbase3ByteReader {
+abstract class AbstractDbase3ByteReader extends CommonByteReader<SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException> implements Dbase3ByteReader {
/** Number of bytes in the header. */
protected short dbaseHeaderBytes;
@@ -95,11 +95,11 @@ abstract class AbstractDbase3ByteReader
/**
* Map a dbf file.
* @param file Database file.
- * @throws DbaseFileNotFoundException if the DBF file has not been found.
- * @throws InvalidDbaseFileFormatException if the database has an invalid format.
+ * @throws SQLDbaseFileNotFoundException if the DBF file has not been found.
+ * @throws SQLInvalidDbaseFileFormatException if the database has an invalid format.
*/
- public AbstractDbase3ByteReader(File file) throws DbaseFileNotFoundException, InvalidDbaseFileFormatException {
- super(file, InvalidDbaseFileFormatException.class, DbaseFileNotFoundException.class);
+ public AbstractDbase3ByteReader(File file) throws SQLDbaseFileNotFoundException, SQLInvalidDbaseFileFormatException {
+ super(file, SQLInvalidDbaseFileFormatException.class, SQLDbaseFileNotFoundException.class);
}
/**
@@ -138,11 +138,11 @@ abstract class AbstractDbase3ByteReader
* Convert the binary code page value of the Dbase 3 file to a recent Charset.
* @param codePageBinaryValue page code binary value.
* @return Charset.
- * @throws InvalidDbaseFileFormatException if the binary value is not one of the standard values that the DBF file should carry : the Dbase 3
+ * @throws SQLInvalidDbaseFileFormatException if the binary value is not one of the standard values that the DBF file should carry : the Dbase 3
* file might be corrupted.
* @throws UnsupportedCharsetException if the code page as no representation in recents Charset (legacy DOS or macintosh charsets).
*/
- protected Charset toCharset(byte codePageBinaryValue) throws InvalidDbaseFileFormatException, UnsupportedCharsetException {
+ protected Charset toCharset(byte codePageBinaryValue) throws SQLInvalidDbaseFileFormatException, UnsupportedCharsetException {
// Attempt to find a known conversion.
String dbfCodePage = toCodePage(codePageBinaryValue);
@@ -165,7 +165,7 @@ abstract class AbstractDbase3ByteReader
// If the code page is invalid, the database itself has chances to be invalid too.
if (dbfCodePage.equals("invalid")) {
String message = format(Level.WARNING, "excp.illegal_codepage", codePageBinaryValue, getFile().getAbsolutePath());
- throw new InvalidDbaseFileFormatException(message);
+ throw new SQLInvalidDbaseFileFormatException(message);
}
// If the code page cannot find a match for a more recent Charset, we wont be able to handle this DBF.
Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java [UTF-8] Fri May 15 19:42:41 2015
@@ -66,13 +66,13 @@ public class DBFDriver extends AbstractJ
* @param url The path to a {@code .dbf} file.
* @param info Ignored in current implementation.
* @return A connection to the given DBF file.
- * @throws InvalidDbaseFileFormatException if the database file format is invalid.
- * @throws DbaseFileNotFoundException if the database file doesn't exist.
- * @throws InvalidDbaseFileFormatException if the database file has a wrong format.
+ * @throws SQLInvalidDbaseFileFormatException if the database file format is invalid.
+ * @throws SQLDbaseFileNotFoundException if the database file doesn't exist.
+ * @throws SQLInvalidDbaseFileFormatException if the database file has a wrong format.
*/
@Override
@SuppressWarnings("resource") // the function opens a connection.
- public Connection connect(final String url, @SuppressWarnings("unused") Properties info) throws InvalidDbaseFileFormatException, DbaseFileNotFoundException {
+ public Connection connect(final String url, @SuppressWarnings("unused") Properties info) throws SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException {
Objects.requireNonNull(url, "the DBase3 url cannot be null");
File file = new File(url);
Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java [UTF-8] Fri May 15 19:42:41 2015
@@ -42,10 +42,10 @@ public class MappedByteReader extends Ab
/**
* Construct a mapped byte reader on a file.
* @param dbase3File File.
- * @throws InvalidDbaseFileFormatException if the database seems to be invalid.
- * @throws DbaseFileNotFoundException if the Dbase file has not been found.
+ * @throws SQLInvalidDbaseFileFormatException if the database seems to be invalid.
+ * @throws SQLDbaseFileNotFoundException if the Dbase file has not been found.
*/
- public MappedByteReader(File dbase3File) throws InvalidDbaseFileFormatException, DbaseFileNotFoundException {
+ public MappedByteReader(File dbase3File) throws SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException {
super(dbase3File);
loadDescriptor();
}
@@ -115,9 +115,9 @@ public class MappedByteReader extends Ab
/**
* Loading the database file content from binary .dbf file.
- * @throws InvalidDbaseFileFormatException if descriptor is not readable.
+ * @throws SQLInvalidDbaseFileFormatException if descriptor is not readable.
*/
- private void loadDescriptor() throws InvalidDbaseFileFormatException {
+ private void loadDescriptor() throws SQLInvalidDbaseFileFormatException {
try {
this.dbaseVersion = getByteBuffer().get();
getByteBuffer().get(this.dbaseLastUpdate);
@@ -152,7 +152,7 @@ public class MappedByteReader extends Ab
// If the last character read after the field descriptor isn't 0x0D, the expected mark has not been found and the DBF is corrupted.
if (descriptorTerminator != 0x0D) {
String message = format(Level.WARNING, "excp.filedescriptor_problem", getFile().getAbsolutePath(), "Character marking the end of the fields descriptors (0x0D) has not been found.");
- throw new InvalidDbaseFileFormatException(message);
+ throw new SQLInvalidDbaseFileFormatException(message);
}
}
catch(BufferUnderflowException e) {
@@ -161,7 +161,7 @@ public class MappedByteReader extends Ab
// Therefore, an internal structure problem cause maybe a premature End of file or anything else, but the only thing
// we can conclude is : we are not before a device trouble, but a file format trouble.
String message = format(Level.WARNING, "excp.filedescriptor_problem", getFile().getAbsolutePath(), e.getMessage());
- throw new InvalidDbaseFileFormatException(message);
+ throw new SQLInvalidDbaseFileFormatException(message);
}
}
Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java [UTF-8] Fri May 15 19:42:41 2015
@@ -53,17 +53,17 @@ public class DBFConnection extends Abstr
* Constructs a connection to the given database.
* @param datafile Data file ({@code .dbf} extension).
* @param br Byte reader to use for reading binary content.
- * @throws DbaseFileNotFoundException if the Database file cannot be found or is not a file.
+ * @throws SQLDbaseFileNotFoundException if the Database file cannot be found or is not a file.
*/
- public DBFConnection(final File datafile, Dbase3ByteReader br) throws DbaseFileNotFoundException {
+ public DBFConnection(final File datafile, Dbase3ByteReader br) throws SQLDbaseFileNotFoundException {
// Check that file exists.
if (!datafile.exists()) {
- throw new DbaseFileNotFoundException(format(Level.WARNING, "excp.file_not_found", datafile.getAbsolutePath()));
+ throw new SQLDbaseFileNotFoundException(format(Level.WARNING, "excp.file_not_found", datafile.getAbsolutePath()));
}
// Check that its not a directory.
if (datafile.isDirectory()) {
- throw new DbaseFileNotFoundException(format(Level.WARNING, "excp.directory_not_expected", datafile.getAbsolutePath()));
+ throw new SQLDbaseFileNotFoundException(format(Level.WARNING, "excp.directory_not_expected", datafile.getAbsolutePath()));
}
databaseFile = datafile;
Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java [UTF-8] Fri May 15 19:42:41 2015
@@ -413,8 +413,17 @@ public class DBFRecordBasedResultSet ext
* @see org.apache.sis.internal.shapefile.jdbc.resultset.DBFResultSet#getObject(java.lang.String)
*/
@Override
- public Object getObject(String columnLabel) throws SQLConnectionClosedException, SQLIllegalColumnIndexException, SQLFeatureNotSupportedException, SQLNoSuchFieldException, SQLNotNumericException, SQLNotDateException {
- return getObject(findColumn(columnLabel));
+ public Object getObject(String columnLabel) throws SQLConnectionClosedException, SQLFeatureNotSupportedException, SQLNoSuchFieldException, SQLNotNumericException, SQLNotDateException {
+ int index = -1;
+
+ try {
+ index = findColumn(columnLabel);
+ return getObject(index);
+ }
+ catch(SQLIllegalColumnIndexException e) {
+ String message = format(Level.SEVERE, "assert.wrong_index_for_column_name", index, columnLabel);
+ throw new RuntimeException(message, e);
+ }
}
/**
Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java [UTF-8] Fri May 15 19:42:41 2015
@@ -19,12 +19,12 @@ package org.apache.sis.storage.shapefile
import java.io.File;
import java.io.InputStream;
import java.sql.SQLFeatureNotSupportedException;
-import java.text.*;
+import java.text.DecimalFormat;
+import java.text.MessageFormat;
import org.apache.sis.feature.DefaultFeatureType;
-import org.apache.sis.internal.shapefile.InvalidShapefileFormatException;
+import org.apache.sis.internal.shapefile.SQLShapefileNotFoundException;
import org.apache.sis.internal.shapefile.ShapefileByteReader;
-import org.apache.sis.internal.shapefile.ShapefileNotFoundException;
import org.apache.sis.internal.shapefile.jdbc.*;
import org.apache.sis.internal.shapefile.jdbc.connection.DBFConnection;
import org.apache.sis.internal.shapefile.jdbc.metadata.DBFDatabaseMetaData;
@@ -33,6 +33,7 @@ import org.apache.sis.internal.shapefile
import org.apache.sis.internal.shapefile.jdbc.sql.SQLInvalidStatementException;
import org.apache.sis.internal.shapefile.jdbc.sql.SQLUnsupportedParsingFeatureException;
import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
+import org.apache.sis.storage.DataStoreClosedException;
import org.apache.sis.feature.AbstractFeature;
/**
@@ -75,27 +76,44 @@ public class InputFeatureStream extends
* Create an input stream of features over a connection.
* @param shpfile Shapefile.
* @param dbaseFile Database file.
- * @throws SQLInvalidStatementException if the given SQL Statement is invalid.
* @throws InvalidShapefileFormatException if the shapefile format is invalid.
* @throws InvalidDbaseFileFormatException if the Dbase file format is invalid.
* @throws ShapefileNotFoundException if the shapefile has not been found.
* @throws DbaseFileNotFoundException if the database file has not been found.
*/
- public InputFeatureStream(File shpfile, File dbaseFile) throws SQLInvalidStatementException, InvalidDbaseFileFormatException, InvalidShapefileFormatException, ShapefileNotFoundException, DbaseFileNotFoundException {
- connection = (DBFConnection)new DBFDriver().connect(dbaseFile.getAbsolutePath(), null);
- sql = MessageFormat.format("SELECT * FROM {0}", dbaseFile.getName());
- shapefile = shpfile;
- databaseFile = dbaseFile;
-
- shapefileReader = new ShapefileByteReader(shapefile, databaseFile);
- featuresType = shapefileReader.getFeaturesType();
-
+ public InputFeatureStream(File shpfile, File dbaseFile) throws InvalidDbaseFileFormatException, InvalidShapefileFormatException, ShapefileNotFoundException, DbaseFileNotFoundException {
try {
- executeQuery();
+ connection = (DBFConnection)new DBFDriver().connect(dbaseFile.getAbsolutePath(), null);
+ sql = MessageFormat.format("SELECT * FROM {0}", dbaseFile.getName());
+ shapefile = shpfile;
+ databaseFile = dbaseFile;
+
+ shapefileReader = new ShapefileByteReader(shapefile, databaseFile);
+ featuresType = shapefileReader.getFeaturesType();
+
+ try {
+ executeQuery();
+ }
+ catch(SQLConnectionClosedException e) {
+ // This would be an internal trouble because in this function (at least) it should be open.
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ catch(SQLInvalidStatementException e) {
+ // This would be an internal trouble because if any SQL statement is executed for the dbase file initialization, it should has a correct syntax or grammar.
+ throw new RuntimeException(e.getMessage(), e);
+ }
}
- catch(SQLConnectionClosedException e) {
- // This would be an internal trouble because in this function (at least) it should be open.
- throw new RuntimeException(e.getMessage(), e);
+ catch(SQLInvalidDbaseFileFormatException ex) {
+ // Promote this exception to an DataStoreException compatible exception.
+ throw new InvalidDbaseFileFormatException(ex.getMessage(), ex);
+ }
+ catch(SQLDbaseFileNotFoundException ex) {
+ // Promote this exception to an DataStoreException compatible exception.
+ throw new DbaseFileNotFoundException(ex.getMessage(), ex);
+ }
+ catch(SQLShapefileNotFoundException ex) {
+ // Promote this exception to an DataStoreException compatible exception.
+ throw new ShapefileNotFoundException(ex.getMessage(), ex);
}
}
@@ -126,7 +144,33 @@ public class InputFeatureStream extends
}
/**
- * Read next feature responding to the SQL request.
+ * Read next feature responding to the SQL query.
+ * @return Feature, null if no more feature is available.
+ * @throws DataStoreClosedException if the current connection used to query the shapefile has been closed.
+ * @throws DataStoreQueryException if the statement used to query the shapefile content is incorrect.
+ * @throws DataStoreQueryResultException if the shapefile results cause a trouble (wrong format, for example).
+ * @throws InvalidShapefileFormatException if the shapefile structure shows a problem.
+ */
+ public AbstractFeature readFeature() throws DataStoreClosedException, DataStoreQueryException, DataStoreQueryResultException, InvalidShapefileFormatException {
+ try {
+ return internalReadFeature();
+ }
+ catch(SQLConnectionClosedException e) {
+ throw new DataStoreClosedException(e.getMessage(), e);
+ }
+ catch(SQLNotNumericException e) {
+ throw new DataStoreQueryResultException(e.getMessage(), e);
+ }
+ catch(SQLNotDateException e) {
+ throw new DataStoreQueryResultException(e.getMessage(), e);
+ }
+ catch(java.sql.SQLException e) {
+ throw new DataStoreQueryException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Read next feature responding to the SQL query.
* @return Feature, null if no more feature is available.
* @throws SQLNotNumericException if a field expected numeric isn't.
* @throws SQLNotDateException if a field expected of date kind, isn't.
@@ -135,11 +179,10 @@ public class InputFeatureStream extends
* @throws SQLInvalidStatementException if the SQL statement is invalid.
* @throws SQLConnectionClosedException if the connection is closed.
* @throws SQLUnsupportedParsingFeatureException if a SQL ability is not currently available through this driver.
- * @throws SQLIllegalColumnIndexException if a column index is illegal.
* @throws SQLFeatureNotSupportedException if a SQL ability is not currently available through this driver.
* @throws InvalidShapefileFormatException if the shapefile format is invalid.
*/
- public AbstractFeature readFeature() throws SQLConnectionClosedException, SQLInvalidStatementException, SQLIllegalParameterException, SQLNoSuchFieldException, SQLUnsupportedParsingFeatureException, SQLNotNumericException, SQLNotDateException, SQLFeatureNotSupportedException, SQLIllegalColumnIndexException, InvalidShapefileFormatException {
+ private AbstractFeature internalReadFeature() throws SQLConnectionClosedException, SQLInvalidStatementException, SQLIllegalParameterException, SQLNoSuchFieldException, SQLUnsupportedParsingFeatureException, SQLNotNumericException, SQLNotDateException, SQLFeatureNotSupportedException, InvalidShapefileFormatException {
try {
if (endOfFile) {
return null;
Modified: sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.java [UTF-8] Fri May 15 19:42:41 2015
@@ -18,12 +18,6 @@ package org.apache.sis.storage.shapefile
import java.io.File;
-import org.apache.sis.internal.shapefile.InvalidShapefileFormatException;
-import org.apache.sis.internal.shapefile.ShapefileNotFoundException;
-import org.apache.sis.internal.shapefile.jdbc.DbaseFileNotFoundException;
-import org.apache.sis.internal.shapefile.jdbc.InvalidDbaseFileFormatException;
-import org.apache.sis.internal.shapefile.jdbc.sql.SQLInvalidStatementException;
-
// Branch-dependent imports
import org.apache.sis.internal.jdk7.Objects;
@@ -64,13 +58,12 @@ public class ShapeFile {
/**
* Find features corresponding to an SQL request SELECT * FROM database.
* @return Features
- * @throws SQLInvalidStatementException if the SQL statement is invalid.
* @throws DbaseFileNotFoundException if the database file has not been found.
* @throws ShapefileNotFoundException if the shapefile has not been found.
* @throws InvalidDbaseFileFormatException if the database file format is invalid.
* @throws InvalidShapefileFormatException if the shapefile format is invalid.
*/
- public InputFeatureStream findAll() throws InvalidDbaseFileFormatException, ShapefileNotFoundException, DbaseFileNotFoundException, SQLInvalidStatementException, InvalidShapefileFormatException {
+ public InputFeatureStream findAll() throws InvalidDbaseFileFormatException, ShapefileNotFoundException, DbaseFileNotFoundException, InvalidShapefileFormatException {
return new InputFeatureStream(shapeFile, databaseFile);
}
}
Modified: sis/trunk/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.properties
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.properties?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.properties [ISO-8859-1] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.properties [ISO-8859-1] Fri May 15 19:42:41 2015
@@ -1,3 +1,7 @@
+# Assertion : if this exception is thrown, the involved code that produced it is sure to have a bug.
+#0 : Wrong index returned by findColumn.
+#1 : Field name that caused the wrong calculation.
+assert.wrong_index_for_column_name=[Erreur interne de l''API] The column index {0}, illegal, has been returned by findColumn for the field ''{1}''.
# Exception : field is not a date.
#0 : Field name.
Modified: sis/trunk/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet_fr.properties
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet_fr.properties?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet_fr.properties [ISO-8859-1] (original)
+++ sis/trunk/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet_fr.properties [ISO-8859-1] Fri May 15 19:42:41 2015
@@ -1,3 +1,8 @@
+# Assertion : if this exception is thrown, the involved code that produced it is sure to have a bug.
+#0 : Wrong index returned by findColumn.
+#1 : Field name that caused the wrong calculation.
+assert.wrong_index_for_column_name=[Erreur interne de l''API] L''index de colonne {0}, illégal, a été renvoyé par findColumn pour le champ ''{1}''.
+
# Exception : field is not a date.
#0 : Field name.
#1 : SQL Query.
Modified: sis/trunk/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java [UTF-8] Fri May 15 19:42:41 2015
@@ -18,9 +18,8 @@ package org.apache.sis.storage.shapefile
import java.io.File;
import java.net.URISyntaxException;
-import java.sql.SQLException;
-import org.apache.sis.internal.shapefile.InvalidShapefileFormatException;
+import org.apache.sis.storage.DataStoreException;
import org.apache.sis.test.TestCase;
import org.junit.Test;
import org.apache.sis.feature.AbstractFeature;
@@ -48,11 +47,10 @@ public final strictfp class ShapeFileTes
/**
* Test polylines count.
* @throws URISyntaxException if the resource name is incorrect.
- * @throws InvalidShapefileFormatException if the shapefile format is invalid.
- * @throws SQLException if any SQL Exception occuring.
+ * @throws DataStoreException if a general file reading trouble occurs.
*/
@Test
- public void testPolyineCount() throws URISyntaxException, SQLException, InvalidShapefileFormatException {
+ public void testPolyineCount() throws URISyntaxException, DataStoreException {
ShapeFile shp = new ShapeFile(path("SignedBikeRoute_4326_clipped.shp"));
readAll(shp);
}
@@ -60,11 +58,10 @@ public final strictfp class ShapeFileTes
/**
* Test polygon count.
* @throws URISyntaxException if the resource name is incorrect.
- * @throws InvalidShapefileFormatException if the shapefile format is invalid.
- * @throws SQLException if any SQL Exception occuring.
+ * @throws DataStoreException if a general file reading trouble occurs.
*/
@Test
- public void testPolygonCount() throws URISyntaxException, SQLException, InvalidShapefileFormatException {
+ public void testPolygonCount() throws URISyntaxException, DataStoreException {
ShapeFile shp = new ShapeFile(path("ANC90Ply_4326.shp"));
readAll(shp);
}
@@ -72,11 +69,10 @@ public final strictfp class ShapeFileTes
/**
* Test point count.
* @throws URISyntaxException if the resource name is incorrect.
- * @throws InvalidShapefileFormatException if the shapefile format is invalid.
- * @throws SQLException if any SQL Exception occuring.
+ * @throws DataStoreException if a general file reading trouble occurs.
*/
@Test
- public void testPointCount() throws URISyntaxException, SQLException, InvalidShapefileFormatException {
+ public void testPointCount() throws URISyntaxException, DataStoreException {
ShapeFile shp = new ShapeFile(path("ABRALicenseePt_4326_clipped.shp"));
readAll(shp);
}
@@ -84,10 +80,9 @@ public final strictfp class ShapeFileTes
/**
* Read all the shapefile content.
* @param shp Shapefile to read.
- * @throws InvalidShapefileFormatException if the shapefile format is invalid.
- * @throws SQLException if any SQL Exception occuring.
+ * @throws DataStoreException if a general file reading trouble occurs.
*/
- private void readAll(ShapeFile shp) throws SQLException, InvalidShapefileFormatException {
+ private void readAll(ShapeFile shp) throws DataStoreException {
InputFeatureStream is = shp.findAll();
try {
AbstractFeature feature = is.readFeature();