Skip to content

Commit 71175e7

Browse files
author
wubingheng
committed
fix FilterProcess changeSaveOrder(String order).
1 parent dcfe66b commit 71175e7

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.qiniu</groupId>
88
<artifactId>qsuits</artifactId>
9-
<version>8.3.10</version>
9+
<version>8.3.11</version>
1010
<name>qsuits</name>
1111
<description>qiniu-suits is a efficient tools for qiniu api implemented by java8.</description>
1212
<url>https://github.com/NigelWu95/qiniu-suits-java</url>

src/main/java/com/qiniu/process/filtration/FilterProcess.java

+20-4
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public FilterProcess<T> clone() throws CloneNotSupportedException {
125125
@Override
126126
public void changeSaveOrder(String order) throws IOException {
127127
try {
128-
this.fileSaveMapper.changePrefixAndSuffix(processName, order);
128+
if (nextProcessor != null) nextProcessor.changeSaveOrder(order);
129+
else fileSaveMapper.changePrefixAndSuffix(processName, order);
129130
} catch (NullPointerException e) {
130131
throw new IOException("instance without savePath can not call changeSaveOrder method.");
131132
}
@@ -148,7 +149,7 @@ public String processLine(T line) throws IOException {
148149
} else if (filter == null) { // 如果是关闭了那么 filter 应该为 null
149150
throw new IOException("input is empty or the processor may be already closed.");
150151
} else {
151-
throw new IOException("instance without savePath can not call this batch process method.");
152+
throw new IOException(e.getMessage());
152153
}
153154
} catch (IOException e) {
154155
throw e;
@@ -182,8 +183,22 @@ public void processLine(List<T> list) throws IOException {
182183
// 默认在不进行进一步处理的情况下直接保存结果,如果需要进一步处理则不保存过滤的结果。
183184
if (nextProcessor == null) {
184185
List<String> writeList = typeConverter.convertToVList(filterList);
185-
if (writeList.size() > 0) fileSaveMapper.writeSuccess(String.join("\n", writeList), false);
186-
if (typeConverter.errorSize() > 0) fileSaveMapper.writeError(typeConverter.errorLines(), false);
186+
try {
187+
if (writeList.size() > 0) fileSaveMapper.writeSuccess(String.join("\n", writeList), false);
188+
if (typeConverter.errorSize() > 0) fileSaveMapper.writeError(typeConverter.errorLines(), false);
189+
} catch (NullPointerException e) {
190+
if (canceled) {
191+
// // nothing to do
192+
} else if (filter == null) { // 如果是关闭了那么 filter 应该为 null
193+
throw new IOException("input is empty or the processor may be already closed.");
194+
} else {
195+
throw new IOException("instance without savePath can not call this batch process method.");
196+
}
197+
} catch (IOException e) {
198+
throw e;
199+
} catch (Exception e) {
200+
throw new IOException(e.getMessage());
201+
}
187202
} else {
188203
nextProcessor.processLine(filterList);
189204
}
@@ -194,6 +209,7 @@ public void closeResource() {
194209
filter = null;
195210
if (nextProcessor != null) nextProcessor.closeResource();
196211
savePath = null;
212+
saveIndex = null;
197213
if (fileSaveMapper != null) fileSaveMapper.closeWriters();
198214
fileSaveMapper = null;
199215
typeConverter = null;

version.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=8.3.10
1+
version=8.3.11

0 commit comments

Comments
 (0)