< prev index next >
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/hpack/IntegerReader.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 22,31 ****
--- 22,32 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.incubator.http.internal.hpack;
+ import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Arrays;
import static java.lang.String.format;
*** 71,81 ****
this.N = N;
state = CONFIGURED;
return this;
}
! public boolean read(ByteBuffer input) {
if (state == NEW) {
throw new IllegalStateException("Configure first");
}
if (state == DONE) {
return true;
--- 72,82 ----
this.N = N;
state = CONFIGURED;
return this;
}
! public boolean read(ByteBuffer input) throws IOException {
if (state == NEW) {
throw new IllegalStateException("Configure first");
}
if (state == DONE) {
return true;
*** 103,113 ****
return false;
}
i = input.get();
long increment = b * (i & 127);
if (r + increment > maxValue) {
! throw new IllegalArgumentException(format(
"Integer overflow: maxValue=%,d, value=%,d",
maxValue, r + increment));
}
r += increment;
b *= 128;
--- 104,114 ----
return false;
}
i = input.get();
long increment = b * (i & 127);
if (r + increment > maxValue) {
! throw new IOException(format(
"Integer overflow: maxValue=%,d, value=%,d",
maxValue, r + increment));
}
r += increment;
b *= 128;
< prev index next >