Package com.uphea.exception

Examples of com.uphea.exception.UpheaException


  public byte[] readImage(String fileName) {
    File file = new File(appData.getImgRoot(), fileName);
    try {
      return fileLRUCache.getFileBytes(file);
    } catch (IOException ioex) {
      throw new UpheaException("Unable to read file " + fileName, ioex);
    }
  }
View Full Code Here


      System.out.println(file);
      try {
        FileUtil.writeBytes(new File(appData.getImgRoot(), question.getId() + ".jpg"), file.getFileContent());
      } catch (IOException ioex) {
        log.error("Unable to save uploaded file.", ioex);
        throw new UpheaException("Unable to save uploaded file.", ioex);
      }
    }
    return REDIRECT + alias(this, "view");
  }
View Full Code Here

   * Changes users password.
   */
  public User changePassword(User user, String currentPassword, String newPassword) {
    user = findUserById(user);
    if (!passwordEncoder.isPasswordValid(user.getHashpw(), currentPassword)) {
      throw new UpheaException();
    }
    user.setHashpw(passwordEncoder.encodePassword(newPassword));
    return appDao.store(user);
  }
View Full Code Here

    String sql;
    InputStream in = null;
    try {
      in = ClassLoaderUtil.getResourceAsStream(fileName);
      if (in == null) {
        throw new UpheaException(fileName + " not found.");
      }
      sql = FileUtil.readUTFString(in);
    } catch (IOException ioex) {
      throw new UpheaException(ioex);
    } finally {
      StreamUtil.close(in);
    }

    String[] queries = StringUtil.splitc(sql, ";");
View Full Code Here

    String sql;
    InputStream in = null;
    try {
      in = ClassLoaderUtil.getResourceAsStream(fileName);
      if (in == null) {
        throw new UpheaException(fileName + " not found.");
      }
      sql = FileUtil.readUTFString(in);
    } catch (IOException ioex) {
      throw new UpheaException(ioex);
    } finally {
      StreamUtil.close(in);
    }

View Full Code Here

TOP

Related Classes of com.uphea.exception.UpheaException

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.