You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2008/01/25 23:46:08 UTC
svn commit: r615385 - in /tapestry/tapestry5/trunk: src/site/apt/
tapestry-core/src/main/java/org/apache/tapestry/internal/services/
tapestry-core/src/test/app1/
tapestry-core/src/test/java/org/apache/tapestry/integration/
tapestry-core/src/test/java/o...
Author: hlship
Date: Fri Jan 25 14:46:07 2008
New Revision: 615385
URL: http://svn.apache.org/viewvc?rev=615385&view=rev
Log:
TAPESTRY-2088: ClassNotFoundException when passing an int[] parameter to a component
Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/PrimitiveArrayParameterDemo.tml
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/IntArrayWriter.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/PrimitiveArrayParameterDemo.java
Modified:
tapestry/tapestry5/trunk/src/site/apt/index.apt
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCache.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCacheImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ParameterWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java
Modified: tapestry/tapestry5/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/index.apt?rev=615385&r1=615384&r2=615385&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/index.apt Fri Jan 25 14:46:07 2008
@@ -79,7 +79,7 @@
and new and improved integrations.
*--+--+--+
-| <<Library>> | <<Author >> | <<Description >>
+| <<Library>> | <<Author>> | <<Description>>
*--+--+--+
| {{{http://equanda.org/equanda-tapestry5/}equanda-tapestry5}} | Joachim Van der Auwera | Components useful for building enterprise applications. Includes Accordion, Tabs, Formtraversal. Amongst other things, these focus on easy input of data without the need for a mouse.
*--+--+--+
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCache.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCache.java?rev=615385&r1=615384&r2=615385&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCache.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCache.java Fri Jan 25 14:46:07 2008
@@ -23,7 +23,7 @@
/**
* Gets the Class instance for then give name.
*
- * @param className fully qualified class name
+ * @param className fully qualified class name, or an primtive type name, or an array name (in source format)
* @return the class instance
*/
Class forName(String className);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCacheImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCacheImpl.java?rev=615385&r1=615384&r2=615385&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCacheImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassCacheImpl.java Fri Jan 25 14:46:07 2008
@@ -16,6 +16,7 @@
import org.apache.tapestry.internal.events.InvalidationListener;
import org.apache.tapestry.ioc.internal.util.CollectionFactory;
+import org.apache.tapestry.ioc.services.ClassFabUtils;
import org.apache.tapestry.ioc.services.ClassFactory;
import java.util.Map;
@@ -43,11 +44,15 @@
if (result == null)
{
+ // This step is necessary to handle primitives and, especially, primitive arrays.
+
+ String jvmName = ClassFabUtils.toJVMBinaryName(className);
+
ClassLoader componentLoader = _classFactory.getClassLoader();
try
{
- result = Class.forName(className, true, componentLoader);
+ result = Class.forName(jvmName, true, componentLoader);
}
catch (ClassNotFoundException ex)
{
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ParameterWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ParameterWorker.java?rev=615385&r1=615384&r2=615385&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ParameterWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ParameterWorker.java Fri Jan 25 14:46:07 2008
@@ -27,8 +27,8 @@
import java.util.List;
/**
- * Responsible for identifying parameters via the {@link org.apache.tapestry.annotations.Parameter}
- * annotation on component fields. This is one of the most complex of the transformations.
+ * Responsible for identifying parameters via the {@link org.apache.tapestry.annotations.Parameter} annotation on
+ * component fields. This is one of the most complex of the transformations.
*/
public class ParameterWorker implements ComponentClassTransformWorker
{
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/PrimitiveArrayParameterDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/PrimitiveArrayParameterDemo.tml?rev=615385&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/PrimitiveArrayParameterDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/PrimitiveArrayParameterDemo.tml Fri Jan 25 14:46:07 2008
@@ -0,0 +1,10 @@
+<html t:type="Border"
+ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+
+ <h1>Primitive Array Parameter Demo</h1>
+
+
+ <t:intarraywriter array="values"/>
+
+</html>
+
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?rev=615385&r1=615384&r2=615385&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Fri Jan 25 14:46:07 2008
@@ -1511,4 +1511,15 @@
assertSourcePresent("<label for=\"title\" id=\"title:label\">Title</label>");
}
+
+ /**
+ * TAPESTRY-2088
+ */
+ @Test
+ public void primitive_array_as_parameter_type()
+ {
+ start("Primitive Array Parameter Demo");
+
+ assertSourcePresent("<ul><li>1</li><li>3</li><li>5</li><li>7</li><li>9</li></ul>");
+ }
}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/IntArrayWriter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/IntArrayWriter.java?rev=615385&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/IntArrayWriter.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/components/IntArrayWriter.java Fri Jan 25 14:46:07 2008
@@ -0,0 +1,40 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.integration.app1.components;
+
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.annotations.Parameter;
+
+public class IntArrayWriter
+{
+ @Parameter
+ private int[] _array;
+
+ boolean beginRender(MarkupWriter writer)
+ {
+ writer.element("ul");
+
+ for (int x : _array)
+ {
+ writer.element("li");
+ writer.write(String.valueOf(x));
+ writer.end();
+ }
+
+ writer.end();
+
+ return false; // don't render body, etc.
+ }
+}
Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/PrimitiveArrayParameterDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/PrimitiveArrayParameterDemo.java?rev=615385&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/PrimitiveArrayParameterDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/PrimitiveArrayParameterDemo.java Fri Jan 25 14:46:07 2008
@@ -0,0 +1,24 @@
+// Copyright 2008 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.package org.apache.tapestry.integration.app1.pages;
+
+package org.apache.tapestry.integration.app1.pages;
+
+public class PrimitiveArrayParameterDemo
+{
+
+ public int[] getValues()
+ {
+ return new int[]{1, 3, 5, 7, 9};
+ }
+}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java?rev=615385&r1=615384&r2=615385&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/Start.java Fri Jan 25 14:46:07 2008
@@ -210,6 +210,9 @@
new Item("AddedGridColumnsDemo", "Added Grid Columns Demo", "programatically adding grid columns"),
+ new Item("PrimitiveArrayParameterDemo", "Primitive Array Parameter Demo",
+ "use primitive array as parameter type"),
+
new Item("TrackEditor", "Generic Page Class Demo",
"demo use of generics with component classes and, particularily, with property types"));