Hi,
> -----Ursprüngliche Nachricht-----
> Von: Andreas Lehmkühler [mailto:[email protected]]
> Gesendet: Freitag, 18. August 2023 07:42
> An: [email protected]
> Betreff: [ANNOUNCE] Apache PDFBox 3.0.0 released
>
> The Apache PDFBox community is pleased to announce the release of Apache
> PDFBox 3.0.0. It is available for download at:
>
> https://pdfbox.apache.org/download.html
>
> [...]
>
> A migration guide is available at
>
> https://pdfbox.apache.org/3.0/migration.html.
>
> It is still a work in progress and we are happy to include any valuable
> feedback from our community.
I was going to suggest to update the documentation to say that you can use the
streamCache field of MemoryUsageSetting rather than using IOUtils. However,
I've looked at the code of MemoryUsageSetting and I'm not actually sure if
that's correct.
I think there's a bug in MemoryUsageSetting: The comment for streamCache says
that it creates "an instance of ScratchFile using the current settings".
However, the line
public final StreamCacheCreateFunction streamCache = () -> new
ScratchFile(this);
is executed at the start of the constructor of MemoryUsageSetting before the
instance variables have been set. At least that's what the bytecode output from
javap -c -p says:
private org.apache.pdfbox.io.MemoryUsageSetting(boolean, boolean, long, long);
Code:
0: aload_0
1: invokespecial #1 // Method
java/lang/Object."<init>":()V
4: aload_0
5: aload_0
6: invokedynamic #2, 0 // InvokeDynamic
#0:create:(Lorg/apache/pdfbox/io/MemoryUsageSetting;)Lorg/apache/pdfbox/io/RandomAccessStreamCache$StreamCacheCreateFunction;
11: putfield #3 // Field
streamCache:Lorg/apache/pdfbox/io/RandomAccessStreamCache$StreamCacheCreateFunction;
14: iload_2
I think the initialization of ScratchFile needs to happen at the end of the
constructor if the settings are supposed to be used.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]