assert asserts = true; if (asserts) { File normFile = normalizeFile(file); if (!file.equals(normFile)) { final String msg = "Parameter file was not " + // NOI18N "normalized. Was " + toDebugString(file) + " instead of " + toDebugString(normFile); // NOI18N LOG.log(Level.WARNING, msg); LOG.log(Level.INFO, msg, new IllegalArgumentException(msg)); URL url = Utilities.toURI(file).toURL(); retVal = URLMapper.findFileObject(url); if (getDiskFileSystem() == null) { try { FileSystem fs = retVal.getFileSystem(); setDiskFileSystem(fs); } catch (FileStateInvalidException ex) { Exceptions.printStackTrace(ex);
/** * @param message localized text */ public FSException(String message) { super(message); Exceptions.attachLocalizedMessage(this, message); }
u.openStream(); Exceptions.attachMessage(e, "While loading: " + res); // NOI18N LOG.log(Level.WARNING, null, e); return loadBundleClass(name, sname, locale, l, loader);
Exceptions.attachMessage(ex, "Current component: " + c); // NOI18N Exceptions.attachMessage(ex, "List of components: " + components); // NOI18N Exceptions.attachMessage(ex, "List of actions: " + Arrays.asList(actions)); // NOI18N Exceptions.printStackTrace(ex);
@Override public boolean check(final Name fqn, final JavaFileObject jfo) { String value = props.getProperty(fqn.toString()); try { return value != null && !value.equals(jfo.toUri().toURL().toExternalForm()); } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); return false; } }
private static ClassPath classpathForFile(FileObject fo) { URL[] layers = (URL[]) fo.getAttribute("layers"); // NOI18N if (layers != null) { for (URL layer : layers) { URL jar = FileUtil.getArchiveFile(layer); if (jar != null) { List<URL> roots = new ArrayList<URL>(); roots.add(FileUtil.getArchiveRoot(jar)); Matcher m = Pattern.compile("(file:.+/)([^/]+)[.]jar").matcher(jar.toString()); // NOI18N if (m.matches()) { try { for (String suffix : NbCollections.iterable(NbBundle.getLocalizingSuffixes())) { roots.add(new URL("jar:" + m.group(1) + "locale/" + m.group(2) + suffix + ".jar!/")); // NOI18N p = FileOwnerQuery.getOwner(layer.toURI()); if (p != null) { return LayerUtils.findResourceCP(p); Exceptions.printStackTrace(ex);
private void jLabel2MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MousePressed try { HtmlBrowser.URLDisplayer.getDefault().showURL(new URL("http://groovy.codehaus.org")); // NOI18N } catch (MalformedURLException murle) { Exceptions.printStackTrace(murle); } }//GEN-LAST:event_jLabel2MousePressed
for (ScalaPlatform platform : mgr.getInstalledPlatforms()) { for (ClassPath.Entry entry : platform.getBootstrapLibraries().entries()) { if (entry.getURL().equals (binaryRoot)) { res = new Result(platform); this.cache.put (binaryRoot, res); if (entry.getURL().equals (binaryRoot)) { res = new Result(platform); this.cache.put (binaryRoot, res); String binaryRootS = binaryRoot.toExternalForm(); if (binaryRootS.startsWith(JAR_FILE)) { String srcZipS = null; URL srcZip = FileUtil.getArchiveRoot(new URL(srcZipS)); FileObject fo = URLMapper.findFileObject(srcZip); if (fo != null) { Exceptions.printStackTrace(mue);
final URL srcRoot = getBaseSourceRoot(BaseUtilities.toURI(this.root).toURL()); if (srcRoot != null && JavaIndex.hasSourceCache(srcRoot, false)) { if ("file".equals(srcRoot.getProtocol())) { //NOI18N final File folder = BaseUtilities.toFile(srcRoot.toURI()); file = new File (folder,path); if (file.exists()) { final FileObject srcRootFo = URLMapper.findFileObject(srcRoot); if (srcRootFo != null) { final FileObject resource = srcRootFo.getFileObject(name); if (resource != null) { return FileObjects.sourceFileObject(resource, srcRootFo); Exceptions.printStackTrace(e); } catch (URISyntaxException e) { Exceptions.printStackTrace(e);
public void actionPerformed(ActionEvent e) { try { URLDisplayer.getDefault().showURL( new URL(NbBundle.getMessage(DashboardImpl.class, "URL_KenaiOverview"))); //NOI18N } catch( MalformedURLException ex ) { //shouldn't happen Exceptions.printStackTrace(ex); } } };
private void addFileURLListener(String url) { if (fo != null) { fo.removeFileChangeListener(fileListener); } if (url.length() > 0) { try { fo = URLMapper.findFileObject(new URL(url)); if (fo != null) { fileListener = WeakListeners.create(FileChangeListener.class, fileListenerImpl, fo); fo.addFileChangeListener(fileListener); } } catch (MalformedURLException ex) { Exceptions.printStackTrace(new IllegalArgumentException("URL = '"+url+"'", ex)); } catch (IllegalArgumentException ex) { Exceptions.printStackTrace(new IllegalArgumentException("URL = '"+url+"'", ex)); } } }
@Override public URL toServer(int projectContext, FileObject projectFile) { init(); if (projectRootURL == null || webDocumentRoot == null) { return null; } String relPath = FileUtil.getRelativePath(webDocumentRoot, projectFile); for (FrameworkServerURLMapping mapping : lookupFrameworkMappings()) { relPath = mapping.convertFileToRelativeURL(projectFile, relPath); } // #233748 - disable using Servlet URL mapping for now: // relPath = applyServletPattern(relPath); try { URL u = new URL(projectRootURL + relPath); WebBrowser browser = getWebBrowser(); if (browser != null) { u = browser.toBrowserURL(getWebProject(), projectFile, u); } return u; } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); return null; } }
private static List<URI> getFxSources(@NonNull final File javaHome) { try { final File f = new File (javaHome, FX_SOURCES); if (f.exists() && f.canRead()) { final URL url = FileUtil.getArchiveRoot(Utilities.toURI(f).toURL()); final URI uri = url.toURI(); return Collections.singletonList (uri); } } catch (MalformedURLException | URISyntaxException e) { Exceptions.printStackTrace(e); } return Collections.emptyList(); }
public String getFileUrl() { if (file == null) { // there's no file for e.g. for dynamic methods return null; } File f = FileUtil.toFile(file); try { return f == null ? null : f.toURI().toURL().toExternalForm(); } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); return null; } }
private ClassPath getAdditionalClassPath(File baseDir) { try { String root = Utilities.toURI(baseDir).toURL().toExternalForm(); Properties sourcesProperties = Properties.getDefault ().getProperties ("debugger").getProperties ("sources"); List<String> additionalSourceRoots = (List<String>) sourcesProperties. getProperties("additional_source_roots"). getMap("project", Collections.emptyMap()). get(root); if (additionalSourceRoots == null || additionalSourceRoots.isEmpty()) { return null; } List<FileObject> additionalSourcePath = new ArrayList<FileObject>(additionalSourceRoots.size()); for (String ar : additionalSourceRoots) { FileObject fo = getFileObject(ar); if (fo != null && fo.canRead()) { additionalSourcePath.add(fo); } } this.additionalSourceRoots = new LinkedHashSet<String>(additionalSourceRoots); return createClassPath( additionalSourcePath.toArray(new FileObject[0])); } catch (MalformedURLException ex) { Exceptions.printStackTrace(ex); return null; } }
@Override public Set<FileObject> getLocationsForIdentifiers(String identifierName) { final Set<FileObject> result = new HashSet<>(); Collection<? extends IndexResult> idIndexResult = search( PHPIndexer.FIELD_IDENTIFIER, identifierName.toLowerCase(), QuerySupport.Kind.PREFIX, PHPIndexer.FIELD_BASE, PHPIndexer.FIELD_IDENTIFIER); for (IndexResult indexResult : idIndexResult) { String[] values = indexResult.getValues(PHPIndexer.FIELD_IDENTIFIER); for (String val : values) { Signature sig = Signature.get(val); if (identifierName.equalsIgnoreCase(sig.string(0))) { URL url = indexResult.getUrl(); FileObject fo = null; try { fo = "file".equals(url.getProtocol()) ? //NOI18N FileUtil.toFileObject(Utilities.toFile(url.toURI())) : URLMapper.findFileObject(url); } catch (URISyntaxException ex) { Exceptions.printStackTrace(ex); } if (fo != null) { result.add(fo); } } } } return result; }
@Override public JComponent createSideBar(JTextComponent target) { try { if (Disassembly.isDisasm(NbEditorUtilities.getDataObject(target.getDocument()).getPrimaryFile().getURL().toString())) { if (INSTANCE == null) { INSTANCE = new DisInfoPanel(); } return INSTANCE; } } catch (Exception e) { Exceptions.printStackTrace(e); } return null; } }
angularIndex = AngularJsIndex.get(project); } catch (IOException ex) { Exceptions.printStackTrace(ex); String name = controller.getName(); URL url = controller.getDeclarationFile(); File file = new File(url.toString()); AngularJsElement element = new AngularJsElement(name, ElementKind.METHOD); result.add(new AngularJsCompletionItem.AngularFOCompletionItem(element, anchor, FileUtil.toFileObject(file)));
public static boolean isDisasm(String url) { //TODO: optimize try { return getFileObject().getURL().toString().equals(url); } catch (FileStateInvalidException fsi) { Exceptions.printStackTrace(fsi); } return false; }
private static boolean containsService(FileObject serviceFO, String serviceName, String serviceImplName) { try { BufferedReader br = new BufferedReader(new InputStreamReader(serviceFO.getInputStream())); try { String line; while ((line = br.readLine()) != null) { int ci = line.indexOf('#'); if (ci >= 0) line = line.substring(0, ci); if (line.trim().equals(serviceImplName)) { return true; } } } finally { br.close(); } } catch (Exception ex) { try { Exceptions.attachLocalizedMessage(ex, serviceFO.getURL().toString()); } catch (FileStateInvalidException fsie) { //noop } Logger.getLogger("global").log(Level.INFO, null, ex); } return false; }