FastByteArrayInputStream consistently returns -1 when no data available

Issue: SPR-13858
This commit is contained in:
Juergen Hoeller 2016-01-13 12:44:34 +01:00
parent 96cb0e6bd6
commit 5d4547d343
1 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -361,7 +361,7 @@ public class FastByteArrayOutputStream extends OutputStream {
@Override @Override
public int read() { public int read() {
if (this.currentBuffer == null) { if (this.currentBuffer == null) {
// this stream doesn't have any data in it // This stream doesn't have any data in it...
return -1; return -1;
} }
else { else {
@ -412,8 +412,8 @@ public class FastByteArrayOutputStream extends OutputStream {
} }
else { else {
if (this.currentBuffer == null) { if (this.currentBuffer == null) {
// this stream doesn't have any data in it // This stream doesn't have any data in it...
return 0; return -1;
} }
else { else {
if (this.nextIndexInCurrentBuffer < this.currentBufferLength) { if (this.nextIndexInCurrentBuffer < this.currentBufferLength) {
@ -456,7 +456,7 @@ public class FastByteArrayOutputStream extends OutputStream {
} }
int len = (int) n; int len = (int) n;
if (this.currentBuffer == null) { if (this.currentBuffer == null) {
// this stream doesn't have any data in it // This stream doesn't have any data in it...
return 0; return 0;
} }
else { else {
@ -506,7 +506,7 @@ public class FastByteArrayOutputStream extends OutputStream {
*/ */
public void updateMessageDigest(MessageDigest messageDigest, int len) { public void updateMessageDigest(MessageDigest messageDigest, int len) {
if (this.currentBuffer == null) { if (this.currentBuffer == null) {
// this stream doesn't have any data in it // This stream doesn't have any data in it...
return; return;
} }
else if (len == 0) { else if (len == 0) {