/** * added for future use - convert NbMarshalledObject to primitive data types and other supported types (if possible) */ static Object unMarshallObjectRecursively(Object mo) { Object o = mo; while (o instanceof NbMarshalledObject) { try { o = ((NbMarshalledObject) o).get(); } catch (IOException e) { ExternalUtil.exception(e); return mo; } catch (ClassNotFoundException e) { ExternalUtil.exception(e); return mo; } } return (o == null) ? mo : o; }
public void run() { synchronized (closeSync) { final JarFile jarFile = getJar(false); if (jarFile != null) { try { jarFile.close(); LOGGER.log(Level.FINE, "closed: "+ System.currentTimeMillis()+ " " + root.getAbsolutePath());//NOI18N } catch (Exception exc) { // ignore exception during closing, just log it ExternalUtil.exception(exc); } finally { setJar(null); closeTask = null; } } } } };
@Override public void fileRenamed(FileRenameEvent fe) { File f = FileUtil.toFile(fe.getFile()); if ((f != null) && !f.equals(aRoot)) { try { setJarFile(f, false, true); } catch (IOException iex) { ExternalUtil.exception(iex); } catch (PropertyVetoException pvex) { ExternalUtil.exception(pvex); } } }
static String decode(final String inStr) { StringBuffer outStr = new StringBuffer(inStr.length()); try { for (int i = 0; i < inStr.length(); i++) { if (isEncodedChar(i, inStr)) { String decChar = inStr.substring(i + 2, i + 6); outStr.append((char) Integer.parseInt(decChar, 16)); i += 5; } else { outStr.append(inStr.charAt(i)); } } } catch (NumberFormatException e) { ExternalUtil.exception(e); return inStr; } return outStr.toString(); }
public synchronized void renameAttributes(String oldName, String newName) { try { String[] arr = new String[2]; split(oldName, arr); Table t = loadTable(arr[0]); Map v = (Map) t.remove(arr[1]); // System.out.println ("ARg[0] = " + arr[0] + " arr[1] = " + arr[1] + " value: " + v); // NOI18N if (v == null) { // no attrs no change return; } split(newName, arr); // Remove transient attributes: Iterator it = v.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); if (FileUtil.transientAttributes.contains(pair.getKey())) { it.remove(); } } t.put(arr[1], v); // System.out.println ("xyz[0] = " + arr[0] + " xyz[1] = " + arr[1] + " value: " + v); // NOI18N saveTable(arr[0], t); } catch (IOException e) { ExternalUtil.exception(e); } }
} catch (Exception e) { ExternalUtil.annotate(e, "fileName = " + fileName); //NOI18N ExternalUtil.exception(e); } catch (IOException e) { ExternalUtil.log("Cannot load attribute " + attrName + " from " + fileName); // NOI18N ExternalUtil.exception(e); } catch (ClassNotFoundException e) { ExternalUtil.log("Cannot load attribute " + attrName + " from " + fileName); // NOI18N ExternalUtil.exception(e);
); ExternalUtil.copyAnnotation(summaryEx, e); ExternalUtil.exception(summaryEx);
ExternalUtil.exception(ex);
/** Loads the table. Does no initialization. */ private Table load(String name) { String[] acceptNames = { ((name.length() == 0) ? "" : (name + '/')) + getFileName(), // NOI18N ((name.length() == 0) ? "" : (name + '/')) + ATTR_NAME_EXT }; // NOI18N for (int i = 0; i < acceptNames.length; i++) { if (info.size(acceptNames[i]) > 0L) { try { InputStream fis = info.inputStream(acceptNames[i]); try { return loadTable(fis, acceptNames[i]); } finally { try { fis.close(); } catch (IOException e) { // ignore--who cares? } } } catch (FileNotFoundException ex) { ExternalUtil.exception(ex); } } } return new Table(); }
public synchronized void deleteAttributes(String name) { try { String[] arr = new String[2]; split(name, arr); Table t = loadTable(arr[0]); if (t.remove(arr[1]) != null) { // if there is a change saveTable(arr[0], t); } } catch (IOException e) { ExternalUtil.exception(e); } }
public InputStream getInputStream() throws IOException, UnknownServiceException { connect(); if (iStream == null) { try { if (fo.isFolder()) { iStream = new FIS(fo); } else { iStream = fo.getInputStream(); } } catch (FileNotFoundException e) { ExternalUtil.exception(e); throw e; } } return iStream; }
public ED(FCLSupport.Op op, Enumeration<FileChangeListener> en, FileEvent fe) { this.op = op; this.en = en; this.fe = fe; FileSystem fs = null; try { fs = this.fe.getFile().getFileSystem(); } catch (FileStateInvalidException ex) { ExternalUtil.exception(ex); } ListenerList<FileChangeListener> fsll = (fs != null) ? fs.getFCLSupport().listeners : null; ListenerList<FileChangeListener> repll = (fs != null && fs.getRepository() != null) ? fs.getRepository().getFCLSupport().listeners : null; fsList = ListenerList.allListeners(fsll); repList = ListenerList.allListeners(repll); }
/** According to name of attribute returns attribute as object * @param params has sense only for methodvalue invocation; and only 2 parametres will be used * @return attribute, which is hold in XMLMapAttr.Attr or null if such attribute doesn`t exist or isn`t able to construct form String representation */ public Object get (final Object p1,Object[] params) { Object obj; try { obj = getAttribute (p1, params); } catch(Exception e) { obj = null; ExternalUtil.exception (e); } return obj; }
/** According to name of attribute returns attribute as object * @param params has sense only for methodvalue invocation; and only 2 parametres will be used * @return attribute, which is hold in XMLMapAttr.Attr or null if such attribute doesn`t exist or isn`t able to construct form String representation */ public Object get (final Object p1,Object[] params) { Object obj; try { obj = getAttribute (p1, params); } catch(Exception e) { obj = null; ExternalUtil.exception (e); } return obj; }
/** According to name of attribute returns attribute as object * @param p1 is name of attribute * @return attribute, which is hold in XMLMapAttr.Attr or null if such attribute doesn`t exist or isn`t able to construct form String representation */ public Object get (final Object p1) { Object obj; try { obj = getAttribute (p1); } catch(Exception e) { obj = null; ExternalUtil.exception (e); } return obj; }
public synchronized void deleteAttributes (String name) { try { String[] arr = new String[2]; split (name, arr); Table t = loadTable (arr[0]); if (t.remove (arr[1]) != null) { // if there is a change saveTable (arr[0], t); } } catch (IOException e) { ExternalUtil.exception (e); } }
public synchronized void deleteAttributes (String name) { try { String[] arr = new String[2]; split (name, arr); Table t = loadTable (arr[0]); if (t.remove (arr[1]) != null) { // if there is a change saveTable (arr[0], t); } } catch (IOException e) { ExternalUtil.exception (e); } }