Backblaze / b2-sdk-java

The official Java SDK for using Backblaze's B2 Storage APIs
Other
94 stars 25 forks source link

create B2Json version of ByteArrayOutputStream and throws IOException… #143

Closed mxue-BB closed 3 years ago

mxue-BB commented 3 years ago

Notes: A subclass of B2JsonByteArrayOutputStream was created for testing with a smaller MAX_ARRAY_SIZE for throwing IOException("Requested array size exceeds maximum limit"). The original MAX_ARRAY_SIZE(Integer.MAX_VALUE - 8) was so large that we would throw an OutOfMemoryError first before even getting a chance to throw IOException with most typical JVM heap settings. (I managed to throw IOException with a larger heap size (>=3 GB) for unit testing B2JsonByteArrayOutputStream with it original MAX_ARRAY_SIZE) The above fact means using B2JsonByteArrayOutputStream to catch and throw the intended IOException is of practical value probably only for JVMs with very large heap size.

certainmagic commented 3 years ago

i just skimmed it. if brianb is fine with it, i'm ok with it.