Package org.supercsv.exception

Examples of org.supercsv.exception.NullInputException


* {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException {
  if( value == null ) {
    throw new NullInputException("Input cannot be null on line " + context.lineNumber + " at column "
      + context.columnNumber, context, this);
  }
  final Long result;
  if( value instanceof Long ) {
    result = (Long) value;
View Full Code Here


* @throws SuperCSVException
*             when the value is some value that cannot be translated into a boolean value {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber + " at column " + context.columnNumber, context, this); }
  final String sval = value.toString(); // cast
 
  String result;
  if( sval.length() <= maxSize ) {
    result = sval;
View Full Code Here

  // convert object array to strings and write them
  final String[] strarr = new String[content.length];
  int i = 0;
  for( final Object o : content ) {
    if( o == null ) {
      throw new NullInputException("Object at position " + i + " is null", new CSVContext(getLineNumber(), i),
        (Throwable) null);
    }
    strarr[i++] = o.toString();
  }
  write(strarr);
View Full Code Here

*             if none of the substrings are found in the input
* @return the argument value
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException, ClassCastException {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber + " at column " + context.columnNumber, context, this); }
  final String sval = value.toString(); // cast
 
  boolean found = false;
  for( final String required : requiredSubStrings ) {
    if( sval.indexOf(required) != -1 ) {
View Full Code Here

*             is the parameter value cannot be cast to a String
* @return the argument value if the value is unique
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException, ClassCastException {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber + " at column " + context.columnNumber, context, this); }
  // check for required hash
  if( !possibleValues.contains(value) ) {
   
    throw new SuperCSVException("Entry \"" + value + "\" on line " + context.lineNumber + " column "
      + context.columnNumber + " is not accepted as a possible value", context, this);
View Full Code Here

*             upon receiving a 'null' value
* @return the argument value transformed by next processors
*/
@Override
public Object execute(final Object value, final CSVContext context) {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber
    + " at column " + context.columnNumber, context, this); }
 
  return next.execute(value, context);
}
View Full Code Here

/**
* {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) throws NumberFormatException {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber + " at column " + context.columnNumber, context, this); }
  final String sval = value.toString(); // cast
  if( sval.length() < min || sval.length() > max ) { throw new SuperCSVException("Entry \"" + value + "\" on line "
    + context.lineNumber + " column " + context.columnNumber + " is not within the string sizes " + min + " - "
    + max, context, this); }
 
View Full Code Here

* {@inheritDoc}
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException {
  if( value == null ) {
    throw new NullInputException("Input cannot be null on line " + context.lineNumber + " at column "
      + context.columnNumber, context, this);
  }
 
  final Double result;
  if( value instanceof Double ) {
View Full Code Here

*             upon receiving a 'null' value or an empty string.
* @return the argument value transformed by next processors
*/
@Override
public Object execute(final Object value, final CSVContext context) {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber
    + " at column " + context.columnNumber, context, this); }
  if( value instanceof String ) {
    String svalue = (String) value;
    if( svalue.length() == 0 ) { throw new SuperCSVException("unexpected empty string", context, this); }
  } else {
View Full Code Here

*             is the parameter value cannot be cast to a String
* @return the argument value if the value is unique
*/
@Override
public Object execute(final Object value, final CSVContext context) throws SuperCSVException, ClassCastException {
  if( value == null ) { throw new NullInputException("Input cannot be null on line " + context.lineNumber + " at column " + context.columnNumber, context, this); }
  // check for required hash
  if( !requiredHashCodes.contains(value.hashCode()) ) {
    // create string of required hash'es for error msg
    final StringBuilder sb = new StringBuilder();
    for( final int hash : requiredHashCodes ) {
View Full Code Here

TOP

Related Classes of org.supercsv.exception.NullInputException

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.