[rules-dev] JIRA JBRULES-1290

Jervis Liu jliu at redhat.com
Fri May 9 07:42:17 EDT 2008


Hi team,

I am currently working on JIRA
http://jira.jboss.com/jira/browse/JBRULES-1290 (BRMS does not allow rule
names to contain an apostrophe character ( ' )). The problem is caused 
by using rule name inputted by users as the name to add a node, see 
below (in PackageItem.java):

Node rulesFolder = this.node.getNode( ASSET_FOLDER_NAME );
ruleNode = rulesFolder.addNode( assetName, AssetItem.RULE_NODE_TYPE_NAME);

The javax.jcr.Node.addNode(String relPath, String primaryNodeTypeName) 
method will through RepositoryException if the relPath parameter 
contains apostrophe character ( ' ). Had a quick check with JSR-170, it 
is true that apostrophe character ( ' ) is not allowed in a path name. 
  Section 4.6:

char ::= nonspace | ' '
nonspace ::= (* Any Unicode character except: '/', ':', '[', ']', '*', 
''', '"', '|' or any whitespace
character *)

There are two possible ways I can think of to have this fixed, none of 
them are ideal though.

a. We valid the rule name inputted by users, the validation rule is in 
line with JSR-170. This approach is not ideal because a rule named 
"Jervis' rule" is perfect valid in my opinion.

b. Somehow we transform the rule name to sth else if it is not a valid 
relative path according to JSR-170. This approach may require a data 
structure somewhere to store the original rule name and transformed 
relative path name. As I am pretty new to Drools, I am not sure how to 
best get this done.

Any thoughts or suggestions are highly welcome.

Cheers,
Jervis Liu



More information about the rules-dev mailing list