1515 */
1616package org .labkey .flow .analysis .model ;
1717
18- import org .apache .logging .log4j .LogManager ;
1918import org .apache .xerces .impl .Constants ;
2019import org .apache .xerces .parsers .DOMParser ;
2120import org .apache .xerces .util .SymbolTable ;
2423import org .apache .xerces .xni .QName ;
2524import org .apache .xerces .xni .XMLLocator ;
2625import org .apache .xerces .xni .XNIException ;
26+ import org .labkey .api .util .XmlBeansUtil ;
2727import org .w3c .dom .Attr ;
2828import org .w3c .dom .Document ;
2929import org .w3c .dom .Element ;
4141import org .xml .sax .helpers .DefaultHandler ;
4242
4343import javax .xml .parsers .SAXParser ;
44- import javax .xml .parsers .SAXParserFactory ;
4544import java .io .File ;
4645import java .io .IOException ;
4746import java .io .InputStream ;
@@ -135,13 +134,14 @@ static public boolean isFlowJoWorkspace(File file)
135134 WorkspaceRecognizer recognizer = new WorkspaceRecognizer ();
136135 try
137136 {
138- SAXParser parser = SAXParserFactory . newInstance () .newSAXParser ();
137+ SAXParser parser = XmlBeansUtil . SAX_PARSER_FACTORY_ALLOWING_DOCTYPE .newSAXParser ();
139138
140139 parser .parse (file , recognizer );
141140 }
142141 catch (Exception e )
143142 {
144143 // suppress
144+ FlowJoWorkspace .LOG .debug ("Unexpected error" , e );
145145 }
146146 return recognizer .isWorkspace ();
147147 }
@@ -371,7 +371,6 @@ public void fatalError(SAXParseException exception) throws SAXException
371371 static class FJParseFilter implements LSParserFilter
372372 {
373373 SymbolTable fSymbolTable = new SymbolTable ();
374- Set <String > rejected = new HashSet <>();
375374
376375 @ Override
377376 public short startElement (Element element )
@@ -385,7 +384,6 @@ public short startElement(Element element)
385384 else if (nsURI != null && (GATINGML_1_5_NAMESPACES .contains (nsURI ) || FJ_GATINGML_1_5_NAMEPSACE_FIXUP .containsKey (nsURI ) || GATINGML_2_0_NAMESPACES .contains (nsURI )))
386385 filter = FILTER_ACCEPT ;
387386
388- // if (filter != FILTER_ACCEPT && rejected.add(element.getNodeName())) System.err.println((filter == FILTER_SKIP ? "SKIPPED: " : "REJECTED: ") + element.getNodeName());
389387 return filter ;
390388 }
391389
@@ -457,7 +455,7 @@ static FJDOMParser create()
457455 {
458456 super (st );
459457 fSymbolTable = st ;
460- fSkippedElemStack = new Stack ();
458+ fSkippedElemStack = new Stack <> ();
461459 fDOMFilter = new FJParseFilter ();
462460 try
463461 {
@@ -516,7 +514,7 @@ public void parse(InputSource inputSource) throws SAXException, IOException
516514 }
517515 catch (RuntimeException x )
518516 {
519- LogManager . getLogger ( FlowJoWorkspace .class ) .error ("Unexpected error" , x );
517+ FlowJoWorkspace .LOG .error ("Unexpected error" , x );
520518 throw x ;
521519 }
522520 }
0 commit comments