Package net.sf.chellow.monad

Examples of net.sf.chellow.monad.InternalException


              "Can't find an entry within the zip file.");
        }
        String name = entry.getName();
        extension = name.substring(name.length() - 3);
      } catch (IOException e) {
        throw new InternalException(e);
      }
    }
    Reader reader;
    try {
      reader = new InputStreamReader(is, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      throw new InternalException(e);
    }
    digester = new Digester(reader, extension);
  }
View Full Code Here


      throws HttpException {
    try {
      initialize(batchId, id, item.getInputStream(), item.getName(),
          item.getSize());
    } catch (IOException e) {
      throw new InternalException(e);
    }
  }
View Full Code Here

        fileName = entry.getName();

        // extract data
        // open output streams
      } catch (IOException e) {
        throw new InternalException(e);
      }
    }
    int locationOfDot = fileName.lastIndexOf(".");
    if (locationOfDot == -1 || locationOfDot == fileName.length() - 1) {
      throw new UserException(
          "The file name must have an extension (eg. '.zip')");
    }
    int location2Dot = fileName.lastIndexOf(".", locationOfDot - 1);
    if (location2Dot != -1) {
      locationOfDot = location2Dot;
    }
    String extension = fileName.substring(locationOfDot + 1);
    NonCoreContract parserContract = NonCoreContract
        .getNonCoreContract("bill-parser-" + extension);
    try {
      PythonInterpreter interpreter = new PythonInterpreter();
      interpreter.exec(parserContract.getChargeScript());
      PyObject parserClass = interpreter.get("Parser");
      parser = (BillParser) parserClass
          .__call__(
              PyJavaType.wrapJavaObject(new InputStreamReader(is,
                  "UTF-8"))).__tojava__(BillParser.class);
    } catch (UnsupportedEncodingException e) {
      throw new InternalException(e);
    }
  }
View Full Code Here

      } else if (extension.equals("xml")) {
        XMLInputFactory factory = XMLInputFactory.newInstance();
        try {
          r = factory.createXMLEventReader(reader);
        } catch (XMLStreamException e) {
          throw new InternalException(e);
        }
      } else {
        throw new UserException("The file extension was '" + extension
            + "' but only csv or xml is recognized.");
      }
View Full Code Here

              }
              e = r.nextEvent();
              lineNumber = e.getLocation().getLineNumber();
            }
          } catch (XMLStreamException e) {
            throw new InternalException(e);
          }
        }
        if (values.isEmpty()) {
          return null;
        } else {
          return values.toArray(new String[0]);
        }
      } else {
        try {
          String[] line = shredder.getLine();
          lineNumber = shredder.getLastLineNumber();
          return line;
        } catch (IOException e) {
          throw new InternalException(e);
        }
      }
    }
View Full Code Here

                inv.getRequest().getRemoteAddr())
                .isLoopbackAddress()) {
          return;
        }
      } catch (UnknownHostException e) {
        throw new InternalException(e);
      }
      throw new UnauthorizedException();
    }
    UserRole role = user.getRole();
    String roleCode = role.getCode();
View Full Code Here

        }
        process = new GeneralImport(getEditUri().resolve(
            new UriPathElement(Long.toString(processId))).append(
            "/"), fileItem.getInputStream(), extension);
      } catch (IOException e) {
        throw new InternalException(e);
      }
      processes.put(processId, process);
    } catch (HttpException e) {
      e.setDocument(document());
      throw e;
View Full Code Here

          .session()
          .createQuery(
              "from NonCoreContract contract where contract.name = :name")
          .setString("name", name).uniqueResult();
    } catch (NonUniqueResultException e) {
      throw new InternalException(
          "There is more than 1 non-core contract with name " + name
              + ".");
    }
  }
View Full Code Here

          .getResource("/WEB-INF/non-core-contracts.xml")
          .openStream(), "xml");
      process.run();
      List<MonadMessage> errors = process.getErrors();
      if (!errors.isEmpty()) {
        throw new InternalException(errors.get(0).getDescription());
      }
    } catch (UnsupportedEncodingException e) {
      throw new InternalException(e);
    } catch (IOException e) {
      throw new InternalException(e);
    }
  }
View Full Code Here

  }

  protected void internalUpdate(Provider provider, String name,
      String chargeScript) throws HttpException {
    if (provider.getRole().getCode() != MarketRole.NON_CORE_ROLE) {
      throw new InternalException(
          "The provider must be of type Z for a non-core service.");
    }
    super.internalUpdate(name, chargeScript);
    setParty(provider);
  }
View Full Code Here

TOP

Related Classes of net.sf.chellow.monad.InternalException

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.