dataObject
*/
private static String getSystemId (DataObject dataObject) {
- String systemId = null;
- try {
- FileObject fileObject = dataObject.getPrimaryFile();
- URL url = fileObject.getURL();
- try {
- systemId = new URI(url.toString()).toASCIIString();
- } catch (URISyntaxException ex) {
- // if cannot be converted to URI, return at least external form
- // instead of returning null
- systemId = url.toExternalForm();
- Util.THIS.debug(ex);
- }
- } catch (FileStateInvalidException exc) {
- if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug (exc);
-
- // nothing to do -> return null; //???
- }
- return systemId;
+ return dataObject.getPrimaryFile().toURI().toASCIIString();
}
private static synchronized SAXParserFactory getSAXParserFactory () throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException {
--- a/api.xml/src/org/netbeans/spi/xml/cookies/SharedXMLSupport.java
+++ a/api.xml/src/org/netbeans/spi/xml/cookies/SharedXMLSupport.java
@@ -54,7 +54,6 @@
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import org.openide.filesystems.FileStateInvalidException;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
@@ -239,11 +238,6 @@
// same as one catched by ErrorHandler
// because we do not have content handler
- } catch (FileStateInvalidException ex) {
-
- // bad luck report as fatal error
- handler.fatalError(new SAXParseException(ex.getLocalizedMessage(), locator, ex));
-
} catch (IOException ex) {
// bad luck probably because cannot resolve entity
--- a/apisupport.ant/nbproject/project.xml
+++ a/apisupport.ant/nbproject/project.xml
@@ -259,7 +259,7 @@
NbClassLoader(FileObject[], ...)
does not throw FileStateInvalidException
+ No NbClassLoader
constructor throws FileStateInvalidException
any longer,
+ which can cause some existing source code to not compile.
+
+ NbClassLoader(FileObject[], ClassLoader, InputOutput)
does not throw FileStateInvalidException
any more.
+
FileObject.toURI
+ FileObject.getURL
should be replaced with toURL
(or toURI
),
+ which also throw no checked exceptions.
+
+ Added FileObject.toURI
for convenience.
+
+ Also deprecated FileObject.getURL
in favor of toURL
+ which is the same but does not throw FileStateInvalidException
,
+ and clarified that URLMapper.findURL(fo, INTERNAL)
+ will never return null.
+