RFR: JDK-8230744 Several classes throw OutOfMemoryError without message

Brent Christian brent.christian at oracle.com
Mon Jun 1 20:36:18 UTC 2020


One comment:

src/java.base/share/classes/java/util/regex/Pattern.java

--- 1679,1690 ----
           i += 2;
           int newTempLen;
           try {
               newTempLen = Math.addExact(j + 2, Math.multiplyExact(3, 
pLen - i));
           } catch (ArithmeticException ae) {
!             throw new
!             OutOfMemoryError("Unable to allocate buffer for \\Q...\\E 
sequence");
           }

"Unable to allocate buffer" seems vague in the context of an OOME.  If 
the problem is trying to create a too-large array, maybe something like, 
"Buffer for \\Q...\\E sequence would exceed maximum array size".

-Brent

On 6/1/20 5:48 AM, Jim Laskey wrote:
> Cleans up every case of OutOfMemoryError without a message. Some logic changes in String::repeat and ByteArrayChannel:: hugeCapacity.
> 
> Thank you.
> 
> Cheers,
> 
> -- Jim
> 
> webrev: http://cr.openjdk.java.net/~jlaskey/8230744/webrev-00/index.html <http://cr.openjdk.java.net/~jlaskey/8230744/webrev-00/index.html>
> jbs: https://bugs.openjdk.java.net/browse/JDK-8230744 <https://bugs.openjdk.java.net/browse/JDK-8230744>
> 
> 


More information about the core-libs-dev mailing list