From 2beafbe22820de3c47e8c1128452c85ef6aeae33 Mon Sep 17 00:00:00 2001
From: Dennis Kao <ulysseskao@ximple.com.tw>
Date: Fri, 27 Sep 2013 18:06:41 +0800
Subject: [PATCH] update for distid

---
 xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeoserverIntegrateConfigJob.java |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeoserverIntegrateConfigJob.java b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeoserverIntegrateConfigJob.java
index 27143a7..6aaa5da 100644
--- a/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeoserverIntegrateConfigJob.java
+++ b/xdgnjobs/ximple-spatialjob/src/main/java/com/ximple/eofms/jobs/GeoserverIntegrateConfigJob.java
@@ -357,12 +357,18 @@
         PrintfFormat pf = new PrintfFormat(CREATE_VIEWSQL);
         String sql = pf.sprintf(new Object[]{viewName, schemaName, tableName});
         Statement stmt = connection.createStatement();
-        stmt.execute(sql);
-
-        pf = new PrintfFormat(ALTER_VIEWSQL + ownerName);
-        sql = pf.sprintf(viewName);
-        stmt.execute(sql);
-        stmt.close();
+        try {
+            stmt.execute(sql);
+            pf = new PrintfFormat(ALTER_VIEWSQL + ownerName);
+            sql = pf.sprintf(viewName);
+            stmt.execute(sql);
+        } catch (SQLException e) {
+            // logger.warn(e.getMessage(), e);
+            logger.info(sql == null ? "SQL=NULL" : "SQL=" + sql);
+            throw e;
+        } finally {
+            stmt.close();
+        }
         // connection.commit();
     }
 
@@ -468,7 +474,7 @@
         try {
             String currentTargetSchema = retrieveCurrentSchemaName(connection, vsstatusBefore);
             if (currentTargetSchema == null) {
-                logger.info("Cannot found target schema in dataStore.");
+                logger.info("Cannot found target schema in dataStore. status=" + vsstatusBefore);
                 return;
             }
             String existTargetSchema = null;
@@ -851,8 +857,8 @@
             };
             lge.setBounds("EPSG:3826",293838.061931726,2758423.49415501,311845.457747425,2768966.72993585);
             String defaultLayerNames = buildDefaultWMSLayerNames(DEFAULT_NAMESPACE, configs, lge);
-            logger.info(key + ":" + defaultLayerNames);
-            logger.info(lge.toString());
+            // logger.info(key + ":" + defaultLayerNames);
+            // logger.info(lge.toString());
             // wmsConfig.getBaseMapLayers().put(key, defaultLayerNames);
             String layerGroupName = key.toString();
             RESTLayerGroup layerGroup = reader.getLayerGroup(DEFAULT_NAMESPACE, layerGroupName);

--
Gitblit v0.0.0-SNAPSHOT