@@ -92,34 +92,35 @@ void testCreatePDFA() throws Exception
9292 }
9393
9494 File signedFile = new File (signedPdfaFilename );
95- BufferedReader br = new BufferedReader (
96- new InputStreamReader (new FileInputStream (signedFile )));
97- String line ;
98- boolean isIncrementalArea = false ;
99- Set <String > set = new HashSet <>();
100- int linePos = 0 ;
101- while ((line = br .readLine ()) != null )
95+ try (BufferedReader br = new BufferedReader (
96+ new InputStreamReader (new FileInputStream (signedFile ))))
10297 {
103- ++linePos ;
104- if (line .equals ("%%EOF" ))
98+ String line ;
99+ boolean isIncrementalArea = false ;
100+ Set <String > set = new HashSet <>();
101+ int linePos = 0 ;
102+ while ((line = br .readLine ()) != null )
105103 {
106- isIncrementalArea = true ;
107- set .clear (); // for cases with several revisions
108- }
109- if (!isIncrementalArea )
110- {
111- continue ;
112- }
113- if (line .matches ("\\ d+ 0 obj" ))
114- {
115- int pos = line .indexOf (" 0 obj" );
116- line = line .substring (0 , pos );
117- assertFalse (set .contains (line ), "object '" + line
118- + " 0 obj' twice in incremental part of PDF at line " + linePos );
119- set .add (line );
104+ ++linePos ;
105+ if (line .equals ("%%EOF" ))
106+ {
107+ isIncrementalArea = true ;
108+ set .clear (); // for cases with several revisions
109+ }
110+ if (!isIncrementalArea )
111+ {
112+ continue ;
113+ }
114+ if (line .matches ("\\ d+ 0 obj" ))
115+ {
116+ int pos = line .indexOf (" 0 obj" );
117+ line = line .substring (0 , pos );
118+ assertFalse (set .contains (line ), "object '" + line
119+ + " 0 obj' twice in incremental part of PDF at line " + linePos );
120+ set .add (line );
121+ }
120122 }
121123 }
122- br .close ();
123124
124125 // https://docs.verapdf.org/develop/
125126 VeraGreenfieldFoundryProvider .initialise ();
0 commit comments