sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1724528 [13/15] - in /sis/branches/JDK6: ./ application/sis-console/src/main/artifact/bin/ application/sis-console/src/main/artifact/log/ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-build-helper/src/main/java/org...
Date Wed, 13 Jan 2016 23:25:42 GMT
Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractDbase3ByteReader.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -36,11 +36,11 @@ import org.apache.sis.internal.jdk7.Obje
  * @module
  */
 abstract class AbstractDbase3ByteReader extends CommonByteReader<SQLInvalidDbaseFileFormatException, SQLDbaseFileNotFoundException> implements Dbase3ByteReader {
-    /** Number of bytes in the header. */
-    protected short dbaseHeaderBytes;
+    /** First data record position, in bytes. */
+    protected short firstRecordPosition;
 
-    /** Number of bytes in the record. */
-    protected short dbaseRecordBytes;
+    /** Size of one record, in bytes. */
+    protected short recordLength;
 
     /** Reserved (dBASE IV) Filled with 00h. */
     protected byte[] reservedFiller1 = new byte[2];
@@ -89,9 +89,6 @@ abstract class AbstractDbase3ByteReader
     /** 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.
@@ -107,7 +104,7 @@ abstract class AbstractDbase3ByteReader
      * @return Charset.
      */
     @Override public Charset getCharset() {
-        return charset;
+        return this.charset;
     }
 
     /**
@@ -115,23 +112,31 @@ abstract class AbstractDbase3ByteReader
      * @return Date of the last update.
      */
     @Override public Date getDateOfLastUpdate() {
-        return toDate(dbaseLastUpdate);
+        return toDate(this.dbaseLastUpdate);
     }
-
+    
     /**
-     * Returns the record count.
-     * @return Record count.
+     * Returns the first record position, in bytes, in the DBase file.
+     * @return First record position.
      */
-    @Override public int getRowCount() {
-        return rowCount;
+    @Override public short getFirstRecordPosition() {
+        return this.firstRecordPosition;
     }
 
     /**
-     * Returns the current record number.
-     * @return Current record number.
+     * Returns the length (in bytes) of one record in this DBase file, including the delete flag. 
+     * @return Record length.
      */
-    @Override public int getRowNum() {
-        return rowNum;
+    @Override public short getRecordLength() {
+        return this.recordLength;
+    }
+    
+    /**
+     * Returns the record count.
+     * @return Record count.
+     */
+    @Override public int getRowCount() {
+        return this.rowCount;
     }
 
     /**

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -105,7 +105,7 @@ public abstract class AbstractJDBC exten
      * @param methodName The call the caller attempted.
      */
     public void logStep(final String methodName) {
-        format(Level.FINER, "log.step", methodName, getClass().getSimpleName());
+        log(Level.FINER, "log.step", methodName, getClass().getSimpleName());
     }
 
     /**
@@ -114,7 +114,9 @@ public abstract class AbstractJDBC exten
      * @param args Arguments that where sent to the unimplemented function.
      */
     public void logStep(final String methodName, Object... args) {
-        format(Level.FINER, "log.step_with_arguments", methodName, getClass().getSimpleName(), arguments(args));
+        if (isLoggable(Level.FINER)) { // Avoid resolution of arguments(...) if not needed.
+            log(Level.FINER, "log.step_with_arguments", methodName, getClass().getSimpleName(), arguments(args));
+        }
     }
 
     /**
@@ -122,7 +124,7 @@ public abstract class AbstractJDBC exten
      * @param methodName The call the caller attempted.
      */
     public void logUnsupportedOperation(final String methodName) {
-        format(Level.WARNING, "excp.unsupportedDriverFeature", getInterface(), methodName, getClass().getSimpleName());
+        log(Level.WARNING, "excp.unsupportedDriverFeature", getInterface(), methodName, getClass().getSimpleName());
     }
 
     /**
@@ -131,7 +133,7 @@ public abstract class AbstractJDBC exten
      * @param args Arguments that where sent to the unimplemented function.
      */
     public void logUnsupportedOperation(final String methodName, Object... args) {
-        format(Level.WARNING, "excp.unsupportedDriverFeature_with_arguments", getInterface(), methodName, getClass().getSimpleName(), arguments(args));
+        log(Level.WARNING, "excp.unsupportedDriverFeature_with_arguments", getInterface(), methodName, getClass().getSimpleName(), arguments(args));
     }
 
     /**

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/CommonByteReader.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -68,28 +68,28 @@ public abstract class CommonByteReader<I
      */
     public CommonByteReader(File f, Class<InvalidFormatException> invalidFormatException, Class<FNFException> fileNotFoundException) throws FNFException, InvalidFormatException {
         Objects.requireNonNull(f, "The file cannot be null.");
-        classInvalidFormatException = invalidFormatException;
-        classFNFException = fileNotFoundException;
+        this.classInvalidFormatException = invalidFormatException;
+        this.classFNFException = fileNotFoundException;
 
-        file = f;
+        this.file = f;
 
         try {
-            fis = new FileInputStream(file);
+            this.fis = new FileInputStream(this.file);
         }
         catch(FileNotFoundException e) {
-            throwException(classInvalidFormatException, e.getMessage(), e);
+            throwException(this.classInvalidFormatException, e.getMessage(), e);
             throw new RuntimeException("this place should not be reached.");
         }
 
-        fc = fis.getChannel();
+        this.fc = this.fis.getChannel();
 
         try {
-            int fsize = (int)fc.size();
-            byteBuffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fsize);
+            int fsize = (int)this.fc.size();
+            this.byteBuffer = this.fc.map(FileChannel.MapMode.READ_ONLY, 0, fsize);
         }
         catch(IOException e) {
-            String message = format(Level.WARNING, "excp.reader_cannot_be_created", file.getAbsolutePath(), e.getMessage());
-            throwException(classFNFException, message, e);
+            String message = format(Level.WARNING, "excp.reader_cannot_be_created", this.file.getAbsolutePath(), e.getMessage());
+            throwException(this.classFNFException, message, e);
             throw new RuntimeException("this place should not be reached.");
         }
    }
@@ -99,13 +99,13 @@ public abstract class CommonByteReader<I
      * @throws IOException if the close operation fails.
      */
     public void close() throws IOException {
-        if (fc != null)
-            fc.close();
+        if (this.fc != null)
+            this.fc.close();
 
-        if (fis != null)
-            fis.close();
+        if (this.fis != null)
+            this.fis.close();
 
-        isClosed = true;
+        this.isClosed = true;
     }
 
     /**
@@ -113,7 +113,7 @@ public abstract class CommonByteReader<I
      * @return true if it is closed.
      */
     public boolean isClosed() {
-        return isClosed;
+        return this.isClosed;
     }
 
     /**
@@ -121,7 +121,7 @@ public abstract class CommonByteReader<I
      * @return Byte Buffer.
      */
     public MappedByteBuffer getByteBuffer() {
-        return byteBuffer;
+        return this.byteBuffer;
     }
 
     /**
@@ -129,6 +129,6 @@ public abstract class CommonByteReader<I
      * @return File.
      */
     public File getFile() {
-        return file;
+        return this.file;
     }
 }

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBase3FieldDescriptor.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -20,6 +20,9 @@ import java.nio.MappedByteBuffer;
 
 import org.apache.sis.internal.shapefile.AutoChecker;
 
+// Branch-dependent imports
+import org.apache.sis.internal.jdk8.JDK8;
+
 
 /**
  * Field descriptor.
@@ -33,6 +36,9 @@ public class DBase3FieldDescriptor exten
     /** Field name. */
     private byte[] fieldName = new byte[11];
 
+    /** Field name as String, for performance issues. */
+    private String stringFieldName;
+
     /** Field type. */
     private DBaseDataType fieldType;
 
@@ -65,30 +71,30 @@ public class DBase3FieldDescriptor exten
      */
     public DBase3FieldDescriptor(MappedByteBuffer byteBuffer) {
         // Field name.
-        byteBuffer.get(fieldName);
+        byteBuffer.get(this.fieldName);
 
         // Field type.
         char dt = (char)byteBuffer.get();
-        fieldType = DBaseDataType.valueOfDataType(dt);
+        this.fieldType = DBaseDataType.valueOfDataType(dt);
 
         // Field address.
-        byteBuffer.get(fieldAddress);
+        byteBuffer.get(this.fieldAddress);
 
         // Length and scale.
-        fieldLength = byteBuffer.get();
-        fieldDecimalCount = byteBuffer.get();
+        this.fieldLength = byteBuffer.get();
+        this.fieldDecimalCount = byteBuffer.get();
 
         byteBuffer.getShort(); // reserved
 
-        byteBuffer.get(dbasePlusLanReserved2);
+        byteBuffer.get(this.dbasePlusLanReserved2);
 
         // Work area id.
-        workAreaID = byteBuffer.get();
+        this.workAreaID = byteBuffer.get();
 
-        byteBuffer.get(dbasePlusLanReserved3);
+        byteBuffer.get(this.dbasePlusLanReserved3);
 
         // Fields.
-        setFields = byteBuffer.get();
+        this.setFields = byteBuffer.get();
 
         byte[] data = new byte[6];
         byteBuffer.get(data); // reserved
@@ -115,11 +121,17 @@ public class DBase3FieldDescriptor exten
      * @return Field name.
      */
     public String getName() {
-        int length = fieldName.length;
-        while (length != 0 && fieldName[length - 1] <= ' ') {
-            length--;
+        // Converting bytes to String takes time. Only do that once.
+        if (this.stringFieldName == null) {
+            int length = this.fieldName.length;
+            while (length != 0 && JDK8.toUnsignedInt(this.fieldName[length - 1]) <= ' ') {
+                length--;
+            }
+
+            this.stringFieldName = new String(this.fieldName, 0, length);
         }
-        return new String(this.fieldName, 0, length);
+
+        return this.stringFieldName;
     }
 
     /**
@@ -127,7 +139,7 @@ public class DBase3FieldDescriptor exten
      * @return Data type.
      */
     public DBaseDataType getType() {
-        return(fieldType);
+        return(this.fieldType);
     }
 
     /**
@@ -135,7 +147,7 @@ public class DBase3FieldDescriptor exten
      */
     @Override
     public String toString() {
-        String text = format("toString", getName(), fieldType, fieldLength, fieldDecimalCount);
+        String text = format("toString", getName(), this.fieldType, JDK8.toUnsignedInt(this.fieldLength), JDK8.toUnsignedInt(this.fieldDecimalCount));
         return text;
     }
 }

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Dbase3ByteReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Dbase3ByteReader.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Dbase3ByteReader.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Dbase3ByteReader.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -85,8 +85,20 @@ public interface Dbase3ByteReader {
      * @return Date of the last update.
      */
     public Date getDateOfLastUpdate();
+    
+    /**
+     * Returns the first record position, in bytes, in the DBase file.
+     * @return First record position.
+     */
+    public short getFirstRecordPosition();
 
     /**
+     * Returns the length (in bytes) of one record in this DBase file, including the delete flag. 
+     * @return Record length.
+     */
+    public short getRecordLength();
+    
+    /**
      * Returns the record count.
      * @return Record count.
      */

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/MappedByteReader.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -28,6 +28,9 @@ import org.apache.sis.internal.shapefile
 import org.apache.sis.internal.shapefile.jdbc.resultset.SQLNoSuchFieldException;
 import org.opengis.feature.Feature;
 
+// Branch-dependent imports
+import org.apache.sis.internal.jdk8.JDK8;
+
 
 /**
  * Reader of a Database Binary content by the way of a {@link java.nio.MappedByteBuffer}
@@ -56,10 +59,9 @@ public class MappedByteReader extends Ab
         this.info = connectionInfos;
 
         // React to special features asked.
-        if (info != null) {
+        if (this.info != null) {
             // Sometimes, DBF files have a wrong charset, or more often : none, and you have to specify it.
-            String recordCharset = (String)info.get("record_charset");
-
+            String recordCharset = (String)this.info.get("record_charset");
             if (recordCharset != null) {
                 Charset cs = Charset.forName(recordCharset);
                 setCharset(cs);
@@ -78,20 +80,18 @@ public class MappedByteReader extends Ab
         getByteBuffer().get(); // denotes whether deleted or current
         // read first part of record
 
-        for (DBase3FieldDescriptor fd : fieldsDescriptors) {
+        for (DBase3FieldDescriptor fd : this.fieldsDescriptors) {
             byte[] data = new byte[fd.getLength()];
             getByteBuffer().get(data);
 
             int length = data.length;
-            while (length != 0 && data[length - 1] <= ' ') {
+            while (length != 0 && JDK8.toUnsignedInt(data[length - 1]) <= ' ') {
                 length--;
             }
 
             String value = new String(data, 0, length);
             feature.setPropertyValue(fd.getName(), value);
         }
-
-        rowNum ++;
     }
 
     /**
@@ -109,8 +109,7 @@ public class MappedByteReader extends Ab
         byte eofCheck = getByteBuffer().get();
 
         boolean isEOF = (eofCheck == 0x1A);
-        this.log(Level.FINER, "log.delete_status", rowNum, eofCheck, isEOF ? "EOF" : "Active");
-
+        this.log(Level.FINER, "log.delete_status", getRowNum(), eofCheck, isEOF ? "EOF" : "Active");
         if (eofCheck == 0x1A) {
             return false;
         }
@@ -123,6 +122,16 @@ public class MappedByteReader extends Ab
     }
 
     /**
+     * Returns the record number of the last record red.
+     * @return The record number.
+     */
+    @Override public int getRowNum() {
+        int position = getByteBuffer().position();
+        int recordNumber = (position - JDK8.toUnsignedInt(this.firstRecordPosition)) / JDK8.toUnsignedInt(this.recordLength);
+        return recordNumber;
+    }
+
+    /**
      * Read the next row as a set of objects.
      * @return Map of field name / object value.
      */
@@ -134,14 +143,13 @@ public class MappedByteReader extends Ab
         // read first part of record
         HashMap<String, byte[]> fieldsValues = new HashMap<String, byte[]>();
 
-        for (DBase3FieldDescriptor fd : fieldsDescriptors) {
+        for (DBase3FieldDescriptor fd : this.fieldsDescriptors) {
             byte[] data = new byte[fd.getLength()];
             getByteBuffer().get(data);
 
             // Trim the bytes right.
             int length = data.length;
-
-            while (length != 0 && data[length - 1] <= ' ') {
+            while (length != 0 && JDK8.toUnsignedInt(data[length - 1]) <= ' ') {
                 length--;
             }
 
@@ -159,7 +167,6 @@ public class MappedByteReader extends Ab
             }
         }
 
-        rowNum ++;
         return fieldsValues;
     }
 
@@ -174,16 +181,16 @@ public class MappedByteReader extends Ab
 
             getByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
             this.rowCount = getByteBuffer().getInt();
-            this.dbaseHeaderBytes = getByteBuffer().getShort();
-            this.dbaseRecordBytes = getByteBuffer().getShort();
+            this.firstRecordPosition = getByteBuffer().getShort();
+            this.recordLength = getByteBuffer().getShort();
             getByteBuffer().order(ByteOrder.BIG_ENDIAN);
 
-            getByteBuffer().get(reservedFiller1);
+            getByteBuffer().get(this.reservedFiller1);
             this.reservedIncompleteTransaction = getByteBuffer().get();
             this.reservedEncryptionFlag = getByteBuffer().get();
-            getByteBuffer().get(reservedFreeRecordThread);
-            getByteBuffer().get(reservedMultiUser);
-            reservedMDXFlag = getByteBuffer().get();
+            getByteBuffer().get(this.reservedFreeRecordThread);
+            getByteBuffer().get(this.reservedMultiUser);
+            this.reservedMDXFlag = getByteBuffer().get();
 
             // Translate code page value to a known charset.
             this.codePage = getByteBuffer().get();
@@ -194,16 +201,16 @@ public class MappedByteReader extends Ab
                 }
                 catch(UnsupportedCharsetException e) {
                     // Warn the caller that he will have to perform is own conversions.
-                    format(Level.WARNING, "log.no_valid_charset", getFile().getAbsolutePath(), e.getMessage());
+                    log(Level.WARNING, "log.no_valid_charset", getFile().getAbsolutePath(), e.getMessage());
                 }
             }
             else {
-                format(Level.INFO, "log.record_charset", this.charset.name());
+                log(Level.INFO, "log.record_charset", this.charset.name());
             }
 
-            getByteBuffer().get(reservedFiller2);
+            getByteBuffer().get(this.reservedFiller2);
 
-            while(getByteBuffer().position() < this.dbaseHeaderBytes - 1) {
+            while(getByteBuffer().position() < this.firstRecordPosition - 1) {
                 DBase3FieldDescriptor fd = new DBase3FieldDescriptor(getByteBuffer());
                 this.fieldsDescriptors.add(fd);
                 // loop until you hit the 0Dh field terminator
@@ -212,7 +219,7 @@ public class MappedByteReader extends Ab
             this.descriptorTerminator = getByteBuffer().get();
 
             // 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) {
+            if (this.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 SQLInvalidDbaseFileFormatException(message);
             }
@@ -233,7 +240,7 @@ public class MappedByteReader extends Ab
      */
     @Override
     public List<DBase3FieldDescriptor> getFieldsDescriptors() {
-        return fieldsDescriptors;
+        return this.fieldsDescriptors;
     }
 
     /**
@@ -253,7 +260,7 @@ public class MappedByteReader extends Ab
      */
     @Override
     public int getColumnCount() {
-        return fieldsDescriptors.size();
+        return this.fieldsDescriptors.size();
     }
 
     /**
@@ -273,8 +280,8 @@ public class MappedByteReader extends Ab
         }
 
         // Search the field among the fields descriptors.
-        for(int index=0; index < fieldsDescriptors.size(); index ++) {
-            if (fieldsDescriptors.get(index).getName().equals(columnLabel)) {
+        for(int index=0; index < this.fieldsDescriptors.size(); index ++) {
+            if (this.fieldsDescriptors.get(index).getName().equals(columnLabel)) {
                 return index + 1;
             }
         }
@@ -297,6 +304,6 @@ public class MappedByteReader extends Ab
             throw new SQLIllegalColumnIndexException(message, sql, getFile(), columnIndex);
         }
 
-        return fieldsDescriptors.get(columnIndex-1);
+        return this.fieldsDescriptors.get(columnIndex-1);
     }
 }

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLConnectionClosedException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLConnectionClosedException.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLConnectionClosedException.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/SQLConnectionClosedException.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -41,8 +41,8 @@ public class SQLConnectionClosedExceptio
      */
     public SQLConnectionClosedException(String message, String sqlStatement, File dbf) {
         super(message);
-        sql = sqlStatement;
-        database = dbf;
+        this.sql = sqlStatement;
+        this.database = dbf;
     }
 
     /**
@@ -50,7 +50,7 @@ public class SQLConnectionClosedExceptio
      * @return SQL statement or null.
      */
     public String getSQL() {
-        return sql;
+        return this.sql;
     }
 
     /**
@@ -58,6 +58,6 @@ public class SQLConnectionClosedExceptio
      * @return Database file.
      */
     public File getDatabase() {
-        return database;
+        return this.database;
     }
 }

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/AbstractConnection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/AbstractConnection.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/AbstractConnection.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/AbstractConnection.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -147,7 +147,7 @@ abstract class AbstractConnection extend
      */
     @Override
     public void setAutoCommit(boolean autoCommit) {
-        format(Level.FINE, "log.auto_commit_ignored", autoCommit);
+        log(Level.FINE, "log.auto_commit_ignored", autoCommit);
     }
 
     /**
@@ -155,7 +155,7 @@ abstract class AbstractConnection extend
      */
     @Override
     public void commit() {
-        format(Level.FINE, "log.commit_rollback_ignored");
+        log(Level.FINE, "log.commit_rollback_ignored");
     }
 
     /**
@@ -163,7 +163,7 @@ abstract class AbstractConnection extend
      */
     @Override
     public void rollback() {
-        format(Level.FINE, "log.commit_rollback_ignored");
+        log(Level.FINE, "log.commit_rollback_ignored");
     }
 
     /**

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/DBFConnection.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -66,9 +66,9 @@ public class DBFConnection extends Abstr
             throw new SQLDbaseFileNotFoundException(format(Level.WARNING, "excp.directory_not_expected", datafile.getAbsolutePath()));
         }
 
-       databaseFile = datafile;
-       byteReader = br;
-       format(Level.FINE, "log.database_connection_opened", databaseFile.getAbsolutePath(), "FIXME : column desc.");
+        this.databaseFile = datafile;
+        this.byteReader = br;
+        log(Level.FINE, "log.database_connection_opened", this.databaseFile.getAbsolutePath(), "FIXME : column desc.");
     }
 
     /**
@@ -82,13 +82,13 @@ public class DBFConnection extends Abstr
         try {
             // Check if all the underlying connections that has been opened with this connection has been closed.
             // If not, we log a warning to help the developper.
-            if (openedStatements.size() > 0) {
-                format(Level.WARNING, "log.statements_left_opened", openedStatements.size(), openedStatements.toString());
+            if (this.openedStatements.size() > 0) {
+                log(Level.WARNING, "log.statements_left_opened", this.openedStatements.size(), openedStatements.toString());
             }
 
-            byteReader.close();
+            this.byteReader.close();
         } catch (IOException e) {
-            format(Level.FINE, e.getMessage(), e);
+            log(Level.FINE, e.getMessage(), e);
         }
     }
 
@@ -101,7 +101,7 @@ public class DBFConnection extends Abstr
         assertNotClosed();
 
         DBFStatement stmt = new DBFStatement(this);
-        openedStatements.add(stmt);
+        this.openedStatements.add(stmt);
         return stmt;
     }
 
@@ -118,7 +118,7 @@ public class DBFConnection extends Abstr
      * @return Charset.
      */
     public Charset getCharset() {
-        return byteReader.getCharset();
+        return this.byteReader.getCharset();
     }
 
     /**
@@ -127,7 +127,7 @@ public class DBFConnection extends Abstr
      */
     @Override
     public File getFile() {
-        return databaseFile;
+        return this.databaseFile;
     }
 
     /**
@@ -152,7 +152,7 @@ public class DBFConnection extends Abstr
      */
     @Override
     public boolean isClosed() {
-        return byteReader.isClosed();
+        return this.byteReader.isClosed();
     }
 
     /**
@@ -190,7 +190,7 @@ public class DBFConnection extends Abstr
     public void notifyCloseStatement(DBFStatement stmt) {
         Objects.requireNonNull(stmt, "The statement notified being closed cannot be null.");
 
-        if (openedStatements.remove(stmt) == false) {
+        if (this.openedStatements.remove(stmt) == false) {
             throw new RuntimeException(format(Level.SEVERE, "assert.statement_not_opened_by_me", stmt, toString()));
         }
     }
@@ -204,7 +204,7 @@ public class DBFConnection extends Abstr
      * @throws SQLNoSuchFieldException if there is no field with this name in the query.
      */
     public int findColumn(String columnLabel, String sql) throws SQLNoSuchFieldException {
-        return byteReader.findColumn(columnLabel, sql);
+        return this.byteReader.findColumn(columnLabel, sql);
     }
 
     /**
@@ -212,7 +212,7 @@ public class DBFConnection extends Abstr
      * @return Column count.
      */
     public int getColumnCount() {
-        return byteReader.getColumnCount();
+        return this.byteReader.getColumnCount();
     }
 
     /**
@@ -242,7 +242,7 @@ public class DBFConnection extends Abstr
                 }
             }
         }
-        catch(SQLNoResultException e) {
+        catch(java.sql.SQLException e) {
             // if we run out of bound of the ResultSet, the boolean returned by next() has not been checked well, and it's an internal error.
             rs.close();
             throw new RuntimeException(e.getMessage(), e);
@@ -275,7 +275,7 @@ public class DBFConnection extends Abstr
             try {
                 rs.next();
             }
-            catch(SQLNoResultException e) {
+            catch(java.sql.SQLException e) {
                 // We encounter an internal API error in this case.
                 rs.close();
                 throw new RuntimeException(e.getMessage(), e);
@@ -290,7 +290,7 @@ public class DBFConnection extends Abstr
      * @return Fields descriptors.
      */
     public List<DBase3FieldDescriptor> getFieldsDescriptors() {
-        return byteReader.getFieldsDescriptors();
+        return this.byteReader.getFieldsDescriptors();
     }
 
     /**
@@ -301,7 +301,7 @@ public class DBFConnection extends Abstr
      * @throws SQLIllegalColumnIndexException if the index is out of bounds.
      */
     public String getFieldName(int columnIndex, String sql) throws SQLIllegalColumnIndexException {
-        return byteReader.getFieldName(columnIndex, sql);
+        return this.byteReader.getFieldName(columnIndex, sql);
     }
 
     /**
@@ -309,7 +309,7 @@ public class DBFConnection extends Abstr
      * @return true if a next row is available.
      */
     public boolean nextRowAvailable() {
-        return byteReader.nextRowAvailable();
+        return this.byteReader.nextRowAvailable();
     }
 
     /**
@@ -317,7 +317,15 @@ public class DBFConnection extends Abstr
      * @return Map of field name / object value, or null if EoF has been encountered.
      */
     public Map<String, byte[]> readNextRowAsObjects() {
-        return byteReader.readNextRowAsObjects();
+        return this.byteReader.readNextRowAsObjects();
+    }
+
+    /**
+     * Returns the record number of the last record red.
+     * @return The record number.
+     */
+    public int getRowNum() {
+        return this.byteReader.getRowNum();
     }
 
     /**
@@ -325,6 +333,6 @@ public class DBFConnection extends Abstr
      */
     @Override
     public String toString() {
-        return format("toString", databaseFile.getAbsolutePath(), isClosed() == false);
+        return format("toString", this.databaseFile.getAbsolutePath(), isClosed() == false);
     }
 }

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/SQLClosingIOFailureException.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/SQLClosingIOFailureException.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/SQLClosingIOFailureException.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/connection/SQLClosingIOFailureException.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -41,8 +41,8 @@ public class SQLClosingIOFailureExceptio
      */
     public SQLClosingIOFailureException(String message, String sqlStatement, File dbf) {
         super(message);
-        sql = sqlStatement;
-        database = dbf;
+        this.sql = sqlStatement;
+        this.database = dbf;
     }
 
     /**
@@ -50,7 +50,7 @@ public class SQLClosingIOFailureExceptio
      * @return SQL statement or null.
      */
     public String getSQL() {
-        return sql;
+        return this.sql;
     }
 
     /**
@@ -58,6 +58,6 @@ public class SQLClosingIOFailureExceptio
      * @return Database file.
      */
     public File getDatabase() {
-        return database;
+        return this.database;
     }
 }

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFDatabaseMetaData.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFDatabaseMetaData.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFDatabaseMetaData.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFDatabaseMetaData.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -43,7 +43,7 @@ public class DBFDatabaseMetaData extends
      */
     public DBFDatabaseMetaData(DBFConnection cnt) {
         Objects.requireNonNull(cnt, "The database connection used to create Database metadata cannot be null.");
-        connection = cnt;
+        this.connection = cnt;
     }
 
     /**
@@ -76,9 +76,9 @@ public class DBFDatabaseMetaData extends
      */
     @Override
     public ResultSet getColumns(@SuppressWarnings("unused") String catalog, @SuppressWarnings("unused") String schemaPattern, @SuppressWarnings("unused") String tableNamePattern, @SuppressWarnings("unused") String columnNamePattern) throws SQLConnectionClosedException {
-        DBFStatement stmt = (DBFStatement)connection.createStatement();
+        DBFStatement stmt = (DBFStatement)this.connection.createStatement();
         try {
-            return new DBFBuiltInMemoryResultSetForColumnsListing(stmt, connection.getFieldsDescriptors());
+            return new DBFBuiltInMemoryResultSetForColumnsListing(stmt, this.connection.getFieldsDescriptors());
         } finally {
             stmt.close();
         }
@@ -90,7 +90,7 @@ public class DBFDatabaseMetaData extends
      */
     @Override
     public File getFile() {
-        return connection.getFile();
+        return this.connection.getFile();
     }
 
     /**
@@ -1019,7 +1019,7 @@ public class DBFDatabaseMetaData extends
     @Override public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) {
         logStep("getTables", catalog, schemaPattern, tableNamePattern, types != null ? Arrays.asList(types) : null);
 
-        DBFStatement stmt = new DBFStatement(connection);
+        DBFStatement stmt = new DBFStatement(this.connection);
         DBFBuiltInMemoryResultSetForTablesListing tables = new DBFBuiltInMemoryResultSetForTablesListing(stmt);
         stmt.registerResultSet(tables);
         return tables;
@@ -1032,7 +1032,7 @@ public class DBFDatabaseMetaData extends
     @Override public ResultSet getSchemas() {
         logStep("getSchemas");
 
-        DBFStatement stmt = new DBFStatement(connection);
+        DBFStatement stmt = new DBFStatement(this.connection);
         DBFBuiltInMemoryResultSetForSchemaListing schemas = new DBFBuiltInMemoryResultSetForSchemaListing(stmt);
         stmt.registerResultSet(schemas);
         return schemas;
@@ -1045,7 +1045,7 @@ public class DBFDatabaseMetaData extends
     @Override public ResultSet getCatalogs() {
         logStep("getCatalogs");
 
-        DBFStatement stmt = new DBFStatement(connection);
+        DBFStatement stmt = new DBFStatement(this.connection);
         DBFBuiltInMemoryResultSetForCatalogNamesListing catalogNames = new DBFBuiltInMemoryResultSetForCatalogNamesListing(stmt);
         stmt.registerResultSet(catalogNames);
         return catalogNames;
@@ -1058,7 +1058,7 @@ public class DBFDatabaseMetaData extends
     @Override public ResultSet getTableTypes() {
         logStep("getTableTypes");
 
-        DBFStatement stmt = new DBFStatement(connection);
+        DBFStatement stmt = new DBFStatement(this.connection);
         DBFBuiltInMemoryResultSetForTablesTypesListing tablesTypes = new DBFBuiltInMemoryResultSetForTablesTypesListing(stmt);
         stmt.registerResultSet(tablesTypes);
         return tablesTypes;
@@ -1174,7 +1174,7 @@ public class DBFDatabaseMetaData extends
      */
     @Override public Connection getConnection() {
         logStep("getConnection");
-        return connection;
+        return this.connection;
     }
 
     /**

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFResultSetMataData.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFResultSetMataData.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFResultSetMataData.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/metadata/DBFResultSetMataData.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -49,10 +49,10 @@ public class DBFResultSetMataData extend
      */
     public DBFResultSetMataData(DBFRecordBasedResultSet resultset) {
         Objects.requireNonNull(resultset, "A non null ResultSet is required.");
-        rs = resultset;
+        this.rs = resultset;
 
         try {
-            metadata = (DBFDatabaseMetaData)resultset.getStatement().getConnection().getMetaData();
+            this.metadata = (DBFDatabaseMetaData)resultset.getStatement().getConnection().getMetaData();
         }
         catch(SQLException e) {
             throw new RuntimeException(e.getMessage(), e);
@@ -82,7 +82,7 @@ public class DBFResultSetMataData extend
     @SuppressWarnings("resource") // The current connection is only used and has not to be closed.
     @Override public int getColumnCount() throws SQLConnectionClosedException {
         logStep("getColumnCount");
-        DBFConnection cnt = (DBFConnection)(((DBFStatement)rs.getStatement()).getConnection());
+        DBFConnection cnt = (DBFConnection)(((DBFStatement)this.rs.getStatement()).getConnection());
 
         return cnt.getColumnCount();
     }
@@ -307,7 +307,7 @@ public class DBFResultSetMataData extend
         logStep("getTableName", column);
 
         // The table default to the file name (without its extension .dbf).
-        String fileName = rs.getFile().getName();
+        String fileName = this.rs.getFile().getName();
         int indexDBF = fileName.lastIndexOf(".");
         String tableName = fileName.substring(0, indexDBF);
 
@@ -468,7 +468,7 @@ public class DBFResultSetMataData extend
      */
     @Override
     protected File getFile() {
-        return rs.getFile();
+        return this.rs.getFile();
     }
 
     /**
@@ -479,12 +479,12 @@ public class DBFResultSetMataData extend
      * @throws SQLConnectionClosedException if the underlying connection is closed.
      */
     private DBFBuiltInMemoryResultSetForColumnsListing desc(int column) throws SQLIllegalColumnIndexException, SQLConnectionClosedException {
-        DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = (DBFBuiltInMemoryResultSetForColumnsListing)metadata.getColumns(null, null, null, null);
+        DBFBuiltInMemoryResultSetForColumnsListing rsDatabase = (DBFBuiltInMemoryResultSetForColumnsListing)this.metadata.getColumns(null, null, null, null);
 
         if (column > getColumnCount()) {
             rsDatabase.close();
             String message = format(Level.WARNING, "excp.illegal_column_index_metadata", column, getColumnCount());
-            throw new SQLIllegalColumnIndexException(message, rs.getSQL(), getFile(), column);
+            throw new SQLIllegalColumnIndexException(message, this.rs.getSQL(), getFile(), column);
         }
 
         // TODO Implements ResultSet:absolute(int) instead.
@@ -492,7 +492,7 @@ public class DBFResultSetMataData extend
             try {
                 rsDatabase.next();
             }
-            catch(SQLNoResultException e) {
+            catch(java.sql.SQLException e) {
                 // We encounter an internal API error in this case.
                 rsDatabase.close();
                 String message = format(Level.SEVERE, "assert.less_column_in_metadata_than_expected", column, getColumnCount());

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/BuiltInMemoryResultSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/BuiltInMemoryResultSet.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/BuiltInMemoryResultSet.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/BuiltInMemoryResultSet.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -55,7 +55,7 @@ public abstract class BuiltInMemoryResul
      */
     @Override
     public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
-        return getBigDecimal(getFieldName(columnIndex, sql));
+        return getBigDecimal(getFieldName(columnIndex, this.sql));
     }
 
     /**
@@ -71,7 +71,7 @@ public abstract class BuiltInMemoryResul
      */
     @Override
     public Date getDate(int columnIndex) throws SQLException {
-        return getDate(getFieldName(columnIndex, sql));
+        return getDate(getFieldName(columnIndex, this.sql));
     }
 
     /**
@@ -95,7 +95,7 @@ public abstract class BuiltInMemoryResul
      */
     @Override
     public double getDouble(int columnIndex) throws SQLException {
-        return getDouble(getFieldName(columnIndex, sql));
+        return getDouble(getFieldName(columnIndex, this.sql));
     }
 
     /**
@@ -103,7 +103,7 @@ public abstract class BuiltInMemoryResul
      */
     @Override
     public float getFloat(int columnIndex) throws SQLException {
-        return getFloat(getFieldName(columnIndex, sql));
+        return getFloat(getFieldName(columnIndex, this.sql));
     }
 
     /**
@@ -127,7 +127,7 @@ public abstract class BuiltInMemoryResul
      */
     @Override
     public int getInt(int columnIndex) throws SQLException {
-        return getInt(getFieldName(columnIndex, sql));
+        return getInt(getFieldName(columnIndex, this.sql));
     }
 
     /**
@@ -141,7 +141,7 @@ public abstract class BuiltInMemoryResul
      * @see java.sql.ResultSet#getLong(int)
      */
     @Override public long getLong(int columnIndex) throws SQLException {
-        return getLong(getFieldName(columnIndex, sql));
+        return getLong(getFieldName(columnIndex, this.sql));
     }
 
     /**
@@ -156,7 +156,7 @@ public abstract class BuiltInMemoryResul
      */
     @Override
     public short getShort(int columnIndex) throws SQLException {
-        return getShort(getFieldName(columnIndex, sql));
+        return getShort(getFieldName(columnIndex, this.sql));
     }
 
     /**
@@ -171,7 +171,7 @@ public abstract class BuiltInMemoryResul
      */
     @Override
     public String getString(int columnIndex) throws SQLException {
-        return(getString(getFieldName(columnIndex, sql)));
+        return(getString(getFieldName(columnIndex, this.sql)));
     }
 
     /**

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForColumnsListing.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -50,7 +50,7 @@ public class DBFBuiltInMemoryResultSetFo
      */
     public DBFBuiltInMemoryResultSetForColumnsListing(DBFStatement stmt, List<DBase3FieldDescriptor> fieldsDescriptors) {
         super(stmt, "driver list columns in this DBase 3 file");
-        itDescriptor = fieldsDescriptors.iterator();
+        this.itDescriptor = fieldsDescriptors.iterator();
     }
 
     /**
@@ -60,98 +60,103 @@ public class DBFBuiltInMemoryResultSetFo
     @Override public String getString(String columnLabel) throws SQLNoSuchFieldException {
         logStep("getString", columnLabel);
 
-        // String => table name
-        if (columnLabel.equals("TABLE_NAME")) {
-            String tableName = getTableName();
-            wasNull = (tableName == null);
-            return tableName;
-        }
+        {   // On the JDK7 branch, this is a switch on strings.
+            // String => table name
+            if (columnLabel.equals("TABLE_NAME")) {
+                String tableName = getTableName();
+                this.wasNull = (tableName == null);
+                return tableName;
+            }
 
-        // String => column name
-        if (columnLabel.equals("COLUMN_NAME")) {
-            String columnName = current.getName();
-            wasNull = (columnName == null);
-            return columnName;
-        }
+            // String => column name
+            else if (columnLabel.equals("COLUMN_NAME")) {
+                String columnName = this.current.getName();
+                this.wasNull = (columnName == null);
+                return columnName;
+            }
 
-        // String => Data source dependent type name, for a UDT the type name is fully qualified
-        if (columnLabel.equals("TYPE_NAME")) {
-            String typeName = current.getType() != null ? toColumnTypeName() : null;
-            wasNull = (typeName == null);
-            return typeName;
-        }
+            // String => Data source dependent type name, for a UDT the type name is fully qualified
+            else if (columnLabel.equals("TYPE_NAME")) {
+                String typeName = this.current.getType() != null ? toColumnTypeName() : null;
+                this.wasNull = (typeName == null);
+                return typeName;
+            }
 
-        /**
-         * Columns responding to features that aren't handled by DBase 3.
-         * and return always a default value NULL or "NO"...
-         */
-
-        // String => table catalog (may be null)
-        if (columnLabel.equals("TABLE_CAT")) {
-            wasNull = true;
-            return null;
-        }
+            /**
+             * Columns responding to features that aren't handled by DBase 3.
+             * and return always a default value NULL or "NO"...
+             */
+
+            // String => table catalog (may be null)
+            else if (columnLabel.equals("TABLE_CAT")) {
+                this.wasNull = true;
+                return null;
+            }
 
-        // String => table schema (may be null)
-        if (columnLabel.equals("TABLE_SCHEM")) {
-            wasNull = true;
-            return null;
-        }
+            // String => table schema (may be null)
+            else if (columnLabel.equals("TABLE_SCHEM")) {
+                this.wasNull = true;
+                return null;
+            }
 
-        // String => comment describing column (may be null)
-        if (columnLabel.equals("REMARKS")) {
-            wasNull = true;
-            return null;
-        }
-        // String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null)
-        if (columnLabel.equals("COLUMN_DEF")) {
-            wasNull = true;
-            return null;
-        }
+            // String => comment describing column (may be null)
+            else if (columnLabel.equals("REMARKS")) {
+                this.wasNull = true;
+                return null;
+            }
 
-        // String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
-        if (columnLabel.equals("SCOPE_CATALOG")) {
-            wasNull = true;
-            return null;
-        }
+            // String => default value for the column, which should be interpreted as a string when the value is enclosed in single quotes (may be null)
+            else if (columnLabel.equals("COLUMN_DEF")) {
+                this.wasNull = true;
+                return null;
+            }
 
-        // String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
-        if (columnLabel.equals("SCOPE_SCHEMA")) {
-            wasNull = true;
-            return null;
-        }
+            // String => catalog of table that is the scope of a reference attribute (null if DATA_TYPE isn't REF)
+            else if (columnLabel.equals("SCOPE_CATALOG")) {
+                this.wasNull = true;
+                return null;
+            }
 
-        // String => table name that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)
-        if (columnLabel.equals("SCOPE_TABLE")) {
-            wasNull = true;
-            return null;
-        }
+            // String => schema of table that is the scope of a reference attribute (null if the DATA_TYPE isn't REF)
+            else if (columnLabel.equals("SCOPE_SCHEMA")) {
+                this.wasNull = true;
+                return null;
+            }
 
-        /**
-         * String => Indicates whether this column is auto incremented
-         * YES --- if the column is auto incremented
-         * NO --- if the column is not auto incremented
-         * empty string --- if it cannot be determined whether the column is auto incremented
-         */
-        if (columnLabel.equals("IS_AUTOINCREMENT")) {
-            wasNull = false;
-            return "NO";
-        }
+            // String => table name that this the scope of a reference attribute (null if the DATA_TYPE isn't REF)
+            else if (columnLabel.equals("SCOPE_TABLE")) {
+                this.wasNull = true;
+                return null;
+            }
 
-        /**
-         * String => Indicates whether this is a generated column
-         * YES --- if this a generated column
-         * NO --- if this not a generated column
-         * empty string --- if it cannot be determined whether this is a generated column
-         */
-        if (columnLabel.equals("IS_GENERATEDCOLUMN")) {
-            wasNull = false;
-            return "NO";
-        }
+            /**
+             * String => Indicates whether this column is auto incremented
+             * YES --- if the column is auto incremented
+             * NO --- if the column is not auto incremented
+             * empty string --- if it cannot be determined whether the column is auto incremented
+             */
+            else if (columnLabel.equals("IS_AUTOINCREMENT")) {
+                this.wasNull = false;
+                return "NO";
+            }
+
+            /**
+             * String => Indicates whether this is a generated column
+             * YES --- if this a generated column
+             * NO --- if this not a generated column
+             * empty string --- if it cannot be determined whether this is a generated column
+             */
+            else if (columnLabel.equals("IS_GENERATEDCOLUMN")) {
+                this.wasNull = false;
+                return "NO";
+            }
 
-        // Attempt to load it from an Integer column and convert it.
-        int value = getInt(columnLabel);
-        return MessageFormat.format("{0,number,#0}", value); // Remove decimal separators.
+            else {
+                // Attempt to load it from an Integer column and convert it.
+                int value = getInt(columnLabel);
+                return MessageFormat.format("{0,number,#0}", value); // Remove decimal separators.
+            }
+        }
     }
 
     /**
@@ -161,104 +166,108 @@ public class DBFBuiltInMemoryResultSetFo
     @Override public int getInt(String columnLabel) throws SQLNoSuchFieldException {
         logStep("getInt", columnLabel);
 
-        // int => SQL type from java.sql.Types
-        if (columnLabel.equals("DATA_TYPE")) {
-            wasNull = false;
-            return toSQLDataType();
-        }
+        {   // On the JDK7 branch, this is a switch on strings.
+            // int => SQL type from java.sql.Types
+            if (columnLabel.equals("DATA_TYPE")) {
+                this.wasNull = false;
+                return toSQLDataType();
+            }
 
-        // int => column size.
-        if (columnLabel.equals("COLUMN_SIZE")) {
-            wasNull = false;
-            return toPrecision();
-        }
+            // int => column size.
+            else if (columnLabel.equals("COLUMN_SIZE")) {
+                this.wasNull = false;
+                return toPrecision();
+            }
 
-        // int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable.
-        if (columnLabel.equals("DECIMAL_DIGITS")) {
-            int scale = toScale();
-            wasNull = toScale() == -1;
-            return scale == -1 ? 0 : scale;
-        }
+            // int => the number of fractional digits. Null is returned for data types where DECIMAL_DIGITS is not applicable.
+            else if (columnLabel.equals("DECIMAL_DIGITS")) {
+                int scale = toScale();
+                this.wasNull = toScale() == -1;
+                return scale == -1 ? 0 : scale;
+            }
 
-        // int => Radix (typically either 10 or 2)
-        if (columnLabel.equals("NUM_PREC_RADIX")) {
-            return 10;
-        }
+            // int => Radix (typically either 10 or 2)
+            else if (columnLabel.equals("NUM_PREC_RADIX")) {
+                return 10;
+            }
 
-        /**
-         * int => is NULL allowed.
-         * columnNoNulls - might not allow NULL values
-         * columnNullable - definitely allows NULL values
-         * columnNullableUnknown - nullability unknown
-         */
-        if (columnLabel.equals("NULLABLE")) {
-            wasNull = false;
-            return DatabaseMetaData.columnNullableUnknown;
-        }
+            /**
+             * int => is NULL allowed.
+             * columnNoNulls - might not allow NULL values
+             * columnNullable - definitely allows NULL values
+             * columnNullableUnknown - nullability unknown
+             */
+            else if (columnLabel.equals("NULLABLE")) {
+                this.wasNull = false;
+                return DatabaseMetaData.columnNullableUnknown;
+            }
 
-        // int => unused
-        if (columnLabel.equals("SQL_DATA_TYPE")) {
-            wasNull = false;
-            return toSQLDataType();
-        }
+            // int => unused
+            else if (columnLabel.equals("SQL_DATA_TYPE")) {
+                this.wasNull = false;
+                return toSQLDataType();
+            }
 
-        // int => for char types the maximum number of bytes in the column
-        if (columnLabel.equals("CHAR_OCTET_LENGTH")) {
-            if (toSQLDataType() == Types.CHAR) {
-                return toPrecision();
+            // int => for char types the maximum number of bytes in the column
+            else if (columnLabel.equals("CHAR_OCTET_LENGTH")) {
+                if (toSQLDataType() == Types.CHAR) {
+                    return toPrecision();
+                }
+
+                return 0;
             }
 
-            return 0;
-        }
+            // int => index of column in table (starting at 1)
+            else if (columnLabel.equals("ORDINAL_POSITION")) {
+                return this.columnIndex;
+            }
 
-        // int => index of column in table (starting at 1)
-        if (columnLabel.equals("ORDINAL_POSITION")) {
-            return columnIndex;
-        }
+            /**
+             * Columns responding to features that aren't handled by DBase 3.
+             * and return always a default value NULL or "NO"...
+             */
+
+            // short => source type of a distinct type or user-generated Ref type, SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)
+            else if (columnLabel.equals("SOURCE_DATA_TYPE")) {
+                this.wasNull = true;
+                return 0;
+            }
 
-        /**
-         * Columns responding to features that aren't handled by DBase 3.
-         * and return always a default value NULL or "NO"...
-         */
-
-        // short => source type of a distinct type or user-generated Ref type, SQL type from java.sql.Types (null if DATA_TYPE isn't DISTINCT or user-generated REF)
-        if (columnLabel.equals("SOURCE_DATA_TYPE")) {
-            wasNull = true;
-            return 0;
-        }
+            // is not used.
+            else if (columnLabel.equals("BUFFER_LENGTH")) {
+                this.wasNull = false;
+                return 0;
+            }
 
-        // is not used.
-        if (columnLabel.equals("BUFFER_LENGTH")) {
-            wasNull = false;
-            return 0;
-        }
+            // int => unused
+            else if (columnLabel.equals("SQL_DATETIME_SUB")) {
+                this.wasNull = false;
+                return 0;
+            }
 
-        // int => unused
-        if (columnLabel.equals("SQL_DATETIME_SUB")) {
-            wasNull = false;
-            return 0;
+            else {
+                // FIXME : this function is not perfect. It a column label is given that refers to a field described in getString(..) this function
+                // will tell that the field doesn't exist. It's not true : the field is not numeric. But as getString(..) defaults to getInt(...),
+                // getInt(..) cannot default to getString(..), else the function will run in a cycle.
+                String message = format(Level.WARNING, "excp.no_desc_field", columnLabel, getTableName());
+                throw new SQLNoSuchFieldException(message, "asking columns desc", getFile(), columnLabel);
+            }
         }
-
-        // FIXME : this function is not perfect. It a column label is given that refers to a field described in getString(..) this function
-        // will tell that the field doesn't exist. It's not true : the field is not numeric. But as getString(..) defaults to getInt(...),
-        // getInt(..) cannot default to getString(..), else the function will run in a cycle.
-        String message = format(Level.WARNING, "excp.no_desc_field", columnLabel, getTableName());
-        throw new SQLNoSuchFieldException(message, "asking columns desc", getFile(), columnLabel);
     }
 
     /**
      * @see java.sql.ResultSet#next()
      */
     @Override public boolean next() throws SQLNoResultException {
-        if (itDescriptor.hasNext()) {
-            current = itDescriptor.next();
-            columnIndex ++;
+        if (this.itDescriptor.hasNext()) {
+            this.current = this.itDescriptor.next();
+            this.columnIndex ++;
             return true;
         }
         else {
-            if (afterLast) {
+            if (this.afterLast) {
                 // The ResultSet has no more records and has been call one time too much.
-                afterLast = true;
+                this.afterLast = true;
 
                 String message = format(Level.WARNING, "excp.no_more_desc", getTableName());
                 throw new SQLNoResultException(message, "asking columns desc", getFile());
@@ -274,7 +283,7 @@ public class DBFBuiltInMemoryResultSetFo
      * @return SQL Datatype.
      */
     private int toSQLDataType() {
-        switch(current.getType()) {
+        switch(this.current.getType()) {
             case AutoIncrement:
                 return Types.INTEGER;
 
@@ -330,7 +339,7 @@ public class DBFBuiltInMemoryResultSetFo
      * @return Column type name.
      */
     private String toColumnTypeName() {
-        switch(current.getType()) {
+        switch(this.current.getType()) {
             case AutoIncrement:
                 return "AUTO_INCREMENT";
 
@@ -386,11 +395,11 @@ public class DBFBuiltInMemoryResultSetFo
      * @return Precision of the current field.
      */
     public int toPrecision() {
-        switch(current.getType()) {
+        switch(this.current.getType()) {
             case AutoIncrement:
             case Character:
             case Integer:
-               return current.getLength();
+               return this.current.getLength();
 
             case Date:
                 return 8;
@@ -398,7 +407,7 @@ public class DBFBuiltInMemoryResultSetFo
             case Double:
             case FloatingPoint:
             case Number:
-                return current.getLength();
+                return this.current.getLength();
 
             case Logical:
                 return 0;
@@ -406,7 +415,7 @@ public class DBFBuiltInMemoryResultSetFo
             case Currency:
             case DateTime:
             case TimeStamp:
-                return current.getLength();
+                return this.current.getLength();
 
             case Memo:
             case Picture:
@@ -415,7 +424,7 @@ public class DBFBuiltInMemoryResultSetFo
                 return 0;
 
             default:
-                return current.getLength();
+                return this.current.getLength();
         }
     }
 
@@ -424,7 +433,7 @@ public class DBFBuiltInMemoryResultSetFo
      * @return Scale of the current field, -1 means : this field is not numeric.
      */
     private int toScale() {
-        switch(current.getType()) {
+        switch(this.current.getType()) {
             case AutoIncrement:
             case Logical:
                 return 0;
@@ -434,7 +443,7 @@ public class DBFBuiltInMemoryResultSetFo
             case FloatingPoint:
             case Number:
             case Currency:
-                return current.getDecimalCount();
+                return this.current.getDecimalCount();
 
             case Character:
             case Date:

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesListing.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -42,31 +42,36 @@ public class DBFBuiltInMemoryResultSetFo
     @Override public String getString(String columnLabel) {
         logStep("getString", columnLabel);
 
-        if (columnLabel.equals("TABLE_NAME"))                // String => table name.
-        {
-            String tableName = getTableName();
-            wasNull = (tableName == null);
-            return tableName;
-        }
+        {   // On the JDK7 branch, this is a switch on strings.
+            if (columnLabel.equals("TABLE_NAME"))                // String => table name.
+            {
+                String tableName = getTableName();
+                this.wasNull = (tableName == null);
+                return tableName;
+            }
 
-        if (columnLabel.equals("TABLE_TYPE")) {              // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
-            wasNull = false;
-            return "TABLE";
-        }
-        if (columnLabel.equals("TYPE_NAME") ||                 // String => type name (may be null)
-            columnLabel.equals("TABLE_CAT") ||                 // String => table catalog (may be null)
-            columnLabel.equals("TABLE_SCHEM") ||               // String => table schema (may be null)
-            columnLabel.equals("REMARKS") ||                   // String => explanatory comment on the table
-            columnLabel.equals("TYPE_CAT") ||                  // String => the types catalog (may be null)
-            columnLabel.equals("TYPE_SCHEM") ||                // String => the types schema (may be null)
-            columnLabel.equals("SELF_REFERENCING_COL_NAME") || // String => name of the designated "identifier" column of a typed table (may be null)
-            columnLabel.equals("REF_GENERATION"))            // String => specifies how values in SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be null)
-        {
-            wasNull = true;
-            return null;
+            else if (columnLabel.equals("TABLE_TYPE")) {             // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
+                this.wasNull = false;
+                return "TABLE";
+            }
+
+            else if (columnLabel.equals("TYPE_NAME")                 // String => type name (may be null)
+                  || columnLabel.equals("TABLE_CAT")                 // String => table catalog (may be null)
+                  || columnLabel.equals("TABLE_SCHEM")               // String => table schema (may be null)
+                  || columnLabel.equals("REMARKS")                   // String => explanatory comment on the table
+                  || columnLabel.equals("TYPE_CAT")                  // String => the types catalog (may be null)
+                  || columnLabel.equals("TYPE_SCHEM")                // String => the types schema (may be null)
+                  || columnLabel.equals("SELF_REFERENCING_COL_NAME") // String => name of the designated "identifier" column of a typed table (may be null)
+                  || columnLabel.equals("REF_GENERATION")) {         // String => specifies how values in SELF_REFERENCING_COL_NAME are created. Values are "SYSTEM", "USER", "DERIVED". (may be null)
+                this.wasNull = true;
+                return null;
+            }
+
+            else {
+                this.wasNull = true;
+                return null;
+            }
         }
-        wasNull = true;
-        return null;
     }
 
     /**
@@ -76,11 +81,11 @@ public class DBFBuiltInMemoryResultSetFo
     {
         logStep("next");
 
-        if (index > 1) {
+        if (this.index > 1) {
             throw new SQLNoResultException(format(Level.WARNING, "excp.only_one_table_per_dbf"), "Driver manager asks for table listing", getFile());
         }
 
-        index ++;
-        return (index == 1) ? true : false;
+        this.index ++;
+        return (this.index == 1) ? true : false;
     }
 }

Modified: sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java?rev=1724528&r1=1724527&r2=1724528&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java [UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/resultset/DBFBuiltInMemoryResultSetForTablesTypesListing.java [UTF-8] Wed Jan 13 23:25:38 2016
@@ -42,16 +42,22 @@ public class DBFBuiltInMemoryResultSetFo
     @Override public String getString(String columnLabel) {
         logStep("getString", columnLabel);
 
-        if (columnLabel.equals("OBJECTID")) {         // FIXME Documentation of ObjectId for geTabletTypes() has not been found. What are the rules about this field ?
-            wasNull = false;
-            return "1";
-        }
-        if (columnLabel.equals("TABLE_TYPE")) {       // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
-            wasNull = false;
-            return "TABLE";               // and DBase 3 only knows tables.
+        {   // On the JDK7 branch, this is a switch on strings.
+            if (columnLabel.equals("OBJECTID")) {    // FIXME Documentation of ObjectId for geTabletTypes() has not been found. What are the rules about this field ?
+                this.wasNull = false;
+                return "1";
+            }
+
+            else if (columnLabel.equals("TABLE_TYPE")) {         // String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
+                this.wasNull = false;
+                return "TABLE";               // and DBase 3 only knows tables.
+            }
+
+            else {
+                this.wasNull = true;
+                return null;
+            }
         }
-        wasNull = true;
-        return null;
     }
 
     /**
@@ -61,11 +67,11 @@ public class DBFBuiltInMemoryResultSetFo
     {
         logStep("next");
 
-        if (index > 1) {
+        if (this.index > 1) {
             throw new SQLNoResultException(format(Level.WARNING, "excp.only_one_table_type_handled"), "Driver manager asks for table types listing", getFile());
         }
 
-        index ++;
-        return (index == 1) ? true : false;
+        this.index ++;
+        return (this.index == 1) ? true : false;
     }
 }



Mime
View raw message