Author: markt Date: Fri Jan 9 03:17:13 2009 New Revision: 733008 URL: http://svn.apache.org/viewvc?rev=733008&view=rev Log: Fix various Eclipse warnings in o.a.jasper.compiler. Remove unused and unnecessary code, correct use of deprecated methods.
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Dumper.java tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java tomcat/trunk/java/org/apache/jasper/compiler/Node.java tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Modified: tomcat/trunk/java/org/apache/jasper/compiler/Dumper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Dumper.java?rev=733008&r1=733007&r2=733008&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/Dumper.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/Dumper.java Fri Jan 9 03:17:13 2009 @@ -42,14 +42,6 @@ System.out.print(str); } - private void printString(String prefix, char[] chars, String suffix) { - String str = null; - if (chars != null) { - str = new String(chars); - } - printString(prefix, str, suffix); - } - private void printString(String prefix, String str, String suffix) { printIndent(); if (str != null) { Modified: tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java?rev=733008&r1=733007&r2=733008&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/JDTCompiler.java Fri Jan 9 03:17:13 2009 @@ -105,17 +105,15 @@ is = new FileInputStream(sourceFile); Reader reader = new BufferedReader(new InputStreamReader(is, ctxt.getOptions().getJavaEncoding())); - if (reader != null) { - char[] chars = new char[8192]; - StringBuffer buf = new StringBuffer(); - int count; - while ((count = reader.read(chars, 0, - chars.length)) > 0) { - buf.append(chars, 0, count); - } - result = new char[buf.length()]; - buf.getChars(0, result.length, result, 0); + char[] chars = new char[8192]; + StringBuffer buf = new StringBuffer(); + int count; + while ((count = reader.read(chars, 0, + chars.length)) > 0) { + buf.append(chars, 0, count); } + result = new char[buf.length()]; + buf.getChars(0, result.length, result, 0); } catch (IOException e) { log.error("Compilation error", e); } finally { @@ -421,12 +419,13 @@ String className = classNames[i]; compilationUnits[i] = new CompilationUnit(fileNames[i], className); } + CompilerOptions cOptions = new CompilerOptions(settings); + cOptions.parseLiteralExpressionsAsConstants = true; Compiler compiler = new Compiler(env, policy, - settings, + cOptions, requestor, - problemFactory, - true); + problemFactory); compiler.compile(compilationUnits); if (!ctxt.keepGenerated()) { Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java?rev=733008&r1=733007&r2=733008&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/JspConfig.java Fri Jan 9 03:17:13 2009 @@ -424,7 +424,6 @@ while (iter.hasNext()) { JspPropertyGroup jpg = iter.next(); - JspProperty jp = jpg.getJspProperty(); String extension = jpg.getExtension(); String path = jpg.getPath(); Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=733008&r1=733007&r2=733008&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Fri Jan 9 03:17:13 2009 @@ -25,7 +25,6 @@ import java.util.List; import java.util.jar.JarFile; -import javax.servlet.jsp.tagext.Tag; import javax.servlet.jsp.tagext.TagFileInfo; import javax.servlet.jsp.tagext.TagInfo; import javax.servlet.jsp.tagext.TagLibraryInfo; @@ -56,7 +55,6 @@ extends DefaultHandler implements LexicalHandler, TagConstants { - private static final String JSP_VERSION = "version"; private static final String LEXICAL_HANDLER_PROPERTY = "http://xml.org/sax/properties/lexical-handler"; private static final String JSP_URI = "http://java.sun.com/JSP/Page"; Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java?rev=733008&r1=733007&r2=733008&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/JspRuntimeContext.java Fri Jan 9 03:17:13 2009 @@ -376,7 +376,7 @@ codeBase = codeBase + File.separator; } File contextDir = new File(codeBase); - URL url = contextDir.getCanonicalFile().toURL(); + URL url = contextDir.getCanonicalFile().toURI().toURL(); codeSource = new CodeSource(url,(Certificate[])null); permissionCollection = policy.getPermissions(codeSource); @@ -408,34 +408,32 @@ permissionCollection.add( new RuntimePermission( "accessClassInPackage.org.apache.jasper.runtime") ); - if (parentClassLoader instanceof URLClassLoader) { - URL [] urls = parentClassLoader.getURLs(); - String jarUrl = null; - String jndiUrl = null; - for (int i=0; i<urls.length; i++) { - if (jndiUrl == null - && urls[i].toString().startsWith("jndi:") ) { - jndiUrl = urls[i].toString() + "-"; - } - if (jarUrl == null - && urls[i].toString().startsWith("jar:jndi:") - ) { - jarUrl = urls[i].toString(); - jarUrl = jarUrl.substring(0,jarUrl.length() - 2); - jarUrl = jarUrl.substring(0, - jarUrl.lastIndexOf('/')) + "/-"; - } + URL [] urls = parentClassLoader.getURLs(); + String jarUrl = null; + String jndiUrl = null; + for (int i=0; i<urls.length; i++) { + if (jndiUrl == null + && urls[i].toString().startsWith("jndi:") ) { + jndiUrl = urls[i].toString() + "-"; } - if (jarUrl != null) { - permissionCollection.add( - new FilePermission(jarUrl,"read")); - permissionCollection.add( - new FilePermission(jarUrl.substring(4),"read")); + if (jarUrl == null + && urls[i].toString().startsWith("jar:jndi:") + ) { + jarUrl = urls[i].toString(); + jarUrl = jarUrl.substring(0,jarUrl.length() - 2); + jarUrl = jarUrl.substring(0, + jarUrl.lastIndexOf('/')) + "/-"; } - if (jndiUrl != null) - permissionCollection.add( - new FilePermission(jndiUrl,"read") ); } + if (jarUrl != null) { + permissionCollection.add( + new FilePermission(jarUrl,"read")); + permissionCollection.add( + new FilePermission(jarUrl.substring(4),"read")); + } + if (jndiUrl != null) + permissionCollection.add( + new FilePermission(jndiUrl,"read") ); } catch(Exception e) { context.log("Security Init for context failed",e); } Modified: tomcat/trunk/java/org/apache/jasper/compiler/Node.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Node.java?rev=733008&r1=733007&r2=733008&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/Node.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/Node.java Fri Jan 9 03:17:13 2009 @@ -25,13 +25,11 @@ import javax.el.ELContext; import javax.el.ELException; import javax.el.ExpressionFactory; -import javax.el.ValueExpression; import javax.servlet.jsp.tagext.BodyTag; import javax.servlet.jsp.tagext.DynamicAttributes; import javax.servlet.jsp.tagext.IterationTag; import javax.servlet.jsp.tagext.JspIdConsumer; import javax.servlet.jsp.tagext.SimpleTag; -import javax.servlet.jsp.tagext.Tag; import javax.servlet.jsp.tagext.TagAttributeInfo; import javax.servlet.jsp.tagext.TagData; import javax.servlet.jsp.tagext.TagFileInfo; @@ -2137,8 +2135,7 @@ throws ELException { if (this.el != null) { // determine exact type - ValueExpression ve = ef.createValueExpression(ctx, this.value, - String.class); + ef.createValueExpression(ctx, this.value, String.class); } } Modified: tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java?rev=733008&r1=733007&r2=733008&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/SmapUtil.java Fri Jan 9 03:17:13 2009 @@ -44,9 +44,6 @@ */ public class SmapUtil { - private org.apache.juli.logging.Log log= - org.apache.juli.logging.LogFactory.getLog( SmapUtil.class ); - //********************************************************************* // Constants @@ -177,14 +174,6 @@ return path.substring(path.lastIndexOf('/') + 1); } - /** - * Returns a file path corresponding to a potential SMAP input - * for the given compilation input (JSP file). - */ - private static String inputSmapPath(String path) { - return path.substring(0, path.lastIndexOf('.') + 1) + "smap"; - } - //********************************************************************* // Installation logic (from Robert Field, JSR-045 spec lead) private static class SDEInstaller { @@ -284,7 +273,6 @@ } void addSDE() throws UnsupportedEncodingException, IOException { - int i; copy(4 + 2 + 2); // magic min/maj version int constantPoolCountPos = genPos; int constantPoolCount = readU2(); Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java?rev=733008&r1=733007&r2=733008&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java Fri Jan 9 03:17:13 2009 @@ -261,10 +261,10 @@ } functionTable.put(funcName, funcInfo); - } else if ("display-name".equals(tname) || // Ignored elements + } else if ("display-name".equals(tname) || "small-icon".equals(tname) || "large-icon".equals(tname) || "listener".equals(tname)) { - ; + // Ignored elements } else if ("taglib-extension".equals(tname)) { // Recognized but ignored } else { @@ -496,7 +496,7 @@ String type = null; String expectedType = null; String methodSignature = null; - boolean required = false, rtexprvalue = false, reqTime = false, isFragment = false, deferredValue = false, deferredMethod = false; + boolean required = false, rtexprvalue = false, isFragment = false, deferredValue = false, deferredMethod = false; Iterator<TreeNode> list = elem.findChildren(); while (list.hasNext()) { @@ -555,9 +555,8 @@ } else { methodSignature = "java.lang.Object method()"; } - } else if ("description".equals(tname) || // Ignored elements - false) { - ; + } else if ("description".equals(tname) || false) { + // Ignored elements } else { if (log.isWarnEnabled()) { log.warn(Localizer.getMessage( Modified: tomcat/trunk/java/org/apache/jasper/compiler/Validator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Validator.java?rev=733008&r1=733007&r2=733008&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/Validator.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Fri Jan 9 03:17:13 2009 @@ -36,7 +36,6 @@ import javax.servlet.jsp.tagext.ValidationMessage; import org.apache.el.lang.ELSupport; -import org.apache.jasper.Constants; import org.apache.jasper.JasperException; import org.apache.jasper.el.ELContextImpl; import org.xml.sax.Attributes; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org