]> source.dussan.org Git - sonarqube.git/commitdiff
Fix usage of clob.free() on MsSQL
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 2 Apr 2015 10:00:25 +0000 (12:00 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 2 Apr 2015 10:00:36 +0000 (12:00 +0200)
sonar-core/src/test/java/org/sonar/core/persistence/DbTester.java

index ecceaa474d7a7002469a93204bddb68bfee3d7a3..a2dae090bdc2a6a34a4719eece707fa8c0ae24ee 100644 (file)
@@ -234,7 +234,7 @@ public class DbTester extends ExternalResource {
         if (value instanceof Clob) {
           Clob clob = (Clob) value;
           value = IOUtils.toString((clob.getAsciiStream()));
-          clob.free();
+          doClobFree(clob);
         } else if (value instanceof BigDecimal) {
           // In Oracle, INTEGER types are mapped as BigDecimal
           value = ((BigDecimal) value).longValue();
@@ -435,4 +435,12 @@ public class DbTester extends ExternalResource {
       IOUtils.closeQuietly(input);
     }
   }
+
+  private static void doClobFree(Clob clob) throws SQLException {
+    try {
+      clob.free();
+    } catch (AbstractMethodError e){
+      // JTS driver do not implement free() as it's using JDBC 3.0
+    }
+  }
 }