sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1651061 [1/4] - in /sis/branches/JDK8/storage/sis-shapefile/src/main: java/org/apache/sis/internal/shapefile/ java/org/apache/sis/internal/shapefile/jdbc/ java/org/apache/sis/internal/shapefile/jdbc/connection/ java/org/apache/sis/internal...
Date Mon, 12 Jan 2015 11:14:55 GMT
Author: desruisseaux
Date: Mon Jan 12 11:14:54 2015
New Revision: 1651061

URL: http://svn.apache.org/r1651061
Log:
Apply "svn:eol-style" properties on Shapefile classes and remove trailing space.
This commit does not contains any code or formatting change.

Modified:
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/InvalidShapefileFormatException.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileNotFoundException.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Dbase3ByteReader.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DbaseFileNotFoundException.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLConnectionClosedException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/SQLClosingIOFailureException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/package-info.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/AbstractDatabaseMetaData.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFDatabaseMetaData.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFResultSetMataData.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/package-info.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/AbstractResultSet.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/BuiltInMemoryResultSet.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForCatalogNamesListing.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFRecordBasedResultSet.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFResultSet.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLIllegalColumnIndexException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoResultException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNoSuchFieldException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotDateException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/SQLNotNumericException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/package-info.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ClauseResolver.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/ConditionalClauseResolver.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/CrudeSQLParser.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/SQLIllegalParameterException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/SQLInvalidStatementException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/SQLUnsupportedParsingFeatureException.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/sql/package-info.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/statement/DBFStatement.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/statement/package-info.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/package-info.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/ShapeFile.java
    sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.properties   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader_fr.properties   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.properties   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.properties   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/MappedByteReader_fr.properties   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.properties   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing_fr.properties   (contents, props changed)
    sis/branches/JDK8/storage/sis-shapefile/src/main/resources/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.properties   (contents, props changed)

Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -29,7 +29,7 @@ import org.apache.sis.util.logging.Loggi
 
 /**
  * Base class for objets having auto-checking abilities
- * and easy access to Bundle and logging function. 
+ * and easy access to Bundle and logging function.
  * @author Marc LE BIHAN
  */
 public abstract class AutoChecker {
@@ -50,7 +50,7 @@ public abstract class AutoChecker {
 
         Class<?> candidateClass = classForResourceBundleName;
         MessageFormat format = null;
-        
+
         // Find the key in the bundle having for name this class, or in one of its superclasses.
         do {
             try {
@@ -62,7 +62,7 @@ public abstract class AutoChecker {
             }
         }
         while(candidateClass != null && format == null);
-        
+
         if (format == null) {
             String fmt = "Cannot find property key {0} in {1} properties file or any of its superclasses.";
             String message = MessageFormat.format(fmt, key, classForResourceBundleName.getName());
@@ -93,7 +93,7 @@ public abstract class AutoChecker {
      */
     final protected String format(Level logLevel, String key, Object... args) {
         Objects.requireNonNull(logLevel, "The log level cannot be null.");
-        
+
         String message = format(key, args);
         logger.log(logLevel, message);
         return(message);
@@ -110,7 +110,7 @@ public abstract class AutoChecker {
      */
     final protected String format(Level logLevel, Class<?> classForResourceBundleName, String key, Object... args) {
         Objects.requireNonNull(logLevel, "The log level cannot be null.");
-        
+
         String message = format(classForResourceBundleName, key, args);
         logger.log(logLevel, message);
         return(message);
@@ -140,7 +140,7 @@ public abstract class AutoChecker {
     public static <E extends Throwable> void throwException(Class<E> classException, String message, Throwable cause) throws E {
        throw(exception(classException, message, cause));
     }
-    
+
     /**
      * Build an exception by reflection.
      * @param <E> Class of the exception to build.
@@ -151,7 +151,7 @@ public abstract class AutoChecker {
      */
     private static <E extends Throwable> E exception(Class<E> classException, String message, Throwable cause) {
        Objects.requireNonNull(classException, "The class of the exception to throw cannot be null."); //$NON-NLS-1$
-       
+
        try
        {
             Constructor<E> cstr = classException.getConstructor(String.class, Throwable.class);
@@ -165,7 +165,7 @@ public abstract class AutoChecker {
             throw new RuntimeException(msg, e);
        }
     }
-    
+
     /**
      * Return the class logger.
      * @return logger.

Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/InvalidShapefileFormatException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/InvalidShapefileFormatException.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/InvalidShapefileFormatException.java [iso-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/InvalidShapefileFormatException.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -1,47 +1,47 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-/**
- * Thrown when the Shapefile format seems to be invalid.
- *
- * @author  Marc Le Bihan
- * @version 0.5
- * @since   0.5
- * @module
- */
-public class InvalidShapefileFormatException extends Exception {
-    /** Serial UID. */
-    private static final long serialVersionUID = -2724950178838120005L;
-
-    /**
-     * Construct an exception.
-     * @param message Message of the exception.
-     */
-    public InvalidShapefileFormatException(String message) {
-        super(message);
-    }
-
-    /**
-     * Construct an exception.
-     * @param message Message of the exception.
-     * @param cause Root cause of the exception.
-     */
-    public InvalidShapefileFormatException(String message, Throwable cause) {
-        super(message, cause);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile;
+
+/**
+ * Thrown when the Shapefile format seems to be invalid.
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+public class InvalidShapefileFormatException extends Exception {
+    /** Serial UID. */
+    private static final long serialVersionUID = -2724950178838120005L;
+
+    /**
+     * Construct an exception.
+     * @param message Message of the exception.
+     */
+    public InvalidShapefileFormatException(String message) {
+        super(message);
+    }
+
+    /**
+     * Construct an exception.
+     * @param message Message of the exception.
+     * @param cause Root cause of the exception.
+     */
+    public InvalidShapefileFormatException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/InvalidShapefileFormatException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/InvalidShapefileFormatException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java [iso-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -1,278 +1,278 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.ByteOrder;
-import java.text.MessageFormat;
-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.ShapeTypeEnum;
-import org.opengis.feature.Feature;
-
-import com.esri.core.geometry.*;
-
-/**
- * Reader of a Shapefile Binary content by the way of a {@link java.nio.MappedByteBuffer}
- *
- * @author  Marc Le Bihan
- * @version 0.5
- * @since   0.5
- * @module
- */
-public class ShapefileByteReader extends CommonByteReader<InvalidShapefileFormatException, ShapefileNotFoundException> {
-    /** Name of the Geometry field. */
-    private static final String GEOMETRY_NAME = "geometry";
-    
-    /** Shapefile descriptor. */
-    private ShapefileDescriptor shapefileDescriptor; 
-    
-    /** Database Field descriptors. */
-    private List<DBase3FieldDescriptor> databaseFieldsDescriptors;
-    
-    /** Type of the features contained in this shapefile. */
-    private DefaultFeatureType featuresType;
-
-    /**
-     * Construct a shapefile byte reader.
-     * @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.
-     */
-    public ShapefileByteReader(File shapefile, File dbaseFile) throws InvalidShapefileFormatException, InvalidDbaseFileFormatException, ShapefileNotFoundException, DbaseFileNotFoundException {
-        super(shapefile, InvalidShapefileFormatException.class, ShapefileNotFoundException.class);
-        loadDatabaseFieldDescriptors(dbaseFile);
-        loadDescriptor();
-
-        featuresType = getFeatureType(shapefile.getName());
-    }
-    
-    /**
-     * Returns the DBase 3 fields descriptors.
-     * @return Fields descriptors.
-     */
-    public List<DBase3FieldDescriptor> getFieldsDescriptors() {
-        return databaseFieldsDescriptors;
-    }
-    
-    /**
-     * Returns the shapefile descriptor.
-     * @return Shapefile descriptor.
-     */
-    public ShapefileDescriptor getShapefileDescriptor() {
-        return shapefileDescriptor;
-    }
-    
-    /**
-     * Returns the type of the features contained in this shapefile.
-     * @return Features type.
-     */
-    public DefaultFeatureType getFeaturesType() {
-        return featuresType;
-    }
-    
-    /**
-     * Create a feature descriptor.
-     * @param name Name of the field.
-     * @return The feature type.
-     */
-    private DefaultFeatureType getFeatureType(final String name) {
-        Objects.requireNonNull(name, "The feature name cannot be null.");
-        
-        final int n = databaseFieldsDescriptors.size();
-        final DefaultAttributeType<?>[] attributes = new DefaultAttributeType<?>[n + 1];
-        final Map<String, Object> properties = new HashMap<>(4);
-
-        // Load data field.
-        for (int i = 0; i < n; i++) {
-            properties.put(DefaultAttributeType.NAME_KEY, databaseFieldsDescriptors.get(i).getName());
-            attributes[i] = new DefaultAttributeType<>(properties, String.class, 1, 1, null);
-        }
-
-        // Add geometry field.
-        properties.put(DefaultAttributeType.NAME_KEY, GEOMETRY_NAME);
-        attributes[n] = new DefaultAttributeType<>(properties, Geometry.class, 1, 1, null);
-
-        // Add name.
-        properties.put(DefaultAttributeType.NAME_KEY, name);
-        return new DefaultFeatureType(properties, false, null, attributes);
-    }
-
-    /**
-     * Load shapefile descriptor.
-     */
-    private void loadDescriptor() {
-        shapefileDescriptor = new ShapefileDescriptor(getByteBuffer());
-    }
-
-    /**
-     * 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.
-     */
-    private void loadDatabaseFieldDescriptors(File dbaseFile) throws InvalidDbaseFileFormatException, DbaseFileNotFoundException {
-        MappedByteReader databaseReader = null;
-        
-        try {
-            databaseReader = new MappedByteReader(dbaseFile);
-            databaseFieldsDescriptors = databaseReader.getFieldsDescriptors();
-        }
-        finally {
-            if (databaseReader != null) {
-                try {
-                    databaseReader.close();
-                }
-                catch(IOException e) {
-                }
-            }
-        }
-    }
-    
-    /**
-     * Complete a feature with shapefile content.
-     * @param feature Feature to complete.
-     * @throws InvalidShapefileFormatException if a validation problem occurs.
-     */
-    public void completeFeature(Feature feature) throws InvalidShapefileFormatException {
-        // insert points into some type of list
-        int RecordNumber = getByteBuffer().getInt();
-        @SuppressWarnings("unused")
-        int ContentLength = getByteBuffer().getInt();
-
-        getByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
-        int iShapeType = getByteBuffer().getInt();
-
-        ShapeTypeEnum type = ShapeTypeEnum.get(iShapeType);
-
-        if (type == null)
-            throw new InvalidShapefileFormatException(MessageFormat.format("The shapefile feature type {0} doesn''t match to any known feature type.", featuresType));
-
-        switch (type) {
-            case Point:
-                loadPointFeature(feature);
-                break;
-    
-            case Polygon:
-                loadPolygonFeature(feature);
-                break;
-    
-            case PolyLine:
-                loadPolylineFeature(feature);
-                break;
-    
-            default:
-                throw new InvalidShapefileFormatException("Unsupported shapefile type: " + iShapeType);
-        }
-
-        getByteBuffer().order(ByteOrder.BIG_ENDIAN);
-    }
-
-    /**
-     * Load point feature.
-     * @param feature Feature to fill.
-     */
-    private void loadPointFeature(Feature feature) {
-        double x = getByteBuffer().getDouble();
-        double y = getByteBuffer().getDouble();
-        Point pnt = new Point(x, y);
-        feature.setPropertyValue(GEOMETRY_NAME, pnt);
-    }
-
-    /**
-     * Load polygon feature.
-     * @param feature Feature to fill.
-     * @throws InvalidShapefileFormatException if the polygon cannot be handled. 
-     */
-    private void loadPolygonFeature(Feature feature) throws InvalidShapefileFormatException {
-        /* double xmin = */getByteBuffer().getDouble();
-        /* double ymin = */getByteBuffer().getDouble();
-        /* double xmax = */getByteBuffer().getDouble();
-        /* double ymax = */getByteBuffer().getDouble();
-        int NumParts = getByteBuffer().getInt();
-        int NumPoints = getByteBuffer().getInt();
-
-        if (NumParts > 1) {
-            throw new InvalidShapefileFormatException("Polygons with multiple linear rings have not implemented yet.");
-        }
-
-        // read the one part
-        @SuppressWarnings("unused")
-        int Part = getByteBuffer().getInt();
-        Polygon poly = new Polygon();
-
-        // create a line from the points
-        double xpnt = getByteBuffer().getDouble();
-        double ypnt = getByteBuffer().getDouble();
-        // Point oldpnt = new Point(xpnt, ypnt);
-        poly.startPath(xpnt, ypnt);
-
-        for (int j = 0; j < NumPoints - 1; j++) {
-            xpnt = getByteBuffer().getDouble();
-            ypnt = getByteBuffer().getDouble();
-            poly.lineTo(xpnt, ypnt);
-        }
-
-        feature.setPropertyValue(GEOMETRY_NAME, poly);
-    }
-
-    /**
-     * Load polyline feature.
-     * @param feature Feature to fill.
-     */
-    private void loadPolylineFeature(Feature feature) {
-        /* double xmin = */getByteBuffer().getDouble();
-        /* double ymin = */getByteBuffer().getDouble();
-        /* double xmax = */getByteBuffer().getDouble();
-        /* double ymax = */getByteBuffer().getDouble();
-
-        int NumParts = getByteBuffer().getInt();
-        int NumPoints = getByteBuffer().getInt();
-
-        int[] NumPartArr = new int[NumParts + 1];
-
-        for (int n = 0; n < NumParts; n++) {
-            int idx = getByteBuffer().getInt();
-            NumPartArr[n] = idx;
-        }
-        NumPartArr[NumParts] = NumPoints;
-
-        double xpnt, ypnt;
-        Polyline ply = new Polyline();
-
-        for (int m = 0; m < NumParts; m++) {
-            xpnt = getByteBuffer().getDouble();
-            ypnt = getByteBuffer().getDouble();
-            ply.startPath(xpnt, ypnt);
-
-            for (int j = NumPartArr[m]; j < NumPartArr[m + 1] - 1; j++) {
-                xpnt = getByteBuffer().getDouble();
-                ypnt = getByteBuffer().getDouble();
-                ply.lineTo(xpnt, ypnt);
-            }
-        }
-
-        feature.setPropertyValue(GEOMETRY_NAME, ply);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteOrder;
+import java.text.MessageFormat;
+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.ShapeTypeEnum;
+import org.opengis.feature.Feature;
+
+import com.esri.core.geometry.*;
+
+/**
+ * Reader of a Shapefile Binary content by the way of a {@link java.nio.MappedByteBuffer}
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+public class ShapefileByteReader extends CommonByteReader<InvalidShapefileFormatException, ShapefileNotFoundException> {
+    /** Name of the Geometry field. */
+    private static final String GEOMETRY_NAME = "geometry";
+
+    /** Shapefile descriptor. */
+    private ShapefileDescriptor shapefileDescriptor;
+
+    /** Database Field descriptors. */
+    private List<DBase3FieldDescriptor> databaseFieldsDescriptors;
+
+    /** Type of the features contained in this shapefile. */
+    private DefaultFeatureType featuresType;
+
+    /**
+     * Construct a shapefile byte reader.
+     * @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.
+     */
+    public ShapefileByteReader(File shapefile, File dbaseFile) throws InvalidShapefileFormatException, InvalidDbaseFileFormatException, ShapefileNotFoundException, DbaseFileNotFoundException {
+        super(shapefile, InvalidShapefileFormatException.class, ShapefileNotFoundException.class);
+        loadDatabaseFieldDescriptors(dbaseFile);
+        loadDescriptor();
+
+        featuresType = getFeatureType(shapefile.getName());
+    }
+
+    /**
+     * Returns the DBase 3 fields descriptors.
+     * @return Fields descriptors.
+     */
+    public List<DBase3FieldDescriptor> getFieldsDescriptors() {
+        return databaseFieldsDescriptors;
+    }
+
+    /**
+     * Returns the shapefile descriptor.
+     * @return Shapefile descriptor.
+     */
+    public ShapefileDescriptor getShapefileDescriptor() {
+        return shapefileDescriptor;
+    }
+
+    /**
+     * Returns the type of the features contained in this shapefile.
+     * @return Features type.
+     */
+    public DefaultFeatureType getFeaturesType() {
+        return featuresType;
+    }
+
+    /**
+     * Create a feature descriptor.
+     * @param name Name of the field.
+     * @return The feature type.
+     */
+    private DefaultFeatureType getFeatureType(final String name) {
+        Objects.requireNonNull(name, "The feature name cannot be null.");
+
+        final int n = databaseFieldsDescriptors.size();
+        final DefaultAttributeType<?>[] attributes = new DefaultAttributeType<?>[n + 1];
+        final Map<String, Object> properties = new HashMap<>(4);
+
+        // Load data field.
+        for (int i = 0; i < n; i++) {
+            properties.put(DefaultAttributeType.NAME_KEY, databaseFieldsDescriptors.get(i).getName());
+            attributes[i] = new DefaultAttributeType<>(properties, String.class, 1, 1, null);
+        }
+
+        // Add geometry field.
+        properties.put(DefaultAttributeType.NAME_KEY, GEOMETRY_NAME);
+        attributes[n] = new DefaultAttributeType<>(properties, Geometry.class, 1, 1, null);
+
+        // Add name.
+        properties.put(DefaultAttributeType.NAME_KEY, name);
+        return new DefaultFeatureType(properties, false, null, attributes);
+    }
+
+    /**
+     * Load shapefile descriptor.
+     */
+    private void loadDescriptor() {
+        shapefileDescriptor = new ShapefileDescriptor(getByteBuffer());
+    }
+
+    /**
+     * 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.
+     */
+    private void loadDatabaseFieldDescriptors(File dbaseFile) throws InvalidDbaseFileFormatException, DbaseFileNotFoundException {
+        MappedByteReader databaseReader = null;
+
+        try {
+            databaseReader = new MappedByteReader(dbaseFile);
+            databaseFieldsDescriptors = databaseReader.getFieldsDescriptors();
+        }
+        finally {
+            if (databaseReader != null) {
+                try {
+                    databaseReader.close();
+                }
+                catch(IOException e) {
+                }
+            }
+        }
+    }
+
+    /**
+     * Complete a feature with shapefile content.
+     * @param feature Feature to complete.
+     * @throws InvalidShapefileFormatException if a validation problem occurs.
+     */
+    public void completeFeature(Feature feature) throws InvalidShapefileFormatException {
+        // insert points into some type of list
+        int RecordNumber = getByteBuffer().getInt();
+        @SuppressWarnings("unused")
+        int ContentLength = getByteBuffer().getInt();
+
+        getByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
+        int iShapeType = getByteBuffer().getInt();
+
+        ShapeTypeEnum type = ShapeTypeEnum.get(iShapeType);
+
+        if (type == null)
+            throw new InvalidShapefileFormatException(MessageFormat.format("The shapefile feature type {0} doesn''t match to any known feature type.", featuresType));
+
+        switch (type) {
+            case Point:
+                loadPointFeature(feature);
+                break;
+
+            case Polygon:
+                loadPolygonFeature(feature);
+                break;
+
+            case PolyLine:
+                loadPolylineFeature(feature);
+                break;
+
+            default:
+                throw new InvalidShapefileFormatException("Unsupported shapefile type: " + iShapeType);
+        }
+
+        getByteBuffer().order(ByteOrder.BIG_ENDIAN);
+    }
+
+    /**
+     * Load point feature.
+     * @param feature Feature to fill.
+     */
+    private void loadPointFeature(Feature feature) {
+        double x = getByteBuffer().getDouble();
+        double y = getByteBuffer().getDouble();
+        Point pnt = new Point(x, y);
+        feature.setPropertyValue(GEOMETRY_NAME, pnt);
+    }
+
+    /**
+     * Load polygon feature.
+     * @param feature Feature to fill.
+     * @throws InvalidShapefileFormatException if the polygon cannot be handled.
+     */
+    private void loadPolygonFeature(Feature feature) throws InvalidShapefileFormatException {
+        /* double xmin = */getByteBuffer().getDouble();
+        /* double ymin = */getByteBuffer().getDouble();
+        /* double xmax = */getByteBuffer().getDouble();
+        /* double ymax = */getByteBuffer().getDouble();
+        int NumParts = getByteBuffer().getInt();
+        int NumPoints = getByteBuffer().getInt();
+
+        if (NumParts > 1) {
+            throw new InvalidShapefileFormatException("Polygons with multiple linear rings have not implemented yet.");
+        }
+
+        // read the one part
+        @SuppressWarnings("unused")
+        int Part = getByteBuffer().getInt();
+        Polygon poly = new Polygon();
+
+        // create a line from the points
+        double xpnt = getByteBuffer().getDouble();
+        double ypnt = getByteBuffer().getDouble();
+        // Point oldpnt = new Point(xpnt, ypnt);
+        poly.startPath(xpnt, ypnt);
+
+        for (int j = 0; j < NumPoints - 1; j++) {
+            xpnt = getByteBuffer().getDouble();
+            ypnt = getByteBuffer().getDouble();
+            poly.lineTo(xpnt, ypnt);
+        }
+
+        feature.setPropertyValue(GEOMETRY_NAME, poly);
+    }
+
+    /**
+     * Load polyline feature.
+     * @param feature Feature to fill.
+     */
+    private void loadPolylineFeature(Feature feature) {
+        /* double xmin = */getByteBuffer().getDouble();
+        /* double ymin = */getByteBuffer().getDouble();
+        /* double xmax = */getByteBuffer().getDouble();
+        /* double ymax = */getByteBuffer().getDouble();
+
+        int NumParts = getByteBuffer().getInt();
+        int NumPoints = getByteBuffer().getInt();
+
+        int[] NumPartArr = new int[NumParts + 1];
+
+        for (int n = 0; n < NumParts; n++) {
+            int idx = getByteBuffer().getInt();
+            NumPartArr[n] = idx;
+        }
+        NumPartArr[NumParts] = NumPoints;
+
+        double xpnt, ypnt;
+        Polyline ply = new Polyline();
+
+        for (int m = 0; m < NumParts; m++) {
+            xpnt = getByteBuffer().getDouble();
+            ypnt = getByteBuffer().getDouble();
+            ply.startPath(xpnt, ypnt);
+
+            for (int j = NumPartArr[m]; j < NumPartArr[m + 1] - 1; j++) {
+                xpnt = getByteBuffer().getDouble();
+                ypnt = getByteBuffer().getDouble();
+                ply.lineTo(xpnt, ypnt);
+            }
+        }
+
+        feature.setPropertyValue(GEOMETRY_NAME, ply);
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileByteReader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java [iso-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -1,122 +1,121 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-import java.nio.ByteOrder;
-import java.nio.MappedByteBuffer;
-
-import org.apache.sis.storage.shapefile.ShapeTypeEnum;
-
-/**
- * Shapefile Descriptor.
- * @author  Marc Le Bihan
- * @version 0.5
- * @since   0.5
- * @module
- */
-public class ShapefileDescriptor {
-    /** File code. */
-    private int fileCode; // big
-
-    /** File length. */
-    private int fileLength; // big // The value for file length is the total length of the file in 16-bit words
-
-    /** File version. */
-    private int version; // little
-
-    /** Shapefile type. */
-    private ShapeTypeEnum shapeType; // little
-
-    /** X Min. */
-    private double xmin; // little
-
-    /** Y Min. */
-    private double ymin; // little
-
-    /** X Max. */
-    private double xmax; // little
-
-    /** Y Max. */
-    private double ymax; // little
-
-    /** Z Min. */
-    private double zmin; // little
-
-    /** Z Max. */
-    private double zmax; // little
-
-    /** M Min. */
-    private double mmin; // little
-
-    /** M Max. */
-    private double mmax; // little
-    
-    /**
-     * Create a shapefile descriptor.
-     * @param byteBuffer Source Bytebuffer.
-     */
-    public ShapefileDescriptor(MappedByteBuffer byteBuffer) {
-        fileCode = byteBuffer.getInt();
-        byteBuffer.getInt();
-        byteBuffer.getInt();
-        byteBuffer.getInt();
-        byteBuffer.getInt();
-        byteBuffer.getInt();
-        fileLength = byteBuffer.getInt() * 2;
-
-        byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
-        version = byteBuffer.getInt();
-        shapeType = ShapeTypeEnum.get(byteBuffer.getInt());
-        xmin = byteBuffer.getDouble();
-        ymin = byteBuffer.getDouble();
-        xmax = byteBuffer.getDouble();
-        ymax = byteBuffer.getDouble();
-        zmin = byteBuffer.getDouble();
-        zmax = byteBuffer.getDouble();
-        mmin = byteBuffer.getDouble();
-        mmax = byteBuffer.getDouble();
-        byteBuffer.order(ByteOrder.BIG_ENDIAN);
-
-        //dbf.byteBuffer.get(); // should be 0d for field terminator
-    }
-
-    /**
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString() {
-        StringBuilder s = new StringBuilder();
-        String lineSeparator = System.getProperty("line.separator", "\n");
-
-        s.append("FileCode: ").append(fileCode).append(lineSeparator);
-        s.append("FileLength: ").append(fileLength).append(lineSeparator);
-        s.append("Version: ").append(version).append(lineSeparator);
-        s.append("ShapeType: ").append(shapeType).append(lineSeparator);
-        s.append("xmin: ").append(xmin).append(lineSeparator);
-        s.append("ymin: ").append(ymin).append(lineSeparator);
-        s.append("xmax: ").append(xmax).append(lineSeparator);
-        s.append("ymax: ").append(ymax).append(lineSeparator);
-        s.append("zmin: ").append(zmin).append(lineSeparator);
-        s.append("zmax: ").append(zmax).append(lineSeparator);
-        s.append("mmin: ").append(mmin).append(lineSeparator);
-        s.append("mmax: ").append(mmax).append(lineSeparator);
-        s.append("------------------------").append(lineSeparator);
-
-        return s.toString();
-    }
-}
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile;
+
+import java.nio.ByteOrder;
+import java.nio.MappedByteBuffer;
+
+import org.apache.sis.storage.shapefile.ShapeTypeEnum;
+
+/**
+ * Shapefile Descriptor.
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+public class ShapefileDescriptor {
+    /** File code. */
+    private int fileCode; // big
+
+    /** File length. */
+    private int fileLength; // big // The value for file length is the total length of the file in 16-bit words
+
+    /** File version. */
+    private int version; // little
+
+    /** Shapefile type. */
+    private ShapeTypeEnum shapeType; // little
+
+    /** X Min. */
+    private double xmin; // little
+
+    /** Y Min. */
+    private double ymin; // little
+
+    /** X Max. */
+    private double xmax; // little
+
+    /** Y Max. */
+    private double ymax; // little
+
+    /** Z Min. */
+    private double zmin; // little
+
+    /** Z Max. */
+    private double zmax; // little
+
+    /** M Min. */
+    private double mmin; // little
+
+    /** M Max. */
+    private double mmax; // little
+
+    /**
+     * Create a shapefile descriptor.
+     * @param byteBuffer Source Bytebuffer.
+     */
+    public ShapefileDescriptor(MappedByteBuffer byteBuffer) {
+        fileCode = byteBuffer.getInt();
+        byteBuffer.getInt();
+        byteBuffer.getInt();
+        byteBuffer.getInt();
+        byteBuffer.getInt();
+        byteBuffer.getInt();
+        fileLength = byteBuffer.getInt() * 2;
+
+        byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
+        version = byteBuffer.getInt();
+        shapeType = ShapeTypeEnum.get(byteBuffer.getInt());
+        xmin = byteBuffer.getDouble();
+        ymin = byteBuffer.getDouble();
+        xmax = byteBuffer.getDouble();
+        ymax = byteBuffer.getDouble();
+        zmin = byteBuffer.getDouble();
+        zmax = byteBuffer.getDouble();
+        mmin = byteBuffer.getDouble();
+        mmax = byteBuffer.getDouble();
+        byteBuffer.order(ByteOrder.BIG_ENDIAN);
+
+        //dbf.byteBuffer.get(); // should be 0d for field terminator
+    }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        StringBuilder s = new StringBuilder();
+        String lineSeparator = System.getProperty("line.separator", "\n");
+
+        s.append("FileCode: ").append(fileCode).append(lineSeparator);
+        s.append("FileLength: ").append(fileLength).append(lineSeparator);
+        s.append("Version: ").append(version).append(lineSeparator);
+        s.append("ShapeType: ").append(shapeType).append(lineSeparator);
+        s.append("xmin: ").append(xmin).append(lineSeparator);
+        s.append("ymin: ").append(ymin).append(lineSeparator);
+        s.append("xmax: ").append(xmax).append(lineSeparator);
+        s.append("ymax: ").append(ymax).append(lineSeparator);
+        s.append("zmin: ").append(zmin).append(lineSeparator);
+        s.append("zmax: ").append(zmax).append(lineSeparator);
+        s.append("mmin: ").append(mmin).append(lineSeparator);
+        s.append("mmax: ").append(mmax).append(lineSeparator);
+        s.append("------------------------").append(lineSeparator);
+
+        return s.toString();
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileDescriptor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileNotFoundException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileNotFoundException.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileNotFoundException.java [iso-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileNotFoundException.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -1,50 +1,50 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile;
-
-import java.sql.SQLNonTransientException;
-
-
-/**
- * Thrown when a shapefile has not been found.
- *
- * @author  Marc Le Bihan
- * @version 0.5
- * @since   0.5
- * @module
- */
-public class ShapefileNotFoundException extends SQLNonTransientException {
-    /** Serial UID. */
-    private static final long serialVersionUID = -3235671561698931817L;
-
-    /**
-     * Construct an exception.
-     * @param message Message of the exception.
-     */
-    public ShapefileNotFoundException(String message) {
-        super(message);
-    }
-
-    /**
-     * Construct an exception.
-     * @param message Message of the exception.
-     * @param cause Root cause of the exception.
-     */
-    public ShapefileNotFoundException(String message, Throwable cause) {
-        super(message, cause);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile;
+
+import java.sql.SQLNonTransientException;
+
+
+/**
+ * Thrown when a shapefile has not been found.
+ *
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+public class ShapefileNotFoundException extends SQLNonTransientException {
+    /** Serial UID. */
+    private static final long serialVersionUID = -3235671561698931817L;
+
+    /**
+     * Construct an exception.
+     * @param message Message of the exception.
+     */
+    public ShapefileNotFoundException(String message) {
+        super(message);
+    }
+
+    /**
+     * Construct an exception.
+     * @param message Message of the exception.
+     * @param cause Root cause of the exception.
+     */
+    public ShapefileNotFoundException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileNotFoundException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/ShapefileNotFoundException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java [iso-8859-1] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -1,278 +1,278 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.internal.shapefile.jdbc;
-
-import java.io.File;
-import java.nio.charset.Charset;
-import java.nio.charset.UnsupportedCharsetException;
-import java.text.MessageFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Objects;
-import java.util.logging.Level;
-
-/**
- * The Abstract Byte Reader.
- * @author  Marc Le Bihan
- * @version 0.5
- * @since   0.5
- * @module
- */
-abstract class AbstractDbase3ByteReader extends CommonByteReader<InvalidDbaseFileFormatException, DbaseFileNotFoundException> implements Dbase3ByteReader {
-    /** Number of bytes in the header. */
-    protected short dbaseHeaderBytes;
-
-    /** Number of bytes in the record. */
-    protected short dbaseRecordBytes;
-    
-    /** Reserved (dBASE IV) Filled with 00h. */
-    protected byte[] reservedFiller1 = new byte[2];
-    
-    /** 
-     * Reserved : Incomplete transaction (dBASE IV).
-     * 00h : Transaction ended (or rolled back).
-     * 01h : Transaction started. 
-     */
-    protected byte reservedIncompleteTransaction;
-
-    /**
-     * Reserved : Encryption flag (dBASE IV).
-     * 00h : Not encrypted. 
-     * 01h : Data encrypted.
-     */
-    protected byte reservedEncryptionFlag;
-    
-    /** Reserved : Free record thread (for LAN only). */
-    protected byte[] reservedFreeRecordThread = new byte[4];
-    
-    /** Reserved : For multi-user (DBase 3+). */
-    protected byte[] reservedMultiUser = new byte[8];
-
-    /** Reserved : MDX flag (dBASE IV). */
-    protected byte reservedMDXFlag;
-    
-    /** Binary code page value. */
-    protected byte codePage;
-    
-    /** Reserved (dBASE IV) Filled with 00h. */
-    protected byte[] reservedFiller2 = new byte[2];
-    
-    /** Marks the end of the descriptor : must be 0x0D. */
-    protected byte descriptorTerminator;
-
-    /** Valid dBASE III PLUS table file (03h without a memo .DBT file; 83h with a memo). */
-    protected byte dbaseVersion;
-
-    /** Number of records in the table. */
-    protected int rowCount;
-    
-    /** Database charset. */
-    protected Charset charset;
-
-    /** Date of last update; in YYMMDD format. */
-    protected byte[] dbaseLastUpdate = new byte[3];
-
-    /** Current row rumber. */
-    protected int rowNum;
-    
-    /**
-     * 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.
-     */
-    public AbstractDbase3ByteReader(File file) throws DbaseFileNotFoundException, InvalidDbaseFileFormatException {
-        super(file, InvalidDbaseFileFormatException.class, DbaseFileNotFoundException.class);
-    }
-    
-    /**
-     * Returns the charset.
-     * @return Charset.
-     */
-    @Override public Charset getCharset() {
-        return charset;
-    }
-    
-    /**
-     * Returns the database last update date.
-     * @return Date of the last update.
-     */
-    @Override public Date getDateOfLastUpdate() {
-        return toDate(dbaseLastUpdate);
-    }
-
-    /**
-     * Returns the record count.
-     * @return Record count.
-     */
-    @Override public int getRowCount() {
-        return rowCount;
-    }
-    
-    /**
-     * Returns the current record number.
-     * @return Current record number.
-     */
-    @Override public int getRowNum() {
-        return rowNum;
-    }
-
-    /**
-     * 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
-     * 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 {
-        // Attempt to find a known conversion.
-        String dbfCodePage = toCodePage(codePageBinaryValue);
-        
-        // If no conversion has been found, decide if the cause is an unsupported value or an illegal value to choose the good exception to return.
-        if (dbfCodePage == null) {
-            switch(Byte.toUnsignedInt(codePageBinaryValue)) {
-                case 0x04: dbfCodePage = "unsupported"; break;
-                case 0x68: dbfCodePage = "unsupported"; break; // Kamenicky (Czech) MS-DOS
-                case 0x69: dbfCodePage = "unsupported"; break; // Mazovia (Polish) MS-DOS
-                case 0x96: dbfCodePage = "unsupported"; break; // russian mac
-                case 0x97: dbfCodePage = "unsupported"; break; // eastern european macintosh
-                case 0x98: dbfCodePage = "unsupported"; break; // greek macintosh
-                case 0xC8: dbfCodePage = "unsupported"; break; // windows ee
-                default: dbfCodePage = "invalid"; break;
-            }
-        }
-        
-        assert dbfCodePage != null;
-        
-        // 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);
-        }
-        
-        // If the code page cannot find a match for a more recent Charset, we wont be able to handle this DBF.
-        if (dbfCodePage.equals("unsupported")) {
-            String message = format(Level.WARNING, "excp.unsupported_codepage", dbfCodePage, getFile().getAbsolutePath());
-            throw new UnsupportedCharsetException(message);
-        }
-        
-        try {
-            return Charset.forName(dbfCodePage);
-        }
-        catch(IllegalArgumentException e) {
-            // If this happens here, it means that we have selected a wrong charset. We have a bug.
-            String message = format(Level.WARNING, "assert.wrong_charset_selection", dbfCodePage, getFile().getAbsolutePath());
-            throw new RuntimeException(message);
-        }
-    }
-    
-    /**
-     * Return a Charset code page from a binary code page value.
-     * @param pageCodeBinaryValue binary code page value.
-     * @return Page code.
-     */
-    private String toCodePage(byte pageCodeBinaryValue) {
-        // From http://trac.osgeo.org/gdal/ticket/2864
-        HashMap<Integer, String> knownConversions = new HashMap<>();
-        knownConversions.put(0x01, "cp437"); //  U.S. MS–DOS
-        knownConversions.put(0x02, "cp850"); // International MS–DOS
-        knownConversions.put(0x03, "cp1252"); // Windows ANSI
-        knownConversions.put(0x08, "cp865"); //  Danish OEM
-        knownConversions.put(0x09, "cp437"); //  Dutch OEM
-        knownConversions.put(0x0a, "cp850"); //  Dutch OEM*
-        knownConversions.put(0x0b, "cp437"); //  Finnish OEM
-        knownConversions.put(0x0d, "cp437"); //  French OEM
-        knownConversions.put(0x0e, "cp850"); //  French OEM*
-        knownConversions.put(0x0f, "cp437"); //  German OEM
-        knownConversions.put(0x10, "cp850"); //  German OEM*
-        knownConversions.put(0x11, "cp437"); //  Italian OEM
-        knownConversions.put(0x12, "cp850"); //  Italian OEM*
-        knownConversions.put(0x13, "cp932"); //  Japanese Shift-JIS
-        knownConversions.put(0x14, "cp850"); //  Spanish OEM*
-        knownConversions.put(0x15, "cp437"); //  Swedish OEM
-        knownConversions.put(0x16, "cp850"); //  Swedish OEM*
-        knownConversions.put(0x17, "cp865"); //  Norwegian OEM
-        knownConversions.put(0x18, "cp437"); //  Spanish OEM
-        knownConversions.put(0x19, "cp437"); //  English OEM (Britain)
-        knownConversions.put(0x1a, "cp850"); //  English OEM (Britain)*
-        knownConversions.put(0x1b, "cp437"); //  English OEM (U.S.)
-        knownConversions.put(0x1c, "cp863"); //  French OEM (Canada)
-        knownConversions.put(0x1d, "cp850"); //  French OEM*
-        knownConversions.put(0x1f, "cp852"); //  Czech OEM
-        knownConversions.put(0x22, "cp852"); //  Hungarian OEM
-        knownConversions.put(0x23, "cp852"); //  Polish OEM
-        knownConversions.put(0x24, "cp860"); //  Portuguese OEM
-        knownConversions.put(0x25, "cp850"); //  Portuguese OEM*
-        knownConversions.put(0x26, "cp866"); //  Russian OEM
-        knownConversions.put(0x37, "cp850"); //  English OEM (U.S.)*
-        knownConversions.put(0x40, "cp852"); //  Romanian OEM
-        knownConversions.put(0x4d, "cp936"); //  Chinese GBK (PRC)
-        knownConversions.put(0x4e, "cp949"); //  Korean (ANSI/OEM)
-        knownConversions.put(0x4f, "cp950"); //  Chinese Big5 (Taiwan)
-        knownConversions.put(0x50, "cp874"); //  Thai (ANSI/OEM)
-        knownConversions.put(0x57, "cp1252"); // ANSI
-        knownConversions.put(0x58, "cp1252"); // Western European ANSI
-        knownConversions.put(0x59, "cp1252"); // Spanish ANSI
-        knownConversions.put(0x64, "cp852"); //  Eastern European MS–DOS
-        knownConversions.put(0x65, "cp866"); //  Russian MS–DOS
-        knownConversions.put(0x66, "cp865"); //  Nordic MS–DOS
-        knownConversions.put(0x67, "cp861"); //  Icelandic MS–DOS
-        knownConversions.put(0x6a, "cp737"); //  Greek MS–DOS (437G)
-        knownConversions.put(0x6b, "cp857"); //  Turkish MS–DOS
-        knownConversions.put(0x6c, "cp863"); //  French–Canadian MS–DOS
-        knownConversions.put(0x78, "cp950"); //  Taiwan Big 5
-        knownConversions.put(0x79, "cp949"); //  Hangul (Wansung)
-        knownConversions.put(0x7a, "cp936"); //  PRC GBK
-        knownConversions.put(0x7b, "cp932"); //  Japanese Shift-JIS
-        knownConversions.put(0x7c, "cp874"); //  Thai Windows/MS–DOS
-        knownConversions.put(0x86, "cp737"); //  Greek OEM
-        knownConversions.put(0x87, "cp852"); //  Slovenian OEM
-        knownConversions.put(0x88, "cp857"); //  Turkish OEM
-        knownConversions.put(0xc8, "cp1250"); // Eastern European Windows
-        knownConversions.put(0xc9, "cp1251"); // Russian Windows
-        knownConversions.put(0xca, "cp1254"); // Turkish Windows
-        knownConversions.put(0xcb, "cp1253"); // Greek Windows
-        knownConversions.put(0xcc, "cp1257"); // Baltic Windows
-        
-        return(knownConversions.get(Byte.toUnsignedInt(pageCodeBinaryValue)));
-    }
-
-    /**
-     * Return a date from a byte array.
-     * @param yymmdd byte[3] with byte[0] = year (2 digits), [1] = month, [2] = day. 
-     * @return Date.
-     */
-    private Date toDate(byte[] yymmdd) {
-        Objects.requireNonNull(yymmdd, "the yymmdd bytes cannot be null");
-        
-        if (yymmdd.length != 3)
-            throw new IllegalArgumentException(MessageFormat.format("Database:toDate() works only on a 3 bytes YY MM DD date. this array has {0} length", yymmdd.length));
-        
-        Objects.requireNonNull(yymmdd[0], "the year byte cannot be null");
-        Objects.requireNonNull(yymmdd[1], "the month byte cannot be null");
-        Objects.requireNonNull(yymmdd[2], "the day byte cannot be null");
-        
-        int year = yymmdd[0] < 70 ? 100 + yymmdd[0] : yymmdd[0];
-        int month = yymmdd[1];
-        int day = yymmdd[2];
-        
-        @SuppressWarnings("deprecation") // But everything is deprecated in DBF files... 
-        Date date = new Date(year, month, day);
-        return date;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.shapefile.jdbc;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.nio.charset.UnsupportedCharsetException;
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Objects;
+import java.util.logging.Level;
+
+/**
+ * The Abstract Byte Reader.
+ * @author  Marc Le Bihan
+ * @version 0.5
+ * @since   0.5
+ * @module
+ */
+abstract class AbstractDbase3ByteReader extends CommonByteReader<InvalidDbaseFileFormatException, DbaseFileNotFoundException> implements Dbase3ByteReader {
+    /** Number of bytes in the header. */
+    protected short dbaseHeaderBytes;
+
+    /** Number of bytes in the record. */
+    protected short dbaseRecordBytes;
+
+    /** Reserved (dBASE IV) Filled with 00h. */
+    protected byte[] reservedFiller1 = new byte[2];
+
+    /**
+     * Reserved : Incomplete transaction (dBASE IV).
+     * 00h : Transaction ended (or rolled back).
+     * 01h : Transaction started.
+     */
+    protected byte reservedIncompleteTransaction;
+
+    /**
+     * Reserved : Encryption flag (dBASE IV).
+     * 00h : Not encrypted.
+     * 01h : Data encrypted.
+     */
+    protected byte reservedEncryptionFlag;
+
+    /** Reserved : Free record thread (for LAN only). */
+    protected byte[] reservedFreeRecordThread = new byte[4];
+
+    /** Reserved : For multi-user (DBase 3+). */
+    protected byte[] reservedMultiUser = new byte[8];
+
+    /** Reserved : MDX flag (dBASE IV). */
+    protected byte reservedMDXFlag;
+
+    /** Binary code page value. */
+    protected byte codePage;
+
+    /** Reserved (dBASE IV) Filled with 00h. */
+    protected byte[] reservedFiller2 = new byte[2];
+
+    /** Marks the end of the descriptor : must be 0x0D. */
+    protected byte descriptorTerminator;
+
+    /** Valid dBASE III PLUS table file (03h without a memo .DBT file; 83h with a memo). */
+    protected byte dbaseVersion;
+
+    /** Number of records in the table. */
+    protected int rowCount;
+
+    /** Database charset. */
+    protected Charset charset;
+
+    /** Date of last update; in YYMMDD format. */
+    protected byte[] dbaseLastUpdate = new byte[3];
+
+    /** Current row rumber. */
+    protected int rowNum;
+
+    /**
+     * 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.
+     */
+    public AbstractDbase3ByteReader(File file) throws DbaseFileNotFoundException, InvalidDbaseFileFormatException {
+        super(file, InvalidDbaseFileFormatException.class, DbaseFileNotFoundException.class);
+    }
+
+    /**
+     * Returns the charset.
+     * @return Charset.
+     */
+    @Override public Charset getCharset() {
+        return charset;
+    }
+
+    /**
+     * Returns the database last update date.
+     * @return Date of the last update.
+     */
+    @Override public Date getDateOfLastUpdate() {
+        return toDate(dbaseLastUpdate);
+    }
+
+    /**
+     * Returns the record count.
+     * @return Record count.
+     */
+    @Override public int getRowCount() {
+        return rowCount;
+    }
+
+    /**
+     * Returns the current record number.
+     * @return Current record number.
+     */
+    @Override public int getRowNum() {
+        return rowNum;
+    }
+
+    /**
+     * 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
+     * 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 {
+        // Attempt to find a known conversion.
+        String dbfCodePage = toCodePage(codePageBinaryValue);
+
+        // If no conversion has been found, decide if the cause is an unsupported value or an illegal value to choose the good exception to return.
+        if (dbfCodePage == null) {
+            switch(Byte.toUnsignedInt(codePageBinaryValue)) {
+                case 0x04: dbfCodePage = "unsupported"; break;
+                case 0x68: dbfCodePage = "unsupported"; break; // Kamenicky (Czech) MS-DOS
+                case 0x69: dbfCodePage = "unsupported"; break; // Mazovia (Polish) MS-DOS
+                case 0x96: dbfCodePage = "unsupported"; break; // russian mac
+                case 0x97: dbfCodePage = "unsupported"; break; // eastern european macintosh
+                case 0x98: dbfCodePage = "unsupported"; break; // greek macintosh
+                case 0xC8: dbfCodePage = "unsupported"; break; // windows ee
+                default: dbfCodePage = "invalid"; break;
+            }
+        }
+
+        assert dbfCodePage != null;
+
+        // 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);
+        }
+
+        // If the code page cannot find a match for a more recent Charset, we wont be able to handle this DBF.
+        if (dbfCodePage.equals("unsupported")) {
+            String message = format(Level.WARNING, "excp.unsupported_codepage", dbfCodePage, getFile().getAbsolutePath());
+            throw new UnsupportedCharsetException(message);
+        }
+
+        try {
+            return Charset.forName(dbfCodePage);
+        }
+        catch(IllegalArgumentException e) {
+            // If this happens here, it means that we have selected a wrong charset. We have a bug.
+            String message = format(Level.WARNING, "assert.wrong_charset_selection", dbfCodePage, getFile().getAbsolutePath());
+            throw new RuntimeException(message);
+        }
+    }
+
+    /**
+     * Return a Charset code page from a binary code page value.
+     * @param pageCodeBinaryValue binary code page value.
+     * @return Page code.
+     */
+    private String toCodePage(byte pageCodeBinaryValue) {
+        // From http://trac.osgeo.org/gdal/ticket/2864
+        HashMap<Integer, String> knownConversions = new HashMap<>();
+        knownConversions.put(0x01, "cp437"); //  U.S. MS–DOS
+        knownConversions.put(0x02, "cp850"); // International MS–DOS
+        knownConversions.put(0x03, "cp1252"); // Windows ANSI
+        knownConversions.put(0x08, "cp865"); //  Danish OEM
+        knownConversions.put(0x09, "cp437"); //  Dutch OEM
+        knownConversions.put(0x0a, "cp850"); //  Dutch OEM*
+        knownConversions.put(0x0b, "cp437"); //  Finnish OEM
+        knownConversions.put(0x0d, "cp437"); //  French OEM
+        knownConversions.put(0x0e, "cp850"); //  French OEM*
+        knownConversions.put(0x0f, "cp437"); //  German OEM
+        knownConversions.put(0x10, "cp850"); //  German OEM*
+        knownConversions.put(0x11, "cp437"); //  Italian OEM
+        knownConversions.put(0x12, "cp850"); //  Italian OEM*
+        knownConversions.put(0x13, "cp932"); //  Japanese Shift-JIS
+        knownConversions.put(0x14, "cp850"); //  Spanish OEM*
+        knownConversions.put(0x15, "cp437"); //  Swedish OEM
+        knownConversions.put(0x16, "cp850"); //  Swedish OEM*
+        knownConversions.put(0x17, "cp865"); //  Norwegian OEM
+        knownConversions.put(0x18, "cp437"); //  Spanish OEM
+        knownConversions.put(0x19, "cp437"); //  English OEM (Britain)
+        knownConversions.put(0x1a, "cp850"); //  English OEM (Britain)*
+        knownConversions.put(0x1b, "cp437"); //  English OEM (U.S.)
+        knownConversions.put(0x1c, "cp863"); //  French OEM (Canada)
+        knownConversions.put(0x1d, "cp850"); //  French OEM*
+        knownConversions.put(0x1f, "cp852"); //  Czech OEM
+        knownConversions.put(0x22, "cp852"); //  Hungarian OEM
+        knownConversions.put(0x23, "cp852"); //  Polish OEM
+        knownConversions.put(0x24, "cp860"); //  Portuguese OEM
+        knownConversions.put(0x25, "cp850"); //  Portuguese OEM*
+        knownConversions.put(0x26, "cp866"); //  Russian OEM
+        knownConversions.put(0x37, "cp850"); //  English OEM (U.S.)*
+        knownConversions.put(0x40, "cp852"); //  Romanian OEM
+        knownConversions.put(0x4d, "cp936"); //  Chinese GBK (PRC)
+        knownConversions.put(0x4e, "cp949"); //  Korean (ANSI/OEM)
+        knownConversions.put(0x4f, "cp950"); //  Chinese Big5 (Taiwan)
+        knownConversions.put(0x50, "cp874"); //  Thai (ANSI/OEM)
+        knownConversions.put(0x57, "cp1252"); // ANSI
+        knownConversions.put(0x58, "cp1252"); // Western European ANSI
+        knownConversions.put(0x59, "cp1252"); // Spanish ANSI
+        knownConversions.put(0x64, "cp852"); //  Eastern European MS–DOS
+        knownConversions.put(0x65, "cp866"); //  Russian MS–DOS
+        knownConversions.put(0x66, "cp865"); //  Nordic MS–DOS
+        knownConversions.put(0x67, "cp861"); //  Icelandic MS–DOS
+        knownConversions.put(0x6a, "cp737"); //  Greek MS–DOS (437G)
+        knownConversions.put(0x6b, "cp857"); //  Turkish MS–DOS
+        knownConversions.put(0x6c, "cp863"); //  French–Canadian MS–DOS
+        knownConversions.put(0x78, "cp950"); //  Taiwan Big 5
+        knownConversions.put(0x79, "cp949"); //  Hangul (Wansung)
+        knownConversions.put(0x7a, "cp936"); //  PRC GBK
+        knownConversions.put(0x7b, "cp932"); //  Japanese Shift-JIS
+        knownConversions.put(0x7c, "cp874"); //  Thai Windows/MS–DOS
+        knownConversions.put(0x86, "cp737"); //  Greek OEM
+        knownConversions.put(0x87, "cp852"); //  Slovenian OEM
+        knownConversions.put(0x88, "cp857"); //  Turkish OEM
+        knownConversions.put(0xc8, "cp1250"); // Eastern European Windows
+        knownConversions.put(0xc9, "cp1251"); // Russian Windows
+        knownConversions.put(0xca, "cp1254"); // Turkish Windows
+        knownConversions.put(0xcb, "cp1253"); // Greek Windows
+        knownConversions.put(0xcc, "cp1257"); // Baltic Windows
+
+        return(knownConversions.get(Byte.toUnsignedInt(pageCodeBinaryValue)));
+    }
+
+    /**
+     * Return a date from a byte array.
+     * @param yymmdd byte[3] with byte[0] = year (2 digits), [1] = month, [2] = day.
+     * @return Date.
+     */
+    private Date toDate(byte[] yymmdd) {
+        Objects.requireNonNull(yymmdd, "the yymmdd bytes cannot be null");
+
+        if (yymmdd.length != 3)
+            throw new IllegalArgumentException(MessageFormat.format("Database:toDate() works only on a 3 bytes YY MM DD date. this array has {0} length", yymmdd.length));
+
+        Objects.requireNonNull(yymmdd[0], "the year byte cannot be null");
+        Objects.requireNonNull(yymmdd[1], "the month byte cannot be null");
+        Objects.requireNonNull(yymmdd[2], "the day byte cannot be null");
+
+        int year = yymmdd[0] < 70 ? 100 + yymmdd[0] : yymmdd[0];
+        int month = yymmdd[1];
+        int day = yymmdd[2];
+
+        @SuppressWarnings("deprecation") // But everything is deprecated in DBF files...
+        Date date = new Date(year, month, day);
+        return date;
+    }
+}

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java?rev=1651061&r1=1651060&r2=1651061&view=diff
==============================================================================
--- sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java [UTF-8] (original)
+++ sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java [UTF-8] Mon Jan 12 11:14:54 2015
@@ -88,14 +88,14 @@ public abstract class AbstractJDBC exten
      */
     public final SQLFeatureNotSupportedException unsupportedOperation(final String methodOrWishedFeatureName, Object... args) throws SQLFeatureNotSupportedException {
         StringBuffer arguments = new StringBuffer();
-        
+
         for(Object arg : args) {
             arguments.append(arguments.length() == 0 ? "" : ", ");   // Separator if needed.
             arguments.append(arg instanceof String ? "\"" : "");     // Enclosing " for String, if needed.
             arguments.append(arg == null ? "null" : arg.toString()); // String value of the argument.
-            arguments.append(arg instanceof String ? "\"" : "");     // Enclosing " for String, if needed. 
+            arguments.append(arg instanceof String ? "\"" : "");     // Enclosing " for String, if needed.
         }
-        
+
         String message = format(Level.WARNING, "excp.unsupportedDriverFeature_with_arguments", getInterface(), methodOrWishedFeatureName, getClass().getSimpleName(), arguments.toString());
         throw new SQLFeatureNotSupportedException(message);
     }
@@ -133,13 +133,13 @@ public abstract class AbstractJDBC exten
     public void logUnsupportedOperation(final String methodName, Object... args) {
         format(Level.WARNING, "excp.unsupportedDriverFeature_with_arguments", getInterface(), methodName, getClass().getSimpleName(), arguments(args));
     }
-    
+
     /**
      * Returns the Database File.
      * @return Database File.
      */
     abstract protected File getFile();
-    
+
     /**
      * Concat arguments in a StringBuffer.
      * @param args arguments.
@@ -147,14 +147,14 @@ public abstract class AbstractJDBC exten
      */
     private StringBuffer arguments(Object... args) {
         StringBuffer arguments = new StringBuffer();
-        
+
         for(Object arg : args) {
             arguments.append(arguments.length() == 0 ? "" : ", ");   // Separator if needed.
             arguments.append(arg instanceof String ? "\"" : "");     // Enclosing " for String, if needed.
             arguments.append(arg == null ? "null" : arg.toString()); // String value of the argument.
-            arguments.append(arg instanceof String ? "\"" : "");     // Enclosing " for String, if needed. 
+            arguments.append(arg instanceof String ? "\"" : "");     // Enclosing " for String, if needed.
         }
-        
+
         return arguments;
     }
 }



Mime
View raw message