Package com.jdroid.java.exception

Examples of com.jdroid.java.exception.UnexpectedException


   */
  public static List<String> fromCSV(File csvFile) {
    try {
      return CSVUtils.fromCSV(new FileInputStream(csvFile));
    } catch (IOException exception) {
      throw new UnexpectedException("Error reading the file: " + csvFile, exception);
    }
  }
View Full Code Here


        return result;
      } finally {
        csvReader.close();
      }
    } catch (IOException exception) {
      throw new UnexpectedException("Error reading the csv", exception);
    }
  }
View Full Code Here

      String fileName = "csv_file" + DateUtils.now().getTime();
      File file = File.createTempFile(fileName, ".csv");
      CSVUtils.writeCSV(new FileOutputStream(file), values);
      return file;
    } catch (IOException exception) {
      throw new UnexpectedException("Error creating a temporal file to write the csv values", exception);
    }
  }
View Full Code Here

    try {
      CSVWriter csvWriter = new CSVWriter(writer, separator, CSVWriter.NO_QUOTE_CHARACTER, StringUtils.EMPTY);
      csvWriter.writeNext(valueConverter.toArray(values));
      csvWriter.close();
    } catch (IOException exception) {
      throw new UnexpectedException("Error writing the values", exception);
    }
  }
View Full Code Here

      // all the values will be quoted
      CSVWriter csvWriter = new CSVWriter(writer);
      csvWriter.writeNext(values.toArray(new String[] {}));
      csvWriter.close();
    } catch (IOException exception) {
      throw new UnexpectedException("Error writing the values", exception);
    }
  }
View Full Code Here

      String fileName = "csv_file" + DateUtils.now().getTime();
      File file = File.createTempFile(fileName, ".csv");
      CSVUtils.writeMultipleColumnCSV(new FileOutputStream(file), values);
      return file;
    } catch (IOException exception) {
      throw new UnexpectedException("Error creating a temporal file to write the csv values", exception);
    }
  }
View Full Code Here

    try {
      CSVWriter csvWriter = new CSVWriter(writer, CSVWriter.DEFAULT_SEPARATOR, CSVWriter.NO_QUOTE_CHARACTER);
      csvWriter.writeAll(values);
      csvWriter.close();
    } catch (IOException exception) {
      throw new UnexpectedException("Error writing the values", exception);
    }
  }
View Full Code Here

   * @param endDate Date range's end date.
   */
  public DateRange(Date startDate, Date endDate) {
   
    if ((startDate != null) && (endDate != null) && DateUtils.isAfter(startDate, endDate)) {
      throw new UnexpectedException("The end date must be after start date.");
    }
    this.startDate = startDate;
    this.endDate = endDate;
  }
View Full Code Here

      return (T)PropertyUtils.getNestedProperty(from, propertyName);
    } catch (NestedNullException exception) {
      // if any the nested objects is null we return null as value
      return null;
    } catch (Exception ex) {
      throw new UnexpectedException("Error getting the property: '" + propertyName + "' of: " + from);
    }
  }
View Full Code Here

   
    this.page = page != null ? page : DEFAULT_PAGE;
    this.size = size != null ? size : DEFAULT_PAGE_SIZE;
   
    if (this.page < 1) {
      throw new UnexpectedException("Wrong page [" + page + "]");
    }
   
    if (this.size < 1) {
      throw new UnexpectedException("Wrong page size [" + size + "]");
    }
  }
View Full Code Here

TOP

Related Classes of com.jdroid.java.exception.UnexpectedException

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.