Open MaratheHarshad opened 9 hours ago
To resolve the NullPointerException
caused by unchecked checkboxes for "Include Metadata" and "Allow Duplicates" in the /split-pdf-by-chapters
feature, you should ensure that the backend receives boolean false
instead of null
. This can be achieved by setting default values for these fields in the SplitPdfByChaptersRequest
class. Here's how you can modify the class:
@Data
@EqualsAndHashCode
@NoArgsConstructor
@AllArgsConstructor
class SplitPdfByChaptersRequest {
private MultipartFile fileInput;
private Integer bookmarkLevel;
private boolean includeMetadata = false; // Default to false
private boolean allowDuplicates = false; // Default to false
}
By setting default values for includeMetadata
and allowDuplicates
to false
, the backend will receive false
when the checkboxes are unchecked, preventing the NullPointerException
[1]. Additionally, ensure that the frontend form is correctly configured to send false
when these checkboxes are unchecked [2].
To continue talking to Dosu, mention @dosu.
Installation Method
None
The Problem
Description:
Currently, in the /split-pdf-by-chapters feature, the includeMetadata and allowDuplicates checkboxes are not correctly submitting true or false values based on the user's selection. When the checkboxes are left unchecked, the backend receives null instead of a boolean false, which results in a NullPointerException.
Feature URL: https://stirlingpdf.io/split-pdf-by-chapters
Steps to Reproduce:
Expected Behavior:
The backend should receive true if the checkbox is checked and false if it’s unchecked. The form should correctly handle boolean values for these checkboxes without causing errors.
Screenshots:
Version of Stirling-PDF
0.32.0
Last Working Version of Stirling-PDF
No response
Page Where the Problem Occurred
https://stirlingpdf.io/split-pdf-by-chapters
Docker Configuration
No response
Relevant Log Output
No response
Additional Information
No response
Browsers Affected
No response
No Duplicate of the Issue