Package ch.inftec.ju.util

Examples of ch.inftec.ju.util.JuRuntimeException


    @Override
    public void doWork(DbWork work) {
      try {
        this.performDbWork(work);
      } catch (Exception ex) {
        throw new JuRuntimeException("Couldn't execute DB work", ex);
      }
    }
View Full Code Here


    if (this.hashCode == null) {
      // Get the primary key annotated with ID
      List<Field> fields = ReflectUtils.getDeclaredFieldsByAnnotation(this.getClass(), Id.class);
     
      if (fields.size() != 1) {
        throw new JuRuntimeException("Expected exactly one @Id annotaded field");
      }
     
      // Get the value of the ID field
      this.idFieldValue = ReflectUtils.getFieldValue(this, fields.get(0));
      if (this.idFieldValue == null) {
        throw new JuRuntimeException("Id of EntityBean must not be null when first hashCode is computed");
      }
     
      // Compute the hashcode
      this.hashCode = this.idFieldValue.hashCode();
    }
View Full Code Here

      byte[] bytes = outputStream.toByteArray();
     
      ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
      return XmlUtils.loadXml(inputStream, null);
    } catch (Exception ex) {
      throw new JuRuntimeException("Couldn't convert byte stream to XML document", ex);
    }
  }
View Full Code Here

   */
  public String getXmlString() {
    try {
      return this.outputStream.toString("utf-8");
    } catch (Exception ex) {
      throw new JuRuntimeException("Couldn't convert byte stream to String", ex);
    }
  }
View Full Code Here

    try (final OutputStream stream = new BufferedOutputStream(
            new FileOutputStream(file.toFile()))) {

      stream.write(this.outputStream.toByteArray());
    } catch (Exception ex) {
      throw new JuRuntimeException("Couldn't write DB data to file " + file, ex);
    }
  }
View Full Code Here

  private String evaluate(String query) throws JuRuntimeException {
    try {
      XPathExpression xPathExpression = this.getXPath().compile(query);
      return xPathExpression.evaluate(this.node);
    } catch (Exception ex) {
      throw new JuRuntimeException("Couldn't evaluate xPath expression: " + query, ex);     
    }
  }
View Full Code Here

  private NodeList evaluateNodeSet(String query) throws JuRuntimeException {
    try {
      XPathExpression xPathExpression = this.getXPath().compile(query);
      return (NodeList)xPathExpression.evaluate(this.node, XPathConstants.NODESET);
    } catch (Exception ex) {
      throw new JuRuntimeException("Couldn't evaluate xPath expression: " + query, ex);     
    }
  }
View Full Code Here

    if (value == null || value.length() == 0) return null;
   
    try {
      return Long.parseLong(value);
    } catch (Exception ex) {
      throw new JuRuntimeException("Couldn't convert " + value + " to Long", ex);
    }
  }
View Full Code Here

        values[i] = node.getTextContent();
      }
     
      return values;
    } catch (Exception ex) {
      throw new JuRuntimeException("Couldn't evaluate xPath query: " + query);
    }
  }
View Full Code Here

        longValues[i] = null;
      } else {
        try {
          longValues[i] = Long.parseLong(value);
        } catch (Exception ex) {
          throw new JuRuntimeException("Couldn't convert " + value + " to Long", ex);
        }
      }
    }
   
    return longValues;
View Full Code Here

TOP

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

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.