Skip to content

Commit 898824c

Browse files
committed
add error message to CreateSelectMetaInputStream
1 parent eb25a5e commit 898824c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/java/com/aliyun/oss/model/CreateSelectMetaInputStream.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class CreateSelectMetaInputStream extends FilterInputStream {
2424
* |--frame type(4 bytes)--|--payload length(4 bytes)--|--header checksum(4 bytes)--|
2525
* |--scanned data bytes(8 bytes)--|--total scan size(8 bytes)--|
2626
* |--status code(4 bytes)--|--total splits count(4 bytes)--|
27-
* |--total lines(8 bytes)--|--columns count(4bytes)--|--payload checksum(4 bytes)--|
27+
* |--total lines(8 bytes)--|--columns count(4 bytes)--|--error message(optional)--|--payload checksum(4 bytes)--|
2828
*/
2929
private static final int END_FRAME_MAGIC = 8388614;
3030
private static final int SELECT_VERSION = 1;
@@ -129,13 +129,22 @@ private void readFrame() throws IOException {
129129
crc32.update(totalLineBytes);
130130
crc32.update(columnBytes);
131131
int status = ByteBuffer.wrap(statusBytes).getInt();
132+
int errorMessageSize = (int)(currentFramePayloadLength - 28);
133+
String error = "";
134+
if (errorMessageSize > 0) {
135+
byte[] errorMessageBytes = new byte[errorMessageSize];
136+
internalRead(errorMessageBytes, 0, errorMessageSize);
137+
error = new String(errorMessageBytes);
138+
crc32.update(errorMessageBytes);
139+
}
140+
132141
finished = true;
133142
currentFramePayloadLength = currentFrameOffset;
134143
internalRead(currentFramePayloadChecksumBytes, 0, 4);
135144

136145
validateCheckSum(currentFramePayloadChecksumBytes, crc32);
137146
if (status / 100 != 2) {
138-
throw new IOException("Oss Select create meta encounter error: code: " + status);
147+
throw new IOException("Oss Select create meta encounter error code: " + status + ", message: " + error);
139148
}
140149

141150
selectObjectMetadata.setCsvObjectMetadata(

0 commit comments

Comments
 (0)