This commit is contained in:
Looly 2021-02-28 12:14:05 +08:00
parent b285db71cd
commit 51d0d118ac
7 changed files with 30 additions and 26 deletions

View File

@ -3,12 +3,13 @@
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
# 5.6.0 (2021-02-27) # 5.6.0 (2021-02-28)
### 新特性 ### 新特性
* 【poi 】 重要不再兼容POI-3.x增加兼容POI-5.xissue#I35J6B@Gitee * 【poi 】 重要不再兼容POI-3.x增加兼容POI-5.xissue#I35J6B@Gitee
### Bug修复 ### Bug修复
* 【socket 】 修复Client创建失败资源未释放问题。
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------

View File

@ -62,7 +62,7 @@ public class XML {
/** /**
* 转换XML为JSONObject * 转换XML为JSONObject
* 转换过程中一些信息可能会丢失JSON中无法区分节点和属性相同的节点将被处理为JSONArray * 转换过程中一些信息可能会丢失JSON中无法区分节点和属性相同的节点将被处理为JSONArray
* Content text may be placed in a "content" member. Comments, prologs, DTDs, and <code>&lt;[ [ ]]&gt;</code> are ignored. * Content text may be placed in a "content" member. Comments, prologs, DTDs, and {@code <[ [ ]]>} are ignored.
* *
* @param string The source string. * @param string The source string.
* @return A JSONObject containing the structured data from the XML string. * @return A JSONObject containing the structured data from the XML string.
@ -75,7 +75,7 @@ public class XML {
/** /**
* 转换XML为JSONObject * 转换XML为JSONObject
* 转换过程中一些信息可能会丢失JSON中无法区分节点和属性相同的节点将被处理为JSONArray * 转换过程中一些信息可能会丢失JSON中无法区分节点和属性相同的节点将被处理为JSONArray
* Content text may be placed in a "content" member. Comments, prologs, DTDs, and <code>&lt;[ [ ]]&gt;</code> are ignored. * Content text may be placed in a "content" member. Comments, prologs, DTDs, and {@code <[ [ ]]>} are ignored.
* All values are converted as strings, for 1, 01, 29.0 will not be coerced to numbers but will instead be the exact value as seen in the XML document. * All values are converted as strings, for 1, 01, 29.0 will not be coerced to numbers but will instead be the exact value as seen in the XML document.
* *
* @param string The source string. * @param string The source string.

View File

@ -40,10 +40,11 @@
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- OFD -->
<dependency> <dependency>
<groupId>org.ofdrw</groupId> <groupId>org.ofdrw</groupId>
<artifactId>ofdrw-full</artifactId> <artifactId>ofdrw-full</artifactId>
<version>1.7.2</version> <version>1.7.3</version>
<scope>compile</scope> <scope>compile</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>

View File

@ -1,19 +1,18 @@
package cn.hutool.poi.word; package cn.hutool.poi.word;
import java.io.File;
import java.io.IOException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IORuntimeException; import cn.hutool.core.io.IORuntimeException;
import cn.hutool.poi.exceptions.POIException; import cn.hutool.poi.exceptions.POIException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import java.io.File;
import java.io.IOException;
/** /**
* Word Document工具 * Word Document工具
* *
* @author looly * @author looly
* @since 4.4.1 * @since 4.4.1
*/ */
@ -21,7 +20,7 @@ public class DocUtil {
/** /**
* 创建{@link XWPFDocument}如果文件已存在则读取之否则创建新的 * 创建{@link XWPFDocument}如果文件已存在则读取之否则创建新的
* *
* @param file docx文件 * @param file docx文件
* @return {@link XWPFDocument} * @return {@link XWPFDocument}
*/ */

View File

@ -21,7 +21,7 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
/** /**
* Word生成器 * Word docx生成器
* *
* @author looly * @author looly
* @since 4.4.1 * @since 4.4.1

View File

@ -1,5 +1,11 @@
package cn.hutool.socket.aio; package cn.hutool.socket.aio;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.thread.ThreadFactoryBuilder;
import cn.hutool.socket.SocketConfig;
import cn.hutool.socket.SocketRuntimeException;
import java.io.Closeable; import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -9,14 +15,9 @@ import java.nio.channels.AsynchronousChannelGroup;
import java.nio.channels.AsynchronousSocketChannel; import java.nio.channels.AsynchronousSocketChannel;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.thread.ThreadFactoryBuilder;
import cn.hutool.socket.SocketConfig;
import cn.hutool.socket.SocketRuntimeException;
/** /**
* Aio Socket客户端 * Aio Socket客户端
* *
* @author looly * @author looly
* @since 4.5.0 * @since 4.5.0
*/ */
@ -26,7 +27,7 @@ public class AioClient implements Closeable{
/** /**
* 构造 * 构造
* *
* @param address 地址 * @param address 地址
* @param ioAction IO处理类 * @param ioAction IO处理类
*/ */
@ -36,7 +37,7 @@ public class AioClient implements Closeable{
/** /**
* 构造 * 构造
* *
* @param address 地址 * @param address 地址
* @param ioAction IO处理类 * @param ioAction IO处理类
* @param config 配置项 * @param config 配置项
@ -47,7 +48,7 @@ public class AioClient implements Closeable{
/** /**
* 构造 * 构造
* *
* @param channel {@link AsynchronousSocketChannel} * @param channel {@link AsynchronousSocketChannel}
* @param ioAction IO处理类 * @param ioAction IO处理类
* @param config 配置项 * @param config 配置项
@ -74,7 +75,7 @@ public class AioClient implements Closeable{
/** /**
* 获取IO处理器 * 获取IO处理器
* *
* @return {@link IoAction} * @return {@link IoAction}
*/ */
public IoAction<ByteBuffer> getIoAction() { public IoAction<ByteBuffer> getIoAction() {
@ -83,7 +84,7 @@ public class AioClient implements Closeable{
/** /**
* 从服务端读取数据 * 从服务端读取数据
* *
* @return this * @return this
*/ */
public AioClient read() { public AioClient read() {
@ -113,7 +114,7 @@ public class AioClient implements Closeable{
// ------------------------------------------------------------------------------------- Private method start // ------------------------------------------------------------------------------------- Private method start
/** /**
* 初始化 * 初始化
* *
* @param address 地址和端口 * @param address 地址和端口
* @param poolSize 线程池大小 * @param poolSize 线程池大小
* @return this * @return this
@ -134,6 +135,7 @@ public class AioClient implements Closeable{
try { try {
channel.connect(address).get(); channel.connect(address).get();
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
IoUtil.close(channel);
throw new SocketRuntimeException(e); throw new SocketRuntimeException(e);
} }
return channel; return channel;

View File

@ -66,6 +66,7 @@ public class NioClient implements Closeable {
//noinspection StatementWithEmptyBody //noinspection StatementWithEmptyBody
while (false == channel.finishConnect()){} while (false == channel.finishConnect()){}
} catch (IOException e) { } catch (IOException e) {
close();
throw new IORuntimeException(e); throw new IORuntimeException(e);
} }
return this; return this;