Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OOME while just trying to assert long array.length #3065

Closed
onacit opened this issue Jun 2, 2023 · 3 comments
Closed

OOME while just trying to assert long array.length #3065

onacit opened this issue Jun 2, 2023 · 3 comments
Assignees
Milestone

Comments

@onacit
Copy link
Contributor

onacit commented Jun 2, 2023

Describe the bug

Given, an instance of byte[] whose length is, incidentally, 98007000,
I tried to verify its length.

final var bytes = getBytes();
final var expectedSize = whatever-not-98007000;
assertThat(bytes).isNotNull().hasSize(expectedSize);

And an OutOfMermoryError thrown, seems it tried to create a nice message.

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.base/java.lang.Integer.toString(Integer.java:457)
	at java.base/java.lang.Byte.toString(Byte.java:441)
	at org.assertj.core.presentation.StandardRepresentation.toStringOf(StandardRepresentation.java:348)
	at org.assertj.core.presentation.StandardRepresentation.toStringOf(StandardRepresentation.java:250)
	at org.assertj.core.presentation.StandardRepresentation.safeStringOf(StandardRepresentation.java:621)
	at org.assertj.core.presentation.StandardRepresentation.lambda$representElements$0(StandardRepresentation.java:628)
	at org.assertj.core.presentation.StandardRepresentation$$Lambda$508/0x00000008003b4a40.apply(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1006)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
@joel-costigliola
Copy link
Member

Thanks for reporting this @onacit!

@joel-costigliola joel-costigliola added this to the 3.25.0 milestone Jun 2, 2023
@etellman
Copy link
Contributor

I can take a look at this one, if nobody else is.

@etellman
Copy link
Contributor

Here's what I came up with: #3109. Let me know what you think of the approach.

This is my first open source contribution, so I may have messed something up with the logistics. Also me know if I created the pull request correctly, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants