aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-04-10 10:36:21 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-04-10 10:36:46 +0200
commit7c6ca990a9caef65967e3cb61f259c4e3cd61482 (patch)
treeefcbe4c09302804ab0ea3cb9419f48848449bfe2 /sonar-core
parent7effa4cf5ef1c02f5cecfdeccd8ba3c20e77fd0b (diff)
downloadsonarqube-7c6ca990a9caef65967e3cb61f259c4e3cd61482.tar.gz
sonarqube-7c6ca990a9caef65967e3cb61f259c4e3cd61482.zip
Fix PropertiesDao when updating a property with a null value
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper-oracle.xml2
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml2
-rw-r--r--sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java1
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update-result.xml3
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update.xml2
5 files changed, 8 insertions, 2 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper-oracle.xml b/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper-oracle.xml
index 907983b8ed9..e4779085142 100644
--- a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper-oracle.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper-oracle.xml
@@ -40,7 +40,7 @@
</select>
<update id="update" parameterType="Property">
- update properties set text_value = #{value} where id = #{id}
+ update properties set text_value = #{value, jdbcType=VARCHAR} where id = #{id}
</update>
<insert id="insert" parameterType="Property" useGeneratedKeys="true" keyProperty="id">
diff --git a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml b/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml
index f00498c4aba..9866dba04b3 100644
--- a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml
@@ -40,7 +40,7 @@
</select>
<update id="update" parameterType="Property">
- update properties set text_value = #{value} where id = #{id}
+ update properties set text_value = #{value, jdbcType=VARCHAR} where id = #{id}
</update>
<insert id="insert" parameterType="Property" useGeneratedKeys="true" keyProperty="id">
diff --git a/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java b/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java
index 080f3390d73..d6461c11fb5 100644
--- a/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/properties/PropertiesDaoTest.java
@@ -79,6 +79,7 @@ public class PropertiesDaoTest extends DaoTestCase {
dao.setProperty(new PropertyDto().setKey("global.key").setValue("new_global"));
dao.setProperty(new PropertyDto().setKey("project.key").setResourceId(10L).setValue("new_project"));
dao.setProperty(new PropertyDto().setKey("user.key").setUserId(100L).setValue("new_user"));
+ dao.setProperty(new PropertyDto().setKey("null.value").setValue(null));
checkTables("update", "properties");
}
diff --git a/sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update-result.xml b/sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update-result.xml
index 3e5eb87705c..c3268596de3 100644
--- a/sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update-result.xml
@@ -9,4 +9,7 @@
<!-- user -->
<properties id="3" prop_key="user.key" text_value="new_user" resource_id="[null]" user_id="100"/>
+ <!-- null value -->
+ <properties id="4" prop_key="null.value" text_value="[null]" resource_id="[null]" user_id="[null]"/>
+
</dataset>
diff --git a/sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update.xml b/sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update.xml
index 69387405cd5..5229a2b791a 100644
--- a/sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/properties/PropertiesDaoTest/update.xml
@@ -9,4 +9,6 @@
<!-- user -->
<properties id="3" prop_key="user.key" text_value="user" resource_id="[null]" user_id="100"/>
+ <!-- null value -->
+ <properties id="4" prop_key="null.value" text_value="not null" resource_id="[null]" user_id="[null]"/>
</dataset>