@ -24,7 +24,11 @@ import javax.swing.text.Segment;
import javax.xml.parsers.ParserConfigurationException ;
import javax.xml.parsers.SAXParser ;
import javax.xml.parsers.SAXParserFactory ;
import com.fr.log.FineLoggerFactory ;
import org.xml.sax.SAXException ;
import org.xml.sax.SAXNotRecognizedException ;
import org.xml.sax.SAXNotSupportedException ;
/ * *
@ -81,10 +85,10 @@ public class DefaultCompletionProvider extends AbstractCompletionProvider {
/ * *
* Returns the text just before the current caret position that could be
* the start of something auto - completable . < p >
*
* < p >
* This method returns all characters before the caret that are matched
* by { @link # isValidChar ( char ) } .
*
* < p >
* { @inheritDoc }
* /
public String getAlreadyEnteredText ( JTextComponent comp ) {
@ -314,6 +318,15 @@ public class DefaultCompletionProvider extends AbstractCompletionProvider {
//long start = System.currentTimeMillis();
SAXParserFactory factory = SAXParserFactory . newInstance ( ) ;
try {
factory . setFeature ( "http://apache.org/xml/features/disallow-doctype-decl" , true ) ;
factory . setFeature ( "http://xml.org/sax/features/external-general-entities" , false ) ;
factory . setFeature ( "http://xml.org/sax/features/external-parameter-entities" , false ) ;
factory . setFeature ( "http://apache.org/xml/features/nonvalidating/load-external-dtd" , false ) ;
} catch ( ParserConfigurationException | SAXNotSupportedException | SAXNotRecognizedException e ) {
FineLoggerFactory . getLogger ( ) . warn ( e . getMessage ( ) , e ) ;
}
factory . setValidating ( true ) ;
CompletionXMLParser handler = new CompletionXMLParser ( this , cl ) ;
BufferedInputStream bin = new BufferedInputStream ( in ) ;
@ -357,8 +370,7 @@ public class DefaultCompletionProvider extends AbstractCompletionProvider {
File file = new File ( resource ) ;
if ( file . isFile ( ) ) {
in = new FileInputStream ( file ) ;
}
else {
} else {
throw new IOException ( "No such resource: " + resource ) ;
}
}