Package center.task

Examples of center.task.CalculateException


          obb = ru.vassaev.core.thread.Process.getByteBuffer(8000, is);
          is.close();
          obb.close();
          v = obb.getIS();
        } catch(IOException e) {
          throw new CalculateException(gl_name, e);
       
      }
      InputStream dh;
      if (v == null)
        return null;
      if (v instanceof String || v instanceof StringBuffer) {
        String val = v.toString().trim();
        if (val.indexOf("<?") != 0) {
          val = "<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>" + val;
        }
        try {
          dh = new java.io.ByteArrayInputStream(val.getBytes(encoding));
        } catch (UnsupportedEncodingException e) {
          throw new CalculateException(gl_name, e);
        }
      } else if (v instanceof InputStream) {
        if (!isHeader) {
          dh = (InputStream) v;
        } else {
          InputStream h;
          try {
            h = new java.io.ByteArrayInputStream(
                    ("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>")
                            .getBytes(encoding));
          } catch (UnsupportedEncodingException e) {
            throw new CalculateException(gl_name, e);
          }
          dh = new java.io.SequenceInputStream(h, (InputStream) v);
        }
      } else
        throw new CalculateException(gl_name, "The source's type isn't supported:" + v.getClass().getCanonicalName());
      try {
        Document d = XMLFileWaiter.getDocument(dh, encoding);
        if (d != null)
          return modify(tl, cntx, d.getDocumentElement());
        return null;
View Full Code Here


        FileInputStream is = null;
        try {
          is = new FileInputStream(f.getCanonicalPath());
          return Strings.getStringBuffer(is, encoding);
        } catch(IOException e) {
          throw new CalculateException(this.getGLName(), e);
        finally {
          if (is != null) try {
            is.close();
          } catch(IOException e) {
            e.printStackTrace();
          }
        }
      } else if (v instanceof OutputByteBuffer) {
        InputStream is = ((OutputByteBuffer)v).getIS();
        try {
          return Strings.getStringBuffer(is, encoding);
        } catch(IOException e) {
          throw new CalculateException(this.getGLName(), e);
        finally {
          if (is != null) try {
            is.close();
          } catch(IOException e) {
            e.printStackTrace();
          }
        }
      }
      return v.toString();
    } catch(CalculateException e) {
      if (whenException == null)
        throw e;
      else {
        if (whenException instanceof Prm)
          try {
            return ((Prm)whenException).getObject(cntx);
          } catch (SysException e1) {
            Throwable cause = e1.getCause();
            if (cause instanceof CalculateException)
              throw (CalculateException)cause;
            throw new CalculateException(fullname, e1);
          }
        return whenException;
      }
    } finally {
      setEvent(old);
View Full Code Here

TOP

Related Classes of center.task.CalculateException

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.