Using special characters such as ( ) in "fromFileName" of CopyFile activity.

Using special characters such as ( ) in "fromFileName" of CopyFile activity.

book

Article ID: KB0093524

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Description:
If you use special characters such as ( ) in "fromFilename" field in CopyFile activity, then you will see the following exception.

java.util.regex.PatternSyntaxException: Unclosed group near index 13

Issue/Introduction

Using special characters such as ( ) in "fromFileName" of CopyFile activity.

Resolution

Use Character class from regex Pattern and surround the special characters with [ ] like the following:

Actual Input : C:/tmp/file(name).txt

Correct Input as per Regex : C:/tmp/file[(]name[)].txt

This is needed as BW uses regex to parse the input file name for CopyFile activity.



Additional Information

https://docs.oracle.com/javase/tutorial/essential/regex/char_classes.html

f you browse through the Pattern class specification, you will see tables summarizing the supported regular expression constructs. In the "Character Classes" section you will find the following:

ConstructDescription
[abc]a, b, or c (simple class)
[^abc]Any character except a, b, or c (negation)
[a-zA-Z]a through z, or A through Z, inclusive (range)
[a-d[m-p]]a through d, or m through p: [a-dm-p] (union)
[a-z&&[def]]d, e, or f (intersection)
[a-z&&[^bc]]a through z, except for b and c: [ad-z] (subtraction)
[a-z&&[^m-p]]a through z, and not m through p: [a-lq-z] (subtraction)