mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
修改异常包装策略:运行时异常不包装,只包装非运行时异常
This commit is contained in:
parent
d5ac761f08
commit
cd53378ae3
@ -18,6 +18,7 @@ import org.dromara.hutool.core.collection.set.SetUtil;
|
|||||||
import org.dromara.hutool.core.collection.set.UniqueKeySet;
|
import org.dromara.hutool.core.collection.set.UniqueKeySet;
|
||||||
import org.dromara.hutool.core.comparator.CompareUtil;
|
import org.dromara.hutool.core.comparator.CompareUtil;
|
||||||
import org.dromara.hutool.core.convert.Convert;
|
import org.dromara.hutool.core.convert.Convert;
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
import org.dromara.hutool.core.lang.Assert;
|
import org.dromara.hutool.core.lang.Assert;
|
||||||
import org.dromara.hutool.core.map.MapUtil;
|
import org.dromara.hutool.core.map.MapUtil;
|
||||||
@ -1156,7 +1157,7 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
|||||||
return (Object[]) obj;
|
return (Object[]) obj;
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new HutoolException(StrUtil.format("[{}] is not Array!", obj.getClass()));
|
throw new HutoolException(StrUtil.format("[{}] is not Array!", obj.getClass()));
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
package org.dromara.hutool.core.classloader;
|
package org.dromara.hutool.core.classloader;
|
||||||
|
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
import org.dromara.hutool.core.io.IORuntimeException;
|
||||||
import org.dromara.hutool.core.io.file.FileUtil;
|
import org.dromara.hutool.core.io.file.FileUtil;
|
||||||
import org.dromara.hutool.core.net.url.URLUtil;
|
import org.dromara.hutool.core.net.url.URLUtil;
|
||||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||||
@ -73,7 +74,7 @@ public class JarClassLoader extends URLClassLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new HutoolException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ import org.dromara.hutool.core.comparator.PinyinComparator;
|
|||||||
import org.dromara.hutool.core.comparator.PropertyComparator;
|
import org.dromara.hutool.core.comparator.PropertyComparator;
|
||||||
import org.dromara.hutool.core.convert.CompositeConverter;
|
import org.dromara.hutool.core.convert.CompositeConverter;
|
||||||
import org.dromara.hutool.core.convert.Convert;
|
import org.dromara.hutool.core.convert.Convert;
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
import org.dromara.hutool.core.func.SerBiConsumer;
|
import org.dromara.hutool.core.func.SerBiConsumer;
|
||||||
import org.dromara.hutool.core.func.SerConsumer3;
|
import org.dromara.hutool.core.func.SerConsumer3;
|
||||||
@ -764,7 +765,7 @@ public class CollUtil {
|
|||||||
if (null != superclass && collectionType != superclass) {
|
if (null != superclass && collectionType != superclass) {
|
||||||
return create(superclass);
|
return create(superclass);
|
||||||
}
|
}
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
@ -16,6 +16,7 @@ import org.dromara.hutool.core.convert.AbstractConverter;
|
|||||||
import org.dromara.hutool.core.convert.ConvertException;
|
import org.dromara.hutool.core.convert.ConvertException;
|
||||||
import org.dromara.hutool.core.date.DateTime;
|
import org.dromara.hutool.core.date.DateTime;
|
||||||
import org.dromara.hutool.core.date.DateUtil;
|
import org.dromara.hutool.core.date.DateUtil;
|
||||||
|
import org.dromara.hutool.core.date.SqlDateUtil;
|
||||||
import org.dromara.hutool.core.text.StrUtil;
|
import org.dromara.hutool.core.text.StrUtil;
|
||||||
|
|
||||||
import java.time.temporal.TemporalAccessor;
|
import java.time.temporal.TemporalAccessor;
|
||||||
@ -113,13 +114,13 @@ public class DateConverter extends AbstractConverter {
|
|||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
if (java.sql.Date.class == targetClass) {
|
if (java.sql.Date.class == targetClass) {
|
||||||
return date.toSqlDate();
|
return SqlDateUtil.date(date);
|
||||||
}
|
}
|
||||||
if (java.sql.Time.class == targetClass) {
|
if (java.sql.Time.class == targetClass) {
|
||||||
return new java.sql.Time(date.getTime());
|
return SqlDateUtil.time(date);
|
||||||
}
|
}
|
||||||
if (java.sql.Timestamp.class == targetClass) {
|
if (java.sql.Timestamp.class == targetClass) {
|
||||||
return date.toTimestamp();
|
return SqlDateUtil.timestamp(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new UnsupportedOperationException(StrUtil.format("Unsupported target Date type: {}", targetClass.getName()));
|
throw new UnsupportedOperationException(StrUtil.format("Unsupported target Date type: {}", targetClass.getName()));
|
||||||
|
@ -22,7 +22,6 @@ import org.dromara.hutool.core.text.StrUtil;
|
|||||||
import org.dromara.hutool.core.util.ObjUtil;
|
import org.dromara.hutool.core.util.ObjUtil;
|
||||||
import org.dromara.hutool.core.util.SystemUtil;
|
import org.dromara.hutool.core.util.SystemUtil;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@ -724,24 +723,6 @@ public class DateTime extends Date {
|
|||||||
return new Date(this.getTime());
|
return new Date(this.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 转为{@link Timestamp}
|
|
||||||
*
|
|
||||||
* @return {@link Timestamp}
|
|
||||||
*/
|
|
||||||
public Timestamp toTimestamp() {
|
|
||||||
return new Timestamp(this.getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 转为 {@link java.sql.Date}
|
|
||||||
*
|
|
||||||
* @return {@link java.sql.Date}
|
|
||||||
*/
|
|
||||||
public java.sql.Date toSqlDate() {
|
|
||||||
return new java.sql.Date(getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为 {@link LocalDateTime}
|
* 转换为 {@link LocalDateTime}
|
||||||
*
|
*
|
||||||
|
64
hutool-core/src/main/java/org/dromara/hutool/core/date/SqlDateUtil.java
Executable file
64
hutool-core/src/main/java/org/dromara/hutool/core/date/SqlDateUtil.java
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023 looly(loolly@aliyun.com)
|
||||||
|
* Hutool is licensed under Mulan PSL v2.
|
||||||
|
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||||
|
* You may obtain a copy of Mulan PSL v2 at:
|
||||||
|
* http://license.coscl.org.cn/MulanPSL2
|
||||||
|
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||||
|
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||||
|
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||||
|
* See the Mulan PSL v2 for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.dromara.hutool.core.date;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.lang.Assert;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code java.sql.*}日期时间相关封装<br>
|
||||||
|
* 考虑到JDK9+模块化后,java.sql并非默认引入模块,因此将相关内容单独封装为工具,避免类找不到问题。
|
||||||
|
*
|
||||||
|
* @author looly
|
||||||
|
* @since 6.0.0
|
||||||
|
*/
|
||||||
|
public class SqlDateUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转为{@link Timestamp}
|
||||||
|
*
|
||||||
|
* @param date 日期时间,非空
|
||||||
|
* @return {@link Timestamp}
|
||||||
|
*/
|
||||||
|
public static Timestamp timestamp(final Date date) {
|
||||||
|
Assert.notNull(date);
|
||||||
|
return new Timestamp(date.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* /**
|
||||||
|
* 转为{@link java.sql.Date}
|
||||||
|
*
|
||||||
|
* @param date 日期时间,非空
|
||||||
|
* @return {@link java.sql.Date}
|
||||||
|
*/
|
||||||
|
public static java.sql.Date date(final Date date) {
|
||||||
|
Assert.notNull(date);
|
||||||
|
return new java.sql.Date(date.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* /**
|
||||||
|
* 转为{@link java.sql.Time}
|
||||||
|
*
|
||||||
|
* @param date 日期时间,非空
|
||||||
|
* @return {@link java.sql.Time}
|
||||||
|
*/
|
||||||
|
public static java.sql.Time time(final Date date) {
|
||||||
|
Assert.notNull(date);
|
||||||
|
return new java.sql.Time(date.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.exception;
|
package org.dromara.hutool.core.exception;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.io.IORuntimeException;
|
||||||
import org.dromara.hutool.core.io.stream.FastByteArrayOutputStream;
|
import org.dromara.hutool.core.io.stream.FastByteArrayOutputStream;
|
||||||
import org.dromara.hutool.core.map.MapUtil;
|
import org.dromara.hutool.core.map.MapUtil;
|
||||||
import org.dromara.hutool.core.reflect.ConstructorUtil;
|
import org.dromara.hutool.core.reflect.ConstructorUtil;
|
||||||
@ -19,6 +20,7 @@ import org.dromara.hutool.core.text.StrUtil;
|
|||||||
import org.dromara.hutool.core.array.ArrayUtil;
|
import org.dromara.hutool.core.array.ArrayUtil;
|
||||||
import org.dromara.hutool.core.text.CharUtil;
|
import org.dromara.hutool.core.text.CharUtil;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.UndeclaredThrowableException;
|
import java.lang.reflect.UndeclaredThrowableException;
|
||||||
@ -66,10 +68,13 @@ public class ExceptionUtil {
|
|||||||
* @return 运行时异常
|
* @return 运行时异常
|
||||||
*/
|
*/
|
||||||
public static RuntimeException wrapRuntime(final Throwable throwable) {
|
public static RuntimeException wrapRuntime(final Throwable throwable) {
|
||||||
|
if(throwable instanceof IOException){
|
||||||
|
return new IORuntimeException(throwable);
|
||||||
|
}
|
||||||
if (throwable instanceof RuntimeException) {
|
if (throwable instanceof RuntimeException) {
|
||||||
return (RuntimeException) throwable;
|
return (RuntimeException) throwable;
|
||||||
}
|
}
|
||||||
return new RuntimeException(throwable);
|
return new HutoolException(throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -62,7 +63,7 @@ public interface SerBiConsumer<T, U> extends BiConsumer<T, U>, Serializable {
|
|||||||
try {
|
try {
|
||||||
accepting(t, u);
|
accepting(t, u);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -52,7 +53,7 @@ public interface SerBiFunction<T, U, R> extends BiFunction<T, U, R>, Serializabl
|
|||||||
try {
|
try {
|
||||||
return this.applying(t, u);
|
return this.applying(t, u);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -54,7 +55,7 @@ public interface SerBiPredicate<T, U> extends BiPredicate<T, U>, Serializable {
|
|||||||
try {
|
try {
|
||||||
return testing(t, u);
|
return testing(t, u);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -51,7 +52,7 @@ public interface SerBinaryOperator<T> extends BinaryOperator<T>, Serializable {
|
|||||||
try {
|
try {
|
||||||
return this.applying(t, u);
|
return this.applying(t, u);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -47,7 +48,7 @@ public interface SerConsumer<T> extends Consumer<T>, Serializable {
|
|||||||
try {
|
try {
|
||||||
accepting(t);
|
accepting(t);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -50,7 +51,7 @@ public interface SerConsumer3<P1, P2, P3> extends Serializable {
|
|||||||
try {
|
try {
|
||||||
accepting(p1, p2, p3);
|
accepting(p1, p2, p3);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -48,7 +49,7 @@ public interface SerFunction<T, R> extends Function<T, R>, Serializable {
|
|||||||
try {
|
try {
|
||||||
return applying(t);
|
return applying(t);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -51,7 +52,7 @@ public interface SerPredicate<T> extends Predicate<T>, Serializable {
|
|||||||
try {
|
try {
|
||||||
return testing(t);
|
return testing(t);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -57,7 +58,7 @@ public interface SerRunnable extends Runnable, Serializable {
|
|||||||
try {
|
try {
|
||||||
running();
|
running();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -46,7 +47,7 @@ public interface SerSupplier<R> extends Supplier<R>, Serializable {
|
|||||||
try {
|
try {
|
||||||
return getting();
|
return getting();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.func;
|
package org.dromara.hutool.core.func;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -48,7 +49,7 @@ public interface SerUnaryOperator<T> extends UnaryOperator<T>, Serializable {
|
|||||||
try {
|
try {
|
||||||
return applying(t);
|
return applying(t);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class LineReader extends ReaderWrapper implements Iterable<String> {
|
|||||||
try {
|
try {
|
||||||
return readLine();
|
return readLine();
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.io.file;
|
package org.dromara.hutool.core.io.file;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
import org.dromara.hutool.core.func.SerConsumer;
|
import org.dromara.hutool.core.func.SerConsumer;
|
||||||
import org.dromara.hutool.core.func.SerFunction;
|
import org.dromara.hutool.core.func.SerFunction;
|
||||||
@ -31,33 +32,36 @@ import java.util.function.Predicate;
|
|||||||
* 文件读取器
|
* 文件读取器
|
||||||
*
|
*
|
||||||
* @author Looly
|
* @author Looly
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class FileReader extends FileWrapper {
|
public class FileReader extends FileWrapper {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建 FileReader
|
* 创建 FileReader
|
||||||
|
*
|
||||||
* @param file 文件
|
* @param file 文件
|
||||||
* @param charset 编码,使用 {@link CharsetUtil}
|
* @param charset 编码,使用 {@link CharsetUtil}
|
||||||
* @return FileReader
|
* @return FileReader
|
||||||
*/
|
*/
|
||||||
public static FileReader of(final File file, final Charset charset){
|
public static FileReader of(final File file, final Charset charset) {
|
||||||
return new FileReader(file, charset);
|
return new FileReader(file, charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建 FileReader, 编码:{@link FileWrapper#DEFAULT_CHARSET}
|
* 创建 FileReader, 编码:{@link FileWrapper#DEFAULT_CHARSET}
|
||||||
|
*
|
||||||
* @param file 文件
|
* @param file 文件
|
||||||
* @return FileReader
|
* @return FileReader
|
||||||
*/
|
*/
|
||||||
public static FileReader of(final File file){
|
public static FileReader of(final File file) {
|
||||||
return new FileReader(file, DEFAULT_CHARSET);
|
return new FileReader(file, DEFAULT_CHARSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------- Constructor start
|
// ------------------------------------------------------- Constructor start
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造
|
* 构造
|
||||||
|
*
|
||||||
* @param file 文件
|
* @param file 文件
|
||||||
* @param charset 编码,使用 {@link CharsetUtil}
|
* @param charset 编码,使用 {@link CharsetUtil}
|
||||||
*/
|
*/
|
||||||
@ -88,7 +92,7 @@ public class FileReader extends FileWrapper {
|
|||||||
* @return 内容
|
* @return 内容
|
||||||
* @throws IORuntimeException IO异常
|
* @throws IORuntimeException IO异常
|
||||||
*/
|
*/
|
||||||
public String readString() throws IORuntimeException{
|
public String readString() throws IORuntimeException {
|
||||||
// JDK11+不再推荐使用这种方式,推荐使用Files.readString
|
// JDK11+不再推荐使用这种方式,推荐使用Files.readString
|
||||||
return new String(readBytes(), this.charset);
|
return new String(readBytes(), this.charset);
|
||||||
}
|
}
|
||||||
@ -116,7 +120,7 @@ public class FileReader extends FileWrapper {
|
|||||||
*/
|
*/
|
||||||
public <T extends Collection<String>> T readLines(final T collection, final Predicate<String> predicate) throws IORuntimeException {
|
public <T extends Collection<String>> T readLines(final T collection, final Predicate<String> predicate) throws IORuntimeException {
|
||||||
readLines((SerConsumer<String>) s -> {
|
readLines((SerConsumer<String>) s -> {
|
||||||
if(null == predicate || predicate.test(s)){
|
if (null == predicate || predicate.test(s)) {
|
||||||
collection.add(s);
|
collection.add(s);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -130,7 +134,7 @@ public class FileReader extends FileWrapper {
|
|||||||
* @throws IORuntimeException IO异常
|
* @throws IORuntimeException IO异常
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public void readLines(final SerConsumer<String> lineHandler) throws IORuntimeException{
|
public void readLines(final SerConsumer<String> lineHandler) throws IORuntimeException {
|
||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
try {
|
try {
|
||||||
reader = FileUtil.getReader(file, charset);
|
reader = FileUtil.getReader(file, charset);
|
||||||
@ -165,13 +169,7 @@ public class FileReader extends FileWrapper {
|
|||||||
reader = FileUtil.getReader(this.file, charset);
|
reader = FileUtil.getReader(this.file, charset);
|
||||||
result = readerHandler.applying(reader);
|
result = readerHandler.applying(reader);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
if(e instanceof IOException){
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
throw new IORuntimeException(e);
|
|
||||||
} else if(e instanceof RuntimeException){
|
|
||||||
throw (RuntimeException)e;
|
|
||||||
} else{
|
|
||||||
throw new HutoolException(e);
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
IoUtil.closeQuietly(reader);
|
IoUtil.closeQuietly(reader);
|
||||||
}
|
}
|
||||||
@ -223,12 +221,12 @@ public class FileReader extends FileWrapper {
|
|||||||
* @since 5.5.2
|
* @since 5.5.2
|
||||||
*/
|
*/
|
||||||
public long writeToStream(final OutputStream out, final boolean isCloseOut) throws IORuntimeException {
|
public long writeToStream(final OutputStream out, final boolean isCloseOut) throws IORuntimeException {
|
||||||
try (final FileInputStream in = new FileInputStream(this.file)){
|
try (final FileInputStream in = new FileInputStream(this.file)) {
|
||||||
return IoUtil.copy(in, out);
|
return IoUtil.copy(in, out);
|
||||||
}catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new IORuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
} finally{
|
} finally {
|
||||||
if(isCloseOut){
|
if (isCloseOut) {
|
||||||
IoUtil.closeQuietly(out);
|
IoUtil.closeQuietly(out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ public class FileTypeUtil {
|
|||||||
try {
|
try {
|
||||||
return IoUtil.readHex(in, Math.min(8192, in.available()), false);
|
return IoUtil.readHex(in, Math.min(8192, in.available()), false);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class PathDeleter {
|
|||||||
try (final Stream<Path> list = Files.list(this.path)){
|
try (final Stream<Path> list = Files.list(this.path)){
|
||||||
list.forEach(PathUtil::del);
|
list.forEach(PathUtil::del);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ public class PathDeleter {
|
|||||||
try {
|
try {
|
||||||
Files.walkFileTree(path, DelVisitor.INSTANCE);
|
Files.walkFileTree(path, DelVisitor.INSTANCE);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import org.dromara.hutool.core.collection.iter.EnumerationIter;
|
|||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
import org.dromara.hutool.core.io.IORuntimeException;
|
import org.dromara.hutool.core.io.IORuntimeException;
|
||||||
import org.dromara.hutool.core.io.IoUtil;
|
import org.dromara.hutool.core.io.IoUtil;
|
||||||
|
import org.dromara.hutool.core.lang.Assert;
|
||||||
import org.dromara.hutool.core.text.StrUtil;
|
import org.dromara.hutool.core.text.StrUtil;
|
||||||
import org.dromara.hutool.core.text.split.SplitUtil;
|
import org.dromara.hutool.core.text.split.SplitUtil;
|
||||||
import org.dromara.hutool.core.text.CharUtil;
|
import org.dromara.hutool.core.text.CharUtil;
|
||||||
@ -367,9 +368,7 @@ public class NetUtil {
|
|||||||
throw new HutoolException(e);
|
throw new HutoolException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (networkInterfaces == null) {
|
Assert.notNull(networkInterfaces, ()-> new HutoolException("Get network interface error!"));
|
||||||
throw new HutoolException("Get network interface error!");
|
|
||||||
}
|
|
||||||
|
|
||||||
final LinkedHashSet<InetAddress> ipSet = new LinkedHashSet<>();
|
final LinkedHashSet<InetAddress> ipSet = new LinkedHashSet<>();
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ package org.dromara.hutool.core.reflect;
|
|||||||
import org.dromara.hutool.core.classloader.ClassLoaderUtil;
|
import org.dromara.hutool.core.classloader.ClassLoaderUtil;
|
||||||
import org.dromara.hutool.core.collection.CollUtil;
|
import org.dromara.hutool.core.collection.CollUtil;
|
||||||
import org.dromara.hutool.core.collection.iter.EnumerationIter;
|
import org.dromara.hutool.core.collection.iter.EnumerationIter;
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
import org.dromara.hutool.core.io.IORuntimeException;
|
import org.dromara.hutool.core.io.IORuntimeException;
|
||||||
import org.dromara.hutool.core.io.file.FileNameUtil;
|
import org.dromara.hutool.core.io.file.FileNameUtil;
|
||||||
import org.dromara.hutool.core.io.resource.ResourceUtil;
|
import org.dromara.hutool.core.io.resource.ResourceUtil;
|
||||||
@ -408,7 +410,7 @@ public class ClassScanner implements Serializable {
|
|||||||
classesOfLoadError.add(className);
|
classesOfLoadError.add(className);
|
||||||
} catch (final Throwable e){
|
} catch (final Throwable e){
|
||||||
if(!this.ignoreLoadError) {
|
if(!this.ignoreLoadError) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}else{
|
}else{
|
||||||
classesOfLoadError.add(className);
|
classesOfLoadError.add(className);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.reflect.method;
|
package org.dromara.hutool.core.reflect.method;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
import org.dromara.hutool.core.lang.Assert;
|
import org.dromara.hutool.core.lang.Assert;
|
||||||
import org.dromara.hutool.core.reflect.lookup.LookupUtil;
|
import org.dromara.hutool.core.reflect.lookup.LookupUtil;
|
||||||
@ -51,7 +52,7 @@ public class MethodHandleUtil {
|
|||||||
try {
|
try {
|
||||||
return (T) methodHandle.invokeWithArguments(args);
|
return (T) methodHandle.invokeWithArguments(args);
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,10 +115,7 @@ public class MethodHandleUtil {
|
|||||||
}
|
}
|
||||||
return (T) handle.invokeWithArguments(args);
|
return (T) handle.invokeWithArguments(args);
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
if(e instanceof RuntimeException){
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
throw (RuntimeException)e;
|
|
||||||
}
|
|
||||||
throw new HutoolException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import org.dromara.hutool.core.classloader.ClassLoaderUtil;
|
|||||||
import org.dromara.hutool.core.collection.set.SetUtil;
|
import org.dromara.hutool.core.collection.set.SetUtil;
|
||||||
import org.dromara.hutool.core.collection.set.UniqueKeySet;
|
import org.dromara.hutool.core.collection.set.UniqueKeySet;
|
||||||
import org.dromara.hutool.core.convert.Convert;
|
import org.dromara.hutool.core.convert.Convert;
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
import org.dromara.hutool.core.lang.Assert;
|
import org.dromara.hutool.core.lang.Assert;
|
||||||
import org.dromara.hutool.core.lang.Singleton;
|
import org.dromara.hutool.core.lang.Singleton;
|
||||||
@ -753,7 +754,7 @@ public class MethodUtil {
|
|||||||
return invoke(isSingleton ? Singleton.get(clazz) : ConstructorUtil.newInstance(clazz), method, args);
|
return invoke(isSingleton ? Singleton.get(clazz) : ConstructorUtil.newInstance(clazz), method, args);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.core.thread;
|
package org.dromara.hutool.core.thread;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.lang.Assert;
|
import org.dromara.hutool.core.lang.Assert;
|
||||||
import org.dromara.hutool.core.stream.StreamUtil;
|
import org.dromara.hutool.core.stream.StreamUtil;
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ public class AsyncUtil {
|
|||||||
if (eHandler != null) {
|
if (eHandler != null) {
|
||||||
return eHandler.apply(ex);
|
return eHandler.apply(ex);
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException(ex);
|
throw ExceptionUtil.wrapRuntime(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -17,6 +17,7 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.dromara.hutool.core.collection.ListUtil;
|
import org.dromara.hutool.core.collection.ListUtil;
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.reflect.ConstructorUtil;
|
import org.dromara.hutool.core.reflect.ConstructorUtil;
|
||||||
import org.dromara.hutool.core.reflect.lookup.LookupUtil;
|
import org.dromara.hutool.core.reflect.lookup.LookupUtil;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
@ -322,7 +323,7 @@ public class LambdaFactoryTest {
|
|||||||
try {
|
try {
|
||||||
return get0();
|
return get0();
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
throw new RuntimeException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.http.client.engine.jdk;
|
package org.dromara.hutool.http.client.engine.jdk;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.io.IORuntimeException;
|
||||||
import org.dromara.hutool.core.io.IoUtil;
|
import org.dromara.hutool.core.io.IoUtil;
|
||||||
import org.dromara.hutool.core.net.url.UrlBuilder;
|
import org.dromara.hutool.core.net.url.UrlBuilder;
|
||||||
import org.dromara.hutool.core.text.StrUtil;
|
import org.dromara.hutool.core.text.StrUtil;
|
||||||
@ -79,7 +80,7 @@ public class JdkClientEngine implements ClientEngine {
|
|||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
// 出错后关闭连接
|
// 出错后关闭连接
|
||||||
IoUtil.closeQuietly(this);
|
IoUtil.closeQuietly(this);
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sendRedirectIfPossible(message, isAsync);
|
return sendRedirectIfPossible(message, isAsync);
|
||||||
|
@ -557,7 +557,7 @@ public class JakartaServletUtil {
|
|||||||
writer.write(text);
|
writer.write(text);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new HutoolException(e);
|
throw new IORuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
IoUtil.closeQuietly(writer);
|
IoUtil.closeQuietly(writer);
|
||||||
}
|
}
|
||||||
|
@ -568,7 +568,7 @@ public class ServletUtil {
|
|||||||
writer.write(text);
|
writer.write(text);
|
||||||
writer.flush();
|
writer.flush();
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new HutoolException(e);
|
throw new IORuntimeException(e);
|
||||||
} finally {
|
} finally {
|
||||||
IoUtil.closeQuietly(writer);
|
IoUtil.closeQuietly(writer);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.hutool.poi.excel;
|
package org.dromara.hutool.poi.excel;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.io.IORuntimeException;
|
||||||
import org.dromara.hutool.poi.excel.cell.CellUtil;
|
import org.dromara.hutool.poi.excel.cell.CellUtil;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
@ -42,7 +43,7 @@ public class IssueI6MBS5Test {
|
|||||||
CellUtil.setComment(cell, "commonText", "ascend", null);
|
CellUtil.setComment(cell, "commonText", "ascend", null);
|
||||||
workbook.write(Files.newOutputStream(file.toPath()));
|
workbook.write(Files.newOutputStream(file.toPath()));
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,11 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.swing.clipboard;
|
package org.dromara.hutool.swing.clipboard;
|
||||||
|
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
|
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.datatransfer.Clipboard;
|
import java.awt.datatransfer.*;
|
||||||
import java.awt.datatransfer.ClipboardOwner;
|
|
||||||
import java.awt.datatransfer.DataFlavor;
|
|
||||||
import java.awt.datatransfer.StringSelection;
|
|
||||||
import java.awt.datatransfer.Transferable;
|
|
||||||
import java.awt.datatransfer.UnsupportedFlavorException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +77,7 @@ public class ClipboardUtil {
|
|||||||
try {
|
try {
|
||||||
return content.getTransferData(flavor);
|
return content.getTransferData(flavor);
|
||||||
} catch (final UnsupportedFlavorException | IOException e) {
|
} catch (final UnsupportedFlavorException | IOException e) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
package org.dromara.hutool.swing.img;
|
package org.dromara.hutool.swing.img;
|
||||||
|
|
||||||
|
import org.dromara.hutool.core.exception.ExceptionUtil;
|
||||||
import org.dromara.hutool.core.exception.HutoolException;
|
import org.dromara.hutool.core.exception.HutoolException;
|
||||||
import org.dromara.hutool.core.io.IORuntimeException;
|
import org.dromara.hutool.core.io.IORuntimeException;
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ public class FontUtil {
|
|||||||
try {
|
try {
|
||||||
return Font.createFont(Font.TYPE1_FONT, fontFile);
|
return Font.createFont(Font.TYPE1_FONT, fontFile);
|
||||||
} catch (final Exception e1) {
|
} catch (final Exception e1) {
|
||||||
throw new HutoolException(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new IORuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
@ -98,7 +99,7 @@ public class FontUtil {
|
|||||||
try {
|
try {
|
||||||
return Font.createFont(Font.TYPE1_FONT, fontStream);
|
return Font.createFont(Font.TYPE1_FONT, fontStream);
|
||||||
} catch (final Exception e1) {
|
} catch (final Exception e1) {
|
||||||
throw new HutoolException(e1);
|
throw ExceptionUtil.wrapRuntime(e1);
|
||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new IORuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
|
@ -47,7 +47,7 @@ public class ImgMetaUtil {
|
|||||||
} catch (final ImageProcessingException e) {
|
} catch (final ImageProcessingException e) {
|
||||||
throw new HutoolException(e);
|
throw new HutoolException(e);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
throw new RuntimeException(e);
|
throw new IORuntimeException(e);
|
||||||
}
|
}
|
||||||
return getOrientation(metadata);
|
return getOrientation(metadata);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user