Skip to content

Commit eedba92

Browse files
author
takahiro.nakayama
committed
modify error class and message.
1 parent b2194e2 commit eedba92

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/main/java/org/embulk/output/HdfsOutputPlugin.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.apache.hadoop.conf.Configuration;
55
import org.apache.hadoop.fs.FileSystem;
66
import org.apache.hadoop.fs.Path;
7+
import org.apache.hadoop.util.Progressable;
78
import org.embulk.config.*;
89
import org.embulk.spi.*;
910
import org.jruby.embed.ScriptingContainer;
@@ -139,13 +140,19 @@ public void nextFile() {
139140
currentPath = new Path(workingPath + String.format(sequenceFormat, taskIndex, fileIndex));
140141
try {
141142
if (fs.exists(currentPath)) {
142-
// TODO: appropriate exception
143-
throw Throwables.propagate(new IOException(currentPath.toString() + "already exists."));
143+
throw new IllegalAccessException(currentPath.toString() + "already exists.");
144144
}
145-
currentStream = fs.create(currentPath);
145+
currentStream = fs.create(
146+
currentPath,
147+
new Progressable() {
148+
@Override
149+
public void progress() {
150+
logger.info("{} byte written.", 1);
151+
}
152+
});
146153
logger.info("Uploading '{}'", currentPath.toString());
147154
}
148-
catch (IOException e) {
155+
catch (IOException | IllegalAccessException e) {
149156
logger.error(e.getMessage());
150157
throw Throwables.propagate(e);
151158
}

0 commit comments

Comments
 (0)