File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
modules/common/src/main/java/org/picketlink/common Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -2374,4 +2374,9 @@ public RuntimeException cannotSetMaxPoolSizeToNegative(String max) {
2374
2374
return new RuntimeException ("Cannot set maximum STS client pool size to negative number (" + max + ")" );
2375
2375
}
2376
2376
2377
+ @ Override
2378
+ public RuntimeException parserFeatureNotSupported (String feature ) {
2379
+ return new RuntimeException ("Parser feature " + feature + " not supported." );
2380
+ }
2381
+
2377
2382
}
Original file line number Diff line number Diff line change @@ -1215,4 +1215,6 @@ public interface PicketLinkLogger {
1215
1215
1216
1216
RuntimeException cannotSetMaxPoolSizeToNegative (String max );
1217
1217
1218
+ RuntimeException parserFeatureNotSupported (String feature );
1219
+
1218
1220
}
Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ public class DocumentUtil {
66
66
67
67
private static DocumentBuilderFactory documentBuilderFactory ;
68
68
69
+ public static final String feature_external_general_entities = "http://xml.org/sax/features/external-general-entities" ;
70
+ public static final String feature_external_parameter_entities = "http://xml.org/sax/features/external-parameter-entities" ;
71
+ public static final String feature_disallow_doctype_decl = "http://apache.org/xml/features/disallow-doctype-decl" ;
72
+
69
73
/**
70
74
* Check whether a node belongs to a document
71
75
*
@@ -517,6 +521,17 @@ private static DocumentBuilderFactory getDocumentBuilderFactory() {
517
521
documentBuilderFactory = DocumentBuilderFactory .newInstance ();
518
522
documentBuilderFactory .setNamespaceAware (true );
519
523
documentBuilderFactory .setXIncludeAware (true );
524
+ String feature = "" ;
525
+ try {
526
+ feature = feature_disallow_doctype_decl ;
527
+ documentBuilderFactory .setFeature (feature , true );
528
+ feature = feature_external_general_entities ;
529
+ documentBuilderFactory .setFeature (feature , false );
530
+ feature = feature_external_parameter_entities ;
531
+ documentBuilderFactory .setFeature (feature , false );
532
+ } catch (ParserConfigurationException e ) {
533
+ throw logger .parserFeatureNotSupported (feature );
534
+ }
520
535
} finally {
521
536
if (tccl_jaxp ) {
522
537
SecurityActions .setTCCL (prevTCCL );
You can’t perform that action at this time.
0 commit comments