diff --git a/deploy2demosite.sh b/deploy2demosite.sh index 4f68747..09dadad 100644 --- a/deploy2demosite.sh +++ b/deploy2demosite.sh @@ -1,4 +1,4 @@ -OIYOKAN_VERSION=1.9.20210430e +OIYOKAN_VERSION=1.10.20210430g export OIYOKAN_VERSION mvn clean install diff --git a/pom.xml b/pom.xml index 4b99655..37ada27 100755 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ jp.oiyokan oiyokan - 1.9.20210430e + 1.10.20210430g oiyokan Oiyokan is a simple OData v4 Server. (based on Apache Olingo / Spring Boot / h2 database) diff --git a/src/main/java/jp/oiyokan/OiyokanConstants.java b/src/main/java/jp/oiyokan/OiyokanConstants.java index 75d6eee..54f0dda 100755 --- a/src/main/java/jp/oiyokan/OiyokanConstants.java +++ b/src/main/java/jp/oiyokan/OiyokanConstants.java @@ -27,7 +27,7 @@ public class OiyokanConstants { /** * Oiyokan のバージョン番号 */ - public static final String VERSION = "1.9.20210430e"; + public static final String VERSION = "1.10.20210430g"; /** * 実験的な $search 機能(全文検索)が有効化されているかどうか。 diff --git a/src/main/java/jp/oiyokan/common/OiyoCommonJdbcUtil.java b/src/main/java/jp/oiyokan/common/OiyoCommonJdbcUtil.java index 3838d86..384664e 100755 --- a/src/main/java/jp/oiyokan/common/OiyoCommonJdbcUtil.java +++ b/src/main/java/jp/oiyokan/common/OiyoCommonJdbcUtil.java @@ -782,7 +782,7 @@ public static List executeDml(Connection connTargetDb, OiyoSqlInfo sqlIn return generatedKeys; } catch (SQLIntegrityConstraintViolationException ex) { - // [M202] Integrity constraint violation occured (DML). 制約違反. + // [IY3401] Integrity constraint violation occured (DML). 制約違反. log.error(OiyokanMessages.IY3401 + ": " + sql + ", " + ex.toString()); // 制約違反については例外的に ex の getMessage についても呼出元に返却. throw new ODataApplicationException(OiyokanMessages.IY3401 + ": " + sql + ": " + ex.getMessage(), // @@ -793,7 +793,15 @@ public static List executeDml(Connection connTargetDb, OiyoSqlInfo sqlIn throw new ODataApplicationException(OiyokanMessages.IY3511 + ": " + sql, // OiyokanMessages.IY3511_CODE, Locale.ENGLISH); } catch (SQLException ex) { - if (ex.toString().indexOf("timed out") >= 0 /* SQL Server 2008 */) { + if (ex.toString().toLowerCase().contains("unique constraint")/* PostgreSQL */ // + || ex.toString().toLowerCase().contains("重複したキー")/* SQLSV2008 */) { + // TODO message + // [IY3401] Integrity constraint violation occured (DML). 制約違反. + log.error(OiyokanMessages.IY3401 + ": " + sql + ", " + ex.toString()); + // 制約違反については例外的に ex の getMessage についても呼出元に返却. + throw new ODataApplicationException(OiyokanMessages.IY3401 + ": " + sql + ": " + ex.getMessage(), // + OiyokanMessages.IY3401_CODE, Locale.ENGLISH); + } else if (ex.toString().toLowerCase().contains("timed out") /* SQL Server 2008 */ ) { // [IY3512] SQL timeout at exec insert/update/delete. log.error(OiyokanMessages.IY3512 + ": " + sql + ", " + ex.toString()); throw new ODataApplicationException(OiyokanMessages.IY3512 + ": " + sql, // diff --git a/src/test/java/jp/oiyokan/db/testdb/entity/UnitTestEntityPatchInsert01Test.java b/src/test/java/jp/oiyokan/db/testdb/entity/UnitTestEntityPatchInsert01Test.java index 97638b4..1707f4d 100644 --- a/src/test/java/jp/oiyokan/db/testdb/entity/UnitTestEntityPatchInsert01Test.java +++ b/src/test/java/jp/oiyokan/db/testdb/entity/UnitTestEntityPatchInsert01Test.java @@ -46,17 +46,17 @@ void test01() throws Exception { ODataResponse resp = OiyokanTestUtil.callPatch("/ODataTest2(" + key + ")", "{\n" // + " \"Name\":\"Name2\",\n" // + " \"Description\":\"Description2\"\n" + "}", false, true); - assertEquals(201, resp.getStatusCode()); - - resp = OiyokanTestUtil.callGet( // - "/ODataTest2", OiyoUrlUtil.encodeUrlQuery("$select=Decimal1,StringChar8,StringVar255")); - @SuppressWarnings("unused") - String result = OiyokanTestUtil.stream2String(resp.getContent()); - // System.err.println(result); + if (201 == resp.getStatusCode()) { + resp = OiyokanTestUtil.callGet( // + "/ODataTest2", OiyoUrlUtil.encodeUrlQuery("$select=Decimal1,StringChar8,StringVar255")); + @SuppressWarnings("unused") + String result = OiyokanTestUtil.stream2String(resp.getContent()); + // System.err.println(result); + } // INSERTした後なので存在する resp = OiyokanTestUtil.callGet("/ODataTest2(" + key + ")", null); - result = OiyokanTestUtil.stream2String(resp.getContent()); + String result = OiyokanTestUtil.stream2String(resp.getContent()); System.err.println(result); assertEquals(200, resp.getStatusCode());