@@ -189,11 +189,9 @@ private void provideXMPMetadata(final Map<String, Object> pdfDetails, final PDMe
189189
190190 private static void extractFilesFromPage (final PDPage page , final List <String > filenames ) throws IOException {
191191 for (PDAnnotation annotation : page .getAnnotations ()) {
192- if (annotation instanceof PDAnnotationFileAttachment ) {
193- PDAnnotationFileAttachment annotationFileAttachment = (PDAnnotationFileAttachment ) annotation ;
192+ if (annotation instanceof PDAnnotationFileAttachment annotationFileAttachment ) {
194193 PDFileSpecification fileSpec = annotationFileAttachment .getFile ();
195- if (fileSpec instanceof PDComplexFileSpecification ) {
196- PDComplexFileSpecification complexFileSpec = (PDComplexFileSpecification ) fileSpec ;
194+ if (fileSpec instanceof PDComplexFileSpecification complexFileSpec ) {
197195 PDEmbeddedFile embeddedFile = getEmbeddedFile (complexFileSpec );
198196 if (embeddedFile != null ) {
199197 extractFile (filenames , complexFileSpec .getFilename ());
@@ -291,11 +289,11 @@ private static void addTextInfo(final Map<String, Object> pdfDetails, final PDDo
291289 */
292290 private static void checkIfXRechnung (final Map <String , Object > pdfDetails ) {
293291 final Object metadata = pdfDetails .get (METADATA_KEY );
294- if (metadata instanceof String ) {
292+ if (metadata instanceof String metadataString ) {
295293 try {
296294 final XMLMatcher xmlMatcher = new XMLMatcher ();
297295 final Context xmlContext = new Context (
298- new MemoryInputStream ((( String ) metadata ) .getBytes (StandardCharsets .UTF_8 )),
296+ new MemoryInputStream (metadataString .getBytes (StandardCharsets .UTF_8 )),
299297 new HashMap <>(), null , Locale .ENGLISH , "" );
300298 final boolean isXRechnung = xmlMatcher .matches (xmlContext );
301299 if (isXRechnung ) {
0 commit comments