Skip to content

Commit

Permalink
Add Constants transform does not support Internet Address type apache…
Browse files Browse the repository at this point in the history
  • Loading branch information
nadment committed Mar 13, 2024
1 parent 0220cae commit 592da1e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.hop.pipeline.transform.TransformMeta;

import java.math.BigDecimal;
import java.net.InetAddress;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -81,7 +82,7 @@ public static final RowMetaAndData buildRow(
String stringValue = field.getValue();

// If the value is empty: consider it to be NULL.
if (stringValue == null || stringValue.length() == 0) {
if (stringValue == null || stringValue.isEmpty() ) {
rowData[i] = null;

if (value.getType() == IValueMeta.TYPE_NONE) {
Expand Down Expand Up @@ -205,7 +206,18 @@ public static final RowMetaAndData buildRow(
remarks.add(new CheckResult(ICheckResult.TYPE_RESULT_ERROR, message, null));
}
break;


case IValueMeta.TYPE_INET:
try {
rowData[i] = InetAddress.getByName(stringValue);
} catch (Exception e) {
String message =
BaseMessages.getString(PKG, "Constant.BuildRow.Error.Parsing.InternetAddress",
value.getName(), stringValue, e.toString());
remarks.add(new CheckResult(ICheckResult.TYPE_RESULT_ERROR, message, null));
}
break;

default:
String message =
BaseMessages.getString(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Constant.BuildRow.Error.Parsing.Date=Couldn''t parse Date field [{0}] with value
Constant.BuildRow.Error.Parsing.Integer=Couldn''t parse Integer field [{0}] with value [{1}] --> {2}
Constant.BuildRow.Error.Parsing.BigNumber=Couldn''t parse BigNumber field [{0}] with value [{1}] --> {2}
Constant.BuildRow.Error.Parsing.Timestamp=Couldn''t parse Timestamp field [{0}] with value [{1}] --> {2}
Constant.BuildRow.Error.Parsing.InternetAddress=Couldn''t parse Internet Address field [{0}] with value [{1}] --> {2}
ConstantDialog.Value.SetEmptyString=Set empty string?
ConstantMeta.Injection.Fields=Fields
ConstantMeta.Injection.Field=Field
Expand Down

0 comments on commit 592da1e

Please sign in to comment.