forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When matching literals we break out of the wrong loop (cherry picked from commit 7dfe43a)
- Loading branch information
1 parent
59384f6
commit 0f812d5
Showing
4 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/CloseDelegateInputStream.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.jboss.resteasy.reactive.server.vertx; | ||
|
||
import java.io.Closeable; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
public class CloseDelegateInputStream extends InputStream { | ||
|
||
final InputStream delegate; | ||
final Closeable closeable; | ||
|
||
public CloseDelegateInputStream(InputStream delegate, Closeable closeable) { | ||
this.delegate = delegate; | ||
this.closeable = closeable; | ||
} | ||
|
||
@Override | ||
public int read(byte[] b) throws IOException { | ||
int ret = delegate.read(b); | ||
if (ret == -1) { | ||
delegate.close(); | ||
} | ||
return ret; | ||
} | ||
|
||
@Override | ||
public int read(byte[] b, int off, int len) throws IOException { | ||
int ret = delegate.read(b, off, len); | ||
if (ret == -1) { | ||
delegate.close(); | ||
} | ||
return ret; | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
try { | ||
delegate.close(); | ||
} finally { | ||
closeable.close(); | ||
} | ||
} | ||
|
||
@Override | ||
public int read() throws IOException { | ||
int ret = delegate.read(); | ||
if (ret == -1) { | ||
delegate.close(); | ||
} | ||
return ret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters