Revision 3289
Added by barteau over 17 years ago
src/edu/ucsb/nceas/metacat/client/MetacatClient.java | ||
---|---|---|
1082 | 1082 |
String lastDocId, nextDocId, metaDocId; |
1083 | 1083 |
StringBuilder fileName = new StringBuilder(); |
1084 | 1084 |
Reader reader; |
1085 |
int sizeLimit; |
|
1085 |
int sizeLimit, idx;
|
|
1086 | 1086 |
MultipartParser multipartParser; |
1087 | 1087 |
InputStream inputStream; |
1088 | 1088 |
Node newBranch, metaRootNode; |
... | ... | |
1113 | 1113 |
//*** Get the data file's DOC ID. |
1114 | 1114 |
nextDocId = nextDocId(lastDocId); |
1115 | 1115 |
//*** Set the file format (just using file extension for now). |
1116 |
formatType = fileName.substring(fileName.lastIndexOf(".")+1).toUpperCase(); |
|
1116 |
idx = fileName.lastIndexOf("."); |
|
1117 |
if (idx > 1) |
|
1118 |
formatType = fileName.substring(idx+1).toUpperCase(); |
|
1119 |
else |
|
1120 |
formatType = ""; |
|
1117 | 1121 |
dataDocIDs.put(nextDocId, formatType); |
1118 | 1122 |
//*** Upload the data file to metacat. |
1119 |
upload(nextDocId, fileName.toString(), inputStream, sizeLimit);
|
|
1123 |
upload(nextDocId, fileName.toString(), inputStream, Integer.MAX_VALUE);
|
|
1120 | 1124 |
|
1121 | 1125 |
lastDocId = nextDocId; |
1122 | 1126 |
fileName = new StringBuilder(); |
Also available in: Unified diff
Modified method "doMetadataUpload". Improved file type parsing. Also changed call to "upload", to send Integer.MAX_VALUE as the file size,
since file size is not available until read (i.e. "Content-Length", which is available, isn't the same as the individual file sizes).
This serves as a flag in the existing code in the method "sendDataOnce" and in the method "MulitipartForm.writeEncodedMultipartForm".