修改异常包装策略:运行时异常不包装,只包装非运行时异常

This commit is contained in:
Looly
2023-08-08 19:03:56 +08:00
parent d5ac761f08
commit cd53378ae3
35 changed files with 155 additions and 92 deletions

View File

@@ -12,16 +12,11 @@
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.Toolkit;
import java.awt.datatransfer.Clipboard;
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.awt.datatransfer.*;
import java.io.IOException;
/**
@@ -82,7 +77,7 @@ public class ClipboardUtil {
try {
return content.getTransferData(flavor);
} catch (final UnsupportedFlavorException | IOException e) {
throw new HutoolException(e);
throw ExceptionUtil.wrapRuntime(e);
}
}
return null;

View File

@@ -12,6 +12,7 @@
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.io.IORuntimeException;
@@ -76,7 +77,7 @@ public class FontUtil {
try {
return Font.createFont(Font.TYPE1_FONT, fontFile);
} catch (final Exception e1) {
throw new HutoolException(e);
throw ExceptionUtil.wrapRuntime(e);
}
} catch (final IOException e) {
throw new IORuntimeException(e);
@@ -98,7 +99,7 @@ public class FontUtil {
try {
return Font.createFont(Font.TYPE1_FONT, fontStream);
} catch (final Exception e1) {
throw new HutoolException(e1);
throw ExceptionUtil.wrapRuntime(e1);
}
} catch (final IOException e) {
throw new IORuntimeException(e);

View File

@@ -47,7 +47,7 @@ public class ImgMetaUtil {
} catch (final ImageProcessingException e) {
throw new HutoolException(e);
} catch (final IOException e) {
throw new RuntimeException(e);
throw new IORuntimeException(e);
}
return getOrientation(metadata);
}