From 6eaf4f27f0afd9321a91702d65206561a8450833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Fri, 7 Feb 2014 01:51:55 +0100 Subject: [PATCH 1/2] make the check sum generation of sql and sqlFile changes independent of the default encoding which is different on different OS --- .../src/main/java/liquibase/change/AbstractSQLChange.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liquibase-core/src/main/java/liquibase/change/AbstractSQLChange.java b/liquibase-core/src/main/java/liquibase/change/AbstractSQLChange.java index 2d3affbda0..14cc97db36 100644 --- a/liquibase-core/src/main/java/liquibase/change/AbstractSQLChange.java +++ b/liquibase-core/src/main/java/liquibase/change/AbstractSQLChange.java @@ -169,7 +169,7 @@ public CheckSum generateCheckSum() { } if (sql != null) { - stream = new ByteArrayInputStream(sql.getBytes()); + stream = new ByteArrayInputStream(sql.getBytes("UTF-8")); } return CheckSum.compute(new NormalizingStream(this.getEndDelimiter(), this.isSplitStatements(), this.isStripComments(), stream), false); From 4c1a5cb1513830bf1e689aa16d980e206f63c5da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Kautler?= Date: Sun, 9 Feb 2014 19:38:38 +0100 Subject: [PATCH 2/2] make the check sum generation of the createProcedure change independent of the default encoding which is different on different OS --- .../java/liquibase/change/core/CreateProcedureChange.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/liquibase-core/src/main/java/liquibase/change/core/CreateProcedureChange.java b/liquibase-core/src/main/java/liquibase/change/core/CreateProcedureChange.java index 7975943827..329da96caa 100644 --- a/liquibase-core/src/main/java/liquibase/change/core/CreateProcedureChange.java +++ b/liquibase-core/src/main/java/liquibase/change/core/CreateProcedureChange.java @@ -14,6 +14,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; @DatabaseChange(name = "createProcedure", description = "Defines the definition for a stored procedure. This command is better to use for creating procedures than the raw sql command because it will not attempt to strip comments or break up lines.\n\nOften times it is best to use the CREATE OR REPLACE syntax along with setting runOnChange='true' on the enclosing changeSet tag. That way if you need to make a change to your procedure you can simply change your existing code rather than creating a new REPLACE PROCEDURE call. The advantage to this approach is that it keeps your change log smaller and allows you to more easily see what has changed in your procedure code through your source control system's diff command.", @@ -178,7 +179,11 @@ public CheckSum generateCheckSum() { } if (procedureText != null) { - stream = new ByteArrayInputStream(procedureText.getBytes()); + try { + stream = new ByteArrayInputStream(procedureText.getBytes("UTF-8")); + } catch (UnsupportedEncodingException e) { + throw new AssertionError("UTF-8 is not supported by the JVM, this should not happen according to the JavaDoc of the Charset class"); + } } CheckSum checkSum = CheckSum.compute(new AbstractSQLChange.NormalizingStream(";", false, false, stream), false);