mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
f2ae96af22
commit
d8f3cb1b9f
@ -22,9 +22,6 @@ import org.dromara.hutool.core.xml.XmlUtil;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.sql.Blob;
|
|
||||||
import java.sql.Clob;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
@ -70,10 +67,10 @@ public class StringConverter extends AbstractConverter {
|
|||||||
return ((TimeZone) value).getID();
|
return ((TimeZone) value).getID();
|
||||||
} else if (value instanceof org.w3c.dom.Node) {
|
} else if (value instanceof org.w3c.dom.Node) {
|
||||||
return XmlUtil.toStr((org.w3c.dom.Node) value);
|
return XmlUtil.toStr((org.w3c.dom.Node) value);
|
||||||
} else if (value instanceof Clob) {
|
} else if (value instanceof java.sql.Clob) {
|
||||||
return clobToStr((Clob) value);
|
return clobToStr((java.sql.Clob) value);
|
||||||
} else if (value instanceof Blob) {
|
} else if (value instanceof java.sql.Blob) {
|
||||||
return blobToStr((Blob) value);
|
return blobToStr((java.sql.Blob) value);
|
||||||
} else if (value instanceof Type) {
|
} else if (value instanceof Type) {
|
||||||
return ((Type) value).getTypeName();
|
return ((Type) value).getTypeName();
|
||||||
}
|
}
|
||||||
@ -85,16 +82,16 @@ public class StringConverter extends AbstractConverter {
|
|||||||
/**
|
/**
|
||||||
* Clob字段值转字符串
|
* Clob字段值转字符串
|
||||||
*
|
*
|
||||||
* @param clob {@link Clob}
|
* @param clob {@link java.sql.Clob}
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
* @since 5.4.5
|
* @since 5.4.5
|
||||||
*/
|
*/
|
||||||
private static String clobToStr(final Clob clob) {
|
private static String clobToStr(final java.sql.Clob clob) {
|
||||||
Reader reader = null;
|
Reader reader = null;
|
||||||
try {
|
try {
|
||||||
reader = clob.getCharacterStream();
|
reader = clob.getCharacterStream();
|
||||||
return IoUtil.read(reader);
|
return IoUtil.read(reader);
|
||||||
} catch (final SQLException e) {
|
} catch (final java.sql.SQLException e) {
|
||||||
throw new ConvertException(e);
|
throw new ConvertException(e);
|
||||||
} finally {
|
} finally {
|
||||||
IoUtil.closeQuietly(reader);
|
IoUtil.closeQuietly(reader);
|
||||||
@ -104,16 +101,16 @@ public class StringConverter extends AbstractConverter {
|
|||||||
/**
|
/**
|
||||||
* Blob字段值转字符串
|
* Blob字段值转字符串
|
||||||
*
|
*
|
||||||
* @param blob {@link Blob}
|
* @param blob {@link java.sql.Blob}
|
||||||
* @return 字符串
|
* @return 字符串
|
||||||
* @since 5.4.5
|
* @since 5.4.5
|
||||||
*/
|
*/
|
||||||
private static String blobToStr(final Blob blob) {
|
private static String blobToStr(final java.sql.Blob blob) {
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
try {
|
try {
|
||||||
in = blob.getBinaryStream();
|
in = blob.getBinaryStream();
|
||||||
return IoUtil.read(in, CharsetUtil.UTF_8);
|
return IoUtil.read(in, CharsetUtil.UTF_8);
|
||||||
} catch (final SQLException e) {
|
} catch (final java.sql.SQLException e) {
|
||||||
throw new ConvertException(e);
|
throw new ConvertException(e);
|
||||||
} finally {
|
} finally {
|
||||||
IoUtil.closeQuietly(in);
|
IoUtil.closeQuietly(in);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user