From b0605b55ba14f29bd4e3a1e9fcbbf25b41c49593 Mon Sep 17 00:00:00 2001 From: Looly Date: Thu, 17 Mar 2022 20:53:36 +0800 Subject: [PATCH] remove length --- CHANGELOG.md | 1 + .../test/java/cn/hutool/crypto/test/SmTest.java | 14 ++++++++++++++ .../src/main/java/cn/hutool/db/meta/Column.java | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8223a282a..527edba76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ * 【core 】 Base32增加pad支持(pr#2195@Github) * 【core 】 Dict增加setFields方法(pr#578@Gitee) * 【db 】 新加db.meta的索引相关接口(pr#563@Gitee) +* 【db 】 Oracle中Column#typeName后的长度去掉(pr#563@Gitee) * ### 🐞Bug修复 * 【core 】 修复ObjectUtil.hasNull传入null返回true的问题(pr#555@Gitee) diff --git a/hutool-crypto/src/test/java/cn/hutool/crypto/test/SmTest.java b/hutool-crypto/src/test/java/cn/hutool/crypto/test/SmTest.java index c98dd21ee..5888cdf08 100644 --- a/hutool-crypto/src/test/java/cn/hutool/crypto/test/SmTest.java +++ b/hutool-crypto/src/test/java/cn/hutool/crypto/test/SmTest.java @@ -74,6 +74,20 @@ public class SmTest { Assert.assertEquals(content, decryptStr); } + @Test + public void sm4TestWithCustomKeyTest2() { + String content = "test中文frfewrewrwerwer---------------------------------------------------"; + + byte[] key = KeyUtil.generateKey(SM4.ALGORITHM_NAME, 128).getEncoded(); + + SM4 sm4 = SmUtil.sm4(key); + Assert.assertEquals("SM4", sm4.getCipher().getAlgorithm()); + + String encryptHex = sm4.encryptHex(content); + String decryptStr = sm4.decryptStr(encryptHex, CharsetUtil.CHARSET_UTF_8); + Assert.assertEquals(content, decryptStr); + } + @Test public void hmacSm3Test() { String content = "test中文"; diff --git a/hutool-db/src/main/java/cn/hutool/db/meta/Column.java b/hutool-db/src/main/java/cn/hutool/db/meta/Column.java index b472bc3ea..362d20ee8 100644 --- a/hutool-db/src/main/java/cn/hutool/db/meta/Column.java +++ b/hutool-db/src/main/java/cn/hutool/db/meta/Column.java @@ -1,6 +1,7 @@ package cn.hutool.db.meta; import cn.hutool.core.util.BooleanUtil; +import cn.hutool.core.util.ReUtil; import cn.hutool.db.DbRuntimeException; import java.io.Serializable; @@ -111,7 +112,12 @@ public class Column implements Serializable, Cloneable { this.isPk = table.isPk(this.name); this.type = columnMetaRs.getInt("DATA_TYPE"); - this.typeName = columnMetaRs.getString("TYPE_NAME"); + + String typeName = columnMetaRs.getString("TYPE_NAME"); + //issue#2201@Gitee + typeName = ReUtil.delLast("\\(\\d+\\)", typeName); + this.typeName = typeName; + this.size = columnMetaRs.getInt("COLUMN_SIZE"); this.isNullable = columnMetaRs.getBoolean("NULLABLE"); this.comment = columnMetaRs.getString("REMARKS");