Package ch.inftec.ju.util

Examples of ch.inftec.ju.util.JuException


  @Test
  public void futureTask_throwingException() throws Exception {
    FutureTask<String> futureTask = new FutureTask<String>(new Callable<String>() {
      @Override
      public String call() throws Exception {
        throw new JuException("Failing...");
      }
    });
   
    executor.execute(futureTask);
   
View Full Code Here


      }

      // Use cause (if possible / serializable)
      Throwable cause = IOUtil.isSerializable(t.getCause())
          ? t.getCause()
          : new JuException("Original cause was non-serializable. Check server for details.");
         
      throw new JuRuntimeException("%s (Original Exception %s was non-serializable)", cause, t.getMessage(), t.getClass().getName());
    } else {
      throw t;
    }
View Full Code Here

    try {
      xmlStream = new BufferedInputStream(xmlUrl.openStream());
     
      return XmlUtils.loadXml(new InputSource(xmlStream), XmlUtils.loadSchema(schemaUrl));
    } catch (Exception ex) {
      throw new JuException(String.format("Couldn't load XML from URL: %s (Schema URL: %s)",
          xmlUrl, schemaUrl), ex);
    } finally {
      IOUtil.close(xmlStream);
    }
  }
View Full Code Here

   
    try {
      xmlStream = new BufferedInputStream(inputStream);     
      return XmlUtils.loadXml(new InputSource(xmlStream), schema);
    } catch (Exception ex) {
      throw new JuException("Couldn't load XML from InputStream", ex);
    } finally {
      IOUtil.close(xmlStream);
    }
  }
View Full Code Here

        schema.newValidator().validate(new DOMSource(doc));
      }

      return doc;
    } catch (Exception ex) {
      throw new JuException("Couldn't load XML" , ex);
    }
  }
View Full Code Here

    try {
      xmlStream = new BufferedInputStream(xmlUrl.openStream());
     
      return XmlUtils.loadXml(new InputSource(xmlStream), XmlUtils.loadSchema(schemaUrl), false);
    } catch (Exception ex) {
      throw new JuException(String.format("Couldn't load XML from URL: %s (Schema URL: %s)",
          xmlUrl, schemaUrl), ex);
    } finally {
      IOUtil.close(xmlStream);
    }
  }
View Full Code Here

   
    try {
      xmlStream = new BufferedInputStream(inputStream);     
      return XmlUtils.loadXml(new InputSource(xmlStream), schema, false);
    } catch (Exception ex) {
      throw new JuException("Couldn't load XML from InputStream", ex);
    } finally {
      IOUtil.close(xmlStream);
    }
  }
View Full Code Here

        schema.newValidator().validate(new DOMSource(doc));
      }

      return doc;
    } catch (Exception ex) {
      throw new JuException("Couldn't load XML" , ex);
    }
  }
View Full Code Here

     */
    public static void validate(String xml, Schema schema) throws JuException {
      try {
        schema.newValidator().validate(new DOMSource(XmlUtils.loadXml(xml, null)));
      } catch (SAXParseException ex) {
        throw new JuException("Parse exception: " + ex.getMessage(), ex);
      } catch (Exception ex) {
        throw new JuException("Validation failed", ex);
      }
    }
View Full Code Here

     */
    public static void validate(String xml, Schema schema, boolean nameSpaceAware) throws JuException {
      try {
        schema.newValidator().validate(new DOMSource(XmlUtils.loadXml(xml, null, nameSpaceAware)));
      } catch (SAXParseException ex) {
        throw new JuException("Parse exception: " + ex.getMessage(), ex);
      } catch (Exception ex) {
        throw new JuException("Validation failed", ex);
      }
    }
View Full Code Here

TOP

Related Classes of ch.inftec.ju.util.JuException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.