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/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/ClassPathProviderImpl.java
+++ a/apisupport.ant/src/org/netbeans/modules/apisupport/project/queries/ClassPathProviderImpl.java
@@ -72,9 +72,7 @@
import org.netbeans.spi.project.support.ant.AntProjectEvent;
import org.netbeans.spi.project.support.ant.AntProjectListener;
import org.netbeans.spi.project.support.ant.PropertyUtils;
-import org.openide.ErrorManager;
import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileStateInvalidException;
import org.openide.filesystems.FileUtil;
import org.openide.util.WeakListeners;
import org.openide.xml.XMLUtil;
@@ -128,13 +126,7 @@
URL generatedClasses = FileUtil.urlForArchiveOrDir(project.getGeneratedClassesDirectory());
URL generatedUnitTestClasses = FileUtil.urlForArchiveOrDir(project.getTestGeneratedClassesDirectory("unit"));
URL generatedFunctionalTestClasses = FileUtil.urlForArchiveOrDir(project.getTestGeneratedClassesDirectory("qa-functional"));
- String fileU;
- try {
- fileU = file.getURL().toString();
- } catch (FileStateInvalidException x) {
- LOG.log(Level.INFO, null, x);
- return null;
- }
+ String fileU = file.getURL().toString();
if (srcDir != null &&
(FileUtil.isParentOf(srcDir, file) || file == srcDir || fileU.startsWith(generatedClasses.toString()))) {
// Regular sources.
@@ -151,11 +143,7 @@
return execute;
} else if (type.equals(ClassPath.SOURCE)) {
if (source == null) {
- try {
- source = ClassPathSupport.createClassPath(srcDir.getURL(), generatedClasses);
- } catch (FileStateInvalidException x) {
- LOG.log(Level.INFO, null, x);
- }
+ source = ClassPathSupport.createClassPath(srcDir.getURL(), generatedClasses);
}
return source;
}
@@ -177,11 +165,7 @@
return testExecute;
} else if (type.equals(ClassPath.SOURCE)) {
if (testSource == null) {
- try {
- testSource = ClassPathSupport.createClassPath(testSrcDir.getURL(), generatedUnitTestClasses);
- } catch (FileStateInvalidException x) {
- LOG.log(Level.INFO, null, x);
- }
+ testSource = ClassPathSupport.createClassPath(testSrcDir.getURL(), generatedUnitTestClasses);
}
return testSource;
}
@@ -190,11 +174,7 @@
// Functional tests.
if (type.equals(ClassPath.SOURCE)) {
if (funcTestSource == null) {
- try {
- funcTestSource = ClassPathSupport.createClassPath(funcTestSrcDir.getURL(), generatedFunctionalTestClasses);
- } catch (FileStateInvalidException x) {
- LOG.log(Level.INFO, null, x);
- }
+ funcTestSource = ClassPathSupport.createClassPath(funcTestSrcDir.getURL(), generatedFunctionalTestClasses);
}
return funcTestSource;
} else if (type.equals(ClassPath.COMPILE)) {
@@ -212,15 +192,10 @@
}
} else if (classesDir != null && (classesDir.equals(file) || FileUtil.isParentOf(classesDir,file))) {
if (ClassPath.EXECUTE.equals(type)) {
- try {
- ListNbClassLoader(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
ahy more.
+
FileObject.toURI
+ FileObject.getURL
no longer throws FileStateInvalidException
,
+ which can cause some existing source code to not compile.
+
+ Added FileObject.toURI
for convenience.
+
+ Also removed checked exception from FileObject.getURL
,
+ and clarified that URLMapper.findURL(fo, INTERNAL)
+ will never return null.
+