W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2008

2002/css-validator/org/w3c/css/properties/css1 CssBackgroundCSS2.java,1.6,1.7

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 17 Mar 2008 18:24:18 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1JbK0Q-0002SY-G0@lionel-hutz.w3.org>

Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory hutz:/tmp/cvs-serv9397

Modified Files:
	CssBackgroundCSS2.java 
Log Message:
CssString not allowed here


Index: CssBackgroundCSS2.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/CssBackgroundCSS2.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- CssBackgroundCSS2.java	14 Sep 2005 15:14:31 -0000	1.6
+++ CssBackgroundCSS2.java	17 Mar 2008 18:24:16 -0000	1.7
@@ -104,6 +104,10 @@
 	    if(manyValues && val != null && val.equals(inherit)) {
 		throw new InvalidParamException("unrecognize", null, null, ac);
 	    }
+	    // quoted strings are not allowed (CssString)
+	    if(check && (val instanceof CssString)) {
+		throw new InvalidParamException("unrecognize", ac);
+	    }
 
 	    if (color == null) {
 		try {
@@ -293,35 +297,41 @@
 	if (same) {
 	    return inherit.toString();
 	} else {*/
-	String ret = "";
-	if(color != null) {
-	    ret += color;
+	StringBuilder sb = new StringBuilder();
+	boolean addspace = false;
+
+	if (color != null) {
+	    sb.append(color);
+	    addspace = true;
 	}
-	if(image != null) {
-	    if(ret != null) {
-		ret += " ";
+	if (image != null) {
+	    if(addspace) {
+		sb.append(' ');
 	    }
-	    ret += image;
+	    sb.append(image);
+	    addspace = true;
 	}
-	if(repeat != null) {
-	    if(ret != null) {
-		ret += " ";
+	if (repeat != null) {
+	    if (addspace) {
+		sb.append(' ');
 	    }
-	    ret += repeat;
+	    sb.append(repeat);
+	    addspace = true;
 	}
-	if(attachment != null) {
-	    if(ret != null) {
-		ret += " ";
+	if (attachment != null) {
+	    if (addspace) {
+		sb.append(' ');
 	    }
-	    ret += attachment;
+	    sb.append(attachment);
+	    addspace = true;
 	}
-	if(position != null) {
-	    if(ret != null) {
-		ret += " ";
+	if (position != null) {
+	    if (addspace) {
+		sb.append(' ');
 	    }
-	    ret += position;
+	    sb.append(position);
 	}
-	return ret;
+	return sb.toString();
 	/*
 	if (color.byUser)
 	    ret += " " + color.toString();
Received on Monday, 17 March 2008 18:25:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:00 GMT