[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1290) BRMS does not allow rule names to contain an apostrophe character ( ' )
Michael Neale (JIRA)
jira-events at lists.jboss.org
Mon May 12 02:19:22 EDT 2008
[ http://jira.jboss.com/jira/browse/JBRULES-1290?page=comments#action_12412429 ]
Michael Neale commented on JBRULES-1290:
----------------------------------------
Jervis wrote:
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.
> BRMS does not allow rule names to contain an apostrophe character ( ' )
> -----------------------------------------------------------------------
>
> Key: JBRULES-1290
> URL: http://jira.jboss.com/jira/browse/JBRULES-1290
> Project: JBoss Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: drools-brms
> Affects Versions: 4.0.2
> Reporter: Phil Verghese
> Assigned To: Jervis Liu
> Fix For: 4.0.8
>
>
> Rules with apostrophe characters are rejected by the BRMS. For example the rule name "Set employee's wage" works outside BRMS, but does not work in BRMS.
> If you attempt to enter a rule through the BRMS containing an apostrophe,the error stack trace says "An error occurred executing the action.
> Details
> com.google.gwt.user.client.rpc.SerializableException:
> javax.jcr.RepositoryException: failed to resolve path Set employee's relative to /drools:repository/drools:package_area/com.example/assets: Invalid name: Set employee's wage: Invalid name: Set employee's wage at
> org.drools.brms.server.ServiceImplementation.createNewRule(ServiceImplementation.java:166)..."
> If you attempt to import a .drl file with a rule that has an apostrophe in the title, you'll get this error message
> (including the <pre> tags): "Unable to import into the package. [<pre>Unable to process import: javax.jcr.RepositoryException: failed
> to resolve path Set employee's wage relative to /drools:repository/drools:package_area/com.soi/assets: Invalid name: Set employee's wage: Invalid name: Set employee's wage</pre>]".
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list