Skip to content

Commit

Permalink
OHttpChunkFramer.decodePrefix(...) should also declare throws (#38)
Browse files Browse the repository at this point in the history
Motivation:

Let's make things more consistent by also adding a throws to OHttpChunkFramer.decodePrefix(...)

Modifications:

Add throws to signature

Result:

More consistent API
  • Loading branch information
normanmaurer authored Dec 27, 2023
1 parent 42bbd9b commit 08f9f20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ interface Decoder {
/**
* Decode the initial bytes of the HTTP content.
* @return true on success, on false if more bytes are needed.
* @throws CryptoException if the prefix cannot be decoded.
*/
boolean decodePrefix(ByteBuf in);
boolean decodePrefix(ByteBuf in) throws CryptoException;

/**
* @return true if the prefix has not been decoded yet.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ final void parse(ByteBuf in, boolean completeBodyReceived, List<Object> out) thr
* Decode the initial bytes of the HTTP content.
* @return true on success, on false if more bytes are needed.
*/
protected abstract boolean decodePrefix(ByteBuf in);
protected abstract boolean decodePrefix(ByteBuf in) throws CryptoException;

/**
* Decrypt a chunk.
Expand Down Expand Up @@ -174,7 +174,7 @@ public boolean isPrefixNeeded() {
}

@Override
public boolean decodePrefix(ByteBuf in) {
public boolean decodePrefix(ByteBuf in) throws CryptoException {
if (decodedPrefix) {
throw new IllegalStateException("Prefix already decoded");
}
Expand Down

0 comments on commit 08f9f20

Please sign in to comment.