This is an automated email from the ASF dual-hosted git repository. matthiasblaesing pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push: new 8f0da0b [NETBEANS-2616] Remove get url deprecation 8f0da0b is described below commit 8f0da0b57f03751df5415c50bda4acd5dbc6c5b9 Author: Brad Walker <bwal...@musings.com> AuthorDate: Thu May 30 10:38:26 2019 -0600 [NETBEANS-2616] Remove get url deprecation One of those deprecated warnings is "getURL() in FileObject has been deprecated". This work is simply to remove these warnings and make the build less noisy. --- .../modules/j2ee/dd/api/client/DDProvider.java | 26 +++---- .../modules/j2ee/dd/api/web/DDProvider.java | 42 +++++------ .../dd/impl/web/metadata/WebAppMetadataImpl.java | 9 +-- .../query/J2eePlatformJavadocForBinaryQuery.java | 15 +--- .../sharability/JavadocForBinaryQueryImpl.java | 15 +--- .../impl/sharability/SourceForBinaryQueryImpl.java | 8 +-- .../jaxws/client/ProjectJAXWSClientSupport.java | 84 ++++++++++------------ .../websvc/core/jaxws/nodes/JaxWsChildren.java | 12 ++-- .../websvc/core/jaxws/nodes/JaxWsClientNode.java | 32 ++++----- .../websvc/jaxws/spi/ProjectJAXWSSupport.java | 6 +- .../modules/websvc/rest/support/Utils.java | 6 +- .../tools/ant/module/xml/AntProjectSupport.java | 19 ++--- .../modules/groovy/editor/api/GroovyIndexer.java | 10 +-- .../plugins/PackageDeleteRefactoringPlugin.java | 13 +--- .../modules/tasklist/impl/TaskManagerImpl.java | 35 +++++---- .../dbschema/jdbcimpl/DBschemaDataObject.java | 6 +- .../modules/form/editors/CustomIconEditor.java | 8 +-- .../modules/i18n/form/I18nServiceImpl.java | 4 +- .../java/editor/overridden/ComputeOverriders.java | 25 ++----- .../modules/java/freeform/JavaActions.java | 4 +- .../netbeans/modules/java/freeform/TestQuery.java | 14 +--- .../queries/SourceJavadocAttacherUtil.java | 4 +- .../netbeans/api/java/source/TreePathHandle.java | 37 +++------- .../modules/java/classfile/CodeGenerator.java | 4 +- .../java/source/tasklist/IncorrectErrorBadges.java | 6 +- .../saas/codegen/java/support/LibrariesHelper.java | 2 +- .../openide/loaders/FileEntityResolver.java | 26 +++---- .../src/org/openide/loaders/DataShadow.java | 6 +- .../openide/loaders/XMLDataObjectInfoParser.java | 9 +-- .../providers/ProfilerStorageProviderImpl.java | 2 +- .../projectsupport/utilities/AppletSupport.java | 54 +++++++------- 31 files changed, 210 insertions(+), 333 deletions(-) diff --git a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/client/DDProvider.java b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/client/DDProvider.java index 269632f..f3c8b7d 100644 --- a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/client/DDProvider.java +++ b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/client/DDProvider.java @@ -118,14 +118,14 @@ public final class DDProvider { // preparsing error = ClientParseUtils.parse(fo); original = DDUtils.createAppClient(fo, version); - baseBeanMap.put(fo.getURL(), new WeakReference<AppClient>(original)); - errorMap.put(fo.getURL(), error); + baseBeanMap.put(fo.toURL(), new WeakReference<AppClient>(original)); + errorMap.put(fo.toURL(), error); } else { BigDecimal orgVersion = original.getVersion(); if (orgVersion != null){ version = orgVersion.toPlainString(); } - error = errorMap.get(fo.getURL()); + error = errorMap.get(fo.toURL()); } } appClient = new AppClientProxy(original, version); @@ -147,7 +147,7 @@ public final class DDProvider { if (cached != null) { return cached; } - ddMap.put(fo.getURL(), new WeakReference<AppClientProxy>(appClient)); + ddMap.put(fo.toURL(), new WeakReference<AppClientProxy>(appClient)); } return appClient; } @@ -168,26 +168,26 @@ public final class DDProvider { if (fo == null) { return null; } - WeakReference<AppClientProxy> wr = ddMap.get(fo.getURL()); + WeakReference<AppClientProxy> wr = ddMap.get(fo.toURL()); if (wr == null) { return null; } AppClientProxy appClient = wr.get(); if (appClient == null) { - ddMap.remove(fo.getURL()); + ddMap.remove(fo.toURL()); } return appClient; } private AppClient getOriginalFromCache(FileObject fo) throws IOException { - WeakReference<AppClient> wr = baseBeanMap.get(fo.getURL()); + WeakReference<AppClient> wr = baseBeanMap.get(fo.toURL()); if (wr == null) { return null; } AppClient appClient = wr.get(); if (appClient == null) { - baseBeanMap.remove(fo.getURL()); - errorMap.remove(fo.getURL()); + baseBeanMap.remove(fo.toURL()); + errorMap.remove(fo.toURL()); } return appClient; } @@ -234,8 +234,8 @@ public final class DDProvider { appClient.setStatus(AppClient.STATE_VALID); } AppClient original = DDUtils.createAppClient(fo, version); - baseBeanMap.put(fo.getURL(), new WeakReference<AppClient>(original)); - errorMap.put(fo.getURL(), appClient.getError()); + baseBeanMap.put(fo.toURL(), new WeakReference<AppClient>(original)); + errorMap.put(fo.toURL(), appClient.getError()); appClient.merge(original, AppClient.MERGE_UPDATE); } catch (SAXException ex) { if (ex instanceof SAXParseException) { @@ -255,10 +255,10 @@ public final class DDProvider { if (original.getClass().equals(orig.getClass())) { orig.merge(original,AppClient.MERGE_UPDATE); } else { - baseBeanMap.put(fo.getURL(), new WeakReference<AppClient>(original)); + baseBeanMap.put(fo.toURL(), new WeakReference<AppClient>(original)); } } catch (SAXException ex) { - baseBeanMap.remove(fo.getURL()); + baseBeanMap.remove(fo.toURL()); } } } diff --git a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/DDProvider.java b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/DDProvider.java index 3675535..aac1bb4 100644 --- a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/DDProvider.java +++ b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/api/web/DDProvider.java @@ -107,12 +107,12 @@ public final class DDProvider { // preparsing error = parse(fo); original = DDUtils.createWebApp(fo, version); - baseBeanMap.put(fo.getURL(), new WeakReference(original)); - errorMap.put(fo.getURL(), error); + baseBeanMap.put(fo.toURL(), new WeakReference(original)); + errorMap.put(fo.toURL(), error); } } else { version = original.getVersion(); - error = (SAXParseException) errorMap.get(fo.getURL()); + error = (SAXParseException) errorMap.get(fo.toURL()); } } if (version != null) { @@ -155,7 +155,7 @@ public final class DDProvider { if (cached != null) { return cached; } - ddMap.put(fo.getURL(), new WeakReference(webApp)); + ddMap.put(fo.toURL(), new WeakReference(webApp)); } return webApp; } @@ -189,26 +189,26 @@ public final class DDProvider { } private WebAppProxy getFromCache(FileObject fo) throws IOException { - WeakReference wr = (WeakReference) ddMap.get(fo.getURL()); + WeakReference wr = (WeakReference) ddMap.get(fo.toURL()); if (wr == null) { return null; } WebAppProxy webApp = (WebAppProxy) wr.get(); if (webApp == null) { - ddMap.remove(fo.getURL()); + ddMap.remove(fo.toURL()); } return webApp; } private WebApp getOriginalFromCache(FileObject fo) throws IOException { - WeakReference wr = (WeakReference) baseBeanMap.get(fo.getURL()); + WeakReference wr = (WeakReference) baseBeanMap.get(fo.toURL()); if (wr == null) { return null; } WebApp webApp = (WebApp) wr.get(); if (webApp == null) { - baseBeanMap.remove(fo.getURL()); - errorMap.remove(fo.getURL()); + baseBeanMap.remove(fo.toURL()); + errorMap.remove(fo.toURL()); } return webApp; } @@ -254,16 +254,12 @@ public final class DDProvider { * @param fo */ private void removeFromCache(FileObject fo){ - try{ - URL foUrl = fo.getURL(); - synchronized (ddMap){ - ddMap.remove(foUrl); - } - baseBeanMap.remove(foUrl); - errorMap.remove(foUrl); - } catch (FileStateInvalidException ex) { - Exceptions.printStackTrace(ex); + URL foUrl = fo.toURL(); + synchronized (ddMap){ + ddMap.remove(foUrl); } + baseBeanMap.remove(foUrl); + errorMap.remove(foUrl); } private class FCA extends FileChangeAdapter { @@ -293,8 +289,8 @@ public final class DDProvider { webApp.setStatus(WebApp.STATE_INVALID_OLD_VERSION); webApp.setError(null); } - baseBeanMap.put(fo.getURL(), new WeakReference(original)); - errorMap.put(fo.getURL(), webApp.getError()); + baseBeanMap.put(fo.toURL(), new WeakReference(original)); + errorMap.put(fo.toURL(), webApp.getError()); webApp.merge(original, WebApp.MERGE_UPDATE); } catch (SAXException ex) { if (ex instanceof SAXParseException) { @@ -312,16 +308,16 @@ public final class DDProvider { version = WebParseUtils.getVersion(fo); WebApp original = DDUtils.createWebApp(fo, version); if (original == null) { - baseBeanMap.remove(fo.getURL()); + baseBeanMap.remove(fo.toURL()); } else { if (original.getClass().equals(orig.getClass())) { orig.merge(original,WebApp.MERGE_UPDATE); } else { - baseBeanMap.put(fo.getURL(), new WeakReference(original)); + baseBeanMap.put(fo.toURL(), new WeakReference(original)); } } } catch (SAXException ex) { - baseBeanMap.remove(fo.getURL()); + baseBeanMap.remove(fo.toURL()); } } } diff --git a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/web/metadata/WebAppMetadataImpl.java b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/web/metadata/WebAppMetadataImpl.java index 891119d..e5b9fce 100644 --- a/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/web/metadata/WebAppMetadataImpl.java +++ b/enterprise/j2ee.dd/src/org/netbeans/modules/j2ee/dd/impl/web/metadata/WebAppMetadataImpl.java @@ -281,13 +281,8 @@ public class WebAppMetadataImpl implements WebAppMetadata { private FragmentRec findFragmentRec(FileObject fo) { for (FragmentRec fr : myRootToFragment.values()) { - try { - if (fr.source.getURL().equals(fo.getURL())) - return fr; - } - catch (FileStateInvalidException ex) { - ex.printStackTrace(); - } + if (fr.source.toURL().equals(fo.toURL())) + return fr; } return null; } diff --git a/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/query/J2eePlatformJavadocForBinaryQuery.java b/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/query/J2eePlatformJavadocForBinaryQuery.java index 14dd1d4..bbb9c02 100644 --- a/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/query/J2eePlatformJavadocForBinaryQuery.java +++ b/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/query/J2eePlatformJavadocForBinaryQuery.java @@ -176,12 +176,8 @@ public class J2eePlatformJavadocForBinaryQuery implements JavadocForBinaryQueryI if (normalizedURL == null) { FileObject fo = URLMapper.findFileObject(url); if (fo != null) { - try { - normalizedURL = fo.getURL(); - this.normalizedURLCache.put (url, normalizedURL); - } catch (FileStateInvalidException e) { - Exceptions.printStackTrace(e); - } + normalizedURL = fo.toURL(); + this.normalizedURLCache.put (url, normalizedURL); } } return normalizedURL; @@ -215,12 +211,7 @@ public class J2eePlatformJavadocForBinaryQuery implements JavadocForBinaryQueryI return rootURL; } FileObject result = findIndexFolder (root,1); - try { - return result == null ? rootURL : result.getURL(); - } catch (FileStateInvalidException e) { - Exceptions.printStackTrace(e); - return rootURL; - } + return result == null ? rootURL : result.toURL(); } private static FileObject findIndexFolder (FileObject fo, int depth) { diff --git a/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/sharability/JavadocForBinaryQueryImpl.java b/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/sharability/JavadocForBinaryQueryImpl.java index f8367fa..826b96d 100644 --- a/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/sharability/JavadocForBinaryQueryImpl.java +++ b/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/sharability/JavadocForBinaryQueryImpl.java @@ -140,12 +140,8 @@ public class JavadocForBinaryQueryImpl implements JavadocForBinaryQueryImplement if (normalizedURL == null) { FileObject fo = URLMapper.findFileObject(url); if (fo != null) { - try { - normalizedURL = fo.getURL(); - this.normalizedURLCache.put (url, normalizedURL); - } catch (FileStateInvalidException e) { - ErrorManager.getDefault().notify(e); - } + normalizedURL = fo.toURL(); + this.normalizedURLCache.put (url, normalizedURL); } } return normalizedURL; @@ -197,12 +193,7 @@ public class JavadocForBinaryQueryImpl implements JavadocForBinaryQueryImplement return rootURL; } FileObject result = findIndexFolder (root,1); - try { - return result == null ? rootURL : result.getURL(); - } catch (FileStateInvalidException e) { - ErrorManager.getDefault().notify(e); - return rootURL; - } + return ((result == null) ? rootURL : result.toURL()); } private static FileObject findIndexFolder (FileObject fo, int depth) { diff --git a/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/sharability/SourceForBinaryQueryImpl.java b/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/sharability/SourceForBinaryQueryImpl.java index 57c6404..588532f 100644 --- a/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/sharability/SourceForBinaryQueryImpl.java +++ b/enterprise/j2eeserver/src/org/netbeans/modules/j2ee/deployment/impl/sharability/SourceForBinaryQueryImpl.java @@ -104,12 +104,8 @@ public class SourceForBinaryQueryImpl implements SourceForBinaryQueryImplementat if (normalizedURL == null) { FileObject fo = URLMapper.findFileObject(url); if (fo != null) { - try { - normalizedURL = fo.getURL(); - this.normalizedURLCache.put (url, normalizedURL); - } catch (FileStateInvalidException e) { - ErrorManager.getDefault().notify(e); - } + normalizedURL = fo.toURL(); + this.normalizedURLCache.put (url, normalizedURL); } } return normalizedURL; diff --git a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java index b8b53c4..dfc5e1a 100644 --- a/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java +++ b/enterprise/websvc.clientapi/src/org/netbeans/modules/websvc/spi/jaxws/client/ProjectJAXWSClientSupport.java @@ -245,49 +245,44 @@ public abstract class ProjectJAXWSClientSupport implements JAXWSClientSupportImp // generate wsdl model immediately final String clientName2 = finalClientName; - try { - final WsdlModeler modeler = WsdlModelerFactory.getDefault().getWsdlModeler(localWsdl.getURL()); - if (modeler!=null) { - modeler.setPackageName(packageName); - if (catalog != null) { - modeler.setCatalog(catalog.getURL()); - } - modeler.generateWsdlModel(new WsdlModelListener() { - public void modelCreated(WsdlModel model) { - if (model==null) { - RequestProcessor.getDefault().post(new Runnable() { - public void run() { - DialogDisplayer.getDefault().notify(new WsImportFailedMessage(modeler.getCreationException())); - } - }); - - } else { - Client client = jaxWsModel.findClientByName(clientName2); - String packName = client.getPackageName(); - // this shuldn't normally happen - // this applies only for case when package name cannot be resolved for namespace - if(packName == null) { - if (model.getServices().size() > 0) { - WsdlService service = model.getServices().get(0); - String javaName = service.getJavaName(); - int index = javaName.lastIndexOf("."); - if (index != -1){ - packName = javaName.substring(0,index ); - } else { - packName = javaName; - } - client.setPackageName(packName); - writeJaxWsModel(jaxWsModel); - } + final WsdlModeler modeler = WsdlModelerFactory.getDefault().getWsdlModeler(localWsdl.toURL()); + + if (modeler!=null) { + modeler.setPackageName(packageName); + if (catalog != null) { + modeler.setCatalog(catalog.toURL()); + } + modeler.generateWsdlModel(new WsdlModelListener() { + public void modelCreated(WsdlModel model) { + if (model==null) { + RequestProcessor.getDefault().post(new Runnable() { + public void run() { + DialogDisplayer.getDefault().notify(new WsImportFailedMessage(modeler.getCreationException())); + } + }); + } else { + Client client = jaxWsModel.findClientByName(clientName2); + String packName = client.getPackageName(); + // this shuldn't normally happen + // this applies only for case when package name cannot be resolved for namespace + if (packName == null) { + if (model.getServices().size() > 0) { + WsdlService service = model.getServices().get(0); + String javaName = service.getJavaName(); + int index = javaName.lastIndexOf("."); + if (index != -1){ + packName = javaName.substring(0,index ); + } else { + packName = javaName; + } + client.setPackageName(packName); + writeJaxWsModel(jaxWsModel); } - - runWsimport(clientName2); } + runWsimport(clientName2); } - }); - } - } catch (IOException ex) { - ErrorManager.getDefault().log(ex.getLocalizedMessage()); + } + }); } } return finalClientName; @@ -405,13 +400,8 @@ public abstract class ProjectJAXWSClientSupport implements JAXWSClientSupportImp } public URL getCatalog() { - try { - FileObject catalog = getCatalogFileObject(); - return catalog==null?null:catalog.getURL(); - } catch (FileStateInvalidException ex) { - return null; - } - + FileObject catalog = getCatalogFileObject(); + return ((catalog==null) ? null : catalog.toURL()); } protected abstract void addJaxWs20Library() throws Exception; diff --git a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsChildren.java b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsChildren.java index 97e9ce0..383050e 100644 --- a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsChildren.java +++ b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsChildren.java @@ -487,11 +487,7 @@ public class JaxWsChildren extends Children.Keys<Object>/* implements MDRChangeL List<URL> list = new ArrayList<URL>(); for (int i=0;i<bindingFiles.length;i++) { FileObject fo = bindingsFolder.getFileObject(bindingFiles[i]); - try { - list.add(fo.getURL()); - } catch (FileStateInvalidException ex) { - // if there is problem no bindings will be added - } + list.add(fo.toURL()); } URL[] bindings = new URL[list.size()]; list.<URL>toArray(bindings); @@ -552,7 +548,7 @@ public class JaxWsChildren extends Children.Keys<Object>/* implements MDRChangeL if (localWsdl!=null) { WsdlWrapperHandler handler = null; try { - handler = WsdlWrapperGenerator.parse(localWsdl.getURL().toExternalForm()); + handler = WsdlWrapperGenerator.parse(localWsdl.toURL().toExternalForm()); } catch (ParserConfigurationException ex) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,ex); } catch (SAXException ex) { @@ -561,9 +557,9 @@ public class JaxWsChildren extends Children.Keys<Object>/* implements MDRChangeL ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,ex); } if (handler != null && !handler.isServiceElement()) { - StreamSource source = new StreamSource(localWsdl.getURL().toExternalForm()); + StreamSource source = new StreamSource(localWsdl.toURL().toExternalForm()); try { - File wrapperWsdlFile = new File(FileUtil.toFile(localWsdl.getParent()), WsdlWrapperGenerator.getWrapperName(localWsdl.getURL())); //NOI18N + File wrapperWsdlFile = new File(FileUtil.toFile(localWsdl.getParent()), WsdlWrapperGenerator.getWrapperName(localWsdl.toURL())); //NOI18N if(!wrapperWsdlFile.exists()) { try { diff --git a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsClientNode.java b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsClientNode.java index 73d0d74..9acce90 100644 --- a/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsClientNode.java +++ b/enterprise/websvc.core/src/org/netbeans/modules/websvc/core/jaxws/nodes/JaxWsClientNode.java @@ -434,22 +434,18 @@ public class JaxWsClientNode extends AbstractNode implements OpenCookie, JaxWsRe WsdlModeler getWsdlModeler() { if (getLocalWsdl()!=null) { - try { - WsdlModeler modeler = WsdlModelerFactory.getDefault().getWsdlModeler(wsdlFileObject.getURL()); - if (modeler!=null) { - String packageName = client.getPackageName(); - if (packageName!=null && client.isPackageNameForceReplace()) { - // set the package name for the modeler - modeler.setPackageName(packageName); - } else { - modeler.setPackageName(null); - } - modeler.setCatalog(getJAXWSClientSupport().getCatalog()); - setBindings(modeler); - return modeler; + WsdlModeler modeler = WsdlModelerFactory.getDefault().getWsdlModeler(wsdlFileObject.toURL()); + if (modeler!=null) { + String packageName = client.getPackageName(); + if (packageName!=null && client.isPackageNameForceReplace()) { + // set the package name for the modeler + modeler.setPackageName(packageName); + } else { + modeler.setPackageName(null); } - } catch (FileStateInvalidException ex) { - ErrorManager.getDefault().log(ex.getLocalizedMessage()); + modeler.setCatalog(getJAXWSClientSupport().getCatalog()); + setBindings(modeler); + return modeler; } } else { ErrorManager.getDefault().log(ErrorManager.ERROR, NbBundle.getMessage(JaxWsNode.class,"ERR_missingLocalWsdl")); @@ -490,11 +486,7 @@ public class JaxWsClientNode extends AbstractNode implements OpenCookie, JaxWsRe for (int i=0;i<bindingFiles.length;i++) { FileObject fo = bindingsFolder.getFileObject(bindingFiles[i]); if (fo != null) { - try { - list.add(fo.getURL()); - } catch (FileStateInvalidException ex) { - // if there is problem no bindings will be added - } + list.add(fo.toURL()); } } URL[] bindings = new URL[list.size()]; diff --git a/enterprise/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java b/enterprise/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java index e37e37e..ef80e44 100644 --- a/enterprise/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java +++ b/enterprise/websvc.jaxwsapi/src/org/netbeans/modules/websvc/jaxws/spi/ProjectJAXWSSupport.java @@ -179,7 +179,7 @@ public abstract class ProjectJAXWSSupport implements JAXWSSupportImpl { WsdlWrapperHandler handler = null; try { - handler = WsdlWrapperGenerator.parse(localWsdl.getURL().toExternalForm()); + handler = WsdlWrapperGenerator.parse(localWsdl.toURL().toExternalForm()); } catch (ParserConfigurationException ex) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,ex); } catch (SAXException ex) { @@ -188,9 +188,9 @@ public abstract class ProjectJAXWSSupport implements JAXWSSupportImpl { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL,ex); } if (!handler.isServiceElement()) { - StreamSource source = new StreamSource(localWsdl.getURL().toExternalForm()); + StreamSource source = new StreamSource(localWsdl.toURL().toExternalForm()); try { - File wrapperWsdlFile = new File(FileUtil.toFile(localWsdl.getParent()), WsdlWrapperGenerator.getWrapperName(localWsdl.getURL())); //NOI18N + File wrapperWsdlFile = new File(FileUtil.toFile(localWsdl.getParent()), WsdlWrapperGenerator.getWrapperName(localWsdl.toURL())); //NOI18N if(!wrapperWsdlFile.exists()) { try { diff --git a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/support/Utils.java b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/support/Utils.java index 9af24bd..5888c1c 100644 --- a/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/support/Utils.java +++ b/enterprise/websvc.rest/src/org/netbeans/modules/websvc/rest/support/Utils.java @@ -353,7 +353,7 @@ public class Utils { try { rs.deploy(); if (testFO != null) { - URL url = testFO[0].getURL(); + URL url = testFO[0].toURL(); if (url != null) { HtmlBrowser.URLDisplayer .getDefault().showURL(url); @@ -372,7 +372,7 @@ public class Utils { rs.getLocalTargetTestRest(), rs.getBaseURL()); rs.deploy(); if (testFO != null) { - URL url = testFO.getURL(); + URL url = testFO.toURL(); if (url != null) { HtmlBrowser.URLDisplayer.getDefault().showURL( url); @@ -410,7 +410,7 @@ public class Utils { File testdir = rs.getLocalTargetTestRest(); FileObject testFO = MiscUtilities.generateTestClient(testdir); p.setProperty(RestSupport.PROP_RESTBEANS_TEST_URL, - testFO.getURL().toString()); + testFO.toURL().toString()); p.setProperty(RestSupport.PROP_RESTBEANS_TEST_FILE, FileUtil.toFile(testFO).getAbsolutePath()); } catch (IOException ex) { diff --git a/extide/o.apache.tools.ant.module/src/org/apache/tools/ant/module/xml/AntProjectSupport.java b/extide/o.apache.tools.ant.module/src/org/apache/tools/ant/module/xml/AntProjectSupport.java index b078b6f..26eec82 100644 --- a/extide/o.apache.tools.ant.module/src/org/apache/tools/ant/module/xml/AntProjectSupport.java +++ b/extide/o.apache.tools.ant.module/src/org/apache/tools/ant/module/xml/AntProjectSupport.java @@ -203,14 +203,10 @@ public class AntProjectSupport implements AntProjectCookie.ParseStatus, Document DataObject d = DataObject.find(fo); if (!d.isModified()) { // #58194: no need to parse the live document. - try { - InputSource s = new InputSource(); - s.setSystemId(fo.getURL().toExternalForm()); - s.setByteStream(fo.getInputStream()); - return s; - } catch (FileStateInvalidException e) { - assert false : e; - } + InputSource s = new InputSource(); + s.setSystemId(fo.toURL().toExternalForm()); + s.setByteStream(fo.getInputStream()); + return s; } } final String[] contents = new String[1]; @@ -225,11 +221,8 @@ public class AntProjectSupport implements AntProjectCookie.ParseStatus, Document }); InputSource in = new InputSource(new StringReader(contents[0])); if (fo != null) { // #10348 - try { - in.setSystemId(fo.getURL().toExternalForm()); - } catch (FileStateInvalidException e) { - assert false : e; - } + in.setSystemId(fo.toURL().toExternalForm()); + // [PENDING] Ant's ProjectHelper has an elaborate set of work- // arounds for inconsistent parser behavior, e.g. file:foo.xml // works in Ant but not with Xerces parser. You must use just foo.xml diff --git a/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndexer.java b/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndexer.java index 2a2922f..772c672 100644 --- a/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndexer.java +++ b/groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndexer.java @@ -238,14 +238,10 @@ public class GroovyIndexer extends EmbeddingIndexer { public void analyze() { this.doc = LexUtilities.getDocument(result, true); - try { - url = file.getURL().toExternalForm(); + url = file.toURL().toExternalForm(); - // Make relative URLs for urls in the libraries - url = GroovyIndex.getPreindexUrl(url); - } catch (IOException ioe) { - Exceptions.printStackTrace(ioe); - } + // Make relative URLs for urls in the libraries + url = GroovyIndex.getPreindexUrl(url); AnalysisResult ar = result.getStructure(); List<? extends ASTElement> children = ar.getElements(); diff --git a/ide/refactoring.api/src/org/netbeans/modules/refactoring/plugins/PackageDeleteRefactoringPlugin.java b/ide/refactoring.api/src/org/netbeans/modules/refactoring/plugins/PackageDeleteRefactoringPlugin.java index 62f2bef..3592a48 100644 --- a/ide/refactoring.api/src/org/netbeans/modules/refactoring/plugins/PackageDeleteRefactoringPlugin.java +++ b/ide/refactoring.api/src/org/netbeans/modules/refactoring/plugins/PackageDeleteRefactoringPlugin.java @@ -190,12 +190,7 @@ public class PackageDeleteRefactoringPlugin implements RefactoringPlugin{ @Override public FileObject getParentFile() { - try { - return URLMapper.findFileObject(dirFileObject.getURL()); - } catch (FileStateInvalidException ex) { - ErrorManager.getDefault().notify(ex); - throw new IllegalStateException(ex); - } + return URLMapper.findFileObject(dirFileObject.toURL()); } @Override @@ -216,11 +211,7 @@ public class PackageDeleteRefactoringPlugin implements RefactoringPlugin{ private PackageDeleteElem(NonRecursiveFolder folder) { this.folder = folder; dir = FileUtil.toFile(folder.getFolder()); - try { - res = folder.getFolder().getURL(); - } catch (FileStateInvalidException fileStateInvalidException) { - throw new IllegalStateException(fileStateInvalidException); - } + res = folder.getFolder().toURL(); srcGroup = getSourceGroup(folder.getFolder(), JAVA_EXTENSION); if (srcGroup == null) { srcGroup = getSourceGroup(folder.getFolder(), Sources.TYPE_GENERIC); diff --git a/ide/tasklist.ui/src/org/netbeans/modules/tasklist/impl/TaskManagerImpl.java b/ide/tasklist.ui/src/org/netbeans/modules/tasklist/impl/TaskManagerImpl.java index feaf085..11f7cd8 100644 --- a/ide/tasklist.ui/src/org/netbeans/modules/tasklist/impl/TaskManagerImpl.java +++ b/ide/tasklist.ui/src/org/netbeans/modules/tasklist/impl/TaskManagerImpl.java @@ -278,10 +278,10 @@ public class TaskManagerImpl extends TaskManager { ArrayList<URL> toRefresh = new ArrayList<URL>(1); for( FileObject fo : resources ) { toRefresh.clear(); - toRefresh.add(fo.getURL()); + toRefresh.add(fo.toURL()); Collection<FileObject> roots = QuerySupport.findRoots(fo, null, null, null); for( FileObject root : roots ) { - IndexingManager.getDefault().refreshIndex(root.getURL(), toRefresh); + IndexingManager.getDefault().refreshIndex(root.toURL(), toRefresh); } } } catch( IOException ioE ) { @@ -447,22 +447,21 @@ public class TaskManagerImpl extends TaskManager { } private void cacheCurrentEditorFile() { - try { - Iterator<FileObject> it = scope.iterator(); - FileObject fo; - if (it.hasNext()) { - fo = it.next(); - } else { - return; - } - ArrayList<URL> toRefresh = new ArrayList<URL>(1); - toRefresh.add(fo.getURL()); - Collection<FileObject> roots = QuerySupport.findRoots(fo, null, null, null); - for (FileObject root : roots) { - IndexingManager.getDefault().refreshIndex(root.getURL(), toRefresh); - } - } catch (FileStateInvalidException ex) { - getLogger().log(Level.INFO, "Error while refreshing files.", ex); + Iterator<FileObject> it = scope.iterator(); + FileObject fo; + + if (it.hasNext()) { + fo = it.next(); + } else { + return; + } + + ArrayList<URL> toRefresh = new ArrayList<URL>(1); + toRefresh.add(fo.toURL()); + + Collection<FileObject> roots = QuerySupport.findRoots(fo, null, null, null); + for (FileObject root : roots) { + IndexingManager.getDefault().refreshIndex(root.toURL(), toRefresh); } } } diff --git a/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/DBschemaDataObject.java b/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/DBschemaDataObject.java index 466a221..577e0e0 100644 --- a/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/DBschemaDataObject.java +++ b/java/dbschema/src/org/netbeans/modules/dbschema/jdbcimpl/DBschemaDataObject.java @@ -67,7 +67,7 @@ public class DBschemaDataObject extends MultiDataObject { if (schemaElement != null) { SchemaElement.removeFromCache(schemaElement.getName().getFullName()); try { - SchemaElement.removeFromCache(schemaElement.getName().getFullName() + "#" + getPrimaryFile().getURL().toString()); //NOI18N + SchemaElement.removeFromCache(schemaElement.getName().getFullName() + "#" + getPrimaryFile().toURL().toString()); //NOI18N } catch (Exception exc) { if (Boolean.getBoolean("netbeans.debug.exceptions")) //NOI18N exc.printStackTrace(); @@ -78,7 +78,7 @@ public class DBschemaDataObject extends MultiDataObject { } else { SchemaElement.removeFromCache(schemaElement.getName().getFullName()); try { - SchemaElement.removeFromCache(schemaElement.getName().getFullName() + "#" + getPrimaryFile().getURL().toString()); //NOI18N + SchemaElement.removeFromCache(schemaElement.getName().getFullName() + "#" + getPrimaryFile().toURL().toString()); //NOI18N } catch (Exception exc) { if (Boolean.getBoolean("netbeans.debug.exceptions")) //NOI18N exc.printStackTrace(); @@ -93,7 +93,7 @@ public class DBschemaDataObject extends MultiDataObject { else { SchemaElement.removeFromCache(schemaElement.getName().getFullName()); try { - SchemaElement.removeFromCache(schemaElement.getName().getFullName() + "#" + getPrimaryFile().getURL().toString()); //NOI18N + SchemaElement.removeFromCache(schemaElement.getName().getFullName() + "#" + getPrimaryFile().toURL().toString()); //NOI18N } catch (Exception exc) { if (Boolean.getBoolean("netbeans.debug.exceptions")) //NOI18N exc.printStackTrace(); diff --git a/java/form/src/org/netbeans/modules/form/editors/CustomIconEditor.java b/java/form/src/org/netbeans/modules/form/editors/CustomIconEditor.java index 963b044..7a0743b 100644 --- a/java/form/src/org/netbeans/modules/form/editors/CustomIconEditor.java +++ b/java/form/src/org/netbeans/modules/form/editors/CustomIconEditor.java @@ -366,14 +366,14 @@ public class CustomIconEditor extends javax.swing.JPanel { name = FileUtil.getRelativePath(packageRoot, selectedCPFile); try { try { - Image image = ImageIO.read(selectedCPFile.getURL()); + Image image = ImageIO.read(selectedCPFile.toURL()); if (image != null) { icon = new ImageIcon(image); type = IconEditor.TYPE_CLASSPATH; } // no NbImageIcon will be created for invalid file } catch (IllegalArgumentException iaex) { // Issue 178906 Logger.getLogger(CustomIconEditor.class.getName()).log(Level.INFO, null, iaex); - icon = new ImageIcon(selectedCPFile.getURL()); + icon = new ImageIcon(selectedCPFile.toURL()); type = IconEditor.TYPE_CLASSPATH; } } catch (IOException ex) { // should not happen @@ -519,11 +519,11 @@ public class CustomIconEditor extends javax.swing.JPanel { this.file = file; try { try { - Image image = (file.getSize() < SIZE_LIMIT) ? ImageIO.read(file.getURL()) : null; + Image image = (file.getSize() < SIZE_LIMIT) ? ImageIO.read(file.toURL()) : null; icon = (image != null) ? new ImageIcon(image) : null; } catch (IllegalArgumentException iaex) { // Issue 178906 Logger.getLogger(CustomIconEditor.class.getName()).log(Level.INFO, null, iaex); - icon = new ImageIcon(file.getURL()); + icon = new ImageIcon(file.toURL()); } } catch (IOException ex) { Logger.getLogger(CustomIconEditor.class.getName()).log(Level.WARNING, null, ex); diff --git a/java/i18n.form/src/org/netbeans/modules/i18n/form/I18nServiceImpl.java b/java/i18n.form/src/org/netbeans/modules/i18n/form/I18nServiceImpl.java index 008acfc..2f7c108 100644 --- a/java/i18n.form/src/org/netbeans/modules/i18n/form/I18nServiceImpl.java +++ b/java/i18n.form/src/org/netbeans/modules/i18n/form/I18nServiceImpl.java @@ -545,9 +545,9 @@ public class I18nServiceImpl implements I18nService { dobj = getPropertiesDataObject(srcFile, bundleName); if (dobj != null) { List<URL> list = new ArrayList<URL>(); - list.add(dobj.getPrimaryEntry().getFile().getURL()); + list.add(dobj.getPrimaryEntry().getFile().toURL()); for (MultiDataObject.Entry e : dobj.secondaryEntries()) { - list.add(e.getFile().getURL()); + list.add(e.getFile().toURL()); } return list; } else { diff --git a/java/java.editor/src/org/netbeans/modules/java/editor/overridden/ComputeOverriders.java b/java/java.editor/src/org/netbeans/modules/java/editor/overridden/ComputeOverriders.java index 9818632..87fccdc 100644 --- a/java/java.editor/src/org/netbeans/modules/java/editor/overridden/ComputeOverriders.java +++ b/java/java.editor/src/org/netbeans/modules/java/editor/overridden/ComputeOverriders.java @@ -215,16 +215,12 @@ public class ComputeOverriders { FileObject currentFileSourceRoot = findSourceRoot(file); if (currentFileSourceRoot != null) { - try { - URL rootURL = currentFileSourceRoot.getURL(); - Map<ElementHandle<TypeElement>, Set<ElementHandle<TypeElement>>> overridingHandles = users.remove(rootURL); - - if (overridingHandles != null) { - computeOverridingForRoot(rootURL, overridingHandles, methods, overriding); - } - } catch (FileStateInvalidException ex) { - LOG.log(Level.INFO, null, ex); - } + URL rootURL = currentFileSourceRoot.toURL(); + Map<ElementHandle<TypeElement>, Set<ElementHandle<TypeElement>>> overridingHandles = users.remove(rootURL); + + if (overridingHandles != null) { + computeOverridingForRoot(rootURL, overridingHandles, methods, overriding); + } } for (Map.Entry<URL, Map<ElementHandle<TypeElement>, Set<ElementHandle<TypeElement>>>> data : users.entrySet()) { @@ -347,14 +343,7 @@ public class ComputeOverriders { return null; } - URL thisSourceRootURL; - - try { - thisSourceRootURL = thisSourceRoot.getURL(); - } catch (FileStateInvalidException ex) { - Exceptions.printStackTrace(ex); - return null; - } + URL thisSourceRootURL = thisSourceRoot.toURL(); Map<URL, List<URL>> rootPeers = getRootPeers(); List<URL> sourceRoots = reverseSourceRootsInOrder(info, thisSourceRootURL, thisSourceRoot, sourceDeps, binaryDeps, rootPeers, interactive); diff --git a/java/java.freeform/src/org/netbeans/modules/java/freeform/JavaActions.java b/java/java.freeform/src/org/netbeans/modules/java/freeform/JavaActions.java index fb8e29d..e89cae2 100644 --- a/java/java.freeform/src/org/netbeans/modules/java/freeform/JavaActions.java +++ b/java/java.freeform/src/org/netbeans/modules/java/freeform/JavaActions.java @@ -1076,7 +1076,7 @@ final class JavaActions implements ActionProvider { * @return the line number (0-based), or -1 if not found */ static final int findLine(FileObject file, final String match, final String elementLocalName, final String elementAttributeName) throws IOException, SAXException, ParserConfigurationException { - InputSource in = new InputSource(file.getURL().toString()); + InputSource in = new InputSource(file.toURL().toString()); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); SAXParser parser = factory.newSAXParser(); @@ -1172,7 +1172,7 @@ final class JavaActions implements ActionProvider { FileObject nbjdkFO = helper.getProjectDirectory().getFileObject(JdkConfiguration.NBJDK_XML); if (nbjdkFO != null) { try { - Document nbjdk = XMLUtil.parse(new InputSource(nbjdkFO.getURL().toString()), false, false, null, null); + Document nbjdk = XMLUtil.parse(new InputSource(nbjdkFO.toURL().toString()), false, false, null, null); NodeList nl = nbjdk.getElementsByTagName("target"); // NOI18N for (int i = 0; i < nl.getLength(); i++) { if (((Element) nl.item(i)).getAttribute("name").equals(scriptPlusTargetNames.get(1))) { // NOI18N diff --git a/java/java.freeform/src/org/netbeans/modules/java/freeform/TestQuery.java b/java/java.freeform/src/org/netbeans/modules/java/freeform/TestQuery.java index bad1dd7..2673ed4 100644 --- a/java/java.freeform/src/org/netbeans/modules/java/freeform/TestQuery.java +++ b/java/java.freeform/src/org/netbeans/modules/java/freeform/TestQuery.java @@ -58,12 +58,7 @@ final class TestQuery implements MultipleRootsUnitTestForSourceQueryImplementati public URL[] findUnitTests(FileObject source) { URL[][] data = findSourcesAndTests(); - URL sourceURL; - try { - sourceURL = source.getURL(); - } catch (FileStateInvalidException e) { - return null; - } + URL sourceURL = source.toURL(); if (Arrays.asList(data[0]).contains(sourceURL)) { return data[1]; } else { @@ -73,12 +68,7 @@ final class TestQuery implements MultipleRootsUnitTestForSourceQueryImplementati public URL[] findSources(FileObject unitTest) { URL[][] data = findSourcesAndTests(); - URL testURL; - try { - testURL = unitTest.getURL(); - } catch (FileStateInvalidException e) { - return null; - } + URL testURL = unitTest.toURL(); if (Arrays.asList(data[1]).contains(testURL)) { return data[0]; } else { diff --git a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/queries/SourceJavadocAttacherUtil.java b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/queries/SourceJavadocAttacherUtil.java index a3512ed..2b3d632 100644 --- a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/queries/SourceJavadocAttacherUtil.java +++ b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/queries/SourceJavadocAttacherUtil.java @@ -206,12 +206,12 @@ public final class SourceJavadocAttacherUtil { final List<URI> result = new ArrayList<URI>(); if (forSources) { for (FileObject root : JavadocAndSourceRootDetection.findSourceRoots(fo,null)) { - result.add(root.getURL().toURI()); + result.add(root.toURL().toURI()); } } else { FileObject root = JavadocAndSourceRootDetection.findJavadocRoot(fo); if (root != null) { - result.add(root.getURL().toURI()); + result.add(root.toURL().toURI()); } } return result; diff --git a/java/java.source.base/src/org/netbeans/api/java/source/TreePathHandle.java b/java/java.source.base/src/org/netbeans/api/java/source/TreePathHandle.java index cb012c8..5bd8a80 100644 --- a/java/java.source.base/src/org/netbeans/api/java/source/TreePathHandle.java +++ b/java/java.source.base/src/org/netbeans/api/java/source/TreePathHandle.java @@ -434,22 +434,9 @@ public final class TreePathHandle { debug.append("TreePathHandle [" + FileUtil.getFileDisplayName(mine) + "] was not created from " + FileUtil.getFileDisplayName(remote)); debug.append("\n"); - - try { - debug.append("mine: id=").append(mine).append(", url=") - .append(mine.getURL().toExternalForm()); - } catch (FileStateInvalidException ex) { - debug.append(ex.getMessage()); - } - + debug.append("mine: id=").append(mine).append(", url=").append(mine.toURL().toExternalForm()); debug.append("\n"); - - try { - debug.append("remote: id=").append(remote).append(", url=") - .append(remote.getURL().toExternalForm()); - } catch (FileStateInvalidException ex) { - debug.append(ex.getMessage()); - } + debug.append("remote: id=").append(remote).append(", url=").append(remote.toURL().toExternalForm()); throw new IllegalArgumentException(debug.toString()); } @@ -680,18 +667,14 @@ public final class TreePathHandle { fo = fo.getParent(); } if (fo != null) { - try { - URL url = fo.getURL(); - URL sourceRoot = null;//XXX: Index.getSourceRootForClassFolder(url); - if (sourceRoot != null) { - FileObject root = URLMapper.findFileObject(sourceRoot); - String resourceName = FileUtil.getRelativePath(fo, URLMapper.findFileObject(source)); - file = root.getFileObject(resourceName.replace('.'+FileObjects.SIG, '.'+FileObjects.CLASS)); //NOI18N - } else { - Logger.getLogger(TreePathHandle.class.getName()).fine("Index.getSourceRootForClassFolder(url) returned null for url=" + url); //NOI18N - } - } catch (FileStateInvalidException ex) { - Exceptions.printStackTrace(ex); + URL url = fo.toURL(); + URL sourceRoot = null;//XXX: Index.getSourceRootForClassFolder(url); + if (sourceRoot != null) { + FileObject root = URLMapper.findFileObject(sourceRoot); + String resourceName = FileUtil.getRelativePath(fo, URLMapper.findFileObject(source)); + file = root.getFileObject(resourceName.replace('.'+FileObjects.SIG, '.'+FileObjects.CLASS)); //NOI18N + } else { + Logger.getLogger(TreePathHandle.class.getName()).fine("Index.getSourceRootForClassFolder(url) returned null for url=" + url); //NOI18N } } } diff --git a/java/java.source/src/org/netbeans/modules/java/classfile/CodeGenerator.java b/java/java.source/src/org/netbeans/modules/java/classfile/CodeGenerator.java index 77dde2b..e1bf184 100644 --- a/java/java.source/src/org/netbeans/modules/java/classfile/CodeGenerator.java +++ b/java/java.source/src/org/netbeans/modules/java/classfile/CodeGenerator.java @@ -196,9 +196,9 @@ public class CodeGenerator { toOpen = te; } - classfileRoot[0] = root.getURL(); + classfileRoot[0] = root.toURL(); binaryName[0] = binName; - final File sourceRoot = new File (JavaIndex.getIndex(root.getURL()),"gensrc"); //NOI18N + final File sourceRoot = new File (JavaIndex.getIndex(root.toURL()),"gensrc"); //NOI18N final FileObject sourceRootFO = FileUtil.createFolder(sourceRoot); if (sourceRootFO == null) { LOG.info("Cannot create folder: " + sourceRoot); //NOI18N diff --git a/java/java.source/src/org/netbeans/modules/java/source/tasklist/IncorrectErrorBadges.java b/java/java.source/src/org/netbeans/modules/java/source/tasklist/IncorrectErrorBadges.java index f3829cf..fc919c8 100644 --- a/java/java.source/src/org/netbeans/modules/java/source/tasklist/IncorrectErrorBadges.java +++ b/java/java.source/src/org/netbeans/modules/java/source/tasklist/IncorrectErrorBadges.java @@ -138,15 +138,15 @@ public class IncorrectErrorBadges implements CancellableTask<CompilationInfo> { return; } - if (!PathRegistry.getDefault().isKnownRoot(root.getURL())) { + if (!PathRegistry.getDefault().isKnownRoot(root.toURL())) { LOG.log(Level.WARNING, "Not PathRegistry controlled root: " + root); return; } LOG.log(Level.WARNING, "Going to recompute root={0}, files in error={1}.", - new Object[] {FileUtil.getFileDisplayName(root), ErrorsCache.getAllFilesInError(root.getURL())}); + new Object[] {FileUtil.getFileDisplayName(root), ErrorsCache.getAllFilesInError(root.toURL())}); - IndexingManager.getDefault().refreshIndex(root.getURL(), null, true, true); + IndexingManager.getDefault().refreshIndex(root.toURL(), null, true, true); } catch (IOException ex) { LOG.log(Level.FINE, null, ex); } diff --git a/java/websvc.saas.codegen.java/src/org/netbeans/modules/websvc/saas/codegen/java/support/LibrariesHelper.java b/java/websvc.saas.codegen.java/src/org/netbeans/modules/websvc/saas/codegen/java/support/LibrariesHelper.java index 0e37b3c..83e64e7 100644 --- a/java/websvc.saas.codegen.java/src/org/netbeans/modules/websvc/saas/codegen/java/support/LibrariesHelper.java +++ b/java/websvc.saas.codegen.java/src/org/netbeans/modules/websvc/saas/codegen/java/support/LibrariesHelper.java @@ -115,7 +115,7 @@ public class LibrariesHelper { if (classPath.contains(destJar)) { continue; } - archiveJars.add(new URL(destJar.getURL().toExternalForm() + "/")); // NOI18N + archiveJars.add(new URL(destJar.toURL().toExternalForm() + "/")); // NOI18N } catch (IOException ex) { Exceptions.printStackTrace(ex); diff --git a/platform/openide.loaders/src/org/netbeans/modules/openide/loaders/FileEntityResolver.java b/platform/openide.loaders/src/org/netbeans/modules/openide/loaders/FileEntityResolver.java index 7391001..2c94d00 100644 --- a/platform/openide.loaders/src/org/netbeans/modules/openide/loaders/FileEntityResolver.java +++ b/platform/openide.loaders/src/org/netbeans/modules/openide/loaders/FileEntityResolver.java @@ -19,8 +19,9 @@ package org.netbeans.modules.openide.loaders; -import java.io.IOException; import java.beans.PropertyChangeListener; +import java.io.IOException; +import java.io.FileNotFoundException; import java.io.BufferedInputStream; import java.io.InputStream; import java.lang.ref.Reference; @@ -79,7 +80,7 @@ public final class FileEntityResolver extends EntityCatalog implements Environme /** Tries to find the entity on system file system. */ - public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException { + public InputSource resolveEntity(String publicID, String systemID) throws FileNotFoundException, SAXException { if (publicID == null) { return null; } @@ -94,19 +95,14 @@ public final class FileEntityResolver extends EntityCatalog implements Environme FileObject fo = FileUtil.getConfigFile (sb.toString ()); if (fo != null) { - // fill in InputSource instance - - InputSource in = new InputSource (fo.getInputStream ()); - try { - Object myPublicID = fo.getAttribute("hint.originalPublicID"); //NOI18N - if (myPublicID instanceof String) { - in.setPublicId((String)myPublicID); - } - URL url = fo.getURL(); - in.setSystemId(url.toString()); // we get nasty nbfs: instead nbres: but it is enough - } catch (IOException ex) { - // do no care just no system id - } + // fill in InputSource instance, could possibly throw an error.. + InputSource in = new InputSource (fo.getInputStream()); + Object myPublicID = fo.getAttribute("hint.originalPublicID"); //NOI18N + if (myPublicID instanceof String) { + in.setPublicId((String)myPublicID); + } + URL url = fo.toURL(); + in.setSystemId(url.toString()); // we get nasty nbfs: instead nbres: but it is enough return in; } else { return null; diff --git a/platform/openide.loaders/src/org/openide/loaders/DataShadow.java b/platform/openide.loaders/src/org/openide/loaders/DataShadow.java index 82a8bf3..e2f04d2 100644 --- a/platform/openide.loaders/src/org/openide/loaders/DataShadow.java +++ b/platform/openide.loaders/src/org/openide/loaders/DataShadow.java @@ -305,7 +305,7 @@ public class DataShadow extends MultiDataObject implements DataObject.Container } fo = trg.createData (n, ext); } - writeShadowFile(fo, obj.getPrimaryFile().getURL()); + writeShadowFile(fo, obj.getPrimaryFile().toURL()); return fo; } }); @@ -468,7 +468,7 @@ public class DataShadow extends MultiDataObject implements DataObject.Container } else { fs = fileObject.getFileSystem(); } - return new URL(fs.getRoot().getURL(), path); + return new URL(fs.getRoot().toURL(), path); } } private static String[] readOriginalFileAndFileSystem(final FileObject f) throws IOException { @@ -645,7 +645,7 @@ public class DataShadow extends MultiDataObject implements DataObject.Container private void tryUpdate() throws IOException { URL url = readURL(getPrimaryFile ()); - if (url.equals(original.getPrimaryFile().getURL())) { + if (url.equals(original.getPrimaryFile().toURL())) { return; } writeOriginal (null, null, getPrimaryFile (), original); diff --git a/platform/openide.loaders/src/org/openide/loaders/XMLDataObjectInfoParser.java b/platform/openide.loaders/src/org/openide/loaders/XMLDataObjectInfoParser.java index 36f7fd2..14c22cc 100644 --- a/platform/openide.loaders/src/org/openide/loaders/XMLDataObjectInfoParser.java +++ b/platform/openide.loaders/src/org/openide/loaders/XMLDataObjectInfoParser.java @@ -201,14 +201,11 @@ implements FileChangeListener, LexicalHandler, LookupListener { } return previousID; } + URL url = null; InputStream in = null; - try { - url = myFileObject.getURL(); - } catch (IOException ex) { - warning(ex, "I/O exception while retrieving xml FileObject URL."); - return NULL; - } + url = myFileObject.toURL(); + synchronized (this) { try { if (!myFileObject.isValid()) { diff --git a/profiler/profiler.nbimpl/src/org/netbeans/modules/profiler/nbimpl/providers/ProfilerStorageProviderImpl.java b/profiler/profiler.nbimpl/src/org/netbeans/modules/profiler/nbimpl/providers/ProfilerStorageProviderImpl.java index 71d72d2..981b139 100644 --- a/profiler/profiler.nbimpl/src/org/netbeans/modules/profiler/nbimpl/providers/ProfilerStorageProviderImpl.java +++ b/profiler/profiler.nbimpl/src/org/netbeans/modules/profiler/nbimpl/providers/ProfilerStorageProviderImpl.java @@ -67,7 +67,7 @@ public final class ProfilerStorageProviderImpl extends ProfilerStorageProvider.A // Maven projects, autoprojects, etc. d = ProjectUtils.getCacheDirectory(p, IDEUtils.class); } - if (d != null) d.setAttribute(SETTINGS_FOR_ATTR, p.getProjectDirectory().getURL()); + if (d != null) d.setAttribute(SETTINGS_FOR_ATTR, p.getProjectDirectory().toURL()); return d; } diff --git a/profiler/profiler.projectsupport/src/org/netbeans/modules/profiler/projectsupport/utilities/AppletSupport.java b/profiler/profiler.projectsupport/src/org/netbeans/modules/profiler/projectsupport/utilities/AppletSupport.java index d1681d8..b5150ad 100644 --- a/profiler/profiler.projectsupport/src/org/netbeans/modules/profiler/projectsupport/utilities/AppletSupport.java +++ b/profiler/profiler.projectsupport/src/org/netbeans/modules/profiler/projectsupport/utilities/AppletSupport.java @@ -112,45 +112,41 @@ public class AppletSupport { URL url = null; - try { - if (ex == null) { - // JDK issue #6193279: Appletviewer does not accept encoded URLs - JavaPlatformManager pm = JavaPlatformManager.getDefault(); - JavaPlatform platform = null; + if (ex == null) { + // JDK issue #6193279: Appletviewer does not accept encoded URLs + JavaPlatformManager pm = JavaPlatformManager.getDefault(); + JavaPlatform platform = null; - if (activePlatform == null) { - platform = pm.getDefaultPlatform(); - } else { - JavaPlatform[] installedPlatforms = pm.getPlatforms(null, new Specification("j2se", null)); //NOI18N + if (activePlatform == null) { + platform = pm.getDefaultPlatform(); + } else { + JavaPlatform[] installedPlatforms = pm.getPlatforms(null, new Specification("j2se", null)); //NOI18N - for (int i = 0; i < installedPlatforms.length; i++) { - String antName = (String) installedPlatforms[i].getProperties().get("platform.ant.name"); //NOI18N + for (int i = 0; i < installedPlatforms.length; i++) { + String antName = (String) installedPlatforms[i].getProperties().get("platform.ant.name"); //NOI18N - if ((antName != null) && antName.equals(activePlatform)) { - platform = installedPlatforms[i]; + if ((antName != null) && antName.equals(activePlatform)) { + platform = installedPlatforms[i]; - break; - } + break; } } + } - boolean workAround6193279 = (platform != null //In case of nonexisting platform don't use the workaround - ) && (platform.getSpecification().getVersion().compareTo(JDK_15) >= 0); //JDK1.5 and higher + boolean workAround6193279 = (platform != null //In case of nonexisting platform don't use the workaround + ) && (platform.getSpecification().getVersion().compareTo(JDK_15) >= 0); //JDK1.5 and higher - if (workAround6193279) { - File f = FileUtil.toFile(html); + if (workAround6193279) { + File f = FileUtil.toFile(html); - try { - url = new URL("file", null, f.getAbsolutePath()); // NOI18N - } catch (MalformedURLException e) { - ErrorManager.getDefault().notify(e); - } - } else { - url = html.getURL(); + try { + url = new URL("file", null, f.getAbsolutePath()); // NOI18N + } catch (MalformedURLException e) { + ErrorManager.getDefault().notify(e); } + } else { + url = html.toURL(); } - } catch (FileStateInvalidException f) { - throw new FileStateInvalidException(); } return url; @@ -302,7 +298,7 @@ public class AppletSupport { ClassPath sp = ClassPath.getClassPath(appletFile, ClassPath.SOURCE); String path = FileUtil.getRelativePath(sp.findOwnerRoot(appletFile), appletFile); path = path.substring(0, path.length() - 5); - fillInFile(writer, path + "." + CLASS_EXT, "codebase=\"" + classesDir.getURL() + "\""); // NOI18N + fillInFile(writer, path + "." + CLASS_EXT, "codebase=\"" + classesDir.toURL() + "\""); // NOI18N } finally { lock.releaseLock(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists