cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r416705 - in /cocoon/trunk: blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/transcoder/ blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/url/ blocks/cocoon-fop/cocoon-fop-impl...
Date Fri, 23 Jun 2006 12:45:04 GMT
Author: cziegeler
Date: Fri Jun 23 05:45:04 2006
New Revision: 416705

URL: http://svn.apache.org/viewvc?rev=416705&view=rev
Log:
Make constants final and fix potential problems

Modified:
    cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/transcoder/ExtendableTranscoderFactory.java
    cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/url/SourceProtocolHandler.java
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
    cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/serialization/FOPSerializer.java
    cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java
    cocoon/trunk/blocks/cocoon-webdav/cocoon-webdav-impl/src/main/java/org/apache/cocoon/components/webdav/WebDAVUtil.java
    cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/generator/GeneratorSelector.java
    cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/programming/java/Jikes.java
    cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/environment/mock/MockRequest.java

Modified: cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/transcoder/ExtendableTranscoderFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/transcoder/ExtendableTranscoderFactory.java?rev=416705&r1=416704&r2=416705&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/transcoder/ExtendableTranscoderFactory.java
(original)
+++ cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/transcoder/ExtendableTranscoderFactory.java
Fri Jun 23 05:45:04 2006
@@ -33,7 +33,7 @@
  */
 public class ExtendableTranscoderFactory implements TranscoderFactory {
 
-    protected static Map transcoders = new HashMap();
+    protected static final Map transcoders = new HashMap();
 
     protected final static TranscoderFactory singleton = new ExtendableTranscoderFactory();
 

Modified: cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/url/SourceProtocolHandler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/url/SourceProtocolHandler.java?rev=416705&r1=416704&r2=416705&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/url/SourceProtocolHandler.java
(original)
+++ cocoon/trunk/blocks/cocoon-batik/cocoon-batik-impl/src/main/java/org/apache/cocoon/components/url/SourceProtocolHandler.java
Fri Jun 23 05:45:04 2006
@@ -38,10 +38,10 @@
 public class SourceProtocolHandler extends AbstractParsedURLProtocolHandler {
 
     /** Thread-local source resolver */
-    protected static InheritableThreadLocal localResolver = new InheritableThreadLocal();
+    protected static final InheritableThreadLocal localResolver = new InheritableThreadLocal();
 
     /** Batik's original default handler */        
-    protected static ParsedURLProtocolHandler defaultHandler;
+    protected static final ParsedURLProtocolHandler defaultHandler = ParsedURL.getHandler(null);
 
     /**
      * Change the default handler used by Batik to resolve URLs to a handler
@@ -55,9 +55,6 @@
      * @param logger the logger for logging.
      */
     static {        
-        // Keep the default handler, if any
-        SourceProtocolHandler.defaultHandler = ParsedURL.getHandler(null);
-
         // Set the default handler to our handler
         ParsedURL.registerHandler(new SourceProtocolHandler(null));
 
@@ -75,8 +72,7 @@
     /**
      * Get the thread-local resolver.
      */
-    public static SourceResolver getSourceResolver()
-    {
+    public static SourceResolver getSourceResolver() {
         SourceResolver resolver = (SourceResolver)localResolver.get();
         return resolver;
     }

Modified: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java?rev=416705&r1=416704&r2=416705&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
(original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/components/renderer/ExtendableRendererFactory.java
Fri Jun 23 05:45:04 2006
@@ -33,7 +33,7 @@
  */
 public class ExtendableRendererFactory implements RendererFactory {
 
-  protected static Map renderers = new HashMap();
+  protected static final Map renderers = new HashMap();
 
   protected final static RendererFactory singleton = new ExtendableRendererFactory();
 

Modified: cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/serialization/FOPSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/serialization/FOPSerializer.java?rev=416705&r1=416704&r2=416705&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/serialization/FOPSerializer.java
(original)
+++ cocoon/trunk/blocks/cocoon-fop/cocoon-fop-impl/src/main/java/org/apache/cocoon/serialization/FOPSerializer.java
Fri Jun 23 05:45:04 2006
@@ -56,7 +56,7 @@
     /**
      * The Renderer Factory to use
      */
-    protected static RendererFactory factory = ExtendableRendererFactory.getRendererFactoryImplementation();
+    protected static final RendererFactory factory = ExtendableRendererFactory.getRendererFactoryImplementation();
 
     /**
      * The <code>Driver</code> which is FOP.

Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java?rev=416705&r1=416704&r2=416705&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java
(original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java
Fri Jun 23 05:45:04 2006
@@ -30,7 +30,7 @@
     extends AbstractLogEnabled
     implements Disposable, Serviceable, ThreadSafe, ExpressionFactory {
 
-    public static String DEFAULT_EXPRESSION_LANGUAGE = "default";
+    public static final String DEFAULT_EXPRESSION_LANGUAGE = "default";
 
     /** The component manager */
     protected ServiceManager manager;

Modified: cocoon/trunk/blocks/cocoon-webdav/cocoon-webdav-impl/src/main/java/org/apache/cocoon/components/webdav/WebDAVUtil.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-webdav/cocoon-webdav-impl/src/main/java/org/apache/cocoon/components/webdav/WebDAVUtil.java?rev=416705&r1=416704&r2=416705&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-webdav/cocoon-webdav-impl/src/main/java/org/apache/cocoon/components/webdav/WebDAVUtil.java
(original)
+++ cocoon/trunk/blocks/cocoon-webdav/cocoon-webdav-impl/src/main/java/org/apache/cocoon/components/webdav/WebDAVUtil.java
Fri Jun 23 05:45:04 2006
@@ -76,7 +76,7 @@
 
         final String filename = uri.substring(uri.lastIndexOf("/"));
         final String uriPrefix = uri.substring(0, uri.lastIndexOf("/") + 1);
-        final HttpURL sourceURL = new HttpURL(uri);                                     
                             
+        //final HttpURL sourceURL = new HttpURL(uri);                                   
                               
         final WebdavResource resource = getWebdavResource(uriPrefix);
                         
         if(!resource.putMethod(uriPrefix + filename, content)) {

Modified: cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/generator/GeneratorSelector.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/generator/GeneratorSelector.java?rev=416705&r1=416704&r2=416705&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/generator/GeneratorSelector.java
(original)
+++ cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/generator/GeneratorSelector.java
Fri Jun 23 05:45:04 2006
@@ -44,7 +44,7 @@
  */
 public class GeneratorSelector extends AbstractLogEnabled implements ThreadSafe, Contextualizable,
Serviceable {
 
-    public static String ROLE = "org.apache.cocoon.components.language.generator.ServerPages";
+    public static final String ROLE = "org.apache.cocoon.components.language.generator.ServerPages";
 
     private Context context;
     

Modified: cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/programming/java/Jikes.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/programming/java/Jikes.java?rev=416705&r1=416704&r2=416705&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/programming/java/Jikes.java
(original)
+++ cocoon/trunk/blocks/cocoon-xsp/cocoon-xsp-impl/src/main/java/org/apache/cocoon/components/language/programming/java/Jikes.java
Fri Jun 23 05:45:04 2006
@@ -257,7 +257,7 @@
             getLogger().error(message.toString(), e);
         }
 
-        if ("".equals(message)) {
+        if ("".equals(message.toString())) {
             type = tokens.nextToken().trim().toLowerCase();
             message.append(tokens.nextToken("\n").substring(1).trim());
 

Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/environment/mock/MockRequest.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/environment/mock/MockRequest.java?rev=416705&r1=416704&r2=416705&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/environment/mock/MockRequest.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/environment/mock/MockRequest.java
Fri Jun 23 05:45:04 2006
@@ -71,7 +71,7 @@
     private Map cookies = new HashMap();
     
     private MockSession session;
-    private Environment environment = null;
+    private Environment environment;
     
     private boolean isRequestedSessionIdFromCookie = true;
     private boolean isRequestedSessionIdFromURL = false;
@@ -81,7 +81,7 @@
         this.environment = environment;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#get(java.lang.String)
      */
     public Object get(String name) { 
@@ -99,34 +99,58 @@
         }
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getAuthType()
+     */
     public String getAuthType() {
         return authType;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getCharacterEncoding()
+     */
     public String getCharacterEncoding() {
         return charEncoding;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#setCharacterEncoding(java.lang.String)
+     */
     public void setCharacterEncoding(String enc) throws java.io.UnsupportedEncodingException
{
         charEncoding = enc;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getContentLength()
+     */
     public int getContentLength() {
         return -1;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getContentType()
+     */
     public String getContentType() {
         return contentType;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getParameter(java.lang.String)
+     */
     public String getParameter(String name) {
         return (String)parameters.get(name);
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getParameterNames()
+     */
     public Enumeration getParameterNames() {
         return parameters.keys();
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getParameterValues(java.lang.String)
+     */
     public String[] getParameterValues(String name) {
         Object param = parameters.get(name);
         if ( null == param ) {
@@ -138,46 +162,80 @@
         return new String[] {(String) param};
     }
 
+    /**
+     * @param name
+     * @param value
+     */
     public void addParameter(String name, String value) {
         parameters.put(name, value);
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getProtocol()
+     */
     public String getProtocol() {
         return protocol;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getScheme()
+     */
     public String getScheme() {
         return scheme;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getServerName()
+     */
     public String getServerName() {
         return serverName;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getServerPort()
+     */
     public int getServerPort() {
         return port;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getRemoteAddr()
+     */
     public String getRemoteAddr() {
         return remoteAddr;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getRemoteHost()
+     */
     public String getRemoteHost() {
         return remoteHost;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getLocale()
+     */
     public Locale getLocale() {
         return locale;
     }
     
+    /**
+     * @param locale
+     */
     public void setLocale(Locale locale) {
         this.locale = locale;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getLocales()
+     */
     public Enumeration getLocales() {
         return Collections.enumeration(Collections.singleton(getLocale()));
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#isSecure()
+     */
     public boolean isSecure() {
         if (scheme==null) {
             return false;
@@ -185,6 +243,9 @@
         return scheme.equalsIgnoreCase("HTTPS");
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getCookies()
+     */
     public Cookie[] getCookies() {
         if (cookies.isEmpty()) {
             return null;
@@ -193,10 +254,16 @@
         return (Cookie []) cookies.values().toArray(cookieArray);
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getCookieMap()
+     */
     public Map getCookieMap() {
         return cookies;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getDateHeader(java.lang.String)
+     */
     public long getDateHeader(String name) {
         String s1 = getHeader(name);
         if (s1 == null) {
@@ -211,30 +278,51 @@
         }
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getHeader(java.lang.String)
+     */
     public String getHeader(String name) {
         return (String) headers.get(name);
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getHeaders(java.lang.String)
+     */
     public Enumeration getHeaders(String name) {
         throw new AssertionFailedError("Not implemented");
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getHeaderNames()
+     */
     public Enumeration getHeaderNames() {
         return headers.keys();
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getMethod()
+     */
     public String getMethod() {
         return method;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getPathInfo()
+     */
     public String getPathInfo() {
         return pathInfo;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getPathTranslated()
+     */
     public String getPathTranslated() {
         throw new AssertionFailedError("Not implemented");
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getContextPath()
+     */
     public String getContextPath() {
         return contextPath;
     }
@@ -243,6 +331,9 @@
         contextPath = path;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getQueryString()
+     */
     public String getQueryString() {
         return queryString;
     }
@@ -251,22 +342,40 @@
         queryString = string;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getRemoteUser()
+     */
     public String getRemoteUser() {
         return remoteUser;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getUserPrincipal()
+     */
     public Principal getUserPrincipal() {
         return principal;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#isUserInRole(java.lang.String)
+     */
     public boolean isUserInRole(String role) {
+        if ( this.userRole == null ) {
+            return role == null;
+        }
         return userRole.equals(role);
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getRequestedSessionId()
+     */
     public String getRequestedSessionId() {
         return reqSessionId;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getRequestURI()
+     */
     public String getRequestURI() {
         if (this.environment == null) {
             return requestURI;
@@ -278,6 +387,9 @@
         requestURI = uri;
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getSitemapURI()
+     */
     public String getSitemapURI() {
         if (this.environment == null) {
             return requestURI;
@@ -285,6 +397,9 @@
         return this.environment.getURI();
     }
     
+    /**
+     * @see org.apache.cocoon.environment.Request#getSitemapPath()
+     */
     public String getSitemapPath() {
         if (this.environment == null) {
             return "";
@@ -292,14 +407,23 @@
         return this.environment.getURIPrefix();
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getSitemapURIPrefix()
+     */
     public String getSitemapURIPrefix() {
         return "";
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getServletPath()
+     */
     public String getServletPath() {
         return servletPath;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getSession(boolean)
+     */
     public Session getSession(boolean create) {
         if ((session == null) && (create)) {
             this.session = new MockSession();
@@ -312,10 +436,16 @@
         return null;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#getSession()
+     */
     public Session getSession() {
         return getSession(true);
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#isRequestedSessionIdValid()
+     */
     public boolean isRequestedSessionIdValid() {
         if (session != null) {
             try {
@@ -328,10 +458,16 @@
         return false;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#isRequestedSessionIdFromCookie()
+     */
     public boolean isRequestedSessionIdFromCookie() {
         return isRequestedSessionIdFromCookie;
     }
 
+    /**
+     * @see org.apache.cocoon.environment.Request#isRequestedSessionIdFromURL()
+     */
     public boolean isRequestedSessionIdFromURL() {
         return isRequestedSessionIdFromURL;
     }
@@ -384,35 +520,35 @@
         this.isRequestedSessionIdFromCookie = isRequestedSessionIdFromCookie;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#getAttribute(java.lang.String)
      */
     public Object getAttribute(String name) {
         return this.getAttribute(name, Request.GLOBAL_SCOPE);
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#getAttributeNames()
      */
     public Enumeration getAttributeNames() {
         return this.getAttributeNames(Request.GLOBAL_SCOPE);
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#setAttribute(java.lang.String, java.lang.Object)
      */
     public void setAttribute(String name, Object value) {
         this.setAttribute(name, value, Request.GLOBAL_SCOPE);
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#removeAttribute(java.lang.String)
      */
     public void removeAttribute(String name) {
         this.removeAttribute(name, Request.GLOBAL_SCOPE);
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#getAttribute(java.lang.String, int)
      */
     public Object getAttribute(String name, int scope) {
@@ -422,7 +558,7 @@
         return this.globalAttributes.get(name);
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#getAttributeNames(int)
      */
     public Enumeration getAttributeNames(int scope) {
@@ -432,7 +568,7 @@
         return this.globalAttributes.keys();
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#setAttribute(java.lang.String, java.lang.Object,
int)
      */
     public void setAttribute(String name, Object value, int scope) {
@@ -443,7 +579,7 @@
         }
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#removeAttribute(java.lang.String, int)
      */
     public void removeAttribute(String name, int scope) {
@@ -454,7 +590,7 @@
         }
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.environment.Request#getInputStream()
      */
     public InputStream getInputStream() throws IOException, UnsupportedOperationException
{
@@ -476,4 +612,7 @@
         return result;
     }
 
+    public void setUserRole(String value) {
+        this.userRole = value;
+    }
 }



Mime
View raw message