W3C home > Mailing lists > Public > www-validator-cvs@w3.org > October 2012

2002/css-validator/org/w3c/css/css StyleSheetGenerator.java,1.34,1.35

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 10 Oct 2012 07:45:53 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1TLqzJ-0001n6-82@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/css
In directory hutz:/tmp/cvs-serv6870

Modified Files:
	StyleSheetGenerator.java 
Log Message:
new handling of csserrortoken

Index: StyleSheetGenerator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetGenerator.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- StyleSheetGenerator.java	4 Aug 2012 21:17:02 -0000	1.34
+++ StyleSheetGenerator.java	10 Oct 2012 07:45:51 -0000	1.35
@@ -285,7 +285,7 @@
                     } else if (ex instanceof CssParseException) {
                         produceParseException((CssParseException) ex, h);
                     } else if (ex instanceof InvalidParamException) {
-                        h.put("ClassName", "invalidparam");
+						h.put("ClassName", "invalidparam");
                     } else if (ex instanceof IOException) {
                         String stringError = ex.toString();
                         // int index = stringError.indexOf(':');
@@ -303,12 +303,39 @@
                         h.put("ClassName", "io");
 
                     } else if (csserror instanceof CssErrorToken) {
-                        CssErrorToken terror = (CssErrorToken) csserror;
+						CssErrorToken terror = (CssErrorToken) csserror;
                         h.put("ClassName", "errortoken");
-                        h.put("ErrorMsg", terror.getErrorDescription() + " : "
-                                + terror.getSkippedString());
+						String str = ac.getMsg().getErrorString("errortoken");
+						if (str == null) {
+							str="Parse Error %s";
+						}
+						String[] params = new String[4];
+						params[0] = terror.getErrorToken();
+						params[1] = Integer.toString(terror.getLine());
+						StringBuilder sb = new StringBuilder();
+						boolean notfirst = false;
+						for (String t : terror.getExpected()) {
+							if (notfirst) {
+								sb.append(", ");
+							}
+							sb.append(t);
+						}
+						params[2] = sb.toString();
+						params[3] = terror.getSkippedString();
+						// replace all parameters
+						String[] msg_parts = str.split("%s", -1);
+						int j = 0;
+						sb.setLength(0);
+						sb.append(msg_parts[0]);
+						for (int k = 1; k < msg_parts.length; k++) {
+							if (j < params.length) {
+								sb.append(params[j++]);
+							}
+							sb.append(msg_parts[k]);
+						}
+                        h.put("ErrorMsg", queryReplace(sb.toString()));
                     } else {
-                        h.put("ClassName", "unkownerror");
+						h.put("ClassName", "unkownerror");
                         h.put("ErrorMsg", ac.getMsg().getErrorString("unknown")
                                 + " " + ex);
                         if (ex instanceof NullPointerException) {
Received on Wednesday, 10 October 2012 07:45:54 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:52 UTC