Skip to content

Commit

Permalink
Add logging to detect nullpointers if plan variable is not initialized (
Browse files Browse the repository at this point in the history
  • Loading branch information
wederbn authored Jan 31, 2020
1 parent 6a3bbce commit 0d45cea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public static String getMethodAttributeValue(ExtensionContext context, Element e
public static String resolveVariableValueReference(ExtensionContext context,
String variableValueReference) throws FaultException {
String variableValue = variableValueReference;
logger.debug("Resolving variable value reference for: {}", variableValueReference);

// Check if a concrete variable name ("varName") or a reference to the value of
// a variable is specified ("$bpelVar[varName]")
Expand All @@ -268,6 +269,7 @@ public static String resolveVariableValueReference(ExtensionContext context,
int endIndexOfVarReference = variableValue.indexOf("]");

String variableName = variableValue.substring(startIndexOfVarReference + VARIABLE_VALUE_REFERENCE.length(), endIndexOfVarReference);
logger.debug("Found variable name to resolve: {}", variableName);

String prefix = variableValue.startsWith(VARIABLE_VALUE_REFERENCE) ? "" : variableValue.substring(0, startIndexOfVarReference);
String suffix = variableValue.length() > endIndexOfVarReference + 1 ? variableValue.substring(endIndexOfVarReference + 1) : "";
Expand All @@ -277,10 +279,12 @@ public static String resolveVariableValueReference(ExtensionContext context,
// We only support simple type variables, therefore the value of the variable is
// directly provided within a <temporary-simple-type-wrapper/> element.
if (variable != null && isSimpleType(variable.type)) {
logger.debug("Variable is of simple type and can be resolved!");
Node variableContent = context.readVariable(variableName);

if (variableContent.getTextContent() != null) {
// Return the value of the variable plus the optionally specified prefix and suffix as result
// Return the value of the variable plus the optionally specified prefix and suffix as result
logger.debug("Replacing variable with following value: {}", variableContent.getTextContent());
variableValue = prefix + variableContent.getTextContent() + suffix;
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,17 @@
<repository>
<id>1_wso2</id>
<name>WSO2 Repository</name>
<url>http://dist.wso2.org/maven2/</url>
<url>https://dist.wso2.org/maven2/</url>
</repository>
<repository>
<id>2_central</id>
<name>Maven Central Repository</name>
<url>http://central.maven.org/maven2/</url>
<url>https://central.maven.org/maven2/</url>
</repository>
<repository>
<id>3_vanto</id>
<name>Vanto Maven Repository</name>
<url>http://people.apache.org/~vanto/m2/</url>
<url>https://people.apache.org/~vanto/m2/</url>
</repository>
</repositories>

Expand Down
4 changes: 2 additions & 2 deletions repositories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

repositories.remote << "http://repo1.maven.org/maven2"
repositories.remote << "http://people.apache.org/~vanto/m2/"
repositories.remote << "https://repo1.maven.org/maven2"
repositories.remote << "https://people.apache.org/~vanto/m2/"

0 comments on commit 0d45cea

Please sign in to comment.