Fixed code according to requested reviews
@@ -27,7 +27,6 @@ import org.apache.hop.core.exception.HopDatabaseException;
import org.apache.hop.core.exception.HopException;
import org.apache.hop.core.exception.HopTransformException;
import org.apache.hop.core.exception.HopXmlException;
-import org.apache.hop.core.injection.InjectionSupported;
import org.apache.hop.core.row.IRowMeta;
import org.apache.hop.core.row.IValueMeta;
import org.apache.hop.core.row.RowDataUtil;
@@ -157,10 +156,12 @@ public class TableInputMeta extends BaseTransformMeta
DatabaseMeta databaseMeta = null;
try {
- databaseMeta = metadataProvider.getSerializer(DatabaseMeta.class).load(variables.resolve(connection));
+ databaseMeta =
+ metadataProvider.getSerializer(DatabaseMeta.class).load(variables.resolve(connection));
} catch (HopException e) {
throw new HopTransformException(
- "Unable to get databaseMeta for connection: " + Const.CR + variables.resolve(connection), e);
+ "Unable to get databaseMeta for connection: " + Const.CR + variables.resolve(connection),
+ e);
}
Database db = new Database(loggingObject, variables, databaseMeta);
@@ -234,12 +235,12 @@ public class TableInputMeta extends BaseTransformMeta
}
@Override
- public void loadXml(Node transformNode, IHopMetadataProvider metadataProvider) throws HopXmlException {
+ public void loadXml(Node transformNode, IHopMetadataProvider metadataProvider)
+ throws HopXmlException {
super.loadXml(transformNode, metadataProvider);
IStream infoStream = getTransformIOMeta().getInfoStreams().get(0);
infoStream.setSubject(lookup);
-
}
@Override
@@ -258,23 +259,24 @@ public class TableInputMeta extends BaseTransformMeta
DatabaseMeta databaseMeta = null;
try {
- databaseMeta = metadataProvider.getSerializer(DatabaseMeta.class).load(variables.resolve(connection));
+ databaseMeta =
+ metadataProvider.getSerializer(DatabaseMeta.class).load(variables.resolve(connection));
} catch (HopException e) {
cr =
new CheckResult(
ICheckResult.TYPE_RESULT_ERROR,
BaseMessages.getString(
- PKG, "TableInputMeta.CheckResult.DatabaseMetaError", variables.resolve(connection)),
+ PKG,
+ "TableInputMeta.CheckResult.DatabaseMetaError",
+ variables.resolve(connection)),
transformMeta);
remarks.add(cr);
-
}
if (databaseMeta != null) {
cr = new CheckResult(ICheckResult.TYPE_RESULT_OK, "Connection exists", transformMeta);
remarks.add(cr);
-
Database db = new Database(loggingObject, variables, databaseMeta);
super.databases = new Database[] {db}; // keep track of it for canceling purposes...
@@ -446,15 +448,10 @@ public class TableInputMeta extends BaseTransformMeta
IHopMetadataProvider metadataProvider)
throws HopTransformException {
-
- DatabaseMeta databaseMeta = null;
-
try {
- databaseMeta = metadataProvider.getSerializer(DatabaseMeta.class).load(variables.resolve(connection));
- } catch (HopException e) {
- throw new HopTransformException(
- "Unable to get databaseMeta for connection: " + Const.CR + variables.resolve(connection), e);
- }
+ DatabaseMeta databaseMeta =
+ metadataProvider.getSerializer(DatabaseMeta.class).load(variables.resolve(connection));
+
// Find the lookupfields...
IRowMeta out = new RowMeta();
// TODO: this builds, but does it work in all cases.
@@ -479,6 +476,11 @@ public class TableInputMeta extends BaseTransformMeta
impact.add(ii);
}
}
+ } catch (HopException e) {
+ throw new HopTransformException(
+ "Unable to get databaseMeta for connection: " + Const.CR + variables.resolve(connection),
+ e);
+ }
}
/** @return Returns the variableReplacementActive. */
