修复FileUtil.moveContent会删除源目录的问题 修复HttpBase.body导致的空指针问题

This commit is contained in:
Looly
2023-03-05 22:45:36 +08:00
parent 51c29abcad
commit 52617b2032
5 changed files with 208 additions and 52 deletions

View File

@@ -304,7 +304,7 @@ public abstract class HttpBase<T> {
* @return byte[]
*/
public byte[] bodyBytes() {
return this.body.readBytes();
return this.body == null ? null : this.body.readBytes();
}
/**
@@ -355,7 +355,7 @@ public abstract class HttpBase<T> {
}
sb.append("Request Body: ").append(StrUtil.CRLF);
sb.append(" ").append(StrUtil.str(this.body.readBytes(), this.charset)).append(StrUtil.CRLF);
sb.append(" ").append(StrUtil.str(this.bodyBytes(), this.charset)).append(StrUtil.CRLF);
return sb.toString();
}

View File

@@ -241,7 +241,7 @@ public class HttpResponse extends HttpBase<HttpResponse> implements Closeable {
if (isAsync) {
return this.in;
}
return this.body.getStream();
return null == this.body ? null : this.body.getStream();
}
/**
@@ -253,7 +253,7 @@ public class HttpResponse extends HttpBase<HttpResponse> implements Closeable {
@Override
public byte[] bodyBytes() {
sync();
return this.body.readBytes();
return super.bodyBytes();
}
/**