Skip to content

Commit c288ab3

Browse files
authored
5377 custom exception for CharBuffer (helidon-io#5505)
* remove -Ddocker.build=true Signed-off-by: aserkes <andrii.serkes@oracle.com> * fix copyrights Signed-off-by: aserkes <andrii.serkes@oracle.com> * Create a custom exception to remove OutOfMemoryError in CharBuffer Signed-off-by: aserkes <andrii.serkes@oracle.com> * remove unnecessary constructors Signed-off-by: aserkes <andrii.serkes@oracle.com> Signed-off-by: aserkes <andrii.serkes@oracle.com>
1 parent 964d5dc commit c288ab3

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

reactive/media/common/src/main/java/io/helidon/reactive/media/common/CharBuffer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private void grow(int minCapacity) {
9797

9898
private static int hugeCapacity(int minCapacity) {
9999
if (minCapacity < 0) {
100-
throw new OutOfMemoryError("Capacity overflow. minCapacity=" + minCapacity);
100+
throw new OutOfCapacityException("Capacity overflow. minCapacity=" + minCapacity);
101101
}
102102
return (minCapacity > MAX_ARRAY_SIZE)
103103
? Integer.MAX_VALUE
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) 2022 Oracle and/or its affiliates.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.helidon.reactive.media.common;
17+
18+
/**
19+
* Exception that is related to the capacity of an object.
20+
*/
21+
public class OutOfCapacityException extends RuntimeException {
22+
23+
/**
24+
* New exception with a message and without a cause.
25+
* @param message message to use
26+
*/
27+
public OutOfCapacityException(String message) {
28+
super(message);
29+
}
30+
31+
}

0 commit comments

Comments
 (0)