[ 
https://issues.apache.org/jira/browse/OPENNLP-1476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17696473#comment-17696473
 ] 

ASF GitHub Bot commented on OPENNLP-1476:
-----------------------------------------

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


##########
opennlp-tools/src/main/java/opennlp/tools/dictionary/serializer/DictionaryEntryPersistor.java:
##########
@@ -225,16 +226,19 @@ public void startPrefixMapping(String prefix, String uri)
   public static boolean create(InputStream in, EntryInserter inserter)
       throws IOException {
 
-    DictionaryContenthandler profileContentHandler =
-        new DictionaryContenthandler(inserter);
+    DictionaryContenthandler profileContentHandler = new 
DictionaryContenthandler(inserter);
 
     XMLReader xmlReader;
     try {
-      xmlReader = XMLReaderFactory.createXMLReader();
+      xmlReader = SAX_PARSER_FACTORY.newSAXParser().getXMLReader();
+      // Note:

Review Comment:
   Basically, from a runtime perspective: _none_. 
   
   The switch to this way of creating the XMLReader instance is kind of a 
modernization. 
   You might wanna check the JavaDoc of `XMLReaderFactory.createXMLReader()` 
for details: 
https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/xml/sax/helpers/XMLReaderFactory.html





> Modernize DictionaryEntryPersistor to create XMLReader via 
> javax.xml.parsers.SAXParserFactory
> ---------------------------------------------------------------------------------------------
>
>                 Key: OPENNLP-1476
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1476
>             Project: OpenNLP
>          Issue Type: Improvement
>    Affects Versions: 2.1.0, 2.1.1
>            Reporter: Martin Wiesner
>            Assignee: Martin Wiesner
>            Priority: Minor
>             Fix For: 2.1.2
>
>
> Atm, {{org.xml.sax.helpers.XMLReaderFactory}} is used inĀ 
> {{DictionaryEntryPersistor}}. However, this the use of XMLReaderFactory is 
> deprecated since Java 9, that is:
> {code:java}
> Deprecated
> It is recommended to use javax.xml.parsers.SAXParserFactory instead.
> {code}
> Aim(s):
> * Switch to {{SAXParserFactory}} to obtain instances of {{XMLReader}} to 
> modern way.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to