comparison src/main/java/org/monetdb/mcl/net/MapiSocket.java @ 612:1d44b8a577ca

write to out, not to super when implementing FilterOutputStream
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Tue, 18 Jan 2022 13:12:55 +0100 (2022-01-18)
parents 6aa38e8c0f2d
children 65641a7cea31
comparison
equal deleted inserted replaced
611:d2a141446e22 612:1d44b8a577ca
1266 // Probably because they're calling print methods instead of write. 1266 // Probably because they're calling print methods instead of write.
1267 // Throw another one, maybe they'll catch this one. 1267 // Throw another one, maybe they'll catch this one.
1268 throw new IOException("Server aborted the upload"); 1268 throw new IOException("Server aborted the upload");
1269 } 1269 }
1270 handleChunking(); 1270 handleChunking();
1271 super.write(b); 1271 out.write(b);
1272 wrote(1); 1272 wrote(1);
1273 } 1273 }
1274 1274
1275 @Override 1275 @Override
1276 public void write(final byte[] b) throws IOException { 1276 public void write(final byte[] b) throws IOException {
1277 write(b, 0, b.length); 1277 this.write(b, 0, b.length);
1278 } 1278 }
1279 1279
1280 @Override 1280 @Override
1281 public void write(final byte[] b, int off, int len) throws IOException { 1281 public void write(final byte[] b, int off, int len) throws IOException {
1282 if (serverCancelled) { 1282 if (serverCancelled) {
1286 throw new IOException("Server aborted the upload"); 1286 throw new IOException("Server aborted the upload");
1287 } 1287 }
1288 while (len > 0) { 1288 while (len > 0) {
1289 handleChunking(); 1289 handleChunking();
1290 int toWrite = Integer.min(len, chunkLeft); 1290 int toWrite = Integer.min(len, chunkLeft);
1291 super.write(b, off, toWrite); 1291 out.write(b, off, toWrite);
1292 off += toWrite; 1292 off += toWrite;
1293 len -= toWrite; 1293 len -= toWrite;
1294 wrote(toWrite); 1294 wrote(toWrite);
1295 } 1295 }
1296 } 1296 }