- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 24 Apr 2007 11:12:19 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/util
In directory hutz:/tmp/cvs-serv17649/org/w3c/css/util
Modified Files:
ApplContext.java
Log Message:
jdk1.2 dependency removed, now uses jdk1.4 classes
Index: ApplContext.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/util/ApplContext.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ApplContext.java 16 Dec 2006 20:22:26 -0000 1.9
+++ ApplContext.java 24 Apr 2007 11:12:16 -0000 1.10
@@ -8,9 +8,7 @@
*/
package org.w3c.css.util;
-//import java.nio.charset.Charset;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
+import java.nio.charset.Charset;
import org.w3c.css.parser.Frame;
import org.w3c.www.http.HttpAcceptCharset;
@@ -23,8 +21,6 @@
*/
public class ApplContext {
- private static Method m = null;
-
String credential = null;
String lang;
@@ -47,18 +43,6 @@
int warningLevel = 0;
- static {
- try {
- Class c = Class.forName("java.nio.charset.Charset");
- Class cp[] = { java.lang.String.class };
- m = c.getDeclaredMethod("isSupported", cp);
- } catch (ClassNotFoundException ex) {
- m = null;
- } catch (NoSuchMethodException ex) {
- m = null;
- }
- }
-
/**
* Creates a new ApplContext
*/
@@ -248,15 +232,11 @@
}
private boolean isCharsetSupported(String charset) {
- // if we can't check, assume it's ok, and fail later.
- if (m == null) {
+ if ("*".equals(charset)) {
return true;
}
try {
- String p[] = new String[1];
- p[0] = charset;
- Boolean b = (Boolean) m.invoke(null, p);
- return b.booleanValue();
+ return Charset.isSupported(charset);
}
catch(Exception e) {
return false;
Received on Tuesday, 24 April 2007 11:12:20 UTC