mawiesne commented on code in PR #892:
URL: https://github.com/apache/opennlp/pull/892#discussion_r2550978593


##########
opennlp-tools/src/main/java/opennlp/tools/util/XmlUtil.java:
##########
@@ -38,7 +42,14 @@ public class XmlUtil {
   public static DocumentBuilder createDocumentBuilder() {
     try {
       DocumentBuilderFactory documentBuilderFactory = 
DocumentBuilderFactory.newInstance();
-      
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+      try {
+        
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+      } catch (ParserConfigurationException e) {
+        /// {@link XMLConstants.FEATURE_SECURE_PROCESSING} is not supported on 
Android.
+        /// See {@link DocumentBuilderFactory#setFeature}
+        logger.info("Failed to enable XMLConstants.FEATURE_SECURE_PROCESSING, 
it's unsupported on" +

Review Comment:
   Could you change this to `logger.warn(..)` instead?



##########
opennlp-tools/src/main/java/opennlp/tools/util/XmlUtil.java:
##########
@@ -38,7 +42,14 @@ public class XmlUtil {
   public static DocumentBuilder createDocumentBuilder() {
     try {
       DocumentBuilderFactory documentBuilderFactory = 
DocumentBuilderFactory.newInstance();
-      
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+      try {
+        
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+      } catch (ParserConfigurationException e) {
+        /// {@link XMLConstants.FEATURE_SECURE_PROCESSING} is not supported on 
Android.
+        /// See {@link DocumentBuilderFactory#setFeature}
+        logger.info("Failed to enable XMLConstants.FEATURE_SECURE_PROCESSING, 
it's unsupported on" +
+                " Android.", e);

Review Comment:
   Can we exchange "Android" with "on this platform"? This would be more 
generic and signal the same for different platforms that don't support 
`XMLConstants.FEATURE_SECURE_PROCESSING`.
   
   I think the code comment is a sufficient hint for devs people and points 
them to the known case of the _Android_ env.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to