Hi,
@Erik thanks for the report but I guess there is a misunderstanding, see
inline
Am 18.08.23 um 11:32 schrieb Brangs, Erik:
Hi,
-Ursprüngliche Nachricht-
Von: Andreas Lehmkühler [mailto:andr...@lehmi.de.INVALID]
Gesendet: Freitag, 18. August 2023 07:42
An: users@pdfbox.apache.org
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);
This is a functional interface. No instance of ScratchFile is created
when creating an instance of MemoryUsageSetting. It is created once the
functional interface is used.
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."":()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 can't read the byte code but I've double checked the behaviour when
debbugging one of our test cases
org.apache.pdfbox.multipdf.PDFMergerUtilityTest.testJpegCcitt()
Fortunately everthing is fine ;-)
Andreas
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: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org
-
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org