{"record":{"id":"dc1ed4b8fb8fb05e","repo":"pentaho/pentaho-kettle","slug":"wrong-value-conversion-to","errorCode":null,"errorMessage":"Wrong value conversion to ","messagePattern":"Wrong value conversion to ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/RowMetaAndData.java","lineNumber":337,"sourceCode":"    throws KettleValueException {\n    if ( String.class.isAssignableFrom( destinationType ) ) {\n      return converter.string2string( vs );\n    } else if ( int.class.isAssignableFrom( destinationType ) ) {\n      return converter.string2intPrimitive( vs );\n    } else if ( Integer.class.isAssignableFrom( destinationType ) ) {\n      return converter.string2integer( vs );\n    } else if ( long.class.isAssignableFrom( destinationType ) ) {\n      return converter.string2longPrimitive( vs );\n    } else if ( Long.class.isAssignableFrom( destinationType ) ) {\n      return converter.string2long( vs );\n    } else if ( boolean.class.isAssignableFrom( destinationType ) ) {\n      return converter.string2booleanPrimitive( vs );\n    } else if ( Boolean.class.isAssignableFrom( destinationType ) ) {\n      return converter.string2boolean( vs );\n    } else if ( destinationType.isEnum() ) {\n      return converter.string2enum( destinationType, vs );\n    } else {\n      throw new RuntimeException( \"Wrong value conversion to \" + destinationType );\n    }\n  }\n\n  /**\n   * Returns value as specified java type using converter. Used for metadata injection.\n   */\n  public Object getAsJavaType( String valueName, Class<?> destinationType, InjectionTypeConverter converter )\n    throws KettleValueException {\n    int idx = rowMeta.indexOfValue( valueName );\n    if ( idx < 0 ) {\n      throw new KettleValueException( \"Unknown column '\" + valueName + \"'\" );\n    }\n\n    ValueMetaInterface metaType = rowMeta.getValueMeta( idx );\n    // find by source value type\n    switch ( metaType.getType() ) {\n      case ValueMetaInterface.TYPE_STRING:\n        String vs = rowMeta.getString( data, idx );","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/RowMetaAndData.java#L319-L355","documentation":"getStringAsJavaType() converts a String value to a requested Java type via an InjectionTypeConverter during metadata injection. If destinationType is not one of the supported targets (String primitives, Boolean, enums, etc.), it throws a RuntimeException naming the type. It's a fail-fast guard for unsupported injection target types.","triggerScenarios":"Calling getAsJavaType (via setProperty) with a destinationType that falls through all isAssignableFrom checks in getStringAsJavaType — e.g. a non-String source field being injected into a destination type like Date, Map, List, or a primitive other than the supported ones.","commonSituations":"Metadata injection into a step whose setter expects a type (e.g. java.util.Date, BigDecimal, array) that the converter has no string conversion for; changing a field's Java type in a custom step without updating injection support.","solutions":["Change the target property's Java type to a supported one (String, boolean/Boolean, int/Integer, enum)","Register/extend the InjectionTypeConverter to support the destination type","Convert the value manually before injection (e.g. pre-parse the string to the needed type)","Catch RuntimeException around the injection call and report the unsupported type"],"exampleFix":"// before\ninjection.setProperty(\"format\", someDate, Date.class);\n// after\ninjection.setProperty(\"format\", someDate, String.class);","handlingStrategy":"type-guard","validationCode":"boolean isSupportedStringDestination(Class<?> t) {\n  return String.class.isAssignableFrom(t) || t == boolean.class || Boolean.class.isAssignableFrom(t)\n    || (t.isEnum());\n}","typeGuard":"boolean isSupportedStringDestination(Class<?> t) {\n  return String.class.isAssignableFrom(t) || t == boolean.class\n    || Boolean.class.isAssignableFrom(t) || t.isEnum();\n}","tryCatchPattern":"try {\n  Object v = row.getAsJavaType(name, destType, converter);\n} catch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Wrong value conversion\")) {\n    log.error(\"Unsupported destination type \" + destType + \" for field \" + name, e);\n  } else throw e;\n}","preventionTips":["Map injection targets only to String, boolean/Boolean, int/Integer, and enum destination types","Keep step setter types aligned with converter capabilities","Write a unit test that injects every mapped field with its declared type"],"tags":["kettle","metadata-injection","type-conversion","unsupported-type"],"backgroundTag":"unsupported-operation","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}