[richfaces-issues] [JBoss JIRA] Created: (RF-4119) CDK's generates a table of InternetResources in component's renderer incorectly

Piotr Kawiak (JIRA) jira-events at lists.jboss.org
Fri Aug 8 05:00:49 EDT 2008


CDK's generates a table of InternetResources in component's renderer incorectly
-------------------------------------------------------------------------------

                 Key: RF-4119
                 URL: https://jira.jboss.org/jira/browse/RF-4119
             Project: RichFaces
          Issue Type: Bug
    Affects Versions: 3.2.2
            Reporter: Piotr Kawiak
            Priority: Trivial


<h:scripts>
    new org.ajax4jsf.javascript.PrototypeScript(),
    here goes another script
    and another one ...
</h:scripts>

that code, placed in .jspx template is used by cdk-plugin to generate component's renderer,
unfortunately, it won't work if developers use spaces instead of tabs for indentation.
The cause of that behaviour can be found in:

rg.ajax4jsf.templatecompiler.elements.vcp.HeaderResourceElement

while (tokenizer.hasMoreTokens()) {
	String token = tokenizer.nextToken();
	String path;
				
	if (token.startsWith(NEW)) {
		keyz.add(token);
		int idx = token.indexOf('(');
		if (idx != -1) {
			path = token.substring(0, idx).substring(NEW.length()).trim();
		} else {
			path = token.substring(NEW.length()).trim();
		}
	} else {
		keyz.add("getResource(\"" + token + "\")");
		path = token;
	}

	paths.add(path);
}

the token is simply not trimmed, and so the generated output looks like that:

getResource("        new org.ajax4jsf.javascript.PrototypeScript()")

which is incorrect. I would suggest putting following code right after calling tokenizer.nextToken():

token = trim.token();

that will solve the problem. I can commit that change to the trunk if needed.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list