Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

NullPointer exception in TableView when trying to sort

$
0
0
Hello

I have created a custom ValueMeta plugin that is working great except for some small issues.

Any time I try to sort rows that contain this custom ValueMeta using the Preview Data tab, I get a null pointer exception.

I have mostly narrowed it down to this method in ValueMetaBase -

Code:

  @Override
  public Object convertDataUsingConversionMetaData( Object data ) throws KettleValueException {
    if ( conversionMetadata == null ) {
      throw new KettleValueException(
          "API coding error: please specify the conversion metadata before attempting to convert value " + name );
    }


    switch ( conversionMetadata.getType() ) {
      case TYPE_STRING:
        return getString( data );
      case TYPE_INTEGER:
        return getInteger( data );
      case TYPE_NUMBER:
        return getNumber( data );
      case TYPE_DATE:
        return getDate( data );
      case TYPE_BIGNUMBER:
        return getBigNumber( data );
      case TYPE_BOOLEAN:
        return getBoolean( data );
      case TYPE_BINARY:
        return getBinary( data );
      default:
        throw new KettleValueException( toString() + " : I can't convert the specified value to data type : "
            + storageMetadata.getType() );
    }
  }

Since it is a custom ValueMeta the switch case falls through to default where the
Code:

storageMetadata
is null.
I have Overrided
Code:

convertDataUsingConversionMetaData(Object object)
method in my ValueMeta plugin to handle this particular case.

This overrided method is never executed because of line @1293 in TableView:
Code:

r[j + 2] = sourceValueMeta.convertDataUsingConversionMetaData( data );
sourceValueMeta is always String (everything is converted to string). and defaults to ValueMetaBase for conversions.

What can I do to fix these issues ?
Have I misunderstood
Code:

convertDataUsingConversionMetaData
method's purpose .. ?

I would appreciate your input!

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>