Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/metron/pull/884#discussion_r159495486
--- Diff:
metron-platform/metron-management/src/main/java/org/apache/metron/management/ShellFunctions.java
---
@@ -90,19 +95,19 @@ public Object apply(List<Object> args) {
@Override
public Object apply(List<Object> args, Context context) throws
ParseException {
- Map<String, StellarExecutor.VariableResult> variables = (Map<String,
StellarExecutor.VariableResult>)
context.getCapability(StellarExecutor.SHELL_VARIABLES).get();
+ Map<String, VariableResult> variables = getVariables(context);
String[] headers = {"VARIABLE", "VALUE", "EXPRESSION"};
String[][] data = new String[variables.size()][3];
int wordWrap = -1;
if(args.size() > 0) {
wordWrap = ConversionUtils.convert(args.get(0), Integer.class);
}
int i = 0;
- for(Map.Entry<String, StellarExecutor.VariableResult> kv :
variables.entrySet()) {
- StellarExecutor.VariableResult result = kv.getValue();
+ for(Map.Entry<String, VariableResult> kv : variables.entrySet()) {
+ VariableResult result = kv.getValue();
data[i++] = new String[] { toWrappedString(kv.getKey().toString(),
wordWrap)
, toWrappedString(result.getResult(),
wordWrap)
- , toWrappedString(result.getExpression(),
wordWrap)
+ ,
toWrappedString(result.getExpression().get(), wordWrap)
--- End diff --
The VariableResult.expression field is now optional. We are not always
know the expression that resulted in a value. The ShellFunctions just needed
updated to treat this as an Optional.
---