You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2006/10/25 23:00:43 UTC

svn commit: r467762 - in /myfaces/tobago/trunk: contrib/fileupload/ core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/context/ core/src/main/java/org/apache/myfaces/tobago/event/ core/src/main/java/org...

Author: bommel
Date: Wed Oct 25 14:00:42 2006
New Revision: 467762

URL: http://svn.apache.org/viewvc?view=rev&rev=467762
Log:
some minor cleanups

Modified:
    myfaces/tobago/trunk/contrib/fileupload/pom.xml
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/RendererConfig.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeEvent.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/TabChangeEvent.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/AccessKeyMap.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataFilter.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/WeblogicWorkaroundServlet.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java
    myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FaceletAnnotationVisitor.java

Modified: myfaces/tobago/trunk/contrib/fileupload/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/contrib/fileupload/pom.xml?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/contrib/fileupload/pom.xml (original)
+++ myfaces/tobago/trunk/contrib/fileupload/pom.xml Wed Oct 25 14:00:42 2006
@@ -14,7 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.myfaces.tobago</groupId>
@@ -60,4 +61,81 @@
       <scope>provided</scope>
     </dependency>
   </dependencies>
+  <profiles>
+    <profile>
+      <id>jdk14retro</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>retrotranslator-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>retrotranslate</id>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <artifactId>maven-jar-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>create-jdk14retro-jar</id>
+                <goals>
+                  <goal>jar</goal>
+                </goals>
+                <configuration>
+                  <classesDirectory>${project.build.directory}/classes-retro</classesDirectory>
+                  <classifier>jdk14retro</classifier>
+                  <archive>
+                    <manifestEntries>
+                      <Extension-Name>${project.artifactId}-jdk14retro</Extension-Name>
+                      <Specification-Vendor>${project.organization.name}</Specification-Vendor>
+                      <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
+                      <Implementation-Title>${project.description}</Implementation-Title>
+                      <Implementation-Version>${project.version}</Implementation-Version>
+                      <Revision>${scm.revision}</Revision>
+                    </manifestEntries>
+                  </archive>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+      <dependencies>
+        <dependency>
+          <groupId>sun.jdk</groupId>
+          <artifactId>rt</artifactId>
+          <version>1.4.0</version>
+          <scope>system</scope>
+          <systemPath>${java14.home}/lib/rt.jar</systemPath>
+        </dependency>
+        <dependency>
+          <groupId>net.sf.retrotranslator</groupId>
+          <artifactId>retrotranslator-runtime</artifactId>
+        </dependency>
+      </dependencies>
+    </profile>
+    <profile>
+      <id>generate-assembly</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-scm-plugin</artifactId>
+            <executions>
+              <execution>
+                <phase>validate</phase>
+                <id>getting-scm.revision</id>
+                <goals>
+                  <goal>update</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
 </project>

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UITreeListbox.java Wed Oct 25 14:00:42 2006
@@ -49,8 +49,8 @@
 
   public static final String BOXES_PREFIX = "boxes_";
 
-  private List<UITreeNode> selectionPath;
-  private List<UITreeNode> expandPath;
+  private List<UITreeNode> selectionPath = null;
+  private List<UITreeNode> expandPath = null;
 
   private boolean encodingChildren = false;
 

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/RendererConfig.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/RendererConfig.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/RendererConfig.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/context/RendererConfig.java Wed Oct 25 14:00:42 2006
@@ -17,6 +17,7 @@
  */
 
 import java.io.Serializable;
