Skip to content

Commit 9172a56

Browse files
committed
Merge pull request #105 from making/fix-cause-position
Fix cause position in UniqueConstraintException's constructor
2 parents 187db38 + 24742d1 commit 9172a56

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/main/java/org/seasar/doma/jdbc/UniqueConstraintException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public UniqueConstraintException(SqlLogType logType, Sql<?> sql,
7575
public UniqueConstraintException(SqlLogType logType, SqlKind kind,
7676
String rawSql, String formattedSql, String sqlFilePath,
7777
Throwable cause) {
78-
super(Message.DOMA2004, sqlFilePath, choiceSql(logType, rawSql,
79-
formattedSql), cause);
78+
super(Message.DOMA2004, cause, sqlFilePath, choiceSql(logType, rawSql,
79+
formattedSql));
8080
this.kind = kind;
8181
this.rawSql = rawSql;
8282
this.formattedSql = formattedSql;

src/test/java/org/seasar/doma/jdbc/UniqueConstraintExceptionTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
public class UniqueConstraintExceptionTest extends TestCase {
2525

2626
public void test() throws Exception {
27+
Exception cause = new Exception();
2728
UniqueConstraintException e = new UniqueConstraintException(
28-
SqlLogType.FORMATTED, SqlKind.INSERT, "aaa", "bbb", "ccc",
29-
new Exception());
29+
SqlLogType.FORMATTED, SqlKind.INSERT, "aaa", "bbb", "ccc"
30+
, cause);
3031
System.out.println(e.getMessage());
3132
assertSame(SqlKind.INSERT, e.getKind());
3233
assertEquals("aaa", e.getRawSql());
3334
assertEquals("bbb", e.getFormattedSql());
3435
assertEquals("ccc", e.getSqlFilePath());
36+
assertEquals(cause, e.getCause());
3537
}
3638
}

0 commit comments

Comments
 (0)