Author: Alex.Kolonitsky
Date: 2010-04-20 12:24:24 -0400 (Tue, 20 Apr 2010)
New Revision: 16781
Modified:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java
root/framework/trunk/impl/src/main/java/org/richfaces/context/PreRenderViewListener.java
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CSSCompiler.java
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
root/framework/trunk/impl/src/main/java/org/richfaces/util/Util.java
Log:
fix checkstyle
Modified:
root/framework/trunk/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java 2010-04-20
16:12:31 UTC (rev 16780)
+++
root/framework/trunk/impl/src/main/java/org/ajax4jsf/resource/Java2Dresource.java 2010-04-20
16:24:24 UTC (rev 16781)
@@ -29,7 +29,6 @@
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
-import javax.faces.application.ResourceHandler;
import javax.faces.component.StateHolder;
import javax.faces.context.FacesContext;
import javax.imageio.ImageIO;
@@ -149,7 +148,6 @@
* generated to render IMG's width and height Subclasses should override
* this method to provide correct sizes of rendered images
*
- * @param facesContext
* @return dimensions of the image to be displayed on page
*/
public abstract Dimension getDimension();
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/context/PreRenderViewListener.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/context/PreRenderViewListener.java 2010-04-20
16:12:31 UTC (rev 16780)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/context/PreRenderViewListener.java 2010-04-20
16:24:24 UTC (rev 16781)
@@ -21,6 +21,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+import org.ajax4jsf.context.ContextInitParameters;
+
import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
@@ -28,10 +30,6 @@
import javax.faces.event.SystemEvent;
import javax.faces.event.SystemEventListener;
-import org.ajax4jsf.context.ContextInitParameters;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-
/**
* This class used for determining what standard skinning resources should be encoded.
* Implements SystemEventListener and reacts on PreRenderViewEvent
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2010-04-20
16:12:31 UTC (rev 16780)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/renderkit/html/BaseGradient.java 2010-04-20
16:24:24 UTC (rev 16781)
@@ -22,17 +22,18 @@
package org.richfaces.renderkit.html;
import org.ajax4jsf.resource.Java2Dresource;
-import org.ajax4jsf.util.HtmlColor;
-import org.ajax4jsf.util.HtmlDimensions;
import org.ajax4jsf.util.NumericDataInputStream;
import org.ajax4jsf.util.NumericDataOutputStream;
import org.richfaces.renderkit.html.images.GradientType;
import org.richfaces.renderkit.html.images.GradientType.BiColor;
import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
import javax.faces.context.FacesContext;
-import java.awt.*;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/resource/CSSCompiler.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CSSCompiler.java 2010-04-20
16:12:31 UTC (rev 16780)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CSSCompiler.java 2010-04-20
16:24:24 UTC (rev 16781)
@@ -1,5 +1,21 @@
package org.richfaces.resource;
+import com.steadystate.css.parser.CSSOMParser;
+import org.richfaces.log.RichfacesLogger;
+import org.slf4j.Logger;
+import org.w3c.css.sac.InputSource;
+import org.w3c.dom.css.CSSImportRule;
+import org.w3c.dom.css.CSSRule;
+import org.w3c.dom.css.CSSRuleList;
+import org.w3c.dom.css.CSSStyleDeclaration;
+import org.w3c.dom.css.CSSStyleRule;
+import org.w3c.dom.css.CSSStyleSheet;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.ValueExpression;
+import javax.faces.application.Resource;
+import javax.faces.context.FacesContext;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -10,98 +26,81 @@
import java.util.List;
import java.util.regex.Pattern;
-import javax.el.ELContext;
-import javax.el.ELException;
-import javax.el.ValueExpression;
-import javax.faces.application.Resource;
-import javax.faces.context.FacesContext;
+public final class CSSCompiler {
-import org.ajax4jsf.util.ELUtils;
-import org.richfaces.log.RichfacesLogger;
-import org.slf4j.Logger;
-import org.w3c.css.sac.InputSource;
-import org.w3c.dom.css.CSSImportRule;
-import org.w3c.dom.css.CSSRule;
-import org.w3c.dom.css.CSSRuleList;
-import org.w3c.dom.css.CSSStyleDeclaration;
-import org.w3c.dom.css.CSSStyleRule;
-import org.w3c.dom.css.CSSStyleSheet;
+ private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
+ private static final String INVALID_RESOURCE_FORMAT_COLON_ERROR =
+ "Invalid resource format. Property ''{0}'' contains
more than one colon (:).";
+ private static final String INVALID_RESOURCE_FORMAT_NO_LIBRARY_NAME_ERROR =
+ "Invalid resource format. Property ''{0}'' cannot be
parsed to extract resource name and library name.";
+ private static final String INVALID_RESOURCE_FORMAT_ERROR =
+ "Invalid resource format. Property ''{0}'' cannot be
parsed.";
-import com.steadystate.css.parser.CSSOMParser;
+ private CSSCompiler() {
+ }
-public class CSSCompiler {
-
- private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
- private static final String INVALID_RESOURCE_FORMAT_COLON_ERROR =
- "Invalid resource format. Property ''{0}'' contains more
than one colon (:).";
- private static final String INVALID_RESOURCE_FORMAT_NO_LIBRARY_NAME_ERROR =
- "Invalid resource format. Property ''{0}'' cannot be parsed
to extract resource name and library name.";
- private static final String INVALID_RESOURCE_FORMAT_ERROR =
- "Invalid resource format. Property ''{0}'' cannot be
parsed.";
- public static InputStream parse(Resource resource) throws IOException {
- FacesContext ctx = FacesContext.getCurrentInstance();
+ public static InputStream parse(Resource resource) throws IOException {
+ FacesContext ctx = FacesContext.getCurrentInstance();
InputStream stream = new BufferedInputStream(
- new ELEvaluatingInputStream(ctx,
- resource,
- resource.getInputStream()));
- StringBuilder main = new StringBuilder();
- try {
- InputSource source = new InputSource(new InputStreamReader(stream));
- CSSOMParser parser = new CSSOMParser();
- // parse and create a stylesheet composition
- CSSStyleSheet stylesheet = parser.parseStyleSheet(source, null,null);
+ new ELEvaluatingInputStream(ctx,
+ resource,
+ resource.getInputStream()));
+ StringBuilder main = new StringBuilder();
+ try {
+ InputSource source = new InputSource(new InputStreamReader(stream));
+ CSSOMParser parser = new CSSOMParser();
+ // parse and create a stylesheet composition
+ CSSStyleSheet stylesheet = parser.parseStyleSheet(source, null, null);
- // now iterate through the dom and inspect.
+ // now iterate through the dom and inspect.
- CSSRuleList ruleList = stylesheet.getCssRules();
- for (int i = 0; i < ruleList.getLength(); i++) {
- CSSRule rule = ruleList.item(i);
- if(rule instanceof CSSImportRule){
+ CSSRuleList ruleList = stylesheet.getCssRules();
+ for (int i = 0; i < ruleList.getLength(); i++) {
+ CSSRule rule = ruleList.item(i);
+ if (rule instanceof CSSImportRule) {
main.append(rule.getCssText());
main.append("\r\n");
- }else if (rule instanceof CSSStyleRule) {
- CSSStyleRule styleRule = (CSSStyleRule) rule;
- boolean needAppendSelector = false;
- StringBuilder selector = new StringBuilder();
- selector.append(styleRule.getSelectorText());
- CSSStyleDeclaration styleDeclaration = styleRule.getStyle();
- selector.append("{" + "\r\n");
- for (int j = 0; j < styleDeclaration.getLength(); j++) {
- String property = styleDeclaration.item(j);
- String value = styleDeclaration.getPropertyCSSValue(property).getCssText();
- if(value.startsWith("\"")){
- //Remove quotas
- value = value.substring(1, value.length()-1);
- }
- if(value != null && value.trim().length() > 0 &&
!value.equals("\"\"")){
- //One of properties of selector is not empty
- needAppendSelector = true;
- selector.append("\t" + property + ":");
- selector.append(value + ";" + "\r\n");
- }
- }
- selector.append("}" + "\r\n");
- if(needAppendSelector){
- main.append(selector);
- }
- }// end of StyleRule instance test
- } // end of ruleList loop
+ } else if (rule instanceof CSSStyleRule) {
+ CSSStyleRule styleRule = (CSSStyleRule) rule;
+ boolean needAppendSelector = false;
+ StringBuilder selector = new StringBuilder();
+ selector.append(styleRule.getSelectorText());
+ CSSStyleDeclaration styleDeclaration = styleRule.getStyle();
+ selector.append("{" + "\r\n");
+ for (int j = 0; j < styleDeclaration.getLength(); j++) {
+ String property = styleDeclaration.item(j);
+ String value =
styleDeclaration.getPropertyCSSValue(property).getCssText();
+ if (value.startsWith("\"")) {
+ //Remove quotas
+ value = value.substring(1, value.length() - 1);
+ }
+ if (value != null && value.trim().length() > 0
&& !value.equals("\"\"")) {
+ //One of properties of selector is not empty
+ needAppendSelector = true;
+ selector.append("\t" + property + ":");
+ selector.append(value + ";" + "\r\n");
+ }
+ }
+ selector.append("}" + "\r\n");
+ if (needAppendSelector) {
+ main.append(selector);
+ }
+ }// end of StyleRule instance test
+ } // end of ruleList loop
- if (stream != null){
- stream.close();
- }
- new ByteArrayInputStream(main.toString().getBytes());
- return new ByteArrayInputStream(main.toString().getBytes("US-ASCII"));
- }
+ if (stream != null) {
+ stream.close();
+ }
+ new ByteArrayInputStream(main.toString().getBytes());
+ return new
ByteArrayInputStream(main.toString().getBytes("US-ASCII"));
+ } catch (IOException ioe) {
+ LOGGER.warn("IO Error: " + ioe + "while evaluating dynamic
CSS");
+ } catch (Exception e) {
+ LOGGER.warn("Error: " + e + "while evaluating dynamic
CSS");
+ }
+ return null;
+ }
- catch (IOException ioe) {
- LOGGER.warn("IO Error: " + ioe + "while evaluating dynamic CSS");
- } catch (Exception e) {
- LOGGER.warn("Error: " + e + "while evaluating dynamic CSS");
- }
- return null;
- }
-
private static final class ELEvaluatingInputStream extends InputStream {
// Premature optimization is the root of all evil. Blah blah.
@@ -112,6 +111,7 @@
private FacesContext ctx;
private Resource info;
+ private int nextRead = -1;
// ---------------------------------------------------- Constructors
@@ -178,12 +178,9 @@
return i;
}
-
- private int nextRead = -1;
-
-
private void readExpressionIntoBufferAndEvaluateIntoBuffer()
- throws IOException {
+ throws IOException {
+
int i;
char c;
do {
@@ -205,24 +202,26 @@
* expressionResult;
*/
private void evaluateExpressionIntoBuffer() {
- char chars[] = new char[buf.size()];
- for (int i = 0, len = buf.size(); i < len; i++) {
+ char [] chars = new char[buf.size()];
+ int len = buf.size();
+ for (int i = 0; i < len; i++) {
chars[i] = (char) (int) buf.get(i);
}
String expressionBody = new String(chars);
- int colon;
+
// If this expression contains a ":"
- if (-1 != (colon = expressionBody.indexOf(":"))) {
+ int colon = expressionBody.indexOf(":");
+ if (-1 != colon) {
// Make sure it contains only one ":"
if (!isPropertyValid(expressionBody)) {
String message =
MessageFormat.format(INVALID_RESOURCE_FORMAT_COLON_ERROR,
- expressionBody);
+ expressionBody);
throw new ELException(message);
}
String[] parts = split(expressionBody, ":");
if (null == parts[0] || null == parts[1]) {
String message =
MessageFormat.format(INVALID_RESOURCE_FORMAT_NO_LIBRARY_NAME_ERROR,
- expressionBody);
+ expressionBody);
throw new ELException(message);
}
@@ -235,32 +234,32 @@
mark = parts[1].indexOf("]") - 1;
parts[1] = parts[1].substring(0, mark);
expressionBody = "resource[" + quoteMark + parts[0] +
- ":" + parts[1] + quoteMark +
"]";
+ ":" + parts[1] + quoteMark + "]";
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
String message = MessageFormat.format(INVALID_RESOURCE_FORMAT_ERROR,
- expressionBody);
+ expressionBody);
throw new ELException(message);
}
}
ELContext elContext = ctx.getELContext();
ValueExpression ve =
- ctx.getApplication().getExpressionFactory().
- createValueExpression(elContext, "#{" + expressionBody
+
- "}", String.class);
+ ctx.getApplication().getExpressionFactory().
+ createValueExpression(elContext, "#{" +
expressionBody +
+ "}", String.class);
Object value = ve.getValue(elContext);
String expressionResult = ((value != null) ? value.toString() :
"");
buf.clear();
- for (int i = 0, len = expressionResult.length(); i < len; i++) {
+ int expressionResultLen = expressionResult.length();
+ for (int i = 0; i < expressionResultLen; i++) {
buf.add((int) expressionResult.charAt(i));
}
}
private String[] split(String expressionBody, String toSplit) {
- return Pattern.compile(expressionBody).split(toSplit, 0);
+ return Pattern.compile(expressionBody).split(toSplit, 0);
}
@@ -271,7 +270,7 @@
}
-
+
private boolean isPropertyValid(String property) {
int idx = property.indexOf(':');
return (property.indexOf(':', idx + 1) == -1);
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java 2010-04-20
16:12:31 UTC (rev 16780)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java 2010-04-20
16:24:24 UTC (rev 16781)
@@ -32,72 +32,71 @@
import org.richfaces.log.RichfacesLogger;
import org.richfaces.skin.SkinFactory;
import org.slf4j.Logger;
+
/**
* @author amarkhel
- * Class, that represented dynamic CSS resource.
- *
+ * Class, that represented dynamic CSS resource.
*/
public class CompiledCSSResource extends AbstractBaseResource {
- private static final String SKIN = "?skin=";
+ private static final String SKIN = "?skin=";
private static final String TEXT_CSS = "text/css";
private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
-
- public CompiledCSSResource(Resource resource){
- this.resourceDelegate = resource;
- }
-
- private Resource resourceDelegate;
-
- @Override
- public InputStream getInputStream() {
- InputStream stream = null;
- try{
- stream = CSSCompiler.parse(resourceDelegate);
- }
- catch(IOException ioe){
- LOGGER.warn("IO Error: " + ioe + "while loading dynamic CSS");
- }
- return stream;
- }
- @Override
+ private Resource resourceDelegate;
+
+ public CompiledCSSResource(Resource resource) {
+ this.resourceDelegate = resource;
+ }
+
+ @Override
+ public InputStream getInputStream() {
+ InputStream stream = null;
+ try {
+ stream = CSSCompiler.parse(resourceDelegate);
+ } catch (IOException ioe) {
+ LOGGER.warn("IO Error: " + ioe + "while loading dynamic
CSS");
+ }
+ return stream;
+ }
+
+ @Override
public String getContentType() {
return TEXT_CSS;
}
- public Resource getResourceDelegate() {
- return resourceDelegate;
- }
+ public Resource getResourceDelegate() {
+ return resourceDelegate;
+ }
- public void setResourceDelegate(Resource resourceDelegate) {
- this.resourceDelegate = resourceDelegate;
- }
-
- @Override
- public String getResourceName() {
+ public void setResourceDelegate(Resource resourceDelegate) {
+ this.resourceDelegate = resourceDelegate;
+ }
+
+ @Override
+ public String getResourceName() {
return resourceDelegate.getResourceName();
}
-
- @Override
+
+ @Override
public String getRequestPath() {
- StringBuilder b = new StringBuilder();
- String path = resourceDelegate.getRequestPath();
- b.append(path);
- b.append(SKIN);
- b.append(getSkinHashCode());
- return b.toString();
- }
+ StringBuilder b = new StringBuilder();
+ String path = resourceDelegate.getRequestPath();
+ b.append(path);
+ b.append(SKIN);
+ b.append(getSkinHashCode());
+ return b.toString();
+ }
private int getSkinHashCode() {
- return ((SkinFactory)ServiceTracker.getService(FacesContext.getCurrentInstance(),
SkinFactory.class)).getSkin(FacesContext.getCurrentInstance()).hashCode();
+ return ((SkinFactory)
ServiceTracker.getService(FacesContext.getCurrentInstance(),
SkinFactory.class)).getSkin(FacesContext.getCurrentInstance()).hashCode();
}
-
- @Override
+
+ @Override
public boolean userAgentNeedsUpdate(FacesContext context) {
- if(context.isProjectStage(ProjectStage.Development)){
- return true;
- }
- return super.userAgentNeedsUpdate(context);
- }
+ if (context.isProjectStage(ProjectStage.Development)) {
+ return true;
+ }
+ return super.userAgentNeedsUpdate(context);
+ }
}
Modified:
root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
---
root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-04-20
16:12:31 UTC (rev 16780)
+++
root/framework/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-04-20
16:24:24 UTC (rev 16781)
@@ -24,7 +24,6 @@
import org.ajax4jsf.cache.Cache;
import org.ajax4jsf.cache.CacheManager;
import org.ajax4jsf.resource.Java2Dresource;
-import org.jboss.cache.util.BeanUtils;
import org.richfaces.context.AttributesContext;
import org.richfaces.context.SingletonsContext;
import org.richfaces.log.RichfacesLogger;
@@ -47,7 +46,6 @@
import java.net.URL;
import java.text.MessageFormat;
import java.util.Date;
-import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
@@ -115,7 +113,7 @@
Object oldCodec = applicationMap.put(RESOURCE_CODEC_ATTRIBUTE_NAME, codec);
if ((oldCodec != null) && (codec != null) &&
!oldCodec.equals(codec)
- && facesContext.isProjectStage(ProjectStage.Development)) {
+ && facesContext.isProjectStage(ProjectStage.Development)) {
LOGGER.warn("Resource codec should be typically set once per application
lifetime");
}
}
@@ -259,15 +257,15 @@
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
- MessageFormat.format(
- "Client requested {0} version of resource, server
has {1} version",
- String.valueOf(requestedVersion),
String.valueOf(existingVersion)));
+ MessageFormat.format(
+ "Client requested {0} version of resource,
server has {1} version",
+ String.valueOf(requestedVersion),
String.valueOf(existingVersion)));
}
if ((existingVersion != null) && (requestedVersion != null)
- && !existingVersion.equals(requestedVersion)) {
+ && !existingVersion.equals(requestedVersion)) {
logResourceProblem(context, null, "Resource {0} of version
{1} was not found", resourceName,
- requestedVersion);
+ requestedVersion);
sendResourceNotFound(context);
return;
@@ -314,8 +312,8 @@
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(new MessageFormat(
- "Storing {0} resource in cache until {1,date,dd
MMM yyyy HH:mm:ss zzz}", Locale.US).
- format(new Object[]{resourceKey,
cacheExpirationDate}));
+ "Storing {0} resource in cache until
{1,date,dd MMM yyyy HH:mm:ss zzz}", Locale.US).
+ format(new Object[]{resourceKey,
cacheExpirationDate}));
}
cache.put(resourceKey, cachedResource, cacheExpirationDate);
@@ -427,7 +425,7 @@
* Should be called only if {@link #isResourceExists(String)} returns
<code>true</code>
*
* @param resourceName
- * @param params
+ * @param params
* @return
*/
protected Resource createHandlerDependentResource(String resourceName, Map<String,
String> params) {
@@ -441,14 +439,14 @@
if (Resource.class.isAssignableFrom(resourceClass)) {
resource = (Resource) resourceClass.newInstance();
resource.setResourceName(resourceName);
- if(resource instanceof Java2Dresource){
- Java2Dresource dynamicResource = (Java2Dresource)resource;
+ if (resource instanceof Java2Dresource) {
+ Java2Dresource dynamicResource = (Java2Dresource) resource;
dynamicResource.populateParameters(params);
resource = dynamicResource;
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(MessageFormat.format("Successfully created
instance of {0} resource",
- resourceName));
+ resourceName));
}
} else {
throw new ClassCastException(resourceClass.getName());
@@ -467,12 +465,12 @@
Map<String, String> params = Util.parseResourceParameters(resourceName);
resourceName = extractParametersFromResourceName(resourceName);
if ((resourceName != null) && ((libraryName == null) ||
(libraryName.length() == 0))
- && isResourceExists(resourceName)) {
+ && isResourceExists(resourceName)) {
result = createHandlerDependentResource(resourceName, params);
} else {
- result = defaultHandler.createResource(resourceName, libraryName, contentType);
- if(resourceName.indexOf(".ecss") != -1){
- result = new CompiledCSSResource(result);
+ result = defaultHandler.createResource(resourceName, libraryName,
contentType);
+ if (resourceName.indexOf(".ecss") != -1) {
+ result = new CompiledCSSResource(result);
}
}
@@ -480,7 +478,7 @@
}
private String extractParametersFromResourceName(String resourceName) {
- if(!(resourceName.lastIndexOf("?") != -1)){
+ if (!(resourceName.lastIndexOf("?") != -1)) {
return resourceName;
}
return resourceName.substring(0, resourceName.lastIndexOf("?"));
@@ -499,7 +497,7 @@
@Override
public String getRendererTypeForResourceName(String resourceName) {
- if(resourceName.indexOf(".ecss") != -1){
+ if (resourceName.indexOf(".ecss") != -1) {
return "javax.faces.resource.Stylesheet";
}
return defaultHandler.getRendererTypeForResourceName(resourceName);
Modified: root/framework/trunk/impl/src/main/java/org/richfaces/util/Util.java
===================================================================
--- root/framework/trunk/impl/src/main/java/org/richfaces/util/Util.java 2010-04-20
16:12:31 UTC (rev 16780)
+++ root/framework/trunk/impl/src/main/java/org/richfaces/util/Util.java 2010-04-20
16:24:24 UTC (rev 16781)
@@ -42,7 +42,6 @@
package org.richfaces.util;
import org.ajax4jsf.Messages;
-import org.ajax4jsf.util.HtmlColor;
import org.ajax4jsf.util.base64.Codec;
import org.richfaces.log.RichfacesLogger;
import org.slf4j.Logger;
@@ -353,21 +352,21 @@
return viewHandler.getResourceURL(context, resourcePath);
}
- public static Map<String, String> parseResourceParameters(String
resourceName){
+ public static Map<String, String> parseResourceParameters(String resourceName)
{
Map<String, String> params = new HashMap<String, String>();
- if(!(resourceName.lastIndexOf(QUESTION_SIGN) != -1)){
+ if (!(resourceName.lastIndexOf(QUESTION_SIGN) != -1)) {
return params;
}
resourceName = resourceName.substring(resourceName.lastIndexOf(QUESTION_SIGN) +
1);
try {
if (resourceName.trim().length() > 0) {
String query = resourceName;
- String paramPairs[] = query.split(AND_SEPARATOR);
- for(int i = 0; i < paramPairs.length ; i++){
- String pair[] = paramPairs[i].split(EQUALS_SIGN);
+ String[] paramPairs = query.split(AND_SEPARATOR);
+ for (int i = 0; i < paramPairs.length; i++) {
+ String[] pair = paramPairs[i].split(EQUALS_SIGN);
String key = URLDecoder.decode(pair[0], "UTF-8").trim();
String value = URLDecoder.decode(pair[1], "UTF-8").trim();
- if(key != null && value != null &&
key.trim().length() > 0 && value.trim().length() > 0){
+ if (key != null && value != null &&
key.trim().length() > 0 && value.trim().length() > 0) {
params.put(key, value);
}
}
@@ -377,7 +376,7 @@
}
return params;
}
-
+
public static String decodeResourceURL(FacesContext context) {
ExternalContext externalContext = context.getExternalContext();
String resourceName = null;