Skip to content

Commit 54c8cf3

Browse files
committed
fix tests + ProgressiveBufferedReadableCharStream
1 parent 5720c7c commit 54c8cf3

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

net.lecousin.core/src/main/java/net/lecousin/framework/io/text/Decoder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ public int decode(char[] chars, int pos, int len, MutableBoolean interrupt, int
9393
int nb = 0;
9494
do {
9595
if (currentBuffer == null) {
96-
// TODO if (nextBuffer.isUnblocked())
96+
if (nextBuffer.isUnblocked())
9797
currentBuffer = nextBuffer.blockResult(0);
98-
// else
99-
// return nb > 0 ? nb : -2;
98+
else
99+
return nb > 0 ? nb : -2;
100100
if (currentBuffer != null)
101101
nextBuffer = io.readNextBufferAsync();
102102
}

net.lecousin.core/src/main/java/net/lecousin/framework/io/text/ProgressiveBufferedReadableCharStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public Void run() throws CancelException {
507507
}
508508
int min = lastNb < bufferSize / 10 ? bufferSize / 10 : 1;
509509
int nb;
510-
try { nb = decoder.decode(buffer.chars, buffer.pos, bufferSize - buffer.pos, interruptFillBuffer, min); }
510+
try { nb = decoder.decode(buffer.chars, buffer.length, bufferSize - buffer.length, interruptFillBuffer, min); }
511511
catch (IOException e) {
512512
synchronized (buffers) {
513513
error = e;

net.lecousin.core/src/test/java/net/lecousin/framework/core/test/io/TestWritableBuffered.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ protected IO.Writable createWritable() throws IOException {
1919
return createWritableBuffered();
2020
}
2121

22-
@SuppressWarnings("unused")
23-
protected void flush(IO.Writable.Buffered io) throws Exception {
24-
}
25-
2622
@Test(timeout=120000)
2723
public void testWriteBufferByBufferInBuffered() throws Exception {
2824
IO.Writable.Buffered io = createWritableBuffered();

net.lecousin.core/src/test/java/net/lecousin/framework/core/tests/io/buffered/TestByteArrayIOWritableBuffered.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected IO.Writable.Buffered createWritableBuffered() throws IOException {
3939
}
4040

4141
@Override
42-
protected void flush(IO.Writable.Buffered io) throws IOException {
42+
protected void flush(IO.Writable io) throws IOException {
4343
ByteArrayIO bio = (ByteArrayIO)io;
4444
FileOutputStream out = new FileOutputStream(file);
4545
out.write(bio.getArray(), 0, (int)bio.getSizeSync());

net.lecousin.core/src/test/java/net/lecousin/framework/core/tests/io/buffered/TestMemoryIOWritableBuffered.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected IO.Writable.Buffered createWritableBuffered() throws IOException {
3636
}
3737

3838
@Override
39-
protected void flush(IO.Writable.Buffered io) throws Exception {
39+
protected void flush(IO.Writable io) throws Exception {
4040
MemoryIO mio = (MemoryIO)io;
4141
FileIO.WriteOnly fio = new FileIO.WriteOnly(file, Task.PRIORITY_NORMAL);
4242
mio.writeAsyncTo(fio).blockException(0);

0 commit comments

Comments
 (0)