diff options
Diffstat (limited to 'other/java/client/src')
| -rw-r--r-- | other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java | 2 | ||||
| -rw-r--r-- | other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java index ba298a713..3bec05796 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedOutputStream.java @@ -39,7 +39,7 @@ public class SeaweedOutputStream extends OutputStream { } public SeaweedOutputStream(FilerClient filerClient, final String fullpath, final String replication) { - this(filerClient, fullpath, null, 0, 8 * 1024 * 1024, "000"); + this(filerClient, fullpath, null, 0, 8 * 1024 * 1024, replication); } public SeaweedOutputStream(FilerClient filerClient, final String path, FilerProto.Entry.Builder entry, diff --git a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java index f8c0c76b6..3f9d79b99 100644 --- a/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java +++ b/other/java/client/src/main/java/seaweedfs/client/SeaweedWrite.java @@ -1,5 +1,6 @@ package seaweedfs.client; +import com.google.common.base.Strings; import com.google.protobuf.ByteString; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; @@ -45,11 +46,16 @@ public class SeaweedWrite { FilerProto.AssignVolumeResponse response = filerClient.getBlockingStub().assignVolume( FilerProto.AssignVolumeRequest.newBuilder() .setCollection(filerClient.getCollection()) - .setReplication(replication == null ? filerClient.getReplication() : replication) + .setReplication(Strings.isNullOrEmpty(replication) ? filerClient.getReplication() : replication) .setDataCenter("") .setTtlSec(0) .setPath(path) .build()); + + if (!Strings.isNullOrEmpty(response.getError())) { + throw new IOException(response.getError()); + } + String fileId = response.getFileId(); String auth = response.getAuth(); |