+import java.util.Locale;
 
 /*
  * Created by IntelliJ IDEA.
@@ -36,7 +37,7 @@
   }
 
   public void setName(String name) {
-    this.name = name.substring(0, 1).toLowerCase() + name.substring(1);
+    this.name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);
   }
 
   public boolean equals(Object o) {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeEvent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeEvent.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeEvent.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/SheetStateChangeEvent.java Wed Oct 25 14:00:42 2006
@@ -20,7 +20,7 @@
 import javax.faces.event.FacesEvent;
 import javax.faces.event.FacesListener;
 
-/**
+/*
  * User: weber
  * Date: 13.12.2004
  * Time: 16:25:03
@@ -36,7 +36,9 @@
   }
 
   public void processListener(FacesListener facesListener) {
-    ((SheetStateChangeListener) facesListener).processSheetStateChange(this);
+    if (facesListener instanceof SheetStateChangeListener) {
+      ((SheetStateChangeListener) facesListener).processSheetStateChange(this);
+    }
   }
 
 }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/TabChangeEvent.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/TabChangeEvent.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/TabChangeEvent.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/event/TabChangeEvent.java Wed Oct 25 14:00:42 2006
@@ -41,7 +41,9 @@
   }
 
   public void processListener(FacesListener facesListener) {
-    ((TabChangeListener) facesListener).processTabChange(this);
+    if (facesListener instanceof TabChangeListener) {
+      ((TabChangeListener) facesListener).processTabChange(this);
+    }
   }
 
   public int getOldTabIndex() {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/RendererBase.java Wed Oct 25 14:00:42 2006
@@ -47,6 +47,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Arrays;
+import java.util.Locale;
 
 public abstract class RendererBase
     extends Renderer implements TobagoRenderer {
@@ -149,7 +150,7 @@
       name = name.substring("javax.faces.".length());
       LOG.warn("patching renderer to   " + name);
     }
-    name = name.substring(0, 1).toLowerCase() + name.substring(1);
+    name = name.substring(0, 1).toLowerCase(Locale.ENGLISH) + name.substring(1);
     return name;
   }
 

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java Wed Oct 25 14:00:42 2006
@@ -27,6 +27,7 @@
  * Time: 10:56:39
  */
 public class CommandTagExtraInfo extends TagExtraInfo {
+  private static final ValidationMessage[] EMPTY_MESSAGE = new ValidationMessage[0];
   public ValidationMessage[] validate(TagData data) {
     Object action = data.getAttribute("action");
     Object onclick = data.getAttribute("onclick");
@@ -38,7 +39,7 @@
     } else if (onclick != null&&link != null) {
       return generateValidationMessages(data);
     }
-    return null;
+    return EMPTY_MESSAGE;
   }
 
   private ValidationMessage[] generateValidationMessages(TagData data) {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/AccessKeyMap.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/AccessKeyMap.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/AccessKeyMap.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/AccessKeyMap.java Wed Oct 25 14:00:42 2006
@@ -19,6 +19,7 @@
 import javax.faces.context.FacesContext;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Locale;
 
 public class AccessKeyMap {
 
@@ -59,7 +60,7 @@
   }
 
   public static boolean addAccessKey(FacesContext facesContext, Character key) {
-    key = new Character(key.toString().toLowerCase().charAt(0));
+    key = new Character(key.toString().toLowerCase(Locale.ENGLISH).charAt(0));
     final AccessKeyMap instance = getInstance(facesContext);
     if (instance.getSet().contains(key)) {
       instance.addDublicated(key.charValue());

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataFilter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataFilter.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataFilter.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataFilter.java Wed Oct 25 14:00:42 2006
@@ -119,8 +119,13 @@
       LOG.error("Not implemented for non HttpServletRequest");
       wrapper = request;
     }
+    ServletResponse wrappedResponse;
+    if (response instanceof HttpServletResponse) {
+      wrappedResponse = new TobagoResponse((HttpServletResponse) response);
+    } else {
+      wrappedResponse = response;
+    }
 
-    TobagoResponse wrappedResponse = new TobagoResponse((HttpServletResponse) response);
     chain.doFilter(wrapper, wrappedResponse);
   }
 

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/WeblogicWorkaroundServlet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/WeblogicWorkaroundServlet.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/WeblogicWorkaroundServlet.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/webapp/WeblogicWorkaroundServlet.java Wed Oct 25 14:00:42 2006
@@ -76,11 +76,13 @@
   private void callInit(String className) {
     try {
       Class aClass = Class.forName(className);
-      ServletContextListener listener = (ServletContextListener)
-          aClass.newInstance();
-      listener.contextInitialized(
-          new ServletContextEvent(getServletContext()));
-    } catch (Exception e) {
+      ServletContextListener listener = (ServletContextListener) aClass.newInstance();
+      listener.contextInitialized(new ServletContextEvent(getServletContext()));
+    } catch (ClassNotFoundException e) {
+      LOG.error("", e);
+    } catch (IllegalAccessException e) {
+      LOG.error("", e);
+    } catch (InstantiationException e) {
       LOG.error("", e);
     }
   }

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Wed Oct 25 14:00:42 2006
@@ -54,6 +54,7 @@
     UIDateInput dateInput = (UIDateInput) link.getForComponent();
     if (dateInput == null) {
       LOG.error("No required UIDateInput component found.");
+      return;
     }
     String idPrefix = dateInput.getId() + "_picker";
     Map<String, Object>  attributes = link.getAttributes();

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ImageRenderer.java Wed Oct 25 14:00:42 2006
@@ -42,6 +42,7 @@
 import javax.faces.component.UIGraphic;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
+import java.util.Locale;
 
 public class ImageRenderer extends RendererBase {
   
@@ -58,7 +59,7 @@
     final String value = graphic.getUrl();
     String src = value;
     if (src != null) {
-      final String ucSrc = src.toUpperCase();
+      final String ucSrc = src.toUpperCase(Locale.ENGLISH);
       if (ucSrc.startsWith("HTTP:") || ucSrc.startsWith("FTP:")
           || ucSrc.startsWith("/")) {
         // absolute Path to image : nothing to do

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/LabelRenderer.java Wed Oct 25 14:00:42 2006
@@ -42,6 +42,7 @@
 import javax.faces.component.UIOutput;
 import javax.faces.context.FacesContext;
 import java.io.IOException;
+import java.util.Locale;
 
 public class LabelRenderer extends RendererBase {
 
@@ -49,7 +50,7 @@
 
   private void createClassAttribute(UIComponent component) {
 
-    String rendererType = component.getRendererType().toLowerCase();
+    String rendererType = component.getRendererType().toLowerCase(Locale.ENGLISH);
     String name = getRendererName(rendererType);
 
     UIComponent parent = findParent(component);

Modified: myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FaceletAnnotationVisitor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FaceletAnnotationVisitor.java?view=diff&rev=467762&r1=467761&r2=467762
==============================================================================
--- myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FaceletAnnotationVisitor.java (original)
+++ myfaces/tobago/trunk/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/FaceletAnnotationVisitor.java Wed Oct 25 14:00:42 2006
@@ -97,10 +97,8 @@
       }
       Document document = createDocument(libraryClass);
 
-      writeFaceletTaglibHandler(unit);
-
       writeFaceletTaglibConfig(taglibAnnotation, document, packageDeclaration);
-
+      writeFaceletTaglibHandler(unit, libraryClass);
     }
   }
 
@@ -130,12 +128,12 @@
     }
   }
 
-  private void writeFaceletTaglibHandler(JCompUnit unit) throws IOException {
+  private void writeFaceletTaglibHandler(JCompUnit unit, JClass clazz) throws IOException {
     JSourceWriter sourceWriter = null;
     try {
       Writer writer = getEnv().getFiler().createTextFile(Filer.Location.SOURCE_TREE,
           unit.getPackageName(),
-          new File(unit.getFilename(null).substring(unit.getPackageName().length()+1)), null);
+          new File(clazz.getLocalName()+".java"), null);
       sourceWriter = new JSourceWriter(writer);
       unit.print(sourceWriter);
     } finally{