@@ -61,8 +61,9 @@ public class FopConfParser {
61
61
private static final String SKIP_PAGE_POSITION_ONLY_ALLOWED = "skip-page-position-only-allowed" ;
62
62
private static final String LEGACY_SKIP_PAGE_POSITION_ONLY = "legacy-skip-page-position-only" ;
63
63
private static final String LEGACY_LAST_PAGE_CHANGE_IPD = "legacy-last-page-change-ipd" ;
64
+ private static final String LEGACY_FO_WRAPPER = "legacy-fo-wrapper" ;
64
65
65
- private final Log log = LogFactory .getLog (FopConfParser .class );
66
+ private static final Log LOG = LogFactory .getLog (FopConfParser .class );
66
67
67
68
private final FopFactoryBuilder fopFactoryBuilder ;
68
69
@@ -169,8 +170,8 @@ public FopConfParser(Configuration cfg, FopFactoryBuilder fopFactoryBuilder) thr
169
170
170
171
private void configure (final URI baseURI , final ResourceResolver resourceResolver ,
171
172
Configuration cfg ) throws FOPException {
172
- if (log .isDebugEnabled ()) {
173
- log .debug ("Initializing FopFactory Configuration" );
173
+ if (LOG .isDebugEnabled ()) {
174
+ LOG .debug ("Initializing FopFactory Configuration" );
174
175
}
175
176
176
177
// strict fo validation
@@ -179,7 +180,7 @@ private void configure(final URI baseURI, final ResourceResolver resourceResolve
179
180
boolean strict = cfg .getChild ("strict-validation" ).getValueAsBoolean ();
180
181
fopFactoryBuilder .setStrictFOValidation (strict );
181
182
} catch (ConfigurationException e ) {
182
- LogUtil .handleException (log , e , false );
183
+ LogUtil .handleException (LOG , e , false );
183
184
}
184
185
}
185
186
@@ -189,7 +190,7 @@ private void configure(final URI baseURI, final ResourceResolver resourceResolve
189
190
strict = cfg .getChild ("strict-configuration" ).getValueAsBoolean ();
190
191
fopFactoryBuilder .setStrictUserConfigValidation (strict );
191
192
} catch (ConfigurationException e ) {
192
- LogUtil .handleException (log , e , false );
193
+ LogUtil .handleException (LOG , e , false );
193
194
}
194
195
}
195
196
@@ -199,7 +200,7 @@ private void configure(final URI baseURI, final ResourceResolver resourceResolve
199
200
fopFactoryBuilder .setKeepEmptyTags (
200
201
cfg .getChild ("accessibility" ).getAttributeAsBoolean (Accessibility .KEEP_EMPTY_TAGS , true ));
201
202
} catch (ConfigurationException e ) {
202
- LogUtil .handleException (log , e , false );
203
+ LogUtil .handleException (LOG , e , false );
203
204
}
204
205
}
205
206
@@ -209,7 +210,7 @@ private void configure(final URI baseURI, final ResourceResolver resourceResolve
209
210
URI confUri = InternalResourceResolver .getBaseURI (cfg .getChild ("base" ).getValue (null ));
210
211
fopFactoryBuilder .setBaseURI (baseURI .resolve (confUri ));
211
212
} catch (URISyntaxException use ) {
212
- LogUtil .handleException (log , use , strict );
213
+ LogUtil .handleException (LOG , use , strict );
213
214
}
214
215
}
215
216
@@ -218,41 +219,41 @@ private void configure(final URI baseURI, final ResourceResolver resourceResolve
218
219
float srcRes = cfg .getChild ("source-resolution" ).getValueAsFloat (
219
220
FopFactoryConfig .DEFAULT_SOURCE_RESOLUTION );
220
221
fopFactoryBuilder .setSourceResolution (srcRes );
221
- if (log .isDebugEnabled ()) {
222
- log .debug ("source-resolution set to: " + srcRes + "dpi" );
222
+ if (LOG .isDebugEnabled ()) {
223
+ LOG .debug ("source-resolution set to: " + srcRes + "dpi" );
223
224
}
224
225
}
225
226
if (cfg .getChild ("target-resolution" , false ) != null ) {
226
227
float targetRes = cfg .getChild ("target-resolution" ).getValueAsFloat (
227
228
FopFactoryConfig .DEFAULT_TARGET_RESOLUTION );
228
229
fopFactoryBuilder .setTargetResolution (targetRes );
229
- if (log .isDebugEnabled ()) {
230
- log .debug ("target-resolution set to: " + targetRes + "dpi" );
230
+ if (LOG .isDebugEnabled ()) {
231
+ LOG .debug ("target-resolution set to: " + targetRes + "dpi" );
231
232
}
232
233
}
233
234
if (cfg .getChild ("break-indent-inheritance" , false ) != null ) {
234
235
try {
235
236
fopFactoryBuilder .setBreakIndentInheritanceOnReferenceAreaBoundary (
236
237
cfg .getChild ("break-indent-inheritance" ).getValueAsBoolean ());
237
238
} catch (ConfigurationException e ) {
238
- LogUtil .handleException (log , e , strict );
239
+ LogUtil .handleException (LOG , e , strict );
239
240
}
240
241
}
241
242
Configuration pageConfig = cfg .getChild ("default-page-settings" );
242
243
if (pageConfig .getAttribute ("height" , null ) != null ) {
243
244
String pageHeight = pageConfig .getAttribute ("height" ,
244
245
FopFactoryConfig .DEFAULT_PAGE_HEIGHT );
245
246
fopFactoryBuilder .setPageHeight (pageHeight );
246
- if (log .isInfoEnabled ()) {
247
- log .info ("Default page-height set to: " + pageHeight );
247
+ if (LOG .isInfoEnabled ()) {
248
+ LOG .info ("Default page-height set to: " + pageHeight );
248
249
}
249
250
}
250
251
if (pageConfig .getAttribute ("width" , null ) != null ) {
251
252
String pageWidth = pageConfig .getAttribute ("width" ,
252
253
FopFactoryConfig .DEFAULT_PAGE_WIDTH );
253
254
fopFactoryBuilder .setPageWidth (pageWidth );
254
- if (log .isInfoEnabled ()) {
255
- log .info ("Default page-width set to: " + pageWidth );
255
+ if (LOG .isInfoEnabled ()) {
256
+ LOG .info ("Default page-width set to: " + pageWidth );
256
257
}
257
258
}
258
259
@@ -271,7 +272,7 @@ private void configure(final URI baseURI, final ResourceResolver resourceResolve
271
272
fopFactoryBuilder .setPreferRenderer (
272
273
cfg .getChild (PREFER_RENDERER ).getValueAsBoolean ());
273
274
} catch (ConfigurationException e ) {
274
- LogUtil .handleException (log , e , strict );
275
+ LogUtil .handleException (LOG , e , strict );
275
276
}
276
277
}
277
278
@@ -280,7 +281,7 @@ private void configure(final URI baseURI, final ResourceResolver resourceResolve
280
281
fopFactoryBuilder .setTableBorderOverpaint (
281
282
cfg .getChild (TABLE_BORDER_OVERPAINT ).getValueAsBoolean ());
282
283
} catch (ConfigurationException e ) {
283
- LogUtil .handleException (log , e , false );
284
+ LogUtil .handleException (LOG , e , false );
284
285
}
285
286
}
286
287
@@ -289,7 +290,7 @@ private void configure(final URI baseURI, final ResourceResolver resourceResolve
289
290
fopFactoryBuilder .setSimpleLineBreaking (
290
291
cfg .getChild (SIMPLE_LINE_BREAKING ).getValueAsBoolean ());
291
292
} catch (ConfigurationException e ) {
292
- LogUtil .handleException (log , e , false );
293
+ LogUtil .handleException (LOG , e , false );
293
294
}
294
295
}
295
296
@@ -298,23 +299,31 @@ private void configure(final URI baseURI, final ResourceResolver resourceResolve
298
299
fopFactoryBuilder .setSkipPagePositionOnlyAllowed (
299
300
cfg .getChild (SKIP_PAGE_POSITION_ONLY_ALLOWED ).getValueAsBoolean ());
300
301
} catch (ConfigurationException e ) {
301
- LogUtil .handleException (log , e , false );
302
+ LogUtil .handleException (LOG , e , false );
302
303
}
303
304
}
304
305
if (cfg .getChild (LEGACY_SKIP_PAGE_POSITION_ONLY , false ) != null ) {
305
306
try {
306
307
fopFactoryBuilder .setLegacySkipPagePositionOnly (
307
308
cfg .getChild (LEGACY_SKIP_PAGE_POSITION_ONLY ).getValueAsBoolean ());
308
309
} catch (ConfigurationException e ) {
309
- LogUtil .handleException (log , e , false );
310
+ LogUtil .handleException (LOG , e , false );
310
311
}
311
312
}
312
313
if (cfg .getChild (LEGACY_LAST_PAGE_CHANGE_IPD , false ) != null ) {
313
314
try {
314
315
fopFactoryBuilder .setLegacyLastPageChangeIPD (
315
316
cfg .getChild (LEGACY_LAST_PAGE_CHANGE_IPD ).getValueAsBoolean ());
316
317
} catch (ConfigurationException e ) {
317
- LogUtil .handleException (log , e , false );
318
+ LogUtil .handleException (LOG , e , false );
319
+ }
320
+ }
321
+ if (cfg .getChild (LEGACY_FO_WRAPPER , false ) != null ) {
322
+ try {
323
+ fopFactoryBuilder .setLegacyFoWrapper (
324
+ cfg .getChild (LEGACY_FO_WRAPPER ).getValueAsBoolean ());
325
+ } catch (ConfigurationException e ) {
326
+ LogUtil .handleException (LOG , e , false );
318
327
}
319
328
}
320
329
@@ -336,7 +345,7 @@ private void setHyphenationBase(Configuration cfg, ResourceResolver resourceReso
336
345
ResourceResolverFactory .createInternalResourceResolver (
337
346
baseURI .resolve (fontBase ), resourceResolver ));
338
347
} catch (URISyntaxException use ) {
339
- LogUtil .handleException (log , use , true );
348
+ LogUtil .handleException (LOG , use , true );
340
349
}
341
350
} else {
342
351
fopFactoryBuilder .setHyphenBaseResourceResolver (
@@ -388,7 +397,7 @@ private void setHyphPatNames(Configuration cfg, FopFactoryBuilder builder, boole
388
397
}
389
398
390
399
if (error .length () != 0 ) {
391
- LogUtil .handleError (log , error .toString (), strict );
400
+ LogUtil .handleError (LOG , error .toString (), strict );
392
401
continue ;
393
402
}
394
403
@@ -402,8 +411,8 @@ private void setHyphPatNames(Configuration cfg, FopFactoryBuilder builder, boole
402
411
} else {
403
412
hyphPatNames .put (llccKey , filename );
404
413
}
405
- if (log .isDebugEnabled ()) {
406
- log .debug ("Using hyphenation pattern filename " + filename
414
+ if (LOG .isDebugEnabled ()) {
415
+ LOG .debug ("Using hyphenation pattern filename " + filename
407
416
+ " for lang=\" " + lang + "\" "
408
417
+ (country != null ? ", country=\" " + country + "\" " : "" ));
409
418
}
@@ -436,15 +445,15 @@ private void configureImageLoading(Configuration parent, boolean strict) throws
436
445
try {
437
446
p = Penalty .toPenalty (Integer .parseInt (value ));
438
447
} catch (NumberFormatException nfe ) {
439
- LogUtil .handleException (log , nfe , strict );
448
+ LogUtil .handleException (LOG , nfe , strict );
440
449
}
441
450
}
442
451
if (p != null ) {
443
452
registry .setAdditionalPenalty (className , p );
444
453
}
445
454
}
446
455
} catch (ConfigurationException e ) {
447
- LogUtil .handleException (log , e , strict );
456
+ LogUtil .handleException (LOG , e , strict );
448
457
}
449
458
}
450
459
0 commit comments