From bd210ee7438fd203c19d3e8080ea12b79fe56159 Mon Sep 17 00:00:00 2001
From: ?? ? <ulysseskao@ximple.com.tw>
Date: Mon, 09 Jun 2008 17:19:15 +0800
Subject: [PATCH] update for EOFM-117

---
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleDatabaseJob.java                            |   20 
 .gitattributes                                                                                                           |   12 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java     |    1 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java           |  319 +
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Element.java                                                      |   36 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java       |   21 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWDDatumConverter.java                                    |  191 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java                                                 |   65 
 xdgnjobs/ximple-spatialjob/pom.xml                                                                                       |    9 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java     |  522 ++
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java     |    1 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java    |   13 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ColorTableMapping.java                                    |    3 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java         |  294 +
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java      |   44 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWD97GeometryConverterDecorator.java                      |    3 
 xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/OracleTarget.java                                                 |   19 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2MySQLJob.java                            | 1089 ++++
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ElementType.java                                                  |   56 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java       |    4 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2OraSDOJob.java                           |  284 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java                              |    4 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java   |   53 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextElement.java                                                  |    1 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/DefaultColorTable.java                                    |   71 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java   |  303 +
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java     |  267 +
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java                          |   58 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java         |  320 +
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java       |  320 +
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnFileJobContext.java                    |    2 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java                               |    2 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java        |   52 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java  |    1 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java       |  268 +
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java       |   11 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Lock.java                                                         |   10 
 xdgnjobs/ximple-jobcarrier/pom.xml                                                                                       |    9 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/PrintfFormat.java                                                    | 1194 ++--
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java           |   47 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextNodeElement.java                                              |    4 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleJobContext.java                     |   10 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/UserAttributeData.java                                            |    2 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java     |   46 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/FrammeAttributeData.java                                          |    2 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java       |  521 ++
 xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java                                    |    2 
 xdgnjobs/pom.xml                                                                                                         |    6 
 xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7fileReaderTest.java                                           |    3 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TPCLIDConverter.java                                      |    2 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/StreamLogging.java                                                |    4 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java     |  304 +
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java                                             |    2 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileReader.java                                               |  106 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileHeader.java                                               |    6 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java   |    7 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/GeomUtil.java                                             |    2 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java                                                  |    8 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java   |    1 
 xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7OracleReaderTest.java                                         |   12 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java                           |    2 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java                  |    2 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java |   35 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java         |   38 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/PrintfFormat.java                                         | 1194 ++--
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/DgnUtility.java                                                      |   32 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java                                            |    8 
 xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexShapeElement.java                                          |   30 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java                       |    2 
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/StringUtils.java                                          | 5174 +++++++++++-----------
 70 files changed, 9,196 insertions(+), 4,370 deletions(-)

diff --git a/.gitattributes b/.gitattributes
index fdf2150..26fec7b 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -66,6 +66,7 @@
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleDatabaseJob.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/DummyFeatureConvertJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2MySQLJob.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2OraSDOJob.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java svneol=native#text/plain
@@ -74,8 +75,19 @@
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnFileJobContext.java -text
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleJobContext.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/OracleUpgradeJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java svneol=native#text/plain
+xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java svneol=native#text/plain
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java svneol=native#text/plain
diff --git a/xdgnjobs/pom.xml b/xdgnjobs/pom.xml
index e5806d7..c7817f9 100644
--- a/xdgnjobs/pom.xml
+++ b/xdgnjobs/pom.xml
@@ -286,6 +286,12 @@
         <version>1.3.2</version>
       </dependency>
         
+      <dependency>
+        <groupId>mysql</groupId>
+        <artifactId>mysql-connector-java</artifactId>
+        <version>5.1.6</version>
+      </dependency>
+
       <!-- opensymphony -->
       <dependency>
         <groupId>opensymphony</groupId>
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexShapeElement.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexShapeElement.java
index f2d6541..f34dc57 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexShapeElement.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ComplexShapeElement.java
@@ -10,10 +10,9 @@
 
 import org.apache.log4j.Logger;
 
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.GeometryCollection;
-import com.vividsolutions.jts.geom.GeometryFactory;
 import com.vividsolutions.jts.geom.CoordinateList;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
 
 /**
  * ComplexShapeElement
@@ -152,29 +151,28 @@
     {
         ArrayList<Geometry> list = new ArrayList<Geometry>();
 
-        for (ListIterator it = listIterator(); it.hasNext(); )
+        for (ListIterator it = listIterator(); it.hasNext();)
         {
             Element element = (Element) it.next();
 
             if (element instanceof ShapeElement)
             {
-                if( ((ShapeElement) element).getVerticeSize() == 0 || ((ShapeElement) element).getVerticeSize() > 1)
+                if (((ShapeElement) element).getVerticeSize() == 0 || ((ShapeElement) element).getVerticeSize() > 1)
                 {
-                  list.add(((ShapeElement) element).toGeometry(factory));
+                    list.add(((ShapeElement) element).toGeometry(factory));
                 }
-            }
-            else if (element instanceof LineStringElement)
+            } else if (element instanceof LineStringElement)
             {
-               if( ((LineStringElement) element).getVerticeSize() == 0 || ((LineStringElement) element).getVerticeSize() > 1)
-               {
-                 list.add(((LineStringElement) element).toGeometry(factory));
-               }
+                if (((LineStringElement) element).getVerticeSize() == 0 || ((LineStringElement) element).getVerticeSize() > 1)
+                {
+                    list.add(((LineStringElement) element).toGeometry(factory));
+                }
             } else if (element instanceof LineElement)
             {
-               if( ((LineElement) element).getVertices().length == 0 || ((LineElement) element).getVertices().length > 1 )
-               {
-                 list.add(((LineElement) element).toGeometry(factory));
-               }
+                if (((LineElement) element).getVertices().length == 0 || ((LineElement) element).getVertices().length > 1)
+                {
+                    list.add(((LineElement) element).toGeometry(factory));
+                }
             } else if (element instanceof ArcElement)
             {
             }
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java
index 2db498d..b8908cf 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java
@@ -167,7 +167,7 @@
                     elementLength = (buffer.getShort() * 2) + 4;
                     if (raw.length < (offset + elementLength))
                     {
-                        System.out.println("Length not match:" + offset +":"+ buffer.position() +":"+buffer.limit());
+                        System.out.println("Length not match:" + offset + ":" + buffer.position() + ":" + buffer.limit());
                         break;
                     }
                     recordType = ElementType.forID(type);
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileHeader.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileHeader.java
index 0d50d54..33f3a1c 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileHeader.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileHeader.java
@@ -17,7 +17,7 @@
  */
 public class Dgn7fileHeader
 {
-    private short  elmtype;
+    private short elmtype;
     private byte[] raw;
 
     public Dgn7fileHeader()
@@ -29,8 +29,8 @@
         file.order(ByteOrder.LITTLE_ENDIAN);
         elmtype = file.getShort();
 
-        short wtf    = file.getShort();
-        int   length = (wtf * 2);
+        short wtf = file.getShort();
+        int length = (wtf * 2);
 
         if (file.remaining() != (length))
         {
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileReader.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileReader.java
index 668e289..35a3156 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileReader.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7fileReader.java
@@ -33,27 +33,27 @@
 {
     private static final Logger logger = LogManager.getLogger(Dgn7fileReader.class);
 
-    private Dgn7fileHeader      header;
+    private Dgn7fileHeader header;
     private ReadableByteChannel channel;
-    ByteBuffer                  buffer;
-    private ElementType         fileElementType = ElementType.UNDEFINED;
-    private ByteBuffer          headerTransfer;
-    private final Record        record = new Record();
-    private final boolean       randomAccessEnabled;
-    private Lock                lock;
-    private boolean             useMemoryMappedBuffer;
-    private long                currentOffset = 0L;
-    private StreamLogging       streamLogger  = new StreamLogging("Shapefile Reader");
-    private int                 maxElementId  = 0;
+    ByteBuffer buffer;
+    private ElementType fileElementType = ElementType.UNDEFINED;
+    private ByteBuffer headerTransfer;
+    private final Record record = new Record();
+    private final boolean randomAccessEnabled;
+    private Lock lock;
+    private boolean useMemoryMappedBuffer;
+    private long currentOffset = 0L;
+    private StreamLogging streamLogger = new StreamLogging("Shapefile Reader");
+    private int maxElementId = 0;
 
     public Dgn7fileReader(ReadableByteChannel channel, boolean strict, boolean useMemoryMapped, Lock lock)
-        throws IOException, Dgn7fileException
+            throws IOException, Dgn7fileException
     {
-        this.channel               = channel;
+        this.channel = channel;
         this.useMemoryMappedBuffer = useMemoryMapped;
         streamLogger.open();
         randomAccessEnabled = channel instanceof FileChannel;
-        this.lock           = lock;
+        this.lock = lock;
         lock.lockRead();
         init(strict);
     }
@@ -129,8 +129,8 @@
 
         buffer.order(ByteOrder.LITTLE_ENDIAN);
 
-        int        length = buffer.getShort(2) * 2;
-        ByteBuffer old    = buffer;
+        int length = buffer.getShort(2) * 2;
+        ByteBuffer old = buffer;
 
         old.position(0);
 
@@ -173,7 +173,7 @@
         }
 
         channel = null;
-        header  = null;
+        header = null;
     }
 
     public boolean supportsRandomAccess()
@@ -190,8 +190,8 @@
         buffer.order(ByteOrder.LITTLE_ENDIAN);
 
         // read shape record header
-        int   recordNumber = ++maxElementId;
-        short signature    = buffer.getShort();
+        int recordNumber = ++maxElementId;
+        short signature = buffer.getShort();
 
         // byte type = (byte) (buffer.get() & 0x7f);
         byte type = (byte) ((signature >>> 8) & 0x007f);
@@ -201,7 +201,7 @@
         // track the record location
         int elementLength = (buffer.getShort() * 2) + 4;
 
-        if (!buffer.isReadOnly() &&!useMemoryMappedBuffer)
+        if (!buffer.isReadOnly() && !useMemoryMappedBuffer)
         {
             // capacity is less than required for the record
             // copy the old into the newly allocated
@@ -218,16 +218,16 @@
                 buffer.position(0);
             } else
 
-            // remaining is less than record length
-            // compact the remaining data and read again,
-            // allowing enough room for one more record header
-            if (buffer.remaining() < elementLength)
-            {
-                this.currentOffset += buffer.position();
-                buffer.compact();
-                fill(buffer, channel);
-                buffer.position(0);
-            }
+                // remaining is less than record length
+                // compact the remaining data and read again,
+                // allowing enough room for one more record header
+                if (buffer.remaining() < elementLength)
+                {
+                    this.currentOffset += buffer.position();
+                    buffer.compact();
+                    fill(buffer, channel);
+                    buffer.position(0);
+                }
         }
 
         // shape record is all little endian
@@ -256,32 +256,32 @@
         {
             int lowCoorX = buffer.getInt();
 
-            lowCoorX    = DgnUtility.convertFromDGN(lowCoorX);
+            lowCoorX = DgnUtility.convertFromDGN(lowCoorX);
             record.minX = DgnUtility.converUnitToCoord(lowCoorX);
 
             int lowCoorY = buffer.getInt();
 
-            lowCoorY    = DgnUtility.convertFromDGN(lowCoorY);
+            lowCoorY = DgnUtility.convertFromDGN(lowCoorY);
             record.minY = DgnUtility.converUnitToCoord(lowCoorY);
 
             int lowCoorZ = buffer.getInt();
 
-            lowCoorZ    = DgnUtility.convertFromDGN(lowCoorZ);
+            lowCoorZ = DgnUtility.convertFromDGN(lowCoorZ);
             record.minZ = DgnUtility.converUnitToCoord(lowCoorZ);
 
             int highCoorX = buffer.getInt();
 
-            highCoorX   = DgnUtility.convertFromDGN(highCoorX);
+            highCoorX = DgnUtility.convertFromDGN(highCoorX);
             record.maxX = DgnUtility.converUnitToCoord(highCoorX);
 
             int highCoorY = buffer.getInt();
 
-            highCoorY   = DgnUtility.convertFromDGN(highCoorY);
+            highCoorY = DgnUtility.convertFromDGN(highCoorY);
             record.maxY = DgnUtility.converUnitToCoord(highCoorY);
 
             int highCoorZ = buffer.getInt();
 
-            highCoorZ   = DgnUtility.convertFromDGN(highCoorZ);
+            highCoorZ = DgnUtility.convertFromDGN(highCoorZ);
             record.maxZ = DgnUtility.converUnitToCoord(highCoorZ);
         }
 
@@ -289,9 +289,9 @@
         record.offset = record.end;
 
         // update all the record info.
-        record.length    = elementLength;
+        record.length = elementLength;
         record.signature = signature;
-        record.number    = recordNumber;
+        record.number = recordNumber;
 
         // remember, we read one int already...
         record.end = this.toFileOffset(buffer.position()) + elementLength - 4;
@@ -390,7 +390,7 @@
 
         // looks good
         boolean hasNext = true;
-        short   type    = buffer.getShort();
+        short type = buffer.getShort();
 
         if (type == -1)
         {
@@ -553,8 +553,8 @@
     public static void main(String[] args)
     {
         JFileChooser jfc = new JFileChooser("D:/TEMP");
-        File         f   = null;
-        int          r   = jfc.showOpenDialog(new JFrame());
+        File f = null;
+        int r = jfc.showOpenDialog(new JFrame());
 
         if (r == JFileChooser.APPROVE_OPTION)
         {
@@ -562,16 +562,16 @@
             {
                 f = jfc.getSelectedFile();
 
-                FileChannel    channel = new FileInputStream(f).getChannel();
-                Dgn7fileReader reader  = new Dgn7fileReader(channel, new Lock());
+                FileChannel channel = new FileInputStream(f).getChannel();
+                Dgn7fileReader reader = new Dgn7fileReader(channel, new Lock());
 
                 System.out.println(reader.getHeader().toString());
 
                 GeometryFactory factory = new GeometryFactory();
-                int             count, size;
+                int count, size;
 
                 count = 0;
-                size  = 0;
+                size = 0;
 
                 try
                 {
@@ -585,8 +585,8 @@
 
                         if (record.element() != null)
                         {
-                            Element     element = (Element) record.element();
-                            ElementType type    = element.getElementType();
+                            Element element = (Element) record.element();
+                            ElementType type = element.getElementType();
 
                             if ((!type.isComplexElement()) && (!element.isComponentElement()))
                             {
@@ -647,10 +647,10 @@
 
     public final class Record
     {
-        int   length;
-        int   number = 0;
-        int   offset;           // Relative to the whole file
-        int   start     = 0;    // Relative to the current loaded buffer
+        int length;
+        int number = 0;
+        int offset;           // Relative to the whole file
+        int start = 0;    // Relative to the current loaded buffer
         short signature = 0;
 
         /**
@@ -684,8 +684,8 @@
         public double maxZ;
 
         // ElementType type;
-        int             end     = 0;    // Relative to the whole file
-        Object          element = null;
+        int end = 0;    // Relative to the whole file
+        Object element = null;
         IElementHandler handler;
 
         public Object element()
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Element.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Element.java
index be83dde..678816a 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Element.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Element.java
@@ -21,22 +21,22 @@
  */
 public class Element
 {
-    public static final int CONSTRUCTION_CLASS      = 0;
+    public static final int CONSTRUCTION_CLASS = 0;
     public static final int CONSTRUCTION_RULE_CLASS = 0;
-    public static final int DIMENSION_CLASS         = 0;
-    public static final int LINEAR_PATTERNED_CLASS  = 0;
-    public static final int MAX_ELEMENT_SIZE        = 0;
-    public static final int MAX_VERTICES            = 100;
-    public static final int PATTERN_AREA            = 0;
+    public static final int DIMENSION_CLASS = 0;
+    public static final int LINEAR_PATTERNED_CLASS = 0;
+    public static final int MAX_ELEMENT_SIZE = 0;
+    public static final int MAX_VERTICES = 100;
+    public static final int PATTERN_AREA = 0;
     public static final int PATTERN_COMPONENT_CLASS = 0;
-    public static final int PATTERN_CROSSHATCH      = 0;
-    public static final int PATTERN_HATCH           = 0;
-    public static final int PRIMARY_CLASS           = 0;
-    public static final int PRIMARY_RULE_CLASS      = 0;
+    public static final int PATTERN_CROSSHATCH = 0;
+    public static final int PATTERN_HATCH = 0;
+    public static final int PRIMARY_CLASS = 0;
+    public static final int PRIMARY_RULE_CLASS = 0;
 
-    protected short[]       raw;
-    protected byte          attrOffset = 0;
-    protected ByteBuffer    rawBuffer;
+    protected short[] raw;
+    protected byte attrOffset = 0;
+    protected ByteBuffer rawBuffer;
 
     public Element(byte[] raw)
     {
@@ -67,7 +67,7 @@
         highCoorY = DgnUtility.convertFromDGN(highCoorY);
 
         return new Envelope(DgnUtility.converUnitToCoord(lowCoorX), DgnUtility.converUnitToCoord(highCoorX),
-                            DgnUtility.converUnitToCoord(lowCoorY), DgnUtility.converUnitToCoord(highCoorY));
+                DgnUtility.converUnitToCoord(lowCoorY), DgnUtility.converUnitToCoord(highCoorY));
     }
 
     public boolean isComponentElement()
@@ -143,7 +143,7 @@
     public List<UserAttributeData> getUserAttributeData()
     {
         short[] data;
-        short   length, nextAttribute;
+        short length, nextAttribute;
 
         if (raw[15] <= 0)
         {
@@ -169,7 +169,7 @@
             }
 
             nextAttribute = (short) (index + length + 1);
-            data          = new short[length];
+            data = new short[length];
             System.arraycopy(raw, index + 1, data, 0, length);
 
             if (data[0] == (short) 0x0020)
@@ -234,7 +234,7 @@
                 buffer.get(dst, 4, dst.length - 4);
             } catch (BufferUnderflowException exception)
             {
-                throw exception;   
+                throw exception;
             }
 
             ByteBuffer tmpBuffer = ByteBuffer.wrap(dst);
@@ -242,7 +242,7 @@
             tmpBuffer.position(0);
             tmpBuffer.putShort(signature);
             tmpBuffer.putShort((short) ((length / 2) - 2));
-            
+
             /*
             ShortBuffer sbuffer = tmpBuffer.asShortBuffer();
 
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ElementType.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ElementType.java
index d3ecac1..5612e7a 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ElementType.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/ElementType.java
@@ -169,7 +169,7 @@
      */
     protected ElementType(int id, String name)
     {
-        this.id   = id;
+        this.id = id;
         this.name = name;
     }
 
@@ -262,59 +262,59 @@
 
         switch (id)
         {
-        case 0 :
+        case 0:
             t = NULL;
             break;
 
-        case 3 :
+        case 3:
             t = LINE;
             break;
 
-        case 4 :
+        case 4:
             t = LINESTRING;
             break;
 
-        case 6 :
+        case 6:
             t = SHAPE;
             break;
 
-        case 7 :
+        case 7:
             t = TEXTNODE;
             break;
 
-        case 8 :
+        case 8:
             t = IGDSDIGITIZER;
             break;
 
-        case 9 :
+        case 9:
             t = TCB;
             break;
 
-        case 10 :
+        case 10:
             t = LEVELSYMBOLOGY;
             break;
 
-        case 12 :
+        case 12:
             t = COMPLEXCHAIN;
             break;
 
-        case 14 :
+        case 14:
             t = COMPLEXSHAPE;
             break;
 
-        case 15 :
+        case 15:
             t = ELLIPSE;
             break;
 
-        case 16 :
+        case 16:
             t = ARC;
             break;
 
-        case 17 :
+        case 17:
             t = TEXT;
             break;
 
-        default :
+        default:
             t = UNDEFINED;
             break;
         }
@@ -328,55 +328,55 @@
 
         switch (id)
         {
-        case 3 :
+        case 3:
             handler = LineElement.ElementHandler.getInstance();
             break;
 
-        case 4 :
+        case 4:
             handler = LineStringElement.ElementHandler.getInstance();
             break;
 
-        case 6 :
+        case 6:
             handler = ShapeElement.ElementHandler.getInstance();
             break;
 
-        case 7 :
+        case 7:
             handler = TextNodeElement.ElementHandler.getInstance();
             break;
 
-        case 8 :
+        case 8:
             handler = new Element.ElementHandler(this);
             break;
 
-        case 9 :
+        case 9:
             handler = new Element.ElementHandler(this);
             break;
 
-        case 10 :
+        case 10:
             handler = new Element.ElementHandler(this);
             break;
 
-        case 12 :
+        case 12:
             handler = ComplexChainElement.ElementHandler.getInstance();
             break;
 
-        case 14 :
+        case 14:
             handler = ComplexShapeElement.ElementHandler.getInstance();
             break;
 
-        case 15 :
+        case 15:
             handler = EllipseElement.ElementHandler.getInstance();
             break;
 
-        case 16 :
+        case 16:
             handler = ArcElement.ElementHandler.getInstance();
             break;
 
-        case 17 :
+        case 17:
             handler = TextElement.ElementHandler.getInstance();
             break;
 
-        default :
+        default:
             handler = null;
         }
 
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/FrammeAttributeData.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/FrammeAttributeData.java
index 3707168..2a9840e 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/FrammeAttributeData.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/FrammeAttributeData.java
@@ -66,6 +66,6 @@
     public String toString()
     {
         return "FrammeData{" + getFsc() + "," + getUfid() + "," + getComponentID() + "," + getRuleNo() + "," + getStatus() + ","
-               + getOccID() + "}";
+                + getOccID() + "}";
     }
 }
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java
index 6c2fd0e..2996936 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineElement.java
@@ -58,8 +58,8 @@
         int startX = ((raw[18] << 16) & 0xffff0000);
         startX = startX + (raw[19] & 0x0000ffff);
 
-        double x      = DgnUtility.converUnitToCoord(startX);
-        int    startY = ((raw[20] << 16) & 0xffff0000);
+        double x = DgnUtility.converUnitToCoord(startX);
+        int startY = ((raw[20] << 16) & 0xffff0000);
 
         startY = startY + (raw[21] & 0x0000ffff);
 
@@ -71,8 +71,8 @@
     public Coordinate getVertex(int index)
     {
         return (index == 0)
-               ? getStartPoint()
-               : getEndPoint();
+                ? getStartPoint()
+                : getEndPoint();
     }
 
     public double getLength()
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java
index 29fad45..ce09145 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/LineStringElement.java
@@ -54,8 +54,8 @@
     public Coordinate getVertex(int index)
     {
         return (index == 0)
-               ? getStartPoint()
-               : getEndPoint();
+                ? getStartPoint()
+                : getEndPoint();
     }
 
     public int getVerticeSize()
@@ -65,8 +65,8 @@
 
     public double getLength()
     {
-        double       result = 0.0;
-        Coordinate[] vset   = getVertices();
+        double result = 0.0;
+        Coordinate[] vset = getVertices();
 
         for (int i = 1; i < getVerticeSize(); i++)
         {
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Lock.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Lock.java
index e51dbf2..58f9f73 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Lock.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Lock.java
@@ -109,7 +109,7 @@
                     wait();
                 } catch (InterruptedException e)
                 {
-                    throw(IOException) new IOException().initCause(e);
+                    throw (IOException) new IOException().initCause(e);
                 }
             }
         }
@@ -117,7 +117,7 @@
         assertTrue("A write lock exists that is owned by another thread", canRead());
 
         Thread current = Thread.currentThread();
-        Owner  owner   = (Owner) owners.get(current);
+        Owner owner = (Owner) owners.get(current);
 
         if (owner != null)
         {
@@ -183,7 +183,7 @@
                 wait();
             } catch (InterruptedException e)
             {
-                throw(IOException) new IOException().initCause(e);
+                throw (IOException) new IOException().initCause(e);
             }
 
             if (writer == null)
@@ -247,11 +247,11 @@
     private class Owner
     {
         final Thread owner;
-        int          timesLocked;
+        int timesLocked;
 
         Owner(Thread owner)
         {
-            this.owner  = owner;
+            this.owner = owner;
             timesLocked = 1;
         }
 
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java
index 4f31770..84c14af 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/NIOUtilities.java
@@ -17,6 +17,7 @@
  */
 
 // J2SE dependencies
+
 import java.lang.reflect.Method;
 import java.nio.ByteBuffer;
 import java.security.AccessController;
@@ -28,12 +29,13 @@
 /**
  * Utility class for managing memory mapped buffers.
  *
- * @since 2.0
- * @source $URL$
- * @version $Id$
  * @author Andres Aimes
+ * @version $Id$
+ * @source $URL$
+ * @since 2.0
  */
-public class NIOUtilities {
+public class NIOUtilities
+{
     /**
      * {@code true} if a warning has already been logged.
      */
@@ -43,9 +45,10 @@
      * Do not allows instantiation of this class.
      *
      * @todo This constructor will become private when {@code NIOBufferUtils}
-     *       will have been removed.
+     * will have been removed.
      */
-    protected NIOUtilities() {
+    protected NIOUtilities()
+    {
     }
 
     /**
@@ -54,28 +57,34 @@
      * case) will be logged as {@code SEVERE} to the logger of the package name. To
      * force logging of errors, set the System property "org.geotools.io.debugBuffer" to "true".
      *
-     * @param  buffer The buffer to close.
+     * @param buffer The buffer to close.
      * @return true if the operation was successful, false otherwise.
-     *
      * @see java.nio.MappedByteBuffer
      */
-    public static boolean clean(final ByteBuffer buffer) {
-        if (buffer == null || ! buffer.isDirect() ) {
+    public static boolean clean(final ByteBuffer buffer)
+    {
+        if (buffer == null || !buffer.isDirect())
+        {
             return false;
         }
-        Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        Boolean b = (Boolean) AccessController.doPrivileged(new PrivilegedAction()
+        {
+            public Object run()
+            {
                 Boolean success = Boolean.FALSE;
-                try {
-                    Method getCleanerMethod = buffer.getClass().getMethod("cleaner", (Class[])null);
+                try
+                {
+                    Method getCleanerMethod = buffer.getClass().getMethod("cleaner", (Class[]) null);
                     getCleanerMethod.setAccessible(true);
-                    Object cleaner = getCleanerMethod.invoke(buffer,  (Object[])null);
-                    Method clean = cleaner.getClass().getMethod("clean", (Class[])null);
-                    clean.invoke(cleaner, (Object[])null);
+                    Object cleaner = getCleanerMethod.invoke(buffer, (Object[]) null);
+                    Method clean = cleaner.getClass().getMethod("clean", (Class[]) null);
+                    clean.invoke(cleaner, (Object[]) null);
                     success = Boolean.TRUE;
-                } catch (Exception e) {
+                } catch (Exception e)
+                {
                     // This really is a show stopper on windows
-                    if (isLoggable()) {
+                    if (isLoggable())
+                    {
                         log(e, buffer);
                     }
                 }
@@ -89,12 +98,15 @@
     /**
      * Check if a warning message should be logged.
      */
-    private static synchronized boolean isLoggable() {
-        try {
+    private static synchronized boolean isLoggable()
+    {
+        try
+        {
             return !warned && (
                     System.getProperty("org.geotools.io.debugBuffer", "false").equalsIgnoreCase("true") ||
-                    System.getProperty("os.name").indexOf("Windows") >= 0 );
-        } catch (SecurityException exception) {
+                            System.getProperty("os.name").indexOf("Windows") >= 0);
+        } catch (SecurityException exception)
+        {
             // The utilities may be running in an Applet, in which case we
             // can't read properties. Assumes we are not in debugging mode.
             return false;
@@ -104,11 +116,12 @@
     /**
      * Log a warning message.
      */
-    private static synchronized void log(final Exception e, final ByteBuffer buffer) {
+    private static synchronized void log(final Exception e, final ByteBuffer buffer)
+    {
         warned = true;
         String message = "Error attempting to close a mapped byte buffer : " + buffer.getClass().getName()
-                       + "\n JVM : " + System.getProperty("java.version")
-                       + ' '         + System.getProperty("java.vendor");
+                + "\n JVM : " + System.getProperty("java.version")
+                + ' ' + System.getProperty("java.vendor");
         Logger.getLogger("org.geotools.io").log(Level.SEVERE, message, e);
     }
 }
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/StreamLogging.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/StreamLogging.java
index db92597..8000b5c 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/StreamLogging.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/StreamLogging.java
@@ -15,8 +15,8 @@
 public class StreamLogging
 {
     private static final Logger LOGGER = LogManager.getLogger("com.ximple.io.dgn7");
-    private String              name;
-    private int                 open = 0;
+    private String name;
+    private int open = 0;
 
     /**
      * The name that will appear in the debug message
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextElement.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextElement.java
index 454897c..f9d9cd5 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextElement.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextElement.java
@@ -2,7 +2,6 @@
 
 import java.awt.geom.AffineTransform;
 import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
 import java.nio.CharBuffer;
 import java.nio.charset.CharacterCodingException;
 import java.nio.charset.Charset;
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextNodeElement.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextNodeElement.java
index 4b70f52..8a959dc 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextNodeElement.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/TextNodeElement.java
@@ -153,7 +153,7 @@
     {
         ArrayList list = new ArrayList();
 
-        for (ListIterator it = listIterator(); it.hasNext(); )
+        for (ListIterator it = listIterator(); it.hasNext();)
         {
             Element element = (Element) it.next();
 
@@ -256,7 +256,7 @@
         double dx = DgnUtility.converUnitToCoord(x);
         // return DgnUtility.convertFromDGN(x);
 
-        int y  = ((raw[33] << 16) & 0xffff0000) | (raw[34] & 0x0000ffff);
+        int y = ((raw[33] << 16) & 0xffff0000) | (raw[34] & 0x0000ffff);
         double dy = DgnUtility.converUnitToCoord(y);
 
         return new Coordinate(dx, dy);
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/UserAttributeData.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/UserAttributeData.java
index 5f0a9fe..2b87fe1 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/UserAttributeData.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/UserAttributeData.java
@@ -13,7 +13,7 @@
 
     public UserAttributeData(short id, int attributeCount)
     {
-        _src    = new short[attributeCount];
+        _src = new short[attributeCount];
         _src[0] = id;
     }
 
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/DgnUtility.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/DgnUtility.java
index 012e150..0009270 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/DgnUtility.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/DgnUtility.java
@@ -105,7 +105,7 @@
         }
 
         return new Envelope(converUnitToCoord((int) range.getMinX()), converUnitToCoord((int) range.getMaxX()),
-                                         converUnitToCoord((int) range.getMinY()), converUnitToCoord((int) range.getMaxY()));
+                converUnitToCoord((int) range.getMinY()), converUnitToCoord((int) range.getMaxY()));
     }
 
     public static Envelope converCoordToUnit(Envelope range)
@@ -116,7 +116,7 @@
         }
 
         return new Envelope(converCoordToUnit(range.getMinX()), converCoordToUnit(range.getMaxX()),
-                                         converCoordToUnit(range.getMinY()), converCoordToUnit(range.getMaxY()));
+                converCoordToUnit(range.getMinY()), converCoordToUnit(range.getMaxY()));
     }
 
     public static long convertDGNToRAWIEEEDouble(byte[] org)
@@ -136,12 +136,12 @@
 
         int[] tmp = new int[2];
 
-        tmp[0]   = buf.getInt();
-        tmp[1]   = buf.getInt();
+        tmp[0] = buf.getInt();
+        tmp[1] = buf.getInt();
 
-        int   exponent;
+        int exponent;
 
-        int sign     = (tmp[0] & 0x80000000);
+        int sign = (tmp[0] & 0x80000000);
         exponent = (tmp[0] >>> 23) & 0x000000ff;
 
         if (exponent != 0)
@@ -150,8 +150,8 @@
         }
 
         int rndbits = tmp[1] & 0x00000007;
-        tmp[1]  = tmp[1] >>> 3;
-        tmp[1]  = (tmp[1] & 0x1fffffff) | (tmp[0] << 29);
+        tmp[1] = tmp[1] >>> 3;
+        tmp[1] = (tmp[1] & 0x1fffffff) | (tmp[0] << 29);
 
         if (rndbits != 0)
         {
@@ -170,9 +170,9 @@
         buf.get(tmpRaw);
         buf.position(0);
         buf.order(ByteOrder.LITTLE_ENDIAN);
-        for (int i = tmpRaw.length; i > 0 ; i--)
+        for (int i = tmpRaw.length; i > 0; i--)
         {
-            buf.put(tmpRaw[i-1]);
+            buf.put(tmpRaw[i - 1]);
         }
         buf.position(0);
         long result = buf.getLong();
@@ -190,16 +190,16 @@
 
         // uint[]   tmp = new int[ 2 ];
         // ushort[] des = new short[ 4 ];
-        int[]   tmp = new int[2];
+        int[] tmp = new int[2];
         short[] des = new short[4];
-        int     sign;
-        int     exponent;
+        int sign;
+        int exponent;
 
         tmp[0] = (int) ((newVal >>> 32));
         tmp[1] = (int) (newVal);
 
         // sign = ( int ) ( ( uint ) tmp[ 0 ] & 0x80000000 );
-        sign     = tmp[0] & 0x80000000;
+        sign = tmp[0] & 0x80000000;
         exponent = (tmp[0] >>> 20) & 0x07ff;
 
         if (exponent != 0)
@@ -251,8 +251,8 @@
 
     public static double getLength(double x1, double y1, double x2, double y2)
     {
-        double dx     = x1 - x2;
-        double dy     = y1 - y2;
+        double dx = x1 - x2;
+        double dy = y1 - y2;
 
         return Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
     }
diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/PrintfFormat.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/PrintfFormat.java
index de4c574..5ec015f 100644
--- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/PrintfFormat.java
+++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/util/PrintfFormat.java
@@ -90,7 +90,7 @@
  * In format strings containing the %<code>n</code>$
  * form of conversion specifications, each argument
  * in the argument list is used exactly once.</p>
- *
+ * <p/>
  * <h4>Escape Sequences</h4>
  * <p>
  * The following table lists escape sequences and
@@ -98,40 +98,40 @@
  * the action.
  * <table>
  * <tr><th align=left>Sequence</th>
- *    <th align=left>Name</th>
- *    <th align=left>Description</th></tr>
+ * <th align=left>Name</th>
+ * <th align=left>Description</th></tr>
  * <tr><td>\\</td><td>backlash</td><td>None.
  * </td></tr>
  * <tr><td>\a</td><td>alert</td><td>Attempts to alert
- *          the user through audible or visible
- *          notification.
+ * the user through audible or visible
+ * notification.
  * </td></tr>
  * <tr><td>\b</td><td>backspace</td><td>Moves the
- *          printing position to one column before
- *          the current position, unless the
- *          current position is the start of a line.
+ * printing position to one column before
+ * the current position, unless the
+ * current position is the start of a line.
  * </td></tr>
  * <tr><td>\f</td><td>form-feed</td><td>Moves the
- *          printing position to the initial
- *          printing position of the next logical
- *          page.
+ * printing position to the initial
+ * printing position of the next logical
+ * page.
  * </td></tr>
  * <tr><td>\n</td><td>newline</td><td>Moves the
- *          printing position to the start of the
- *          next line.
+ * printing position to the start of the
+ * next line.
  * </td></tr>
  * <tr><td>\r</td><td>carriage-return</td><td>Moves
- *          the printing position to the start of
- *          the current line.
+ * the printing position to the start of
+ * the current line.
  * </td></tr>
  * <tr><td>\t</td><td>tab</td><td>Moves the printing
- *          position to the next implementation-
- *          defined horizontal tab position.
+ * position to the next implementation-
+ * defined horizontal tab position.
  * </td></tr>
  * <tr><td>\v</td><td>vertical-tab</td><td>Moves the
- *          printing position to the start of the
- *          next implementation-defined vertical
- *          tab position.
+ * printing position to the start of the
+ * next implementation-defined vertical
+ * tab position.
  * </td></tr>
  * </table></p>
  * <h4>Conversion Specifications</h4>
@@ -206,55 +206,55 @@
  * be mixed with the %<code>n</code>$ form.  The
  * results of mixing numbered and unnumbered argument
  * specifications in a format string are undefined.</p>
- *
+ * <p/>
  * <h4>Flag Characters</h4>
  * <p>
  * The flags and their meanings are:</p>
  * <dl>
  * <dt>'<dd> integer portion of the result of a
- *      decimal conversion (%i, %d, %f, %g, or %G) will
- *      be formatted with thousands' grouping
- *      characters.  For other conversions the flag
- *      is ignored.  The non-monetary grouping
- *      character is used.
+ * decimal conversion (%i, %d, %f, %g, or %G) will
+ * be formatted with thousands' grouping
+ * characters.  For other conversions the flag
+ * is ignored.  The non-monetary grouping
+ * character is used.
  * <dt>-<dd> result of the conversion is left-justified
- *      within the field.  (It will be right-justified
- *      if this flag is not specified).</td></tr>
+ * within the field.  (It will be right-justified
+ * if this flag is not specified).</td></tr>
  * <dt>+<dd> result of a signed conversion always
- *      begins with a sign (+ or -).  (It will begin
- *      with a sign only when a negative value is
- *      converted if this flag is not specified.)
+ * begins with a sign (+ or -).  (It will begin
+ * with a sign only when a negative value is
+ * converted if this flag is not specified.)
  * <dt>&lt;space&gt;<dd> If the first character of a
- *      signed conversion is not a sign, a space
- *      character will be placed before the result.
- *      This means that if the space character and +
- *      flags both appear, the space flag will be
- *      ignored.
+ * signed conversion is not a sign, a space
+ * character will be placed before the result.
+ * This means that if the space character and +
+ * flags both appear, the space flag will be
+ * ignored.
  * <dt>#<dd> value is to be converted to an alternative
- *      form.  For c, d, i, and s conversions, the flag
- *      has no effect.  For o conversion, it increases
- *      the precision to force the first digit of the
- *      result to be a zero.  For x or X conversion, a
- *      non-zero result has 0x or 0X prefixed to it,
- *      respectively.  For e, E, f, g, and G
- *      conversions, the result always contains a radix
- *      character, even if no digits follow the radix
- *      character (normally, a decimal point appears in
- *      the result of these conversions only if a digit
- *      follows it).  For g and G conversions, trailing
- *      zeros will not be removed from the result as
- *      they normally are.
+ * form.  For c, d, i, and s conversions, the flag
+ * has no effect.  For o conversion, it increases
+ * the precision to force the first digit of the
+ * result to be a zero.  For x or X conversion, a
+ * non-zero result has 0x or 0X prefixed to it,
+ * respectively.  For e, E, f, g, and G
+ * conversions, the result always contains a radix
+ * character, even if no digits follow the radix
+ * character (normally, a decimal point appears in
+ * the result of these conversions only if a digit
+ * follows it).  For g and G conversions, trailing
+ * zeros will not be removed from the result as
+ * they normally are.
  * <dt>0<dd> d, i, o, x, X, e, E, f, g, and G
- *      conversions, leading zeros (following any
- *      indication of sign or base) are used to pad to
- *      the field width;  no space padding is
- *      performed.  If the 0 and - flags both appear,
- *      the 0 flag is ignored.  For d, i, o, x, and X
- *      conversions, if a precision is specified, the
- *      0 flag will be ignored. For c conversions,
- *      the flag is ignored.
+ * conversions, leading zeros (following any
+ * indication of sign or base) are used to pad to
+ * the field width;  no space padding is
+ * performed.  If the 0 and - flags both appear,
+ * the 0 flag is ignored.  For d, i, o, x, and X
+ * conversions, if a precision is specified, the
+ * 0 flag will be ignored. For c conversions,
+ * the flag is ignored.
  * </dl>
- *
+ * <p/>
  * <h4>Conversion Characters</h4>
  * <p>
  * Each conversion character results in fetching zero
@@ -263,103 +263,103 @@
  * Usually, an unchecked exception will be thrown.
  * If the format is exhausted while arguments remain,
  * the excess arguments are ignored.</p>
- *
+ * <p/>
  * <p>
  * The conversion characters and their meanings are:
  * </p>
  * <dl>
  * <dt>d,i<dd>The int argument is converted to a
- *        signed decimal in the style [-]dddd.  The
- *        precision specifies the minimum number of
- *        digits to appear;  if the value being
- *        converted can be represented in fewer
- *        digits, it will be expanded with leading
- *        zeros.  The default precision is 1.  The
- *        result of converting 0 with an explicit
- *        precision of 0 is no characters.
+ * signed decimal in the style [-]dddd.  The
+ * precision specifies the minimum number of
+ * digits to appear;  if the value being
+ * converted can be represented in fewer
+ * digits, it will be expanded with leading
+ * zeros.  The default precision is 1.  The
+ * result of converting 0 with an explicit
+ * precision of 0 is no characters.
  * <dt>o<dd> The int argument is converted to unsigned
- *        octal format in the style ddddd.  The
- *        precision specifies the minimum number of
- *        digits to appear;  if the value being
- *        converted can be represented in fewer
- *        digits, it will be expanded with leading
- *        zeros.  The default precision is 1.  The
- *        result of converting 0 with an explicit
- *        precision of 0 is no characters.
+ * octal format in the style ddddd.  The
+ * precision specifies the minimum number of
+ * digits to appear;  if the value being
+ * converted can be represented in fewer
+ * digits, it will be expanded with leading
+ * zeros.  The default precision is 1.  The
+ * result of converting 0 with an explicit
+ * precision of 0 is no characters.
  * <dt>x<dd> The int argument is converted to unsigned
- *        hexadecimal format in the style dddd;  the
- *        letters abcdef are used.  The precision
- *        specifies the minimum numberof digits to
- *        appear; if the value being converted can be
- *        represented in fewer digits, it will be
- *        expanded with leading zeros.  The default
- *        precision is 1.  The result of converting 0
- *        with an explicit precision of 0 is no
- *        characters.
+ * hexadecimal format in the style dddd;  the
+ * letters abcdef are used.  The precision
+ * specifies the minimum numberof digits to
+ * appear; if the value being converted can be
+ * represented in fewer digits, it will be
+ * expanded with leading zeros.  The default
+ * precision is 1.  The result of converting 0
+ * with an explicit precision of 0 is no
+ * characters.
  * <dt>X<dd> Behaves the same as the x conversion
- *        character except that letters ABCDEF are
- *        used instead of abcdef.
+ * character except that letters ABCDEF are
+ * used instead of abcdef.
  * <dt>f<dd> The floating point number argument is
- *        written in decimal notation in the style
- *        [-]ddd.ddd, where the number of digits after
- *        the radix character (shown here as a decimal
- *        point) is equal to the precision
- *        specification.  A Locale is used to determine
- *        the radix character to use in this format.
- *        If the precision is omitted from the
- *        argument, six digits are written after the
- *        radix character;  if the precision is
- *        explicitly 0 and the # flag is not specified,
- *        no radix character appears.  If a radix
- *        character appears, at least 1 digit appears
- *        before it.  The value is rounded to the
- *        appropriate number of digits.
+ * written in decimal notation in the style
+ * [-]ddd.ddd, where the number of digits after
+ * the radix character (shown here as a decimal
+ * point) is equal to the precision
+ * specification.  A Locale is used to determine
+ * the radix character to use in this format.
+ * If the precision is omitted from the
+ * argument, six digits are written after the
+ * radix character;  if the precision is
+ * explicitly 0 and the # flag is not specified,
+ * no radix character appears.  If a radix
+ * character appears, at least 1 digit appears
+ * before it.  The value is rounded to the
+ * appropriate number of digits.
  * <dt>e,E<dd>The floating point number argument is
- *        written in the style [-]d.ddde{+-}dd
- *        (the symbols {+-} indicate either a plus or
- *        minus sign), where there is one digit before
- *        the radix character (shown here as a decimal
- *        point) and the number of digits after it is
- *        equal to the precision.  A Locale is used to
- *        determine the radix character to use in this
- *        format.  When the precision is missing, six
- *        digits are written after the radix character;
- *        if the precision is 0 and the # flag is not
- *        specified, no radix character appears.  The
- *        E conversion will produce a number with E
- *        instead of e introducing the exponent.  The
- *        exponent always contains at least two digits.
- *        However, if the value to be written requires
- *        an exponent greater than two digits,
- *        additional exponent digits are written as
- *        necessary.  The value is rounded to the
- *        appropriate number of digits.
+ * written in the style [-]d.ddde{+-}dd
+ * (the symbols {+-} indicate either a plus or
+ * minus sign), where there is one digit before
+ * the radix character (shown here as a decimal
+ * point) and the number of digits after it is
+ * equal to the precision.  A Locale is used to
+ * determine the radix character to use in this
+ * format.  When the precision is missing, six
+ * digits are written after the radix character;
+ * if the precision is 0 and the # flag is not
+ * specified, no radix character appears.  The
+ * E conversion will produce a number with E
+ * instead of e introducing the exponent.  The
+ * exponent always contains at least two digits.
+ * However, if the value to be written requires
+ * an exponent greater than two digits,
+ * additional exponent digits are written as
+ * necessary.  The value is rounded to the
+ * appropriate number of digits.
  * <dt>g,G<dd>The floating point number argument is
- *        written in style f or e (or in sytle E in the
- *        case of a G conversion character), with the
- *        precision specifying the number of
- *        significant digits.  If the precision is
- *        zero, it is taken as one.  The style used
- *        depends on the value converted:  style e
- *        (or E) will be used only if the exponent
- *        resulting from the conversion is less than
- *        -4 or greater than or equal to the precision.
- *        Trailing zeros are removed from the result.
- *        A radix character appears only if it is
- *        followed by a digit.
+ * written in style f or e (or in sytle E in the
+ * case of a G conversion character), with the
+ * precision specifying the number of
+ * significant digits.  If the precision is
+ * zero, it is taken as one.  The style used
+ * depends on the value converted:  style e
+ * (or E) will be used only if the exponent
+ * resulting from the conversion is less than
+ * -4 or greater than or equal to the precision.
+ * Trailing zeros are removed from the result.
+ * A radix character appears only if it is
+ * followed by a digit.
  * <dt>c,C<dd>The integer argument is converted to a
- *        char and the result is written.
- *
+ * char and the result is written.
+ * <p/>
  * <dt>s,S<dd>The argument is taken to be a string and
- *        bytes from the string are written until the
- *        end of the string or the number of bytes
- *        indicated by the precision specification of
- *        the argument is reached.  If the precision
- *        is omitted from the argument, it is taken to
- *        be infinite, so all characters up to the end
- *        of the string are written.
+ * bytes from the string are written until the
+ * end of the string or the number of bytes
+ * indicated by the precision specification of
+ * the argument is reached.  If the precision
+ * is omitted from the argument, it is taken to
+ * be infinite, so all characters up to the end
+ * of the string are written.
  * <dt>%<dd>Write a % character;  no argument is
- *        converted.
+ * converted.
  * </dl>
  * <p>
  * If a conversion specification does not match one of
@@ -431,25 +431,31 @@
  *
  * @author Allan Jacobs
  * @version 1
- * Release 1: Initial release.
- * Release 2: Asterisk field widths and precisions
- *            %n$ and *m$
- *            Bug fixes
- *              g format fix (2 digits in e form corrupt)
- *              rounding in f format implemented
- *              round up when digit not printed is 5
- *              formatting of -0.0f
- *              round up/down when last digits are 50000...
+ *          Release 1: Initial release.
+ *          Release 2: Asterisk field widths and precisions
+ *          %n$ and *m$
+ *          Bug fixes
+ *          g format fix (2 digits in e form corrupt)
+ *          rounding in f format implemented
+ *          round up when digit not printed is 5
+ *          formatting of -0.0f
+ *          round up/down when last digits are 50000...
  */
 public final class PrintfFormat
 {
-    /** Vector of control strings and format literals. */
+    /**
+     * Vector of control strings and format literals.
+     */
     private Vector vFmt = new Vector();
 
-    /** Character position.  Used by the constructor. */
+    /**
+     * Character position.  Used by the constructor.
+     */
     private int cPos = 0;
 
-    /** Character position.  Used by the constructor. */
+    /**
+     * Character position.  Used by the constructor.
+     */
     private DecimalFormatSymbols dfs = null;
 
     /**
@@ -459,10 +465,11 @@
      * unpaired percent signs.  A pair of successive
      * percent signs designates a single percent sign in
      * the format.
-     * @param fmtArg  Control string.
-     * @exception IllegalArgumentException if the control
-     * string is null, zero length, or otherwise
-     * malformed.
+     *
+     * @param fmtArg Control string.
+     * @throws IllegalArgumentException if the control
+     *                                  string is null, zero length, or otherwise
+     *                                  malformed.
      */
     public PrintfFormat(String fmtArg) throws IllegalArgumentException
     {
@@ -476,18 +483,19 @@
      * unpaired percent signs.  A pair of successive
      * percent signs designates a single percent sign in
      * the format.
-     * @param fmtArg  Control string.
-     * @exception IllegalArgumentException if the control
-     * string is null, zero length, or otherwise
-     * malformed.
+     *
+     * @param fmtArg Control string.
+     * @throws IllegalArgumentException if the control
+     *                                  string is null, zero length, or otherwise
+     *                                  malformed.
      */
     public PrintfFormat(Locale locale, String fmtArg) throws IllegalArgumentException
     {
         dfs = new DecimalFormatSymbols(locale);
 
-        int                     ePos = 0;
+        int ePos = 0;
         ConversionSpecification sFmt = null;
-        String                  unCS = this.nonControl(fmtArg, 0);
+        String unCS = this.nonControl(fmtArg, 0);
 
         if (unCS != null)
         {
@@ -590,12 +598,13 @@
      * of the String <code>s</code>, the next unpaired
      * percent sign, or at the end of the String if the
      * last character is a percent sign.
-     * @param s  Control string.
+     *
+     * @param s     Control string.
      * @param start Position in the string
-     *     <code>s</code> to begin looking for the start
-     *     of a control string.
+     *              <code>s</code> to begin looking for the start
+     *              of a control string.
      * @return the substring from the start position
-     *     to the beginning of the control string.
+     *         to the beginning of the control string.
      */
     private String nonControl(String s, int start)
     {
@@ -616,21 +625,22 @@
      * Integer, Long, Float, Double, and Character
      * arguments are treated as wrappers for primitive
      * types.
+     *
      * @param o The array of objects to format.
-     * @return  The formatted String.
+     * @return The formatted String.
      */
     public String sprintf(Object[] o)
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        int                     i  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        int i = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -713,19 +723,20 @@
 
     /**
      * Format nothing.  Just use the control string.
-     * @return  the formatted String.
+     *
+     * @return the formatted String.
      */
     public String sprintf()
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -741,23 +752,24 @@
 
     /**
      * Format an int.
+     *
      * @param x The int to format.
-     * @return  The formatted String.
-     * @exception IllegalArgumentException if the
-     *     conversion character is f, e, E, g, G, s,
-     *     or S.
+     * @return The formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is f, e, E, g, G, s,
+     *                                  or S.
      */
     public String sprintf(int x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -776,23 +788,24 @@
 
     /**
      * Format an long.
+     *
      * @param x The long to format.
-     * @return  The formatted String.
-     * @exception IllegalArgumentException if the
-     *     conversion character is f, e, E, g, G, s,
-     *     or S.
+     * @return The formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is f, e, E, g, G, s,
+     *                                  or S.
      */
     public String sprintf(long x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -811,23 +824,24 @@
 
     /**
      * Format a double.
+     *
      * @param x The double to format.
-     * @return  The formatted String.
-     * @exception IllegalArgumentException if the
-     *     conversion character is c, C, s, S,
-     *     d, d, x, X, or o.
+     * @return The formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is c, C, s, S,
+     *                                  d, d, x, X, or o.
      */
     public String sprintf(double x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -846,22 +860,23 @@
 
     /**
      * Format a String.
+     *
      * @param x The String to format.
-     * @return  The formatted String.
-     * @exception IllegalArgumentException if the
-     *   conversion character is neither s nor S.
+     * @return The formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is neither s nor S.
      */
     public String sprintf(String x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -885,23 +900,24 @@
      * Strings using an internal formatting method for
      * Strings. Otherwise use the default formatter
      * (use toString).
+     *
      * @param x the Object to format.
-     * @return  the formatted String.
-     * @exception IllegalArgumentException if the
-     *    conversion character is inappropriate for
-     *    formatting an unwrapped value.
+     * @return the formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is inappropriate for
+     *                                  formatting an unwrapped value.
      */
     public String sprintf(Object x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -946,30 +962,30 @@
     }
 
     /**
-     * <p>
+     * <p/>
      * ConversionSpecification allows the formatting of
      * a single primitive or object embedded within a
      * string.  The formatting is controlled by a
      * format string.  Only one Java primitive or
      * object can be formatted at a time.
-     * <p>
+     * <p/>
      * A format string is a Java string that contains
      * a control string.  The control string starts at
      * the first percent sign (%) in the string,
      * provided that this percent sign
      * <ol>
      * <li>is not escaped protected by a matching % or
-     *     is not an escape % character,
+     * is not an escape % character,
      * <li>is not at the end of the format string, and
      * <li>precedes a sequence of characters that parses
-     *     as a valid control string.
+     * as a valid control string.
      * </ol>
-     * <p>
+     * <p/>
      * A control string takes the form:
      * <pre> % ['-+ #0]* [0..9]* { . [0..9]* }+
      *                { [hlL] }+ [idfgGoxXeEcs]
      * </pre>
-     * <p>
+     * <p/>
      * The behavior is like printf.  One (hopefully the
      * only) exception is that the minimum number of
      * exponent digits is 3 instead of 2 for e and E
@@ -980,7 +996,9 @@
      */
     private class ConversionSpecification
     {
-        /** Default precision. */
+        /**
+         * Default precision.
+         */
         private final static int defaultDigits = 6;
 
         /**
@@ -1051,7 +1069,7 @@
          * d, i, o, u, x, or X conversions.  The number of
          * digits to appear after the radix character for
          * the e, E, and f conversions.  The maximum number
-         *  of significant digits for the g and G
+         * of significant digits for the g and G
          * conversions.  The maximum number of bytes to be
          * printed from a string in s and S conversions.
          */
@@ -1070,12 +1088,12 @@
 
         /*
          */
-        private boolean positionalSpecification       = false;
-        private int     argumentPosition              = 0;
-        private boolean positionalFieldWidth          = false;
-        private int     argumentPositionForFieldWidth = 0;
-        private boolean positionalPrecision           = false;
-        private int     argumentPositionForPrecision  = 0;
+        private boolean positionalSpecification = false;
+        private int argumentPosition = 0;
+        private boolean positionalFieldWidth = false;
+        private int argumentPositionForFieldWidth = 0;
+        private boolean positionalPrecision = false;
+        private int argumentPositionForPrecision = 0;
 
         /**
          * Flag specifying that a following d, i, o, u, x,
@@ -1098,7 +1116,9 @@
          */
         private boolean optionalL = false;
 
-        /** Control string type. */
+        /**
+         * Control string type.
+         */
         private char conversionCharacter = '\0';
 
         /**
@@ -1107,7 +1127,9 @@
          */
         private int pos = 0;
 
-        /** Literal or control format string. */
+        /**
+         * Literal or control format string.
+         */
         private String fmt;
 
         /**
@@ -1123,11 +1145,12 @@
          * The argument must begin with a % and end
          * with the conversion character for the
          * conversion specification.
-         *  @param fmtArg  String specifying the
-         *     conversion specification.
-         *  @exception IllegalArgumentException if the
-         *     input string is null, zero length, or
-         *     otherwise malformed.
+         *
+         * @param fmtArg String specifying the
+         *               conversion specification.
+         * @throws IllegalArgumentException if the
+         *                                  input string is null, zero length, or
+         *                                  otherwise malformed.
          */
         ConversionSpecification(String fmtArg) throws IllegalArgumentException
         {
@@ -1163,7 +1186,7 @@
                         if (precisionSet && leadingZeros)
                         {
                             if ((conversionCharacter == 'd') || (conversionCharacter == 'i') || (conversionCharacter == 'o')
-                                || (conversionCharacter == 'x'))
+                                    || (conversionCharacter == 'x'))
                             {
                                 leadingZeros = false;
                             }
@@ -1184,6 +1207,7 @@
 
         /**
          * Set the String for this instance.
+         *
          * @param s the String to store.
          */
         void setLiteral(String s)
@@ -1200,7 +1224,7 @@
         String getLiteral()
         {
             StringBuffer sb = new StringBuffer();
-            int          i  = 0;
+            int i = 0;
 
             while (i < fmt.length())
             {
@@ -1214,42 +1238,42 @@
 
                         switch (c)
                         {
-                        case 'a' :
+                        case 'a':
                             sb.append((char) 0x07);
 
                             break;
 
-                        case 'b' :
+                        case 'b':
                             sb.append('\b');
 
                             break;
 
-                        case 'f' :
+                        case 'f':
                             sb.append('\f');
 
                             break;
 
-                        case 'n' :
+                        case 'n':
                             sb.append(System.getProperty("line.separator"));
 
                             break;
 
-                        case 'r' :
+                        case 'r':
                             sb.append('\r');
 
                             break;
 
-                        case 't' :
+                        case 't':
                             sb.append('\t');
 
                             break;
 
-                        case 'v' :
+                        case 'v':
                             sb.append((char) 0x0b);
 
                             break;
 
-                        case '\\' :
+                        case '\\':
                             sb.append('\\');
 
                             break;
@@ -1284,9 +1308,10 @@
          * Check whether the specifier has a variable
          * field width that is going to be set by an
          * argument.
+         *
          * @return <code>true</code> if the conversion
-         *   uses an * field width; otherwise
-         *   <code>false</code>.
+         *         uses an * field width; otherwise
+         *         <code>false</code>.
          */
         boolean isVariableFieldWidth()
         {
@@ -1297,6 +1322,7 @@
          * Set the field width with an argument.  A
          * negative field width is taken as a - flag
          * followed by a positive field width.
+         *
          * @param fw the field width.
          */
         void setFieldWidthWithArg(int fw)
@@ -1307,16 +1333,17 @@
             }
 
             fieldWidthSet = true;
-            fieldWidth    = Math.abs(fw);
+            fieldWidth = Math.abs(fw);
         }
 
         /**
          * Check whether the specifier has a variable
          * precision that is going to be set by an
          * argument.
+         *
          * @return <code>true</code> if the conversion
-         *   uses an * precision; otherwise
-         *   <code>false</code>.
+         *         uses an * precision; otherwise
+         *         <code>false</code>.
          */
         boolean isVariablePrecision()
         {
@@ -1326,21 +1353,23 @@
         /**
          * Set the precision with an argument.  A
          * negative precision will be changed to zero.
+         *
          * @param pr the precision.
          */
         void setPrecisionWithArg(int pr)
         {
             precisionSet = true;
-            precision    = Math.max(pr, 0);
+            precision = Math.max(pr, 0);
         }
 
         /**
          * Format an int argument using this conversion
-         *  specification.
+         * specification.
+         *
          * @param s the int to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *     conversion character is f, e, E, g, or G.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is f, e, E, g, or G.
          */
         String internalsprintf(int s) throws IllegalArgumentException
         {
@@ -1348,8 +1377,8 @@
 
             switch (conversionCharacter)
             {
-            case 'd' :
-            case 'i' :
+            case 'd':
+            case 'i':
                 if (optionalh)
                 {
                     s2 = printDFormat((short) s);
@@ -1363,8 +1392,8 @@
 
                 break;
 
-            case 'x' :
-            case 'X' :
+            case 'x':
+            case 'X':
                 if (optionalh)
                 {
                     s2 = printXFormat((short) s);
@@ -1378,7 +1407,7 @@
 
                 break;
 
-            case 'o' :
+            case 'o':
                 if (optionalh)
                 {
                     s2 = printOFormat((short) s);
@@ -1392,15 +1421,15 @@
 
                 break;
 
-            case 'c' :
-            case 'C' :
+            case 'c':
+            case 'C':
                 s2 = printCFormat((char) s);
 
                 break;
 
-            default :
+            default:
                 throw new IllegalArgumentException("Cannot format a int with a format using a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1409,10 +1438,11 @@
         /**
          * Format a long argument using this conversion
          * specification.
+         *
          * @param s the long to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *     conversion character is f, e, E, g, or G.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is f, e, E, g, or G.
          */
         String internalsprintf(long s) throws IllegalArgumentException
         {
@@ -1420,8 +1450,8 @@
 
             switch (conversionCharacter)
             {
-            case 'd' :
-            case 'i' :
+            case 'd':
+            case 'i':
                 if (optionalh)
                 {
                     s2 = printDFormat((short) s);
@@ -1435,8 +1465,8 @@
 
                 break;
 
-            case 'x' :
-            case 'X' :
+            case 'x':
+            case 'X':
                 if (optionalh)
                 {
                     s2 = printXFormat((short) s);
@@ -1450,7 +1480,7 @@
 
                 break;
 
-            case 'o' :
+            case 'o':
                 if (optionalh)
                 {
                     s2 = printOFormat((short) s);
@@ -1464,15 +1494,15 @@
 
                 break;
 
-            case 'c' :
-            case 'C' :
+            case 'c':
+            case 'C':
                 s2 = printCFormat((char) s);
 
                 break;
 
-            default :
+            default:
                 throw new IllegalArgumentException("Cannot format a long with a format using a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1481,11 +1511,12 @@
         /**
          * Format a double argument using this conversion
          * specification.
+         *
          * @param s the double to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *     conversion character is c, C, s, S, i, d,
-         *     x, X, or o.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is c, C, s, S, i, d,
+         *                                  x, X, or o.
          */
         String internalsprintf(double s) throws IllegalArgumentException
         {
@@ -1493,26 +1524,26 @@
 
             switch (conversionCharacter)
             {
-            case 'f' :
+            case 'f':
                 s2 = printFFormat(s);
 
                 break;
 
-            case 'E' :
-            case 'e' :
+            case 'E':
+            case 'e':
                 s2 = printEFormat(s);
 
                 break;
 
-            case 'G' :
-            case 'g' :
+            case 'G':
+            case 'g':
                 s2 = printGFormat(s);
 
                 break;
 
-            default :
+            default:
                 throw new IllegalArgumentException("Cannot " + "format a double with a format using a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1521,10 +1552,11 @@
         /**
          * Format a String argument using this conversion
          * specification.
+         *
          * @param s the String to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *   conversion character is neither s nor S.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is neither s nor S.
          */
         String internalsprintf(String s) throws IllegalArgumentException
         {
@@ -1536,7 +1568,7 @@
             } else
             {
                 throw new IllegalArgumentException("Cannot " + "format a String with a format using a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1545,10 +1577,11 @@
         /**
          * Format an Object argument using this conversion
          * specification.
+         *
          * @param s the Object to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *     conversion character is neither s nor S.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is neither s nor S.
          */
         String internalsprintf(Object s)
         {
@@ -1560,7 +1593,7 @@
             } else
             {
                 throw new IllegalArgumentException("Cannot format a String with a format using" + " a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1578,12 +1611,12 @@
          * is ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the number of digits
          * to appear after the radix character.  Padding is
          * with trailing 0s.
@@ -1591,10 +1624,10 @@
         private char[] fFormatDigits(double x)
         {
             // int defaultDigits=6;
-            String  sx, sxOut;
-            int     i, j, k;
-            int     n1In, n2In;
-            int     expon     = 0;
+            String sx, sxOut;
+            int i, j, k;
+            int n1In, n2In;
+            int expon = 0;
             boolean minusSign = false;
 
             if (x > 0.0)
@@ -1602,7 +1635,7 @@
                 sx = Double.toString(x);
             } else if (x < 0.0)
             {
-                sx        = Double.toString(-x);
+                sx = Double.toString(-x);
                 minusSign = true;
             } else
             {
@@ -1611,7 +1644,7 @@
                 if (sx.charAt(0) == '-')
                 {
                     minusSign = true;
-                    sx        = sx.substring(1);
+                    sx = sx.substring(1);
                 }
             }
 
@@ -1761,7 +1794,7 @@
                     ca4[0] = '1';
                 }
 
-                if (alternateForm ||!precisionSet || (precision != 0))
+                if (alternateForm || !precisionSet || (precision != 0))
                 {
                     ca4[1] = '.';
 
@@ -1779,7 +1812,7 @@
             {
                 if (!carry)
                 {
-                    if (alternateForm ||!precisionSet || (precision != 0))
+                    if (alternateForm || !precisionSet || (precision != 0))
                     {
                         ca4 = new char[n1In + expon + p + 1];
                     } else
@@ -1790,7 +1823,7 @@
                     j = 0;
                 } else
                 {
-                    if (alternateForm ||!precisionSet || (precision != 0))
+                    if (alternateForm || !precisionSet || (precision != 0))
                     {
                         ca4 = new char[n1In + expon + p + 2];
                     } else
@@ -1799,7 +1832,7 @@
                     }
 
                     ca4[0] = '1';
-                    j      = 1;
+                    j = 1;
                 }
 
                 for (i = 0; i < Math.min(n1In + expon, ca3.length); i++, j++)
@@ -1812,7 +1845,7 @@
                     ca4[j] = '0';
                 }
 
-                if (alternateForm ||!precisionSet || (precision != 0))
+                if (alternateForm || !precisionSet || (precision != 0))
                 {
                     ca4[j] = '.';
                     j++;
@@ -1941,7 +1974,7 @@
 
             if (thousands && (nThousands > 0))
             {
-                ca6    = new char[ca5.length + nThousands + lead];
+                ca6 = new char[ca5.length + nThousands + lead];
                 ca6[0] = ca5[0];
 
                 for (i = lead, k = lead; i < dp; i++)
@@ -1949,9 +1982,9 @@
                     if ((i > 0) && (dp - i) % 3 == 0)
                     {
                         // ca6[k]=',';
-                        ca6[k]     = dfs.getGroupingSeparator();
+                        ca6[k] = dfs.getGroupingSeparator();
                         ca6[k + 1] = ca5[i];
-                        k          += 2;
+                        k += 2;
                     } else
                     {
                         ca6[k] = ca5[i];
@@ -1974,13 +2007,14 @@
          * the input double value is an infinity,
          * not-a-number, or a finite double and formats
          * each type of input appropriately.
+         *
          * @param x the double value to be formatted.
          * @return the converted double value.
          */
         private String fFormatString(double x)
         {
             boolean noDigits = false;
-            char[]  ca6, ca7;
+            char[] ca6, ca7;
 
             if (Double.isInfinite(x))
             {
@@ -2038,16 +2072,16 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear after the radix character.
          * Padding is with trailing 0s.
-         *
+         * <p/>
          * The behavior is like printf.  One (hopefully the
          * only) exception is that the minimum number of
          * exponent digits is 3 instead of 2 for e and E
@@ -2061,11 +2095,11 @@
             char[] ca1, ca2, ca3;
 
             // int defaultDigits=6;
-            String  sx, sxOut;
-            int     i, j, k, p;
-            int     n1In, n2In;
-            int     expon = 0;
-            int     ePos, rPos, eSize;
+            String sx, sxOut;
+            int i, j, k, p;
+            int n1In, n2In;
+            int expon = 0;
+            int ePos, rPos, eSize;
             boolean minusSign = false;
 
             if (x > 0.0)
@@ -2073,7 +2107,7 @@
                 sx = Double.toString(x);
             } else if (x < 0.0)
             {
-                sx        = Double.toString(-x);
+                sx = Double.toString(-x);
                 minusSign = true;
             } else
             {
@@ -2082,7 +2116,7 @@
                 if (sx.charAt(0) == '-')
                 {
                     minusSign = true;
-                    sx        = sx.substring(1);
+                    sx = sx.substring(1);
                 }
             }
 
@@ -2190,7 +2224,7 @@
             }
 
             boolean carry = false;
-            int     i0    = 0;
+            int i0 = 0;
 
             if (ca1[0] != '0')
             {
@@ -2217,7 +2251,7 @@
 
                 if (carry)
                 {
-                    ca2     = new char[i0 + p + 1];
+                    ca2 = new char[i0 + p + 1];
                     ca2[i0] = '1';
 
                     for (j = 0; j < i0; j++)
@@ -2235,7 +2269,7 @@
                 }
             }
 
-            if ((Math.abs(expon) < 100) &&!optionalL)
+            if ((Math.abs(expon) < 100) && !optionalL)
             {
                 eSize = 4;
             } else
@@ -2243,7 +2277,7 @@
                 eSize = 5;
             }
 
-            if (alternateForm ||!precisionSet || (precision != 0))
+            if (alternateForm || !precisionSet || (precision != 0))
             {
                 ca2 = new char[2 + p + eSize];
             } else
@@ -2254,12 +2288,12 @@
             if (ca1[0] != '0')
             {
                 ca2[0] = ca1[0];
-                j      = 1;
+                j = 1;
             } else
             {
                 for (j = 1; j < ((ePos == -1)
-                                 ? ca1.length
-                                 : ePos); j++)
+                        ? ca1.length
+                        : ePos); j++)
                 {
                     if (ca1[j] != '0')
                     {
@@ -2270,19 +2304,19 @@
                 if (((ePos != -1) && (j < ePos)) || ((ePos == -1) && (j < ca1.length)))
                 {
                     ca2[0] = ca1[j];
-                    expon  -= j;
+                    expon -= j;
                     j++;
                 } else
                 {
                     ca2[0] = '0';
-                    j      = 2;
+                    j = 2;
                 }
             }
 
-            if (alternateForm ||!precisionSet || (precision != 0))
+            if (alternateForm || !precisionSet || (precision != 0))
             {
                 ca2[1] = '.';
-                i      = 2;
+                i = 2;
             } else
             {
                 i = 1;
@@ -2314,47 +2348,47 @@
             {
                 switch (expon / 100)
                 {
-                case 1 :
+                case 1:
                     ca2[i] = '1';
 
                     break;
 
-                case 2 :
+                case 2:
                     ca2[i] = '2';
 
                     break;
 
-                case 3 :
+                case 3:
                     ca2[i] = '3';
 
                     break;
 
-                case 4 :
+                case 4:
                     ca2[i] = '4';
 
                     break;
 
-                case 5 :
+                case 5:
                     ca2[i] = '5';
 
                     break;
 
-                case 6 :
+                case 6:
                     ca2[i] = '6';
 
                     break;
 
-                case 7 :
+                case 7:
                     ca2[i] = '7';
 
                     break;
 
-                case 8 :
+                case 8:
                     ca2[i] = '8';
 
                     break;
 
-                case 9 :
+                case 9:
                     ca2[i] = '9';
 
                     break;
@@ -2365,52 +2399,52 @@
 
             switch ((expon % 100) / 10)
             {
-            case 0 :
+            case 0:
                 ca2[i] = '0';
 
                 break;
 
-            case 1 :
+            case 1:
                 ca2[i] = '1';
 
                 break;
 
-            case 2 :
+            case 2:
                 ca2[i] = '2';
 
                 break;
 
-            case 3 :
+            case 3:
                 ca2[i] = '3';
 
                 break;
 
-            case 4 :
+            case 4:
                 ca2[i] = '4';
 
                 break;
 
-            case 5 :
+            case 5:
                 ca2[i] = '5';
 
                 break;
 
-            case 6 :
+            case 6:
                 ca2[i] = '6';
 
                 break;
 
-            case 7 :
+            case 7:
                 ca2[i] = '7';
 
                 break;
 
-            case 8 :
+            case 8:
                 ca2[i] = '8';
 
                 break;
 
-            case 9 :
+            case 9:
                 ca2[i] = '9';
 
                 break;
@@ -2420,52 +2454,52 @@
 
             switch (expon % 10)
             {
-            case 0 :
+            case 0:
                 ca2[i] = '0';
 
                 break;
 
-            case 1 :
+            case 1:
                 ca2[i] = '1';
 
                 break;
 
-            case 2 :
+            case 2:
                 ca2[i] = '2';
 
                 break;
 
-            case 3 :
+            case 3:
                 ca2[i] = '3';
 
                 break;
 
-            case 4 :
+            case 4:
                 ca2[i] = '4';
 
                 break;
 
-            case 5 :
+            case 5:
                 ca2[i] = '5';
 
                 break;
 
-            case 6 :
+            case 6:
                 ca2[i] = '6';
 
                 break;
 
-            case 7 :
+            case 7:
                 ca2[i] = '7';
 
                 break;
 
-            case 8 :
+            case 8:
                 ca2[i] = '8';
 
                 break;
 
-            case 9 :
+            case 9:
                 ca2[i] = '9';
 
                 break;
@@ -2583,7 +2617,7 @@
 
             if (thousands && (nThousands > 0))
             {
-                ca4    = new char[ca3.length + nThousands + lead];
+                ca4 = new char[ca3.length + nThousands + lead];
                 ca4[0] = ca3[0];
 
                 for (i = lead, k = lead; i < dp; i++)
@@ -2591,9 +2625,9 @@
                     if ((i > 0) && (dp - i) % 3 == 0)
                     {
                         // ca4[k]=',';
-                        ca4[k]     = dfs.getGroupingSeparator();
+                        ca4[k] = dfs.getGroupingSeparator();
                         ca4[k + 1] = ca3[i];
-                        k          += 2;
+                        k += 2;
                     } else
                     {
                         ca4[k] = ca3[i];
@@ -2614,11 +2648,12 @@
          * Check to see if the digits that are going to
          * be truncated because of the precision should
          * force a round in the preceding digits.
-         * @param ca1 the array of digits
+         *
+         * @param ca1    the array of digits
          * @param icarry the index of the first digit that
-         *     is to be truncated from the print
+         *               is to be truncated from the print
          * @return <code>true</code> if the truncation forces
-         *     a round that will change the print
+         *         a round that will change the print
          */
         private boolean checkForCarry(char[] ca1, int icarry)
         {
@@ -2646,7 +2681,7 @@
                     if (!carry && (icarry > 0))
                     {
                         carry = ((ca1[icarry - 1] == '1') || (ca1[icarry - 1] == '3') || (ca1[icarry - 1] == '5')
-                                 || (ca1[icarry - 1] == '7') || (ca1[icarry - 1] == '9'));
+                                || (ca1[icarry - 1] == '7') || (ca1[icarry - 1] == '9'));
                     }
                 }
             }
@@ -2659,13 +2694,14 @@
          * is not quite finished because the symbolic
          * carry may change the length of the string and
          * change the exponent (in e format).
-         * @param cLast index of the last digit changed
-         *     by the round
+         *
+         * @param cLast  index of the last digit changed
+         *               by the round
          * @param cFirst index of the first digit allowed
-         *     to be changed by this phase of the round
+         *               to be changed by this phase of the round
          * @return <code>true</code> if the carry forces
-         *     a round that will change the print still
-         *     more
+         *         a round that will change the print still
+         *         more
          */
         private boolean startSymbolicCarry(char[] ca, int cLast, int cFirst)
         {
@@ -2677,52 +2713,52 @@
 
                 switch (ca[i])
                 {
-                case '0' :
+                case '0':
                     ca[i] = '1';
 
                     break;
 
-                case '1' :
+                case '1':
                     ca[i] = '2';
 
                     break;
 
-                case '2' :
+                case '2':
                     ca[i] = '3';
 
                     break;
 
-                case '3' :
+                case '3':
                     ca[i] = '4';
 
                     break;
 
-                case '4' :
+                case '4':
                     ca[i] = '5';
 
                     break;
 
-                case '5' :
+                case '5':
                     ca[i] = '6';
 
                     break;
 
-                case '6' :
+                case '6':
                     ca[i] = '7';
 
                     break;
 
-                case '7' :
+                case '7':
                     ca[i] = '8';
 
                     break;
 
-                case '8' :
+                case '8':
                     ca[i] = '9';
 
                     break;
 
-                case '9' :
+                case '9':
                     ca[i] = '0';
                     carry = true;
 
@@ -2739,15 +2775,16 @@
          * the input double value is an infinity,
          * not-a-number, or a finite double and formats
          * each type of input appropriately.
-         * @param x the double value to be formatted.
+         *
+         * @param x     the double value to be formatted.
          * @param eChar an 'e' or 'E' to use in the
-         *     converted double value.
+         *              converted double value.
          * @return the converted double value.
          */
         private String eFormatString(double x, char eChar)
         {
             boolean noDigits = false;
-            char[]  ca4, ca5;
+            char[] ca4, ca5;
 
             if (Double.isInfinite(x))
             {
@@ -2795,8 +2832,9 @@
 
         /**
          * Apply zero or blank, left or right padding.
-         * @param ca4 array of characters before padding is
-         *     finished
+         *
+         * @param ca4      array of characters before padding is
+         *                 finished
          * @param noDigits NaN or signed Inf
          * @return a padded array of characters
          */
@@ -2851,8 +2889,8 @@
                     if (nBlanks > 0)
                     {
                         ca5 = new char[ca4.length + nBlanks];
-                        i   = 0;
-                        j   = 0;
+                        i = 0;
+                        j = 0;
 
                         if (ca4[0] == '-')
                         {
@@ -2879,6 +2917,7 @@
 
         /**
          * Format method for the f conversion character.
+         *
          * @param x the double to format.
          * @return the formatted String.
          */
@@ -2890,6 +2929,7 @@
         /**
          * Format method for the e or E conversion
          * character.
+         *
          * @param x the double to format.
          * @return the formatted String.
          */
@@ -2906,9 +2946,9 @@
 
         /**
          * Format method for the g conversion character.
-         *
+         * <p/>
          * For g format, the flag character '-', means that
-         *  the output should be left justified within the
+         * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  '+' character means that the conversion
          * will always begin with a sign (+ or -).  The
@@ -2918,24 +2958,25 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear after the radix character.
          * Padding is with trailing 0s.
+         *
          * @param x the double to format.
          * @return the formatted String.
          */
         private String printGFormat(double x)
         {
-            String  sx, sy, sz, ret;
-            int     savePrecision = precision;
-            int     i;
-            char[]  ca4, ca5;
+            String sx, sy, sz, ret;
+            int savePrecision = precision;
+            int i;
+            char[] ca4, ca5;
             boolean noDigits = false;
 
             if (Double.isInfinite(x))
@@ -2988,11 +3029,11 @@
 
                 if (conversionCharacter == 'g')
                 {
-                    sx   = eFormatString(x, 'e').trim();
+                    sx = eFormatString(x, 'e').trim();
                     ePos = sx.indexOf('e');
                 } else
                 {
-                    sx   = eFormatString(x, 'E').trim();
+                    sx = eFormatString(x, 'E').trim();
                     ePos = sx.indexOf('E');
                 }
 
@@ -3106,7 +3147,7 @@
             }
 
             // Pad with blanks or zeros.
-            ca5       = applyFloatPadding(ca4, false);
+            ca5 = applyFloatPadding(ca4, false);
             precision = savePrecision;
 
             return new String(ca5);
@@ -3115,7 +3156,7 @@
         /**
          * Format method for the d conversion specifer and
          * short argument.
-         *
+         * <p/>
          * For d format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
@@ -3127,14 +3168,15 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the short to format.
          * @return the formatted String.
          */
@@ -3146,7 +3188,7 @@
         /**
          * Format method for the d conversion character and
          * long argument.
-         *
+         * <p/>
          * For d format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
@@ -3158,14 +3200,15 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the long to format.
          * @return the formatted String.
          */
@@ -3177,7 +3220,7 @@
         /**
          * Format method for the d conversion character and
          * int argument.
-         *
+         * <p/>
          * For d format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
@@ -3189,14 +3232,15 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the int to format.
          * @return the formatted String.
          */
@@ -3208,19 +3252,20 @@
         /**
          * Utility method for formatting using the d
          * conversion character.
+         *
          * @param sx the String to format, the result of
-         *     converting a short, int, or long to a
-         *     String.
+         *           converting a short, int, or long to a
+         *           String.
          * @return the formatted String.
          */
         private String printDFormat(String sx)
         {
-            int     nLeadingZeros = 0;
-            int     nBlanks       = 0,
-                    n             = 0;
-            int     i             = 0,
-                    jFirst        = 0;
-            boolean neg           = sx.charAt(0) == '-';
+            int nLeadingZeros = 0;
+            int nBlanks = 0,
+                    n = 0;
+            int i = 0,
+                    jFirst = 0;
+            boolean neg = sx.charAt(0) == '-';
 
             if (sx.equals("0") && precisionSet && (precision == 0))
             {
@@ -3291,8 +3336,8 @@
                 char[] csx = sx.toCharArray();
 
                 jFirst = neg
-                         ? 1
-                         : 0;
+                        ? 1
+                        : 0;
 
                 for (int j = 0; j < nLeadingZeros; i++, j++)
                 {
@@ -3354,8 +3399,8 @@
                 char[] csx = sx.toCharArray();
 
                 jFirst = neg
-                         ? 1
-                         : 0;
+                        ? 1
+                        : 0;
 
                 for (int j = jFirst; j < csx.length; j++, i++)
                 {
@@ -3369,20 +3414,21 @@
         /**
          * Format method for the x conversion character and
          * short argument.
-         *
+         * <p/>
          * For x format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means to lead with
          * '0x'.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the short to format.
          * @return the formatted String.
          */
@@ -3412,55 +3458,55 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "800" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "80" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "8" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     switch (t.charAt(0))
                     {
-                    case '1' :
+                    case '1':
                         sx = "9" + t.substring(1, 4);
 
                         break;
 
-                    case '2' :
+                    case '2':
                         sx = "a" + t.substring(1, 4);
 
                         break;
 
-                    case '3' :
+                    case '3':
                         sx = "b" + t.substring(1, 4);
 
                         break;
 
-                    case '4' :
+                    case '4':
                         sx = "c" + t.substring(1, 4);
 
                         break;
 
-                    case '5' :
+                    case '5':
                         sx = "d" + t.substring(1, 4);
 
                         break;
 
-                    case '6' :
+                    case '6':
                         sx = "e" + t.substring(1, 4);
 
                         break;
 
-                    case '7' :
+                    case '7':
                         sx = "f" + t.substring(1, 4);
 
                         break;
@@ -3479,20 +3525,21 @@
         /**
          * Format method for the x conversion character and
          * long argument.
-         *
+         * <p/>
          * For x format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means to lead with
          * '0x'.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the long to format.
          * @return the formatted String.
          */
@@ -3509,115 +3556,115 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "800000000000000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "80000000000000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "8000000000000" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "800000000000" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "80000000000" + t;
 
                     break;
 
-                case 6 :
+                case 6:
                     sx = "8000000000" + t;
 
                     break;
 
-                case 7 :
+                case 7:
                     sx = "800000000" + t;
 
                     break;
 
-                case 8 :
+                case 8:
                     sx = "80000000" + t;
 
                     break;
 
-                case 9 :
+                case 9:
                     sx = "8000000" + t;
 
                     break;
 
-                case 10 :
+                case 10:
                     sx = "800000" + t;
 
                     break;
 
-                case 11 :
+                case 11:
                     sx = "80000" + t;
 
                     break;
 
-                case 12 :
+                case 12:
                     sx = "8000" + t;
 
                     break;
 
-                case 13 :
+                case 13:
                     sx = "800" + t;
 
                     break;
 
-                case 14 :
+                case 14:
                     sx = "80" + t;
 
                     break;
 
-                case 15 :
+                case 15:
                     sx = "8" + t;
 
                     break;
 
-                case 16 :
+                case 16:
                     switch (t.charAt(0))
                     {
-                    case '1' :
+                    case '1':
                         sx = "9" + t.substring(1, 16);
 
                         break;
 
-                    case '2' :
+                    case '2':
                         sx = "a" + t.substring(1, 16);
 
                         break;
 
-                    case '3' :
+                    case '3':
                         sx = "b" + t.substring(1, 16);
 
                         break;
 
-                    case '4' :
+                    case '4':
                         sx = "c" + t.substring(1, 16);
 
                         break;
 
-                    case '5' :
+                    case '5':
                         sx = "d" + t.substring(1, 16);
 
                         break;
 
-                    case '6' :
+                    case '6':
                         sx = "e" + t.substring(1, 16);
 
                         break;
 
-                    case '7' :
+                    case '7':
                         sx = "f" + t.substring(1, 16);
 
                         break;
@@ -3636,20 +3683,21 @@
         /**
          * Format method for the x conversion character and
          * int argument.
-         *
+         * <p/>
          * For x format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means to lead with
          * '0x'.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the int to format.
          * @return the formatted String.
          */
@@ -3666,75 +3714,75 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "8000000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "800000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "80000" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "8000" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "800" + t;
 
                     break;
 
-                case 6 :
+                case 6:
                     sx = "80" + t;
 
                     break;
 
-                case 7 :
+                case 7:
                     sx = "8" + t;
 
                     break;
 
-                case 8 :
+                case 8:
                     switch (t.charAt(0))
                     {
-                    case '1' :
+                    case '1':
                         sx = "9" + t.substring(1, 8);
 
                         break;
 
-                    case '2' :
+                    case '2':
                         sx = "a" + t.substring(1, 8);
 
                         break;
 
-                    case '3' :
+                    case '3':
                         sx = "b" + t.substring(1, 8);
 
                         break;
 
-                    case '4' :
+                    case '4':
                         sx = "c" + t.substring(1, 8);
 
                         break;
 
-                    case '5' :
+                    case '5':
                         sx = "d" + t.substring(1, 8);
 
                         break;
 
-                    case '6' :
+                    case '6':
                         sx = "e" + t.substring(1, 8);
 
                         break;
 
-                    case '7' :
+                    case '7':
                         sx = "f" + t.substring(1, 8);
 
                         break;
@@ -3753,15 +3801,16 @@
         /**
          * Utility method for formatting using the x
          * conversion character.
+         *
          * @param sx the String to format, the result of
-         *     converting a short, int, or long to a
-         *     String.
+         *           converting a short, int, or long to a
+         *           String.
          * @return the formatted String.
          */
         private String printXFormat(String sx)
         {
             int nLeadingZeros = 0;
-            int nBlanks       = 0;
+            int nBlanks = 0;
 
             if (sx.equals("0") && precisionSet && (precision == 0))
             {
@@ -3805,7 +3854,7 @@
             n += nBlanks;
 
             char[] ca = new char[n];
-            int    i  = 0;
+            int i = 0;
 
             if (leftJustify)
             {
@@ -3881,21 +3930,22 @@
         /**
          * Format method for the o conversion character and
          * short argument.
-         *
+         * <p/>
          * For o format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means that the
          * output begins with a leading 0 and the precision
          * is increased by 1.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the short to format.
          * @return the formatted String.
          */
@@ -3912,27 +3962,27 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "10000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "1000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "100" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "10" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "1" + t;
 
                     break;
@@ -3948,21 +3998,22 @@
         /**
          * Format method for the o conversion character and
          * long argument.
-         *
+         * <p/>
          * For o format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means that the
          * output begins with a leading 0 and the precision
          * is increased by 1.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the long to format.
          * @return the formatted String.
          */
@@ -3979,107 +4030,107 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "100000000000000000000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "10000000000000000000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "1000000000000000000" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "100000000000000000" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "10000000000000000" + t;
 
                     break;
 
-                case 6 :
+                case 6:
                     sx = "1000000000000000" + t;
 
                     break;
 
-                case 7 :
+                case 7:
                     sx = "100000000000000" + t;
 
                     break;
 
-                case 8 :
+                case 8:
                     sx = "10000000000000" + t;
 
                     break;
 
-                case 9 :
+                case 9:
                     sx = "1000000000000" + t;
 
                     break;
 
-                case 10 :
+                case 10:
                     sx = "100000000000" + t;
 
                     break;
 
-                case 11 :
+                case 11:
                     sx = "10000000000" + t;
 
                     break;
 
-                case 12 :
+                case 12:
                     sx = "1000000000" + t;
 
                     break;
 
-                case 13 :
+                case 13:
                     sx = "100000000" + t;
 
                     break;
 
-                case 14 :
+                case 14:
                     sx = "10000000" + t;
 
                     break;
 
-                case 15 :
+                case 15:
                     sx = "1000000" + t;
 
                     break;
 
-                case 16 :
+                case 16:
                     sx = "100000" + t;
 
                     break;
 
-                case 17 :
+                case 17:
                     sx = "10000" + t;
 
                     break;
 
-                case 18 :
+                case 18:
                     sx = "1000" + t;
 
                     break;
 
-                case 19 :
+                case 19:
                     sx = "100" + t;
 
                     break;
 
-                case 20 :
+                case 20:
                     sx = "10" + t;
 
                     break;
 
-                case 21 :
+                case 21:
                     sx = "1" + t;
 
                     break;
@@ -4095,21 +4146,22 @@
         /**
          * Format method for the o conversion character and
          * int argument.
-         *
+         * <p/>
          * For o format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means that the
          * output begins with a leading 0 and the precision
          * is increased by 1.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the int to format.
          * @return the formatted String.
          */
@@ -4126,57 +4178,57 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "2000000000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "200000000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "20000000" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "2000000" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "200000" + t;
 
                     break;
 
-                case 6 :
+                case 6:
                     sx = "20000" + t;
 
                     break;
 
-                case 7 :
+                case 7:
                     sx = "2000" + t;
 
                     break;
 
-                case 8 :
+                case 8:
                     sx = "200" + t;
 
                     break;
 
-                case 9 :
+                case 9:
                     sx = "20" + t;
 
                     break;
 
-                case 10 :
+                case 10:
                     sx = "2" + t;
 
                     break;
 
-                case 11 :
+                case 11:
                     sx = "3" + t.substring(1);
 
                     break;
@@ -4192,15 +4244,16 @@
         /**
          * Utility method for formatting using the o
          * conversion character.
+         *
          * @param sx the String to format, the result of
-         *     converting a short, int, or long to a
-         *     String.
+         *           converting a short, int, or long to a
+         *           String.
          * @return the formatted String.
          */
         private String printOFormat(String sx)
         {
             int nLeadingZeros = 0;
-            int nBlanks       = 0;
+            int nBlanks = 0;
 
             if (sx.equals("0") && precisionSet && (precision == 0))
             {
@@ -4232,9 +4285,9 @@
                 nBlanks = 0;
             }
 
-            int    n  = nLeadingZeros + sx.length() + nBlanks;
+            int n = nLeadingZeros + sx.length() + nBlanks;
             char[] ca = new char[n];
-            int    i;
+            int i;
 
             if (leftJustify)
             {
@@ -4289,24 +4342,25 @@
         /**
          * Format method for the c conversion character and
          * char argument.
-         *
+         * <p/>
          * The only flag character that affects c format is
          * the '-', meaning that the output should be left
          * justified within the field.  The default is to
          * pad with blanks on the left.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  Padding is with
          * blanks by default.  The default width is 1.
-         *
+         * <p/>
          * The precision, if set, is ignored.
+         *
          * @param x the char to format.
          * @return the formatted String.
          */
         private String printCFormat(char x)
         {
             int nPrint = 1;
-            int width  = fieldWidth;
+            int width = fieldWidth;
 
             if (!fieldWidthSet)
             {
@@ -4314,7 +4368,7 @@
             }
 
             char[] ca = new char[width];
-            int    i  = 0;
+            int i = 0;
 
             if (leftJustify)
             {
@@ -4340,30 +4394,31 @@
         /**
          * Format method for the s conversion character and
          * String argument.
-         *
+         * <p/>
          * The only flag character that affects s format is
          * the '-', meaning that the output should be left
          * justified within the field.  The default is to
          * pad with blanks on the left.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is the
          * smaller of the number of characters in the the
          * input and the precision.  Padding is with blanks
          * by default.
-         *
+         * <p/>
          * The precision, if set, specifies the maximum
          * number of characters to be printed from the
          * string.  A null digit string is treated
          * as a 0.  The default is not to set a maximum
          * number of characters to be printed.
+         *
          * @param x the String to format.
          * @return the formatted String.
          */
         private String printSFormat(String x)
         {
             int nPrint = x.length();
-            int width  = fieldWidth;
+            int width = fieldWidth;
 
             if (precisionSet && (nPrint > precision))
             {
@@ -4391,7 +4446,7 @@
             }
 
             char[] ca = new char[n];
-            int    i  = 0;
+            int i = 0;
 
             if (leftJustify)
             {
@@ -4449,9 +4504,10 @@
         /**
          * Check for a conversion character.  If it is
          * there, store it.
+         *
          * @return <code>true</code> if the conversion
-         *     character is there, and
-         *     <code>false</code> otherwise.
+         *         character is there, and
+         *         <code>false</code> otherwise.
          */
         private boolean setConversionCharacter()
         {
@@ -4465,7 +4521,7 @@
                 char c = fmt.charAt(pos);
 
                 if ((c == 'i') || (c == 'd') || (c == 'f') || (c == 'g') || (c == 'G') || (c == 'o') || (c == 'x') || (c == 'X')
-                    || (c == 'e') || (c == 'E') || (c == 'c') || (c == 's') || (c == '%'))
+                        || (c == 'e') || (c == 'E') || (c == 'c') || (c == 's') || (c == '%'))
                 {
                     conversionCharacter = c;
                     pos++;
@@ -4531,7 +4587,7 @@
                     if (!setPrecisionArgPosition())
                     {
                         variablePrecision = true;
-                        precisionSet      = true;
+                        precisionSet = true;
                     }
 
                     return;
@@ -4554,7 +4610,7 @@
                     {
                         String sz = fmt.substring(firstPos + 1, pos);
 
-                        precision    = Integer.parseInt(sz);
+                        precision = Integer.parseInt(sz);
                         precisionSet = true;
                     }
                 }
@@ -4568,7 +4624,7 @@
         {
             int firstPos = pos;
 
-            fieldWidth    = 0;
+            fieldWidth = 0;
             fieldWidthSet = false;
 
             if ((pos < fmt.length()) && (fmt.charAt(pos) == '*'))
@@ -4578,7 +4634,7 @@
                 if (!setFieldWidthArgPosition())
                 {
                     variableFieldWidth = true;
-                    fieldWidthSet      = true;
+                    fieldWidthSet = true;
                 }
             } else
             {
@@ -4599,7 +4655,7 @@
                 {
                     String sz = fmt.substring(firstPos, pos);
 
-                    fieldWidth    = Integer.parseInt(sz);
+                    fieldWidth = Integer.parseInt(sz);
                     fieldWidthSet = true;
                 }
             }
@@ -4625,8 +4681,8 @@
                 if (fmt.charAt(xPos) == '$')
                 {
                     positionalSpecification = true;
-                    argumentPosition        = Integer.parseInt(fmt.substring(pos, xPos));
-                    pos                     = xPos + 1;
+                    argumentPosition = Integer.parseInt(fmt.substring(pos, xPos));
+                    pos = xPos + 1;
                 }
             }
         }
@@ -4637,7 +4693,7 @@
         private boolean setFieldWidthArgPosition()
         {
             boolean ret = false;
-            int     xPos;
+            int xPos;
 
             for (xPos = pos; xPos < fmt.length(); xPos++)
             {
@@ -4651,10 +4707,10 @@
             {
                 if (fmt.charAt(xPos) == '$')
                 {
-                    positionalFieldWidth          = true;
+                    positionalFieldWidth = true;
                     argumentPositionForFieldWidth = Integer.parseInt(fmt.substring(pos, xPos));
-                    pos                           = xPos + 1;
-                    ret                           = true;
+                    pos = xPos + 1;
+                    ret = true;
                 }
             }
 
@@ -4667,7 +4723,7 @@
         private boolean setPrecisionArgPosition()
         {
             boolean ret = false;
-            int     xPos;
+            int xPos;
 
             for (xPos = pos; xPos < fmt.length(); xPos++)
             {
@@ -4681,10 +4737,10 @@
             {
                 if (fmt.charAt(xPos) == '$')
                 {
-                    positionalPrecision          = true;
+                    positionalPrecision = true;
                     argumentPositionForPrecision = Integer.parseInt(fmt.substring(pos, xPos));
-                    pos                          = xPos + 1;
-                    ret                          = true;
+                    pos = xPos + 1;
+                    ret = true;
                 }
             }
 
@@ -4727,12 +4783,12 @@
         private void setFlagCharacters()
         {
             /* '-+ #0 */
-            thousands     = false;
-            leftJustify   = false;
-            leadingSign   = false;
-            leadingSpace  = false;
+            thousands = false;
+            leftJustify = false;
+            leadingSign = false;
+            leadingSpace = false;
             alternateForm = false;
-            leadingZeros  = false;
+            leadingZeros = false;
 
             for (; pos < fmt.length(); pos++)
             {
@@ -4743,11 +4799,11 @@
                     thousands = true;
                 } else if (c == '-')
                 {
-                    leftJustify  = true;
+                    leftJustify = true;
                     leadingZeros = false;
                 } else if (c == '+')
                 {
-                    leadingSign  = true;
+                    leadingSign = true;
                     leadingSpace = false;
                 } else if (c == ' ')
                 {
diff --git a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7OracleReaderTest.java b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7OracleReaderTest.java
index 0ab0b93..f01a630 100644
--- a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7OracleReaderTest.java
+++ b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7OracleReaderTest.java
@@ -8,8 +8,10 @@
 import org.testng.annotations.Test;
 
 import com.vividsolutions.jts.geom.Coordinate;
-import com.ximple.util.PrintfFormat;
+
 import oracle.jdbc.OracleConnection;
+
+import com.ximple.util.PrintfFormat;
 
 /**
  * Dgn7OracleReaderTest
@@ -61,8 +63,8 @@
                 System.out.print("complexChain:");
                 if (frammeLinkage != null)
                     System.out.print(":FSC-" + frammeLinkage.getFsc() +
-                                       ":UFID-" + frammeLinkage.getUfid() +
-                                       ":COMP-" + frammeLinkage.getComponentID());
+                            ":UFID-" + frammeLinkage.getUfid() +
+                            ":COMP-" + frammeLinkage.getComponentID());
                 else
                     System.out.print("Linkage is null");
 
@@ -102,8 +104,8 @@
                 System.out.print("TextNode:origin=" + coord.toString());
                 if (frammeLinkage != null)
                     System.out.print(":FSC-" + frammeLinkage.getFsc() +
-                                       ":UFID-" + frammeLinkage.getUfid() +
-                                       ":COMP-" + frammeLinkage.getComponentID());
+                            ":UFID-" + frammeLinkage.getUfid() +
+                            ":COMP-" + frammeLinkage.getComponentID());
                 else
                     System.out.print("Linkage is null");
                 for (int i = 0; i < textNode.size(); i++)
diff --git a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java
index cc1ed35..301255e 100644
--- a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java
+++ b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7TextElementReaderTest.java
@@ -9,9 +9,9 @@
 import java.util.List;
 
 import org.apache.log4j.Logger;
+import org.geotools.TestData;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
-import org.geotools.TestData;
 
 /**
  * Dgn7TextElementReaderTest
diff --git a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7fileReaderTest.java b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7fileReaderTest.java
index 314427c..40b6d1f 100644
--- a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7fileReaderTest.java
+++ b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/Dgn7fileReaderTest.java
@@ -2,14 +2,13 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.nio.channels.FileChannel;
 
 import org.apache.log4j.Logger;
+import org.geotools.TestData;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
-import org.geotools.TestData;
 
 /**
  * Dgn7fileReaderTest
diff --git a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/OracleTarget.java b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/OracleTarget.java
index 1279340..11d8fe0 100644
--- a/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/OracleTarget.java
+++ b/xdgnjobs/ximple-dgnio/src/test/java/com/ximple/io/dgn7/OracleTarget.java
@@ -9,6 +9,7 @@
 import org.apache.log4j.Logger;
 
 import com.vividsolutions.jts.util.Assert;
+
 import oracle.jdbc.OracleConnection;
 
 /**
@@ -20,14 +21,14 @@
  */
 public class OracleTarget
 {
-    private static final Logger logger          = Logger.getLogger(OracleTarget.class);
-    private static OracleTarget _instance       = null;
-    private static final String ORACLE_URL      = "jdbc:oracle:thin:@";
-    private static final String _propUsrKey     = "user";
-    private static final String _propPassKey    = "password";
-    private static String       _oracleHost     = "192.168.11.200";
-    private static String       _oracleInstance = "NNTPC";
-    private static String       _oraclePort     = "1521";
+    private static final Logger logger = Logger.getLogger(OracleTarget.class);
+    private static OracleTarget _instance = null;
+    private static final String ORACLE_URL = "jdbc:oracle:thin:@";
+    private static final String _propUsrKey = "user";
+    private static final String _propPassKey = "password";
+    private static String _oracleHost = "192.168.11.200";
+    private static String _oracleInstance = "NNTPC";
+    private static String _oraclePort = "1521";
 
     static
     {
@@ -41,7 +42,7 @@
     }
 
     private OracleConnection oracleConnection = null;
-    private Properties       properties;
+    private Properties properties;
 
     private OracleTarget()
     {
diff --git a/xdgnjobs/ximple-jobcarrier/pom.xml b/xdgnjobs/ximple-jobcarrier/pom.xml
index ced9097..dd497ec 100644
--- a/xdgnjobs/ximple-jobcarrier/pom.xml
+++ b/xdgnjobs/ximple-jobcarrier/pom.xml
@@ -94,6 +94,10 @@
       <groupId>org.geotools</groupId>
       <artifactId>gt2-oracle-spatial</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.geotools</groupId>
+      <artifactId>gt2-mysql</artifactId>
+    </dependency>
 
     <!-- because main and sample-data depend on referencing we need a tie breaker -->
     <dependency>
@@ -149,6 +153,11 @@
       <artifactId>postgis-driver</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+    </dependency>
+
     <!-- Ximple Library -->
     <dependency>
       <artifactId>ximple-dgnio</artifactId>
diff --git a/xdgnjobs/ximple-spatialjob/pom.xml b/xdgnjobs/ximple-spatialjob/pom.xml
index 817c643..996a354 100644
--- a/xdgnjobs/ximple-spatialjob/pom.xml
+++ b/xdgnjobs/ximple-spatialjob/pom.xml
@@ -81,6 +81,10 @@
       <groupId>org.geotools</groupId>
       <artifactId>gt2-oracle-spatial</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.geotools</groupId>
+      <artifactId>gt2-mysql</artifactId>
+    </dependency>
 
     <!-- because main and sample-data depend on referencing we need a tie breaker -->
     <dependency>
@@ -132,6 +136,11 @@
       <artifactId>postgis-driver</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+    </dependency>
+
     <!-- Ximple Library -->
     <dependency>
       <groupId>com.ximple.eofms</groupId>
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java
index d43c849..7c8ea7a 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompIdDispatchableFilter.java
@@ -100,7 +100,7 @@
 
     public String getFeatureTypeName(Element element)
     {
-        StringBuilder sb= new StringBuilder();
+        StringBuilder sb = new StringBuilder();
         sb.append(getName());
         if (useLongName)
         {
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java
index 9b4109f..df378c7 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeCompLevelIdDispatchableFilter.java
@@ -109,7 +109,7 @@
 
     public String getFeatureTypeName(Element element)
     {
-        StringBuilder sb= new StringBuilder();
+        StringBuilder sb = new StringBuilder();
         sb.append(getName());
         if (useLongName)
         {
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java
index 9ab6756..465bdc8 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/filter/TypeIdDispatchableFilter.java
@@ -82,7 +82,7 @@
 
     public String getFeatureTypeName(Element element)
     {
-        StringBuilder sb= new StringBuilder();
+        StringBuilder sb = new StringBuilder();
         sb.append(getName());
         if (useLongName)
         {
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleDatabaseJob.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleDatabaseJob.java
index 2b1ea1e..163b63c 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleDatabaseJob.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/AbstractOracleDatabaseJob.java
@@ -10,12 +10,8 @@
 import java.util.StringTokenizer;
 import java.util.TreeMap;
 
-import com.vividsolutions.jts.util.Assert;
-import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
-
 import org.apache.commons.logging.Log;
 import org.geotools.data.DataStore;
-import org.geotools.data.postgis.PostgisDataStoreFactory;
 import org.geotools.data.jdbc.ConnectionPoolManager;
 import org.geotools.data.oracle.OracleDataStore;
 import org.geotools.data.oracle.OracleDataStoreFactory;
@@ -25,13 +21,19 @@
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 
+import com.vividsolutions.jts.util.Assert;
+
 import oracle.sql.BLOB;
+
+import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
 
 public abstract class AbstractOracleDatabaseJob implements Job
 {
-    /** The Oracle driver class name */
+    /**
+     * The Oracle driver class name
+     */
     private static final String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
-    
+
     private static final String ORACLE_URL = "jdbc:oracle:thin:@";
     private static final String PROPUsrKey = "user";
     private static final String PROPPassKey = "password";
@@ -74,9 +76,11 @@
 
     protected AbstractOracleDatabaseJob()
     {
-        try {
+        try
+        {
             Class.forName(JDBC_DRIVER);
-        } catch (Throwable t) {
+        } catch (Throwable t)
+        {
             // must be running off dummy jar!
             driverFound = false;
         }
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2MySQLJob.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2MySQLJob.java
new file mode 100644
index 0000000..ade54b4
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2MySQLJob.java
@@ -0,0 +1,1089 @@
+package com.ximple.eofms.jobs;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.FileChannel;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.map.LinkedMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.geotools.data.DataStore;
+import org.geotools.data.mysql.MySQLDataStore;
+import org.geotools.data.mysql.MySQLDataStoreFactory;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import oracle.jdbc.OracleConnection;
+import oracle.jdbc.OracleResultSet;
+import oracle.sql.ARRAY;
+import oracle.sql.BLOB;
+
+import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
+import com.ximple.eofms.jobs.context.mysql.OracleConvertMySQLJobContext;
+import com.ximple.eofms.jobs.context.mysql.IndexDgnConvertMySQLJobContext;
+import com.ximple.eofms.jobs.context.mysql.GeneralDgnConvertMySQLJobContext;
+import com.ximple.eofms.jobs.context.mysql.FeatureDgnConvertMySQLJobContext;
+import com.ximple.eofms.util.BinConverter;
+import com.ximple.eofms.util.ByteArrayCompressor;
+import com.ximple.eofms.util.StringUtils;
+import com.ximple.io.dgn7.ComplexElement;
+import com.ximple.io.dgn7.Dgn7fileException;
+import com.ximple.io.dgn7.Dgn7fileReader;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.ElementType;
+import com.ximple.io.dgn7.IElementHandler;
+import com.ximple.io.dgn7.Lock;
+import com.ximple.io.dgn7.TextElement;
+import com.ximple.util.PrintfFormat;
+
+public class OracleConvertDgn2MySQLJob extends AbstractOracleDatabaseJob
+{
+    final static Log logger = LogFactory.getLog(OracleConvertDgn2PostGISJob.class);
+
+    private static final String MYHOST = "MYHOST";
+    private static final String MYDATBASE = "MYDATBASE";
+    private static final String MYPORT = "MYPORT";
+    private static final String MYSCHEMA = "MYSCHEMA";
+    private static final String MYUSER = "MYUSER";
+    private static final String MYPASS = "MYPASS";
+    private static final String USEWKB = "USEWKB";
+
+    private static final int FETCHSIZE = 30;
+    private static final int BATCHSIZE = 25;
+    private static final int COMMITSIZE = 20;
+
+    class Pair
+    {
+        Object first;
+        Object second;
+
+        public Pair(Object first, Object second)
+        {
+            this.first = first;
+            this.second = second;
+        }
+    }
+
+    protected static MySQLDataStoreFactory dataStoreFactory = new MySQLDataStoreFactory();
+
+    GeometryFactory _geomFactory = new GeometryFactory();
+    protected String _myHost;
+    protected String _myDatabase;
+    protected String _myPort;
+    protected String _mySchema;
+    protected String _myUsername;
+    protected String _myPassword;
+    protected String _myUseWKB;
+
+    protected Map<String, String> myProperties;
+    protected MySQLDataStore targetDataStore;
+
+    public Log getLogger()
+    {
+        return logger;
+    }
+
+    protected AbstractOracleJobContext prepareJobContext(String filterPath)
+    {
+        return new OracleConvertMySQLJobContext(getDataPath(), getTargetDataStore(), filterPath);
+    }
+
+    protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException
+    {
+        super.extractJobConfiguration(jobDetail);
+        JobDataMap dataMap = jobDetail.getJobDataMap();
+        _myHost = dataMap.getString(MYHOST);
+        _myDatabase = dataMap.getString(MYDATBASE);
+        _myPort = dataMap.getString(MYPORT);
+        _mySchema = dataMap.getString(MYSCHEMA);
+        _myUsername = dataMap.getString(MYUSER);
+        _myPassword = dataMap.getString(MYPASS);
+        _myUseWKB = dataMap.getString(USEWKB);
+
+        Log logger = getLogger();
+        /*
+        logger.info("MYHOST=" + _myHost);
+        logger.info("MYDATBASE=" + _myDatabase);
+        logger.info("MYPORT=" + _myPort);
+        logger.info("MYSCHEMA=" + _mySchema);
+        logger.info("MYUSER=" + _myUsername);
+        logger.info("MYPASS=" + _myPassword);
+        logger.info("USEWKB=" + _myUseWKB);
+        */
+
+        if (_myHost == null)
+        {
+            logger.warn("MYHOST is null");
+            throw new JobExecutionException("Unknown PostGIS host.");
+        }
+        if (_myDatabase == null)
+        {
+            logger.warn("PGDATABASE is null");
+            throw new JobExecutionException("Unknown PostGIS database.");
+        }
+        if (_myPort == null)
+        {
+            logger.warn("MYPORT is null");
+            throw new JobExecutionException("Unknown PostGIS port.");
+        }
+        if (_mySchema == null)
+        {
+            logger.warn("MYSCHEMA is null");
+            throw new JobExecutionException("Unknown PostGIS schema.");
+        }
+        if (_myUsername == null)
+        {
+            logger.warn("PGUSERNAME is null");
+            throw new JobExecutionException("Unknown PostGIS username.");
+        }
+        if (_myPassword == null)
+        {
+            logger.warn("PGPASSWORD is null");
+            throw new JobExecutionException("Unknown PostGIS password.");
+        }
+
+        Map<String, String> remote = new TreeMap<String, String>();
+        remote.put("dbtype", "postgis");
+        remote.put("charset", "UTF-8");
+        remote.put("host", _myHost);
+        remote.put("port", _myPort);
+        remote.put("database", _myDatabase);
+        remote.put("user", _myUsername);
+        remote.put("passwd", _myPassword);
+        remote.put("namespace", null);
+        myProperties = remote;
+    }
+
+    public void execute(JobExecutionContext context) throws JobExecutionException
+    {
+        // Every job has its own job detail
+        JobDetail jobDetail = context.getJobDetail();
+
+        // The name is defined in the job definition
+        String jobName = jobDetail.getName();
+
+        // Log the time the job started
+        logger.info(jobName + " fired at " + new Date());
+        extractJobConfiguration(jobDetail);
+        createSourceDataStore();
+        createTargetDataStore();
+        if (getSourceDataStore() == null)
+        {
+            logger.warn("Cannot connect source oracle database.");
+            throw new JobExecutionException("Cannot connect source oracle database.");
+        }
+
+        if (getTargetDataStore() == null)
+        {
+            logger.warn("Cannot connect source postgreSQL database.");
+            throw new JobExecutionException("Cannot connect source postgreSQL database.");
+        }
+
+        Calendar cal = Calendar.getInstance();
+        Date startTime = cal.getTime();
+        try
+        {
+            logger.info("-- step:clearOutputDatabase --");
+            clearOutputDatabase();
+            boolean bFirst = true;
+            if (checkConvertDB())
+            {
+                logger.info("-- step:convertOracleDB --");
+
+                for (String orgSchema : _orgSchema)
+                {
+                    OracleConvertMySQLJobContext jobContext =
+                            (OracleConvertMySQLJobContext) prepareJobContext(_filterPath);
+                    jobContext.setSourceDataStore(getSourceDataStore());
+                    // jobContext.setConvertElementIn(_convertElementIn);
+                    jobContext.setElementLogging(checkElementLogging());
+                    jobContext.setExecutionContext(context);
+
+                    if (bFirst)
+                        copyConnectivity(jobContext);
+                    else
+                        bFirst = false;
+
+                    logger.info("----- start schema:" + orgSchema + " -----");
+                    exetcuteConvert(jobContext, orgSchema, _dataPath);
+
+                    //close all open filewriter instance
+                    jobContext.closeFeatureWriter();
+                }
+            }
+
+            if (checkConvertFile())
+            {
+                logger.info("-- step:convertIndexDesignFile --");
+                convertIndexDesignFile(context);
+                logger.info("-- step:convertOtherDesignFile --");
+                convertOtherDesignFile(context);
+            }
+
+            if (checkConvertElementIn())
+            {
+                logger.info("-- step:convertFeatureDesignFile --");
+                convertFeatureDesignFile(context);
+            }
+
+            if (checkCreateDummy())
+            {
+                logger.info("-- step:createDummyFeatureFile --");
+                createDummyFeatureFile(context);
+            }
+
+            disconnect();
+            Date endTime = cal.getTime();
+            Date time = new Date(endTime.getTime() - startTime.getTime());
+            // public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
+            // SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
+            logger.warn("use time = " + time);
+        } catch (SQLException e)
+        {
+            logger.warn(e.getMessage(), e);
+            throw new JobExecutionException("Database error. " + e.getMessage(), e);
+        } catch (IOException ex)
+        {
+            logger.warn(ex.getMessage(), ex);
+            throw new JobExecutionException("IO error. " + ex.getMessage(), ex);
+        }
+        logger.info(jobName + " end at " + new Date());
+    }
+
+    /**
+     * Connectivity�ƻs�@�Ӫ����A�b�d�߹q�y��V�ɥΨӤ��OMS��Ʈw���q���s����(Connectivity)
+     *
+     * @param jobContext job context
+     * @throws SQLException sql exception
+     */
+    private void copyConnectivity(OracleConvertMySQLJobContext jobContext) throws SQLException
+    {
+        OracleConnection connection = jobContext.getOracleConnection();
+        Statement stmt = connection.createStatement();
+        stmt.execute(AbstractOracleJobContext.TRUNCATE_CONNECTIVITY_WEBCHECK);
+        stmt.execute(AbstractOracleJobContext.COPY_CONNECTIVITY_TO_WEBCHECK);
+    }
+
+    private void exetcuteConvert(OracleConvertMySQLJobContext jobContext,
+                                 String querySchema, String dataPath) throws SQLException
+    {
+        int order = 0;
+        OrderedMap map = getBlobStorageList(jobContext.getOracleConnection(), querySchema, "SD$SPACENODES"
+                , null);
+
+        logger.info("begin convert job:[" + map.size() + "]:testmode=" + _testMode);
+
+        int total = map.size(); //spacenodes count
+        int step = total / 100;
+        int current = 0;
+
+        //jobContext.startTransaction();
+        jobContext.setCurrentSchema(querySchema);
+        jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", 0);
+        for (OrderedMapIterator it = map.orderedMapIterator(); it.hasNext();)
+        {
+            it.next();
+
+            Pair pair = (Pair) it.getValue();
+            String tableSrc = (String) pair.first;
+
+            logger.info("begin convert:[" + order + "]-" + tableSrc);
+            queryIgsetElement(jobContext, querySchema, tableSrc);
+
+            order++;
+
+            if (_testMode)
+            {
+                if ((_testCount < 0) || (order >= _testCount))
+                    break;
+            }
+
+            if ((order % COMMITSIZE) == 0)
+            {
+                // OracleConnection connection = jobContext.getOracleConnection();
+                // connection.commitTransaction();
+                jobContext.commitTransaction();
+                //jobContext.startTransaction();
+                System.gc();
+            }
+
+            int now = order % step;
+            if (now != current)
+            {
+                current = now;
+                jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", current);
+
+            }
+        }
+        jobContext.getExecutionContext().put("ConvertDgn2PostGISJobProgress", 100);
+
+        jobContext.commitTransaction();
+
+        logger.info("end convert job:[" + order + "]");
+        System.gc();
+    }
+
+    protected OrderedMap getBlobStorageList(OracleConnection connection, String schemaSrc, String tableSrc,
+                                            OrderedMap orderedMap) throws SQLException
+    {
+        if (orderedMap == null)
+            orderedMap = new LinkedMap(99);
+        String fetchStmtFmt = "SELECT SNID, SPACETABLE FROM \"%s\".\"%s\"";
+        PrintfFormat spf = new PrintfFormat(fetchStmtFmt);
+        String fetchStmt = spf.sprintf(new Object[]{schemaSrc, tableSrc});
+        Statement stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+        ResultSet rs = null;
+
+        stmt.setFetchSize(FETCHSIZE);
+
+        try
+        {
+            rs = stmt.executeQuery(fetchStmt);
+
+            while (rs.next())
+            {
+                int size = rs.getMetaData().getColumnCount();
+                Object[] values = new Object[size];
+
+                for (int i = 0; i < size; i++)
+                {
+                    values[i] = rs.getObject(i + 1);
+                }
+
+                Integer key = ((BigDecimal) values[0]).intValue();
+                String name = (String) values[1];
+
+                Pair pair = (Pair) orderedMap.get(key);
+                if (pair == null)
+                    orderedMap.put(key, new Pair(name, null));
+                else
+                    pair.first = name;
+            }
+        } catch (SQLException e)
+        {
+            logger.error(e.toString(), e);
+            logger.error("stmt=" + fetchStmt);
+            throw e;
+        } finally
+        {
+            if (rs != null) rs.close();
+            stmt.close();
+        }
+
+        return orderedMap;
+    }
+
+    protected OrderedMap getRawFormatStorageList(OracleConnection connection, String schemaSrc, String tableSrc,
+                                                 OrderedMap orderedMap) throws SQLException
+    {
+        if (orderedMap == null)
+            orderedMap = new LinkedMap(99);
+        String fetchStmtFmt = "SELECT RNID, SPACETABLE FROM \"%s\".\"%s\"";
+        PrintfFormat spf = new PrintfFormat(fetchStmtFmt);
+        String fetchStmt = spf.sprintf(new Object[]{schemaSrc, tableSrc});
+        Statement stmt = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+
+        stmt.setFetchSize(FETCHSIZE);
+
+        ResultSet rs = stmt.executeQuery(fetchStmt);
+
+        while (rs.next())
+        {
+            int size = rs.getMetaData().getColumnCount();
+            Object[] values = new Object[size];
+
+            for (int i = 0; i < size; i++)
+            {
+                values[i] = rs.getObject(i + 1);
+            }
+
+            Integer key = ((BigDecimal) values[0]).intValue();
+            String name = (String) values[1];
+
+            Pair pair = (Pair) orderedMap.get(key);
+            if (pair == null)
+                orderedMap.put(key, new Pair(null, name));
+            else
+                pair.second = name;
+        }
+
+        rs.close();
+        stmt.close();
+
+        return orderedMap;
+    }
+
+    protected void queryIgsetElement(OracleConvertMySQLJobContext jobContext,
+                                     String srcschema, String srctable) throws SQLException
+    {
+        OracleConnection connection = jobContext.getOracleConnection();
+        String fetchSrcStmtFmt = "SELECT IGDSELM FROM \"%s\".\"%s\" ORDER BY ROWID";
+        PrintfFormat spf = new PrintfFormat(fetchSrcStmtFmt);
+        String fetchSrcStmt = spf.sprintf(new Object[]{srcschema, srctable});
+        Statement stmtSrc = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+
+        stmtSrc.setFetchSize(FETCHSIZE);
+
+        ResultSet rsSrc = stmtSrc.executeQuery(fetchSrcStmt);
+
+        while (rsSrc.next())
+        {
+            byte[] raw = null;
+
+            if (rsSrc.getMetaData().getColumnType(1) == Types.BLOB)
+            {
+                BLOB blob = (BLOB) rsSrc.getBlob(1);
+
+                raw = getBytesFromBLOB(blob);
+                blob.close();
+            } else
+            {
+                raw = rsSrc.getBytes(1);
+            }
+
+            try
+            {
+                Element element = fetchBinaryElement(raw);
+                jobContext.putFeatureCollection(element);
+            } catch (Dgn7fileException e)
+            {
+                logger.warn("Dgn7Exception", e);
+            }
+        }
+
+        rsSrc.close();
+        stmtSrc.close();
+    }
+
+    protected void queryRawElement(OracleConvertMySQLJobContext jobContext,
+                                   String srcschema, String srctable) throws SQLException
+    {
+        OracleConnection connection = jobContext.getOracleConnection();
+        String fetchDestStmtFmt = "SELECT ELEMENT FROM \"%s\".\"%s\" ORDER BY ROWID";
+        PrintfFormat spf = new PrintfFormat(fetchDestStmtFmt);
+        String fetchDestStmt = spf.sprintf(new Object[]{srcschema, srctable});
+        Statement stmtDest = connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
+
+        stmtDest.setFetchSize(FETCHSIZE);
+
+        ResultSet rsDest = stmtDest.executeQuery(fetchDestStmt);
+
+        while (rsDest.next())
+        {
+            ARRAY rawsValue = ((OracleResultSet) rsDest).getARRAY(1);
+            long[] rawData = rawsValue.getLongArray();
+            byte[] comparessedValue;
+
+            /*
+            if (dataMode == TransferTask.DataMode.Normal)
+            {
+                comparessedValue = BinConverter.unmarshalByteArray(rawData, true);
+            } else
+            {
+                comparessedValue = BinConverter.unmarshalCompactByteArray(rawData);
+            }
+            */
+            comparessedValue = BinConverter.unmarshalByteArray(rawData, true);
+
+            byte[] rawDest = ByteArrayCompressor.decompressByteArray(comparessedValue);
+
+
+            try
+            {
+                Element element = fetchBinaryElement(rawDest);
+                jobContext.putFeatureCollection(element);
+            } catch (Dgn7fileException e)
+            {
+                logger.warn("Dgn7Exception:" + e.getMessage(), e);
+            }
+        }
+
+        rsDest.close();
+        stmtDest.close();
+    }
+
+    // Binary to Element
+    private Element fetchBinaryElement(byte[] raws) throws Dgn7fileException
+    {
+        ByteBuffer buffer = ByteBuffer.wrap(raws);
+        buffer.order(ByteOrder.LITTLE_ENDIAN);
+        short signature = buffer.getShort();
+
+        // byte type = (byte) (buffer.get() & 0x7f);
+        byte type = (byte) ((signature >>> 8) & 0x007f);
+
+        // silly Bentley say contentLength is in 2-byte words
+        // and ByteByffer uses raws.
+        // track the record location
+        int elementLength = (buffer.getShort() * 2) + 4;
+        ElementType recordType = ElementType.forID(type);
+        IElementHandler handler;
+
+        handler = recordType.getElementHandler();
+
+        Element dgnElement = (Element) handler.read(buffer, signature, elementLength);
+        if (recordType.isComplexElement() && (elementLength < raws.length))
+        {
+            int offset = elementLength;
+            while (offset < (raws.length - 4))
+            {
+                buffer.position(offset);
+                signature = buffer.getShort();
+                type = (byte) ((signature >>> 8) & 0x007f);
+                elementLength = (buffer.getShort() * 2) + 4;
+                if (raws.length < (offset + elementLength))
+                {
+                    System.out.println("Length not match:" + offset + ":" + buffer.position() + ":" + buffer.limit());
+                    break;
+                }
+                recordType = ElementType.forID(type);
+                handler = recordType.getElementHandler();
+                if (handler != null)
+                {
+                    Element subElement = (Element) handler.read(buffer, signature, elementLength);
+                    ((ComplexElement) dgnElement).add(subElement);
+                    offset += elementLength;
+                } else
+                {
+                    byte[] remain = new byte[buffer.remaining()];
+                    System.arraycopy(raws, offset, remain, 0, buffer.remaining());
+                    for (int i = 0; i < remain.length; i++)
+                    {
+                        if (remain[i] != 0)
+                        {
+                            logger.info("fetch element has some error. index=" + (offset + i) + ":value=" + remain[i]);
+                            System.out.println("fetch element has some error. index=" + (offset + i) + ":value=" + remain[i]);
+                        }
+                    }
+                    break;
+                }
+            }
+        }
+
+        return dgnElement;
+    }
+
+    /**
+     * �����ഫ���޹��ɪ��u�@
+     *
+     * @param context �u�@��������
+     * @throws org.quartz.JobExecutionException
+     *          exception
+     */
+    private void convertIndexDesignFile(JobExecutionContext context) throws JobExecutionException
+    {
+        File indexDir = new File(getDataPath(), "index");
+        if (!indexDir.exists())
+        {
+            logger.info("index dir=" + indexDir + " not exist.");
+            return;
+        }
+
+        if (!indexDir.isDirectory())
+        {
+            logger.info("index dir=" + indexDir + " is not a directory.");
+        }
+
+        File[] dgnFiles = indexDir.listFiles(new FilenameFilter()
+        {
+            public boolean accept(File dir, String name)
+            {
+                return name.toLowerCase().endsWith(".dgn");
+            }
+        });
+
+        for (File dgnFile : dgnFiles)
+        {
+            IndexDgnConvertMySQLJobContext convertContext =
+                    new IndexDgnConvertMySQLJobContext(getDataPath(), getTargetDataStore());
+            logger.debug("--- start dgnfile-" + dgnFile.toString() + " ---");
+            try
+            {
+                convertContext.setExecutionContext(context);
+                String dgnPaths[] = StringUtils.splitToArray(dgnFile.toString(), File.separator);
+                convertContext.setFilename(dgnPaths[dgnPaths.length - 1]);
+
+                FileInputStream fs = new FileInputStream(dgnFile);
+                FileChannel fc = fs.getChannel();
+                Dgn7fileReader reader = new Dgn7fileReader(fc, new Lock());
+                convertContext.setReader(reader);
+
+                scanIndexDgnElement(convertContext);
+
+                convertContext.commitTransaction();
+                convertContext.closeFeatureWriter();
+                System.gc();
+            } catch (FileNotFoundException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (Dgn7fileException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (IOException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (IllegalAttributeException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (SchemaException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            }
+        }
+    }
+
+    protected void scanIndexDgnElement(IndexDgnConvertMySQLJobContext convertContext)
+            throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException
+    {
+        Dgn7fileReader reader = convertContext.getReader();
+        int count = 0;
+        Element lastComplex = null;
+        while (reader.hasNext())
+        {
+            Dgn7fileReader.Record record = reader.nextElement();
+            if (record.element() != null)
+            {
+                Element element = (Element) record.element();
+                ElementType type = element.getElementType();
+
+                if ((!type.isComplexElement()) && (!element.isComponentElement()))
+                {
+                    lastComplex = null;
+
+                    processIndexElement(element, convertContext);
+                } else if (element.isComponentElement())
+                {
+                    if (lastComplex != null)
+                    {
+                        ((ComplexElement) lastComplex).add(element);
+                    }
+                } else if (type.isComplexElement())
+                {
+                    if (lastComplex == null)
+                    {
+                        lastComplex = element;
+                    } else
+                    {
+                        processIndexElement(element, convertContext);
+                        lastComplex = element;
+                    }
+                }
+            }
+            count++;
+        }
+
+        logger.debug("ElementRecord Count=" + count);
+    }
+
+    private void processIndexElement(Element element, IndexDgnConvertMySQLJobContext convertContext)
+            throws IllegalAttributeException, SchemaException
+    {
+        if (element instanceof TextElement)
+        {
+            convertContext.putFeatureCollection(element);
+        }
+    }
+
+
+    /**
+     * �����ഫ��L�]�p���ɪ��u�@
+     *
+     * @param context jobContext
+     * @throws org.quartz.JobExecutionException
+     *          exception
+     */
+    private void convertOtherDesignFile(JobExecutionContext context) throws JobExecutionException
+    {
+        File otherDir = new File(getDataPath(), "other");
+        if (!otherDir.exists())
+        {
+            logger.info("other dir=" + otherDir + " not exist.");
+            return;
+        }
+
+        if (!otherDir.isDirectory())
+        {
+            logger.info("other dir=" + otherDir + " is not a directory.");
+        }
+
+        File[] dgnFiles = otherDir.listFiles(new FilenameFilter()
+        {
+            public boolean accept(File dir, String name)
+            {
+                return name.toLowerCase().endsWith(".dgn");
+            }
+        });
+
+        for (File dgnFile : dgnFiles)
+        {
+            GeneralDgnConvertMySQLJobContext convertContext =
+                    new GeneralDgnConvertMySQLJobContext(getDataPath(), getTargetDataStore());
+            logger.info("--- start dgnfile-" + dgnFile.toString() + " ---");
+            try
+            {
+                convertContext.setExecutionContext(context);
+                String dgnPaths[] = StringUtils.splitToArray(dgnFile.toString(), File.separator);
+                convertContext.setFilename(dgnPaths[dgnPaths.length - 1]);
+
+                FileInputStream fs = new FileInputStream(dgnFile);
+                FileChannel fc = fs.getChannel();
+                Dgn7fileReader reader = new Dgn7fileReader(fc, new Lock());
+                convertContext.setReader(reader);
+
+                scanOtherDgnElement(convertContext);
+
+                convertContext.commitTransaction();
+                convertContext.closeFeatureWriter();
+                System.gc();
+            } catch (FileNotFoundException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (Dgn7fileException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (IOException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (IllegalAttributeException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (SchemaException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            }
+        }
+    }
+
+    public void scanOtherDgnElement(GeneralDgnConvertMySQLJobContext convertContext)
+            throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException
+    {
+        Dgn7fileReader reader = convertContext.getReader();
+        int count = 0;
+        Element lastComplex = null;
+        while (reader.hasNext())
+        {
+            Dgn7fileReader.Record record = reader.nextElement();
+            if (record.element() != null)
+            {
+                Element element = (Element) record.element();
+                ElementType type = element.getElementType();
+
+                if ((!type.isComplexElement()) && (!element.isComponentElement()))
+                {
+                    lastComplex = null;
+
+                    processOtherElement(element, convertContext);
+                } else if (element.isComponentElement())
+                {
+                    if (lastComplex != null)
+                    {
+                        ((ComplexElement) lastComplex).add(element);
+                    }
+                } else if (type.isComplexElement())
+                {
+                    if (lastComplex == null)
+                    {
+                        lastComplex = element;
+                    } else
+                    {
+                        processOtherElement(element, convertContext);
+                        lastComplex = element;
+                    }
+                }
+            }
+            count++;
+        }
+
+        logger.debug("ElementRecord Count=" + count);
+    }
+
+    private void processOtherElement(Element element, GeneralDgnConvertMySQLJobContext convertContext)
+            throws IllegalAttributeException, SchemaException
+    {
+        convertContext.putFeatureCollection(element);
+    }
+
+    private void clearOutputDatabase()
+    {
+        /*
+        File outDataPath = new File(getDataPath(), OracleConvertPostGISJobContext.SHPOUTPATH);
+        if (outDataPath.exists() && outDataPath.isDirectory())
+        {
+            deleteFilesInPath(outDataPath);
+        }
+        outDataPath = new File(getDataPath(), IndexDgnConvertShpJobContext.SHPOUTPATH);
+        if (outDataPath.exists() && outDataPath.isDirectory())
+        {
+            deleteFilesInPath(outDataPath);
+        }
+        outDataPath = new File(getDataPath(), GeneralDgnConvertShpJobContext.SHPOUTPATH);
+        if (outDataPath.exists() && outDataPath.isDirectory())
+        {
+            deleteFilesInPath(outDataPath);
+        }
+        */
+    }
+
+    private void deleteFilesInPath(File outDataPath)
+    {
+        deleteFilesInPath(outDataPath, true);
+    }
+
+    private void deleteFilesInPath(File outDataPath, boolean removeSubDir)
+    {
+        if (!outDataPath.isDirectory())
+        {
+            return;
+        }
+        File[] files = outDataPath.listFiles();
+        for (File file : files)
+        {
+            if (file.isFile())
+            {
+                if (!file.delete())
+                {
+                    logger.info("Cannot delete file-" + file.toString());
+                }
+            } else if (file.isDirectory())
+            {
+                deleteFilesInPath(file, removeSubDir);
+                if (removeSubDir)
+                {
+                    if (file.delete())
+                    {
+                        logger.info("Cannot delete dir-" + file.toString());
+                    }
+                }
+            }
+        }
+    }
+
+    private void convertFeatureDesignFile(JobExecutionContext context) throws JobExecutionException
+    {
+        File elminDir = new File(getDataPath(), "elmin");
+        if (!elminDir.exists())
+        {
+            logger.info("elmin dir=" + elminDir + " not exist.");
+            return;
+        }
+
+        if (!elminDir.isDirectory())
+        {
+            logger.info("elmin dir=" + elminDir + " is not a directory.");
+        }
+
+        File[] dgnFiles = elminDir.listFiles(new FilenameFilter()
+        {
+            public boolean accept(File dir, String name)
+            {
+                return name.toLowerCase().endsWith(".dgn");
+            }
+        });
+
+        for (File dgnFile : dgnFiles)
+        {
+            FeatureDgnConvertMySQLJobContext convertContext =
+                    new FeatureDgnConvertMySQLJobContext(getDataPath(), getTargetDataStore(), _filterPath);
+            logger.info("--- start dgnfile-" + dgnFile.toString() + " ---");
+            try
+            {
+                convertContext.setExecutionContext(context);
+                String dgnPaths[] = StringUtils.splitToArray(dgnFile.toString(), File.separator);
+                convertContext.setFilename(dgnPaths[dgnPaths.length - 1]);
+
+                FileInputStream fs = new FileInputStream(dgnFile);
+                FileChannel fc = fs.getChannel();
+                Dgn7fileReader reader = new Dgn7fileReader(fc, new Lock());
+                convertContext.setReader(reader);
+
+                scanFeatureDgnElement(convertContext);
+
+                convertContext.commitTransaction();
+                convertContext.closeFeatureWriter();
+                System.gc();
+            } catch (FileNotFoundException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (Dgn7fileException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (IOException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (IllegalAttributeException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            } catch (SchemaException e)
+            {
+                convertContext.rollbackTransaction();
+                logger.warn(e.getMessage(), e);
+                throw new JobExecutionException(e.getMessage(), e);
+            }
+        }
+    }
+
+    public void scanFeatureDgnElement(FeatureDgnConvertMySQLJobContext convertContext)
+            throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException
+    {
+        Dgn7fileReader reader = convertContext.getReader();
+        int count = 0;
+        Element lastComplex = null;
+        while (reader.hasNext())
+        {
+            Dgn7fileReader.Record record = reader.nextElement();
+            if (record.element() != null)
+            {
+                Element element = (Element) record.element();
+                ElementType type = element.getElementType();
+
+                if ((!type.isComplexElement()) && (!element.isComponentElement()))
+                {
+                    lastComplex = null;
+
+                    processFeatureElement(element, convertContext);
+                } else if (element.isComponentElement())
+                {
+                    if (lastComplex != null)
+                    {
+                        ((ComplexElement) lastComplex).add(element);
+                    }
+                } else if (type.isComplexElement())
+                {
+                    if (lastComplex == null)
+                    {
+                        lastComplex = element;
+                    } else
+                    {
+                        processFeatureElement(element, convertContext);
+                        lastComplex = element;
+                    }
+                }
+            }
+            count++;
+        }
+
+        logger.debug("ElementRecord Count=" + count);
+    }
+
+    private void processFeatureElement(Element element, FeatureDgnConvertMySQLJobContext convertContext)
+            throws IllegalAttributeException, SchemaException
+    {
+        convertContext.putFeatureCollection(element);
+    }
+
+    private void createDummyFeatureFile(JobExecutionContext context) throws JobExecutionException
+    {
+        /*
+        DummyFeatureConvertShpJobContext convertContext = new DummyFeatureConvertShpJobContext(getDataPath(), _filterPath);
+        try {
+            convertContext.startTransaction();
+            convertContext.commitTransaction();
+            convertContext.closeFeatureWriter();
+        } catch (IOException e)
+        {
+            logger.warn(e.getMessage(), e);
+            throw new JobExecutionException(e.getMessage(), e);
+        }
+        */
+    }
+
+    public DataStore getTargetDataStore()
+    {
+        return targetDataStore;
+    }
+
+    protected void createTargetDataStore() throws JobExecutionException
+    {
+        if (targetDataStore != null)
+        {
+            targetDataStore.dispose();
+            targetDataStore = null;
+        }
+
+        /*
+        if (!isDriverFound())
+        {
+            throw new JobExecutionException("Oracle JDBC Driver not found.-" + JDBC_DRIVER);
+        }
+        */
+
+        if (!myProperties.containsKey("max connections" /*MySQLDataStoreFactory.MAXCONN.key */))
+        {
+            myProperties.put("max connections", "2");
+        }
+
+        if (!myProperties.containsKey("min connections" /* MySQLDataStoreFactory.MINCONN.key */))
+        {
+            myProperties.put("min connections", "1");
+        }
+
+        if (!myProperties.containsKey(MySQLDataStoreFactory.WKBENABLED.key))
+        {
+            myProperties.put(MySQLDataStoreFactory.WKBENABLED.key, "true");
+        }
+
+        if (!dataStoreFactory.canProcess(myProperties))
+        {
+            getLogger().warn("cannot process properties-");
+            throw new JobExecutionException("cannot process properties-");
+        }
+        try
+        {
+            targetDataStore = (MySQLDataStore) dataStoreFactory.createDataStore(myProperties);
+        } catch (IOException e)
+        {
+            getLogger().warn(e.getMessage(), e);
+            throw new JobExecutionException(e.getMessage(), e);
+        }
+    }
+}
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2OraSDOJob.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2OraSDOJob.java
index 9a3f93d..fba160a 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2OraSDOJob.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2OraSDOJob.java
@@ -13,15 +13,22 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Types;
+import java.util.Calendar;
 import java.util.Date;
+import java.util.Map;
+import java.util.TreeMap;
 
 import org.apache.commons.collections.OrderedMap;
 import org.apache.commons.collections.OrderedMapIterator;
 import org.apache.commons.collections.map.LinkedMap;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.geotools.data.DataStore;
+import org.geotools.data.oracle.OracleDataStore;
+import org.geotools.data.oracle.OracleDataStoreFactory;
 import org.geotools.feature.IllegalAttributeException;
 import org.geotools.feature.SchemaException;
+import org.quartz.JobDataMap;
 import org.quartz.JobDetail;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -34,10 +41,10 @@
 import oracle.sql.BLOB;
 
 import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
-import com.ximple.eofms.jobs.context.shapefile.FeatureDgnConvertShpJobContext;
-import com.ximple.eofms.jobs.context.shapefile.GeneralDgnConvertShpJobContext;
-import com.ximple.eofms.jobs.context.shapefile.IndexDgnConvertShpJobContext;
-import com.ximple.eofms.jobs.context.shapefile.OracleConvertShapefilesJobContext;
+import com.ximple.eofms.jobs.context.orasdo.FeatureDgnConvertOraSDOJobContext;
+import com.ximple.eofms.jobs.context.orasdo.GeneralDgnConvertOraSDOJobContext;
+import com.ximple.eofms.jobs.context.orasdo.IndexDgnConvertOraSDOJobContext;
+import com.ximple.eofms.jobs.context.orasdo.OracleConvertOraSDOJobContext;
 import com.ximple.eofms.util.BinConverter;
 import com.ximple.eofms.util.ByteArrayCompressor;
 import com.ximple.eofms.util.StringUtils;
@@ -55,10 +62,13 @@
 {
     final static Log logger = LogFactory.getLog(OracleConvertDgn2OraSDOJob.class);
 
-    /**
-     * The Oracle driver class name
-     */
-    private static final String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
+    private static final String SDOHOST = "SDOHOST";
+    private static final String SDODDATBASE = "SDODDATBASE";
+    private static final String SDOPORT = "SDOPORT";
+    private static final String SDOSCHEMA = "SDOSCHEMA";
+    private static final String SDOUSER = "SDOUSER";
+    private static final String SDOPASS = "SDOPASS";
+    private static final String USEWKB = "USEWKB";
 
     private static final int FETCHSIZE = 30;
     private static final int BATCHSIZE = 25;
@@ -76,72 +86,94 @@
         }
     }
 
+    protected static OracleDataStoreFactory dataStoreFactory = new OracleDataStoreFactory();
+
     GeometryFactory _geomFactory = new GeometryFactory();
+    protected String _sdoHost;
+    protected String _sdoDatabase;
+    protected String _sdoPort;
+    protected String _sdoSchema;
+    protected String _sdoUsername;
+    protected String _sdoPassword;
+    protected String _sdoUseWKB;
+
+    protected Map<String, String> sdoProperties;
+    protected OracleDataStore targetDataStore;
 
     public Log getLogger()
     {
         return logger;
     }
 
-    // OracleDataStoreFactory factory = new OracleDataStoreFactory();
-    /*
-        Map map = new HashMap();
-        map.put("host", fixture.getProperty("host"));
-        map.put("port", fixture.getProperty("port"));
-        map.put("instance", fixture.getProperty("instance"));
-        map.put("user", fixture.getProperty("user"));
-        map.put("passwd", fixture.getProperty("passwd"));
-        map.put("dbtype", "oracle");
-        map.put("alias", fixture.getProperty("instance"));
-        map.put("namespace", null);
-
-        assertTrue(factory.canProcess(map));
-
-        OracleDataStore store = (OracleDataStore) factory.createDataStore(map);
-        assertNull(store.getNameSpace());
-
-        map.put("schema", fixture.getProperty("user").toUpperCase());
-        store = (OracleDataStore) factory.createDataStore(map);
-        assertNull(store.getNameSpace());
-
-        map.put("namespace", "topp");
-        store = (OracleDataStore) factory.createDataStore(map);
-        assertEquals(new URI("topp"), store.getNameSpace());
-     */
-
-    /*
-        FeatureWriter writer = dstore.getFeatureWriter("ORA_TEST_POINTS", Filter.INCLUDE,
-                Transaction.AUTO_COMMIT);
-        assertNotNull(writer);
-
-        Feature feature = writer.next();
-        System.out.println(feature);
-        feature.setAttribute(0, "Changed Feature");
-        System.out.println(feature);
-        writer.write();
-        writer.close();
-     */
-
-    /*
-        Map fidGen = new HashMap();
-        fidGen.put("ORA_TEST_POINTS", JDBCDataStoreConfig.FID_GEN_MANUAL_INC);
-
-        JDBCDataStoreConfig config = JDBCDataStoreConfig.createWithSchemaNameAndFIDGenMap(schemaName,
-                fidGen);
-
-        String name = "add_name";
-        BigDecimal intval = new BigDecimal(70);
-        Point point = jtsFactory.createPoint(new Coordinate(-15.0, -25));
-        Feature feature = dstore.getSchema("ORA_TEST_POINTS")
-                                .create(new Object[] { name, intval, point });
-
-        FeatureStore fs = (FeatureStore) dstore.getFeatureSource("ORA_TEST_POINTS");
-        fs.addFeatures(DataUtilities.collection(feature));
-     */
-
     protected AbstractOracleJobContext prepareJobContext(String filterPath)
     {
-        return new OracleConvertShapefilesJobContext(filterPath);
+        return new OracleConvertOraSDOJobContext(getDataPath(), getTargetDataStore(), filterPath);
+    }
+
+    protected void extractJobConfiguration(JobDetail jobDetail) throws JobExecutionException
+    {
+        super.extractJobConfiguration(jobDetail);
+        JobDataMap dataMap = jobDetail.getJobDataMap();
+        _sdoHost = dataMap.getString(SDOHOST);
+        _sdoDatabase = dataMap.getString(SDODDATBASE);
+        _sdoPort = dataMap.getString(SDOPORT);
+        _sdoSchema = dataMap.getString(SDOSCHEMA);
+        _sdoUsername = dataMap.getString(SDOUSER);
+        _sdoPassword = dataMap.getString(SDOPASS);
+        _sdoUseWKB = dataMap.getString(USEWKB);
+
+        Log logger = getLogger();
+        /*
+        logger.info("SDOHOST=" + _myHost);
+        logger.info("SDODDATBASE=" + _myDatabase);
+        logger.info("SDOPORT=" + _myPort);
+        logger.info("SDOSCHEMA=" + _mySchema);
+        logger.info("SDOUSER=" + _myUsername);
+        logger.info("SDOPASS=" + _myPassword);
+        logger.info("USEWKB=" + _myUseWKB);
+        */
+
+        if (_sdoHost == null)
+        {
+            logger.warn("SDOHOST is null");
+            throw new JobExecutionException("Unknown OraSDO host.");
+        }
+        if (_sdoDatabase == null)
+        {
+            logger.warn("PGDATABASE is null");
+            throw new JobExecutionException("Unknown OraSDO database.");
+        }
+        if (_sdoPort == null)
+        {
+            logger.warn("SDOPORT is null");
+            throw new JobExecutionException("Unknown OraSDO port.");
+        }
+        if (_sdoSchema == null)
+        {
+            logger.warn("SDOSCHEMA is null");
+            throw new JobExecutionException("Unknown OraSDO schema.");
+        }
+        if (_sdoUsername == null)
+        {
+            logger.warn("PGUSERNAME is null");
+            throw new JobExecutionException("Unknown OraSDO username.");
+        }
+        if (_sdoPassword == null)
+        {
+            logger.warn("PGPASSWORD is null");
+            throw new JobExecutionException("Unknown OraSDO password.");
+        }
+
+        Map<String, String> remote = new TreeMap<String, String>();
+        remote.put("dbtype", "OraSDO");
+        remote.put("charset", "UTF-8");
+        remote.put("host", _sdoHost);
+        remote.put("port", _sdoPort);
+        remote.put("database", _sdoDatabase);
+        remote.put("user", _sdoUsername);
+        remote.put("passwd", _sdoPassword);
+        remote.put("namespace", null);
+        sdoProperties = remote;
     }
 
     public void execute(JobExecutionContext context) throws JobExecutionException
@@ -156,15 +188,25 @@
         logger.info(jobName + " fired at " + new Date());
         extractJobConfiguration(jobDetail);
         createSourceDataStore();
+        createTargetDataStore();
         if (getSourceDataStore() == null)
         {
+            logger.warn("Cannot connect source oracle database.");
             throw new JobExecutionException("Cannot connect source oracle database.");
         }
 
+        if (getTargetDataStore() == null)
+        {
+            logger.warn("Cannot connect source postgreSQL database.");
+            throw new JobExecutionException("Cannot connect source postgreSQL database.");
+        }
+
+        Calendar cal = Calendar.getInstance();
+        Date startTime = cal.getTime();
         try
         {
-            logger.info("-- step:clearOutputDirectory --");
-            clearOutputDirectory();
+            logger.info("-- step:clearOutputDatabase --");
+            clearOutputDatabase();
             boolean bFirst = true;
             if (checkConvertDB())
             {
@@ -172,9 +214,10 @@
 
                 for (String orgSchema : _orgSchema)
                 {
-                    OracleConvertShapefilesJobContext jobContext = (OracleConvertShapefilesJobContext) prepareJobContext(_filterPath);
+                    OracleConvertOraSDOJobContext jobContext =
+                            (OracleConvertOraSDOJobContext) prepareJobContext(_filterPath);
                     jobContext.setSourceDataStore(getSourceDataStore());
-                    jobContext.setConvertElementIn(_convertElementIn);
+                    // jobContext.setConvertElementIn(_convertElementIn);
                     jobContext.setElementLogging(checkElementLogging());
                     jobContext.setExecutionContext(context);
 
@@ -212,6 +255,11 @@
             }
 
             disconnect();
+            Date endTime = cal.getTime();
+            Date time = new Date(endTime.getTime() - startTime.getTime());
+            // public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
+            // SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
+            logger.warn("use time = " + time);
         } catch (SQLException e)
         {
             logger.warn(e.getMessage(), e);
@@ -230,15 +278,15 @@
      * @param jobContext job context
      * @throws SQLException sql exception
      */
-    private void copyConnectivity(OracleConvertShapefilesJobContext jobContext) throws SQLException
+    private void copyConnectivity(OracleConvertOraSDOJobContext jobContext) throws SQLException
     {
         OracleConnection connection = jobContext.getOracleConnection();
         Statement stmt = connection.createStatement();
-        stmt.execute(OracleConvertShapefilesJobContext.TRUNCATE_CONNECTIVITY_WEBCHECK);
-        stmt.execute(OracleConvertShapefilesJobContext.COPY_CONNECTIVITY_TO_WEBCHECK);
+        stmt.execute(AbstractOracleJobContext.TRUNCATE_CONNECTIVITY_WEBCHECK);
+        stmt.execute(AbstractOracleJobContext.COPY_CONNECTIVITY_TO_WEBCHECK);
     }
 
-    private void exetcuteConvert(OracleConvertShapefilesJobContext jobContext,
+    private void exetcuteConvert(OracleConvertOraSDOJobContext jobContext,
                                  String querySchema, String dataPath) throws SQLException
     {
         int order = 0;
@@ -253,7 +301,7 @@
 
         //jobContext.startTransaction();
         jobContext.setCurrentSchema(querySchema);
-        jobContext.getExecutionContext().put("ConvertDgn2ShpJobProgress", 0);
+        jobContext.getExecutionContext().put("ConvertDgn2OraSDOJobProgress", 0);
         for (OrderedMapIterator it = map.orderedMapIterator(); it.hasNext();)
         {
             it.next();
@@ -285,11 +333,11 @@
             if (now != current)
             {
                 current = now;
-                jobContext.getExecutionContext().put("ConvertDgn2ShpJobProgress", current);
+                jobContext.getExecutionContext().put("ConvertDgn2OraSDOJobProgress", current);
 
             }
         }
-        jobContext.getExecutionContext().put("ConvertDgn2ShpJobProgress", 100);
+        jobContext.getExecutionContext().put("ConvertDgn2OraSDOJobProgress", 100);
 
         jobContext.commitTransaction();
 
@@ -387,7 +435,7 @@
         return orderedMap;
     }
 
-    protected void queryIgsetElement(OracleConvertShapefilesJobContext jobContext,
+    protected void queryIgsetElement(OracleConvertOraSDOJobContext jobContext,
                                      String srcschema, String srctable) throws SQLException
     {
         OracleConnection connection = jobContext.getOracleConnection();
@@ -429,7 +477,7 @@
         stmtSrc.close();
     }
 
-    protected void queryRawElement(OracleConvertShapefilesJobContext jobContext,
+    protected void queryRawElement(OracleConvertOraSDOJobContext jobContext,
                                    String srcschema, String srctable) throws SQLException
     {
         OracleConnection connection = jobContext.getOracleConnection();
@@ -568,7 +616,8 @@
 
         for (File dgnFile : dgnFiles)
         {
-            IndexDgnConvertShpJobContext convertContext = new IndexDgnConvertShpJobContext(getDataPath());
+            IndexDgnConvertOraSDOJobContext convertContext =
+                    new IndexDgnConvertOraSDOJobContext(getDataPath(), getTargetDataStore());
             logger.debug("--- start dgnfile-" + dgnFile.toString() + " ---");
             try
             {
@@ -615,7 +664,7 @@
         }
     }
 
-    protected void scanIndexDgnElement(IndexDgnConvertShpJobContext convertContext)
+    protected void scanIndexDgnElement(IndexDgnConvertOraSDOJobContext convertContext)
             throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException
     {
         Dgn7fileReader reader = convertContext.getReader();
@@ -658,7 +707,8 @@
         logger.debug("ElementRecord Count=" + count);
     }
 
-    private void processIndexElement(Element element, IndexDgnConvertShpJobContext convertContext) throws IllegalAttributeException, SchemaException
+    private void processIndexElement(Element element, IndexDgnConvertOraSDOJobContext convertContext)
+            throws IllegalAttributeException, SchemaException
     {
         if (element instanceof TextElement)
         {
@@ -698,7 +748,8 @@
 
         for (File dgnFile : dgnFiles)
         {
-            GeneralDgnConvertShpJobContext convertContext = new GeneralDgnConvertShpJobContext(getDataPath());
+            GeneralDgnConvertOraSDOJobContext convertContext =
+                    new GeneralDgnConvertOraSDOJobContext(getDataPath(), getTargetDataStore());
             logger.info("--- start dgnfile-" + dgnFile.toString() + " ---");
             try
             {
@@ -745,7 +796,7 @@
         }
     }
 
-    public void scanOtherDgnElement(GeneralDgnConvertShpJobContext convertContext)
+    public void scanOtherDgnElement(GeneralDgnConvertOraSDOJobContext convertContext)
             throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException
     {
         Dgn7fileReader reader = convertContext.getReader();
@@ -788,15 +839,16 @@
         logger.debug("ElementRecord Count=" + count);
     }
 
-    private void processOtherElement(Element element, GeneralDgnConvertShpJobContext convertContext)
+    private void processOtherElement(Element element, GeneralDgnConvertOraSDOJobContext convertContext)
             throws IllegalAttributeException, SchemaException
     {
         convertContext.putFeatureCollection(element);
     }
 
-    private void clearOutputDirectory()
+    private void clearOutputDatabase()
     {
-        File outDataPath = new File(getDataPath(), OracleConvertShapefilesJobContext.SHPOUTPATH);
+        /*
+        File outDataPath = new File(getDataPath(), OracleConvertOraSDOJobContext.SHPOUTPATH);
         if (outDataPath.exists() && outDataPath.isDirectory())
         {
             deleteFilesInPath(outDataPath);
@@ -811,6 +863,7 @@
         {
             deleteFilesInPath(outDataPath);
         }
+        */
     }
 
     private void deleteFilesInPath(File outDataPath)
@@ -871,7 +924,8 @@
 
         for (File dgnFile : dgnFiles)
         {
-            FeatureDgnConvertShpJobContext convertContext = new FeatureDgnConvertShpJobContext(getDataPath(), _filterPath);
+            FeatureDgnConvertOraSDOJobContext convertContext =
+                    new FeatureDgnConvertOraSDOJobContext(getDataPath(), getTargetDataStore(), _filterPath);
             logger.info("--- start dgnfile-" + dgnFile.toString() + " ---");
             try
             {
@@ -918,7 +972,7 @@
         }
     }
 
-    public void scanFeatureDgnElement(FeatureDgnConvertShpJobContext convertContext)
+    public void scanFeatureDgnElement(FeatureDgnConvertOraSDOJobContext convertContext)
             throws Dgn7fileException, IOException, IllegalAttributeException, SchemaException
     {
         Dgn7fileReader reader = convertContext.getReader();
@@ -961,7 +1015,7 @@
         logger.debug("ElementRecord Count=" + count);
     }
 
-    private void processFeatureElement(Element element, FeatureDgnConvertShpJobContext convertContext)
+    private void processFeatureElement(Element element, FeatureDgnConvertOraSDOJobContext convertContext)
             throws IllegalAttributeException, SchemaException
     {
         convertContext.putFeatureCollection(element);
@@ -982,4 +1036,56 @@
         }
         */
     }
+
+    public DataStore getTargetDataStore()
+    {
+        return targetDataStore;
+    }
+
+    protected void createTargetDataStore() throws JobExecutionException
+    {
+        if (targetDataStore != null)
+        {
+            targetDataStore.dispose();
+            targetDataStore = null;
+        }
+
+        /*
+        if (!isDriverFound())
+        {
+            throw new JobExecutionException("Oracle JDBC Driver not found.-" + JDBC_DRIVER);
+        }
+        */
+
+        if (!sdoProperties.containsKey(OracleDataStoreFactory.MAXCONN.key))
+        {
+            sdoProperties.put(OracleDataStoreFactory.MAXCONN.key, "2");
+        }
+
+        if (!sdoProperties.containsKey(OracleDataStoreFactory.MINCONN.key))
+        {
+            sdoProperties.put(OracleDataStoreFactory.MINCONN.key, "1");
+        }
+
+        /*
+        if (!sdoProperties.containsKey(OracleDataStoreFactory.WKBENABLED.key))
+        {
+            sdoProperties.put(OracleDataStoreFactory.WKBENABLED.key, "true");
+        }
+        */
+
+        if (!dataStoreFactory.canProcess(sdoProperties))
+        {
+            getLogger().warn("cannot process properties-");
+            throw new JobExecutionException("cannot process properties-");
+        }
+        try
+        {
+            targetDataStore = (OracleDataStore) dataStoreFactory.createDataStore(sdoProperties);
+        } catch (IOException e)
+        {
+            getLogger().warn(e.getMessage(), e);
+            throw new JobExecutionException(e.getMessage(), e);
+        }
+    }
 }
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java
index 05f5b4f..d7dbdf7 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2PostGISJob.java
@@ -18,7 +18,28 @@
 import java.util.Map;
 import java.util.TreeMap;
 
+import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.OrderedMapIterator;
+import org.apache.commons.collections.map.LinkedMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.geotools.data.DataStore;
+import org.geotools.data.postgis.PostgisDataStore;
+import org.geotools.data.postgis.PostgisDataStoreFactory;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
 import com.vividsolutions.jts.geom.GeometryFactory;
+
+import oracle.jdbc.OracleConnection;
+import oracle.jdbc.OracleResultSet;
+import oracle.sql.ARRAY;
+import oracle.sql.BLOB;
+
 import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
 import com.ximple.eofms.jobs.context.postgis.FeatureDgnConvertPostGISJobContext;
 import com.ximple.eofms.jobs.context.postgis.GeneralDgnConvertPostGISJobContext;
@@ -36,27 +57,6 @@
 import com.ximple.io.dgn7.Lock;
 import com.ximple.io.dgn7.TextElement;
 import com.ximple.util.PrintfFormat;
-
-import org.apache.commons.collections.OrderedMap;
-import org.apache.commons.collections.OrderedMapIterator;
-import org.apache.commons.collections.map.LinkedMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.geotools.data.DataStore;
-import org.geotools.data.oracle.OracleDataStore;
-import org.geotools.data.postgis.PostgisDataStore;
-import org.geotools.data.postgis.PostgisDataStoreFactory;
-import org.geotools.feature.IllegalAttributeException;
-import org.geotools.feature.SchemaException;
-import org.quartz.JobDataMap;
-import org.quartz.JobDetail;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-
-import oracle.jdbc.OracleConnection;
-import oracle.jdbc.OracleResultSet;
-import oracle.sql.ARRAY;
-import oracle.sql.BLOB;
 
 public class OracleConvertDgn2PostGISJob extends AbstractOracleDatabaseJob
 {
@@ -154,13 +154,13 @@
 
         Log logger = getLogger();
         /*
-        logger.info("PGHOST=" + _pgHost);
-        logger.info("PGDDATBASE=" + _pgDatabase);
-        logger.info("PGPORT=" + _pgPort);
-        logger.info("PGSCHEMA=" + _pgSchema);
-        logger.info("PGUSER=" + _pgUsername);
-        logger.info("PGPASS=" + _pgPassword);
-        logger.info("USEWKB=" + _pgUseWKB);
+        logger.info("PGHOST=" + _myHost);
+        logger.info("PGDDATBASE=" + _myDatabase);
+        logger.info("PGPORT=" + _myPort);
+        logger.info("PGSCHEMA=" + _mySchema);
+        logger.info("PGUSER=" + _myUsername);
+        logger.info("PGPASS=" + _myPassword);
+        logger.info("USEWKB=" + _myUseWKB);
         */
 
         if (_pgHost == null)
@@ -247,7 +247,7 @@
                     OracleConvertPostGISJobContext jobContext =
                             (OracleConvertPostGISJobContext) prepareJobContext(_filterPath);
                     jobContext.setSourceDataStore(getSourceDataStore());
-                    jobContext.setConvertElementIn(_convertElementIn);
+                    // jobContext.setConvertElementIn(_convertElementIn);
                     jobContext.setElementLogging(checkElementLogging());
                     jobContext.setExecutionContext(context);
 
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java
index 384b6d9..b14ab22 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/OracleConvertDgn2ShpJob.java
@@ -22,10 +22,6 @@
 import org.apache.commons.logging.LogFactory;
 import org.geotools.feature.IllegalAttributeException;
 import org.geotools.feature.SchemaException;
-import org.geotools.data.oracle.OracleDataStore;
-import org.geotools.data.jdbc.ConnectionPoolManager;
-import org.geotools.data.jdbc.datasource.DataSourceUtil;
-import org.geotools.data.jdbc.datasource.DataSourceFinder;
 import org.quartz.JobDetail;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnFileJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnFileJobContext.java
index 0a28ca6..8448eaf 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnFileJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractDgnFileJobContext.java
@@ -2,8 +2,8 @@
 
 import java.util.Map;
 
-import org.quartz.JobExecutionContext;
 import org.apache.commons.logging.Log;
+import org.quartz.JobExecutionContext;
 
 import com.ximple.io.dgn7.Dgn7fileReader;
 
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleJobContext.java
index 82081c2..0b112ae 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/AbstractOracleJobContext.java
@@ -1,18 +1,14 @@
 package com.ximple.eofms.jobs.context;
 
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Properties;
 import java.io.IOException;
+import java.util.Properties;
 
 import org.apache.commons.logging.Log;
-import org.geotools.data.oracle.OracleDataStore;
-import org.geotools.data.Transaction;
 import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.geotools.data.oracle.OracleDataStore;
 
 import oracle.jdbc.OracleConnection;
-
-import com.ximple.eofms.jobs.context.shapefile.OracleConvertShapefilesJobContext;
 
 public abstract class AbstractOracleJobContext
 {
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java
new file mode 100644
index 0000000..805ec8a
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractDgnToMySQLJobContext.java
@@ -0,0 +1,47 @@
+package com.ximple.eofms.jobs.context.mysql;
+
+import java.io.IOException;
+import java.sql.Connection;
+
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.geotools.data.mysql.MySQLDataStore;
+
+import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext;
+
+public abstract class AbstractDgnToMySQLJobContext extends AbstractDgnFileJobContext
+{
+    protected MySQLDataStore targetDataStore;
+
+    public AbstractDgnToMySQLJobContext(String dataPath, DataStore targetDataStore)
+    {
+        super(dataPath);
+        this.targetDataStore = (MySQLDataStore) targetDataStore;
+    }
+
+    public MySQLDataStore getTargetDataStore()
+    {
+        return targetDataStore;
+    }
+
+    public void setTargetDataStore(MySQLDataStore targetDataStore)
+    {
+        this.targetDataStore = targetDataStore;
+    }
+
+    public Connection getConnection()
+    {
+        if (targetDataStore != null)
+        {
+            try
+            {
+                return targetDataStore.getConnection(Transaction.AUTO_COMMIT);
+            } catch (IOException e)
+            {
+                getLogger().warn(e.getMessage(), e);
+            }
+        }
+        return null;
+    }
+}
+
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java
new file mode 100644
index 0000000..6db750d
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/AbstractOracleToMySQLJobContext.java
@@ -0,0 +1,52 @@
+package com.ximple.eofms.jobs.context.mysql;
+
+import java.io.IOException;
+import java.sql.Connection;
+
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.geotools.data.mysql.MySQLDataStore;
+
+import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
+
+public abstract class AbstractOracleToMySQLJobContext extends AbstractOracleJobContext
+{
+    protected MySQLDataStore targetDataStore;
+
+    public AbstractOracleToMySQLJobContext(String dataPath, DataStore targetDataStore)
+    {
+        if ((targetDataStore != null) && (targetDataStore instanceof MySQLDataStore))
+        {
+            this.targetDataStore = (MySQLDataStore) targetDataStore;
+        } else
+        {
+            getLogger().info("targetDataStore has wrong.");
+        }
+        setDataPath(dataPath);
+    }
+
+    public MySQLDataStore getTargetDataStore()
+    {
+        return targetDataStore;
+    }
+
+    public void setTargetDataStore(MySQLDataStore targetDataStore)
+    {
+        this.targetDataStore = targetDataStore;
+    }
+
+    public Connection getConnection()
+    {
+        if (targetDataStore != null)
+        {
+            try
+            {
+                return targetDataStore.getConnection(Transaction.AUTO_COMMIT);
+            } catch (IOException e)
+            {
+                getLogger().warn(e.getMessage(), e);
+            }
+        }
+        return null;
+    }
+}
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java
new file mode 100644
index 0000000..e60f5d8
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/DummyFeatureConvertMySQlJobContext.java
@@ -0,0 +1,304 @@
+package com.ximple.eofms.jobs.context.mysql;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.xmlrules.DigesterLoader;
+import org.geotools.feature.Feature;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.SimpleFeature;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.xml.sax.SAXException;
+
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import com.ximple.eofms.jobs.context.orasdo.AbstractDgnToOraSDOJobContext;
+import com.ximple.eofms.filter.ElementDispatcher;
+import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
+import com.ximple.eofms.filter.ElementDispatchableFilter;
+import com.ximple.eofms.filter.TypeCompIdDispatchableFilter;
+import com.ximple.eofms.filter.TypeCompLevelIdDispatchableFilter;
+import com.ximple.eofms.filter.TypeIdDispatchableFilter;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.ComplexElement;
+import com.ximple.io.dgn7.UserAttributeData;
+
+public class DummyFeatureConvertMySQlJobContext extends AbstractDgnToMySQLJobContext
+{
+    static final Log logger = LogFactory.getLog(DummyFeatureConvertMySQlJobContext.class);
+    static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
+    static final GeometryFactory geometryFactory = new GeometryFactory();
+    static final String SHPOUTPATH = "shpout";
+
+    private String dataOut = null;
+
+    private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+
+    private PessimisticMapWrapper txFeaturesContext;
+
+    private ElementDispatcher elementDispatcher;
+    private String _filterConfig;
+    private boolean withIndex = false;
+
+    public DummyFeatureConvertMySQlJobContext(String dataPath, DataStore targetDataStore, String filterConfig)
+    {
+        super(dataPath, targetDataStore);
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+        _filterConfig = filterConfig;
+        elementDispatcher = createElementDispatcher();
+    }
+
+    private ElementDispatcher createElementDispatcher()
+    {
+        try
+        {
+            URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml");
+            assert rulesURL != null;
+            Digester digester = DigesterLoader.createDigester(rulesURL);
+            URL filterURL = null;
+            if (_filterConfig != null)
+            {
+                File config = new File(_filterConfig);
+                if (config.exists())
+                {
+                    filterURL = config.toURI().toURL();
+                }
+            }
+            if (filterURL == null)
+            {
+                // config = new File("conf/DefaultConvertShpFilter.xml");
+                filterURL = this.getClass().getResource("/conf/DefaultConvertShpFilter.xml");
+                // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml");
+            }
+            assert filterURL != null;
+            return (ElementDispatcher) digester.parse(filterURL);
+        } catch (UnsupportedEncodingException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (MalformedURLException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (SAXException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException
+    {
+        assert elementDispatcher != null;
+
+        if (element == null)
+        {
+            logger.warn("Unknown Element:" + null);
+            return;
+        }
+
+        // �P�_�O�_�ũM����
+        Feature feature = elementDispatcher.execute(element);
+        if (feature == null)
+        {
+            FrammeAttributeData linkage =
+                    AbstractFLinkageDispatchableFilter.getFeatureLinkage(element);
+            logger.warn("Unknown Element:" + element.getElementType().toString() +
+                    ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" +
+                    (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID())));
+            if (element instanceof ComplexElement)
+            {
+                ComplexElement complex = (ComplexElement) element;
+                logger.warn("----Complex Element size=" + complex.size());
+            }
+
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        ArrayList arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+    }
+
+    public void startTransaction()
+    {
+        assert elementDispatcher != null;
+        for (ElementDispatchableFilter filter : elementDispatcher.getRules())
+        {
+            if (filter instanceof TypeCompIdDispatchableFilter)
+            {
+                ((TypeCompIdDispatchableFilter) filter).getCreateStrategy();
+            } else if (filter instanceof TypeCompLevelIdDispatchableFilter)
+            {
+                ((TypeCompIdDispatchableFilter) filter).getCreateStrategy();
+            } else if (filter instanceof TypeIdDispatchableFilter)
+            {
+                ((TypeCompIdDispatchableFilter) filter).getCreateStrategy();
+            }
+        }
+    }
+
+    public void commitTransaction()
+    {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    public void rollbackTransaction()
+    {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                logger.debug("Begin Save OracleSDO:" + featureType.getTypeName());
+
+                FeatureWriter writer;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    if (targetDataStore.getSchema(featureType.getTypeName()) == null)
+                    {
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(), Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList<Feature> features = featuresContext.get(featureType);
+                Iterator itFeature = features.iterator();
+                while (itFeature.hasNext())
+                {
+                    Feature feature = (Feature) itFeature.next();
+                    ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public String getDataOutPath()
+    {
+        if (dataOut == null)
+        {
+            File outPath = new File(getDataPath(), SHPOUTPATH);
+            if (!outPath.exists())
+            {
+                outPath.mkdir();
+            } else if (!outPath.isDirectory())
+            {
+                outPath.mkdir();
+            }
+            dataOut = outPath.toString();
+        }
+        return dataOut;
+    }
+
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    protected FrammeAttributeData getFeatureLinkage(Element element)
+    {
+        if (!element.hasUserAttributeData())
+            return null;
+
+        List<UserAttributeData> usrDatas = element.getUserAttributeData();
+        for (UserAttributeData anUsrData : usrDatas)
+        {
+            if (anUsrData instanceof FrammeAttributeData)
+            {
+                return (FrammeAttributeData) anUsrData;
+            }
+        }
+        return null;
+    }
+
+
+    public boolean isWithIndex()
+    {
+        return withIndex;
+    }
+
+    public void setWithIndex(boolean withIndex)
+    {
+        this.withIndex = withIndex;
+    }
+
+    public Log getLogger()
+    {
+        return logger;
+    }
+}
+
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java
new file mode 100644
index 0000000..f22761d
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/FeatureDgnConvertMySQLJobContext.java
@@ -0,0 +1,268 @@
+package com.ximple.eofms.jobs.context.mysql;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.xmlrules.DigesterLoader;
+import org.geotools.feature.Feature;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.SimpleFeature;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.xml.sax.SAXException;
+
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import com.ximple.eofms.filter.ElementDispatcher;
+import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.ComplexElement;
+import com.ximple.io.dgn7.UserAttributeData;
+
+public class FeatureDgnConvertMySQLJobContext extends AbstractDgnToMySQLJobContext
+{
+    static final Log logger = LogFactory.getLog(FeatureDgnConvertMySQLJobContext.class);
+    static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
+    static final GeometryFactory geometryFactory = new GeometryFactory();
+
+    private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+
+    private PessimisticMapWrapper txFeaturesContext;
+
+    private ElementDispatcher elementDispatcher;
+    private String _filterConfig;
+    private boolean withIndex = false;
+
+    public FeatureDgnConvertMySQLJobContext(String dataPath, DataStore targetDataStore, String filterConfig)
+    {
+        super(dataPath, targetDataStore);
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+        _filterConfig = filterConfig;
+        elementDispatcher = createElementDispatcher();
+    }
+
+    private ElementDispatcher createElementDispatcher()
+    {
+        try
+        {
+            URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml");
+            assert rulesURL != null;
+            Digester digester = DigesterLoader.createDigester(rulesURL);
+            URL filterURL = null;
+            if (_filterConfig != null)
+            {
+                File config = new File(_filterConfig);
+                if (config.exists())
+                {
+                    filterURL = config.toURI().toURL();
+                }
+            }
+            if (filterURL == null)
+            {
+                // config = new File("conf/DefaultConvertShpFilter.xml");
+                filterURL = this.getClass().getResource("/conf/DefaultConvertShpFilter.xml");
+                // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml");
+            }
+            assert filterURL != null;
+            return (ElementDispatcher) digester.parse(filterURL);
+        } catch (UnsupportedEncodingException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (MalformedURLException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (SAXException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException
+    {
+        assert elementDispatcher != null;
+
+        if (element == null)
+        {
+            logger.warn("Unknown Element:" + null);
+            return;
+        }
+
+        // �P�_�O�_�ũM����
+        Feature feature = elementDispatcher.execute(element);
+        if (feature == null)
+        {
+            FrammeAttributeData linkage =
+                    AbstractFLinkageDispatchableFilter.getFeatureLinkage(element);
+            logger.warn("Unknown Element:" + element.getElementType().toString() +
+                    ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" +
+                    (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID())));
+            if (element instanceof ComplexElement)
+            {
+                ComplexElement complex = (ComplexElement) element;
+                logger.warn("----Complex Element size=" + complex.size());
+            }
+
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        ArrayList arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+    }
+
+    public void startTransaction()
+    {
+    }
+
+    public void commitTransaction()
+    {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    public void rollbackTransaction()
+    {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                logger.debug("Begin Save OracleSDO:" + featureType.getTypeName());
+
+                FeatureWriter writer;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    if (targetDataStore.getSchema(featureType.getTypeName()) == null)
+                    {
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList<Feature> features = featuresContext.get(featureType);
+                Iterator itFeature = features.iterator();
+                while (itFeature.hasNext())
+                {
+                    Feature feature = (Feature) itFeature.next();
+                    ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    protected FrammeAttributeData getFeatureLinkage(Element element)
+    {
+        if (!element.hasUserAttributeData())
+            return null;
+
+        List<UserAttributeData> usrDatas = element.getUserAttributeData();
+        for (UserAttributeData anUsrData : usrDatas)
+        {
+            if (anUsrData instanceof FrammeAttributeData)
+            {
+                return (FrammeAttributeData) anUsrData;
+            }
+        }
+        return null;
+    }
+
+
+    public boolean isWithIndex()
+    {
+        return withIndex;
+    }
+
+    public void setWithIndex(boolean withIndex)
+    {
+        this.withIndex = withIndex;
+    }
+
+    public Log getLogger()
+    {
+        return logger;
+    }
+}
+
+
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java
new file mode 100644
index 0000000..506777d
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/GeneralDgnConvertMySQLJobContext.java
@@ -0,0 +1,521 @@
+package com.ximple.eofms.jobs.context.mysql;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.TreeMap;
+import java.util.Iterator;
+import java.util.List;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
+import org.geotools.feature.Feature;
+import org.geotools.feature.FeatureTypeBuilder;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.geotools.feature.SimpleFeature;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.Geometry;
+
+import com.ximple.eofms.util.TWD97GeometryConverterDecorator;
+import com.ximple.eofms.util.FeatureTypeBuilderUtil;
+import com.ximple.eofms.util.DefaultColorTable;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.TextElement;
+import com.ximple.io.dgn7.ShapeElement;
+import com.ximple.io.dgn7.LineStringElement;
+import com.ximple.io.dgn7.ArcElement;
+import com.ximple.io.dgn7.TextNodeElement;
+import com.ximple.io.dgn7.LineElement;
+import com.ximple.io.dgn7.EllipseElement;
+import com.ximple.io.dgn7.ComplexChainElement;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.UserAttributeData;
+
+public class GeneralDgnConvertMySQLJobContext  extends AbstractDgnToMySQLJobContext
+{
+    static final Log logger = LogFactory.getLog(GeneralDgnConvertMySQLJobContext.class);
+    static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
+    static final GeometryFactory geometryFactory = new GeometryFactory();
+
+    private String dataOut = null;
+
+    private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+
+    private PessimisticMapWrapper txFeaturesContext;
+    private TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>();
+    private TreeMap<String, FeatureType> featureTypes = new TreeMap<String, FeatureType>();
+
+    private TWD97GeometryConverterDecorator convertDecorator = null;
+    private String featureBaseName = null;
+    private boolean withIndex = false;
+
+    public GeneralDgnConvertMySQLJobContext(String dataPath, DataStore targetDataStore)
+    {
+        super(dataPath, targetDataStore);
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+        convertDecorator = new TWD97GeometryConverterDecorator();
+    }
+
+    public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException
+    {
+        FeatureType ft = lookupFeatureType(element);
+        if (ft != null)
+        {
+            Feature feature = createFeature(ft, element);
+            if (feature == null)
+            {
+                if (element instanceof TextElement)
+                    logger.info("cannot craete feature." + element.toString() + "'" +
+                            ((TextElement) element).getText() + "'");
+                else if (element instanceof ShapeElement)
+                    logger.info("cannot craete feature." + element.toString() + "'" +
+                            ((ShapeElement) element).getVerticeSize() + "'" +
+                            ((ShapeElement) element).getStartPoint());
+                else if (element instanceof LineStringElement)
+                    logger.info("cannot craete feature." + element.toString() + "'" +
+                            ((LineStringElement) element).getVerticeSize() + "'" +
+                            ((LineStringElement) element).getStartPoint());
+                else if (element instanceof ArcElement)
+                    logger.info("cannot craete feature." + element.toString() + "'" +
+                            ((ArcElement) element).getOrigin().toString() + "'" +
+                            ((ArcElement) element).getRotationAngle());
+
+                return;
+            }
+
+            if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+            {
+                txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>());
+            }
+            ArrayList<Feature> arrayList = (ArrayList<Feature>) txFeaturesContext.get(feature.getFeatureType());
+            arrayList.add(feature);
+        } else
+        {
+            logger.info("Unknown Element :" + element.getType() + ", lv=" + element.getLevelIndex());
+        }
+    }
+
+    public void startTransaction()
+    {
+    }
+
+    public void commitTransaction()
+    {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    public void rollbackTransaction()
+    {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                logger.debug("Begin Save into OracleSDO:" + featureType.getTypeName());
+
+                FeatureWriter writer;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    if (targetDataStore.getSchema(featureType.getTypeName()) != null)
+                    {
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList<Feature> features = featuresContext.get(featureType);
+                Iterator itFeature = features.iterator();
+                while (itFeature.hasNext())
+                {
+                    Feature feature = (Feature) itFeature.next();
+                    ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save into OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    public FeatureType createPointFeatureElement(String featureName) throws SchemaException
+    {
+        if (!typeBuilders.containsKey(featureName))
+        {
+            FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName);
+            typeBuilders.put(featureName, typeBuilder);
+        }
+        return typeBuilders.get(featureName).getFeatureType();
+    }
+
+    public FeatureType createLineFeatureElement(String featureName) throws SchemaException
+    {
+        if (!typeBuilders.containsKey(featureName))
+        {
+            FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName);
+            typeBuilders.put(featureName, typeBuilder);
+        }
+        return typeBuilders.get(featureName).getFeatureType();
+    }
+
+    public FeatureType createArcFeatureElement(String featureName) throws SchemaException
+    {
+        if (!typeBuilders.containsKey(featureName))
+        {
+            FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName);
+            typeBuilders.put(featureName, typeBuilder);
+        }
+        return typeBuilders.get(featureName).getFeatureType();
+    }
+
+    public FeatureType createEllipseFeatureElement(String featureName) throws SchemaException
+    {
+        if (!typeBuilders.containsKey(featureName))
+        {
+            FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName);
+            typeBuilders.put(featureName, typeBuilder);
+        }
+        return typeBuilders.get(featureName).getFeatureType();
+    }
+
+    public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException
+    {
+        DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance();
+        if (element instanceof TextElement)
+        {
+            TextElement textElement = (TextElement) element;
+            convertDecorator.setConverter(textElement);
+
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            double angle = textElement.getRotationAngle();
+            String content = textElement.getText();
+            angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue();
+            if (geom != null)
+            {
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(textElement.getColorIndex()),
+                        textElement.getFontIndex(),
+                        textElement.getJustification(),
+                        textElement.getTextHeight(),
+                        textElement.getTextWidth(),
+                        angle,
+                        content
+                });
+            } else
+            {
+                logger.info("geometry is null." + element.toString());
+            }
+            return null;
+        } else if (element instanceof TextNodeElement)
+        {
+            TextNodeElement textNodeElement = (TextNodeElement) element;
+            convertDecorator.setConverter(textNodeElement);
+
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            double angle = textNodeElement.getRotationAngle();
+            angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue();
+            String[] texts = textNodeElement.getTextArray();
+            StringBuffer sb = new StringBuffer();
+            for (String text : texts)
+            {
+                if (sb.length() != 0)
+                    sb.append("\n");
+                sb.append(text);
+            }
+
+            if (geom != null)
+            {
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(textNodeElement.getColorIndex()),
+                        textNodeElement.getFontIndex(),
+                        textNodeElement.getJustification(),
+                        textNodeElement.getTextNodeHeight(),
+                        textNodeElement.getTextNodeLength(),
+                        angle,
+                        sb.toString()
+                });
+            } else
+            {
+                logger.info("geometry is null." + element.toString());
+            }
+            return null;
+        } else if (element instanceof ShapeElement)
+        {
+            ShapeElement shapeElement = (ShapeElement) element;
+            convertDecorator.setConverter(shapeElement);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+            {
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(shapeElement.getColorIndex()),
+                        shapeElement.getWeight(),
+                        shapeElement.getLineStyle()
+                });
+            } else
+            {
+                logger.info("geometry is null." + element.toString());
+            }
+            return null;
+        } else if (element instanceof LineStringElement)
+        {
+            LineStringElement linestring = (LineStringElement) element;
+            convertDecorator.setConverter(linestring);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(linestring.getColorIndex()),
+                        linestring.getWeight(),
+                        linestring.getLineStyle()
+                });
+            return null;
+        } else if (element instanceof LineElement)
+        {
+            LineElement line = (LineElement) element;
+            convertDecorator.setConverter(line);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(line.getColorIndex()),
+                        line.getWeight(),
+                        line.getLineStyle()
+                });
+            return null;
+        } else if (element instanceof ArcElement)
+        {
+            ArcElement arcElement = (ArcElement) element;
+            /*
+            logger.fatal("" + arcElement.getPrimary() + ":" + arcElement.getSecondary() +
+                    "-" + arcElement.getStartAngle() + ":" + arcElement.getSweepAngle() + ":" +
+            arcElement.getRotationAngle() + ":" + arcElement.getOrigin());
+            */
+            convertDecorator.setConverter(arcElement);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(arcElement.getColorIndex()),
+                        arcElement.getWeight(),
+                        arcElement.getLineStyle()
+                });
+            return null;
+        } else if (element instanceof EllipseElement)
+        {
+            EllipseElement arcElement = (EllipseElement) element;
+            convertDecorator.setConverter(arcElement);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(arcElement.getColorIndex()),
+                        arcElement.getWeight(),
+                        arcElement.getLineStyle()
+                });
+            return null;
+        } else if (element instanceof ComplexChainElement)
+        {
+            ComplexChainElement complexChainElement = (ComplexChainElement) element;
+            convertDecorator.setConverter(complexChainElement);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(complexChainElement.getColorIndex()),
+                        complexChainElement.getWeight(),
+                        complexChainElement.getLineStyle()
+                });
+            return null;
+        }
+        return null;
+    }
+
+    private String getFeatureBaseName()
+    {
+        if (featureBaseName == null)
+        {
+            String dgnname = getFilename().toLowerCase();
+            int i = dgnname.lastIndexOf(".");
+            if (i != -1)
+            {
+                dgnname = dgnname.substring(0, i);
+            }
+            featureBaseName = dgnname;
+        }
+        return featureBaseName;
+    }
+
+    private FeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException
+    {
+        String typeName;
+        if (element instanceof TextElement)
+        {
+            typeName = getFeatureBaseName() + "P";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createPointFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof TextNodeElement)
+        {
+            typeName = getFeatureBaseName() + "P";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createPointFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof LineStringElement)
+        {
+            if (element instanceof ShapeElement)
+            {
+                typeName = getFeatureBaseName() + "R";
+                if (!featureTypes.containsKey(typeName))
+                {
+                    featureTypes.put(typeName, createLineFeatureElement(typeName));
+                }
+                return featureTypes.get(typeName);
+            } else
+            {
+                typeName = getFeatureBaseName() + "L";
+                if (!featureTypes.containsKey(typeName))
+                {
+                    featureTypes.put(typeName, createLineFeatureElement(typeName));
+                }
+                return featureTypes.get(typeName);
+            }
+        } else if (element instanceof LineElement)
+        {
+            typeName = getFeatureBaseName() + "L";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createLineFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof ComplexChainElement)
+        {
+            typeName = getFeatureBaseName() + "L";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createLineFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof ArcElement)
+        {
+            typeName = getFeatureBaseName() + "A";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createArcFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof EllipseElement)
+        {
+            typeName = getFeatureBaseName() + "R";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createEllipseFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        }
+
+        return null;
+    }
+
+    protected FrammeAttributeData getFeatureLinkage(Element element)
+    {
+        if (!element.hasUserAttributeData())
+            return null;
+
+        List<UserAttributeData> usrDatas = element.getUserAttributeData();
+        for (UserAttributeData anUsrData : usrDatas)
+        {
+            if (anUsrData instanceof FrammeAttributeData)
+            {
+                return (FrammeAttributeData) anUsrData;
+            }
+        }
+        return null;
+    }
+
+
+    public boolean isWithIndex()
+    {
+        return withIndex;
+    }
+
+    public void setWithIndex(boolean withIndex)
+    {
+        this.withIndex = withIndex;
+    }
+
+    public Log getLogger()
+    {
+        return logger;
+    }
+}
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java
new file mode 100644
index 0000000..089a6ed
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/IndexDgnConvertMySQLJobContext.java
@@ -0,0 +1,320 @@
+package com.ximple.eofms.jobs.context.mysql;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
+import org.geotools.feature.Feature;
+import org.geotools.feature.FeatureTypeBuilder;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.geotools.feature.SimpleFeature;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.Coordinate;
+
+import com.ximple.eofms.util.TWD97GeometryConverterDecorator;
+import com.ximple.eofms.util.FeatureTypeBuilderUtil;
+import com.ximple.eofms.util.DefaultColorTable;
+import com.ximple.eofms.util.TPCLIDConverter;
+import com.ximple.eofms.util.TWDDatumConverter;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.TextElement;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.UserAttributeData;
+
+public class IndexDgnConvertMySQLJobContext extends AbstractDgnToMySQLJobContext
+{
+    static final Log logger = LogFactory.getLog(IndexDgnConvertMySQLJobContext.class);
+    static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
+    static final GeometryFactory geometryFactory = new GeometryFactory();
+    TWD97GeometryConverterDecorator convertDecorator = new TWD97GeometryConverterDecorator();
+
+    private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+
+    private PessimisticMapWrapper txFeaturesContext;
+    private FeatureTypeBuilder typeBuilderPnt = null;
+    private FeatureTypeBuilder typeBuilderRect = null;
+    private FeatureType featureType = null;
+    private FeatureType featureType2 = null;
+
+    public IndexDgnConvertMySQLJobContext(String dataPath, DataStore targetDataStore)
+    {
+        super(dataPath, targetDataStore);
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+    }
+
+    public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException
+    {
+        if (!(element instanceof TextElement))
+        {
+            return;
+        }
+
+        Feature feature = createFeature((TextElement) element);
+        if (feature == null)
+        {
+            logger.info("cannot craete feature." + element.toString() + "'" +
+                    ((TextElement) element).getText() + "'");
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        ArrayList arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+
+        feature = createFeature2((TextElement) element);
+        if (feature == null)
+        {
+            logger.info("cannot craete feature2." + element.toString() + "'" +
+                    ((TextElement) element).getText() + "'");
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+    }
+
+    public void startTransaction()
+    {
+    }
+
+    public void commitTransaction()
+    {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    public void rollbackTransaction()
+    {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                logger.debug("Begin Save OracleSDO:" + featureType.getTypeName());
+
+                FeatureWriter writer;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    if (targetDataStore.getSchema(featureType.getTypeName()) == null)
+                    {
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(), Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList<Feature> features = featuresContext.get(featureType);
+                for (Feature feature1 : features)
+                {
+                    ((SimpleFeature) writer.next()).setAttributes(feature1.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    public FeatureType createFeatureElement(String featureName) throws SchemaException
+    {
+        if (typeBuilderRect == null)
+        {
+            typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName);
+        }
+        return typeBuilderRect.getFeatureType();
+    }
+
+    public FeatureType createFeatureElement2(String featureName) throws SchemaException
+    {
+        if (typeBuilderPnt == null)
+        {
+            typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexTextFeatureTypeBuilder(featureName);
+        }
+        return typeBuilderPnt.getFeatureType();
+    }
+
+    public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException
+    {
+        DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance();
+        if (element instanceof TextElement)
+        {
+            TextElement textElement = (TextElement) element;
+            String tpclid = textElement.getText();
+
+            Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid);
+            Geometry geom = geometryFactory.createLinearRing(new Coordinate[]
+                    {
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMinX(), extent.getMinY())),
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMaxX(), extent.getMinY())),
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMaxX(), extent.getMaxY())),
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMinX(), extent.getMaxY())),
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMinX(), extent.getMinY())),
+                    });
+
+            return featureType.create(new Object[]{
+                    geom,
+                    extent.getMinX(),
+                    extent.getMinY(),
+                    extent.getMaxX(),
+                    extent.getMaxY(),
+                    tpclid,
+                    colorTable.getColorCode(textElement.getColorIndex()),
+                    textElement.getWeight(),
+                    textElement.getLineStyle()
+            });
+        }
+        return null;
+    }
+
+    public Feature createFeature2(FeatureType featureType, Element element) throws IllegalAttributeException
+    {
+        DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance();
+        if (element instanceof TextElement)
+        {
+            TextElement txtElement = (TextElement) element;
+            double angle = txtElement.getRotationAngle();
+            angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue();
+            convertDecorator.setConverter(txtElement);
+            Feature feature = featureType.create(new Object[]{
+                    convertDecorator.toGeometry(geometryFactory),
+                    colorTable.getColorCode(txtElement.getColorIndex()),
+                    txtElement.getWeight(),
+                    txtElement.getLineStyle(),
+                    txtElement.getJustification(),
+                    txtElement.getTextHeight(),
+                    txtElement.getTextWidth(),
+                    angle,
+                    txtElement.getText()
+            });
+            return feature;
+        }
+        return null;
+    }
+
+    private Feature createFeature(TextElement element) throws SchemaException, IllegalAttributeException
+    {
+        if (featureType == null)
+        {
+            String dgnname = getFilename().toLowerCase();
+            int i = dgnname.lastIndexOf(".");
+            if (i != -1)
+            {
+                dgnname = dgnname.substring(0, i);
+            }
+            featureType = createFeatureElement(dgnname);
+        }
+        return createFeature(featureType, element);
+    }
+
+    private Feature createFeature2(TextElement element) throws SchemaException, IllegalAttributeException
+    {
+        if (featureType2 == null)
+        {
+            String dgnname = getFilename().toLowerCase();
+            int i = dgnname.lastIndexOf(".");
+            if (i != -1)
+            {
+                dgnname = dgnname.substring(0, i);
+            }
+            dgnname = dgnname + "P";
+            featureType2 = createFeatureElement2(dgnname);
+        }
+        return createFeature2(featureType2, element);
+    }
+
+    protected FrammeAttributeData getFeatureLinkage(Element element)
+    {
+        if (!element.hasUserAttributeData())
+            return null;
+
+        List<UserAttributeData> usrDatas = element.getUserAttributeData();
+        for (UserAttributeData anUsrData : usrDatas)
+        {
+            if (anUsrData instanceof FrammeAttributeData)
+            {
+                return (FrammeAttributeData) anUsrData;
+            }
+        }
+        return null;
+    }
+
+    public Log getLogger()
+    {
+        return logger;
+    }
+}
+
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java
new file mode 100644
index 0000000..2bbc898
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/mysql/OracleConvertMySQLJobContext.java
@@ -0,0 +1,319 @@
+package com.ximple.eofms.jobs.context.mysql;
+
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.xmlrules.DigesterLoader;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.geotools.data.mysql.MySQLDataStoreFactory;
+import org.geotools.feature.Feature;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.SimpleFeature;
+import org.geotools.feature.IllegalAttributeException;
+import org.quartz.JobExecutionContext;
+import org.xml.sax.SAXException;
+
+import com.vividsolutions.jts.util.Assert;
+
+import com.ximple.eofms.jobs.OracleElementLogger;
+import com.ximple.eofms.filter.ElementDispatcher;
+import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.ComplexElement;
+
+public class OracleConvertMySQLJobContext extends AbstractOracleToMySQLJobContext
+{
+    static Log logger = LogFactory.getLog(OracleConvertMySQLJobContext.class);
+    static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
+
+    static MySQLDataStoreFactory dataStoreFactory = new MySQLDataStoreFactory();
+
+    private OracleElementLogger elmLogger = null;
+
+    static
+    {
+        try
+        {
+            DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
+        } catch (SQLException e)
+        {
+            Assert.shouldNeverReachHere(e.getMessage());
+        }
+    }
+
+    private String _filterConfig;
+
+    private ElementDispatcher elementDispatcher;
+
+    private HashMap featuresContext = new HashMap();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+    private PessimisticMapWrapper txFeaturesContext;
+
+    private JobExecutionContext executionContext;
+
+    private String currentSchema = null;
+    private String pgCurrentSchema = null;
+    private boolean schemaChanged = false;
+    // private String _convertElementIn = null;
+
+    public OracleConvertMySQLJobContext(String dataPath, DataStore oraDS, String filterConfig)
+    {
+        super(dataPath, oraDS);
+        _filterConfig = filterConfig;
+        elementDispatcher = createElementDispatcher();
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+    }
+
+    private ElementDispatcher createElementDispatcher()
+    {
+        try
+        {
+            URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml");
+            assert rulesURL != null;
+            Digester digester = DigesterLoader.createDigester(rulesURL);
+            URL filterURL = null;
+            if (_filterConfig != null)
+            {
+                File config = new File(_filterConfig);
+                if (config.exists())
+                {
+                    filterURL = config.toURI().toURL();
+                }
+            }
+            if (filterURL == null)
+            {
+                // config = new File("conf/DefaultConvertShpFilter.xml");
+                filterURL = this.getClass().getResource("/conf/DefaultConvertShpFilter.xml");
+                // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml");
+            }
+            assert filterURL != null;
+            return (ElementDispatcher) digester.parse(filterURL);
+        } catch (UnsupportedEncodingException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (MalformedURLException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (SAXException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    public void putFeatureCollection(Element element)
+    {
+        assert elementDispatcher != null;
+        // �P�_�O�_�ũM����
+        Feature feature = elementDispatcher.execute(element);
+        if (feature == null)
+        {
+            boolean isEmptySize = false;
+            FrammeAttributeData linkage =
+                    AbstractFLinkageDispatchableFilter.getFeatureLinkage(element);
+            logger.warn("Unknown Element:" + element.getElementType().toString() +
+                    ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" +
+                    (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID())));
+
+            if (element instanceof ComplexElement)
+            {
+                ComplexElement complex = (ComplexElement) element;
+                logger.warn("----Complex Element size=" + complex.size() + ":" +
+                        (linkage == null ? "NULL" : (linkage.getUfid())));
+                isEmptySize = true;
+            }
+
+            if (getElementLogging() && (!isEmptySize))
+            {
+                getElementLogger().logElement(element, getCurrentSchema());
+            }
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        ArrayList arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+    }
+
+    public void startTransaction()
+    {
+        //txFeaturesContext.startTransaction();
+    }
+
+    public void commitTransaction()
+    {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+
+        if (this.getElementLogger() != null)
+            this.getElementLogger().flashLogging();
+    }
+
+    public void rollbackTransaction()
+    {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                FeatureWriter writer = null;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    DataStore postGisDataStore = null;
+                    postGisDataStore = dataStoreFactory.createDataStore(properties);
+
+                    boolean existTable = isExistFeature(featureType);
+
+                    if (!existTable)
+                    {
+                        postGisDataStore.createSchema(featureType);
+                        writer = postGisDataStore.getFeatureWriter(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = postGisDataStore.getFeatureWriterAppend(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList features = (ArrayList) featuresContext.get(featureType);
+                Iterator itFeature = features.iterator();
+                while (itFeature.hasNext())
+                {
+                    Feature feature = (Feature) itFeature.next();
+                    ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+
+    }
+
+    private boolean isExistFeature(FeatureType featureType)
+    {
+        try
+        {
+            FeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName());
+            return existFeatureType != null && existFeatureType.equals(featureType);
+        } catch (IOException e)
+        {
+            logger.info(e.getMessage(), e);
+            return false;
+        }
+    }
+
+    public JobExecutionContext getExecutionContext()
+    {
+        return executionContext;
+    }
+
+    public void setExecutionContext(JobExecutionContext context)
+    {
+        executionContext = context;
+    }
+
+    /**
+     * �����]�Ƽg�J��
+     *
+     * @throws IOException IO�o�Ϳ��~
+     */
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    protected OracleElementLogger getElementLogger()
+    {
+        if (elmLogger == null)
+        {
+            elmLogger = new OracleElementLogger(getOracleConnection());
+            elmLogger.setDataPath(this.getDataPath());
+        }
+        return elmLogger;
+    }
+
+    public String getCurrentSchema()
+    {
+        return currentSchema;
+    }
+
+    public void setCurrentSchema(String querySchema)
+    {
+        this.currentSchema = querySchema;
+        this.schemaChanged = true;
+    }
+
+    protected Log getLogger()
+    {
+        return logger;
+    }
+}
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java
index 71dd629..23fce14 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractDgnToOraSDOJobContext.java
@@ -1,14 +1,46 @@
 package com.ximple.eofms.jobs.context.orasdo;
 
-import java.util.Properties;
+import java.io.IOException;
+import java.sql.Connection;
+
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.geotools.data.oracle.OracleDataStore;
 
 import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext;
 
 public abstract class AbstractDgnToOraSDOJobContext extends AbstractDgnFileJobContext
 {
-    public AbstractDgnToOraSDOJobContext(String dataPath, Properties properties)
+    protected OracleDataStore targetDataStore;
+
+    public AbstractDgnToOraSDOJobContext(String dataPath, DataStore targetDataStore)
     {
         super(dataPath);
-        this.properties = properties;
+        this.targetDataStore = (OracleDataStore) targetDataStore;
+    }
+
+    public OracleDataStore getTargetDataStore()
+    {
+        return targetDataStore;
+    }
+
+    public void setTargetDataStore(OracleDataStore targetDataStore)
+    {
+        this.targetDataStore = targetDataStore;
+    }
+
+    public Connection getConnection()
+    {
+        if (targetDataStore != null)
+        {
+            try
+            {
+                return targetDataStore.getConnection(Transaction.AUTO_COMMIT);
+            } catch (IOException e)
+            {
+                getLogger().warn(e.getMessage(), e);
+            }
+        }
+        return null;
     }
 }
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java
index 2c0c7a1..78dfc8b 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/AbstractOracleToOraSDOJobContext.java
@@ -1,12 +1,52 @@
 package com.ximple.eofms.jobs.context.orasdo;
 
-import java.util.Properties;
+import java.io.IOException;
+import java.sql.Connection;
+
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.geotools.data.oracle.OracleDataStore;
 
 import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
 
 public abstract class AbstractOracleToOraSDOJobContext extends AbstractOracleJobContext
 {
-    public AbstractOracleToOraSDOJobContext(String dataPath, Properties properties)
+    protected OracleDataStore targetDataStore;
+
+    public AbstractOracleToOraSDOJobContext(String dataPath, DataStore targetDataStore)
     {
+        if ((targetDataStore != null) && (targetDataStore instanceof OracleDataStore))
+        {
+            this.targetDataStore = (OracleDataStore) targetDataStore;
+        } else
+        {
+            getLogger().info("targetDataStore has wrong.");
+        }
+        setDataPath(dataPath);
+    }
+
+    public OracleDataStore getTargetDataStore()
+    {
+        return targetDataStore;
+    }
+
+    public void setTargetDataStore(OracleDataStore targetDataStore)
+    {
+        this.targetDataStore = targetDataStore;
+    }
+
+    public Connection getConnection()
+    {
+        if (targetDataStore != null)
+        {
+            try
+            {
+                return targetDataStore.getConnection(Transaction.AUTO_COMMIT);
+            } catch (IOException e)
+            {
+                getLogger().warn(e.getMessage(), e);
+            }
+        }
+        return null;
     }
 }
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java
new file mode 100644
index 0000000..70ba052
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/DummyFeatureConvertOraSDOJobContext.java
@@ -0,0 +1,303 @@
+package com.ximple.eofms.jobs.context.orasdo;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.xmlrules.DigesterLoader;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
+import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.geotools.data.DataStore;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.Transaction;
+import org.geotools.feature.Feature;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.geotools.feature.SimpleFeature;
+import org.xml.sax.SAXException;
+
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
+import com.ximple.eofms.filter.ElementDispatchableFilter;
+import com.ximple.eofms.filter.ElementDispatcher;
+import com.ximple.eofms.filter.TypeCompIdDispatchableFilter;
+import com.ximple.eofms.filter.TypeCompLevelIdDispatchableFilter;
+import com.ximple.eofms.filter.TypeIdDispatchableFilter;
+import com.ximple.io.dgn7.ComplexElement;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.UserAttributeData;
+
+public class DummyFeatureConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext
+{
+    static final Log logger = LogFactory.getLog(DummyFeatureConvertOraSDOJobContext.class);
+    static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
+    static final GeometryFactory geometryFactory = new GeometryFactory();
+    static final String SHPOUTPATH = "shpout";
+
+    private String dataOut = null;
+
+    private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+
+    private PessimisticMapWrapper txFeaturesContext;
+
+    private ElementDispatcher elementDispatcher;
+    private String _filterConfig;
+    private boolean withIndex = false;
+
+    public DummyFeatureConvertOraSDOJobContext(String dataPath, DataStore targetDataStore, String filterConfig)
+    {
+        super(dataPath, targetDataStore);
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+        _filterConfig = filterConfig;
+        elementDispatcher = createElementDispatcher();
+    }
+
+    private ElementDispatcher createElementDispatcher()
+    {
+        try
+        {
+            URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml");
+            assert rulesURL != null;
+            Digester digester = DigesterLoader.createDigester(rulesURL);
+            URL filterURL = null;
+            if (_filterConfig != null)
+            {
+                File config = new File(_filterConfig);
+                if (config.exists())
+                {
+                    filterURL = config.toURI().toURL();
+                }
+            }
+            if (filterURL == null)
+            {
+                // config = new File("conf/DefaultConvertShpFilter.xml");
+                filterURL = this.getClass().getResource("/conf/DefaultConvertShpFilter.xml");
+                // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml");
+            }
+            assert filterURL != null;
+            return (ElementDispatcher) digester.parse(filterURL);
+        } catch (UnsupportedEncodingException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (MalformedURLException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (SAXException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException
+    {
+        assert elementDispatcher != null;
+
+        if (element == null)
+        {
+            logger.warn("Unknown Element:" + null);
+            return;
+        }
+
+        // �P�_�O�_�ũM����
+        Feature feature = elementDispatcher.execute(element);
+        if (feature == null)
+        {
+            FrammeAttributeData linkage =
+                    AbstractFLinkageDispatchableFilter.getFeatureLinkage(element);
+            logger.warn("Unknown Element:" + element.getElementType().toString() +
+                    ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" +
+                    (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID())));
+            if (element instanceof ComplexElement)
+            {
+                ComplexElement complex = (ComplexElement) element;
+                logger.warn("----Complex Element size=" + complex.size());
+            }
+
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        ArrayList arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+    }
+
+    public void startTransaction()
+    {
+        assert elementDispatcher != null;
+        for (ElementDispatchableFilter filter : elementDispatcher.getRules())
+        {
+            if (filter instanceof TypeCompIdDispatchableFilter)
+            {
+                ((TypeCompIdDispatchableFilter) filter).getCreateStrategy();
+            } else if (filter instanceof TypeCompLevelIdDispatchableFilter)
+            {
+                ((TypeCompIdDispatchableFilter) filter).getCreateStrategy();
+            } else if (filter instanceof TypeIdDispatchableFilter)
+            {
+                ((TypeCompIdDispatchableFilter) filter).getCreateStrategy();
+            }
+        }
+    }
+
+    public void commitTransaction()
+    {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    public void rollbackTransaction()
+    {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                logger.debug("Begin Save OracleSDO:" + featureType.getTypeName());
+
+                FeatureWriter writer;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    if (targetDataStore.getSchema(featureType.getTypeName()) == null)
+                    {
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(), Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList<Feature> features = featuresContext.get(featureType);
+                Iterator itFeature = features.iterator();
+                while (itFeature.hasNext())
+                {
+                    Feature feature = (Feature) itFeature.next();
+                    ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public String getDataOutPath()
+    {
+        if (dataOut == null)
+        {
+            File outPath = new File(getDataPath(), SHPOUTPATH);
+            if (!outPath.exists())
+            {
+                outPath.mkdir();
+            } else if (!outPath.isDirectory())
+            {
+                outPath.mkdir();
+            }
+            dataOut = outPath.toString();
+        }
+        return dataOut;
+    }
+
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    protected FrammeAttributeData getFeatureLinkage(Element element)
+    {
+        if (!element.hasUserAttributeData())
+            return null;
+
+        List<UserAttributeData> usrDatas = element.getUserAttributeData();
+        for (UserAttributeData anUsrData : usrDatas)
+        {
+            if (anUsrData instanceof FrammeAttributeData)
+            {
+                return (FrammeAttributeData) anUsrData;
+            }
+        }
+        return null;
+    }
+
+
+    public boolean isWithIndex()
+    {
+        return withIndex;
+    }
+
+    public void setWithIndex(boolean withIndex)
+    {
+        this.withIndex = withIndex;
+    }
+
+    public Log getLogger()
+    {
+        return logger;
+    }
+}
+
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java
new file mode 100644
index 0000000..aae85fd
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/FeatureDgnConvertOraSDOJobContext.java
@@ -0,0 +1,267 @@
+package com.ximple.eofms.jobs.context.orasdo;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.xmlrules.DigesterLoader;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
+import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.geotools.data.DataStore;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.Transaction;
+import org.geotools.feature.Feature;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.geotools.feature.SimpleFeature;
+import org.xml.sax.SAXException;
+
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
+import com.ximple.eofms.filter.ElementDispatcher;
+import com.ximple.io.dgn7.ComplexElement;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.UserAttributeData;
+
+public class FeatureDgnConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext
+{
+    static final Log logger = LogFactory.getLog(FeatureDgnConvertOraSDOJobContext.class);
+    static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
+    static final GeometryFactory geometryFactory = new GeometryFactory();
+
+    private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+
+    private PessimisticMapWrapper txFeaturesContext;
+
+    private ElementDispatcher elementDispatcher;
+    private String _filterConfig;
+    private boolean withIndex = false;
+
+    public FeatureDgnConvertOraSDOJobContext(String dataPath, DataStore targetDataStore, String filterConfig)
+    {
+        super(dataPath, targetDataStore);
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+        _filterConfig = filterConfig;
+        elementDispatcher = createElementDispatcher();
+    }
+
+    private ElementDispatcher createElementDispatcher()
+    {
+        try
+        {
+            URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml");
+            assert rulesURL != null;
+            Digester digester = DigesterLoader.createDigester(rulesURL);
+            URL filterURL = null;
+            if (_filterConfig != null)
+            {
+                File config = new File(_filterConfig);
+                if (config.exists())
+                {
+                    filterURL = config.toURI().toURL();
+                }
+            }
+            if (filterURL == null)
+            {
+                // config = new File("conf/DefaultConvertShpFilter.xml");
+                filterURL = this.getClass().getResource("/conf/DefaultConvertShpFilter.xml");
+                // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml");
+            }
+            assert filterURL != null;
+            return (ElementDispatcher) digester.parse(filterURL);
+        } catch (UnsupportedEncodingException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (MalformedURLException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (SAXException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException
+    {
+        assert elementDispatcher != null;
+
+        if (element == null)
+        {
+            logger.warn("Unknown Element:" + null);
+            return;
+        }
+
+        // �P�_�O�_�ũM����
+        Feature feature = elementDispatcher.execute(element);
+        if (feature == null)
+        {
+            FrammeAttributeData linkage =
+                    AbstractFLinkageDispatchableFilter.getFeatureLinkage(element);
+            logger.warn("Unknown Element:" + element.getElementType().toString() +
+                    ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" +
+                    (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID())));
+            if (element instanceof ComplexElement)
+            {
+                ComplexElement complex = (ComplexElement) element;
+                logger.warn("----Complex Element size=" + complex.size());
+            }
+
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        ArrayList arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+    }
+
+    public void startTransaction()
+    {
+    }
+
+    public void commitTransaction()
+    {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    public void rollbackTransaction()
+    {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                logger.debug("Begin Save OracleSDO:" + featureType.getTypeName());
+
+                FeatureWriter writer;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    if (targetDataStore.getSchema(featureType.getTypeName()) == null)
+                    {
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList<Feature> features = featuresContext.get(featureType);
+                Iterator itFeature = features.iterator();
+                while (itFeature.hasNext())
+                {
+                    Feature feature = (Feature) itFeature.next();
+                    ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    protected FrammeAttributeData getFeatureLinkage(Element element)
+    {
+        if (!element.hasUserAttributeData())
+            return null;
+
+        List<UserAttributeData> usrDatas = element.getUserAttributeData();
+        for (UserAttributeData anUsrData : usrDatas)
+        {
+            if (anUsrData instanceof FrammeAttributeData)
+            {
+                return (FrammeAttributeData) anUsrData;
+            }
+        }
+        return null;
+    }
+
+
+    public boolean isWithIndex()
+    {
+        return withIndex;
+    }
+
+    public void setWithIndex(boolean withIndex)
+    {
+        this.withIndex = withIndex;
+    }
+
+    public Log getLogger()
+    {
+        return logger;
+    }
+}
+
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java
new file mode 100644
index 0000000..a2f58c0
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/GeneralDgnConvertOraSDOJobContext.java
@@ -0,0 +1,522 @@
+package com.ximple.eofms.jobs.context.orasdo;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
+import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.geotools.data.DataStore;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.Transaction;
+import org.geotools.feature.Feature;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.FeatureTypeBuilder;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.geotools.feature.SimpleFeature;
+
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import com.ximple.eofms.util.DefaultColorTable;
+import com.ximple.eofms.util.FeatureTypeBuilderUtil;
+import com.ximple.eofms.util.TWD97GeometryConverterDecorator;
+import com.ximple.io.dgn7.ArcElement;
+import com.ximple.io.dgn7.ComplexChainElement;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.EllipseElement;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.LineElement;
+import com.ximple.io.dgn7.LineStringElement;
+import com.ximple.io.dgn7.ShapeElement;
+import com.ximple.io.dgn7.TextElement;
+import com.ximple.io.dgn7.TextNodeElement;
+import com.ximple.io.dgn7.UserAttributeData;
+
+public class GeneralDgnConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext
+{
+    static final Log logger = LogFactory.getLog(GeneralDgnConvertOraSDOJobContext.class);
+    static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
+    static final GeometryFactory geometryFactory = new GeometryFactory();
+
+    private String dataOut = null;
+
+    private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+
+    private PessimisticMapWrapper txFeaturesContext;
+    private TreeMap<String, FeatureTypeBuilder> typeBuilders = new TreeMap<String, FeatureTypeBuilder>();
+    private TreeMap<String, FeatureType> featureTypes = new TreeMap<String, FeatureType>();
+
+    private TWD97GeometryConverterDecorator convertDecorator = null;
+    private String featureBaseName = null;
+    private boolean withIndex = false;
+
+    public GeneralDgnConvertOraSDOJobContext(String dataPath, DataStore targetDataStore)
+    {
+        super(dataPath, targetDataStore);
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+        convertDecorator = new TWD97GeometryConverterDecorator();
+    }
+
+    public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException
+    {
+        FeatureType ft = lookupFeatureType(element);
+        if (ft != null)
+        {
+            Feature feature = createFeature(ft, element);
+            if (feature == null)
+            {
+                if (element instanceof TextElement)
+                    logger.info("cannot craete feature." + element.toString() + "'" +
+                            ((TextElement) element).getText() + "'");
+                else if (element instanceof ShapeElement)
+                    logger.info("cannot craete feature." + element.toString() + "'" +
+                            ((ShapeElement) element).getVerticeSize() + "'" +
+                            ((ShapeElement) element).getStartPoint());
+                else if (element instanceof LineStringElement)
+                    logger.info("cannot craete feature." + element.toString() + "'" +
+                            ((LineStringElement) element).getVerticeSize() + "'" +
+                            ((LineStringElement) element).getStartPoint());
+                else if (element instanceof ArcElement)
+                    logger.info("cannot craete feature." + element.toString() + "'" +
+                            ((ArcElement) element).getOrigin().toString() + "'" +
+                            ((ArcElement) element).getRotationAngle());
+
+                return;
+            }
+
+            if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+            {
+                txFeaturesContext.put(feature.getFeatureType(), new ArrayList<Feature>());
+            }
+            ArrayList<Feature> arrayList = (ArrayList<Feature>) txFeaturesContext.get(feature.getFeatureType());
+            arrayList.add(feature);
+        } else
+        {
+            logger.info("Unknown Element :" + element.getType() + ", lv=" + element.getLevelIndex());
+        }
+    }
+
+    public void startTransaction()
+    {
+    }
+
+    public void commitTransaction()
+    {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    public void rollbackTransaction()
+    {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                logger.debug("Begin Save into OracleSDO:" + featureType.getTypeName());
+
+                FeatureWriter writer;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    if (targetDataStore.getSchema(featureType.getTypeName()) != null)
+                    {
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList<Feature> features = featuresContext.get(featureType);
+                Iterator itFeature = features.iterator();
+                while (itFeature.hasNext())
+                {
+                    Feature feature = (Feature) itFeature.next();
+                    ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save into OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    public FeatureType createPointFeatureElement(String featureName) throws SchemaException
+    {
+        if (!typeBuilders.containsKey(featureName))
+        {
+            FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalPointFeatureTypeBuilder(featureName);
+            typeBuilders.put(featureName, typeBuilder);
+        }
+        return typeBuilders.get(featureName).getFeatureType();
+    }
+
+    public FeatureType createLineFeatureElement(String featureName) throws SchemaException
+    {
+        if (!typeBuilders.containsKey(featureName))
+        {
+            FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalLineFeatureTypeBuilder(featureName);
+            typeBuilders.put(featureName, typeBuilder);
+        }
+        return typeBuilders.get(featureName).getFeatureType();
+    }
+
+    public FeatureType createArcFeatureElement(String featureName) throws SchemaException
+    {
+        if (!typeBuilders.containsKey(featureName))
+        {
+            FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalArcFeatureTypeBuilder(featureName);
+            typeBuilders.put(featureName, typeBuilder);
+        }
+        return typeBuilders.get(featureName).getFeatureType();
+    }
+
+    public FeatureType createEllipseFeatureElement(String featureName) throws SchemaException
+    {
+        if (!typeBuilders.containsKey(featureName))
+        {
+            FeatureTypeBuilder typeBuilder = FeatureTypeBuilderUtil.createNormalEllipseFeatureTypeBuilder(featureName);
+            typeBuilders.put(featureName, typeBuilder);
+        }
+        return typeBuilders.get(featureName).getFeatureType();
+    }
+
+    public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException
+    {
+        DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance();
+        if (element instanceof TextElement)
+        {
+            TextElement textElement = (TextElement) element;
+            convertDecorator.setConverter(textElement);
+
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            double angle = textElement.getRotationAngle();
+            String content = textElement.getText();
+            angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue();
+            if (geom != null)
+            {
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(textElement.getColorIndex()),
+                        textElement.getFontIndex(),
+                        textElement.getJustification(),
+                        textElement.getTextHeight(),
+                        textElement.getTextWidth(),
+                        angle,
+                        content
+                });
+            } else
+            {
+                logger.info("geometry is null." + element.toString());
+            }
+            return null;
+        } else if (element instanceof TextNodeElement)
+        {
+            TextNodeElement textNodeElement = (TextNodeElement) element;
+            convertDecorator.setConverter(textNodeElement);
+
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            double angle = textNodeElement.getRotationAngle();
+            angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue();
+            String[] texts = textNodeElement.getTextArray();
+            StringBuffer sb = new StringBuffer();
+            for (String text : texts)
+            {
+                if (sb.length() != 0)
+                    sb.append("\n");
+                sb.append(text);
+            }
+
+            if (geom != null)
+            {
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(textNodeElement.getColorIndex()),
+                        textNodeElement.getFontIndex(),
+                        textNodeElement.getJustification(),
+                        textNodeElement.getTextNodeHeight(),
+                        textNodeElement.getTextNodeLength(),
+                        angle,
+                        sb.toString()
+                });
+            } else
+            {
+                logger.info("geometry is null." + element.toString());
+            }
+            return null;
+        } else if (element instanceof ShapeElement)
+        {
+            ShapeElement shapeElement = (ShapeElement) element;
+            convertDecorator.setConverter(shapeElement);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+            {
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(shapeElement.getColorIndex()),
+                        shapeElement.getWeight(),
+                        shapeElement.getLineStyle()
+                });
+            } else
+            {
+                logger.info("geometry is null." + element.toString());
+            }
+            return null;
+        } else if (element instanceof LineStringElement)
+        {
+            LineStringElement linestring = (LineStringElement) element;
+            convertDecorator.setConverter(linestring);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(linestring.getColorIndex()),
+                        linestring.getWeight(),
+                        linestring.getLineStyle()
+                });
+            return null;
+        } else if (element instanceof LineElement)
+        {
+            LineElement line = (LineElement) element;
+            convertDecorator.setConverter(line);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(line.getColorIndex()),
+                        line.getWeight(),
+                        line.getLineStyle()
+                });
+            return null;
+        } else if (element instanceof ArcElement)
+        {
+            ArcElement arcElement = (ArcElement) element;
+            /*
+            logger.fatal("" + arcElement.getPrimary() + ":" + arcElement.getSecondary() +
+                    "-" + arcElement.getStartAngle() + ":" + arcElement.getSweepAngle() + ":" +
+            arcElement.getRotationAngle() + ":" + arcElement.getOrigin());
+            */
+            convertDecorator.setConverter(arcElement);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(arcElement.getColorIndex()),
+                        arcElement.getWeight(),
+                        arcElement.getLineStyle()
+                });
+            return null;
+        } else if (element instanceof EllipseElement)
+        {
+            EllipseElement arcElement = (EllipseElement) element;
+            convertDecorator.setConverter(arcElement);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(arcElement.getColorIndex()),
+                        arcElement.getWeight(),
+                        arcElement.getLineStyle()
+                });
+            return null;
+        } else if (element instanceof ComplexChainElement)
+        {
+            ComplexChainElement complexChainElement = (ComplexChainElement) element;
+            convertDecorator.setConverter(complexChainElement);
+            Geometry geom = convertDecorator.toGeometry(geometryFactory);
+            if (geom != null)
+                return featureType.create(new Object[]{
+                        geom,
+                        colorTable.getColorCode(complexChainElement.getColorIndex()),
+                        complexChainElement.getWeight(),
+                        complexChainElement.getLineStyle()
+                });
+            return null;
+        }
+        return null;
+    }
+
+    private String getFeatureBaseName()
+    {
+        if (featureBaseName == null)
+        {
+            String dgnname = getFilename().toLowerCase();
+            int i = dgnname.lastIndexOf(".");
+            if (i != -1)
+            {
+                dgnname = dgnname.substring(0, i);
+            }
+            featureBaseName = dgnname;
+        }
+        return featureBaseName;
+    }
+
+    private FeatureType lookupFeatureType(Element element) throws SchemaException, IllegalAttributeException
+    {
+        String typeName;
+        if (element instanceof TextElement)
+        {
+            typeName = getFeatureBaseName() + "P";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createPointFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof TextNodeElement)
+        {
+            typeName = getFeatureBaseName() + "P";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createPointFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof LineStringElement)
+        {
+            if (element instanceof ShapeElement)
+            {
+                typeName = getFeatureBaseName() + "R";
+                if (!featureTypes.containsKey(typeName))
+                {
+                    featureTypes.put(typeName, createLineFeatureElement(typeName));
+                }
+                return featureTypes.get(typeName);
+            } else
+            {
+                typeName = getFeatureBaseName() + "L";
+                if (!featureTypes.containsKey(typeName))
+                {
+                    featureTypes.put(typeName, createLineFeatureElement(typeName));
+                }
+                return featureTypes.get(typeName);
+            }
+        } else if (element instanceof LineElement)
+        {
+            typeName = getFeatureBaseName() + "L";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createLineFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof ComplexChainElement)
+        {
+            typeName = getFeatureBaseName() + "L";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createLineFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof ArcElement)
+        {
+            typeName = getFeatureBaseName() + "A";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createArcFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        } else if (element instanceof EllipseElement)
+        {
+            typeName = getFeatureBaseName() + "R";
+            if (!featureTypes.containsKey(typeName))
+            {
+                featureTypes.put(typeName, createEllipseFeatureElement(typeName));
+            }
+            return featureTypes.get(typeName);
+        }
+
+        return null;
+    }
+
+    protected FrammeAttributeData getFeatureLinkage(Element element)
+    {
+        if (!element.hasUserAttributeData())
+            return null;
+
+        List<UserAttributeData> usrDatas = element.getUserAttributeData();
+        for (UserAttributeData anUsrData : usrDatas)
+        {
+            if (anUsrData instanceof FrammeAttributeData)
+            {
+                return (FrammeAttributeData) anUsrData;
+            }
+        }
+        return null;
+    }
+
+
+    public boolean isWithIndex()
+    {
+        return withIndex;
+    }
+
+    public void setWithIndex(boolean withIndex)
+    {
+        this.withIndex = withIndex;
+    }
+
+    public Log getLogger()
+    {
+        return logger;
+    }
+}
+
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java
new file mode 100644
index 0000000..5e72094
--- /dev/null
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/IndexDgnConvertOraSDOJobContext.java
@@ -0,0 +1,320 @@
+package com.ximple.eofms.jobs.context.orasdo;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
+import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.geotools.data.DataStore;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.Transaction;
+import org.geotools.feature.Feature;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.FeatureTypeBuilder;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SchemaException;
+import org.geotools.feature.SimpleFeature;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+
+import com.ximple.eofms.util.DefaultColorTable;
+import com.ximple.eofms.util.FeatureTypeBuilderUtil;
+import com.ximple.eofms.util.TPCLIDConverter;
+import com.ximple.eofms.util.TWD97GeometryConverterDecorator;
+import com.ximple.eofms.util.TWDDatumConverter;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+import com.ximple.io.dgn7.TextElement;
+import com.ximple.io.dgn7.UserAttributeData;
+
+public class IndexDgnConvertOraSDOJobContext extends AbstractDgnToOraSDOJobContext
+{
+    static final Log logger = LogFactory.getLog(IndexDgnConvertOraSDOJobContext.class);
+    static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
+    static final GeometryFactory geometryFactory = new GeometryFactory();
+    TWD97GeometryConverterDecorator convertDecorator = new TWD97GeometryConverterDecorator();
+
+    private HashMap<String, ArrayList<Feature>> featuresContext = new HashMap<String, ArrayList<Feature>>();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+
+    private PessimisticMapWrapper txFeaturesContext;
+    private FeatureTypeBuilder typeBuilderPnt = null;
+    private FeatureTypeBuilder typeBuilderRect = null;
+    private FeatureType featureType = null;
+    private FeatureType featureType2 = null;
+
+    public IndexDgnConvertOraSDOJobContext(String dataPath, DataStore targetDataStore)
+    {
+        super(dataPath, targetDataStore);
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+    }
+
+    public void putFeatureCollection(Element element) throws IllegalAttributeException, SchemaException
+    {
+        if (!(element instanceof TextElement))
+        {
+            return;
+        }
+
+        Feature feature = createFeature((TextElement) element);
+        if (feature == null)
+        {
+            logger.info("cannot craete feature." + element.toString() + "'" +
+                    ((TextElement) element).getText() + "'");
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        ArrayList arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+
+        feature = createFeature2((TextElement) element);
+        if (feature == null)
+        {
+            logger.info("cannot craete feature2." + element.toString() + "'" +
+                    ((TextElement) element).getText() + "'");
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+    }
+
+    public void startTransaction()
+    {
+    }
+
+    public void commitTransaction()
+    {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    public void rollbackTransaction()
+    {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                logger.debug("Begin Save OracleSDO:" + featureType.getTypeName());
+
+                FeatureWriter writer;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    if (targetDataStore.getSchema(featureType.getTypeName()) == null)
+                    {
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(), Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList<Feature> features = featuresContext.get(featureType);
+                for (Feature feature1 : features)
+                {
+                    ((SimpleFeature) writer.next()).setAttributes(feature1.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    public FeatureType createFeatureElement(String featureName) throws SchemaException
+    {
+        if (typeBuilderRect == null)
+        {
+            typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexFeatureTypeBuilder(featureName);
+        }
+        return typeBuilderRect.getFeatureType();
+    }
+
+    public FeatureType createFeatureElement2(String featureName) throws SchemaException
+    {
+        if (typeBuilderPnt == null)
+        {
+            typeBuilderRect = FeatureTypeBuilderUtil.createNormalIndexTextFeatureTypeBuilder(featureName);
+        }
+        return typeBuilderPnt.getFeatureType();
+    }
+
+    public Feature createFeature(FeatureType featureType, Element element) throws IllegalAttributeException
+    {
+        DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance();
+        if (element instanceof TextElement)
+        {
+            TextElement textElement = (TextElement) element;
+            String tpclid = textElement.getText();
+
+            Envelope extent = TPCLIDConverter.convertTpclIdToEnvelope(tpclid);
+            Geometry geom = geometryFactory.createLinearRing(new Coordinate[]
+                    {
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMinX(), extent.getMinY())),
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMaxX(), extent.getMinY())),
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMaxX(), extent.getMaxY())),
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMinX(), extent.getMaxY())),
+                            TWDDatumConverter.fromTM2ToTWD97(new Coordinate(extent.getMinX(), extent.getMinY())),
+                    });
+
+            return featureType.create(new Object[]{
+                    geom,
+                    extent.getMinX(),
+                    extent.getMinY(),
+                    extent.getMaxX(),
+                    extent.getMaxY(),
+                    tpclid,
+                    colorTable.getColorCode(textElement.getColorIndex()),
+                    textElement.getWeight(),
+                    textElement.getLineStyle()
+            });
+        }
+        return null;
+    }
+
+    public Feature createFeature2(FeatureType featureType, Element element) throws IllegalAttributeException
+    {
+        DefaultColorTable colorTable = (DefaultColorTable) DefaultColorTable.getInstance();
+        if (element instanceof TextElement)
+        {
+            TextElement txtElement = (TextElement) element;
+            double angle = txtElement.getRotationAngle();
+            angle = BigDecimal.valueOf(angle).setScale(3, RoundingMode.HALF_UP).doubleValue();
+            convertDecorator.setConverter(txtElement);
+            Feature feature = featureType.create(new Object[]{
+                    convertDecorator.toGeometry(geometryFactory),
+                    colorTable.getColorCode(txtElement.getColorIndex()),
+                    txtElement.getWeight(),
+                    txtElement.getLineStyle(),
+                    txtElement.getJustification(),
+                    txtElement.getTextHeight(),
+                    txtElement.getTextWidth(),
+                    angle,
+                    txtElement.getText()
+            });
+            return feature;
+        }
+        return null;
+    }
+
+    private Feature createFeature(TextElement element) throws SchemaException, IllegalAttributeException
+    {
+        if (featureType == null)
+        {
+            String dgnname = getFilename().toLowerCase();
+            int i = dgnname.lastIndexOf(".");
+            if (i != -1)
+            {
+                dgnname = dgnname.substring(0, i);
+            }
+            featureType = createFeatureElement(dgnname);
+        }
+        return createFeature(featureType, element);
+    }
+
+    private Feature createFeature2(TextElement element) throws SchemaException, IllegalAttributeException
+    {
+        if (featureType2 == null)
+        {
+            String dgnname = getFilename().toLowerCase();
+            int i = dgnname.lastIndexOf(".");
+            if (i != -1)
+            {
+                dgnname = dgnname.substring(0, i);
+            }
+            dgnname = dgnname + "P";
+            featureType2 = createFeatureElement2(dgnname);
+        }
+        return createFeature2(featureType2, element);
+    }
+
+    protected FrammeAttributeData getFeatureLinkage(Element element)
+    {
+        if (!element.hasUserAttributeData())
+            return null;
+
+        List<UserAttributeData> usrDatas = element.getUserAttributeData();
+        for (UserAttributeData anUsrData : usrDatas)
+        {
+            if (anUsrData instanceof FrammeAttributeData)
+            {
+                return (FrammeAttributeData) anUsrData;
+            }
+        }
+        return null;
+    }
+
+    public Log getLogger()
+    {
+        return logger;
+    }
+}
+
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java
index b027a76..e34ef0b 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/orasdo/OracleConvertOraSDOJobContext.java
@@ -1,27 +1,315 @@
 package com.ximple.eofms.jobs.context.orasdo;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.xmlrules.DigesterLoader;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.commons.transaction.util.LoggerFacade;
+import org.apache.commons.transaction.memory.PessimisticMapWrapper;
 import org.apache.commons.transaction.util.CommonsLoggingLogger;
+import org.apache.commons.transaction.util.LoggerFacade;
+import org.geotools.data.DataStore;
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.Transaction;
+import org.geotools.data.oracle.OracleDataStoreFactory;
+import org.geotools.feature.Feature;
+import org.geotools.feature.FeatureType;
+import org.geotools.feature.IllegalAttributeException;
+import org.geotools.feature.SimpleFeature;
+import org.quartz.JobExecutionContext;
+import org.xml.sax.SAXException;
 
-import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
+import com.vividsolutions.jts.util.Assert;
 
-public class OracleConvertOraSDOJobContext extends AbstractOracleJobContext
+import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
+import com.ximple.eofms.filter.ElementDispatcher;
+import com.ximple.eofms.jobs.OracleElementLogger;
+import com.ximple.io.dgn7.ComplexElement;
+import com.ximple.io.dgn7.Element;
+import com.ximple.io.dgn7.FrammeAttributeData;
+
+public class OracleConvertOraSDOJobContext extends AbstractOracleToOraSDOJobContext
 {
     static Log logger = LogFactory.getLog(OracleConvertOraSDOJobContext.class);
     static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
 
+    static OracleDataStoreFactory dataStoreFactory = new OracleDataStoreFactory();
+
+    private OracleElementLogger elmLogger = null;
+
+    static
+    {
+        try
+        {
+            DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
+        } catch (SQLException e)
+        {
+            Assert.shouldNeverReachHere(e.getMessage());
+        }
+    }
+
+    private String _filterConfig;
+
+    private ElementDispatcher elementDispatcher;
+
+    private HashMap featuresContext = new HashMap();
+    private HashMap<String, FeatureWriter> featuresWriterContext = new HashMap<String, FeatureWriter>();
+    private PessimisticMapWrapper txFeaturesContext;
+
+    private JobExecutionContext executionContext;
+
+    private String currentSchema = null;
+    private String pgCurrentSchema = null;
+    private boolean schemaChanged = false;
+    // private String _convertElementIn = null;
+
+    public OracleConvertOraSDOJobContext(String dataPath, DataStore oraDS, String filterConfig)
+    {
+        super(dataPath, oraDS);
+        _filterConfig = filterConfig;
+        elementDispatcher = createElementDispatcher();
+        txFeaturesContext = new PessimisticMapWrapper(featuresContext, sLogger);
+    }
+
+    private ElementDispatcher createElementDispatcher()
+    {
+        try
+        {
+            URL rulesURL = ElementDispatcher.class.getResource("ElementDispatcherRules.xml");
+            assert rulesURL != null;
+            Digester digester = DigesterLoader.createDigester(rulesURL);
+            URL filterURL = null;
+            if (_filterConfig != null)
+            {
+                File config = new File(_filterConfig);
+                if (config.exists())
+                {
+                    filterURL = config.toURI().toURL();
+                }
+            }
+            if (filterURL == null)
+            {
+                // config = new File("conf/DefaultConvertShpFilter.xml");
+                filterURL = this.getClass().getResource("/conf/DefaultConvertShpFilter.xml");
+                // filterURL = this.getClass().getResource("/conf/ConvertShpFilterForLevel.xml");
+            }
+            assert filterURL != null;
+            return (ElementDispatcher) digester.parse(filterURL);
+        } catch (UnsupportedEncodingException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (MalformedURLException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        } catch (SAXException e)
+        {
+            logger.info(e.getMessage(), e);
+            throw new RuntimeException(e.getMessage(), e);
+        }
+    }
+
+    public void putFeatureCollection(Element element)
+    {
+        assert elementDispatcher != null;
+        // �P�_�O�_�ũM����
+        Feature feature = elementDispatcher.execute(element);
+        if (feature == null)
+        {
+            boolean isEmptySize = false;
+            FrammeAttributeData linkage =
+                    AbstractFLinkageDispatchableFilter.getFeatureLinkage(element);
+            logger.warn("Unknown Element:" + element.getElementType().toString() +
+                    ":type=" + element.getType() + ":lv=" + element.getLevelIndex() + ":id=" +
+                    (linkage == null ? "NULL" : (linkage.getFsc() + "|" + linkage.getComponentID())));
+
+            if (element instanceof ComplexElement)
+            {
+                ComplexElement complex = (ComplexElement) element;
+                logger.warn("----Complex Element size=" + complex.size() + ":" +
+                        (linkage == null ? "NULL" : (linkage.getUfid())));
+                isEmptySize = true;
+            }
+
+            if (getElementLogging() && (!isEmptySize))
+            {
+                getElementLogger().logElement(element, getCurrentSchema());
+            }
+            return;
+        }
+
+        if (!txFeaturesContext.containsKey(feature.getFeatureType()))
+        {
+            txFeaturesContext.put(feature.getFeatureType(), new ArrayList());
+        }
+        ArrayList arrayList = (ArrayList) txFeaturesContext.get(feature.getFeatureType());
+        arrayList.add(feature);
+    }
+
     public void startTransaction()
     {
+        //txFeaturesContext.startTransaction();
     }
 
     public void commitTransaction()
     {
+        if (!txFeaturesContext.isEmpty())
+        {
+            logger.debug("Transaction size = " + txFeaturesContext.size());
+            //txFeaturesContext.commitTransaction();
+        } else
+        {
+            logger.debug("Transaction is empty.");
+        }
+
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+
+        if (this.getElementLogger() != null)
+            this.getElementLogger().flashLogging();
     }
 
     public void rollbackTransaction()
     {
+        //txFeaturesContext.rollbackTransaction();
+        if (!featuresContext.isEmpty())
+        {
+            updateDataStore();
+        }
+    }
+
+    private void updateDataStore()
+    {
+        Iterator it = featuresContext.keySet().iterator();
+
+        try
+        {
+            while (it.hasNext())
+            {
+                FeatureType featureType = (FeatureType) it.next();
+                FeatureWriter writer = null;
+                if (featuresWriterContext.containsKey(featureType.getTypeName()))
+                {
+                    writer = featuresWriterContext.get(featureType.getTypeName());
+                } else
+                {
+                    DataStore postGisDataStore = null;
+                    postGisDataStore = dataStoreFactory.createDataStore(properties);
+
+                    boolean existTable = isExistFeature(featureType);
+
+                    if (!existTable)
+                    {
+                        postGisDataStore.createSchema(featureType);
+                        writer = postGisDataStore.getFeatureWriter(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = postGisDataStore.getFeatureWriterAppend(featureType.getTypeName(),
+                                Transaction.AUTO_COMMIT);
+                    }
+                    featuresWriterContext.put(featureType.getTypeName(), writer);
+                }
+
+                ArrayList features = (ArrayList) featuresContext.get(featureType);
+                Iterator itFeature = features.iterator();
+                while (itFeature.hasNext())
+                {
+                    Feature feature = (Feature) itFeature.next();
+                    ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
+                }
+                //writer.close();
+                logger.debug("End Save OracleSDO:" + featureType.getTypeName());
+            }
+            featuresContext.clear();
+        } catch (MalformedURLException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IllegalAttributeException e)
+        {
+            logger.error(e.getMessage(), e);
+        } catch (IOException e)
+        {
+            logger.error(e.getMessage(), e);
+        }
+
+    }
+
+    private boolean isExistFeature(FeatureType featureType)
+    {
+        try
+        {
+            FeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName());
+            return existFeatureType != null && existFeatureType.equals(featureType);
+        } catch (IOException e)
+        {
+            logger.info(e.getMessage(), e);
+            return false;
+        }
+    }
+
+    public JobExecutionContext getExecutionContext()
+    {
+        return executionContext;
+    }
+
+    public void setExecutionContext(JobExecutionContext context)
+    {
+        executionContext = context;
+    }
+
+    /**
+     * �����]�Ƽg�J��
+     *
+     * @throws IOException IO�o�Ϳ��~
+     */
+    public void closeFeatureWriter() throws IOException
+    {
+
+        for (FeatureWriter featureWriter : this.featuresWriterContext.values())
+        {
+            featureWriter.close();
+        }
+
+        this.featuresWriterContext.clear();
+    }
+
+    protected OracleElementLogger getElementLogger()
+    {
+        if (elmLogger == null)
+        {
+            elmLogger = new OracleElementLogger(getOracleConnection());
+            elmLogger.setDataPath(this.getDataPath());
+        }
+        return elmLogger;
+    }
+
+    public String getCurrentSchema()
+    {
+        return currentSchema;
+    }
+
+    public void setCurrentSchema(String querySchema)
+    {
+        this.currentSchema = querySchema;
+        this.schemaChanged = true;
     }
 
     protected Log getLogger()
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java
index 3b09bcc..9878e8e 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractDgnToPostGISJobContext.java
@@ -1,14 +1,13 @@
 package com.ximple.eofms.jobs.context.postgis;
 
-import java.util.Map;
-import java.sql.Connection;
 import java.io.IOException;
+import java.sql.Connection;
+
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.geotools.data.postgis.PostgisDataStore;
 
 import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext;
-
-import org.geotools.data.postgis.PostgisDataStore;
-import org.geotools.data.Transaction;
-import org.geotools.data.DataStore;
 
 public abstract class AbstractDgnToPostGISJobContext extends AbstractDgnFileJobContext
 {
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java
index e36a820..68c5c3e 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/AbstractOracleToPostGISJobContext.java
@@ -1,13 +1,13 @@
 package com.ximple.eofms.jobs.context.postgis;
 
-import java.sql.Connection;
 import java.io.IOException;
+import java.sql.Connection;
+
+import org.geotools.data.DataStore;
+import org.geotools.data.Transaction;
+import org.geotools.data.postgis.PostgisDataStore;
 
 import com.ximple.eofms.jobs.context.AbstractOracleJobContext;
-
-import org.geotools.data.postgis.PostgisDataStore;
-import org.geotools.data.Transaction;
-import org.geotools.data.DataStore;
 
 public abstract class AbstractOracleToPostGISJobContext extends AbstractOracleJobContext
 {
@@ -18,7 +18,8 @@
         if ((targetDataStore != null) && (targetDataStore instanceof PostgisDataStore))
         {
             this.targetDataStore = (PostgisDataStore) targetDataStore;
-        } else {
+        } else
+        {
             getLogger().info("targetDataStore has wrong.");
         }
         setDataPath(dataPath);
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java
index bf42829..12332b6 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/DummyFeatureConvertPostGISJobContext.java
@@ -5,12 +5,10 @@
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.digester.Digester;
 import org.apache.commons.digester.xmlrules.DigesterLoader;
@@ -19,12 +17,9 @@
 import org.apache.commons.transaction.memory.PessimisticMapWrapper;
 import org.apache.commons.transaction.util.CommonsLoggingLogger;
 import org.apache.commons.transaction.util.LoggerFacade;
+import org.geotools.data.DataStore;
 import org.geotools.data.FeatureWriter;
 import org.geotools.data.Transaction;
-import org.geotools.data.DataStore;
-import org.geotools.data.postgis.PostgisDataStore;
-import org.geotools.data.shapefile.ShapefileDataStore;
-import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore;
 import org.geotools.feature.Feature;
 import org.geotools.feature.FeatureType;
 import org.geotools.feature.IllegalAttributeException;
@@ -203,8 +198,7 @@
             while (it.hasNext())
             {
                 FeatureType featureType = (FeatureType) it.next();
-                File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName());
-                logger.debug("Begin Save shapefile:" + sfile.toURI());
+                logger.debug("Begin Save PostGIS:" + featureType.getTypeName());
 
                 FeatureWriter writer;
                 if (featuresWriterContext.containsKey(featureType.getTypeName()))
@@ -212,28 +206,13 @@
                     writer = featuresWriterContext.get(featureType.getTypeName());
                 } else
                 {
-                    ShapefileDataStore shapefileDataStore = null;
-                    boolean existFile = sfile.exists();
-
-                    if (!withIndex)
+                    if (targetDataStore.getSchema(featureType.getTypeName()) == null)
                     {
-                        shapefileDataStore = new ShapefileDataStore(sfile.toURI().toURL(),
-                                true, Charset.forName("UTF-8"));
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT);
                     } else
                     {
-                        shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(),
-                                null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8"));
-                    }
-
-                    if (!existFile)
-                    {
-                        shapefileDataStore.createSchema(featureType);
-                        writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(),
-                                Transaction.AUTO_COMMIT);
-                    } else
-                    {
-                        writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(),
-                                Transaction.AUTO_COMMIT);
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(), Transaction.AUTO_COMMIT);
                     }
                     featuresWriterContext.put(featureType.getTypeName(), writer);
                 }
@@ -246,7 +225,7 @@
                     ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
                 }
                 //writer.close();
-                logger.debug("End Save shapefile:" + sfile.toURI());
+                logger.debug("End Save PostGIS:" + featureType.getTypeName());
             }
             featuresContext.clear();
         } catch (MalformedURLException e)
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java
index 3f55622..b6426a8 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/FeatureDgnConvertPostGISJobContext.java
@@ -5,12 +5,10 @@
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.digester.Digester;
 import org.apache.commons.digester.xmlrules.DigesterLoader;
@@ -19,11 +17,9 @@
 import org.apache.commons.transaction.memory.PessimisticMapWrapper;
 import org.apache.commons.transaction.util.CommonsLoggingLogger;
 import org.apache.commons.transaction.util.LoggerFacade;
+import org.geotools.data.DataStore;
 import org.geotools.data.FeatureWriter;
 import org.geotools.data.Transaction;
-import org.geotools.data.DataStore;
-import org.geotools.data.shapefile.ShapefileDataStore;
-import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore;
 import org.geotools.feature.Feature;
 import org.geotools.feature.FeatureType;
 import org.geotools.feature.IllegalAttributeException;
@@ -35,7 +31,6 @@
 
 import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
 import com.ximple.eofms.filter.ElementDispatcher;
-import com.ximple.eofms.jobs.context.shapefile.FeatureDgnConvertShpJobContext;
 import com.ximple.io.dgn7.ComplexElement;
 import com.ximple.io.dgn7.Element;
 import com.ximple.io.dgn7.FrammeAttributeData;
@@ -43,10 +38,9 @@
 
 public class FeatureDgnConvertPostGISJobContext extends AbstractDgnToPostGISJobContext
 {
-    static final Log logger = LogFactory.getLog(FeatureDgnConvertShpJobContext.class);
+    static final Log logger = LogFactory.getLog(FeatureDgnConvertPostGISJobContext.class);
     static final LoggerFacade sLogger = new CommonsLoggingLogger(logger);
     static final GeometryFactory geometryFactory = new GeometryFactory();
-    static final String SHPOUTPATH = "shpout";
 
     private String dataOut = null;
 
@@ -185,8 +179,7 @@
             while (it.hasNext())
             {
                 FeatureType featureType = (FeatureType) it.next();
-                File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName());
-                logger.debug("Begin Save shapefile:" + sfile.toURI());
+                logger.debug("Begin Save PostGIS:" + featureType.getTypeName());
 
                 FeatureWriter writer;
                 if (featuresWriterContext.containsKey(featureType.getTypeName()))
@@ -194,27 +187,14 @@
                     writer = featuresWriterContext.get(featureType.getTypeName());
                 } else
                 {
-                    ShapefileDataStore shapefileDataStore = null;
-                    boolean existFile = sfile.exists();
-
-                    if (!withIndex)
+                    if (targetDataStore.getSchema(featureType.getTypeName()) == null)
                     {
-                        shapefileDataStore = new ShapefileDataStore(sfile.toURI().toURL(),
-                                true, Charset.forName("UTF-8"));
-                    } else
-                    {
-                        shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(),
-                                null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8"));
-                    }
-
-                    if (!existFile)
-                    {
-                        shapefileDataStore.createSchema(featureType);
-                        writer = shapefileDataStore.getFeatureWriter(featureType.getTypeName(),
+                        targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(),
                                 Transaction.AUTO_COMMIT);
                     } else
                     {
-                        writer = shapefileDataStore.getFeatureWriterAppend(featureType.getTypeName(),
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(),
                                 Transaction.AUTO_COMMIT);
                     }
                     featuresWriterContext.put(featureType.getTypeName(), writer);
@@ -228,7 +208,7 @@
                     ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
                 }
                 //writer.close();
-                logger.debug("End Save shapefile:" + sfile.toURI());
+                logger.debug("End Save PostGIS:" + featureType.getTypeName());
             }
             featuresContext.clear();
         } catch (MalformedURLException e)
@@ -241,23 +221,6 @@
         {
             logger.error(e.getMessage(), e);
         }
-    }
-
-    public String getDataOutPath()
-    {
-        if (dataOut == null)
-        {
-            File outPath = new File(getDataPath(), SHPOUTPATH);
-            if (!outPath.exists())
-            {
-                outPath.mkdir();
-            } else if (!outPath.isDirectory())
-            {
-                outPath.mkdir();
-            }
-            dataOut = outPath.toString();
-        }
-        return dataOut;
     }
 
     public void closeFeatureWriter() throws IOException
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java
index cf2e377..f7b8580 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/GeneralDgnConvertPostGISJobContext.java
@@ -1,16 +1,13 @@
 package com.ximple.eofms.jobs.context.postgis;
 
-import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.MalformedURLException;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 import java.util.TreeMap;
 
 import org.apache.commons.logging.Log;
@@ -18,11 +15,9 @@
 import org.apache.commons.transaction.memory.PessimisticMapWrapper;
 import org.apache.commons.transaction.util.CommonsLoggingLogger;
 import org.apache.commons.transaction.util.LoggerFacade;
+import org.geotools.data.DataStore;
 import org.geotools.data.FeatureWriter;
 import org.geotools.data.Transaction;
-import org.geotools.data.DataStore;
-import org.geotools.data.shapefile.ShapefileDataStore;
-import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore;
 import org.geotools.feature.Feature;
 import org.geotools.feature.FeatureType;
 import org.geotools.feature.FeatureTypeBuilder;
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java
index af12c88..9a1da31 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/IndexDgnConvertPostGISJobContext.java
@@ -1,29 +1,22 @@
 package com.ximple.eofms.jobs.context.postgis;
 
-import java.io.File;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.MalformedURLException;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.commons.transaction.memory.PessimisticMapWrapper;
 import org.apache.commons.transaction.util.CommonsLoggingLogger;
 import org.apache.commons.transaction.util.LoggerFacade;
+import org.geotools.data.DataStore;
 import org.geotools.data.FeatureWriter;
 import org.geotools.data.Transaction;
-import org.geotools.data.DataStore;
-import org.geotools.data.postgis.PostgisDataStore;
-import org.geotools.data.shapefile.ShapefileDataStore;
-import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore;
-import org.geotools.feature.AttributeTypeFactory;
 import org.geotools.feature.Feature;
 import org.geotools.feature.FeatureType;
 import org.geotools.feature.FeatureTypeBuilder;
@@ -37,10 +30,10 @@
 import com.vividsolutions.jts.geom.GeometryFactory;
 
 import com.ximple.eofms.util.DefaultColorTable;
+import com.ximple.eofms.util.FeatureTypeBuilderUtil;
 import com.ximple.eofms.util.TPCLIDConverter;
 import com.ximple.eofms.util.TWD97GeometryConverterDecorator;
 import com.ximple.eofms.util.TWDDatumConverter;
-import com.ximple.eofms.util.FeatureTypeBuilderUtil;
 import com.ximple.io.dgn7.Element;
 import com.ximple.io.dgn7.FrammeAttributeData;
 import com.ximple.io.dgn7.TextElement;
@@ -148,8 +141,7 @@
             while (it.hasNext())
             {
                 FeatureType featureType = (FeatureType) it.next();
-                File sfile = new File(getDataOutPath() + File.separator + featureType.getTypeName());
-                logger.debug("Begin Save shapefile:" + sfile.toURI());
+                logger.debug("Begin Save PostGIS:" + featureType.getTypeName());
 
                 FeatureWriter writer;
                 if (featuresWriterContext.containsKey(featureType.getTypeName()))
@@ -157,17 +149,14 @@
                     writer = featuresWriterContext.get(featureType.getTypeName());
                 } else
                 {
-                    /*
-                    ShapefileDataStore shapefileDataStore = new ShapefileDataStore(sfile.toURI().toURL(),
-                            true, Charset.forName("UTF-8"));
-                    PostgisDataStore shapefileDataStore = new IndexedShapefileDataStore(sfile.toURI().toURL(),
-                            null, true, true, IndexedShapefileDataStore.TREE_QIX, Charset.forName("UTF-8"));
-                    */
-                    if (targetDataStore.getSchema(featureType.getTypeName()) != null)
+                    if (targetDataStore.getSchema(featureType.getTypeName()) == null)
                     {
                         targetDataStore.createSchema(featureType);
+                        writer = targetDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT);
+                    } else
+                    {
+                        writer = targetDataStore.getFeatureWriterAppend(featureType.getTypeName(), Transaction.AUTO_COMMIT);
                     }
-                    writer = targetDataStore.getFeatureWriter(featureType.getTypeName(), Transaction.AUTO_COMMIT);
                     featuresWriterContext.put(featureType.getTypeName(), writer);
                 }
 
@@ -177,7 +166,7 @@
                     ((SimpleFeature) writer.next()).setAttributes(feature1.getAttributes(null));
                 }
                 //writer.close();
-                logger.debug("End Save shapefile:" + sfile.toURI());
+                logger.debug("End Save PostGIS:" + featureType.getTypeName());
             }
             featuresContext.clear();
         } catch (MalformedURLException e)
@@ -190,23 +179,6 @@
         {
             logger.error(e.getMessage(), e);
         }
-    }
-
-    public String getDataOutPath()
-    {
-        if (dataOut == null)
-        {
-            File outPath = new File(getDataPath(), SHPOUTPATH);
-            if (!outPath.exists())
-            {
-                outPath.mkdir();
-            } else if (!outPath.isDirectory())
-            {
-                outPath.mkdir();
-            }
-            dataOut = outPath.toString();
-        }
-        return dataOut;
     }
 
     public void closeFeatureWriter() throws IOException
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java
index 58708ac..c4e47cf 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/postgis/OracleConvertPostGISJobContext.java
@@ -10,7 +10,6 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
 
 import org.apache.commons.digester.Digester;
 import org.apache.commons.digester.xmlrules.DigesterLoader;
@@ -23,7 +22,6 @@
 import org.geotools.data.FeatureWriter;
 import org.geotools.data.Transaction;
 import org.geotools.data.postgis.PostgisDataStoreFactory;
-import org.geotools.data.postgis.PostgisDataStore;
 import org.geotools.feature.Feature;
 import org.geotools.feature.FeatureType;
 import org.geotools.feature.IllegalAttributeException;
@@ -70,11 +68,9 @@
 
     private JobExecutionContext executionContext;
 
-    private String dataOut = null;
     private String currentSchema = null;
     private String pgCurrentSchema = null;
     private boolean schemaChanged = false;
-    private String _convertElementIn = null;
 
     public OracleConvertPostGISJobContext(String dataPath, DataStore pgDS, String filterConfig)
     {
@@ -239,7 +235,7 @@
                     ((SimpleFeature) writer.next()).setAttributes(feature.getAttributes(null));
                 }
                 //writer.close();
-                logger.debug("End Save posgis:");
+                logger.debug("End Save PostGIS:" + featureType.getTypeName());
             }
             featuresContext.clear();
         } catch (MalformedURLException e)
@@ -257,7 +253,15 @@
 
     private boolean isExistFeature(FeatureType featureType)
     {
-        return false;
+        try
+        {
+            FeatureType existFeatureType = targetDataStore.getSchema(featureType.getTypeName());
+            return existFeatureType != null && existFeatureType.equals(featureType);
+        } catch (IOException e)
+        {
+            logger.info(e.getMessage(), e);
+            return false;
+        }
     }
 
     public JobExecutionContext getExecutionContext()
@@ -305,11 +309,6 @@
     {
         this.currentSchema = querySchema;
         this.schemaChanged = true;
-    }
-
-    public void setConvertElementIn(String convertElementIn)
-    {
-        _convertElementIn = convertElementIn;
     }
 
     protected Log getLogger()
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java
index 6e93a5e..fda158f 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/DummyFeatureConvertShpJobContext.java
@@ -37,7 +37,6 @@
 import com.ximple.eofms.filter.TypeCompIdDispatchableFilter;
 import com.ximple.eofms.filter.TypeCompLevelIdDispatchableFilter;
 import com.ximple.eofms.filter.TypeIdDispatchableFilter;
-import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext;
 import com.ximple.io.dgn7.ComplexElement;
 import com.ximple.io.dgn7.Element;
 import com.ximple.io.dgn7.FrammeAttributeData;
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java
index 57039ae..638c328 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/FeatureDgnConvertShpJobContext.java
@@ -33,7 +33,6 @@
 
 import com.ximple.eofms.filter.AbstractFLinkageDispatchableFilter;
 import com.ximple.eofms.filter.ElementDispatcher;
-import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext;
 import com.ximple.io.dgn7.ComplexElement;
 import com.ximple.io.dgn7.Element;
 import com.ximple.io.dgn7.FrammeAttributeData;
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java
index de4486b..0da1bc0 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/GeneralDgnConvertShpJobContext.java
@@ -31,7 +31,6 @@
 import com.vividsolutions.jts.geom.Geometry;
 import com.vividsolutions.jts.geom.GeometryFactory;
 
-import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext;
 import com.ximple.eofms.util.DefaultColorTable;
 import com.ximple.eofms.util.FeatureTypeBuilderUtil;
 import com.ximple.eofms.util.TWD97GeometryConverterDecorator;
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java
index cc890d2..e90fb0f 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/IndexDgnConvertShpJobContext.java
@@ -20,7 +20,6 @@
 import org.geotools.data.Transaction;
 import org.geotools.data.shapefile.ShapefileDataStore;
 import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore;
-import org.geotools.feature.AttributeTypeFactory;
 import org.geotools.feature.Feature;
 import org.geotools.feature.FeatureType;
 import org.geotools.feature.FeatureTypeBuilder;
@@ -33,12 +32,11 @@
 import com.vividsolutions.jts.geom.Geometry;
 import com.vividsolutions.jts.geom.GeometryFactory;
 
-import com.ximple.eofms.jobs.context.AbstractDgnFileJobContext;
 import com.ximple.eofms.util.DefaultColorTable;
+import com.ximple.eofms.util.FeatureTypeBuilderUtil;
 import com.ximple.eofms.util.TPCLIDConverter;
 import com.ximple.eofms.util.TWD97GeometryConverterDecorator;
 import com.ximple.eofms.util.TWDDatumConverter;
-import com.ximple.eofms.util.FeatureTypeBuilderUtil;
 import com.ximple.io.dgn7.Element;
 import com.ximple.io.dgn7.FrammeAttributeData;
 import com.ximple.io.dgn7.TextElement;
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java
index 42bcbc0..697ed62 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/context/shapefile/OracleConvertShapefilesJobContext.java
@@ -22,7 +22,6 @@
 import org.apache.commons.transaction.util.LoggerFacade;
 import org.geotools.data.FeatureWriter;
 import org.geotools.data.Transaction;
-import org.geotools.data.oracle.OracleDataStore;
 import org.geotools.data.shapefile.ShapefileDataStore;
 import org.geotools.data.shapefile.indexed.IndexedShapefileDataStore;
 import org.geotools.feature.Feature;
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ColorTableMapping.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ColorTableMapping.java
index b0e3715..a93c23e 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ColorTableMapping.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/ColorTableMapping.java
@@ -6,7 +6,10 @@
 public interface ColorTableMapping
 {
     boolean contain(Color color);
+
     List findId(Color color);
+
     Color getColor(int value);
+
     String getColorCode(int i);
 }
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/DefaultColorTable.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/DefaultColorTable.java
index b050fb0..36c1a5f 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/DefaultColorTable.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/DefaultColorTable.java
@@ -6,7 +6,7 @@
 
 public class DefaultColorTable implements ColorTableMapping
 {
-    private static DefaultColorTable _instance  = null;
+    private static DefaultColorTable _instance = null;
 
     public static ColorTableMapping getInstance()
     {
@@ -19,6 +19,7 @@
     }
 
     private ArrayList<Color> colortable = null;
+
     private DefaultColorTable()
     {
         initializeColorTable();
@@ -328,36 +329,40 @@
         return false;
     }
 
-    private static String colorToString(Color c) {
-		char[] buf = new char[7];
-		buf[0] = '#';
-		String s = Integer.toHexString(c.getRed());
-		if (s.length() == 1) {
-			buf[1] = '0';
-			buf[2] = s.charAt(0);
-		}
-		else {
-			buf[1] = s.charAt(0);
-			buf[2] = s.charAt(1);
-		}
-		s = Integer.toHexString(c.getGreen());
-		if (s.length() == 1) {
-			buf[3] = '0';
-			buf[4] = s.charAt(0);
-		}
-		else {
-			buf[3] = s.charAt(0);
-			buf[4] = s.charAt(1);
-		}
-		s = Integer.toHexString(c.getBlue());
-		if (s.length() == 1) {
-			buf[5] = '0';
-			buf[6] = s.charAt(0);
-		}
-		else {
-			buf[5] = s.charAt(0);
-			buf[6] = s.charAt(1);
-		}
-		return String.valueOf(buf);
-	}
+    private static String colorToString(Color c)
+    {
+        char[] buf = new char[7];
+        buf[0] = '#';
+        String s = Integer.toHexString(c.getRed());
+        if (s.length() == 1)
+        {
+            buf[1] = '0';
+            buf[2] = s.charAt(0);
+        } else
+        {
+            buf[1] = s.charAt(0);
+            buf[2] = s.charAt(1);
+        }
+        s = Integer.toHexString(c.getGreen());
+        if (s.length() == 1)
+        {
+            buf[3] = '0';
+            buf[4] = s.charAt(0);
+        } else
+        {
+            buf[3] = s.charAt(0);
+            buf[4] = s.charAt(1);
+        }
+        s = Integer.toHexString(c.getBlue());
+        if (s.length() == 1)
+        {
+            buf[5] = '0';
+            buf[6] = s.charAt(0);
+        } else
+        {
+            buf[5] = s.charAt(0);
+            buf[6] = s.charAt(1);
+        }
+        return String.valueOf(buf);
+    }
 }
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java
index e07bbab..7b1b7ad 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/FeatureTypeBuilderUtil.java
@@ -1,7 +1,7 @@
 package com.ximple.eofms.util;
 
-import org.geotools.feature.FeatureTypeBuilder;
 import org.geotools.feature.AttributeTypeFactory;
+import org.geotools.feature.FeatureTypeBuilder;
 
 import com.vividsolutions.jts.geom.Geometry;
 
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/GeomUtil.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/GeomUtil.java
index ebdf0d2..8cd89e4 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/GeomUtil.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/GeomUtil.java
@@ -25,6 +25,6 @@
     public static Envelope convertLogicalEnvelope(Envelope value)
     {
         return new Envelope(convertLogicalValue(value.getMinX()), convertLogicalValue(value.getMaxX()),
-                            convertLogicalValue(value.getMinY()), convertLogicalValue(value.getMaxY()));
+                convertLogicalValue(value.getMinY()), convertLogicalValue(value.getMaxY()));
     }
 }
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/PrintfFormat.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/PrintfFormat.java
index b7a6ade..8aeac8e 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/PrintfFormat.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/PrintfFormat.java
@@ -90,7 +90,7 @@
  * In format strings containing the %<code>n</code>$
  * form of conversion specifications, each argument
  * in the argument list is used exactly once.</p>
- *
+ * <p/>
  * <h4>Escape Sequences</h4>
  * <p>
  * The following table lists escape sequences and
@@ -98,40 +98,40 @@
  * the action.
  * <table>
  * <tr><th align=left>Sequence</th>
- *    <th align=left>Name</th>
- *    <th align=left>Description</th></tr>
+ * <th align=left>Name</th>
+ * <th align=left>Description</th></tr>
  * <tr><td>\\</td><td>backlash</td><td>None.
  * </td></tr>
  * <tr><td>\a</td><td>alert</td><td>Attempts to alert
- *          the user through audible or visible
- *          notification.
+ * the user through audible or visible
+ * notification.
  * </td></tr>
  * <tr><td>\b</td><td>backspace</td><td>Moves the
- *          printing position to one column before
- *          the current position, unless the
- *          current position is the start of a line.
+ * printing position to one column before
+ * the current position, unless the
+ * current position is the start of a line.
  * </td></tr>
  * <tr><td>\f</td><td>form-feed</td><td>Moves the
- *          printing position to the initial
- *          printing position of the next logical
- *          page.
+ * printing position to the initial
+ * printing position of the next logical
+ * page.
  * </td></tr>
  * <tr><td>\n</td><td>newline</td><td>Moves the
- *          printing position to the start of the
- *          next line.
+ * printing position to the start of the
+ * next line.
  * </td></tr>
  * <tr><td>\r</td><td>carriage-return</td><td>Moves
- *          the printing position to the start of
- *          the current line.
+ * the printing position to the start of
+ * the current line.
  * </td></tr>
  * <tr><td>\t</td><td>tab</td><td>Moves the printing
- *          position to the next implementation-
- *          defined horizontal tab position.
+ * position to the next implementation-
+ * defined horizontal tab position.
  * </td></tr>
  * <tr><td>\v</td><td>vertical-tab</td><td>Moves the
- *          printing position to the start of the
- *          next implementation-defined vertical
- *          tab position.
+ * printing position to the start of the
+ * next implementation-defined vertical
+ * tab position.
  * </td></tr>
  * </table></p>
  * <h4>Conversion Specifications</h4>
@@ -206,55 +206,55 @@
  * be mixed with the %<code>n</code>$ form.  The
  * results of mixing numbered and unnumbered argument
  * specifications in a format string are undefined.</p>
- *
+ * <p/>
  * <h4>Flag Characters</h4>
  * <p>
  * The flags and their meanings are:</p>
  * <dl>
  * <dt>'<dd> integer portion of the result of a
- *      decimal conversion (%i, %d, %f, %g, or %G) will
- *      be formatted with thousands' grouping
- *      characters.  For other conversions the flag
- *      is ignored.  The non-monetary grouping
- *      character is used.
+ * decimal conversion (%i, %d, %f, %g, or %G) will
+ * be formatted with thousands' grouping
+ * characters.  For other conversions the flag
+ * is ignored.  The non-monetary grouping
+ * character is used.
  * <dt>-<dd> result of the conversion is left-justified
- *      within the field.  (It will be right-justified
- *      if this flag is not specified).</td></tr>
+ * within the field.  (It will be right-justified
+ * if this flag is not specified).</td></tr>
  * <dt>+<dd> result of a signed conversion always
- *      begins with a sign (+ or -).  (It will begin
- *      with a sign only when a negative value is
- *      converted if this flag is not specified.)
+ * begins with a sign (+ or -).  (It will begin
+ * with a sign only when a negative value is
+ * converted if this flag is not specified.)
  * <dt>&lt;space&gt;<dd> If the first character of a
- *      signed conversion is not a sign, a space
- *      character will be placed before the result.
- *      This means that if the space character and +
- *      flags both appear, the space flag will be
- *      ignored.
+ * signed conversion is not a sign, a space
+ * character will be placed before the result.
+ * This means that if the space character and +
+ * flags both appear, the space flag will be
+ * ignored.
  * <dt>#<dd> value is to be converted to an alternative
- *      form.  For c, d, i, and s conversions, the flag
- *      has no effect.  For o conversion, it increases
- *      the precision to force the first digit of the
- *      result to be a zero.  For x or X conversion, a
- *      non-zero result has 0x or 0X prefixed to it,
- *      respectively.  For e, E, f, g, and G
- *      conversions, the result always contains a radix
- *      character, even if no digits follow the radix
- *      character (normally, a decimal point appears in
- *      the result of these conversions only if a digit
- *      follows it).  For g and G conversions, trailing
- *      zeros will not be removed from the result as
- *      they normally are.
+ * form.  For c, d, i, and s conversions, the flag
+ * has no effect.  For o conversion, it increases
+ * the precision to force the first digit of the
+ * result to be a zero.  For x or X conversion, a
+ * non-zero result has 0x or 0X prefixed to it,
+ * respectively.  For e, E, f, g, and G
+ * conversions, the result always contains a radix
+ * character, even if no digits follow the radix
+ * character (normally, a decimal point appears in
+ * the result of these conversions only if a digit
+ * follows it).  For g and G conversions, trailing
+ * zeros will not be removed from the result as
+ * they normally are.
  * <dt>0<dd> d, i, o, x, X, e, E, f, g, and G
- *      conversions, leading zeros (following any
- *      indication of sign or base) are used to pad to
- *      the field width;  no space padding is
- *      performed.  If the 0 and - flags both appear,
- *      the 0 flag is ignored.  For d, i, o, x, and X
- *      conversions, if a precision is specified, the
- *      0 flag will be ignored. For c conversions,
- *      the flag is ignored.
+ * conversions, leading zeros (following any
+ * indication of sign or base) are used to pad to
+ * the field width;  no space padding is
+ * performed.  If the 0 and - flags both appear,
+ * the 0 flag is ignored.  For d, i, o, x, and X
+ * conversions, if a precision is specified, the
+ * 0 flag will be ignored. For c conversions,
+ * the flag is ignored.
  * </dl>
- *
+ * <p/>
  * <h4>Conversion Characters</h4>
  * <p>
  * Each conversion character results in fetching zero
@@ -263,103 +263,103 @@
  * Usually, an unchecked exception will be thrown.
  * If the format is exhausted while arguments remain,
  * the excess arguments are ignored.</p>
- *
+ * <p/>
  * <p>
  * The conversion characters and their meanings are:
  * </p>
  * <dl>
  * <dt>d,i<dd>The int argument is converted to a
- *        signed decimal in the style [-]dddd.  The
- *        precision specifies the minimum number of
- *        digits to appear;  if the value being
- *        converted can be represented in fewer
- *        digits, it will be expanded with leading
- *        zeros.  The default precision is 1.  The
- *        result of converting 0 with an explicit
- *        precision of 0 is no characters.
+ * signed decimal in the style [-]dddd.  The
+ * precision specifies the minimum number of
+ * digits to appear;  if the value being
+ * converted can be represented in fewer
+ * digits, it will be expanded with leading
+ * zeros.  The default precision is 1.  The
+ * result of converting 0 with an explicit
+ * precision of 0 is no characters.
  * <dt>o<dd> The int argument is converted to unsigned
- *        octal format in the style ddddd.  The
- *        precision specifies the minimum number of
- *        digits to appear;  if the value being
- *        converted can be represented in fewer
- *        digits, it will be expanded with leading
- *        zeros.  The default precision is 1.  The
- *        result of converting 0 with an explicit
- *        precision of 0 is no characters.
+ * octal format in the style ddddd.  The
+ * precision specifies the minimum number of
+ * digits to appear;  if the value being
+ * converted can be represented in fewer
+ * digits, it will be expanded with leading
+ * zeros.  The default precision is 1.  The
+ * result of converting 0 with an explicit
+ * precision of 0 is no characters.
  * <dt>x<dd> The int argument is converted to unsigned
- *        hexadecimal format in the style dddd;  the
- *        letters abcdef are used.  The precision
- *        specifies the minimum numberof digits to
- *        appear; if the value being converted can be
- *        represented in fewer digits, it will be
- *        expanded with leading zeros.  The default
- *        precision is 1.  The result of converting 0
- *        with an explicit precision of 0 is no
- *        characters.
+ * hexadecimal format in the style dddd;  the
+ * letters abcdef are used.  The precision
+ * specifies the minimum numberof digits to
+ * appear; if the value being converted can be
+ * represented in fewer digits, it will be
+ * expanded with leading zeros.  The default
+ * precision is 1.  The result of converting 0
+ * with an explicit precision of 0 is no
+ * characters.
  * <dt>X<dd> Behaves the same as the x conversion
- *        character except that letters ABCDEF are
- *        used instead of abcdef.
+ * character except that letters ABCDEF are
+ * used instead of abcdef.
  * <dt>f<dd> The floating point number argument is
- *        written in decimal notation in the style
- *        [-]ddd.ddd, where the number of digits after
- *        the radix character (shown here as a decimal
- *        point) is equal to the precision
- *        specification.  A Locale is used to determine
- *        the radix character to use in this format.
- *        If the precision is omitted from the
- *        argument, six digits are written after the
- *        radix character;  if the precision is
- *        explicitly 0 and the # flag is not specified,
- *        no radix character appears.  If a radix
- *        character appears, at least 1 digit appears
- *        before it.  The value is rounded to the
- *        appropriate number of digits.
+ * written in decimal notation in the style
+ * [-]ddd.ddd, where the number of digits after
+ * the radix character (shown here as a decimal
+ * point) is equal to the precision
+ * specification.  A Locale is used to determine
+ * the radix character to use in this format.
+ * If the precision is omitted from the
+ * argument, six digits are written after the
+ * radix character;  if the precision is
+ * explicitly 0 and the # flag is not specified,
+ * no radix character appears.  If a radix
+ * character appears, at least 1 digit appears
+ * before it.  The value is rounded to the
+ * appropriate number of digits.
  * <dt>e,E<dd>The floating point number argument is
- *        written in the style [-]d.ddde{+-}dd
- *        (the symbols {+-} indicate either a plus or
- *        minus sign), where there is one digit before
- *        the radix character (shown here as a decimal
- *        point) and the number of digits after it is
- *        equal to the precision.  A Locale is used to
- *        determine the radix character to use in this
- *        format.  When the precision is missing, six
- *        digits are written after the radix character;
- *        if the precision is 0 and the # flag is not
- *        specified, no radix character appears.  The
- *        E conversion will produce a number with E
- *        instead of e introducing the exponent.  The
- *        exponent always contains at least two digits.
- *        However, if the value to be written requires
- *        an exponent greater than two digits,
- *        additional exponent digits are written as
- *        necessary.  The value is rounded to the
- *        appropriate number of digits.
+ * written in the style [-]d.ddde{+-}dd
+ * (the symbols {+-} indicate either a plus or
+ * minus sign), where there is one digit before
+ * the radix character (shown here as a decimal
+ * point) and the number of digits after it is
+ * equal to the precision.  A Locale is used to
+ * determine the radix character to use in this
+ * format.  When the precision is missing, six
+ * digits are written after the radix character;
+ * if the precision is 0 and the # flag is not
+ * specified, no radix character appears.  The
+ * E conversion will produce a number with E
+ * instead of e introducing the exponent.  The
+ * exponent always contains at least two digits.
+ * However, if the value to be written requires
+ * an exponent greater than two digits,
+ * additional exponent digits are written as
+ * necessary.  The value is rounded to the
+ * appropriate number of digits.
  * <dt>g,G<dd>The floating point number argument is
- *        written in style f or e (or in sytle E in the
- *        case of a G conversion character), with the
- *        precision specifying the number of
- *        significant digits.  If the precision is
- *        zero, it is taken as one.  The style used
- *        depends on the value converted:  style e
- *        (or E) will be used only if the exponent
- *        resulting from the conversion is less than
- *        -4 or greater than or equal to the precision.
- *        Trailing zeros are removed from the result.
- *        A radix character appears only if it is
- *        followed by a digit.
+ * written in style f or e (or in sytle E in the
+ * case of a G conversion character), with the
+ * precision specifying the number of
+ * significant digits.  If the precision is
+ * zero, it is taken as one.  The style used
+ * depends on the value converted:  style e
+ * (or E) will be used only if the exponent
+ * resulting from the conversion is less than
+ * -4 or greater than or equal to the precision.
+ * Trailing zeros are removed from the result.
+ * A radix character appears only if it is
+ * followed by a digit.
  * <dt>c,C<dd>The integer argument is converted to a
- *        char and the result is written.
- *
+ * char and the result is written.
+ * <p/>
  * <dt>s,S<dd>The argument is taken to be a string and
- *        bytes from the string are written until the
- *        end of the string or the number of bytes
- *        indicated by the precision specification of
- *        the argument is reached.  If the precision
- *        is omitted from the argument, it is taken to
- *        be infinite, so all characters up to the end
- *        of the string are written.
+ * bytes from the string are written until the
+ * end of the string or the number of bytes
+ * indicated by the precision specification of
+ * the argument is reached.  If the precision
+ * is omitted from the argument, it is taken to
+ * be infinite, so all characters up to the end
+ * of the string are written.
  * <dt>%<dd>Write a % character;  no argument is
- *        converted.
+ * converted.
  * </dl>
  * <p>
  * If a conversion specification does not match one of
@@ -431,25 +431,31 @@
  *
  * @author Allan Jacobs
  * @version 1
- * Release 1: Initial release.
- * Release 2: Asterisk field widths and precisions
- *            %n$ and *m$
- *            Bug fixes
- *              g format fix (2 digits in e form corrupt)
- *              rounding in f format implemented
- *              round up when digit not printed is 5
- *              formatting of -0.0f
- *              round up/down when last digits are 50000...
+ *          Release 1: Initial release.
+ *          Release 2: Asterisk field widths and precisions
+ *          %n$ and *m$
+ *          Bug fixes
+ *          g format fix (2 digits in e form corrupt)
+ *          rounding in f format implemented
+ *          round up when digit not printed is 5
+ *          formatting of -0.0f
+ *          round up/down when last digits are 50000...
  */
 public final class PrintfFormat
 {
-    /** Vector of control strings and format literals. */
+    /**
+     * Vector of control strings and format literals.
+     */
     private Vector vFmt = new Vector();
 
-    /** Character position.  Used by the constructor. */
+    /**
+     * Character position.  Used by the constructor.
+     */
     private int cPos = 0;
 
-    /** Character position.  Used by the constructor. */
+    /**
+     * Character position.  Used by the constructor.
+     */
     private DecimalFormatSymbols dfs = null;
 
     /**
@@ -459,10 +465,11 @@
      * unpaired percent signs.  A pair of successive
      * percent signs designates a single percent sign in
      * the format.
-     * @param fmtArg  Control string.
-     * @exception IllegalArgumentException if the control
-     * string is null, zero length, or otherwise
-     * malformed.
+     *
+     * @param fmtArg Control string.
+     * @throws IllegalArgumentException if the control
+     *                                  string is null, zero length, or otherwise
+     *                                  malformed.
      */
     public PrintfFormat(String fmtArg) throws IllegalArgumentException
     {
@@ -476,18 +483,19 @@
      * unpaired percent signs.  A pair of successive
      * percent signs designates a single percent sign in
      * the format.
-     * @param fmtArg  Control string.
-     * @exception IllegalArgumentException if the control
-     * string is null, zero length, or otherwise
-     * malformed.
+     *
+     * @param fmtArg Control string.
+     * @throws IllegalArgumentException if the control
+     *                                  string is null, zero length, or otherwise
+     *                                  malformed.
      */
     public PrintfFormat(Locale locale, String fmtArg) throws IllegalArgumentException
     {
         dfs = new DecimalFormatSymbols(locale);
 
-        int                     ePos = 0;
+        int ePos = 0;
         ConversionSpecification sFmt = null;
-        String                  unCS = this.nonControl(fmtArg, 0);
+        String unCS = this.nonControl(fmtArg, 0);
 
         if (unCS != null)
         {
@@ -590,12 +598,13 @@
      * of the String <code>s</code>, the next unpaired
      * percent sign, or at the end of the String if the
      * last character is a percent sign.
-     * @param s  Control string.
+     *
+     * @param s     Control string.
      * @param start Position in the string
-     *     <code>s</code> to begin looking for the start
-     *     of a control string.
+     *              <code>s</code> to begin looking for the start
+     *              of a control string.
      * @return the substring from the start position
-     *     to the beginning of the control string.
+     *         to the beginning of the control string.
      */
     private String nonControl(String s, int start)
     {
@@ -616,21 +625,22 @@
      * Integer, Long, Float, Double, and Character
      * arguments are treated as wrappers for primitive
      * types.
+     *
      * @param o The array of objects to format.
-     * @return  The formatted String.
+     * @return The formatted String.
      */
     public String sprintf(Object[] o)
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        int                     i  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        int i = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -713,19 +723,20 @@
 
     /**
      * Format nothing.  Just use the control string.
-     * @return  the formatted String.
+     *
+     * @return the formatted String.
      */
     public String sprintf()
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -741,23 +752,24 @@
 
     /**
      * Format an int.
+     *
      * @param x The int to format.
-     * @return  The formatted String.
-     * @exception IllegalArgumentException if the
-     *     conversion character is f, e, E, g, G, s,
-     *     or S.
+     * @return The formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is f, e, E, g, G, s,
+     *                                  or S.
      */
     public String sprintf(int x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -776,23 +788,24 @@
 
     /**
      * Format an long.
+     *
      * @param x The long to format.
-     * @return  The formatted String.
-     * @exception IllegalArgumentException if the
-     *     conversion character is f, e, E, g, G, s,
-     *     or S.
+     * @return The formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is f, e, E, g, G, s,
+     *                                  or S.
      */
     public String sprintf(long x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -811,23 +824,24 @@
 
     /**
      * Format a double.
+     *
      * @param x The double to format.
-     * @return  The formatted String.
-     * @exception IllegalArgumentException if the
-     *     conversion character is c, C, s, S,
-     *     d, d, x, X, or o.
+     * @return The formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is c, C, s, S,
+     *                                  d, d, x, X, or o.
      */
     public String sprintf(double x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -846,22 +860,23 @@
 
     /**
      * Format a String.
+     *
      * @param x The String to format.
-     * @return  The formatted String.
-     * @exception IllegalArgumentException if the
-     *   conversion character is neither s nor S.
+     * @return The formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is neither s nor S.
      */
     public String sprintf(String x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -885,23 +900,24 @@
      * Strings using an internal formatting method for
      * Strings. Otherwise use the default formatter
      * (use toString).
+     *
      * @param x the Object to format.
-     * @return  the formatted String.
-     * @exception IllegalArgumentException if the
-     *    conversion character is inappropriate for
-     *    formatting an unwrapped value.
+     * @return the formatted String.
+     * @throws IllegalArgumentException if the
+     *                                  conversion character is inappropriate for
+     *                                  formatting an unwrapped value.
      */
     public String sprintf(Object x) throws IllegalArgumentException
     {
-        Enumeration             e  = vFmt.elements();
+        Enumeration e = vFmt.elements();
         ConversionSpecification cs = null;
-        char                    c  = 0;
-        StringBuffer            sb = new StringBuffer();
+        char c = 0;
+        StringBuffer sb = new StringBuffer();
 
         while (e.hasMoreElements())
         {
             cs = (ConversionSpecification) e.nextElement();
-            c  = cs.getConversionCharacter();
+            c = cs.getConversionCharacter();
 
             if (c == '\0')
             {
@@ -946,30 +962,30 @@
     }
 
     /**
-     * <p>
+     * <p/>
      * ConversionSpecification allows the formatting of
      * a single primitive or object embedded within a
      * string.  The formatting is controlled by a
      * format string.  Only one Java primitive or
      * object can be formatted at a time.
-     * <p>
+     * <p/>
      * A format string is a Java string that contains
      * a control string.  The control string starts at
      * the first percent sign (%) in the string,
      * provided that this percent sign
      * <ol>
      * <li>is not escaped protected by a matching % or
-     *     is not an escape % character,
+     * is not an escape % character,
      * <li>is not at the end of the format string, and
      * <li>precedes a sequence of characters that parses
-     *     as a valid control string.
+     * as a valid control string.
      * </ol>
-     * <p>
+     * <p/>
      * A control string takes the form:
      * <pre> % ['-+ #0]* [0..9]* { . [0..9]* }+
      *                { [hlL] }+ [idfgGoxXeEcs]
      * </pre>
-     * <p>
+     * <p/>
      * The behavior is like printf.  One (hopefully the
      * only) exception is that the minimum number of
      * exponent digits is 3 instead of 2 for e and E
@@ -980,7 +996,9 @@
      */
     private class ConversionSpecification
     {
-        /** Default precision. */
+        /**
+         * Default precision.
+         */
         private final static int defaultDigits = 6;
 
         /**
@@ -1051,7 +1069,7 @@
          * d, i, o, u, x, or X conversions.  The number of
          * digits to appear after the radix character for
          * the e, E, and f conversions.  The maximum number
-         *  of significant digits for the g and G
+         * of significant digits for the g and G
          * conversions.  The maximum number of bytes to be
          * printed from a string in s and S conversions.
          */
@@ -1070,12 +1088,12 @@
 
         /*
          */
-        private boolean positionalSpecification       = false;
-        private int     argumentPosition              = 0;
-        private boolean positionalFieldWidth          = false;
-        private int     argumentPositionForFieldWidth = 0;
-        private boolean positionalPrecision           = false;
-        private int     argumentPositionForPrecision  = 0;
+        private boolean positionalSpecification = false;
+        private int argumentPosition = 0;
+        private boolean positionalFieldWidth = false;
+        private int argumentPositionForFieldWidth = 0;
+        private boolean positionalPrecision = false;
+        private int argumentPositionForPrecision = 0;
 
         /**
          * Flag specifying that a following d, i, o, u, x,
@@ -1098,7 +1116,9 @@
          */
         private boolean optionalL = false;
 
-        /** Control string type. */
+        /**
+         * Control string type.
+         */
         private char conversionCharacter = '\0';
 
         /**
@@ -1107,7 +1127,9 @@
          */
         private int pos = 0;
 
-        /** Literal or control format string. */
+        /**
+         * Literal or control format string.
+         */
         private String fmt;
 
         /**
@@ -1123,11 +1145,12 @@
          * The argument must begin with a % and end
          * with the conversion character for the
          * conversion specification.
-         *  @param fmtArg  String specifying the
-         *     conversion specification.
-         *  @exception IllegalArgumentException if the
-         *     input string is null, zero length, or
-         *     otherwise malformed.
+         *
+         * @param fmtArg String specifying the
+         *               conversion specification.
+         * @throws IllegalArgumentException if the
+         *                                  input string is null, zero length, or
+         *                                  otherwise malformed.
          */
         ConversionSpecification(String fmtArg) throws IllegalArgumentException
         {
@@ -1163,7 +1186,7 @@
                         if (precisionSet && leadingZeros)
                         {
                             if ((conversionCharacter == 'd') || (conversionCharacter == 'i') || (conversionCharacter == 'o')
-                                || (conversionCharacter == 'x'))
+                                    || (conversionCharacter == 'x'))
                             {
                                 leadingZeros = false;
                             }
@@ -1184,6 +1207,7 @@
 
         /**
          * Set the String for this instance.
+         *
          * @param s the String to store.
          */
         void setLiteral(String s)
@@ -1200,7 +1224,7 @@
         String getLiteral()
         {
             StringBuffer sb = new StringBuffer();
-            int          i  = 0;
+            int i = 0;
 
             while (i < fmt.length())
             {
@@ -1214,42 +1238,42 @@
 
                         switch (c)
                         {
-                        case 'a' :
+                        case 'a':
                             sb.append((char) 0x07);
 
                             break;
 
-                        case 'b' :
+                        case 'b':
                             sb.append('\b');
 
                             break;
 
-                        case 'f' :
+                        case 'f':
                             sb.append('\f');
 
                             break;
 
-                        case 'n' :
+                        case 'n':
                             sb.append(System.getProperty("line.separator"));
 
                             break;
 
-                        case 'r' :
+                        case 'r':
                             sb.append('\r');
 
                             break;
 
-                        case 't' :
+                        case 't':
                             sb.append('\t');
 
                             break;
 
-                        case 'v' :
+                        case 'v':
                             sb.append((char) 0x0b);
 
                             break;
 
-                        case '\\' :
+                        case '\\':
                             sb.append('\\');
 
                             break;
@@ -1284,9 +1308,10 @@
          * Check whether the specifier has a variable
          * field width that is going to be set by an
          * argument.
+         *
          * @return <code>true</code> if the conversion
-         *   uses an * field width; otherwise
-         *   <code>false</code>.
+         *         uses an * field width; otherwise
+         *         <code>false</code>.
          */
         boolean isVariableFieldWidth()
         {
@@ -1297,6 +1322,7 @@
          * Set the field width with an argument.  A
          * negative field width is taken as a - flag
          * followed by a positive field width.
+         *
          * @param fw the field width.
          */
         void setFieldWidthWithArg(int fw)
@@ -1307,16 +1333,17 @@
             }
 
             fieldWidthSet = true;
-            fieldWidth    = Math.abs(fw);
+            fieldWidth = Math.abs(fw);
         }
 
         /**
          * Check whether the specifier has a variable
          * precision that is going to be set by an
          * argument.
+         *
          * @return <code>true</code> if the conversion
-         *   uses an * precision; otherwise
-         *   <code>false</code>.
+         *         uses an * precision; otherwise
+         *         <code>false</code>.
          */
         boolean isVariablePrecision()
         {
@@ -1326,21 +1353,23 @@
         /**
          * Set the precision with an argument.  A
          * negative precision will be changed to zero.
+         *
          * @param pr the precision.
          */
         void setPrecisionWithArg(int pr)
         {
             precisionSet = true;
-            precision    = Math.max(pr, 0);
+            precision = Math.max(pr, 0);
         }
 
         /**
          * Format an int argument using this conversion
-         *  specification.
+         * specification.
+         *
          * @param s the int to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *     conversion character is f, e, E, g, or G.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is f, e, E, g, or G.
          */
         String internalsprintf(int s) throws IllegalArgumentException
         {
@@ -1348,8 +1377,8 @@
 
             switch (conversionCharacter)
             {
-            case 'd' :
-            case 'i' :
+            case 'd':
+            case 'i':
                 if (optionalh)
                 {
                     s2 = printDFormat((short) s);
@@ -1363,8 +1392,8 @@
 
                 break;
 
-            case 'x' :
-            case 'X' :
+            case 'x':
+            case 'X':
                 if (optionalh)
                 {
                     s2 = printXFormat((short) s);
@@ -1378,7 +1407,7 @@
 
                 break;
 
-            case 'o' :
+            case 'o':
                 if (optionalh)
                 {
                     s2 = printOFormat((short) s);
@@ -1392,15 +1421,15 @@
 
                 break;
 
-            case 'c' :
-            case 'C' :
+            case 'c':
+            case 'C':
                 s2 = printCFormat((char) s);
 
                 break;
 
-            default :
+            default:
                 throw new IllegalArgumentException("Cannot format a int with a format using a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1409,10 +1438,11 @@
         /**
          * Format a long argument using this conversion
          * specification.
+         *
          * @param s the long to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *     conversion character is f, e, E, g, or G.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is f, e, E, g, or G.
          */
         String internalsprintf(long s) throws IllegalArgumentException
         {
@@ -1420,8 +1450,8 @@
 
             switch (conversionCharacter)
             {
-            case 'd' :
-            case 'i' :
+            case 'd':
+            case 'i':
                 if (optionalh)
                 {
                     s2 = printDFormat((short) s);
@@ -1435,8 +1465,8 @@
 
                 break;
 
-            case 'x' :
-            case 'X' :
+            case 'x':
+            case 'X':
                 if (optionalh)
                 {
                     s2 = printXFormat((short) s);
@@ -1450,7 +1480,7 @@
 
                 break;
 
-            case 'o' :
+            case 'o':
                 if (optionalh)
                 {
                     s2 = printOFormat((short) s);
@@ -1464,15 +1494,15 @@
 
                 break;
 
-            case 'c' :
-            case 'C' :
+            case 'c':
+            case 'C':
                 s2 = printCFormat((char) s);
 
                 break;
 
-            default :
+            default:
                 throw new IllegalArgumentException("Cannot format a long with a format using a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1481,11 +1511,12 @@
         /**
          * Format a double argument using this conversion
          * specification.
+         *
          * @param s the double to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *     conversion character is c, C, s, S, i, d,
-         *     x, X, or o.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is c, C, s, S, i, d,
+         *                                  x, X, or o.
          */
         String internalsprintf(double s) throws IllegalArgumentException
         {
@@ -1493,26 +1524,26 @@
 
             switch (conversionCharacter)
             {
-            case 'f' :
+            case 'f':
                 s2 = printFFormat(s);
 
                 break;
 
-            case 'E' :
-            case 'e' :
+            case 'E':
+            case 'e':
                 s2 = printEFormat(s);
 
                 break;
 
-            case 'G' :
-            case 'g' :
+            case 'G':
+            case 'g':
                 s2 = printGFormat(s);
 
                 break;
 
-            default :
+            default:
                 throw new IllegalArgumentException("Cannot " + "format a double with a format using a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1521,10 +1552,11 @@
         /**
          * Format a String argument using this conversion
          * specification.
+         *
          * @param s the String to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *   conversion character is neither s nor S.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is neither s nor S.
          */
         String internalsprintf(String s) throws IllegalArgumentException
         {
@@ -1536,7 +1568,7 @@
             } else
             {
                 throw new IllegalArgumentException("Cannot " + "format a String with a format using a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1545,10 +1577,11 @@
         /**
          * Format an Object argument using this conversion
          * specification.
+         *
          * @param s the Object to format.
          * @return the formatted String.
-         * @exception IllegalArgumentException if the
-         *     conversion character is neither s nor S.
+         * @throws IllegalArgumentException if the
+         *                                  conversion character is neither s nor S.
          */
         String internalsprintf(Object s)
         {
@@ -1560,7 +1593,7 @@
             } else
             {
                 throw new IllegalArgumentException("Cannot format a String with a format using" + " a " + conversionCharacter
-                                                   + " conversion character.");
+                        + " conversion character.");
             }
 
             return s2;
@@ -1578,12 +1611,12 @@
          * is ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the number of digits
          * to appear after the radix character.  Padding is
          * with trailing 0s.
@@ -1591,10 +1624,10 @@
         private char[] fFormatDigits(double x)
         {
             // int defaultDigits=6;
-            String  sx, sxOut;
-            int     i, j, k;
-            int     n1In, n2In;
-            int     expon     = 0;
+            String sx, sxOut;
+            int i, j, k;
+            int n1In, n2In;
+            int expon = 0;
             boolean minusSign = false;
 
             if (x > 0.0)
@@ -1602,7 +1635,7 @@
                 sx = Double.toString(x);
             } else if (x < 0.0)
             {
-                sx        = Double.toString(-x);
+                sx = Double.toString(-x);
                 minusSign = true;
             } else
             {
@@ -1611,7 +1644,7 @@
                 if (sx.charAt(0) == '-')
                 {
                     minusSign = true;
-                    sx        = sx.substring(1);
+                    sx = sx.substring(1);
                 }
             }
 
@@ -1761,7 +1794,7 @@
                     ca4[0] = '1';
                 }
 
-                if (alternateForm ||!precisionSet || (precision != 0))
+                if (alternateForm || !precisionSet || (precision != 0))
                 {
                     ca4[1] = '.';
 
@@ -1779,7 +1812,7 @@
             {
                 if (!carry)
                 {
-                    if (alternateForm ||!precisionSet || (precision != 0))
+                    if (alternateForm || !precisionSet || (precision != 0))
                     {
                         ca4 = new char[n1In + expon + p + 1];
                     } else
@@ -1790,7 +1823,7 @@
                     j = 0;
                 } else
                 {
-                    if (alternateForm ||!precisionSet || (precision != 0))
+                    if (alternateForm || !precisionSet || (precision != 0))
                     {
                         ca4 = new char[n1In + expon + p + 2];
                     } else
@@ -1799,7 +1832,7 @@
                     }
 
                     ca4[0] = '1';
-                    j      = 1;
+                    j = 1;
                 }
 
                 for (i = 0; i < Math.min(n1In + expon, ca3.length); i++, j++)
@@ -1812,7 +1845,7 @@
                     ca4[j] = '0';
                 }
 
-                if (alternateForm ||!precisionSet || (precision != 0))
+                if (alternateForm || !precisionSet || (precision != 0))
                 {
                     ca4[j] = '.';
                     j++;
@@ -1941,7 +1974,7 @@
 
             if (thousands && (nThousands > 0))
             {
-                ca6    = new char[ca5.length + nThousands + lead];
+                ca6 = new char[ca5.length + nThousands + lead];
                 ca6[0] = ca5[0];
 
                 for (i = lead, k = lead; i < dp; i++)
@@ -1949,9 +1982,9 @@
                     if ((i > 0) && (dp - i) % 3 == 0)
                     {
                         // ca6[k]=',';
-                        ca6[k]     = dfs.getGroupingSeparator();
+                        ca6[k] = dfs.getGroupingSeparator();
                         ca6[k + 1] = ca5[i];
-                        k          += 2;
+                        k += 2;
                     } else
                     {
                         ca6[k] = ca5[i];
@@ -1974,13 +2007,14 @@
          * the input double value is an infinity,
          * not-a-number, or a finite double and formats
          * each type of input appropriately.
+         *
          * @param x the double value to be formatted.
          * @return the converted double value.
          */
         private String fFormatString(double x)
         {
             boolean noDigits = false;
-            char[]  ca6, ca7;
+            char[] ca6, ca7;
 
             if (Double.isInfinite(x))
             {
@@ -2038,16 +2072,16 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear after the radix character.
          * Padding is with trailing 0s.
-         *
+         * <p/>
          * The behavior is like printf.  One (hopefully the
          * only) exception is that the minimum number of
          * exponent digits is 3 instead of 2 for e and E
@@ -2061,11 +2095,11 @@
             char[] ca1, ca2, ca3;
 
             // int defaultDigits=6;
-            String  sx, sxOut;
-            int     i, j, k, p;
-            int     n1In, n2In;
-            int     expon = 0;
-            int     ePos, rPos, eSize;
+            String sx, sxOut;
+            int i, j, k, p;
+            int n1In, n2In;
+            int expon = 0;
+            int ePos, rPos, eSize;
             boolean minusSign = false;
 
             if (x > 0.0)
@@ -2073,7 +2107,7 @@
                 sx = Double.toString(x);
             } else if (x < 0.0)
             {
-                sx        = Double.toString(-x);
+                sx = Double.toString(-x);
                 minusSign = true;
             } else
             {
@@ -2082,7 +2116,7 @@
                 if (sx.charAt(0) == '-')
                 {
                     minusSign = true;
-                    sx        = sx.substring(1);
+                    sx = sx.substring(1);
                 }
             }
 
@@ -2190,7 +2224,7 @@
             }
 
             boolean carry = false;
-            int     i0    = 0;
+            int i0 = 0;
 
             if (ca1[0] != '0')
             {
@@ -2217,7 +2251,7 @@
 
                 if (carry)
                 {
-                    ca2     = new char[i0 + p + 1];
+                    ca2 = new char[i0 + p + 1];
                     ca2[i0] = '1';
 
                     for (j = 0; j < i0; j++)
@@ -2235,7 +2269,7 @@
                 }
             }
 
-            if ((Math.abs(expon) < 100) &&!optionalL)
+            if ((Math.abs(expon) < 100) && !optionalL)
             {
                 eSize = 4;
             } else
@@ -2243,7 +2277,7 @@
                 eSize = 5;
             }
 
-            if (alternateForm ||!precisionSet || (precision != 0))
+            if (alternateForm || !precisionSet || (precision != 0))
             {
                 ca2 = new char[2 + p + eSize];
             } else
@@ -2254,12 +2288,12 @@
             if (ca1[0] != '0')
             {
                 ca2[0] = ca1[0];
-                j      = 1;
+                j = 1;
             } else
             {
                 for (j = 1; j < ((ePos == -1)
-                                 ? ca1.length
-                                 : ePos); j++)
+                        ? ca1.length
+                        : ePos); j++)
                 {
                     if (ca1[j] != '0')
                     {
@@ -2270,19 +2304,19 @@
                 if (((ePos != -1) && (j < ePos)) || ((ePos == -1) && (j < ca1.length)))
                 {
                     ca2[0] = ca1[j];
-                    expon  -= j;
+                    expon -= j;
                     j++;
                 } else
                 {
                     ca2[0] = '0';
-                    j      = 2;
+                    j = 2;
                 }
             }
 
-            if (alternateForm ||!precisionSet || (precision != 0))
+            if (alternateForm || !precisionSet || (precision != 0))
             {
                 ca2[1] = '.';
-                i      = 2;
+                i = 2;
             } else
             {
                 i = 1;
@@ -2314,47 +2348,47 @@
             {
                 switch (expon / 100)
                 {
-                case 1 :
+                case 1:
                     ca2[i] = '1';
 
                     break;
 
-                case 2 :
+                case 2:
                     ca2[i] = '2';
 
                     break;
 
-                case 3 :
+                case 3:
                     ca2[i] = '3';
 
                     break;
 
-                case 4 :
+                case 4:
                     ca2[i] = '4';
 
                     break;
 
-                case 5 :
+                case 5:
                     ca2[i] = '5';
 
                     break;
 
-                case 6 :
+                case 6:
                     ca2[i] = '6';
 
                     break;
 
-                case 7 :
+                case 7:
                     ca2[i] = '7';
 
                     break;
 
-                case 8 :
+                case 8:
                     ca2[i] = '8';
 
                     break;
 
-                case 9 :
+                case 9:
                     ca2[i] = '9';
 
                     break;
@@ -2365,52 +2399,52 @@
 
             switch ((expon % 100) / 10)
             {
-            case 0 :
+            case 0:
                 ca2[i] = '0';
 
                 break;
 
-            case 1 :
+            case 1:
                 ca2[i] = '1';
 
                 break;
 
-            case 2 :
+            case 2:
                 ca2[i] = '2';
 
                 break;
 
-            case 3 :
+            case 3:
                 ca2[i] = '3';
 
                 break;
 
-            case 4 :
+            case 4:
                 ca2[i] = '4';
 
                 break;
 
-            case 5 :
+            case 5:
                 ca2[i] = '5';
 
                 break;
 
-            case 6 :
+            case 6:
                 ca2[i] = '6';
 
                 break;
 
-            case 7 :
+            case 7:
                 ca2[i] = '7';
 
                 break;
 
-            case 8 :
+            case 8:
                 ca2[i] = '8';
 
                 break;
 
-            case 9 :
+            case 9:
                 ca2[i] = '9';
 
                 break;
@@ -2420,52 +2454,52 @@
 
             switch (expon % 10)
             {
-            case 0 :
+            case 0:
                 ca2[i] = '0';
 
                 break;
 
-            case 1 :
+            case 1:
                 ca2[i] = '1';
 
                 break;
 
-            case 2 :
+            case 2:
                 ca2[i] = '2';
 
                 break;
 
-            case 3 :
+            case 3:
                 ca2[i] = '3';
 
                 break;
 
-            case 4 :
+            case 4:
                 ca2[i] = '4';
 
                 break;
 
-            case 5 :
+            case 5:
                 ca2[i] = '5';
 
                 break;
 
-            case 6 :
+            case 6:
                 ca2[i] = '6';
 
                 break;
 
-            case 7 :
+            case 7:
                 ca2[i] = '7';
 
                 break;
 
-            case 8 :
+            case 8:
                 ca2[i] = '8';
 
                 break;
 
-            case 9 :
+            case 9:
                 ca2[i] = '9';
 
                 break;
@@ -2583,7 +2617,7 @@
 
             if (thousands && (nThousands > 0))
             {
-                ca4    = new char[ca3.length + nThousands + lead];
+                ca4 = new char[ca3.length + nThousands + lead];
                 ca4[0] = ca3[0];
 
                 for (i = lead, k = lead; i < dp; i++)
@@ -2591,9 +2625,9 @@
                     if ((i > 0) && (dp - i) % 3 == 0)
                     {
                         // ca4[k]=',';
-                        ca4[k]     = dfs.getGroupingSeparator();
+                        ca4[k] = dfs.getGroupingSeparator();
                         ca4[k + 1] = ca3[i];
-                        k          += 2;
+                        k += 2;
                     } else
                     {
                         ca4[k] = ca3[i];
@@ -2614,11 +2648,12 @@
          * Check to see if the digits that are going to
          * be truncated because of the precision should
          * force a round in the preceding digits.
-         * @param ca1 the array of digits
+         *
+         * @param ca1    the array of digits
          * @param icarry the index of the first digit that
-         *     is to be truncated from the print
+         *               is to be truncated from the print
          * @return <code>true</code> if the truncation forces
-         *     a round that will change the print
+         *         a round that will change the print
          */
         private boolean checkForCarry(char[] ca1, int icarry)
         {
@@ -2646,7 +2681,7 @@
                     if (!carry && (icarry > 0))
                     {
                         carry = ((ca1[icarry - 1] == '1') || (ca1[icarry - 1] == '3') || (ca1[icarry - 1] == '5')
-                                 || (ca1[icarry - 1] == '7') || (ca1[icarry - 1] == '9'));
+                                || (ca1[icarry - 1] == '7') || (ca1[icarry - 1] == '9'));
                     }
                 }
             }
@@ -2659,13 +2694,14 @@
          * is not quite finished because the symbolic
          * carry may change the length of the string and
          * change the exponent (in e format).
-         * @param cLast index of the last digit changed
-         *     by the round
+         *
+         * @param cLast  index of the last digit changed
+         *               by the round
          * @param cFirst index of the first digit allowed
-         *     to be changed by this phase of the round
+         *               to be changed by this phase of the round
          * @return <code>true</code> if the carry forces
-         *     a round that will change the print still
-         *     more
+         *         a round that will change the print still
+         *         more
          */
         private boolean startSymbolicCarry(char[] ca, int cLast, int cFirst)
         {
@@ -2677,52 +2713,52 @@
 
                 switch (ca[i])
                 {
-                case '0' :
+                case '0':
                     ca[i] = '1';
 
                     break;
 
-                case '1' :
+                case '1':
                     ca[i] = '2';
 
                     break;
 
-                case '2' :
+                case '2':
                     ca[i] = '3';
 
                     break;
 
-                case '3' :
+                case '3':
                     ca[i] = '4';
 
                     break;
 
-                case '4' :
+                case '4':
                     ca[i] = '5';
 
                     break;
 
-                case '5' :
+                case '5':
                     ca[i] = '6';
 
                     break;
 
-                case '6' :
+                case '6':
                     ca[i] = '7';
 
                     break;
 
-                case '7' :
+                case '7':
                     ca[i] = '8';
 
                     break;
 
-                case '8' :
+                case '8':
                     ca[i] = '9';
 
                     break;
 
-                case '9' :
+                case '9':
                     ca[i] = '0';
                     carry = true;
 
@@ -2739,15 +2775,16 @@
          * the input double value is an infinity,
          * not-a-number, or a finite double and formats
          * each type of input appropriately.
-         * @param x the double value to be formatted.
+         *
+         * @param x     the double value to be formatted.
          * @param eChar an 'e' or 'E' to use in the
-         *     converted double value.
+         *              converted double value.
          * @return the converted double value.
          */
         private String eFormatString(double x, char eChar)
         {
             boolean noDigits = false;
-            char[]  ca4, ca5;
+            char[] ca4, ca5;
 
             if (Double.isInfinite(x))
             {
@@ -2795,8 +2832,9 @@
 
         /**
          * Apply zero or blank, left or right padding.
-         * @param ca4 array of characters before padding is
-         *     finished
+         *
+         * @param ca4      array of characters before padding is
+         *                 finished
          * @param noDigits NaN or signed Inf
          * @return a padded array of characters
          */
@@ -2851,8 +2889,8 @@
                     if (nBlanks > 0)
                     {
                         ca5 = new char[ca4.length + nBlanks];
-                        i   = 0;
-                        j   = 0;
+                        i = 0;
+                        j = 0;
 
                         if (ca4[0] == '-')
                         {
@@ -2879,6 +2917,7 @@
 
         /**
          * Format method for the f conversion character.
+         *
          * @param x the double to format.
          * @return the formatted String.
          */
@@ -2890,6 +2929,7 @@
         /**
          * Format method for the e or E conversion
          * character.
+         *
          * @param x the double to format.
          * @return the formatted String.
          */
@@ -2906,9 +2946,9 @@
 
         /**
          * Format method for the g conversion character.
-         *
+         * <p/>
          * For g format, the flag character '-', means that
-         *  the output should be left justified within the
+         * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  '+' character means that the conversion
          * will always begin with a sign (+ or -).  The
@@ -2918,24 +2958,25 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear after the radix character.
          * Padding is with trailing 0s.
+         *
          * @param x the double to format.
          * @return the formatted String.
          */
         private String printGFormat(double x)
         {
-            String  sx, sy, sz, ret;
-            int     savePrecision = precision;
-            int     i;
-            char[]  ca4, ca5;
+            String sx, sy, sz, ret;
+            int savePrecision = precision;
+            int i;
+            char[] ca4, ca5;
             boolean noDigits = false;
 
             if (Double.isInfinite(x))
@@ -2988,11 +3029,11 @@
 
                 if (conversionCharacter == 'g')
                 {
-                    sx   = eFormatString(x, 'e').trim();
+                    sx = eFormatString(x, 'e').trim();
                     ePos = sx.indexOf('e');
                 } else
                 {
-                    sx   = eFormatString(x, 'E').trim();
+                    sx = eFormatString(x, 'E').trim();
                     ePos = sx.indexOf('E');
                 }
 
@@ -3106,7 +3147,7 @@
             }
 
             // Pad with blanks or zeros.
-            ca5       = applyFloatPadding(ca4, false);
+            ca5 = applyFloatPadding(ca4, false);
             precision = savePrecision;
 
             return new String(ca5);
@@ -3115,7 +3156,7 @@
         /**
          * Format method for the d conversion specifer and
          * short argument.
-         *
+         * <p/>
          * For d format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
@@ -3127,14 +3168,15 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the short to format.
          * @return the formatted String.
          */
@@ -3146,7 +3188,7 @@
         /**
          * Format method for the d conversion character and
          * long argument.
-         *
+         * <p/>
          * For d format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
@@ -3158,14 +3200,15 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the long to format.
          * @return the formatted String.
          */
@@ -3177,7 +3220,7 @@
         /**
          * Format method for the d conversion character and
          * int argument.
-         *
+         * <p/>
          * For d format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
@@ -3189,14 +3232,15 @@
          * ignored.  The '0' flag character implies that
          * padding to the field width will be done with
          * zeros instead of blanks.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the int to format.
          * @return the formatted String.
          */
@@ -3208,19 +3252,20 @@
         /**
          * Utility method for formatting using the d
          * conversion character.
+         *
          * @param sx the String to format, the result of
-         *     converting a short, int, or long to a
-         *     String.
+         *           converting a short, int, or long to a
+         *           String.
          * @return the formatted String.
          */
         private String printDFormat(String sx)
         {
-            int     nLeadingZeros = 0;
-            int     nBlanks       = 0,
-                    n             = 0;
-            int     i             = 0,
-                    jFirst        = 0;
-            boolean neg           = sx.charAt(0) == '-';
+            int nLeadingZeros = 0;
+            int nBlanks = 0,
+                    n = 0;
+            int i = 0,
+                    jFirst = 0;
+            boolean neg = sx.charAt(0) == '-';
 
             if (sx.equals("0") && precisionSet && (precision == 0))
             {
@@ -3291,8 +3336,8 @@
                 char[] csx = sx.toCharArray();
 
                 jFirst = neg
-                         ? 1
-                         : 0;
+                        ? 1
+                        : 0;
 
                 for (int j = 0; j < nLeadingZeros; i++, j++)
                 {
@@ -3354,8 +3399,8 @@
                 char[] csx = sx.toCharArray();
 
                 jFirst = neg
-                         ? 1
-                         : 0;
+                        ? 1
+                        : 0;
 
                 for (int j = jFirst; j < csx.length; j++, i++)
                 {
@@ -3369,20 +3414,21 @@
         /**
          * Format method for the x conversion character and
          * short argument.
-         *
+         * <p/>
          * For x format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means to lead with
          * '0x'.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the short to format.
          * @return the formatted String.
          */
@@ -3412,55 +3458,55 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "800" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "80" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "8" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     switch (t.charAt(0))
                     {
-                    case '1' :
+                    case '1':
                         sx = "9" + t.substring(1, 4);
 
                         break;
 
-                    case '2' :
+                    case '2':
                         sx = "a" + t.substring(1, 4);
 
                         break;
 
-                    case '3' :
+                    case '3':
                         sx = "b" + t.substring(1, 4);
 
                         break;
 
-                    case '4' :
+                    case '4':
                         sx = "c" + t.substring(1, 4);
 
                         break;
 
-                    case '5' :
+                    case '5':
                         sx = "d" + t.substring(1, 4);
 
                         break;
 
-                    case '6' :
+                    case '6':
                         sx = "e" + t.substring(1, 4);
 
                         break;
 
-                    case '7' :
+                    case '7':
                         sx = "f" + t.substring(1, 4);
 
                         break;
@@ -3479,20 +3525,21 @@
         /**
          * Format method for the x conversion character and
          * long argument.
-         *
+         * <p/>
          * For x format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means to lead with
          * '0x'.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the long to format.
          * @return the formatted String.
          */
@@ -3509,115 +3556,115 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "800000000000000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "80000000000000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "8000000000000" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "800000000000" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "80000000000" + t;
 
                     break;
 
-                case 6 :
+                case 6:
                     sx = "8000000000" + t;
 
                     break;
 
-                case 7 :
+                case 7:
                     sx = "800000000" + t;
 
                     break;
 
-                case 8 :
+                case 8:
                     sx = "80000000" + t;
 
                     break;
 
-                case 9 :
+                case 9:
                     sx = "8000000" + t;
 
                     break;
 
-                case 10 :
+                case 10:
                     sx = "800000" + t;
 
                     break;
 
-                case 11 :
+                case 11:
                     sx = "80000" + t;
 
                     break;
 
-                case 12 :
+                case 12:
                     sx = "8000" + t;
 
                     break;
 
-                case 13 :
+                case 13:
                     sx = "800" + t;
 
                     break;
 
-                case 14 :
+                case 14:
                     sx = "80" + t;
 
                     break;
 
-                case 15 :
+                case 15:
                     sx = "8" + t;
 
                     break;
 
-                case 16 :
+                case 16:
                     switch (t.charAt(0))
                     {
-                    case '1' :
+                    case '1':
                         sx = "9" + t.substring(1, 16);
 
                         break;
 
-                    case '2' :
+                    case '2':
                         sx = "a" + t.substring(1, 16);
 
                         break;
 
-                    case '3' :
+                    case '3':
                         sx = "b" + t.substring(1, 16);
 
                         break;
 
-                    case '4' :
+                    case '4':
                         sx = "c" + t.substring(1, 16);
 
                         break;
 
-                    case '5' :
+                    case '5':
                         sx = "d" + t.substring(1, 16);
 
                         break;
 
-                    case '6' :
+                    case '6':
                         sx = "e" + t.substring(1, 16);
 
                         break;
 
-                    case '7' :
+                    case '7':
                         sx = "f" + t.substring(1, 16);
 
                         break;
@@ -3636,20 +3683,21 @@
         /**
          * Format method for the x conversion character and
          * int argument.
-         *
+         * <p/>
          * For x format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means to lead with
          * '0x'.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the int to format.
          * @return the formatted String.
          */
@@ -3666,75 +3714,75 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "8000000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "800000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "80000" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "8000" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "800" + t;
 
                     break;
 
-                case 6 :
+                case 6:
                     sx = "80" + t;
 
                     break;
 
-                case 7 :
+                case 7:
                     sx = "8" + t;
 
                     break;
 
-                case 8 :
+                case 8:
                     switch (t.charAt(0))
                     {
-                    case '1' :
+                    case '1':
                         sx = "9" + t.substring(1, 8);
 
                         break;
 
-                    case '2' :
+                    case '2':
                         sx = "a" + t.substring(1, 8);
 
                         break;
 
-                    case '3' :
+                    case '3':
                         sx = "b" + t.substring(1, 8);
 
                         break;
 
-                    case '4' :
+                    case '4':
                         sx = "c" + t.substring(1, 8);
 
                         break;
 
-                    case '5' :
+                    case '5':
                         sx = "d" + t.substring(1, 8);
 
                         break;
 
-                    case '6' :
+                    case '6':
                         sx = "e" + t.substring(1, 8);
 
                         break;
 
-                    case '7' :
+                    case '7':
                         sx = "f" + t.substring(1, 8);
 
                         break;
@@ -3753,15 +3801,16 @@
         /**
          * Utility method for formatting using the x
          * conversion character.
+         *
          * @param sx the String to format, the result of
-         *     converting a short, int, or long to a
-         *     String.
+         *           converting a short, int, or long to a
+         *           String.
          * @return the formatted String.
          */
         private String printXFormat(String sx)
         {
             int nLeadingZeros = 0;
-            int nBlanks       = 0;
+            int nBlanks = 0;
 
             if (sx.equals("0") && precisionSet && (precision == 0))
             {
@@ -3805,7 +3854,7 @@
             n += nBlanks;
 
             char[] ca = new char[n];
-            int    i  = 0;
+            int i = 0;
 
             if (leftJustify)
             {
@@ -3881,21 +3930,22 @@
         /**
          * Format method for the o conversion character and
          * short argument.
-         *
+         * <p/>
          * For o format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means that the
          * output begins with a leading 0 and the precision
          * is increased by 1.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the short to format.
          * @return the formatted String.
          */
@@ -3912,27 +3962,27 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "10000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "1000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "100" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "10" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "1" + t;
 
                     break;
@@ -3948,21 +3998,22 @@
         /**
          * Format method for the o conversion character and
          * long argument.
-         *
+         * <p/>
          * For o format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means that the
          * output begins with a leading 0 and the precision
          * is increased by 1.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the long to format.
          * @return the formatted String.
          */
@@ -3979,107 +4030,107 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "100000000000000000000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "10000000000000000000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "1000000000000000000" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "100000000000000000" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "10000000000000000" + t;
 
                     break;
 
-                case 6 :
+                case 6:
                     sx = "1000000000000000" + t;
 
                     break;
 
-                case 7 :
+                case 7:
                     sx = "100000000000000" + t;
 
                     break;
 
-                case 8 :
+                case 8:
                     sx = "10000000000000" + t;
 
                     break;
 
-                case 9 :
+                case 9:
                     sx = "1000000000000" + t;
 
                     break;
 
-                case 10 :
+                case 10:
                     sx = "100000000000" + t;
 
                     break;
 
-                case 11 :
+                case 11:
                     sx = "10000000000" + t;
 
                     break;
 
-                case 12 :
+                case 12:
                     sx = "1000000000" + t;
 
                     break;
 
-                case 13 :
+                case 13:
                     sx = "100000000" + t;
 
                     break;
 
-                case 14 :
+                case 14:
                     sx = "10000000" + t;
 
                     break;
 
-                case 15 :
+                case 15:
                     sx = "1000000" + t;
 
                     break;
 
-                case 16 :
+                case 16:
                     sx = "100000" + t;
 
                     break;
 
-                case 17 :
+                case 17:
                     sx = "10000" + t;
 
                     break;
 
-                case 18 :
+                case 18:
                     sx = "1000" + t;
 
                     break;
 
-                case 19 :
+                case 19:
                     sx = "100" + t;
 
                     break;
 
-                case 20 :
+                case 20:
                     sx = "10" + t;
 
                     break;
 
-                case 21 :
+                case 21:
                     sx = "1" + t;
 
                     break;
@@ -4095,21 +4146,22 @@
         /**
          * Format method for the o conversion character and
          * int argument.
-         *
+         * <p/>
          * For o format, the flag character '-', means that
          * the output should be left justified within the
          * field.  The default is to pad with blanks on the
          * left.  The '#' flag character means that the
          * output begins with a leading 0 and the precision
          * is increased by 1.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is to
          * add no padding.  Padding is with blanks by
          * default.
-         *
+         * <p/>
          * The precision, if set, is the minimum number of
          * digits to appear.  Padding is with leading 0s.
+         *
          * @param x the int to format.
          * @return the formatted String.
          */
@@ -4126,57 +4178,57 @@
 
                 switch (t.length())
                 {
-                case 1 :
+                case 1:
                     sx = "2000000000" + t;
 
                     break;
 
-                case 2 :
+                case 2:
                     sx = "200000000" + t;
 
                     break;
 
-                case 3 :
+                case 3:
                     sx = "20000000" + t;
 
                     break;
 
-                case 4 :
+                case 4:
                     sx = "2000000" + t;
 
                     break;
 
-                case 5 :
+                case 5:
                     sx = "200000" + t;
 
                     break;
 
-                case 6 :
+                case 6:
                     sx = "20000" + t;
 
                     break;
 
-                case 7 :
+                case 7:
                     sx = "2000" + t;
 
                     break;
 
-                case 8 :
+                case 8:
                     sx = "200" + t;
 
                     break;
 
-                case 9 :
+                case 9:
                     sx = "20" + t;
 
                     break;
 
-                case 10 :
+                case 10:
                     sx = "2" + t;
 
                     break;
 
-                case 11 :
+                case 11:
                     sx = "3" + t.substring(1);
 
                     break;
@@ -4192,15 +4244,16 @@
         /**
          * Utility method for formatting using the o
          * conversion character.
+         *
          * @param sx the String to format, the result of
-         *     converting a short, int, or long to a
-         *     String.
+         *           converting a short, int, or long to a
+         *           String.
          * @return the formatted String.
          */
         private String printOFormat(String sx)
         {
             int nLeadingZeros = 0;
-            int nBlanks       = 0;
+            int nBlanks = 0;
 
             if (sx.equals("0") && precisionSet && (precision == 0))
             {
@@ -4232,9 +4285,9 @@
                 nBlanks = 0;
             }
 
-            int    n  = nLeadingZeros + sx.length() + nBlanks;
+            int n = nLeadingZeros + sx.length() + nBlanks;
             char[] ca = new char[n];
-            int    i;
+            int i;
 
             if (leftJustify)
             {
@@ -4289,24 +4342,25 @@
         /**
          * Format method for the c conversion character and
          * char argument.
-         *
+         * <p/>
          * The only flag character that affects c format is
          * the '-', meaning that the output should be left
          * justified within the field.  The default is to
          * pad with blanks on the left.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  Padding is with
          * blanks by default.  The default width is 1.
-         *
+         * <p/>
          * The precision, if set, is ignored.
+         *
          * @param x the char to format.
          * @return the formatted String.
          */
         private String printCFormat(char x)
         {
             int nPrint = 1;
-            int width  = fieldWidth;
+            int width = fieldWidth;
 
             if (!fieldWidthSet)
             {
@@ -4314,7 +4368,7 @@
             }
 
             char[] ca = new char[width];
-            int    i  = 0;
+            int i = 0;
 
             if (leftJustify)
             {
@@ -4340,30 +4394,31 @@
         /**
          * Format method for the s conversion character and
          * String argument.
-         *
+         * <p/>
          * The only flag character that affects s format is
          * the '-', meaning that the output should be left
          * justified within the field.  The default is to
          * pad with blanks on the left.
-         *
+         * <p/>
          * The field width is treated as the minimum number
          * of characters to be printed.  The default is the
          * smaller of the number of characters in the the
          * input and the precision.  Padding is with blanks
          * by default.
-         *
+         * <p/>
          * The precision, if set, specifies the maximum
          * number of characters to be printed from the
          * string.  A null digit string is treated
          * as a 0.  The default is not to set a maximum
          * number of characters to be printed.
+         *
          * @param x the String to format.
          * @return the formatted String.
          */
         private String printSFormat(String x)
         {
             int nPrint = x.length();
-            int width  = fieldWidth;
+            int width = fieldWidth;
 
             if (precisionSet && (nPrint > precision))
             {
@@ -4391,7 +4446,7 @@
             }
 
             char[] ca = new char[n];
-            int    i  = 0;
+            int i = 0;
 
             if (leftJustify)
             {
@@ -4449,9 +4504,10 @@
         /**
          * Check for a conversion character.  If it is
          * there, store it.
+         *
          * @return <code>true</code> if the conversion
-         *     character is there, and
-         *     <code>false</code> otherwise.
+         *         character is there, and
+         *         <code>false</code> otherwise.
          */
         private boolean setConversionCharacter()
         {
@@ -4465,7 +4521,7 @@
                 char c = fmt.charAt(pos);
 
                 if ((c == 'i') || (c == 'd') || (c == 'f') || (c == 'g') || (c == 'G') || (c == 'o') || (c == 'x') || (c == 'X')
-                    || (c == 'e') || (c == 'E') || (c == 'c') || (c == 's') || (c == '%'))
+                        || (c == 'e') || (c == 'E') || (c == 'c') || (c == 's') || (c == '%'))
                 {
                     conversionCharacter = c;
                     pos++;
@@ -4531,7 +4587,7 @@
                     if (!setPrecisionArgPosition())
                     {
                         variablePrecision = true;
-                        precisionSet      = true;
+                        precisionSet = true;
                     }
 
                     return;
@@ -4554,7 +4610,7 @@
                     {
                         String sz = fmt.substring(firstPos + 1, pos);
 
-                        precision    = Integer.parseInt(sz);
+                        precision = Integer.parseInt(sz);
                         precisionSet = true;
                     }
                 }
@@ -4568,7 +4624,7 @@
         {
             int firstPos = pos;
 
-            fieldWidth    = 0;
+            fieldWidth = 0;
             fieldWidthSet = false;
 
             if ((pos < fmt.length()) && (fmt.charAt(pos) == '*'))
@@ -4578,7 +4634,7 @@
                 if (!setFieldWidthArgPosition())
                 {
                     variableFieldWidth = true;
-                    fieldWidthSet      = true;
+                    fieldWidthSet = true;
                 }
             } else
             {
@@ -4599,7 +4655,7 @@
                 {
                     String sz = fmt.substring(firstPos, pos);
 
-                    fieldWidth    = Integer.parseInt(sz);
+                    fieldWidth = Integer.parseInt(sz);
                     fieldWidthSet = true;
                 }
             }
@@ -4625,8 +4681,8 @@
                 if (fmt.charAt(xPos) == '$')
                 {
                     positionalSpecification = true;
-                    argumentPosition        = Integer.parseInt(fmt.substring(pos, xPos));
-                    pos                     = xPos + 1;
+                    argumentPosition = Integer.parseInt(fmt.substring(pos, xPos));
+                    pos = xPos + 1;
                 }
             }
         }
@@ -4637,7 +4693,7 @@
         private boolean setFieldWidthArgPosition()
         {
             boolean ret = false;
-            int     xPos;
+            int xPos;
 
             for (xPos = pos; xPos < fmt.length(); xPos++)
             {
@@ -4651,10 +4707,10 @@
             {
                 if (fmt.charAt(xPos) == '$')
                 {
-                    positionalFieldWidth          = true;
+                    positionalFieldWidth = true;
                     argumentPositionForFieldWidth = Integer.parseInt(fmt.substring(pos, xPos));
-                    pos                           = xPos + 1;
-                    ret                           = true;
+                    pos = xPos + 1;
+                    ret = true;
                 }
             }
 
@@ -4667,7 +4723,7 @@
         private boolean setPrecisionArgPosition()
         {
             boolean ret = false;
-            int     xPos;
+            int xPos;
 
             for (xPos = pos; xPos < fmt.length(); xPos++)
             {
@@ -4681,10 +4737,10 @@
             {
                 if (fmt.charAt(xPos) == '$')
                 {
-                    positionalPrecision          = true;
+                    positionalPrecision = true;
                     argumentPositionForPrecision = Integer.parseInt(fmt.substring(pos, xPos));
-                    pos                          = xPos + 1;
-                    ret                          = true;
+                    pos = xPos + 1;
+                    ret = true;
                 }
             }
 
@@ -4727,12 +4783,12 @@
         private void setFlagCharacters()
         {
             /* '-+ #0 */
-            thousands     = false;
-            leftJustify   = false;
-            leadingSign   = false;
-            leadingSpace  = false;
+            thousands = false;
+            leftJustify = false;
+            leadingSign = false;
+            leadingSpace = false;
             alternateForm = false;
-            leadingZeros  = false;
+            leadingZeros = false;
 
             for (; pos < fmt.length(); pos++)
             {
@@ -4743,11 +4799,11 @@
                     thousands = true;
                 } else if (c == '-')
                 {
-                    leftJustify  = true;
+                    leftJustify = true;
                     leadingZeros = false;
                 } else if (c == '+')
                 {
-                    leadingSign  = true;
+                    leadingSign = true;
                     leadingSpace = false;
                 } else if (c == ' ')
                 {
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/StringUtils.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/StringUtils.java
index 06e869a..5821070 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/StringUtils.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/StringUtils.java
@@ -1,2806 +1,2770 @@
 package com.ximple.eofms.util;
 
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Collection;
-import java.util.Locale;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Array;
+import java.net.URLEncoder;
+import java.nio.CharBuffer;
+import java.nio.charset.CharacterCodingException;
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CharacterCodingException;
-import java.nio.CharBuffer;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.lang.reflect.Array;
 import java.text.BreakIterator;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public abstract class StringUtils
 {
-	public static String ENCODING_US_ASCII = "US-ASCII";
-	public static String ENCODING_ISO_8859_1 = "ISO-8859-1";
-	public static String ENCODING_ISO_8859_2 = "ISO-8859-2";
-	public static String ENCODING_ISO_8859_5 = "ISO-8859-5";
-	public static String ENCODING_UTF_8 = "UTF-8";
-	public static String ENCODING_UTF_16BE = "UTF-16BE";
-	public static String ENCODING_UTF_16LE = "UTF-16LE";
-	public static String ENCODING_UTF_16 = "UTF-16";
+    public static String ENCODING_US_ASCII = "US-ASCII";
+    public static String ENCODING_ISO_8859_1 = "ISO-8859-1";
+    public static String ENCODING_ISO_8859_2 = "ISO-8859-2";
+    public static String ENCODING_ISO_8859_5 = "ISO-8859-5";
+    public static String ENCODING_UTF_8 = "UTF-8";
+    public static String ENCODING_UTF_16BE = "UTF-16BE";
+    public static String ENCODING_UTF_16LE = "UTF-16LE";
+    public static String ENCODING_UTF_16 = "UTF-16";
 
-	public static Charset CHARSET_US_ASCII = Charset.forName(StringUtils.ENCODING_US_ASCII);
+    public static Charset CHARSET_US_ASCII = Charset.forName(StringUtils.ENCODING_US_ASCII);
 
-	public static final Pattern BBCODE_COLOR = Pattern.compile("\\[color\\s*=\\s*([#\\w]*)\\s*\\]", Pattern.CASE_INSENSITIVE);
-	public static final Pattern BBCODE_SIZE = Pattern.compile("\\[size\\s*=\\s*([+\\-]?[0-9]*)\\s*\\]", Pattern.CASE_INSENSITIVE);
-	public static final Pattern BBCODE_URL_SHORT = Pattern.compile("\\[url\\]\\s*([^\\s]*)\\s*\\[\\/url\\]", Pattern.CASE_INSENSITIVE);
-	public static final Pattern BBCODE_URL_LONG = Pattern.compile("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]", Pattern.CASE_INSENSITIVE);
-	public static final Pattern BBCODE_IMG = Pattern.compile("\\[img\\]\\s*([^\\s]*)\\s*\\[\\/img\\]", Pattern.CASE_INSENSITIVE);
-	public static final Pattern BBCODE_QUOTE_LONG = Pattern.compile("\\[quote=([^\\]]+\\]*)\\]", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
-	public static final Pattern BBCODE_BAREURL = Pattern.compile("(?:[^\"'=>\\]]|^)((?:http|ftp)s?://(?:%[\\p{Digit}A-Fa-f][\\p{Digit}A-Fa-f]|[\\-_\\.!~*';\\|/?:@#&=\\+$,\\p{Alnum}])+)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
+    public static final Pattern BBCODE_COLOR = Pattern.compile("\\[color\\s*=\\s*([#\\w]*)\\s*\\]", Pattern.CASE_INSENSITIVE);
+    public static final Pattern BBCODE_SIZE = Pattern.compile("\\[size\\s*=\\s*([+\\-]?[0-9]*)\\s*\\]", Pattern.CASE_INSENSITIVE);
+    public static final Pattern BBCODE_URL_SHORT = Pattern.compile("\\[url\\]\\s*([^\\s]*)\\s*\\[\\/url\\]", Pattern.CASE_INSENSITIVE);
+    public static final Pattern BBCODE_URL_LONG = Pattern.compile("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]", Pattern.CASE_INSENSITIVE);
+    public static final Pattern BBCODE_IMG = Pattern.compile("\\[img\\]\\s*([^\\s]*)\\s*\\[\\/img\\]", Pattern.CASE_INSENSITIVE);
+    public static final Pattern BBCODE_QUOTE_LONG = Pattern.compile("\\[quote=([^\\]]+\\]*)\\]", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
+    public static final Pattern BBCODE_BAREURL = Pattern.compile("(?:[^\"'=>\\]]|^)((?:http|ftp)s?://(?:%[\\p{Digit}A-Fa-f][\\p{Digit}A-Fa-f]|[\\-_\\.!~*';\\|/?:@#&=\\+$,\\p{Alnum}])+)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
 
-	private static final Map<Character, String> AGGRESSIVE_HTML_ENCODE_MAP = new HashMap<Character, String>();
-	private static final Map<Character, String> DEFENSIVE_HTML_ENCODE_MAP = new HashMap<Character, String>();
-	private static final Map<Character, String> XML_ENCODE_MAP = new HashMap<Character, String>();
-	private static final Map<Character, String> STRING_ENCODE_MAP = new HashMap<Character, String>();
-	private static final Map<Character, String> SQL_ENCODE_MAP = new HashMap<Character, String>();
-	private static final Map<Character, String> LATEX_ENCODE_MAP = new HashMap<Character, String>();
+    private static final Map<Character, String> AGGRESSIVE_HTML_ENCODE_MAP = new HashMap<Character, String>();
+    private static final Map<Character, String> DEFENSIVE_HTML_ENCODE_MAP = new HashMap<Character, String>();
+    private static final Map<Character, String> XML_ENCODE_MAP = new HashMap<Character, String>();
+    private static final Map<Character, String> STRING_ENCODE_MAP = new HashMap<Character, String>();
+    private static final Map<Character, String> SQL_ENCODE_MAP = new HashMap<Character, String>();
+    private static final Map<Character, String> LATEX_ENCODE_MAP = new HashMap<Character, String>();
 
-	private static final Map<String, Character>		HTML_DECODE_MAP = new HashMap<String, Character>();
+    private static final Map<String, Character> HTML_DECODE_MAP = new HashMap<String, Character>();
 
-	private static final HtmlEncoderFallbackHandler HTML_ENCODER_FALLBACK = new HtmlEncoderFallbackHandler();
+    private static final HtmlEncoderFallbackHandler HTML_ENCODER_FALLBACK = new HtmlEncoderFallbackHandler();
 
-	static
-	{
-		// Html encoding mapping according to the HTML 4.0 spec
-		// http://www.w3.org/TR/REC-html40/sgml/entities.html
+    static
+    {
+        // Html encoding mapping according to the HTML 4.0 spec
+        // http://www.w3.org/TR/REC-html40/sgml/entities.html
 
-		// Special characters for HTML
-		AGGRESSIVE_HTML_ENCODE_MAP.put('\u0026',"&amp;");
-		AGGRESSIVE_HTML_ENCODE_MAP.put('\u003C',"&lt;");
-		AGGRESSIVE_HTML_ENCODE_MAP.put('\u003E',"&gt;");
-		AGGRESSIVE_HTML_ENCODE_MAP.put('\u0022',"&quot;");
+        // Special characters for HTML
+        AGGRESSIVE_HTML_ENCODE_MAP.put('\u0026', "&amp;");
+        AGGRESSIVE_HTML_ENCODE_MAP.put('\u003C', "&lt;");
+        AGGRESSIVE_HTML_ENCODE_MAP.put('\u003E', "&gt;");
+        AGGRESSIVE_HTML_ENCODE_MAP.put('\u0022', "&quot;");
 
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0152',"&OElig;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0153',"&oelig;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0160',"&Scaron;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0161',"&scaron;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0178',"&Yuml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u02C6',"&circ;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u02DC',"&tilde;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2002',"&ensp;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2003',"&emsp;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2009',"&thinsp;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u200C',"&zwnj;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u200D',"&zwj;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u200E',"&lrm;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u200F',"&rlm;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2013',"&ndash;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2014',"&mdash;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2018',"&lsquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2019',"&rsquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u201A',"&sbquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u201C',"&ldquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u201D',"&rdquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u201E',"&bdquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2020',"&dagger;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2021',"&Dagger;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2030',"&permil;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2039',"&lsaquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u203A',"&rsaquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u20AC',"&euro;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0152', "&OElig;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0153', "&oelig;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0160', "&Scaron;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0161', "&scaron;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0178', "&Yuml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u02C6', "&circ;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u02DC', "&tilde;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2002', "&ensp;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2003', "&emsp;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2009', "&thinsp;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u200C', "&zwnj;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u200D', "&zwj;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u200E', "&lrm;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u200F', "&rlm;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2013', "&ndash;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2014', "&mdash;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2018', "&lsquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2019', "&rsquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u201A', "&sbquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u201C', "&ldquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u201D', "&rdquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u201E', "&bdquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2020', "&dagger;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2021', "&Dagger;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2030', "&permil;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2039', "&lsaquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u203A', "&rsaquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u20AC', "&euro;");
 
-		// Character entity references for ISO 8859-1 characters
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A0',"&nbsp;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A1',"&iexcl;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A2',"&cent;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A3',"&pound;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A4',"&curren;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A5',"&yen;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A6',"&brvbar;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A7',"&sect;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A8',"&uml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00A9',"&copy;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00AA',"&ordf;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00AB',"&laquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00AC',"&not;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00AD',"&shy;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00AE',"&reg;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00AF',"&macr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B0',"&deg;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B1',"&plusmn;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B2',"&sup2;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B3',"&sup3;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B4',"&acute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B5',"&micro;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B6',"&para;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B7',"&middot;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B8',"&cedil;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00B9',"&sup1;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00BA',"&ordm;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00BB',"&raquo;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00BC',"&frac14;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00BD',"&frac12;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00BE',"&frac34;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00BF',"&iquest;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C0',"&Agrave;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C1',"&Aacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C2',"&Acirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C3',"&Atilde;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C4',"&Auml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C5',"&Aring;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C6',"&AElig;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C7',"&Ccedil;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C8',"&Egrave;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00C9',"&Eacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00CA',"&Ecirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00CB',"&Euml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00CC',"&Igrave;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00CD',"&Iacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00CE',"&Icirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00CF',"&Iuml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D0',"&ETH;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D1',"&Ntilde;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D2',"&Ograve;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D3',"&Oacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D4',"&Ocirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D5',"&Otilde;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D6',"&Ouml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D7',"&times;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D8',"&Oslash;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00D9',"&Ugrave;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00DA',"&Uacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00DB',"&Ucirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00DC',"&Uuml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00DD',"&Yacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00DE',"&THORN;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00DF',"&szlig;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E0',"&agrave;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E1',"&aacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E2',"&acirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E3',"&atilde;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E4',"&auml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E5',"&aring;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E6',"&aelig;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E7',"&ccedil;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E8',"&egrave;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00E9',"&eacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00EA',"&ecirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00EB',"&euml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00EC',"&igrave;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00ED',"&iacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00EE',"&icirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00EF',"&iuml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F0',"&eth;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F1',"&ntilde;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F2',"&ograve;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F3',"&oacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F4',"&ocirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F5',"&otilde;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F6',"&ouml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F7',"&divide;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F8',"&oslash;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00F9',"&ugrave;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00FA',"&uacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00FB',"&ucirc;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00FC',"&uuml;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00FD',"&yacute;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00FE',"&thorn;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u00FF',"&yuml;");
+        // Character entity references for ISO 8859-1 characters
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A0', "&nbsp;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A1', "&iexcl;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A2', "&cent;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A3', "&pound;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A4', "&curren;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A5', "&yen;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A6', "&brvbar;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A7', "&sect;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A8', "&uml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00A9', "&copy;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00AA', "&ordf;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00AB', "&laquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00AC', "&not;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00AD', "&shy;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00AE', "&reg;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00AF', "&macr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B0', "&deg;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B1', "&plusmn;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B2', "&sup2;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B3', "&sup3;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B4', "&acute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B5', "&micro;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B6', "&para;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B7', "&middot;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B8', "&cedil;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00B9', "&sup1;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00BA', "&ordm;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00BB', "&raquo;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00BC', "&frac14;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00BD', "&frac12;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00BE', "&frac34;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00BF', "&iquest;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C0', "&Agrave;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C1', "&Aacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C2', "&Acirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C3', "&Atilde;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C4', "&Auml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C5', "&Aring;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C6', "&AElig;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C7', "&Ccedil;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C8', "&Egrave;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00C9', "&Eacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00CA', "&Ecirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00CB', "&Euml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00CC', "&Igrave;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00CD', "&Iacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00CE', "&Icirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00CF', "&Iuml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D0', "&ETH;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D1', "&Ntilde;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D2', "&Ograve;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D3', "&Oacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D4', "&Ocirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D5', "&Otilde;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D6', "&Ouml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D7', "&times;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D8', "&Oslash;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00D9', "&Ugrave;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00DA', "&Uacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00DB', "&Ucirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00DC', "&Uuml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00DD', "&Yacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00DE', "&THORN;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00DF', "&szlig;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E0', "&agrave;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E1', "&aacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E2', "&acirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E3', "&atilde;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E4', "&auml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E5', "&aring;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E6', "&aelig;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E7', "&ccedil;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E8', "&egrave;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00E9', "&eacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00EA', "&ecirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00EB', "&euml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00EC', "&igrave;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00ED', "&iacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00EE', "&icirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00EF', "&iuml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F0', "&eth;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F1', "&ntilde;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F2', "&ograve;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F3', "&oacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F4', "&ocirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F5', "&otilde;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F6', "&ouml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F7', "&divide;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F8', "&oslash;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00F9', "&ugrave;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00FA', "&uacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00FB', "&ucirc;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00FC', "&uuml;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00FD', "&yacute;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00FE', "&thorn;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u00FF', "&yuml;");
 
-		// Mathematical, Greek and Symbolic characters for HTML
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0192',"&fnof;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0391',"&Alpha;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0392',"&Beta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0393',"&Gamma;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0394',"&Delta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0395',"&Epsilon;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0396',"&Zeta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0397',"&Eta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0398',"&Theta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u0399',"&Iota;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u039A',"&Kappa;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u039B',"&Lambda;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u039C',"&Mu;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u039D',"&Nu;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u039E',"&Xi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u039F',"&Omicron;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03A0',"&Pi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03A1',"&Rho;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03A3',"&Sigma;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03A4',"&Tau;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03A5',"&Upsilon;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03A6',"&Phi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03A7',"&Chi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03A8',"&Psi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03A9',"&Omega;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03B1',"&alpha;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03B2',"&beta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03B3',"&gamma;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03B4',"&delta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03B5',"&epsilon;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03B6',"&zeta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03B7',"&eta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03B8',"&theta;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03B9',"&iota;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03BA',"&kappa;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03BB',"&lambda;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03BC',"&mu;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03BD',"&nu;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03BE',"&xi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03BF',"&omicron;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C0',"&pi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C1',"&rho;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C2',"&sigmaf;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C3',"&sigma;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C4',"&tau;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C5',"&upsilon;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C6',"&phi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C7',"&chi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C8',"&psi;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03C9',"&omega;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03D1',"&thetasym;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03D2',"&upsih;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u03D6',"&piv;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2022',"&bull;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2026',"&hellip;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2032',"&prime;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2033',"&Prime;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u203E',"&oline;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2044',"&frasl;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2118',"&weierp;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2111',"&image;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u211C',"&real;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2122',"&trade;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2135',"&alefsym;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2190',"&larr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2191',"&uarr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2192',"&rarr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2193',"&darr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2194',"&harr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u21B5',"&crarr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u21D0',"&lArr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u21D1',"&uArr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u21D2',"&rArr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u21D3',"&dArr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u21D4',"&hArr;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2200',"&forall;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2202',"&part;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2203',"&exist;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2205',"&empty;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2207',"&nabla;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2208',"&isin;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2209',"&notin;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u220B',"&ni;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u220F',"&prod;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2211',"&sum;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2212',"&minus;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2217',"&lowast;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u221A',"&radic;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u221D',"&prop;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u221E',"&infin;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2220',"&ang;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2227',"&and;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2228',"&or;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2229',"&cap;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u222A',"&cup;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u222B',"&int;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2234',"&there4;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u223C',"&sim;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2245',"&cong;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2248',"&asymp;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2260',"&ne;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2261',"&equiv;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2264',"&le;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2265',"&ge;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2282',"&sub;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2283',"&sup;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2284',"&nsub;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2286',"&sube;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2287',"&supe;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2295',"&oplus;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2297',"&otimes;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u22A5',"&perp;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u22C5',"&sdot;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2308',"&lceil;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2309',"&rceil;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u230A',"&lfloor;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u230B',"&rfloor;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2329',"&lang;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u232A',"&rang;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u25CA',"&loz;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2660',"&spades;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2663',"&clubs;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2665',"&hearts;");
-		DEFENSIVE_HTML_ENCODE_MAP.put('\u2666',"&diams;");
+        // Mathematical, Greek and Symbolic characters for HTML
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0192', "&fnof;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0391', "&Alpha;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0392', "&Beta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0393', "&Gamma;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0394', "&Delta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0395', "&Epsilon;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0396', "&Zeta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0397', "&Eta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0398', "&Theta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u0399', "&Iota;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u039A', "&Kappa;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u039B', "&Lambda;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u039C', "&Mu;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u039D', "&Nu;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u039E', "&Xi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u039F', "&Omicron;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03A0', "&Pi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03A1', "&Rho;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03A3', "&Sigma;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03A4', "&Tau;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03A5', "&Upsilon;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03A6', "&Phi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03A7', "&Chi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03A8', "&Psi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03A9', "&Omega;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03B1', "&alpha;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03B2', "&beta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03B3', "&gamma;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03B4', "&delta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03B5', "&epsilon;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03B6', "&zeta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03B7', "&eta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03B8', "&theta;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03B9', "&iota;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03BA', "&kappa;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03BB', "&lambda;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03BC', "&mu;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03BD', "&nu;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03BE', "&xi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03BF', "&omicron;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C0', "&pi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C1', "&rho;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C2', "&sigmaf;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C3', "&sigma;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C4', "&tau;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C5', "&upsilon;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C6', "&phi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C7', "&chi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C8', "&psi;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03C9', "&omega;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03D1', "&thetasym;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03D2', "&upsih;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u03D6', "&piv;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2022', "&bull;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2026', "&hellip;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2032', "&prime;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2033', "&Prime;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u203E', "&oline;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2044', "&frasl;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2118', "&weierp;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2111', "&image;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u211C', "&real;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2122', "&trade;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2135', "&alefsym;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2190', "&larr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2191', "&uarr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2192', "&rarr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2193', "&darr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2194', "&harr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u21B5', "&crarr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u21D0', "&lArr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u21D1', "&uArr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u21D2', "&rArr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u21D3', "&dArr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u21D4', "&hArr;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2200', "&forall;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2202', "&part;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2203', "&exist;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2205', "&empty;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2207', "&nabla;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2208', "&isin;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2209', "&notin;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u220B', "&ni;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u220F', "&prod;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2211', "&sum;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2212', "&minus;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2217', "&lowast;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u221A', "&radic;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u221D', "&prop;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u221E', "&infin;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2220', "&ang;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2227', "&and;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2228', "&or;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2229', "&cap;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u222A', "&cup;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u222B', "&int;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2234', "&there4;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u223C', "&sim;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2245', "&cong;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2248', "&asymp;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2260', "&ne;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2261', "&equiv;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2264', "&le;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2265', "&ge;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2282', "&sub;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2283', "&sup;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2284', "&nsub;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2286', "&sube;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2287', "&supe;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2295', "&oplus;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2297', "&otimes;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u22A5', "&perp;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u22C5', "&sdot;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2308', "&lceil;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2309', "&rceil;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u230A', "&lfloor;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u230B', "&rfloor;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2329', "&lang;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u232A', "&rang;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u25CA', "&loz;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2660', "&spades;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2663', "&clubs;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2665', "&hearts;");
+        DEFENSIVE_HTML_ENCODE_MAP.put('\u2666', "&diams;");
 
-		Set<Map.Entry<Character, String>> aggresive_entries = AGGRESSIVE_HTML_ENCODE_MAP.entrySet();
-		for (Map.Entry<Character, String> entry : aggresive_entries)
-		{
-			HTML_DECODE_MAP.put(entry.getValue(), entry.getKey());
-		}
+        Set<Map.Entry<Character, String>> aggresive_entries = AGGRESSIVE_HTML_ENCODE_MAP.entrySet();
+        for (Map.Entry<Character, String> entry : aggresive_entries)
+        {
+            HTML_DECODE_MAP.put(entry.getValue(), entry.getKey());
+        }
 
-		Set<Map.Entry<Character, String>> defensive_entries = DEFENSIVE_HTML_ENCODE_MAP.entrySet();
-		for (Map.Entry<Character, String> entry : defensive_entries)
-		{
-			HTML_DECODE_MAP.put(entry.getValue(), entry.getKey());
-		}
+        Set<Map.Entry<Character, String>> defensive_entries = DEFENSIVE_HTML_ENCODE_MAP.entrySet();
+        for (Map.Entry<Character, String> entry : defensive_entries)
+        {
+            HTML_DECODE_MAP.put(entry.getValue(), entry.getKey());
+        }
 
-		XML_ENCODE_MAP.put('\u0026',"&amp;");
-		XML_ENCODE_MAP.put('\'',"&apos;");
-		XML_ENCODE_MAP.put('\u0022',"&quot;");
-		XML_ENCODE_MAP.put('\u003C',"&lt;");
-		XML_ENCODE_MAP.put('\u003E',"&gt;");
+        XML_ENCODE_MAP.put('\u0026', "&amp;");
+        XML_ENCODE_MAP.put('\'', "&apos;");
+        XML_ENCODE_MAP.put('\u0022', "&quot;");
+        XML_ENCODE_MAP.put('\u003C', "&lt;");
+        XML_ENCODE_MAP.put('\u003E', "&gt;");
 
-		SQL_ENCODE_MAP.put('\'',"''");
+        SQL_ENCODE_MAP.put('\'', "''");
 
-		STRING_ENCODE_MAP.put('\\',"\\\\");
-		STRING_ENCODE_MAP.put('\n',"\\n");
-		STRING_ENCODE_MAP.put('\r',"\\r");
-		STRING_ENCODE_MAP.put('\t',"\\t");
-		STRING_ENCODE_MAP.put('"',"\\\"");
+        STRING_ENCODE_MAP.put('\\', "\\\\");
+        STRING_ENCODE_MAP.put('\n', "\\n");
+        STRING_ENCODE_MAP.put('\r', "\\r");
+        STRING_ENCODE_MAP.put('\t', "\\t");
+        STRING_ENCODE_MAP.put('"', "\\\"");
 
-		LATEX_ENCODE_MAP.put('\\',"\\\\");
-		LATEX_ENCODE_MAP.put('#',"\\#");
-		LATEX_ENCODE_MAP.put('$',"\\$");
-		LATEX_ENCODE_MAP.put('%',"\\%");
-		LATEX_ENCODE_MAP.put('&',"\\&");
-		LATEX_ENCODE_MAP.put('~',"\\~");
-		LATEX_ENCODE_MAP.put('_',"\\_");
-		LATEX_ENCODE_MAP.put('^',"\\^");
-		LATEX_ENCODE_MAP.put('{',"\\{");
-		LATEX_ENCODE_MAP.put('}',"\\}");
-		LATEX_ENCODE_MAP.put('\u00A1',"!'");
-		LATEX_ENCODE_MAP.put('\u00BF',"?'");
-		LATEX_ENCODE_MAP.put('\u00C0',"\\`{A}");
-		LATEX_ENCODE_MAP.put('\u00C1',"\\'{A}");
-		LATEX_ENCODE_MAP.put('\u00C2',"\\^{A}");
-		LATEX_ENCODE_MAP.put('\u00C3',"\\H{A}");
-		LATEX_ENCODE_MAP.put('\u00C4',"\\\"{A}");
-		LATEX_ENCODE_MAP.put('\u00C5',"\\AA");
-		LATEX_ENCODE_MAP.put('\u00C6',"\\AE");
-		LATEX_ENCODE_MAP.put('\u00C7',"\\c{C}");
-		LATEX_ENCODE_MAP.put('\u00C8',"\\`{E}");
-		LATEX_ENCODE_MAP.put('\u00C9',"\\'{E}");
-		LATEX_ENCODE_MAP.put('\u00CA',"\\^{E}");
-		LATEX_ENCODE_MAP.put('\u00CB',"\\\"{E}");
-		LATEX_ENCODE_MAP.put('\u00CC',"\\`{I}");
-		LATEX_ENCODE_MAP.put('\u00CD',"\\'{I}");
-		LATEX_ENCODE_MAP.put('\u00CE',"\\^{I}");
-		LATEX_ENCODE_MAP.put('\u00CF',"\\\"{I}");
+        LATEX_ENCODE_MAP.put('\\', "\\\\");
+        LATEX_ENCODE_MAP.put('#', "\\#");
+        LATEX_ENCODE_MAP.put('$', "\\$");
+        LATEX_ENCODE_MAP.put('%', "\\%");
+        LATEX_ENCODE_MAP.put('&', "\\&");
+        LATEX_ENCODE_MAP.put('~', "\\~");
+        LATEX_ENCODE_MAP.put('_', "\\_");
+        LATEX_ENCODE_MAP.put('^', "\\^");
+        LATEX_ENCODE_MAP.put('{', "\\{");
+        LATEX_ENCODE_MAP.put('}', "\\}");
+        LATEX_ENCODE_MAP.put('\u00A1', "!'");
+        LATEX_ENCODE_MAP.put('\u00BF', "?'");
+        LATEX_ENCODE_MAP.put('\u00C0', "\\`{A}");
+        LATEX_ENCODE_MAP.put('\u00C1', "\\'{A}");
+        LATEX_ENCODE_MAP.put('\u00C2', "\\^{A}");
+        LATEX_ENCODE_MAP.put('\u00C3', "\\H{A}");
+        LATEX_ENCODE_MAP.put('\u00C4', "\\\"{A}");
+        LATEX_ENCODE_MAP.put('\u00C5', "\\AA");
+        LATEX_ENCODE_MAP.put('\u00C6', "\\AE");
+        LATEX_ENCODE_MAP.put('\u00C7', "\\c{C}");
+        LATEX_ENCODE_MAP.put('\u00C8', "\\`{E}");
+        LATEX_ENCODE_MAP.put('\u00C9', "\\'{E}");
+        LATEX_ENCODE_MAP.put('\u00CA', "\\^{E}");
+        LATEX_ENCODE_MAP.put('\u00CB', "\\\"{E}");
+        LATEX_ENCODE_MAP.put('\u00CC', "\\`{I}");
+        LATEX_ENCODE_MAP.put('\u00CD', "\\'{I}");
+        LATEX_ENCODE_MAP.put('\u00CE', "\\^{I}");
+        LATEX_ENCODE_MAP.put('\u00CF', "\\\"{I}");
 // todo \u00D0
-		LATEX_ENCODE_MAP.put('\u00D1',"\\H{N}");
-		LATEX_ENCODE_MAP.put('\u00D2',"\\`{O}");
-		LATEX_ENCODE_MAP.put('\u00D3',"\\'{O}");
-		LATEX_ENCODE_MAP.put('\u00D4',"\\^{O}");
-		LATEX_ENCODE_MAP.put('\u00D5',"\\H{O}");
-		LATEX_ENCODE_MAP.put('\u00D6',"\\\"{O}");
+        LATEX_ENCODE_MAP.put('\u00D1', "\\H{N}");
+        LATEX_ENCODE_MAP.put('\u00D2', "\\`{O}");
+        LATEX_ENCODE_MAP.put('\u00D3', "\\'{O}");
+        LATEX_ENCODE_MAP.put('\u00D4', "\\^{O}");
+        LATEX_ENCODE_MAP.put('\u00D5', "\\H{O}");
+        LATEX_ENCODE_MAP.put('\u00D6', "\\\"{O}");
 // todo \u00D7
-		LATEX_ENCODE_MAP.put('\u00D8',"\\O");
-		LATEX_ENCODE_MAP.put('\u00D9',"\\`{U}");
-		LATEX_ENCODE_MAP.put('\u00DA',"\\'{U}");
-		LATEX_ENCODE_MAP.put('\u00DB',"\\^{U}");
-		LATEX_ENCODE_MAP.put('\u00DC',"\\\"{U}");
-		LATEX_ENCODE_MAP.put('\u00DD',"\\'{Y}");
+        LATEX_ENCODE_MAP.put('\u00D8', "\\O");
+        LATEX_ENCODE_MAP.put('\u00D9', "\\`{U}");
+        LATEX_ENCODE_MAP.put('\u00DA', "\\'{U}");
+        LATEX_ENCODE_MAP.put('\u00DB', "\\^{U}");
+        LATEX_ENCODE_MAP.put('\u00DC', "\\\"{U}");
+        LATEX_ENCODE_MAP.put('\u00DD', "\\'{Y}");
 // todo \u00DE
-		LATEX_ENCODE_MAP.put('\u00DF',"\\ss");
-		LATEX_ENCODE_MAP.put('\u00E0',"\\`{a}");
-		LATEX_ENCODE_MAP.put('\u00E1',"\\'{a}");
-		LATEX_ENCODE_MAP.put('\u00E2',"\\^{a}");
-		LATEX_ENCODE_MAP.put('\u00E3',"\\H{a}");
-		LATEX_ENCODE_MAP.put('\u00E4',"\\\"{a}");
-		LATEX_ENCODE_MAP.put('\u00E5',"\\aa");
-		LATEX_ENCODE_MAP.put('\u00E6',"\\ae");
-		LATEX_ENCODE_MAP.put('\u00E7',"\\c{c}");
-		LATEX_ENCODE_MAP.put('\u00E8',"\\`{e}");
-		LATEX_ENCODE_MAP.put('\u00E9',"\\'{e}");
-		LATEX_ENCODE_MAP.put('\u00EA',"\\^{e}");
-		LATEX_ENCODE_MAP.put('\u00EB',"\\\"{e}");
-		LATEX_ENCODE_MAP.put('\u00EC',"\\`{i}");
-		LATEX_ENCODE_MAP.put('\u00ED',"\\'{i}");
-		LATEX_ENCODE_MAP.put('\u00EE',"\\^{i}");
-		LATEX_ENCODE_MAP.put('\u00EF',"\\\"{i}");
+        LATEX_ENCODE_MAP.put('\u00DF', "\\ss");
+        LATEX_ENCODE_MAP.put('\u00E0', "\\`{a}");
+        LATEX_ENCODE_MAP.put('\u00E1', "\\'{a}");
+        LATEX_ENCODE_MAP.put('\u00E2', "\\^{a}");
+        LATEX_ENCODE_MAP.put('\u00E3', "\\H{a}");
+        LATEX_ENCODE_MAP.put('\u00E4', "\\\"{a}");
+        LATEX_ENCODE_MAP.put('\u00E5', "\\aa");
+        LATEX_ENCODE_MAP.put('\u00E6', "\\ae");
+        LATEX_ENCODE_MAP.put('\u00E7', "\\c{c}");
+        LATEX_ENCODE_MAP.put('\u00E8', "\\`{e}");
+        LATEX_ENCODE_MAP.put('\u00E9', "\\'{e}");
+        LATEX_ENCODE_MAP.put('\u00EA', "\\^{e}");
+        LATEX_ENCODE_MAP.put('\u00EB', "\\\"{e}");
+        LATEX_ENCODE_MAP.put('\u00EC', "\\`{i}");
+        LATEX_ENCODE_MAP.put('\u00ED', "\\'{i}");
+        LATEX_ENCODE_MAP.put('\u00EE', "\\^{i}");
+        LATEX_ENCODE_MAP.put('\u00EF', "\\\"{i}");
 // todo \u00F0
-		LATEX_ENCODE_MAP.put('\u00F1',"\\H{n}");
-		LATEX_ENCODE_MAP.put('\u00F2',"\\`{o}");
-		LATEX_ENCODE_MAP.put('\u00F3',"\\'{o}");
-		LATEX_ENCODE_MAP.put('\u00F4',"\\^{o}");
-		LATEX_ENCODE_MAP.put('\u00F5',"\\H{o}");
-		LATEX_ENCODE_MAP.put('\u00F6',"\\\"{o}");
+        LATEX_ENCODE_MAP.put('\u00F1', "\\H{n}");
+        LATEX_ENCODE_MAP.put('\u00F2', "\\`{o}");
+        LATEX_ENCODE_MAP.put('\u00F3', "\\'{o}");
+        LATEX_ENCODE_MAP.put('\u00F4', "\\^{o}");
+        LATEX_ENCODE_MAP.put('\u00F5', "\\H{o}");
+        LATEX_ENCODE_MAP.put('\u00F6', "\\\"{o}");
 // todo \u00F7
-		LATEX_ENCODE_MAP.put('\u00F8',"\\o");
-		LATEX_ENCODE_MAP.put('\u00F9',"\\`{u}");
-		LATEX_ENCODE_MAP.put('\u00FA',"\\'{u}");
-		LATEX_ENCODE_MAP.put('\u00FB',"\\^{u}");
-		LATEX_ENCODE_MAP.put('\u00FC',"\\\"{u}");
-		LATEX_ENCODE_MAP.put('\u00FD',"\\'{y}");
+        LATEX_ENCODE_MAP.put('\u00F8', "\\o");
+        LATEX_ENCODE_MAP.put('\u00F9', "\\`{u}");
+        LATEX_ENCODE_MAP.put('\u00FA', "\\'{u}");
+        LATEX_ENCODE_MAP.put('\u00FB', "\\^{u}");
+        LATEX_ENCODE_MAP.put('\u00FC', "\\\"{u}");
+        LATEX_ENCODE_MAP.put('\u00FD', "\\'{y}");
 // todo \u00FE
-		LATEX_ENCODE_MAP.put('\u00FF',"\\\"{y}");
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * containing only valid characters for a java class name.
-	 *
-	 * @param name The string that has to be transformed into a valid class
-	 * name.
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeUrl(String)
-	 * @see #encodeHtml(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeLatex(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeClassname(String name)
-	{
-		if (null == name)
-		{
-			return null;
-		}
-
-		Pattern pattern = Pattern.compile("[^\\w]");
-		Matcher matcher = pattern.matcher(name);
-
-		return matcher.replaceAll("_");
-	}
-
-	private static boolean needsUrlEncoding(String source)
-	{
-		if (null == source)
-		{
-			return false;
-		}
-
-		// check if the string needs encoding first since
-		// the URLEncoder always allocates a StringBuffer, even when the
-		// string is returned as-is
-		boolean encode = false;
-		char ch;
-		for (int i = 0; i < source.length(); i++)
-		{
-			ch = source.charAt(i);
-
-			if (ch >= 'a' && ch <= 'z' ||
-				ch >= 'A' && ch <= 'Z' ||
-				ch >= '0' && ch <= '9' ||
-				ch == '-' || ch == '_' || ch == '.' || ch == '*')
-			{
-				continue;
-			}
-
-			encode = true;
-			break;
-		}
-
-		return encode;
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * containing only valid URL characters.
-	 *
-	 * @param source The string that has to be transformed into a valid URL
-	 * string.
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrlValue(String)
-	 * @see #encodeHtml(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeLatex(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeUrl(String source)
-	{
-		if (!needsUrlEncoding(source))
-		{
-			return source;
-		}
-
-		try
-		{
-			return URLEncoder.encode(source, ENCODING_ISO_8859_1);
-		}
-		///CLOVER:OFF
-		catch (UnsupportedEncodingException e)
-		{
-			// this should never happen, ISO-8859-1 is a standard encoding
-			throw new RuntimeException(e);
-		}
-		///CLOVER:ON
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * only pure US Ascii strings are preserved and URL encoded in a regular
-	 * way. Strings with characters from other encodings will be encoded in a
-	 * RIFE-specific manner to allow international data to passed along the
-	 * query string.
-	 *
-	 * @param source The string that has to be transformed into a valid URL
-	 * parameter string.
-	 * @return The encoded <code>String</code> object.
-	 * @see #decodeUrlValue(String)
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrl(String)
-	 * @see #encodeHtml(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeLatex(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeUrlValue(String source)
-	{
-		if (!needsUrlEncoding(source))
-		{
-			return source;
-		}
-
-		// check if the string is valid US-ASCII encoding
-		boolean         valid = true;
-		CharsetEncoder encoder = CHARSET_US_ASCII.newEncoder();
-		try
-		{
-			encoder.encode(CharBuffer.wrap(source));
-		}
-		catch (CharacterCodingException e)
-		{
-			valid = false;
-		}
-
-		try
-		{
-			// if it is valid US-ASCII, use the regular URL encoding method
-			if (valid)
-			{
-					return URLEncoder.encode(source, ENCODING_US_ASCII);
-			}
-			// otherwise, base-64 encode the UTF-8 bytes and mark the string
-			// as being encoded in a special way
-			else
-			{
-				StringBuilder encoded = new StringBuilder("%02%02");
-				String base64 = Base64.encodeToString(source.getBytes(ENCODING_UTF_8), false);
-				String base64_urlsafe = replace(base64, "=", "%3D");
-				encoded.append(base64_urlsafe);
-
-				return encoded.toString();
-			}
-		}
-		///CLOVER:OFF
-		catch (UnsupportedEncodingException e)
-		{
-			// this should never happen, ISO-8859-1 is a standard encoding
-			throw new RuntimeException(e);
-		}
-		///CLOVER:ON
-	}
-
-	/**
-	 * Decodes a <code>String</code> that has been encoded in a RIFE-specific
-	 * manner for URL usage.. Before calling this method, you should first
-	 * verify if the value needs decoding by using the
-	 * <code>doesUrlValueNeedDecoding(String)</code> method.
-	 *
-	 * @param source the value that has been encoded for URL usage in a
-	 * RIFE-specific way
-	 * @return The decoded <code>String</code> object.
-	 * @see #encodeUrlValue(String)
-	 * @see #doesUrlValueNeedDecoding(String)
-	 * @since 1.0
-	 */
-	public static String decodeUrlValue(String source)
-	{
-		try
-		{
-			byte[] decoded = Base64.decode(source.substring(2));
-			if (null == decoded)
-			{
-				return null;
-			}
-			else
-			{
-				return new String(decoded, StringUtils.ENCODING_UTF_8);
-			}
-		}
-		///CLOVER:OFF
-		catch (UnsupportedEncodingException e)
-		{
-			// this should never happen, UTF-8 is a standard encoding
-			throw new RuntimeException(e);
-		}
-		///CLOVER:ON
-	}
-
-	/**
-	 * Checks if a <code>String</code> is encoded in a RIFE-specific manner
-	 * for URL usage.
-	 *
-	 * @param source the value that might have been encoded for URL usage in a
-	 * RIFE-specific way
-	 * @return <code>true</code> if the value is encoded in the RIFE-specific
-	 * format; and
-	 * <p><code>false</code> otherwise
-	 * @see #encodeUrlValue(String)
-	 * @see #decodeUrlValue(String)
-	 * @since 1.0
-	 */
-	public static boolean doesUrlValueNeedDecoding(String source)
-	{
-		if (source != null &&
-			source.length() > 2 &&
-			source.startsWith("\u0002\u0002"))
-		{
-			return true;
-		}
-
-		return false;
-	}
-
-	private static boolean needsHtmlEncoding(String source, boolean defensive)
-	{
-		if (null == source)
-		{
-			return false;
-		}
-
-		boolean encode = false;
-		char ch;
-		for (int i = 0; i < source.length(); i++)
-		{
-			ch = source.charAt(i);
-
-			if ((defensive || (ch != '\u0022' && ch != '\u0026' && ch != '\u003C' && ch != '\u003E')) &&
-				ch < '\u00A0')
-			{
-				continue;
-			}
-
-			encode = true;
-			break;
-		}
-
-		return encode;
-	}
-
-	/**
-	 *
-	 * @since 1.6
-	 */
-	public static String decodeHtml(String source)
-	{
-		if (null == source ||
-			0 == source.length())
-		{
-			return source;
-		}
-
-		int		current_index = 0;
-		int		delimiter_start_index = 0;
-		int		delimiter_end_index = 0;
-
-		StringBuilder result = null;
-
-		while (current_index <= source.length())
-		{
-			delimiter_start_index = source.indexOf('&', current_index);
-			if (delimiter_start_index != -1)
-			{
-				delimiter_end_index = source.indexOf(';', delimiter_start_index + 1);
-				if (delimiter_end_index != -1)
-				{
-					// ensure that the string builder is setup correctly
-					if (null == result)
-					{
-						result = new StringBuilder();
-					}
-
-					// add the text that leads up to this match
-					if (delimiter_start_index > current_index)
-					{
-						result.append(source.substring(current_index, delimiter_start_index));
-					}
-
-					// add the decoded entity
-					String entity = source.substring(delimiter_start_index, delimiter_end_index + 1);
-
-					current_index = delimiter_end_index + 1;
-
-					// try to decoded numeric entities
-					if (entity.charAt(1) == '#')
-					{
-						int start = 2;
-						int radix = 10;
-						// check if the number is hexadecimal
-						if (entity.charAt(2) == 'X' || entity.charAt(2) == 'x')
-						{
-							start++;
-							radix = 16;
-						}
-						try
-						{
-							Character c = new Character((char)Integer.parseInt(entity.substring(start, entity.length() - 1), radix));
-							result.append(c);
-						}
-						// when the number of the entity can't be parsed, add the entity as-is
-						catch (NumberFormatException e)
-						{
-							result.append(entity);
-						}
-					}
-					else
-					{
-						// try to decode the entity as a literal
-						Character decoded = HTML_DECODE_MAP.get(entity);
-						if (decoded != null)
-						{
-							result.append(decoded);
-						}
-						// if there was no match, add the entity as-is
-						else
-						{
-							result.append(entity);
-						}
-					}
-				}
-				else
-				{
-					break;
-				}
-			}
-			else
-			{
-				break;
-			}
-		}
-
-		if (null == result)
-		{
-			return source;
-		}
-		else if (current_index < source.length())
-		{
-			result.append(source.substring(current_index));
-		}
-
-		return result.toString();
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * containing only valid Html characters.
-	 *
-	 * @param source The string that has to be transformed into a valid Html
-	 * string.
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrl(String)
-	 * @see #encodeUrlValue(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeString(String)
-	 * @see #encodeLatex(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeHtml(String source)
-	{
-		if (needsHtmlEncoding(source, false))
-		{
-			return encode(source, HTML_ENCODER_FALLBACK, AGGRESSIVE_HTML_ENCODE_MAP, DEFENSIVE_HTML_ENCODE_MAP);
-		}
-		return source;
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * containing as much as possible Html characters. It is safe to already
-	 * feed existing Html to this method since &amp;, &lt; and &gt; will not
-	 * be encoded.
-	 *
-	 * @param source The string that has to be transformed into a valid Html
-	 * string.
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrl(String)
-	 * @see #encodeUrlValue(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeString(String)
-	 * @see #encodeLatex(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeHtmlDefensive(String source)
-	{
-		if (needsHtmlEncoding(source, true))
-		{
-			return encode(source, null, DEFENSIVE_HTML_ENCODE_MAP);
-		}
-		return source;
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * containing only valid XML characters.
-	 *
-	 * @param source The string that has to be transformed into a valid XML
-	 * string.
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrl(String)
-	 * @see #encodeUrlValue(String)
-	 * @see #encodeHtml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeString(String)
-	 * @see #encodeLatex(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeXml(String source)
-	{
-		return encode(source, null, XML_ENCODE_MAP);
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * containing only valid <code>String</code> characters.
-	 *
-	 * @param source The string that has to be transformed into a valid
-	 * sequence of <code>String</code> characters.
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrl(String)
-	 * @see #encodeUrlValue(String)
-	 * @see #encodeHtml(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeLatex(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeString(String source)
-	{
-		return encode(source, null, STRING_ENCODE_MAP);
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a series of
-	 * unicode escape codes.
-	 *
-	 * @param source The string that has to be transformed into a valid
-	 * sequence of unicode escape codes
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrl(String)
-	 * @see #encodeUrlValue(String)
-	 * @see #encodeHtml(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeLatex(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeUnicode(String source)
-	{
-		if (null == source)
-		{
-			return null;
-		}
-
-		StringBuilder	encoded = new StringBuilder();
-		String			hexstring = null;
-		for (int i = 0; i < source.length(); i++)
-		{
-			hexstring = Integer.toHexString((int)source.charAt(i)).toUpperCase();
-			encoded.append("\\u");
-			// fill with zeros
-			for (int j = hexstring.length(); j < 4; j++)
-			{
-				encoded.append("0");
-			}
-			encoded.append(hexstring);
-		}
-
-		return encoded.toString();
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * containing only valid Sql characters.
-	 *
-	 * @param source The string that has to be transformed into a valid Sql
-	 * string.
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrl(String)
-	 * @see #encodeUrlValue(String)
-	 * @see #encodeHtml(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeString(String)
-	 * @see #encodeLatex(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeSql(String source)
-	{
-		return encode(source, null, SQL_ENCODE_MAP);
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * containing only valid LaTeX characters.
-	 *
-	 * @param source The string that has to be transformed into a valid LaTeX
-	 * string.
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrl(String)
-	 * @see #encodeUrlValue(String)
-	 * @see #encodeHtml(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeString(String)
-	 * @see #encodeRegexp(String)
-	 * @since 1.0
-	 */
-	public static String encodeLatex(String source)
-	{
-		if (null == source)
-		{
-			return null;
-		}
-
-		source = encode(source, null, LATEX_ENCODE_MAP);
-		source = StringUtils.replace(source, "latex", "\\LaTeX", false);
-
-		return source;
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a new string,
-	 * using the mapping that are provided through the supplied encoding
-	 * table.
-	 *
-	 * @param source The string that has to be transformed into a valid
-	 * string, using the mappings that are provided through the supplied
-	 * encoding table.
-	 * @param encodingTables A <code>Map</code> object containing the mappings
-	 * to transform characters into valid entities. The keys of this map
-	 * should be <code>Character</code> objects and the values
-	 * <code>String</code> objects.
-	 * @return The encoded <code>String</code> object.
-	 * @since 1.0
-	 */
-	private static String encode(String source, EncoderFallbackHandler fallbackHandler, Map<Character, String>... encodingTables)
-	{
-		if (null == source)
-		{
-			return null;
-		}
-
-		if (null == encodingTables ||
-			0 == encodingTables.length)
-		{
-			return source;
-		}
-
-		StringBuilder	encoded_string = null;
-		char[]			string_to_encode_array = source.toCharArray();
-		int				last_match = -1;
-
-		for (int i = 0; i < string_to_encode_array.length; i++)
-		{
-			char char_to_encode = string_to_encode_array[i];
-			for (Map<Character, String> encoding_table : encodingTables)
-			{
-				if (encoding_table.containsKey(char_to_encode))
-				{
-					encoded_string = prepareEncodedString(source, encoded_string, i, last_match, string_to_encode_array);
-
-					encoded_string.append(encoding_table.get(char_to_encode));
-					last_match = i;
-				}
-			}
-
-			if (fallbackHandler != null &&
-				last_match < i &&
-				fallbackHandler.hasFallback(char_to_encode))
-			{
-				encoded_string = prepareEncodedString(source, encoded_string, i, last_match, string_to_encode_array);
-
-				fallbackHandler.appendFallback(encoded_string, char_to_encode);
-				last_match = i;
-			}
-		}
-
-		if (null == encoded_string)
-		{
-			return source;
-		}
-		else
-		{
-			int difference = string_to_encode_array.length-(last_match+1);
-			if (difference > 0)
-			{
-				encoded_string.append(string_to_encode_array, last_match+1, difference);
-			}
-			return encoded_string.toString();
-		}
-	}
-
-	private static StringBuilder prepareEncodedString(String source, StringBuilder encodedString, int i, int lastMatch, char[] stringToEncodeArray)
-	{
-		if (null == encodedString)
-		{
-			encodedString = new StringBuilder(source.length());
-		}
-
-		int difference = i - (lastMatch + 1);
-		if (difference > 0)
-		{
-			encodedString.append(stringToEncodeArray, lastMatch + 1, difference);
-		}
-
-		return encodedString;
-	}
-
-	private static interface EncoderFallbackHandler
-	{
-		abstract boolean hasFallback(char character);
-		abstract void appendFallback(StringBuilder encodedBuffer, char character);
-	}
-
-	private static class HtmlEncoderFallbackHandler implements EncoderFallbackHandler
-	{
-		private final static String PREFIX = "&#";
-		private final static String SUFFIX = ";";
-
-		public boolean hasFallback(char character)
-		{
-			if (character < '\u00A0')
-			{
-				return false;
-			}
-
-			return true;
-		}
-
-		public void appendFallback(StringBuilder encodedBuffer, char character)
-		{
-			encodedBuffer.append(PREFIX);
-			encodedBuffer.append((int)character);
-			encodedBuffer.append(SUFFIX);
-		}
-	}
-
-	/**
-	 * Transforms a provided <code>String</code> object into a literal that can
-	 * be included into a regular expression {@link Pattern} as-is. None of the
-	 * regular expression escapes in the string will be functional anymore.
-	 *
-	 * @param source The string that has to be escaped as a literal
-	 * @return The encoded <code>String</code> object.
-	 * @see #encodeClassname(String)
-	 * @see #encodeUrl(String)
-	 * @see #encodeUrlValue(String)
-	 * @see #encodeHtml(String)
-	 * @see #encodeXml(String)
-	 * @see #encodeSql(String)
-	 * @see #encodeString(String)
-	 * @see #encodeLatex(String)
-	 * @since 1.3
-	 */
-    public static String encodeRegexp(String source)
-	{
-        int regexp_quote_start = source.indexOf("\\E");
-        if (-1 == regexp_quote_start)
-		{
-			return "\\Q" + source + "\\E";
-		}
-
-        StringBuilder buffer = new StringBuilder(source.length() * 2);
-		buffer.append("\\Q");
-
-		regexp_quote_start = 0;
-
-		int current = 0;
-		while (-1 == (regexp_quote_start = source.indexOf("\\E", current)))
-		{
-			buffer.append(source.substring(current, regexp_quote_start));
-			current = regexp_quote_start + 2;
-			buffer.append("\\E\\\\E\\Q");
-		}
-
-		buffer.append(source.substring(current, source.length()));
-		buffer.append("\\E");
-
-		return buffer.toString();
+        LATEX_ENCODE_MAP.put('\u00FF', "\\\"{y}");
     }
 
-	/**
-	 * Counts the number of times a substring occures in a provided string in
-	 * a case-sensitive manner.
-	 *
-	 * @param source The <code>String</code> object that will be searched in.
-	 * @param substring The string whose occurances will we counted.
-	 * @return An <code>int</code> value containing the number of occurances
-	 * of the substring.
-	 * @since 1.0
-	 */
-	public static int count(String source, String substring)
-	{
-		return count(source, substring, true);
-	}
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * containing only valid characters for a java class name.
+     *
+     * @param name The string that has to be transformed into a valid class
+     *             name.
+     * @return The encoded <code>String</code> object.
+     * @see #encodeUrl(String)
+     * @see #encodeHtml(String)
+     * @see #encodeXml(String)
+     * @see #encodeSql(String)
+     * @see #encodeLatex(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeClassname(String name)
+    {
+        if (null == name)
+        {
+            return null;
+        }
 
-	/**
-	 * Counts the number of times a substring occures in a provided string.
-	 *
-	 * @param source The <code>String</code> object that will be searched in.
-	 * @param substring The string whose occurances will we counted.
-	 * @param matchCase A <code>boolean</code> indicating if the match is
-	 * going to be performed in a case-sensitive manner or not.
-	 * @return An <code>int</code> value containing the number of occurances
-	 * of the substring.
-	 * @since 1.0
-	 */
-	public static int count(String source, String substring, boolean matchCase)
-	{
-		if (null == source)
-		{
-			return 0;
-		}
+        Pattern pattern = Pattern.compile("[^\\w]");
+        Matcher matcher = pattern.matcher(name);
 
-		if (null == substring)
-		{
-			return 0;
-		}
+        return matcher.replaceAll("_");
+    }
 
-		int current_index = 0;
-		int substring_index = 0;
-		int count = 0;
+    private static boolean needsUrlEncoding(String source)
+    {
+        if (null == source)
+        {
+            return false;
+        }
 
-		if (!matchCase)
-		{
-			source = source.toLowerCase();
-			substring = substring.toLowerCase();
-		}
+        // check if the string needs encoding first since
+        // the URLEncoder always allocates a StringBuffer, even when the
+        // string is returned as-is
+        boolean encode = false;
+        char ch;
+        for (int i = 0; i < source.length(); i++)
+        {
+            ch = source.charAt(i);
 
-		while (current_index < source.length()-1)
-		{
-			substring_index = source.indexOf(substring, current_index);
+            if (ch >= 'a' && ch <= 'z' ||
+                    ch >= 'A' && ch <= 'Z' ||
+                    ch >= '0' && ch <= '9' ||
+                    ch == '-' || ch == '_' || ch == '.' || ch == '*')
+            {
+                continue;
+            }
 
-			if (-1 == substring_index)
-			{
-				break;
-			}
-			else
-			{
-				current_index = substring_index + substring.length();
-				count++;
-			}
-		}
+            encode = true;
+            break;
+        }
 
-		return count;
-	}
+        return encode;
+    }
 
-	/**
-	 * Splits a string into different parts, using a seperator string to
-	 * detect the seperation boundaries in a case-sensitive manner. The
-	 * seperator will not be included in the list of parts.
-	 *
-	 * @param source The string that will be split into parts.
-	 * @param seperator The seperator string that will be used to determine
-	 * the parts.
-	 * @return An <code>ArrayList</code> containing the parts as
-	 * <code>String</code> objects.
-	 * @since 1.0
-	 */
-	public static ArrayList<String> split(String source, String seperator)
-	{
-		return split(source, seperator, true);
-	}
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * containing only valid URL characters.
+     *
+     * @param source The string that has to be transformed into a valid URL
+     *               string.
+     * @return The encoded <code>String</code> object.
+     * @see #encodeClassname(String)
+     * @see #encodeUrlValue(String)
+     * @see #encodeHtml(String)
+     * @see #encodeXml(String)
+     * @see #encodeSql(String)
+     * @see #encodeLatex(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeUrl(String source)
+    {
+        if (!needsUrlEncoding(source))
+        {
+            return source;
+        }
 
-	/**
-	 * Splits a string into different parts, using a seperator string to
-	 * detect the seperation boundaries. The seperator will not be included in
-	 * the list of parts.
-	 *
-	 * @param source The string that will be split into parts.
-	 * @param seperator The seperator string that will be used to determine
-	 * the parts.
-	 * @param matchCase A <code>boolean</code> indicating if the match is
-	 * going to be performed in a case-sensitive manner or not.
-	 * @return An <code>ArrayList</code> containing the parts as
-	 * <code>String</code> objects.
-	 * @since 1.0
-	 */
-	public static ArrayList<String> split(String source, String seperator, boolean matchCase)
-	{
-		ArrayList<String>   substrings = new ArrayList<String>();
+        try
+        {
+            return URLEncoder.encode(source, ENCODING_ISO_8859_1);
+        }
+        ///CLOVER:OFF
+        catch (UnsupportedEncodingException e)
+        {
+            // this should never happen, ISO-8859-1 is a standard encoding
+            throw new RuntimeException(e);
+        }
+        ///CLOVER:ON
+    }
 
-		if (null == source)
-		{
-			return substrings;
-		}
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * only pure US Ascii strings are preserved and URL encoded in a regular
+     * way. Strings with characters from other encodings will be encoded in a
+     * RIFE-specific manner to allow international data to passed along the
+     * query string.
+     *
+     * @param source The string that has to be transformed into a valid URL
+     *               parameter string.
+     * @return The encoded <code>String</code> object.
+     * @see #decodeUrlValue(String)
+     * @see #encodeClassname(String)
+     * @see #encodeUrl(String)
+     * @see #encodeHtml(String)
+     * @see #encodeXml(String)
+     * @see #encodeSql(String)
+     * @see #encodeLatex(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeUrlValue(String source)
+    {
+        if (!needsUrlEncoding(source))
+        {
+            return source;
+        }
 
-		if (null == seperator)
-		{
-			substrings.add(source);
-			return substrings;
-		}
+        // check if the string is valid US-ASCII encoding
+        boolean valid = true;
+        CharsetEncoder encoder = CHARSET_US_ASCII.newEncoder();
+        try
+        {
+            encoder.encode(CharBuffer.wrap(source));
+        }
+        catch (CharacterCodingException e)
+        {
+            valid = false;
+        }
 
-		int		current_index = 0;
-		int		delimiter_index = 0;
-		String	element = null;
+        try
+        {
+            // if it is valid US-ASCII, use the regular URL encoding method
+            if (valid)
+            {
+                return URLEncoder.encode(source, ENCODING_US_ASCII);
+            }
+            // otherwise, base-64 encode the UTF-8 bytes and mark the string
+            // as being encoded in a special way
+            else
+            {
+                StringBuilder encoded = new StringBuilder("%02%02");
+                String base64 = Base64.encodeToString(source.getBytes(ENCODING_UTF_8), false);
+                String base64_urlsafe = replace(base64, "=", "%3D");
+                encoded.append(base64_urlsafe);
 
-		String  source_lookup_reference = null;
-		if (!matchCase)
-		{
-			source_lookup_reference = source.toLowerCase();
-			seperator = seperator.toLowerCase();
-		}
-		else
-		{
-			source_lookup_reference = source;
-		}
+                return encoded.toString();
+            }
+        }
+        ///CLOVER:OFF
+        catch (UnsupportedEncodingException e)
+        {
+            // this should never happen, ISO-8859-1 is a standard encoding
+            throw new RuntimeException(e);
+        }
+        ///CLOVER:ON
+    }
 
-		while (current_index <= source_lookup_reference.length())
-		{
-			delimiter_index = source_lookup_reference.indexOf(seperator, current_index);
+    /**
+     * Decodes a <code>String</code> that has been encoded in a RIFE-specific
+     * manner for URL usage.. Before calling this method, you should first
+     * verify if the value needs decoding by using the
+     * <code>doesUrlValueNeedDecoding(String)</code> method.
+     *
+     * @param source the value that has been encoded for URL usage in a
+     *               RIFE-specific way
+     * @return The decoded <code>String</code> object.
+     * @see #encodeUrlValue(String)
+     * @see #doesUrlValueNeedDecoding(String)
+     * @since 1.0
+     */
+    public static String decodeUrlValue(String source)
+    {
+        try
+        {
+            byte[] decoded = Base64.decode(source.substring(2));
+            if (null == decoded)
+            {
+                return null;
+            } else
+            {
+                return new String(decoded, StringUtils.ENCODING_UTF_8);
+            }
+        }
+        ///CLOVER:OFF
+        catch (UnsupportedEncodingException e)
+        {
+            // this should never happen, UTF-8 is a standard encoding
+            throw new RuntimeException(e);
+        }
+        ///CLOVER:ON
+    }
 
-			if (-1 == delimiter_index)
-			{
-				element = new String(source.substring(current_index, source.length()));
-				substrings.add(element);
-				current_index = source.length() + 1;
-			}
-			else
-			{
-				element = new String(source.substring(current_index, delimiter_index));
-				substrings.add(element);
-				current_index = delimiter_index + seperator.length();
-			}
-		}
+    /**
+     * Checks if a <code>String</code> is encoded in a RIFE-specific manner
+     * for URL usage.
+     *
+     * @param source the value that might have been encoded for URL usage in a
+     *               RIFE-specific way
+     * @return <code>true</code> if the value is encoded in the RIFE-specific
+     *         format; and
+     *         <p><code>false</code> otherwise
+     * @see #encodeUrlValue(String)
+     * @see #decodeUrlValue(String)
+     * @since 1.0
+     */
+    public static boolean doesUrlValueNeedDecoding(String source)
+    {
+        if (source != null &&
+                source.length() > 2 &&
+                source.startsWith("\u0002\u0002"))
+        {
+            return true;
+        }
 
-		return substrings;
-	}
+        return false;
+    }
 
-	/**
-	 * Splits a string into different parts, using a seperator string to
-	 * detect the seperation boundaries in a case-sensitive manner. The
-	 * seperator will not be included in the parts array.
-	 *
-	 * @param source The string that will be split into parts.
-	 * @param seperator The seperator string that will be used to determine
-	 * the parts.
-	 * @return A <code>String[]</code> array containing the seperated parts.
-	 * @since 1.0
-	 */
-	public static String[] splitToArray(String source, String seperator)
-	{
-		return splitToArray(source, seperator, true);
-	}
+    private static boolean needsHtmlEncoding(String source, boolean defensive)
+    {
+        if (null == source)
+        {
+            return false;
+        }
 
-	/**
-	 * Splits a string into different parts, using a seperator string to
-	 * detect the seperation boundaries. The seperator will not be included in
-	 * the parts array.
-	 *
-	 * @param source The string that will be split into parts.
-	 * @param seperator The seperator string that will be used to determine
-	 * the parts.
-	 * @param matchCase A <code>boolean</code> indicating if the match is
-	 * going to be performed in a case-sensitive manner or not.
-	 * @return A <code>String[]</code> array containing the seperated parts.
-	 * @since 1.0
-	 */
-	public static String[] splitToArray(String source, String seperator, boolean matchCase)
-	{
-		ArrayList<String>   substrings = split(source, seperator, matchCase);
-		String[]            substrings_array = new String[substrings.size()];
-		substrings_array = substrings.toArray(substrings_array);
+        boolean encode = false;
+        char ch;
+        for (int i = 0; i < source.length(); i++)
+        {
+            ch = source.charAt(i);
 
-		return substrings_array;
-	}
+            if ((defensive || (ch != '\u0022' && ch != '\u0026' && ch != '\u003C' && ch != '\u003E')) &&
+                    ch < '\u00A0')
+            {
+                continue;
+            }
 
-	/**
-	 * Splits a string into integers, using a seperator string to detect the
-	 * seperation boundaries in a case-sensitive manner. If a part couldn't be
-	 * converted to an integer, it will be omitted from the resulting array.
-	 *
-	 * @param source The string that will be split into integers.
-	 * @param seperator The seperator string that will be used to determine
-	 * the parts.
-	 * @return An <code>int[]</code> array containing the seperated parts.
-	 * @since 1.0
-	 */
-	public static int[] splitToIntArray(String source, String seperator)
-	{
-		return splitToIntArray(source, seperator, true);
-	}
+            encode = true;
+            break;
+        }
 
-	/**
-	 * Splits a string into integers, using a seperator string to detect the
-	 * seperation boundaries. If a part couldn't be converted to an integer,
-	 * it will be omitted from the resulting array.
-	 *
-	 * @param source The string that will be split into integers.
-	 * @param seperator The seperator string that will be used to determine
-	 * the parts.
-	 * @param matchCase A <code>boolean</code> indicating if the match is
-	 * going to be performed in a case-sensitive manner or not.
-	 * @return An <code>int[]</code> array containing the seperated parts.
-	 * @since 1.0
-	 */
-	public static int[] splitToIntArray(String source, String seperator, boolean matchCase)
-	{
-		ArrayList<String>   string_parts = split(source, seperator, matchCase);
-		int                 number_of_valid_parts = 0;
+        return encode;
+    }
 
-		for (String string_part : string_parts)
-		{
-			try
-			{
-				Integer.parseInt(string_part);
-				number_of_valid_parts++;
-			}
-			catch (NumberFormatException e)
-			{
-				// just continue
-			}
-		}
+    /**
+     * @since 1.6
+     */
+    public static String decodeHtml(String source)
+    {
+        if (null == source ||
+                0 == source.length())
+        {
+            return source;
+        }
 
-		int[]   string_parts_int = (int[]) Array.newInstance(int.class, number_of_valid_parts);
-		int     added_parts = 0;
+        int current_index = 0;
+        int delimiter_start_index = 0;
+        int delimiter_end_index = 0;
 
-		for (String string_part : string_parts)
-		{
-			try
-			{
-				string_parts_int[added_parts] = Integer.parseInt(string_part);
-				added_parts++;
-			}
-			catch (NumberFormatException e)
-			{
-				// just continue
-			}
-		}
+        StringBuilder result = null;
 
-		return string_parts_int;
-	}
+        while (current_index <= source.length())
+        {
+            delimiter_start_index = source.indexOf('&', current_index);
+            if (delimiter_start_index != -1)
+            {
+                delimiter_end_index = source.indexOf(';', delimiter_start_index + 1);
+                if (delimiter_end_index != -1)
+                {
+                    // ensure that the string builder is setup correctly
+                    if (null == result)
+                    {
+                        result = new StringBuilder();
+                    }
 
-	/**
-	 * Splits a string into bytes, using a seperator string to detect the
-	 * seperation boundaries in a case-sensitive manner. If a part couldn't be
-	 * converted to a <code>byte</code>, it will be omitted from the resulting
-	 * array.
-	 *
-	 * @param source The string that will be split into bytes.
-	 * @param seperator The seperator string that will be used to determine
-	 * the parts.
-	 * @return A <code>byte[]</code> array containing the bytes.
-	 * @since 1.0
-	 */
-	public static byte[] splitToByteArray(String source, String seperator)
-	{
-		return splitToByteArray(source, seperator, true);
-	}
+                    // add the text that leads up to this match
+                    if (delimiter_start_index > current_index)
+                    {
+                        result.append(source.substring(current_index, delimiter_start_index));
+                    }
 
-	/**
-	 * Splits a string into bytes, using a seperator string to detect the
-	 * seperation boundaries. If a part couldn't be converted to a
-	 * <code>byte</code>, it will be omitted from the resulting array.
-	 *
-	 * @param source The string that will be split into bytes.
-	 * @param seperator The seperator string that will be used to determine
-	 * the parts.
-	 * @param matchCase A <code>boolean</code> indicating if the match is
-	 * going to be performed in a case-sensitive manner or not.
-	 * @return A <code>byte[]</code> array containing the bytes.
-	 * @since 1.0
-	 */
-	public static byte[] splitToByteArray(String source, String seperator, boolean matchCase)
-	{
-		ArrayList<String>   string_parts = split(source, seperator, matchCase);
-		int                 number_of_valid_parts = 0;
-		for (String string_part : string_parts)
-		{
-			try
-			{
-				Byte.parseByte(string_part);
-				number_of_valid_parts++;
-			}
-			catch (NumberFormatException e)
-			{
-				// just continue
-			}
-		}
+                    // add the decoded entity
+                    String entity = source.substring(delimiter_start_index, delimiter_end_index + 1);
 
-		byte[]  string_parts_byte = (byte[])Array.newInstance(byte.class, number_of_valid_parts);
-		int     added_parts = 0;
-		for (String string_part : string_parts)
-		{
-			try
-			{
-				string_parts_byte[added_parts] = Byte.parseByte(string_part);
-				added_parts++;
-			}
-			catch (NumberFormatException e)
-			{
-				// just continue
-			}
-		}
+                    current_index = delimiter_end_index + 1;
 
-		return string_parts_byte;
-	}
+                    // try to decoded numeric entities
+                    if (entity.charAt(1) == '#')
+                    {
+                        int start = 2;
+                        int radix = 10;
+                        // check if the number is hexadecimal
+                        if (entity.charAt(2) == 'X' || entity.charAt(2) == 'x')
+                        {
+                            start++;
+                            radix = 16;
+                        }
+                        try
+                        {
+                            Character c = new Character((char) Integer.parseInt(entity.substring(start, entity.length() - 1), radix));
+                            result.append(c);
+                        }
+                        // when the number of the entity can't be parsed, add the entity as-is
+                        catch (NumberFormatException e)
+                        {
+                            result.append(entity);
+                        }
+                    } else
+                    {
+                        // try to decode the entity as a literal
+                        Character decoded = HTML_DECODE_MAP.get(entity);
+                        if (decoded != null)
+                        {
+                            result.append(decoded);
+                        }
+                        // if there was no match, add the entity as-is
+                        else
+                        {
+                            result.append(entity);
+                        }
+                    }
+                } else
+                {
+                    break;
+                }
+            } else
+            {
+                break;
+            }
+        }
 
-	/**
-	 * Removes all occurances of a string from the front of another string in
-	 * a case-sensitive manner.
-	 *
-	 * @param source The string in which the matching will be done.
-	 * @param stringToStrip The string that will be stripped from the front.
-	 * @return A new <code>String</code> containing the stripped result.
-	 * @since 1.0
-	 */
-	public static String stripFromFront(String source, String stringToStrip)
-	{
-		return stripFromFront(source, stringToStrip, true);
-	}
+        if (null == result)
+        {
+            return source;
+        } else if (current_index < source.length())
+        {
+            result.append(source.substring(current_index));
+        }
 
-	/**
-	 * Removes all occurances of a string from the front of another string.
-	 *
-	 * @param source The string in which the matching will be done.
-	 * @param stringToStrip The string that will be stripped from the front.
-	 * @param matchCase A <code>boolean</code> indicating if the match is
-	 * going to be performed in a case-sensitive manner or not.
-	 * @return A new <code>String</code> containing the stripping result.
-	 * @since 1.0
-	 */
-	public static String stripFromFront(String source, String stringToStrip, boolean matchCase)
-	{
-		if (null == source)
-		{
-			return null;
-		}
+        return result.toString();
+    }
 
-		if (null == stringToStrip)
-		{
-			return source;
-		}
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * containing only valid Html characters.
+     *
+     * @param source The string that has to be transformed into a valid Html
+     *               string.
+     * @return The encoded <code>String</code> object.
+     * @see #encodeClassname(String)
+     * @see #encodeUrl(String)
+     * @see #encodeUrlValue(String)
+     * @see #encodeXml(String)
+     * @see #encodeSql(String)
+     * @see #encodeString(String)
+     * @see #encodeLatex(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeHtml(String source)
+    {
+        if (needsHtmlEncoding(source, false))
+        {
+            return encode(source, HTML_ENCODER_FALLBACK, AGGRESSIVE_HTML_ENCODE_MAP, DEFENSIVE_HTML_ENCODE_MAP);
+        }
+        return source;
+    }
 
-		int strip_length = stringToStrip.length();
-		int new_index = 0;
-		int last_index = 0;
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * containing as much as possible Html characters. It is safe to already
+     * feed existing Html to this method since &amp;, &lt; and &gt; will not
+     * be encoded.
+     *
+     * @param source The string that has to be transformed into a valid Html
+     *               string.
+     * @return The encoded <code>String</code> object.
+     * @see #encodeClassname(String)
+     * @see #encodeUrl(String)
+     * @see #encodeUrlValue(String)
+     * @see #encodeXml(String)
+     * @see #encodeSql(String)
+     * @see #encodeString(String)
+     * @see #encodeLatex(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeHtmlDefensive(String source)
+    {
+        if (needsHtmlEncoding(source, true))
+        {
+            return encode(source, null, DEFENSIVE_HTML_ENCODE_MAP);
+        }
+        return source;
+    }
 
-		String  source_lookup_reference = null;
-		if (!matchCase)
-		{
-			source_lookup_reference = source.toLowerCase();
-			stringToStrip = stringToStrip.toLowerCase();
-		}
-		else
-		{
-			source_lookup_reference = source;
-		}
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * containing only valid XML characters.
+     *
+     * @param source The string that has to be transformed into a valid XML
+     *               string.
+     * @return The encoded <code>String</code> object.
+     * @see #encodeClassname(String)
+     * @see #encodeUrl(String)
+     * @see #encodeUrlValue(String)
+     * @see #encodeHtml(String)
+     * @see #encodeSql(String)
+     * @see #encodeString(String)
+     * @see #encodeLatex(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeXml(String source)
+    {
+        return encode(source, null, XML_ENCODE_MAP);
+    }
 
-		new_index = source_lookup_reference.indexOf(stringToStrip);
-		if (0 == new_index)
-		{
-			do
-			{
-				last_index = new_index;
-				new_index = source_lookup_reference.indexOf(stringToStrip, new_index+strip_length);
-			}
-			while (new_index != -1 &&
-				   new_index == last_index+strip_length);
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * containing only valid <code>String</code> characters.
+     *
+     * @param source The string that has to be transformed into a valid
+     *               sequence of <code>String</code> characters.
+     * @return The encoded <code>String</code> object.
+     * @see #encodeClassname(String)
+     * @see #encodeUrl(String)
+     * @see #encodeUrlValue(String)
+     * @see #encodeHtml(String)
+     * @see #encodeXml(String)
+     * @see #encodeSql(String)
+     * @see #encodeLatex(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeString(String source)
+    {
+        return encode(source, null, STRING_ENCODE_MAP);
+    }
 
-			return source.substring(last_index+strip_length);
-		}
-		else
-		{
-			return source;
-		}
-	}
+    /**
+     * Transforms a provided <code>String</code> object into a series of
+     * unicode escape codes.
+     *
+     * @param source The string that has to be transformed into a valid
+     *               sequence of unicode escape codes
+     * @return The encoded <code>String</code> object.
+     * @see #encodeClassname(String)
+     * @see #encodeUrl(String)
+     * @see #encodeUrlValue(String)
+     * @see #encodeHtml(String)
+     * @see #encodeXml(String)
+     * @see #encodeSql(String)
+     * @see #encodeLatex(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeUnicode(String source)
+    {
+        if (null == source)
+        {
+            return null;
+        }
 
-	/**
-	 * Removes all occurances of a string from the end of another string in a
-	 * case-sensitive manner.
-	 *
-	 * @param source The string in which the matching will be done.
-	 * @param stringToStrip The string that will be stripped from the end.
-	 * @return A new <code>String</code> containing the stripped result.
-	 * @since 1.0
-	 */
-	public static String stripFromEnd(String source, String stringToStrip)
-	{
-		return stripFromEnd(source, stringToStrip, true);
-	}
+        StringBuilder encoded = new StringBuilder();
+        String hexstring = null;
+        for (int i = 0; i < source.length(); i++)
+        {
+            hexstring = Integer.toHexString((int) source.charAt(i)).toUpperCase();
+            encoded.append("\\u");
+            // fill with zeros
+            for (int j = hexstring.length(); j < 4; j++)
+            {
+                encoded.append("0");
+            }
+            encoded.append(hexstring);
+        }
 
-	/**
-	 * Removes all occurances of a string from the end of another string.
-	 *
-	 * @param source The string in which the matching will be done.
-	 * @param stringToStrip The string that will be stripped from the end.
-	 * @param matchCase A <code>boolean</code> indicating if the match is
-	 * going to be performed in a case-sensitive manner or not.
-	 * @return A new <code>String</code> containing the stripped result.
-	 * @since 1.0
-	 */
-	public static String stripFromEnd(String source, String stringToStrip, boolean matchCase)
-	{
-		if (null == source)
-		{
-			return null;
-		}
+        return encoded.toString();
+    }
 
-		if (null == stringToStrip)
-		{
-			return source;
-		}
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * containing only valid Sql characters.
+     *
+     * @param source The string that has to be transformed into a valid Sql
+     *               string.
+     * @return The encoded <code>String</code> object.
+     * @see #encodeClassname(String)
+     * @see #encodeUrl(String)
+     * @see #encodeUrlValue(String)
+     * @see #encodeHtml(String)
+     * @see #encodeXml(String)
+     * @see #encodeString(String)
+     * @see #encodeLatex(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeSql(String source)
+    {
+        return encode(source, null, SQL_ENCODE_MAP);
+    }
 
-		int strip_length = stringToStrip.length();
-		int new_index = 0;
-		int last_index = 0;
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * containing only valid LaTeX characters.
+     *
+     * @param source The string that has to be transformed into a valid LaTeX
+     *               string.
+     * @return The encoded <code>String</code> object.
+     * @see #encodeClassname(String)
+     * @see #encodeUrl(String)
+     * @see #encodeUrlValue(String)
+     * @see #encodeHtml(String)
+     * @see #encodeXml(String)
+     * @see #encodeSql(String)
+     * @see #encodeString(String)
+     * @see #encodeRegexp(String)
+     * @since 1.0
+     */
+    public static String encodeLatex(String source)
+    {
+        if (null == source)
+        {
+            return null;
+        }
 
-		String  source_lookup_reference = null;
-		if (!matchCase)
-		{
-			source_lookup_reference = source.toLowerCase();
-			stringToStrip = stringToStrip.toLowerCase();
-		}
-		else
-		{
-			source_lookup_reference = source;
-		}
+        source = encode(source, null, LATEX_ENCODE_MAP);
+        source = StringUtils.replace(source, "latex", "\\LaTeX", false);
 
-		new_index = source_lookup_reference.lastIndexOf(stringToStrip);
-		if (new_index != -1 &&
-			source.length() == new_index+strip_length)
-		{
-			do
-			{
-				last_index = new_index;
-				new_index = source_lookup_reference.lastIndexOf(stringToStrip, last_index-1);
-			}
-			while (new_index != -1 &&
-				   new_index == last_index-strip_length);
+        return source;
+    }
 
-			return source.substring(0, last_index);
-		}
-		else
-		{
-			return source;
-		}
-	}
+    /**
+     * Transforms a provided <code>String</code> object into a new string,
+     * using the mapping that are provided through the supplied encoding
+     * table.
+     *
+     * @param source         The string that has to be transformed into a valid
+     *                       string, using the mappings that are provided through the supplied
+     *                       encoding table.
+     * @param encodingTables A <code>Map</code> object containing the mappings
+     *                       to transform characters into valid entities. The keys of this map
+     *                       should be <code>Character</code> objects and the values
+     *                       <code>String</code> objects.
+     * @return The encoded <code>String</code> object.
+     * @since 1.0
+     */
+    private static String encode(String source, EncoderFallbackHandler fallbackHandler, Map<Character, String>... encodingTables)
+    {
+        if (null == source)
+        {
+            return null;
+        }
 
-	/**
-	 * Searches for a string within a specified string in a case-sensitive
-	 * manner and replaces every match with another string.
-	 *
-	 * @param source The string in which the matching parts will be replaced.
-	 * @param stringToReplace The string that will be searched for.
-	 * @param replacementString The string that will replace each matching
-	 * part.
-	 * @return A new <code>String</code> object containing the replacement
-	 * result.
-	 * @since 1.0
-	 */
-	public static String replace(String source, String stringToReplace, String replacementString)
-	{
-		return replace(source, stringToReplace, replacementString, true);
-	}
+        if (null == encodingTables ||
+                0 == encodingTables.length)
+        {
+            return source;
+        }
 
-	/**
-	 * Searches for a string within a specified string and replaces every
-	 * match with another string.
-	 *
-	 * @param source The string in which the matching parts will be replaced.
-	 * @param stringToReplace The string that will be searched for.
-	 * @param replacementString The string that will replace each matching
-	 * part.
-	 * @param matchCase A <code>boolean</code> indicating if the match is
-	 * going to be performed in a case-sensitive manner or not.
-	 * @return A new <code>String</code> object containing the replacement
-	 * result.
-	 * @since 1.0
-	 */
-	public static String replace(String source, String stringToReplace, String replacementString, boolean matchCase)
-	{
-		if (null == source)
-		{
-			return null;
-		}
+        StringBuilder encoded_string = null;
+        char[] string_to_encode_array = source.toCharArray();
+        int last_match = -1;
 
-		if (null == stringToReplace)
-		{
-			return source;
-		}
+        for (int i = 0; i < string_to_encode_array.length; i++)
+        {
+            char char_to_encode = string_to_encode_array[i];
+            for (Map<Character, String> encoding_table : encodingTables)
+            {
+                if (encoding_table.containsKey(char_to_encode))
+                {
+                    encoded_string = prepareEncodedString(source, encoded_string, i, last_match, string_to_encode_array);
 
-		if (null == replacementString)
-		{
-			return source;
-		}
+                    encoded_string.append(encoding_table.get(char_to_encode));
+                    last_match = i;
+                }
+            }
 
-		Iterator<String> string_parts = split(source, stringToReplace, matchCase).iterator();
-		StringBuilder		new_string = new StringBuilder();
+            if (fallbackHandler != null &&
+                    last_match < i &&
+                    fallbackHandler.hasFallback(char_to_encode))
+            {
+                encoded_string = prepareEncodedString(source, encoded_string, i, last_match, string_to_encode_array);
 
-		while (string_parts.hasNext())
-		{
-			String string_part = string_parts.next();
-			new_string.append(string_part);
-			if (string_parts.hasNext())
-			{
-				new_string.append(replacementString);
-			}
-		}
+                fallbackHandler.appendFallback(encoded_string, char_to_encode);
+                last_match = i;
+            }
+        }
 
-		return new_string.toString();
-	}
+        if (null == encoded_string)
+        {
+            return source;
+        } else
+        {
+            int difference = string_to_encode_array.length - (last_match + 1);
+            if (difference > 0)
+            {
+                encoded_string.append(string_to_encode_array, last_match + 1, difference);
+            }
+            return encoded_string.toString();
+        }
+    }
 
-	/**
-	 * Creates a new string that contains the provided string a number of
-	 * times.
-	 *
-	 * @param source The string that will be repeated.
-	 * @param count The number of times that the string will be repeated.
-	 * @return A new <code>String</code> object containing the repeated
-	 * concatenation result.
-	 * @since 1.0
-	 */
-	public static String repeat(String source, int count)
-	{
-		if (null == source)
-		{
-			return null;
-		}
+    private static StringBuilder prepareEncodedString(String source, StringBuilder encodedString, int i, int lastMatch, char[] stringToEncodeArray)
+    {
+        if (null == encodedString)
+        {
+            encodedString = new StringBuilder(source.length());
+        }
 
-		StringBuilder new_string = new StringBuilder();
-		while (count > 0)
-		{
-			new_string.append(source);
-			count --;
-		}
+        int difference = i - (lastMatch + 1);
+        if (difference > 0)
+        {
+            encodedString.append(stringToEncodeArray, lastMatch + 1, difference);
+        }
 
-		return new_string.toString();
-	}
+        return encodedString;
+    }
 
-	/**
-	 * Creates a new array of <code>String</code> objects, containing the
-	 * elements of a supplied <code>Iterator</code>.
-	 *
-	 * @param iterator The iterator containing the elements to create the
-	 * array with.
-	 * @return The new <code>String</code> array.
-	 * @since 1.0
-	 */
-	public static String[] toStringArray(Iterator<String> iterator)
-	{
-		if (null == iterator)
-		{
-			return new String[0];
-		}
+    private static interface EncoderFallbackHandler
+    {
+        abstract boolean hasFallback(char character);
 
-		ArrayList<String>   strings = new ArrayList<String>();
+        abstract void appendFallback(StringBuilder encodedBuffer, char character);
+    }
 
-		while (iterator.hasNext())
-		{
-			strings.add(iterator.next());
-		}
+    private static class HtmlEncoderFallbackHandler implements EncoderFallbackHandler
+    {
+        private final static String PREFIX = "&#";
+        private final static String SUFFIX = ";";
 
-		String[] string_array = new String[strings.size()];
-		strings.toArray(string_array);
+        public boolean hasFallback(char character)
+        {
+            if (character < '\u00A0')
+            {
+                return false;
+            }
 
-		return string_array;
-	}
+            return true;
+        }
 
-	/**
-	 * Creates a new <code>ArrayList</code>, containing the elements of a
-	 * supplied array of <code>String</code> objects.
-	 *
-	 * @param stringArray The array of <code>String</code> objects that have
-	 * to be converted.
-	 * @return The new <code>ArrayList</code> with the elements of the
-	 * <code>String</code> array.
-	 * @since 1.0
-	 */
-	public static ArrayList<String> toArrayList(String[] stringArray)
-	{
-		ArrayList<String> strings = new ArrayList<String>();
+        public void appendFallback(StringBuilder encodedBuffer, char character)
+        {
+            encodedBuffer.append(PREFIX);
+            encodedBuffer.append((int) character);
+            encodedBuffer.append(SUFFIX);
+        }
+    }
 
-		if (null == stringArray)
-		{
-			return strings;
-		}
+    /**
+     * Transforms a provided <code>String</code> object into a literal that can
+     * be included into a regular expression {@link Pattern} as-is. None of the
+     * regular expression escapes in the string will be functional anymore.
+     *
+     * @param source The string that has to be escaped as a literal
+     * @return The encoded <code>String</code> object.
+     * @see #encodeClassname(String)
+     * @see #encodeUrl(String)
+     * @see #encodeUrlValue(String)
+     * @see #encodeHtml(String)
+     * @see #encodeXml(String)
+     * @see #encodeSql(String)
+     * @see #encodeString(String)
+     * @see #encodeLatex(String)
+     * @since 1.3
+     */
+    public static String encodeRegexp(String source)
+    {
+        int regexp_quote_start = source.indexOf("\\E");
+        if (-1 == regexp_quote_start)
+        {
+            return "\\Q" + source + "\\E";
+        }
 
-		for (String element : stringArray)
-		{
-			strings.add(element);
-		}
+        StringBuilder buffer = new StringBuilder(source.length() * 2);
+        buffer.append("\\Q");
 
-		return strings;
-	}
+        regexp_quote_start = 0;
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied <code>Collection</code> of <code>String</code> objects joined
-	 * by a given seperator.
-	 *
-	 * @param collection The <code>Collection</code> containing the elements
-	 * to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(Collection collection, String seperator)
-	{
-		if (null == collection)
-		{
-			return null;
-		}
+        int current = 0;
+        while (-1 == (regexp_quote_start = source.indexOf("\\E", current)))
+        {
+            buffer.append(source.substring(current, regexp_quote_start));
+            current = regexp_quote_start + 2;
+            buffer.append("\\E\\\\E\\Q");
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        buffer.append(source.substring(current, source.length()));
+        buffer.append("\\E");
 
-		if (0 == collection.size())
-		{
-			return "";
-		}
-		else
-		{
-			StringBuilder result = new StringBuilder();
-			for (Object element : collection)
-			{
-				result.append(String.valueOf(element));
-				result.append(seperator);
-			}
+        return buffer.toString();
+    }
+
+    /**
+     * Counts the number of times a substring occures in a provided string in
+     * a case-sensitive manner.
+     *
+     * @param source    The <code>String</code> object that will be searched in.
+     * @param substring The string whose occurances will we counted.
+     * @return An <code>int</code> value containing the number of occurances
+     *         of the substring.
+     * @since 1.0
+     */
+    public static int count(String source, String substring)
+    {
+        return count(source, substring, true);
+    }
+
+    /**
+     * Counts the number of times a substring occures in a provided string.
+     *
+     * @param source    The <code>String</code> object that will be searched in.
+     * @param substring The string whose occurances will we counted.
+     * @param matchCase A <code>boolean</code> indicating if the match is
+     *                  going to be performed in a case-sensitive manner or not.
+     * @return An <code>int</code> value containing the number of occurances
+     *         of the substring.
+     * @since 1.0
+     */
+    public static int count(String source, String substring, boolean matchCase)
+    {
+        if (null == source)
+        {
+            return 0;
+        }
+
+        if (null == substring)
+        {
+            return 0;
+        }
+
+        int current_index = 0;
+        int substring_index = 0;
+        int count = 0;
+
+        if (!matchCase)
+        {
+            source = source.toLowerCase();
+            substring = substring.toLowerCase();
+        }
+
+        while (current_index < source.length() - 1)
+        {
+            substring_index = source.indexOf(substring, current_index);
+
+            if (-1 == substring_index)
+            {
+                break;
+            } else
+            {
+                current_index = substring_index + substring.length();
+                count++;
+            }
+        }
+
+        return count;
+    }
+
+    /**
+     * Splits a string into different parts, using a seperator string to
+     * detect the seperation boundaries in a case-sensitive manner. The
+     * seperator will not be included in the list of parts.
+     *
+     * @param source    The string that will be split into parts.
+     * @param seperator The seperator string that will be used to determine
+     *                  the parts.
+     * @return An <code>ArrayList</code> containing the parts as
+     *         <code>String</code> objects.
+     * @since 1.0
+     */
+    public static ArrayList<String> split(String source, String seperator)
+    {
+        return split(source, seperator, true);
+    }
+
+    /**
+     * Splits a string into different parts, using a seperator string to
+     * detect the seperation boundaries. The seperator will not be included in
+     * the list of parts.
+     *
+     * @param source    The string that will be split into parts.
+     * @param seperator The seperator string that will be used to determine
+     *                  the parts.
+     * @param matchCase A <code>boolean</code> indicating if the match is
+     *                  going to be performed in a case-sensitive manner or not.
+     * @return An <code>ArrayList</code> containing the parts as
+     *         <code>String</code> objects.
+     * @since 1.0
+     */
+    public static ArrayList<String> split(String source, String seperator, boolean matchCase)
+    {
+        ArrayList<String> substrings = new ArrayList<String>();
+
+        if (null == source)
+        {
+            return substrings;
+        }
+
+        if (null == seperator)
+        {
+            substrings.add(source);
+            return substrings;
+        }
+
+        int current_index = 0;
+        int delimiter_index = 0;
+        String element = null;
+
+        String source_lookup_reference = null;
+        if (!matchCase)
+        {
+            source_lookup_reference = source.toLowerCase();
+            seperator = seperator.toLowerCase();
+        } else
+        {
+            source_lookup_reference = source;
+        }
+
+        while (current_index <= source_lookup_reference.length())
+        {
+            delimiter_index = source_lookup_reference.indexOf(seperator, current_index);
+
+            if (-1 == delimiter_index)
+            {
+                element = new String(source.substring(current_index, source.length()));
+                substrings.add(element);
+                current_index = source.length() + 1;
+            } else
+            {
+                element = new String(source.substring(current_index, delimiter_index));
+                substrings.add(element);
+                current_index = delimiter_index + seperator.length();
+            }
+        }
+
+        return substrings;
+    }
+
+    /**
+     * Splits a string into different parts, using a seperator string to
+     * detect the seperation boundaries in a case-sensitive manner. The
+     * seperator will not be included in the parts array.
+     *
+     * @param source    The string that will be split into parts.
+     * @param seperator The seperator string that will be used to determine
+     *                  the parts.
+     * @return A <code>String[]</code> array containing the seperated parts.
+     * @since 1.0
+     */
+    public static String[] splitToArray(String source, String seperator)
+    {
+        return splitToArray(source, seperator, true);
+    }
+
+    /**
+     * Splits a string into different parts, using a seperator string to
+     * detect the seperation boundaries. The seperator will not be included in
+     * the parts array.
+     *
+     * @param source    The string that will be split into parts.
+     * @param seperator The seperator string that will be used to determine
+     *                  the parts.
+     * @param matchCase A <code>boolean</code> indicating if the match is
+     *                  going to be performed in a case-sensitive manner or not.
+     * @return A <code>String[]</code> array containing the seperated parts.
+     * @since 1.0
+     */
+    public static String[] splitToArray(String source, String seperator, boolean matchCase)
+    {
+        ArrayList<String> substrings = split(source, seperator, matchCase);
+        String[] substrings_array = new String[substrings.size()];
+        substrings_array = substrings.toArray(substrings_array);
+
+        return substrings_array;
+    }
+
+    /**
+     * Splits a string into integers, using a seperator string to detect the
+     * seperation boundaries in a case-sensitive manner. If a part couldn't be
+     * converted to an integer, it will be omitted from the resulting array.
+     *
+     * @param source    The string that will be split into integers.
+     * @param seperator The seperator string that will be used to determine
+     *                  the parts.
+     * @return An <code>int[]</code> array containing the seperated parts.
+     * @since 1.0
+     */
+    public static int[] splitToIntArray(String source, String seperator)
+    {
+        return splitToIntArray(source, seperator, true);
+    }
+
+    /**
+     * Splits a string into integers, using a seperator string to detect the
+     * seperation boundaries. If a part couldn't be converted to an integer,
+     * it will be omitted from the resulting array.
+     *
+     * @param source    The string that will be split into integers.
+     * @param seperator The seperator string that will be used to determine
+     *                  the parts.
+     * @param matchCase A <code>boolean</code> indicating if the match is
+     *                  going to be performed in a case-sensitive manner or not.
+     * @return An <code>int[]</code> array containing the seperated parts.
+     * @since 1.0
+     */
+    public static int[] splitToIntArray(String source, String seperator, boolean matchCase)
+    {
+        ArrayList<String> string_parts = split(source, seperator, matchCase);
+        int number_of_valid_parts = 0;
+
+        for (String string_part : string_parts)
+        {
+            try
+            {
+                Integer.parseInt(string_part);
+                number_of_valid_parts++;
+            }
+            catch (NumberFormatException e)
+            {
+                // just continue
+            }
+        }
+
+        int[] string_parts_int = (int[]) Array.newInstance(int.class, number_of_valid_parts);
+        int added_parts = 0;
+
+        for (String string_part : string_parts)
+        {
+            try
+            {
+                string_parts_int[added_parts] = Integer.parseInt(string_part);
+                added_parts++;
+            }
+            catch (NumberFormatException e)
+            {
+                // just continue
+            }
+        }
+
+        return string_parts_int;
+    }
+
+    /**
+     * Splits a string into bytes, using a seperator string to detect the
+     * seperation boundaries in a case-sensitive manner. If a part couldn't be
+     * converted to a <code>byte</code>, it will be omitted from the resulting
+     * array.
+     *
+     * @param source    The string that will be split into bytes.
+     * @param seperator The seperator string that will be used to determine
+     *                  the parts.
+     * @return A <code>byte[]</code> array containing the bytes.
+     * @since 1.0
+     */
+    public static byte[] splitToByteArray(String source, String seperator)
+    {
+        return splitToByteArray(source, seperator, true);
+    }
+
+    /**
+     * Splits a string into bytes, using a seperator string to detect the
+     * seperation boundaries. If a part couldn't be converted to a
+     * <code>byte</code>, it will be omitted from the resulting array.
+     *
+     * @param source    The string that will be split into bytes.
+     * @param seperator The seperator string that will be used to determine
+     *                  the parts.
+     * @param matchCase A <code>boolean</code> indicating if the match is
+     *                  going to be performed in a case-sensitive manner or not.
+     * @return A <code>byte[]</code> array containing the bytes.
+     * @since 1.0
+     */
+    public static byte[] splitToByteArray(String source, String seperator, boolean matchCase)
+    {
+        ArrayList<String> string_parts = split(source, seperator, matchCase);
+        int number_of_valid_parts = 0;
+        for (String string_part : string_parts)
+        {
+            try
+            {
+                Byte.parseByte(string_part);
+                number_of_valid_parts++;
+            }
+            catch (NumberFormatException e)
+            {
+                // just continue
+            }
+        }
+
+        byte[] string_parts_byte = (byte[]) Array.newInstance(byte.class, number_of_valid_parts);
+        int added_parts = 0;
+        for (String string_part : string_parts)
+        {
+            try
+            {
+                string_parts_byte[added_parts] = Byte.parseByte(string_part);
+                added_parts++;
+            }
+            catch (NumberFormatException e)
+            {
+                // just continue
+            }
+        }
+
+        return string_parts_byte;
+    }
+
+    /**
+     * Removes all occurances of a string from the front of another string in
+     * a case-sensitive manner.
+     *
+     * @param source        The string in which the matching will be done.
+     * @param stringToStrip The string that will be stripped from the front.
+     * @return A new <code>String</code> containing the stripped result.
+     * @since 1.0
+     */
+    public static String stripFromFront(String source, String stringToStrip)
+    {
+        return stripFromFront(source, stringToStrip, true);
+    }
+
+    /**
+     * Removes all occurances of a string from the front of another string.
+     *
+     * @param source        The string in which the matching will be done.
+     * @param stringToStrip The string that will be stripped from the front.
+     * @param matchCase     A <code>boolean</code> indicating if the match is
+     *                      going to be performed in a case-sensitive manner or not.
+     * @return A new <code>String</code> containing the stripping result.
+     * @since 1.0
+     */
+    public static String stripFromFront(String source, String stringToStrip, boolean matchCase)
+    {
+        if (null == source)
+        {
+            return null;
+        }
+
+        if (null == stringToStrip)
+        {
+            return source;
+        }
+
+        int strip_length = stringToStrip.length();
+        int new_index = 0;
+        int last_index = 0;
+
+        String source_lookup_reference = null;
+        if (!matchCase)
+        {
+            source_lookup_reference = source.toLowerCase();
+            stringToStrip = stringToStrip.toLowerCase();
+        } else
+        {
+            source_lookup_reference = source;
+        }
+
+        new_index = source_lookup_reference.indexOf(stringToStrip);
+        if (0 == new_index)
+        {
+            do
+            {
+                last_index = new_index;
+                new_index = source_lookup_reference.indexOf(stringToStrip, new_index + strip_length);
+            }
+            while (new_index != -1 &&
+                    new_index == last_index + strip_length);
+
+            return source.substring(last_index + strip_length);
+        } else
+        {
+            return source;
+        }
+    }
+
+    /**
+     * Removes all occurances of a string from the end of another string in a
+     * case-sensitive manner.
+     *
+     * @param source        The string in which the matching will be done.
+     * @param stringToStrip The string that will be stripped from the end.
+     * @return A new <code>String</code> containing the stripped result.
+     * @since 1.0
+     */
+    public static String stripFromEnd(String source, String stringToStrip)
+    {
+        return stripFromEnd(source, stringToStrip, true);
+    }
+
+    /**
+     * Removes all occurances of a string from the end of another string.
+     *
+     * @param source        The string in which the matching will be done.
+     * @param stringToStrip The string that will be stripped from the end.
+     * @param matchCase     A <code>boolean</code> indicating if the match is
+     *                      going to be performed in a case-sensitive manner or not.
+     * @return A new <code>String</code> containing the stripped result.
+     * @since 1.0
+     */
+    public static String stripFromEnd(String source, String stringToStrip, boolean matchCase)
+    {
+        if (null == source)
+        {
+            return null;
+        }
+
+        if (null == stringToStrip)
+        {
+            return source;
+        }
+
+        int strip_length = stringToStrip.length();
+        int new_index = 0;
+        int last_index = 0;
+
+        String source_lookup_reference = null;
+        if (!matchCase)
+        {
+            source_lookup_reference = source.toLowerCase();
+            stringToStrip = stringToStrip.toLowerCase();
+        } else
+        {
+            source_lookup_reference = source;
+        }
+
+        new_index = source_lookup_reference.lastIndexOf(stringToStrip);
+        if (new_index != -1 &&
+                source.length() == new_index + strip_length)
+        {
+            do
+            {
+                last_index = new_index;
+                new_index = source_lookup_reference.lastIndexOf(stringToStrip, last_index - 1);
+            }
+            while (new_index != -1 &&
+                    new_index == last_index - strip_length);
+
+            return source.substring(0, last_index);
+        } else
+        {
+            return source;
+        }
+    }
+
+    /**
+     * Searches for a string within a specified string in a case-sensitive
+     * manner and replaces every match with another string.
+     *
+     * @param source            The string in which the matching parts will be replaced.
+     * @param stringToReplace   The string that will be searched for.
+     * @param replacementString The string that will replace each matching
+     *                          part.
+     * @return A new <code>String</code> object containing the replacement
+     *         result.
+     * @since 1.0
+     */
+    public static String replace(String source, String stringToReplace, String replacementString)
+    {
+        return replace(source, stringToReplace, replacementString, true);
+    }
+
+    /**
+     * Searches for a string within a specified string and replaces every
+     * match with another string.
+     *
+     * @param source            The string in which the matching parts will be replaced.
+     * @param stringToReplace   The string that will be searched for.
+     * @param replacementString The string that will replace each matching
+     *                          part.
+     * @param matchCase         A <code>boolean</code> indicating if the match is
+     *                          going to be performed in a case-sensitive manner or not.
+     * @return A new <code>String</code> object containing the replacement
+     *         result.
+     * @since 1.0
+     */
+    public static String replace(String source, String stringToReplace, String replacementString, boolean matchCase)
+    {
+        if (null == source)
+        {
+            return null;
+        }
+
+        if (null == stringToReplace)
+        {
+            return source;
+        }
+
+        if (null == replacementString)
+        {
+            return source;
+        }
+
+        Iterator<String> string_parts = split(source, stringToReplace, matchCase).iterator();
+        StringBuilder new_string = new StringBuilder();
+
+        while (string_parts.hasNext())
+        {
+            String string_part = string_parts.next();
+            new_string.append(string_part);
+            if (string_parts.hasNext())
+            {
+                new_string.append(replacementString);
+            }
+        }
+
+        return new_string.toString();
+    }
+
+    /**
+     * Creates a new string that contains the provided string a number of
+     * times.
+     *
+     * @param source The string that will be repeated.
+     * @param count  The number of times that the string will be repeated.
+     * @return A new <code>String</code> object containing the repeated
+     *         concatenation result.
+     * @since 1.0
+     */
+    public static String repeat(String source, int count)
+    {
+        if (null == source)
+        {
+            return null;
+        }
+
+        StringBuilder new_string = new StringBuilder();
+        while (count > 0)
+        {
+            new_string.append(source);
+            count--;
+        }
+
+        return new_string.toString();
+    }
+
+    /**
+     * Creates a new array of <code>String</code> objects, containing the
+     * elements of a supplied <code>Iterator</code>.
+     *
+     * @param iterator The iterator containing the elements to create the
+     *                 array with.
+     * @return The new <code>String</code> array.
+     * @since 1.0
+     */
+    public static String[] toStringArray(Iterator<String> iterator)
+    {
+        if (null == iterator)
+        {
+            return new String[0];
+        }
+
+        ArrayList<String> strings = new ArrayList<String>();
+
+        while (iterator.hasNext())
+        {
+            strings.add(iterator.next());
+        }
+
+        String[] string_array = new String[strings.size()];
+        strings.toArray(string_array);
+
+        return string_array;
+    }
+
+    /**
+     * Creates a new <code>ArrayList</code>, containing the elements of a
+     * supplied array of <code>String</code> objects.
+     *
+     * @param stringArray The array of <code>String</code> objects that have
+     *                    to be converted.
+     * @return The new <code>ArrayList</code> with the elements of the
+     *         <code>String</code> array.
+     * @since 1.0
+     */
+    public static ArrayList<String> toArrayList(String[] stringArray)
+    {
+        ArrayList<String> strings = new ArrayList<String>();
+
+        if (null == stringArray)
+        {
+            return strings;
+        }
+
+        for (String element : stringArray)
+        {
+            strings.add(element);
+        }
+
+        return strings;
+    }
+
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied <code>Collection</code> of <code>String</code> objects joined
+     * by a given seperator.
+     *
+     * @param collection The <code>Collection</code> containing the elements
+     *                   to join.
+     * @param seperator  The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(Collection collection, String seperator)
+    {
+        if (null == collection)
+        {
+            return null;
+        }
+
+        if (null == seperator)
+        {
+            seperator = "";
+        }
+
+        if (0 == collection.size())
+        {
+            return "";
+        } else
+        {
+            StringBuilder result = new StringBuilder();
+            for (Object element : collection)
+            {
+                result.append(String.valueOf(element));
+                result.append(seperator);
+            }
 
-			result.setLength(result.length()-seperator.length());
-			return result.toString();
-		}
-	}
+            result.setLength(result.length() - seperator.length());
+            return result.toString();
+        }
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The object array containing the elements to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(Object[] array, String seperator)
-	{
-		return join(array, seperator, null, false);
-	}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The object array containing the elements to join.
+     * @param seperator The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(Object[] array, String seperator)
+    {
+        return join(array, seperator, null, false);
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The object array containing the elements to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @param delimiter The delimiter used to surround the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(Object[] array, String seperator, String delimiter)
-	{
-		return join(array, seperator, delimiter, false);
-	}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The object array containing the elements to join.
+     * @param seperator The seperator used to join the string elements.
+     * @param delimiter The delimiter used to surround the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(Object[] array, String seperator, String delimiter)
+    {
+        return join(array, seperator, delimiter, false);
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The object array containing the elements to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @param delimiter The delimiter used to surround the string elements.
-	 * @param encodeStrings Indicates whether the characters of the string
-	 * representation of the Array values should be encoded.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(Object[] array, String seperator, String delimiter, boolean encodeStrings)
-	{
-		if (null == array)
-		{
-			return null;
-		}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array         The object array containing the elements to join.
+     * @param seperator     The seperator used to join the string elements.
+     * @param delimiter     The delimiter used to surround the string elements.
+     * @param encodeStrings Indicates whether the characters of the string
+     *                      representation of the Array values should be encoded.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(Object[] array, String seperator, String delimiter, boolean encodeStrings)
+    {
+        if (null == array)
+        {
+            return null;
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        if (null == seperator)
+        {
+            seperator = "";
+        }
 
-		if (null == delimiter)
-		{
-			delimiter = "";
-		}
+        if (null == delimiter)
+        {
+            delimiter = "";
+        }
 
-		if (0 == array.length)
-		{
-			return "";
-		}
-		else
-		{
-			int				current_index = 0;
-			String			array_value = null;
-			StringBuilder	result = new StringBuilder();
-			while (current_index < array.length - 1)
-			{
-				if (null == array[current_index])
-				{
-					result.append("null");
-				}
-				else
-				{
-					array_value = String.valueOf(array[current_index]);
-					if (encodeStrings)
-					{
-						array_value = encodeString(array_value);
-					}
-					result.append(delimiter);
-					result.append(array_value);
-					result.append(delimiter);
-				}
-				result.append(seperator);
-				current_index++;
-			}
+        if (0 == array.length)
+        {
+            return "";
+        } else
+        {
+            int current_index = 0;
+            String array_value = null;
+            StringBuilder result = new StringBuilder();
+            while (current_index < array.length - 1)
+            {
+                if (null == array[current_index])
+                {
+                    result.append("null");
+                } else
+                {
+                    array_value = String.valueOf(array[current_index]);
+                    if (encodeStrings)
+                    {
+                        array_value = encodeString(array_value);
+                    }
+                    result.append(delimiter);
+                    result.append(array_value);
+                    result.append(delimiter);
+                }
+                result.append(seperator);
+                current_index++;
+            }
 
-			if (null == array[current_index])
-			{
-				result.append("null");
-			}
-			else
-			{
-				array_value = String.valueOf(array[current_index]);
-				if (encodeStrings)
-				{
-					array_value = encodeString(array_value);
-				}
-				result.append(delimiter);
-				result.append(array_value);
-				result.append(delimiter);
-			}
-			return result.toString();
-		}
-	}
+            if (null == array[current_index])
+            {
+                result.append("null");
+            } else
+            {
+                array_value = String.valueOf(array[current_index]);
+                if (encodeStrings)
+                {
+                    array_value = encodeString(array_value);
+                }
+                result.append(delimiter);
+                result.append(array_value);
+                result.append(delimiter);
+            }
+            return result.toString();
+        }
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The boolean array containing the values to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(boolean[] array, String seperator)
-	{
-		if (null == array)
-		{
-			return null;
-		}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The boolean array containing the values to join.
+     * @param seperator The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(boolean[] array, String seperator)
+    {
+        if (null == array)
+        {
+            return null;
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        if (null == seperator)
+        {
+            seperator = "";
+        }
 
-		if (0 == array.length)
-		{
-			return "";
-		}
-		else
-		{
-			int current_index = 0;
-			String result = "";
-			while (current_index < array.length - 1)
-			{
-				result = result + array[current_index] + seperator;
-				current_index++;
-			}
+        if (0 == array.length)
+        {
+            return "";
+        } else
+        {
+            int current_index = 0;
+            String result = "";
+            while (current_index < array.length - 1)
+            {
+                result = result + array[current_index] + seperator;
+                current_index++;
+            }
 
-			result = result +  array[current_index];
-			return result;
-		}
-	}
+            result = result + array[current_index];
+            return result;
+        }
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The byte array containing the values to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(byte[] array, String seperator)
-	{
-		if (null == array)
-		{
-			return null;
-		}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The byte array containing the values to join.
+     * @param seperator The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(byte[] array, String seperator)
+    {
+        if (null == array)
+        {
+            return null;
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        if (null == seperator)
+        {
+            seperator = "";
+        }
 
-		if (0 == array.length)
-		{
-			return "";
-		}
-		else
-		{
-			int current_index = 0;
-			String result = "";
-			while (current_index < array.length - 1)
-			{
-				result = result + array[current_index] + seperator;
-				current_index++;
-			}
+        if (0 == array.length)
+        {
+            return "";
+        } else
+        {
+            int current_index = 0;
+            String result = "";
+            while (current_index < array.length - 1)
+            {
+                result = result + array[current_index] + seperator;
+                current_index++;
+            }
 
-			result = result +  array[current_index];
-			return result;
-		}
-	}
+            result = result + array[current_index];
+            return result;
+        }
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The double array containing the values to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(double[] array, String seperator)
-	{
-		if (null == array)
-		{
-			return null;
-		}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The double array containing the values to join.
+     * @param seperator The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(double[] array, String seperator)
+    {
+        if (null == array)
+        {
+            return null;
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        if (null == seperator)
+        {
+            seperator = "";
+        }
 
-		if (0 == array.length)
-		{
-			return "";
-		}
-		else
-		{
-			int current_index = 0;
-			String result = "";
-			while (current_index < array.length - 1)
-			{
-				result = result + array[current_index] + seperator;
-				current_index++;
-			}
+        if (0 == array.length)
+        {
+            return "";
+        } else
+        {
+            int current_index = 0;
+            String result = "";
+            while (current_index < array.length - 1)
+            {
+                result = result + array[current_index] + seperator;
+                current_index++;
+            }
 
-			result = result +  array[current_index];
-			return result;
-		}
-	}
+            result = result + array[current_index];
+            return result;
+        }
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The float array containing the values to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(float[] array, String seperator)
-	{
-		if (null == array)
-		{
-			return null;
-		}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The float array containing the values to join.
+     * @param seperator The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(float[] array, String seperator)
+    {
+        if (null == array)
+        {
+            return null;
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        if (null == seperator)
+        {
+            seperator = "";
+        }
 
-		if (0 == array.length)
-		{
-			return "";
-		}
-		else
-		{
-			int current_index = 0;
-			String result = "";
-			while (current_index < array.length - 1)
-			{
-				result = result + array[current_index] + seperator;
-				current_index++;
-			}
+        if (0 == array.length)
+        {
+            return "";
+        } else
+        {
+            int current_index = 0;
+            String result = "";
+            while (current_index < array.length - 1)
+            {
+                result = result + array[current_index] + seperator;
+                current_index++;
+            }
 
-			result = result +  array[current_index];
-			return result;
-		}
-	}
+            result = result + array[current_index];
+            return result;
+        }
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The integer array containing the values to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(int[] array, String seperator)
-	{
-		if (null == array)
-		{
-			return null;
-		}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The integer array containing the values to join.
+     * @param seperator The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(int[] array, String seperator)
+    {
+        if (null == array)
+        {
+            return null;
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        if (null == seperator)
+        {
+            seperator = "";
+        }
 
-		if (0 == array.length)
-		{
-			return "";
-		}
-		else
-		{
-			int current_index = 0;
-			String result = "";
-			while (current_index < array.length - 1)
-			{
-				result = result + array[current_index] + seperator;
-				current_index++;
-			}
+        if (0 == array.length)
+        {
+            return "";
+        } else
+        {
+            int current_index = 0;
+            String result = "";
+            while (current_index < array.length - 1)
+            {
+                result = result + array[current_index] + seperator;
+                current_index++;
+            }
 
-			result = result +  array[current_index];
-			return result;
-		}
-	}
+            result = result + array[current_index];
+            return result;
+        }
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The long array containing the values to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(long[] array, String seperator)
-	{
-		if (null == array)
-		{
-			return null;
-		}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The long array containing the values to join.
+     * @param seperator The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(long[] array, String seperator)
+    {
+        if (null == array)
+        {
+            return null;
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        if (null == seperator)
+        {
+            seperator = "";
+        }
 
-		if (0 == array.length)
-		{
-			return "";
-		}
-		else
-		{
-			int current_index = 0;
-			String result = "";
-			while (current_index < array.length - 1)
-			{
-				result = result + array[current_index] + seperator;
-				current_index++;
-			}
+        if (0 == array.length)
+        {
+            return "";
+        } else
+        {
+            int current_index = 0;
+            String result = "";
+            while (current_index < array.length - 1)
+            {
+                result = result + array[current_index] + seperator;
+                current_index++;
+            }
 
-			result = result +  array[current_index];
-			return result;
-		}
-	}
+            result = result + array[current_index];
+            return result;
+        }
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The short array containing the values to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(short[] array, String seperator)
-	{
-		if (null == array)
-		{
-			return null;
-		}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The short array containing the values to join.
+     * @param seperator The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(short[] array, String seperator)
+    {
+        if (null == array)
+        {
+            return null;
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        if (null == seperator)
+        {
+            seperator = "";
+        }
 
-		if (0 == array.length)
-		{
-			return "";
-		}
-		else
-		{
-			int current_index = 0;
-			String result = "";
-			while (current_index < array.length - 1)
-			{
-				result = result + array[current_index] + seperator;
-				current_index++;
-			}
+        if (0 == array.length)
+        {
+            return "";
+        } else
+        {
+            int current_index = 0;
+            String result = "";
+            while (current_index < array.length - 1)
+            {
+                result = result + array[current_index] + seperator;
+                current_index++;
+            }
 
-			result = result +  array[current_index];
-			return result;
-		}
-	}
+            result = result + array[current_index];
+            return result;
+        }
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The char array containing the values to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(char[] array, String seperator)
-	{
-		return join(array, seperator, null);
-	}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The char array containing the values to join.
+     * @param seperator The seperator used to join the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(char[] array, String seperator)
+    {
+        return join(array, seperator, null);
+    }
 
-	/**
-	 * Creates a new <code>String</code> object, containing the elements of a
-	 * supplied array, joined by a given seperator.
-	 *
-	 * @param array The char array containing the values to join.
-	 * @param seperator The seperator used to join the string elements.
-	 * @param delimiter The delimiter used to surround the string elements.
-	 * @return A new <code>String</code> with the join result.
-	 * @since 1.0
-	 */
-	public static String join(char[] array, String seperator, String delimiter)
-	{
-		if (null == array)
-		{
-			return null;
-		}
+    /**
+     * Creates a new <code>String</code> object, containing the elements of a
+     * supplied array, joined by a given seperator.
+     *
+     * @param array     The char array containing the values to join.
+     * @param seperator The seperator used to join the string elements.
+     * @param delimiter The delimiter used to surround the string elements.
+     * @return A new <code>String</code> with the join result.
+     * @since 1.0
+     */
+    public static String join(char[] array, String seperator, String delimiter)
+    {
+        if (null == array)
+        {
+            return null;
+        }
 
-		if (null == seperator)
-		{
-			seperator = "";
-		}
+        if (null == seperator)
+        {
+            seperator = "";
+        }
 
-		if (null == delimiter)
-		{
-			delimiter = "";
-		}
+        if (null == delimiter)
+        {
+            delimiter = "";
+        }
 
-		if (0 == array.length)
-		{
-			return "";
-		}
-		else
-		{
-			int current_index = 0;
-			StringBuilder	result = new StringBuilder();
-			while (current_index < array.length - 1)
-			{
-				result.append(delimiter);
-				result.append(array[current_index]);
-				result.append(delimiter);
-				result.append(seperator);
-				current_index++;
-			}
+        if (0 == array.length)
+        {
+            return "";
+        } else
+        {
+            int current_index = 0;
+            StringBuilder result = new StringBuilder();
+            while (current_index < array.length - 1)
+            {
+                result.append(delimiter);
+                result.append(array[current_index]);
+                result.append(delimiter);
+                result.append(seperator);
+                current_index++;
+            }
 
-			result.append(delimiter);
-			result.append(String.valueOf(array[current_index]));
-			result.append(delimiter);
-			return result.toString();
-		}
-	}
+            result.append(delimiter);
+            result.append(String.valueOf(array[current_index]));
+            result.append(delimiter);
+            return result.toString();
+        }
+    }
 
-	/**
-	 * Returns an array that contains all the occurances of a substring in a
-	 * string in the correct order. The search will be performed in a
-	 * case-sensitive manner.
-	 *
-	 * @param source The <code>String</code> object that will be searched in.
-	 * @param substring The string whose occurances will we counted.
-	 * @return An <code>int[]</code> array containing the indices of the
-	 * substring.
-	 * @since 1.0
-	 */
-	public static int[] indicesOf(String source, String substring)
-	{
-		return indicesOf(source, substring, true);
-	}
+    /**
+     * Returns an array that contains all the occurances of a substring in a
+     * string in the correct order. The search will be performed in a
+     * case-sensitive manner.
+     *
+     * @param source    The <code>String</code> object that will be searched in.
+     * @param substring The string whose occurances will we counted.
+     * @return An <code>int[]</code> array containing the indices of the
+     *         substring.
+     * @since 1.0
+     */
+    public static int[] indicesOf(String source, String substring)
+    {
+        return indicesOf(source, substring, true);
+    }
 
-	/**
-	 * Returns an array that contains all the occurances of a substring in a
-	 * string in the correct order.
-	 *
-	 * @param source The <code>String</code> object that will be searched in.
-	 * @param substring The string whose occurances will we counted.
-	 * @param matchCase A <code>boolean</code> indicating if the match is
-	 * going to be performed in a case-sensitive manner or not.
-	 * @return An <code>int[]</code> array containing the indices of the
-	 * substring.
-	 * @since 1.0
-	 */
-	public static int[] indicesOf(String source, String substring, boolean matchCase)
-	{
-		if (null == source ||
-			null == substring)
-		{
-			return new int[0];
-		}
+    /**
+     * Returns an array that contains all the occurances of a substring in a
+     * string in the correct order.
+     *
+     * @param source    The <code>String</code> object that will be searched in.
+     * @param substring The string whose occurances will we counted.
+     * @param matchCase A <code>boolean</code> indicating if the match is
+     *                  going to be performed in a case-sensitive manner or not.
+     * @return An <code>int[]</code> array containing the indices of the
+     *         substring.
+     * @since 1.0
+     */
+    public static int[] indicesOf(String source, String substring, boolean matchCase)
+    {
+        if (null == source ||
+                null == substring)
+        {
+            return new int[0];
+        }
 
-		String  source_lookup_reference = null;
-		if (!matchCase)
-		{
-			source_lookup_reference = source.toLowerCase();
-			substring = substring.toLowerCase();
-		}
-		else
-		{
-			source_lookup_reference = source;
-		}
+        String source_lookup_reference = null;
+        if (!matchCase)
+        {
+            source_lookup_reference = source.toLowerCase();
+            substring = substring.toLowerCase();
+        } else
+        {
+            source_lookup_reference = source;
+        }
 
-		int current_index = 0;
-		int substring_index = 0;
-		int count = count(source_lookup_reference, substring);
-		int[] indices = new int[count];
-		int counter = 0;
+        int current_index = 0;
+        int substring_index = 0;
+        int count = count(source_lookup_reference, substring);
+        int[] indices = new int[count];
+        int counter = 0;
 
-		while (current_index < source.length()-1)
-		{
-			substring_index = source_lookup_reference.indexOf(substring, current_index);
+        while (current_index < source.length() - 1)
+        {
+            substring_index = source_lookup_reference.indexOf(substring, current_index);
 
-			if (-1 == substring_index)
-			{
-				break;
-			}
-			else
-			{
-				current_index = substring_index + substring.length();
-				indices[counter] = substring_index;
-				counter++;
-			}
-		}
+            if (-1 == substring_index)
+            {
+                break;
+            } else
+            {
+                current_index = substring_index + substring.length();
+                indices[counter] = substring_index;
+                counter++;
+            }
+        }
 
-		return indices;
-	}
+        return indices;
+    }
 
-	/**
-	 * Matches a collection of regular expressions against a string.
-	 *
-	 * @param value The <code>String</code> that will be checked.
-	 * @param regexps The collection of regular expressions against which the
-	 * match will be performed.
-	 * @return The <code>Matcher</code> instance that corresponds to the
-	 * <code>String</code> that returned a successful match; or
-	 * <p><code>null</code> if no match could be found.
-	 * @since 1.0
-	 */
-	public static Matcher getMatchingRegexp(String value, Collection<Pattern> regexps)
-	{
-		if (value != null &&
-			value.length() > 0 &&
-			regexps != null &&
-			regexps.size() > 0)
-		{
-			Matcher matcher = null;
-			for (Pattern regexp : regexps)
-			{
-				matcher = regexp.matcher(value);
-				if (matcher.matches())
-				{
-					return matcher;
-				}
-			}
-		}
+    /**
+     * Matches a collection of regular expressions against a string.
+     *
+     * @param value   The <code>String</code> that will be checked.
+     * @param regexps The collection of regular expressions against which the
+     *                match will be performed.
+     * @return The <code>Matcher</code> instance that corresponds to the
+     *         <code>String</code> that returned a successful match; or
+     *         <p><code>null</code> if no match could be found.
+     * @since 1.0
+     */
+    public static Matcher getMatchingRegexp(String value, Collection<Pattern> regexps)
+    {
+        if (value != null &&
+                value.length() > 0 &&
+                regexps != null &&
+                regexps.size() > 0)
+        {
+            Matcher matcher = null;
+            for (Pattern regexp : regexps)
+            {
+                matcher = regexp.matcher(value);
+                if (matcher.matches())
+                {
+                    return matcher;
+                }
+            }
+        }
 
-		return null;
-	}
+        return null;
+    }
 
-	/**
-	 * Matches a collection of strings against a regular expression.
-	 *
-	 * @param values The <code>Collection</code> of <code>String</code>
-	 * objects that will be checked.
-	 * @param regexp The regular expression <code>Pattern</code> against which
-	 * the matches will be performed.
-	 * @return The <code>Matcher</code> instance that corresponds to the
-	 * <code>String</code> that returned a successful match; or
-	 * <p><code>null</code> if no match could be found.
-	 * @since 1.0
-	 */
-	public static Matcher getRegexpMatch(Collection<String> values, Pattern regexp)
-	{
-		if (values != null &&
-			values.size() > 0 &&
-			regexp != null)
-		{
-			Matcher matcher = null;
-			for (String value : values)
-			{
-				matcher = regexp.matcher(value);
-				if (matcher.matches())
-				{
-					return matcher;
-				}
-			}
-		}
+    /**
+     * Matches a collection of strings against a regular expression.
+     *
+     * @param values The <code>Collection</code> of <code>String</code>
+     *               objects that will be checked.
+     * @param regexp The regular expression <code>Pattern</code> against which
+     *               the matches will be performed.
+     * @return The <code>Matcher</code> instance that corresponds to the
+     *         <code>String</code> that returned a successful match; or
+     *         <p><code>null</code> if no match could be found.
+     * @since 1.0
+     */
+    public static Matcher getRegexpMatch(Collection<String> values, Pattern regexp)
+    {
+        if (values != null &&
+                values.size() > 0 &&
+                regexp != null)
+        {
+            Matcher matcher = null;
+            for (String value : values)
+            {
+                matcher = regexp.matcher(value);
+                if (matcher.matches())
+                {
+                    return matcher;
+                }
+            }
+        }
 
-		return null;
-	}
+        return null;
+    }
 
-	/**
-	 * Checks if the name filters through an including and an excluding
-	 * regular expression.
-	 *
-	 * @param name The <code>String</code> that will be filtered.
-	 * @param included The regular expressions that needs to succeed
-	 * @param excluded The regular expressions that needs to fail
-	 * @return <code>true</code> if the name filtered through correctly; or
-	 * <p><code>false</code> otherwise.
-	 * @since 1.0
-	 */
-	public static boolean filter(String name, Pattern included, Pattern excluded)
-	{
-		Pattern[] included_array = null;
-		if (included != null)
-		{
-			included_array = new Pattern[] {included};
-		}
+    /**
+     * Checks if the name filters through an including and an excluding
+     * regular expression.
+     *
+     * @param name     The <code>String</code> that will be filtered.
+     * @param included The regular expressions that needs to succeed
+     * @param excluded The regular expressions that needs to fail
+     * @return <code>true</code> if the name filtered through correctly; or
+     *         <p><code>false</code> otherwise.
+     * @since 1.0
+     */
+    public static boolean filter(String name, Pattern included, Pattern excluded)
+    {
+        Pattern[] included_array = null;
+        if (included != null)
+        {
+            included_array = new Pattern[]{included};
+        }
 
-		Pattern[] excluded_array = null;
-		if (excluded != null)
-		{
-			excluded_array = new Pattern[] {excluded};
-		}
+        Pattern[] excluded_array = null;
+        if (excluded != null)
+        {
+            excluded_array = new Pattern[]{excluded};
+        }
 
-		return filter(name, included_array, excluded_array);
-	}
+        return filter(name, included_array, excluded_array);
+    }
 
-	/**
-	 * Checks if the name filters through a series of including and excluding
-	 * regular expressions.
-	 *
-	 * @param name The <code>String</code> that will be filtered.
-	 * @param included An array of regular expressions that need to succeed
-	 * @param excluded An array of regular expressions that need to fail
-	 * @return <code>true</code> if the name filtered through correctly; or
-	 * <p><code>false</code> otherwise.
-	 * @since 1.0
-	 */
-	public static boolean filter(String name, Pattern[] included, Pattern[] excluded)
-	{
-		if (null == name)
-		{
-			return false;
-		}
+    /**
+     * Checks if the name filters through a series of including and excluding
+     * regular expressions.
+     *
+     * @param name     The <code>String</code> that will be filtered.
+     * @param included An array of regular expressions that need to succeed
+     * @param excluded An array of regular expressions that need to fail
+     * @return <code>true</code> if the name filtered through correctly; or
+     *         <p><code>false</code> otherwise.
+     * @since 1.0
+     */
+    public static boolean filter(String name, Pattern[] included, Pattern[] excluded)
+    {
+        if (null == name)
+        {
+            return false;
+        }
 
-		boolean accepted = false;
+        boolean accepted = false;
 
-		// retain only the includes
-		if (null == included)
-		{
-			accepted = true;
-		}
-		else
-		{
-			for (Pattern pattern : included)
-			{
-				if (pattern != null &&
-					pattern.matcher(name).matches())
-				{
-					accepted = true;
-					break;
-				}
-			}
-		}
+        // retain only the includes
+        if (null == included)
+        {
+            accepted = true;
+        } else
+        {
+            for (Pattern pattern : included)
+            {
+                if (pattern != null &&
+                        pattern.matcher(name).matches())
+                {
+                    accepted = true;
+                    break;
+                }
+            }
+        }
 
-		// remove the excludes
-		if (accepted &&
-			excluded != null)
-		{
-			for (Pattern pattern : excluded)
-			{
-				if (pattern != null &&
-					pattern.matcher(name).matches())
-				{
-					accepted = false;
-					break;
-				}
-			}
-		}
+        // remove the excludes
+        if (accepted &&
+                excluded != null)
+        {
+            for (Pattern pattern : excluded)
+            {
+                if (pattern != null &&
+                        pattern.matcher(name).matches())
+                {
+                    accepted = false;
+                    break;
+                }
+            }
+        }
 
-		return accepted;
-	}
+        return accepted;
+    }
 
-	/**
-	 * Ensure that the first character of the provided string is upper case.
-	 *
-	 * @param source The <code>String</code> to capitalize.
-	 * @return The capitalized <code>String</code>.
-	 * @since 1.0
-	 */
-	public static String capitalize(String source)
-	{
-		if (source == null || source.length() == 0)
-		{
-			return source;
-		}
+    /**
+     * Ensure that the first character of the provided string is upper case.
+     *
+     * @param source The <code>String</code> to capitalize.
+     * @return The capitalized <code>String</code>.
+     * @since 1.0
+     */
+    public static String capitalize(String source)
+    {
+        if (source == null || source.length() == 0)
+        {
+            return source;
+        }
 
-		if (source.length() > 1 &&
-			Character.isUpperCase(source.charAt(0)))
-		{
-			return source;
-		}
+        if (source.length() > 1 &&
+                Character.isUpperCase(source.charAt(0)))
+        {
+            return source;
+        }
 
-		char chars[] = source.toCharArray();
-		chars[0] = Character.toUpperCase(chars[0]);
-		return new String(chars);
-	}
+        char chars[] = source.toCharArray();
+        chars[0] = Character.toUpperCase(chars[0]);
+        return new String(chars);
+    }
 
-	/**
-	 * Ensure that the first character of the provided string lower case.
-	 *
-	 * @param source The <code>String</code> to uncapitalize.
-	 * @return The uncapitalized <code>String</code>.
-	 * @since 1.5
-	 */
-	public static String uncapitalize(String source)
-	{
-		if (source == null || source.length() == 0)
-		{
-			return source;
-		}
+    /**
+     * Ensure that the first character of the provided string lower case.
+     *
+     * @param source The <code>String</code> to uncapitalize.
+     * @return The uncapitalized <code>String</code>.
+     * @since 1.5
+     */
+    public static String uncapitalize(String source)
+    {
+        if (source == null || source.length() == 0)
+        {
+            return source;
+        }
 
-		if (source.length() > 1 &&
-			Character.isLowerCase(source.charAt(0)))
-		{
-			return source;
-		}
+        if (source.length() > 1 &&
+                Character.isLowerCase(source.charAt(0)))
+        {
+            return source;
+        }
 
-		char chars[] = source.toCharArray();
-		chars[0] = Character.toLowerCase(chars[0]);
-		return new String(chars);
-	}
+        char chars[] = source.toCharArray();
+        chars[0] = Character.toLowerCase(chars[0]);
+        return new String(chars);
+    }
 
-	private static String convertUrl(String source, Pattern pattern, boolean shorten, boolean sanitize, boolean no_follow)
-	{
-		int max_length = 1024;
+    private static String convertUrl(String source, Pattern pattern, boolean shorten, boolean sanitize, boolean no_follow)
+    {
+        int max_length = 1024;
 
-		String result = source;
+        String result = source;
 
-		Matcher url_matcher = pattern.matcher(source);
-		boolean found = url_matcher.find();
-		if (found)
-		{
-			String visual_url = null;
-			String actual_url = null;
-			int last = 0;
-			StringBuilder sb = new StringBuilder();
-			do
-			{
-				actual_url = url_matcher.group(1);
-				if (url_matcher.groupCount() > 1)
-				{
-					visual_url = url_matcher.group(2);
-				}
-				else
-				{
-					visual_url = actual_url;
-				}
+        Matcher url_matcher = pattern.matcher(source);
+        boolean found = url_matcher.find();
+        if (found)
+        {
+            String visual_url = null;
+            String actual_url = null;
+            int last = 0;
+            StringBuilder sb = new StringBuilder();
+            do
+            {
+                actual_url = url_matcher.group(1);
+                if (url_matcher.groupCount() > 1)
+                {
+                    visual_url = url_matcher.group(2);
+                } else
+                {
+                    visual_url = actual_url;
+                }
 
-				if (sanitize)
-				{
-					// defang javascript
-					actual_url = StringUtils.replace(actual_url, "javascript:", "");
+                if (sanitize)
+                {
+                    // defang javascript
+                    actual_url = StringUtils.replace(actual_url, "javascript:", "");
 
-					// fill in http:// for URLs that don't begin with /
-					if ((actual_url.indexOf("://") == -1) &&
-						(!actual_url.startsWith("/")))
-					{
-						actual_url = "http://"+actual_url;
-					}
-				}
+                    // fill in http:// for URLs that don't begin with /
+                    if ((actual_url.indexOf("://") == -1) &&
+                            (!actual_url.startsWith("/")))
+                    {
+                        actual_url = "http://" + actual_url;
+                    }
+                }
 
-				if (pattern.equals(BBCODE_BAREURL))
-				{
-					sb.append(source.substring(last, url_matcher.start(1)));
-				}
-				else
-				{
-					sb.append(source.substring(last, url_matcher.start(0)));
-				}
-				sb.append("<a href=\"");
-				sb.append(actual_url);
-				sb.append("\"");
-				if (actual_url.startsWith("http://") ||
-					actual_url.startsWith("https://"))
-				{
-					sb.append(" target=\"_blank\"");
-				}
-				if (no_follow)
-				{
-					sb.append(" rel=\"nofollow\"");
-				}
-				sb.append(">");
-				if (visual_url.length() <= max_length || !shorten)
-				{
-					sb.append(visual_url);
-				}
-				else
-				{
-					String ellipsis = "...";
-					int query_index = visual_url.indexOf("?");
+                if (pattern.equals(BBCODE_BAREURL))
+                {
+                    sb.append(source.substring(last, url_matcher.start(1)));
+                } else
+                {
+                    sb.append(source.substring(last, url_matcher.start(0)));
+                }
+                sb.append("<a href=\"");
+                sb.append(actual_url);
+                sb.append("\"");
+                if (actual_url.startsWith("http://") ||
+                        actual_url.startsWith("https://"))
+                {
+                    sb.append(" target=\"_blank\"");
+                }
+                if (no_follow)
+                {
+                    sb.append(" rel=\"nofollow\"");
+                }
+                sb.append(">");
+                if (visual_url.length() <= max_length || !shorten)
+                {
+                    sb.append(visual_url);
+                } else
+                {
+                    String ellipsis = "...";
+                    int query_index = visual_url.indexOf("?");
 
-					// hack query string off
-					// keep '?'
-					if (query_index != -1)
-					{
-						visual_url = visual_url.substring(0, query_index + 1) + ellipsis;
-					}
+                    // hack query string off
+                    // keep '?'
+                    if (query_index != -1)
+                    {
+                        visual_url = visual_url.substring(0, query_index + 1) + ellipsis;
+                    }
 
-					if (visual_url.length() >= max_length)
-					{
-						int last_slash = visual_url.lastIndexOf("/");
-						int start_slash = visual_url.indexOf("/", visual_url.indexOf("://")+3);
+                    if (visual_url.length() >= max_length)
+                    {
+                        int last_slash = visual_url.lastIndexOf("/");
+                        int start_slash = visual_url.indexOf("/", visual_url.indexOf("://") + 3);
 
-						if (last_slash != start_slash)
-						{
-							visual_url = visual_url.substring(0, start_slash + 1) + ellipsis + visual_url.substring(last_slash);
-						}
-					}
+                        if (last_slash != start_slash)
+                        {
+                            visual_url = visual_url.substring(0, start_slash + 1) + ellipsis + visual_url.substring(last_slash);
+                        }
+                    }
 
-					sb.append(visual_url);
-				}
-				sb.append("</a>");
+                    sb.append(visual_url);
+                }
+                sb.append("</a>");
 
-				if (pattern.equals(BBCODE_BAREURL))
-				{
-					last = url_matcher.end(1);
-				}
-				else
-				{
-					last = url_matcher.end(0);
-				}
+                if (pattern.equals(BBCODE_BAREURL))
+                {
+                    last = url_matcher.end(1);
+                } else
+                {
+                    last = url_matcher.end(0);
+                }
 
-				found = url_matcher.find();
-			}
-			while (found);
+                found = url_matcher.find();
+            }
+            while (found);
 
-			sb.append(source.substring(last));
-			result = sb.toString();
-		}
+            sb.append(source.substring(last));
+            result = sb.toString();
+        }
 
-		return result;
-	}
+        return result;
+    }
 
-	private static String parseBBCode(String source, boolean shorten, boolean sanitize, boolean convert_bare, boolean no_follow)
-	{
-		String result = source;
+    private static String parseBBCode(String source, boolean shorten, boolean sanitize, boolean convert_bare, boolean no_follow)
+    {
+        String result = source;
 
-		result = StringUtils.replace(result, "[b]", "<b>", false);
-		result = StringUtils.replace(result, "[/b]", "</b>", false);
-		result = StringUtils.replace(result, "[u]", "<u>", false);
-		result = StringUtils.replace(result, "[/u]", "</u>", false);
-		result = StringUtils.replace(result, "[i]", "<i>", false);
-		result = StringUtils.replace(result, "[/i]", "</i>", false);
-		result = StringUtils.replace(result, "[pre]", "<pre>", false);
-		result = StringUtils.replace(result, "[/pre]", "</pre>", false);
+        result = StringUtils.replace(result, "[b]", "<b>", false);
+        result = StringUtils.replace(result, "[/b]", "</b>", false);
+        result = StringUtils.replace(result, "[u]", "<u>", false);
+        result = StringUtils.replace(result, "[/u]", "</u>", false);
+        result = StringUtils.replace(result, "[i]", "<i>", false);
+        result = StringUtils.replace(result, "[/i]", "</i>", false);
+        result = StringUtils.replace(result, "[pre]", "<pre>", false);
+        result = StringUtils.replace(result, "[/pre]", "</pre>", false);
 
-		String			resultCopy = result;
-		String			resultLowerCopy = result.toLowerCase();
-		StringBuilder	buffer = new StringBuilder();
-		int startIndex;
-		int endIndex;
-		while (-1 != (startIndex = resultLowerCopy.indexOf("[*]")))
-		{
-			int begin = resultLowerCopy.indexOf("[list]", startIndex + 3);
-			int end = resultLowerCopy.indexOf("[/list]", startIndex + 3);
-			int next = resultLowerCopy.indexOf("[*]", startIndex + 3); // 3 == sizeof [*]
+        String resultCopy = result;
+        String resultLowerCopy = result.toLowerCase();
+        StringBuilder buffer = new StringBuilder();
+        int startIndex;
+        int endIndex;
+        while (-1 != (startIndex = resultLowerCopy.indexOf("[*]")))
+        {
+            int begin = resultLowerCopy.indexOf("[list]", startIndex + 3);
+            int end = resultLowerCopy.indexOf("[/list]", startIndex + 3);
+            int next = resultLowerCopy.indexOf("[*]", startIndex + 3); // 3 == sizeof [*]
 
-			if (begin == -1)
-			{
-				begin = Integer.MAX_VALUE;
-			}
+            if (begin == -1)
+            {
+                begin = Integer.MAX_VALUE;
+            }
 
-			if (end == -1)
-			{
-				end = Integer.MAX_VALUE;
-			}
+            if (end == -1)
+            {
+                end = Integer.MAX_VALUE;
+            }
 
-			if (next == -1)
-			{
-				next = Integer.MAX_VALUE;
-			}
+            if (next == -1)
+            {
+                next = Integer.MAX_VALUE;
+            }
 
-			if (next < begin && next < end)
-			{
-				endIndex = next;
-			}
-			else if (begin < next && begin < end)
-			{
-				endIndex = begin;
-			}
-			else if (end < next && end < begin)
-			{
-				endIndex = end;
-			}
-			else
-			{
-				endIndex = resultLowerCopy.length();
-			}
+            if (next < begin && next < end)
+            {
+                endIndex = next;
+            } else if (begin < next && begin < end)
+            {
+                endIndex = begin;
+            } else if (end < next && end < begin)
+            {
+                endIndex = end;
+            } else
+            {
+                endIndex = resultLowerCopy.length();
+            }
 
-			buffer
-				.append(resultCopy.substring(0, startIndex))
-				.append("<li>")
-				.append(resultCopy.substring(startIndex + 3, endIndex)) // 3 == sizeof [*]
-				.append("</li>");
+            buffer
+                    .append(resultCopy.substring(0, startIndex))
+                    .append("<li>")
+                    .append(resultCopy.substring(startIndex + 3, endIndex)) // 3 == sizeof [*]
+                    .append("</li>");
 
-			resultCopy = resultCopy.substring(endIndex);
-			resultLowerCopy = resultLowerCopy.substring(endIndex);
-		}
-		buffer.append(resultCopy.substring(0));
+            resultCopy = resultCopy.substring(endIndex);
+            resultLowerCopy = resultLowerCopy.substring(endIndex);
+        }
+        buffer.append(resultCopy.substring(0));
 
-		result = buffer.toString();
+        result = buffer.toString();
 
-		result = StringUtils.replace(result, "[list]", "<ul>", false);
-		result = StringUtils.replace(result, "[/list]", "</ul>", false);
+        result = StringUtils.replace(result, "[list]", "<ul>", false);
+        result = StringUtils.replace(result, "[/list]", "</ul>", false);
 
-		Matcher color_matcher = BBCODE_COLOR.matcher(result);
-		result = color_matcher.replaceAll("<font color=\"$1\">");
-		result = StringUtils.replace(result, "[/color]", "</font>", false);
+        Matcher color_matcher = BBCODE_COLOR.matcher(result);
+        result = color_matcher.replaceAll("<font color=\"$1\">");
+        result = StringUtils.replace(result, "[/color]", "</font>", false);
 
-		Matcher size_matcher = BBCODE_SIZE.matcher(result);
-		result = size_matcher.replaceAll("<font size=\"$1\">");
-		result = StringUtils.replace(result, "[/size]", "</font>", false);
+        Matcher size_matcher = BBCODE_SIZE.matcher(result);
+        result = size_matcher.replaceAll("<font size=\"$1\">");
+        result = StringUtils.replace(result, "[/size]", "</font>", false);
 
-		result = convertUrl(result, BBCODE_URL_SHORT, shorten, sanitize, no_follow);
-		result = convertUrl(result, BBCODE_URL_LONG, shorten, sanitize, no_follow);
+        result = convertUrl(result, BBCODE_URL_SHORT, shorten, sanitize, no_follow);
+        result = convertUrl(result, BBCODE_URL_LONG, shorten, sanitize, no_follow);
 
-		if (convert_bare)
-		{
-			result = convertUrl(result, BBCODE_BAREURL, shorten, sanitize, no_follow);
-		}
+        if (convert_bare)
+        {
+            result = convertUrl(result, BBCODE_BAREURL, shorten, sanitize, no_follow);
+        }
 
-		Matcher img_matcher = BBCODE_IMG.matcher(result);
-		result = img_matcher.replaceAll("<div class=\"bbcode_img\"><img src=\"$1\" border=\"0\" alt=\"\" /></div>");
+        Matcher img_matcher = BBCODE_IMG.matcher(result);
+        result = img_matcher.replaceAll("<div class=\"bbcode_img\"><img src=\"$1\" border=\"0\" alt=\"\" /></div>");
 
-		Matcher quote_matcher_long = BBCODE_QUOTE_LONG.matcher(result);
-		result = quote_matcher_long.replaceAll("<div class=\"quoteaccount\">$1:</div><div class=\"quotebody\">");
-		result = StringUtils.replace(result, "[quote]", "<div class=\"quotebody\">", false);
-		result = StringUtils.replace(result, "[/quote]", "</div>", false);
+        Matcher quote_matcher_long = BBCODE_QUOTE_LONG.matcher(result);
+        result = quote_matcher_long.replaceAll("<div class=\"quoteaccount\">$1:</div><div class=\"quotebody\">");
+        result = StringUtils.replace(result, "[quote]", "<div class=\"quotebody\">", false);
+        result = StringUtils.replace(result, "[/quote]", "</div>", false);
 
-		result = StringUtils.replace(result, "\r\n", "<br />\r");
-		result = StringUtils.replace(result, "\n", "<br />\n");
-		result = StringUtils.replace(result, "\r", "\r\n");
+        result = StringUtils.replace(result, "\r\n", "<br />\r");
+        result = StringUtils.replace(result, "\n", "<br />\n");
+        result = StringUtils.replace(result, "\r", "\r\n");
 
-		// remove the BR that could be added due to code formatting ppl
-		// use to format lists
-		result = StringUtils.replace(result, "ul><br />\r\n", "ul>\r\n");
-		result = StringUtils.replace(result, "ul><br />\n", "ul>\n");
+        // remove the BR that could be added due to code formatting ppl
+        // use to format lists
+        result = StringUtils.replace(result, "ul><br />\r\n", "ul>\r\n");
+        result = StringUtils.replace(result, "ul><br />\n", "ul>\n");
 
-		return result;
-	}
+        return result;
+    }
 
-	/**
-	 * Converts a <code>String</code> to a <code>boolean</code> value.
-	 *
-	 * @param value The <code>String</code> to convert.
-	 * @return The corresponding <code>boolean</code> value.
-	 * @since 1.0
-	 */
-	public static boolean convertToBoolean(String value)
-	{
-		if (null == value)
-		{
-			return false;
-		}
+    /**
+     * Converts a <code>String</code> to a <code>boolean</code> value.
+     *
+     * @param value The <code>String</code> to convert.
+     * @return The corresponding <code>boolean</code> value.
+     * @since 1.0
+     */
+    public static boolean convertToBoolean(String value)
+    {
+        if (null == value)
+        {
+            return false;
+        }
 
-		if (value.equals("1") ||
-			value.equalsIgnoreCase("t") ||
-			value.equalsIgnoreCase("true") ||
-			value.equalsIgnoreCase("y") ||
-			value.equalsIgnoreCase("yes") ||
-			value.equalsIgnoreCase("on"))
-		{
-			return true;
-		}
+        if (value.equals("1") ||
+                value.equalsIgnoreCase("t") ||
+                value.equalsIgnoreCase("true") ||
+                value.equalsIgnoreCase("y") ||
+                value.equalsIgnoreCase("yes") ||
+                value.equalsIgnoreCase("on"))
+        {
+            return true;
+        }
 
-		return false;
-	}
+        return false;
+    }
 
-	/**
-	 * Converts all tabs on a line to spaces according to the provided tab
-	 * width.
-	 *
-	 * @param line The line whose tabs have to be converted.
-	 * @param tabWidth The tab width.
-	 * @return A new <code>String</code> object containing the line with the
-	 * replaced tabs.
-	 * @since 1.0
-	 */
-	public static String convertTabsToSpaces(String line, int tabWidth)
-	{
-		StringBuilder result = new StringBuilder();
-		int tab_index = -1;
-		int last_tab_index = 0;
-		int added_chars = 0;
-		int tab_size;
-		while ((tab_index = line.indexOf("\t", last_tab_index)) != -1)
-		{
-			tab_size = tabWidth-((tab_index+added_chars)%tabWidth);
-			if (0 == tab_size)
-			{
-				tab_size = tabWidth;
-			}
-			added_chars += tab_size-1;
-			result.append(line.substring(last_tab_index, tab_index));
-			result.append(StringUtils.repeat(" ", tab_size));
-			last_tab_index = tab_index+1;
-		}
-		if (0 == last_tab_index)
-		{
-			return line;
-		}
-		else
-		{
-			result.append(line.substring(last_tab_index));
-		}
+    /**
+     * Converts all tabs on a line to spaces according to the provided tab
+     * width.
+     *
+     * @param line     The line whose tabs have to be converted.
+     * @param tabWidth The tab width.
+     * @return A new <code>String</code> object containing the line with the
+     *         replaced tabs.
+     * @since 1.0
+     */
+    public static String convertTabsToSpaces(String line, int tabWidth)
+    {
+        StringBuilder result = new StringBuilder();
+        int tab_index = -1;
+        int last_tab_index = 0;
+        int added_chars = 0;
+        int tab_size;
+        while ((tab_index = line.indexOf("\t", last_tab_index)) != -1)
+        {
+            tab_size = tabWidth - ((tab_index + added_chars) % tabWidth);
+            if (0 == tab_size)
+            {
+                tab_size = tabWidth;
+            }
+            added_chars += tab_size - 1;
+            result.append(line.substring(last_tab_index, tab_index));
+            result.append(StringUtils.repeat(" ", tab_size));
+            last_tab_index = tab_index + 1;
+        }
+        if (0 == last_tab_index)
+        {
+            return line;
+        } else
+        {
+            result.append(line.substring(last_tab_index));
+        }
 
-		return result.toString();
-	}
+        return result.toString();
+    }
 
-	/**
-	 * Ensures that all whitespace is removed from a <code>String</code>.
-	 * <p>It also works with a <code>null</code> argument.
-	 *
-	 * @param source The <code>String</code> to trim.
-	 * @return The trimmed <code>String</code>.
-	 * @since 1.0
-	 */
-	public static String trim(String source)
-	{
-		if (source == null || source.length() == 0)
-		{
-			return source;
-		}
+    /**
+     * Ensures that all whitespace is removed from a <code>String</code>.
+     * <p>It also works with a <code>null</code> argument.
+     *
+     * @param source The <code>String</code> to trim.
+     * @return The trimmed <code>String</code>.
+     * @since 1.0
+     */
+    public static String trim(String source)
+    {
+        if (source == null || source.length() == 0)
+        {
+            return source;
+        }
 
-		return source.trim();
-	}
+        return source.trim();
+    }
 
     /**
      * Reformats a string where lines that are longer than <tt>width</tt>
      * are split apart at the earliest wordbreak or at maxLength, whichever is
      * sooner. If the width specified is less than 5 or greater than the input
      * Strings length the string will be returned as is.
-     * <p>
+     * <p/>
      * Please note that this method can be lossy - trailing spaces on wrapped
      * lines may be trimmed.
      *
@@ -2814,12 +2778,10 @@
         if (input == null)
         {
             return "";
-        }
-        else if (width < 5)
+        } else if (width < 5)
         {
             return input;
-        }
-        else if (width >= input.length())
+        } else if (width >= input.length())
         {
             return input;
         }
@@ -2831,18 +2793,18 @@
         }
 
         StringBuilder buffer = new StringBuilder(input.length());
-		int		current_index = 0;
-		int		delimiter_index = 0;
-		String	seperator = "\n";
-		String	line;
+        int current_index = 0;
+        int delimiter_index = 0;
+        String seperator = "\n";
+        String line;
 
-		// go over the input string and jump from line to line
-		while (current_index <= input.length())
-		{
-			// look for the next linebreak
-			delimiter_index = input.indexOf(seperator, current_index);
+        // go over the input string and jump from line to line
+        while (current_index <= input.length())
+        {
+            // look for the next linebreak
+            delimiter_index = input.indexOf(seperator, current_index);
 
-			// get the line that corresponds to it
+            // get the line that corresponds to it
 			if (-1 == delimiter_index)
 			{
 				line = new String(input.substring(current_index, input.length()));
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TPCLIDConverter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TPCLIDConverter.java
index 46a2cc1..a4989d8 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TPCLIDConverter.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TPCLIDConverter.java
@@ -368,7 +368,7 @@
         Coordinate pt2 = new Coordinate(point);
         pt2.x += width;
         pt2.y += height;
-        return  new Envelope(point, pt2);
+        return new Envelope(point, pt2);
     }
 
     public static Coordinate convertTpclIdToCoordinate(String tpclid)
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWD97GeometryConverterDecorator.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWD97GeometryConverterDecorator.java
index 72f9537..0cb12d5 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWD97GeometryConverterDecorator.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWD97GeometryConverterDecorator.java
@@ -7,7 +7,6 @@
 import com.vividsolutions.jts.geom.GeometryFactory;
 import com.vividsolutions.jts.util.Assert;
 
-import com.ximple.eofms.util.TWDDatumConverter;
 import com.ximple.io.dgn7.GeometryConverter;
 
 public class TWD97GeometryConverterDecorator implements GeometryConverter
@@ -45,7 +44,7 @@
     {
         public void filter(CoordinateSequence coordinateSequence, int i)
         {
-            Coordinate pt =coordinateSequence.getCoordinate(i);
+            Coordinate pt = coordinateSequence.getCoordinate(i);
             Coordinate pt97 = TWDDatumConverter.fromTM2ToTWD97(pt);
             pt.x = pt97.x;
             pt.y = pt97.y;
diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWDDatumConverter.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWDDatumConverter.java
index e9a6445..0971069 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWDDatumConverter.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/util/TWDDatumConverter.java
@@ -15,7 +15,7 @@
      *   Definition of math related value
      */
     private static final double COS67_5 = 0.3826834323650897717284599840304e0;
-    private static final double PI      = 3.14159265358979323e0;
+    private static final double PI = 3.14159265358979323e0;
     private static final double HALF_PI = 1.570796326794896615e0;
     private static final double DEG_RAD = 0.01745329251994329572e0;
     private static final double RAD_DEG = 57.295779513082321031e0;
@@ -23,10 +23,10 @@
     /*
      * Definition of datum related value
      */
-    private static final double AD_C       = 1.0026000e0;
-    private static final double TWD67_A    = 6378160.0e0;
-    private static final double TWD67_B    = 6356774.7192e0;
-    private static final double TWD67_ECC  = 0.00669454185458e0;
+    private static final double AD_C = 1.0026000e0;
+    private static final double TWD67_A = 6378160.0e0;
+    private static final double TWD67_B = 6356774.7192e0;
+    private static final double TWD67_ECC = 0.00669454185458e0;
     private static final double TWD67_ECC2 = 0.00673966079586e0;
 
     // different from garmin and already knowned value, but those all value only
@@ -36,17 +36,17 @@
     private static final double TWD67_DY = -361.32e0;
 
     // release to public. if can got more enough twd67/twd97 control point coordinare,
-    private static final double TWD67_DZ   = -180.51e0;
-    private static final double TWD67_RX   = -0.00000117e0;    // then we can calculate a better value than now.
-    private static final double TWD67_RY   = 0.00000184e0;     //
-    private static final double TWD67_RZ   = 0.00000098e0;     // and, also lack twd67/twd97 altitude convertion value...
-    private static final double TWD67_S    = 0.00002329e0;     //
-    private static final double TWD97_A    = 6378137.0e0;
-    private static final double TWD97_B    = 6356752.3141e0;
-    private static final double TWD97_ECC  = 0.00669438002290e0;
+    private static final double TWD67_DZ = -180.51e0;
+    private static final double TWD67_RX = -0.00000117e0;    // then we can calculate a better value than now.
+    private static final double TWD67_RY = 0.00000184e0;     //
+    private static final double TWD67_RZ = 0.00000098e0;     // and, also lack twd67/twd97 altitude convertion value...
+    private static final double TWD67_S = 0.00002329e0;     //
+    private static final double TWD97_A = 6378137.0e0;
+    private static final double TWD97_B = 6356752.3141e0;
+    private static final double TWD97_ECC = 0.00669438002290e0;
     private static final double TWD97_ECC2 = 0.00673949677556e0;
-    private static final double TWD67_TM2  = 0.9999e0;         // TWD67->TM2 scale
-    private static final double TWD97_TM2  = 0.9999e0;         // TWD97->TM2 scale
+    private static final double TWD67_TM2 = 0.9999e0;         // TWD67->TM2 scale
+    private static final double TWD97_TM2 = 0.9999e0;         // TWD97->TM2 scale
 
     /*
      * datum convert function
@@ -59,8 +59,8 @@
         double x1, y1, z1, x2, y2, z2;
         double q, q2, t, t1, s, s1, sum, sin_b, cos_b, sin_p, cos_p;
 
-        lon    = pt.x * DEG_RAD;
-        lat    = pt.y * DEG_RAD;
+        lon = pt.x * DEG_RAD;
+        lat = pt.y * DEG_RAD;
         height = pt.z * DEG_RAD;
 
         if ((lat < -HALF_PI) && (lat > -1.001 * HALF_PI))
@@ -81,14 +81,14 @@
 
         sin_lat = Math.sin(lat);
         cos_lat = Math.cos(lat);
-        r       = TWD67_A / (Math.sqrt(1.0 - TWD67_ECC * sin_lat * sin_lat));
-        x1      = (r + height) * cos_lat * Math.cos(lon);
-        y1      = (r + height) * cos_lat * Math.sin(lon);
-        z1      = ((r * (1 - TWD67_ECC)) + height) * sin_lat;
-        x2      = x1 + TWD67_DX + TWD67_S * (lon + TWD67_RZ * lat - TWD67_RY * height);
-        y2      = y1 + TWD67_DY + TWD67_S * (-TWD67_RZ * lon + lat + TWD67_RX * height);
-        z2      = z1 + TWD67_DZ + TWD67_S * (TWD67_RY * lon - TWD67_RX * lat + height);
-        pole    = 0.0;
+        r = TWD67_A / (Math.sqrt(1.0 - TWD67_ECC * sin_lat * sin_lat));
+        x1 = (r + height) * cos_lat * Math.cos(lon);
+        y1 = (r + height) * cos_lat * Math.sin(lon);
+        z1 = ((r * (1 - TWD67_ECC)) + height) * sin_lat;
+        x2 = x1 + TWD67_DX + TWD67_S * (lon + TWD67_RZ * lat - TWD67_RY * height);
+        y2 = y1 + TWD67_DY + TWD67_S * (-TWD67_RZ * lon + lat + TWD67_RX * height);
+        z2 = z1 + TWD67_DZ + TWD67_S * (TWD67_RY * lon - TWD67_RX * lat + height);
+        pole = 0.0;
 
         if (x2 != 0.0)
         {
@@ -104,7 +104,7 @@
             } else
             {
                 pole = 1;
-                lon  = 0;
+                lon = 0;
 
                 if (z2 > 0)
                 {
@@ -114,7 +114,7 @@
                     lat = -HALF_PI;
                 } else
                 {
-                    lat  = HALF_PI;
+                    lat = HALF_PI;
                     newX = lon * RAD_DEG;
                     newY = lat * RAD_DEG;
                     newZ = -TWD97_B;
@@ -124,18 +124,18 @@
             }
         }
 
-        q2    = x2 * x2 + y2 * y2;
-        q     = Math.sqrt(q2);
-        t     = z2 * AD_C;
-        s     = Math.sqrt(t * t + q2);
+        q2 = x2 * x2 + y2 * y2;
+        q = Math.sqrt(q2);
+        t = z2 * AD_C;
+        s = Math.sqrt(t * t + q2);
         sin_b = t / s;
         cos_b = q / s;
-        t1    = z2 + TWD97_B * TWD97_ECC2 * sin_b * sin_b * sin_b;
-        sum   = q - TWD97_A * TWD97_ECC * cos_b * cos_b * cos_b;
-        s1    = Math.sqrt(t1 * t1 + sum * sum);
+        t1 = z2 + TWD97_B * TWD97_ECC2 * sin_b * sin_b * sin_b;
+        sum = q - TWD97_A * TWD97_ECC * cos_b * cos_b * cos_b;
+        s1 = Math.sqrt(t1 * t1 + sum * sum);
         sin_p = t1 / s1;
         cos_p = sum / s1;
-        r     = TWD97_A / Math.sqrt(1.0 - TWD97_ECC * sin_p * sin_p);
+        r = TWD97_A / Math.sqrt(1.0 - TWD97_ECC * sin_p * sin_p);
 
         if (cos_p >= COS67_5)
         {
@@ -148,7 +148,7 @@
             height = z2 / sin_p + r * (TWD97_ECC - 1.0);
         }
 
-        if (pole !=0.0)
+        if (pole != 0.0)
         {
             lat = Math.atan(sin_p / cos_p);
         }
@@ -167,8 +167,8 @@
         double x1, y1, z1, x2, y2, z2;
         double q, q2, t, t1, s, s1, sum, sin_b, cos_b, sin_p, cos_p;
 
-        lon    = pt.x * DEG_RAD;
-        lat    = pt.y * DEG_RAD;
+        lon = pt.x * DEG_RAD;
+        lat = pt.y * DEG_RAD;
         height = pt.z * DEG_RAD;
 
         if ((lat < -HALF_PI) && (lat > -1.001 * HALF_PI))
@@ -189,14 +189,14 @@
 
         sin_lat = Math.sin(lat);
         cos_lat = Math.cos(lat);
-        r       = TWD97_A / (Math.sqrt(1.0 - TWD97_ECC * sin_lat * sin_lat));
-        x1      = (r + height) * cos_lat * Math.cos(lon);
-        y1      = (r + height) * cos_lat * Math.sin(lon);
-        z1      = ((r * (1 - TWD97_ECC)) + height) * sin_lat;
-        x2      = x1 - TWD67_DX - TWD67_S * (lon + TWD67_RZ * lat - TWD67_RY * height);
-        y2      = y1 - TWD67_DY - TWD67_S * (-TWD67_RZ * lon + lat + TWD67_RX * height);
-        z2      = z1 - TWD67_DZ - TWD67_S * (TWD67_RY * lon - TWD67_RX * lat + height);
-        pole    = 0;
+        r = TWD97_A / (Math.sqrt(1.0 - TWD97_ECC * sin_lat * sin_lat));
+        x1 = (r + height) * cos_lat * Math.cos(lon);
+        y1 = (r + height) * cos_lat * Math.sin(lon);
+        z1 = ((r * (1 - TWD97_ECC)) + height) * sin_lat;
+        x2 = x1 - TWD67_DX - TWD67_S * (lon + TWD67_RZ * lat - TWD67_RY * height);
+        y2 = y1 - TWD67_DY - TWD67_S * (-TWD67_RZ * lon + lat + TWD67_RX * height);
+        z2 = z1 - TWD67_DZ - TWD67_S * (TWD67_RY * lon - TWD67_RX * lat + height);
+        pole = 0;
 
         if (x2 != 0.0)
         {
@@ -212,7 +212,7 @@
             } else
             {
                 pole = 1;
-                lon  = 0;
+                lon = 0;
 
                 if (z2 > 0)
                 {
@@ -222,7 +222,7 @@
                     lat = -HALF_PI;
                 } else
                 {
-                    lat  = HALF_PI;
+                    lat = HALF_PI;
                     newX = lon * RAD_DEG;
                     newY = lat * RAD_DEG;
                     newZ = -TWD67_B;
@@ -232,18 +232,18 @@
             }
         }
 
-        q2    = x2 * x2 + y2 * y2;
-        q     = Math.sqrt(q2);
-        t     = z2 * AD_C;
-        s     = Math.sqrt(t * t + q2);
+        q2 = x2 * x2 + y2 * y2;
+        q = Math.sqrt(q2);
+        t = z2 * AD_C;
+        s = Math.sqrt(t * t + q2);
         sin_b = t / s;
         cos_b = q / s;
-        t1    = z2 + TWD67_B * TWD67_ECC2 * sin_b * sin_b * sin_b;
-        sum   = q - TWD67_A * TWD67_ECC * cos_b * cos_b * cos_b;
-        s1    = Math.sqrt(t1 * t1 + sum * sum);
+        t1 = z2 + TWD67_B * TWD67_ECC2 * sin_b * sin_b * sin_b;
+        sum = q - TWD67_A * TWD67_ECC * cos_b * cos_b * cos_b;
+        s1 = Math.sqrt(t1 * t1 + sum * sum);
         sin_p = t1 / s1;
         cos_p = sum / s1;
-        r     = TWD67_A / Math.sqrt(1.0 - TWD67_ECC * sin_p * sin_p);
+        r = TWD67_A / Math.sqrt(1.0 - TWD67_ECC * sin_p * sin_p);
 
         if (cos_p >= COS67_5)
         {
@@ -273,24 +273,24 @@
         double n, t, c, A;
         double newX, newY;
 
-        x0   = x * DEG_RAD;
-        y0   = y * DEG_RAD;
-        x1   = lon * DEG_RAD;
-        y1   = lat * DEG_RAD;
-        m0   = mercator(y1, a, ecc);
-        m1   = mercator(y0, a, ecc);
-        n    = a / Math.sqrt(1 - ecc * Math.pow(Math.sin(y0), 2.0));
-        t    = Math.pow(Math.tan(y0), 2.0);
-        c    = ecc2 * Math.pow(Math.cos(y0), 2.0);
-        A    = (x0 - x1) * Math.cos(y0);
+        x0 = x * DEG_RAD;
+        y0 = y * DEG_RAD;
+        x1 = lon * DEG_RAD;
+        y1 = lat * DEG_RAD;
+        m0 = mercator(y1, a, ecc);
+        m1 = mercator(y0, a, ecc);
+        n = a / Math.sqrt(1 - ecc * Math.pow(Math.sin(y0), 2.0));
+        t = Math.pow(Math.tan(y0), 2.0);
+        c = ecc2 * Math.pow(Math.cos(y0), 2.0);
+        A = (x0 - x1) * Math.cos(y0);
         newX = scale * n
-               * (A + (1.0 - t + c) * A * A * A / 6.0
-                  + (5.0 - 18.0 * t + t * t + 72.0 * c - 58.0 * ecc2) * Math.pow(A, 5.0) / 120.0);
+                * (A + (1.0 - t + c) * A * A * A / 6.0
+                + (5.0 - 18.0 * t + t * t + 72.0 * c - 58.0 * ecc2) * Math.pow(A, 5.0) / 120.0);
         newY = scale
-               * (m1 - m0
-                  + n * Math.tan(y0)
-                    * (A * A / 2.0 + (5.0 - t + 9.0 * c + 4 * c * c) * Math.pow(A, 4.0) / 24.0
-                       + (61.0 - 58.0 * t + t * t + 600.0 * c - 330.0 * ecc2) * Math.pow(A, 6.0) / 720.0));
+                * (m1 - m0
+                + n * Math.tan(y0)
+                * (A * A / 2.0 + (5.0 - t + 9.0 * c + 4 * c * c) * Math.pow(A, 4.0) / 24.0
+                + (61.0 - 58.0 * t + t * t + 600.0 * c - 330.0 * ecc2) * Math.pow(A, 6.0) / 720.0));
         return new Coordinate(newX, newY);
     }
 
@@ -300,30 +300,30 @@
         double x0, y0, x1, y1, phi, m, m0, mu, e1;
         double c1, t1, n1, r1, d;
 
-        x0  = x;
-        y0  = y;
-        x1  = lon * DEG_RAD;
-        y1  = lat * DEG_RAD;
-        m0  = mercator(y1, a, ecc);
-        m   = m0 + y0 / scale;
-        e1  = (1.0 - Math.sqrt(1.0 - ecc)) / (1.0 + Math.sqrt(1.0 - ecc));
-        mu  = m / (a * (1.0 - ecc / 4.0 - 3.0 * ecc * ecc / 64.0 - 5.0 * ecc * ecc * ecc / 256.0));
+        x0 = x;
+        y0 = y;
+        x1 = lon * DEG_RAD;
+        y1 = lat * DEG_RAD;
+        m0 = mercator(y1, a, ecc);
+        m = m0 + y0 / scale;
+        e1 = (1.0 - Math.sqrt(1.0 - ecc)) / (1.0 + Math.sqrt(1.0 - ecc));
+        mu = m / (a * (1.0 - ecc / 4.0 - 3.0 * ecc * ecc / 64.0 - 5.0 * ecc * ecc * ecc / 256.0));
         phi = mu + (3.0 * e1 / 2.0 - 27.0 * Math.pow(e1, 3.0) / 32.0) * Math.sin(2.0 * mu)
-              + (21.0 * e1 * e1 / 16.0 - 55.0 * Math.pow(e1, 4.0) / 32.0) * Math.sin(4.0 * mu)
-              + 151.0 * Math.pow(e1, 3.0) / 96.0 * Math.sin(6.0 * mu) + 1097.0 * Math.pow(e1, 4.0) / 512.0 * Math.sin(8.0 * mu);
-        c1   = ecc2 * Math.pow(Math.cos(phi), 2.0);
-        t1   = Math.pow(Math.tan(phi), 2.0);
-        n1   = a / Math.sqrt(1 - ecc * Math.pow(Math.sin(phi), 2.0));
-        r1   = a * (1.0 - ecc) / Math.pow(1.0 - ecc * Math.pow(Math.sin(phi), 2.0), 1.5);
-        d    = x0 / (n1 * scale);
+                + (21.0 * e1 * e1 / 16.0 - 55.0 * Math.pow(e1, 4.0) / 32.0) * Math.sin(4.0 * mu)
+                + 151.0 * Math.pow(e1, 3.0) / 96.0 * Math.sin(6.0 * mu) + 1097.0 * Math.pow(e1, 4.0) / 512.0 * Math.sin(8.0 * mu);
+        c1 = ecc2 * Math.pow(Math.cos(phi), 2.0);
+        t1 = Math.pow(Math.tan(phi), 2.0);
+        n1 = a / Math.sqrt(1 - ecc * Math.pow(Math.sin(phi), 2.0));
+        r1 = a * (1.0 - ecc) / Math.pow(1.0 - ecc * Math.pow(Math.sin(phi), 2.0), 1.5);
+        d = x0 / (n1 * scale);
         newX = (x1 + (d - (1.0 + 2.0 * t1 + c1) * Math.pow(d, 3.0) / 6.0
-                      + (5.0 - 2.0 * c1 + 28.0 * t1 - 3.0 * c1 * c1 + 8.0 * ecc2 + 24.0 * t1 * t1) * Math.pow(d, 5.0)
-                        / 120.0) / Math.cos(phi)) * RAD_DEG;
+                + (5.0 - 2.0 * c1 + 28.0 * t1 - 3.0 * c1 * c1 + 8.0 * ecc2 + 24.0 * t1 * t1) * Math.pow(d, 5.0)
+                / 120.0) / Math.cos(phi)) * RAD_DEG;
         newY = (phi
                 - n1 * Math.tan(phi) / r1
-                  * (d * d / 2.0 - (5.0 + 3.0 * t1 + 10.0 * c1 - 4.0 * c1 * c1 - 9.0 * ecc2) * Math.pow(d, 4.0) / 24.0
-                     + (61.0 + 90.0 * t1 + 298.0 * c1 + 45.0 * t1 * t1 - 252.0 * ecc2 - 3.0 * c1 * c1) * Math.pow(d, 6.0)
-                       / 72.0)) * RAD_DEG;
+                * (d * d / 2.0 - (5.0 + 3.0 * t1 + 10.0 * c1 - 4.0 * c1 * c1 - 9.0 * ecc2) * Math.pow(d, 4.0) / 24.0
+                + (61.0 + 90.0 * t1 + 298.0 * c1 + 45.0 * t1 * t1 - 252.0 * ecc2 - 3.0 * c1 * c1) * Math.pow(d, 6.0)
+                / 72.0)) * RAD_DEG;
         return new Coordinate(newX, newY);
     }
 
@@ -335,9 +335,9 @@
         } else
         {
             return a * ((1.0 - ecc / 4.0 - 3.0 * ecc * ecc / 64.0 - 5.0 * ecc * ecc * ecc / 256.0) * y
-                        - (3.0 * ecc / 8.0 + 3.0 * ecc * ecc / 32.0 + 45.0 * ecc * ecc * ecc / 1024.0) * Math.sin(2.0 * y)
-                        + (15.0 * ecc * ecc / 256.0 + 45.0 * ecc * ecc * ecc / 1024.0) * Math.sin(4.0 * y)
-                        - (35.0 * ecc * ecc * ecc / 3072.0) * Math.sin(6.0 * y));
+                    - (3.0 * ecc / 8.0 + 3.0 * ecc * ecc / 32.0 + 45.0 * ecc * ecc * ecc / 1024.0) * Math.sin(2.0 * y)
+                    + (15.0 * ecc * ecc / 256.0 + 45.0 * ecc * ecc * ecc / 1024.0) * Math.sin(4.0 * y)
+                    - (35.0 * ecc * ecc * ecc / 3072.0) * Math.sin(6.0 * y));
         }
     }
 
@@ -492,6 +492,7 @@
 
     /**
      * ��TM2�y���ഫ��TWD97�y��
+     *
      * @param pt TM2��m
      * @return �s��TWD97�y��
      */

--
Gitblit v0.0.0-SNAPSHOT