/** Constructor. Creates new XMLFileSystem. * @param uri to file with definition of XMLFileSystem * @throws SAXException if parsing is not succesful */ public XMLFileSystem(String uri) throws SAXException { this(); if (uri == null) { throw new NullPointerException("Null uri"); // NOI18N } try { setXmlUrl(new URL(uri)); } catch (Exception e) { throw (SAXException) ExternalUtil.copyAnnotation(new SAXException(e.getMessage()), e); } }
private URL createAbsoluteUrl(String name) throws java.io.FileNotFoundException { if (!(content instanceof String)) { return null; } String uri = (String) content; try { URL[] uc = getLayers(); URL retVal = ((uc == null) || (uc.length == 0)) ? new URL(uri) : new URL(uc[0], uri); return retVal; } catch (IOException ex) { // neni koser osetreni - RM FileNotFoundException x = new FileNotFoundException(name); ExternalUtil.copyAnnotation(x, ex); throw x; } }
/** Constructor. Creates new XMLFileSystem. * @param url to definition of XMLFileSystem * @throws SAXException if parsing not succesful */ public XMLFileSystem(URL url) throws SAXException { this(); if (url == null) { throw new NullPointerException("Null url"); // NOI18N } try { setXmlUrl(url); } catch (Exception e) { throw (SAXException) ExternalUtil.copyAnnotation(new SAXException(e.getMessage()), e); } }
/** * Encodes Object into String encoded in HEX format * @param value Object, which will be encoded * @return serialized Object in String encoded in HEX format * @throws IOException */ static String encodeValue(Object value) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(value); oos.close(); } catch (Exception e) { throw (IOException) ExternalUtil.copyAnnotation(new IOException(), e); } byte[] bArray = bos.toByteArray(); StringBuffer strBuff = new StringBuffer(bArray.length * 2); for (int i = 0; i < bArray.length; i++) { if ((bArray[i] < 16) && (bArray[i] >= 0)) { strBuff.append("0"); // NOI18N } strBuff.append(Integer.toHexString((bArray[i] < 0) ? (bArray[i] + 256) : bArray[i])); } return strBuff.toString(); }
throw (IOException) ExternalUtil.copyAnnotation(new IOException(), e); throw (IOException) ExternalUtil.copyAnnotation(new IOException(), e);
} catch (IOException iox) { FileNotFoundException x = new FileNotFoundException(name); ExternalUtil.copyAnnotation(x, iox); throw x;
/** * Reads itself from XML format * New added - for Sandwich project (XML format instead of serialization) . * @param is input stream (which is parsed) * @return Table */ public void readFromXML(InputStream is, boolean validate) throws SAXException { StringBuffer fileName = new StringBuffer(); ElementHandler[] elmKeyService = { parseFirstLevel(), parseSecondLevel(fileName), parseThirdLevel(fileName) }; // String dtd = getClass().getClassLoader().getResource(DTD_PATH).toExternalForm(); InnerParser parser = new InnerParser(PUBLIC_ID, dtd, elmKeyService); try { parser.parseXML(is, validate); } catch (Exception ioe) { throw (SAXException) ExternalUtil.copyAnnotation( new SAXException(NbBundle.getMessage(DefaultAttributes.class, "EXC_DefAttrReadErr")), ioe ); } catch (FactoryConfigurationError fce) { // ??? see http://openide.netbeans.org/servlets/ReadMsg?msgId=340881&listName=dev throw (SAXException) ExternalUtil.copyAnnotation( new SAXException(NbBundle.getMessage(DefaultAttributes.class, "EXC_DefAttrReadErr")), fce ); } }
NbBundle.getMessage(DefaultAttributes.class, "EXC_DefAttrReadErr") + ": " + folderName ); ExternalUtil.copyAnnotation(summaryEx, e); ExternalUtil.exception(summaryEx);
/** Initializes the root of FS. */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { //ois.defaultReadObject (); ObjectInputStream.GetField fields = ois.readFields(); URL[] urls = (URL[]) fields.get("urlsToXml", null); // NOI18N if (urls == null) { urls = new URL[1]; urls[0] = (URL) fields.get("uriId", null); // NOI18N if (urls[0] == null) { throw new IOException("missing uriId"); // NOI18N } } try { setXmlUrls(urls); } catch (PropertyVetoException ex) { IOException x = new IOException(ex.getMessage()); ExternalUtil.copyAnnotation(x, ex); throw x; } }
/** Constructor. Creates new XMLFileSystem. * @param uri to file with definition of XMLFileSystem * @throws SAXException if parsing is not succesful */ public XMLFileSystem(String uri) throws SAXException { this(); if (uri == null) throw new NullPointerException("Null uri"); // NOI18N try { setXmlUrl(new URL(uri)); } catch(Exception e) { throw (SAXException)ExternalUtil.copyAnnotation (new SAXException (e.getMessage()),e); } }
private URL createAbsoluteUrl (String name) throws java.io.FileNotFoundException { if (!(content instanceof String)) return null; String uri = (String)content; try { URL[] uc = getLayers(); URL retVal = (uc == null || uc.length == 0)?new URL (uri):new URL (uc[0],uri); return retVal; } catch(IOException ex) {// neni koser osetreni - RM FileNotFoundException x = new FileNotFoundException (name); ExternalUtil.copyAnnotation (x,ex); throw x; } }
/** Constructor. Creates new XMLFileSystem. * @param uri to file with definition of XMLFileSystem * @throws SAXException if parsing is not succesful */ public XMLFileSystem(String uri) throws SAXException { this(); if (uri == null) throw new NullPointerException("Null uri"); // NOI18N try { setXmlUrl(new URL(uri)); } catch(Exception e) { throw (SAXException)ExternalUtil.copyAnnotation (new SAXException (e.getMessage()),e); } }
/** Constructor. Creates new XMLFileSystem. * @param url to definition of XMLFileSystem * @throws SAXException if parsing not succesful */ public XMLFileSystem(URL url) throws SAXException{ this(); if (url == null) throw new NullPointerException("Null url"); // NOI18N try { setXmlUrl(url); } catch(Exception e) { throw (SAXException)ExternalUtil.copyAnnotation (new SAXException (e.getMessage()),e); } }
/** Constructor. Creates new XMLFileSystem. * @param url to definition of XMLFileSystem * @throws SAXException if parsing not succesful */ public XMLFileSystem(URL url) throws SAXException{ this(); if (url == null) throw new NullPointerException("Null url"); // NOI18N try { setXmlUrl(url); } catch(Exception e) { throw (SAXException)ExternalUtil.copyAnnotation (new SAXException (e.getMessage()),e); } }
private URL createAbsoluteUrl (String name) throws java.io.FileNotFoundException { if (!(content instanceof String)) return null; String uri = (String)content; try { URL[] uc = getLayers(); URL retVal = (uc == null || uc.length == 0)?new URL (uri):new URL (uc[0],uri); return retVal; } catch(IOException ex) {// neni koser osetreni - RM FileNotFoundException x = new FileNotFoundException (name); ExternalUtil.copyAnnotation (x,ex); throw x; } }
/** * Encodes Object into String encoded in HEX format * @param value Object, which will be encoded * @return serialized Object in String encoded in HEX format * @throws IOException */ static String encodeValue(Object value) throws IOException{ ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(value); oos.close(); } catch (Exception e) { throw (IOException)ExternalUtil.copyAnnotation (new IOException (),e); } byte bArray[] = bos.toByteArray(); StringBuffer strBuff = new StringBuffer(bArray.length*2); for(int i = 0; i < bArray.length;i++) { if (bArray[i] < 16 && bArray[i] >= 0) strBuff.append("0");// NOI18N strBuff.append(Integer.toHexString(bArray[i] < 0?bArray[i]+256:bArray[i])); } return strBuff.toString(); }
/** * Reads itself from XML format * New added - for Sandwich project (XML format instead of serialization) . * @param is input stream (which is parsed) * @return Table */ public void readFromXML (InputStream is, boolean validate) throws SAXException { StringBuffer fileName = new StringBuffer(); ElementHandler[] elmKeyService = {parseFirstLevel(),parseSecondLevel(fileName),parseThirdLevel(fileName)};// String dtd = getClass().getClassLoader().getResource( DTD_PATH ).toExternalForm(); InnerParser parser = new InnerParser(PUBLIC_ID, dtd, elmKeyService); try { parser.parseXML(is, validate); } catch(Exception ioe) { throw (SAXException)ExternalUtil.copyAnnotation (new SAXException (NbBundle.getMessage(DefaultAttributes.class,"EXC_DefAttrReadErr")),ioe); } catch (FactoryConfigurationError fce) { // ??? see http://openide.netbeans.org/servlets/ReadMsg?msgId=340881&listName=dev throw (SAXException)ExternalUtil.copyAnnotation(new SAXException(NbBundle.getMessage(DefaultAttributes.class, "EXC_DefAttrReadErr")), fce); } }
/** * Reads itself from XML format * New added - for Sandwich project (XML format instead of serialization) . * @param is input stream (which is parsed) * @return Table */ public void readFromXML (InputStream is, boolean validate) throws SAXException { StringBuffer fileName = new StringBuffer(); ElementHandler[] elmKeyService = {parseFirstLevel(),parseSecondLevel(fileName),parseThirdLevel(fileName)};// String dtd = getClass().getClassLoader().getResource( DTD_PATH ).toExternalForm(); InnerParser parser = new InnerParser(PUBLIC_ID, dtd, elmKeyService); try { parser.parseXML(is, validate); } catch(Exception ioe) { throw (SAXException)ExternalUtil.copyAnnotation (new SAXException (NbBundle.getMessage(DefaultAttributes.class,"EXC_DefAttrReadErr")),ioe); } catch (FactoryConfigurationError fce) { // ??? see http://openide.netbeans.org/servlets/ReadMsg?msgId=340881&listName=dev throw (SAXException)ExternalUtil.copyAnnotation(new SAXException(NbBundle.getMessage(DefaultAttributes.class, "EXC_DefAttrReadErr")), fce); } }
/** Initializes the root of FS. */ private void readObject (ObjectInputStream ois) throws IOException, ClassNotFoundException { //ois.defaultReadObject (); ObjectInputStream.GetField fields = ois.readFields(); URL[] urls = (URL[]) fields.get ("urlsToXml",null); // NOI18N if (urls == null) { urls = new URL[1]; urls[0] = (URL) fields.get ("uriId",null); // NOI18N } try { if (urlsToXml.length != 1) setXmlUrls(urlsToXml); else setXmlUrl(urlsToXml[0]); } catch (PropertyVetoException ex) { IOException x = new IOException (ex.getMessage()); ExternalUtil.copyAnnotation (x,ex); throw x; } }
/** Initializes the root of FS. */ private void readObject (ObjectInputStream ois) throws IOException, ClassNotFoundException { //ois.defaultReadObject (); ObjectInputStream.GetField fields = ois.readFields(); URL[] urls = (URL[]) fields.get ("urlsToXml",null); // NOI18N if (urls == null) { urls = new URL[1]; urls[0] = (URL) fields.get ("uriId",null); // NOI18N } try { if (urlsToXml.length != 1) setXmlUrls(urlsToXml); else setXmlUrl(urlsToXml[0]); } catch (PropertyVetoException ex) { IOException x = new IOException (ex.getMessage()); ExternalUtil.copyAnnotation (x,ex); throw x; } }