tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r545226 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry: TapestryFilter.java corelib/components/BeanEditForm.java corelib/components/Select.java internal/services/InternalClassTransformationImpl.java
Date Thu, 07 Jun 2007 16:10:34 GMT
Author: hlship
Date: Thu Jun  7 09:10:33 2007
New Revision: 545226

URL: http://svn.apache.org/viewvc?view=rev&rev=545226
Log:
TAPESTRY-1511: VerifyError when using inner classes inside components

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Select.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalClassTransformationImpl.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java?view=diff&rev=545226&r1=545225&r2=545226
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/TapestryFilter.java
Thu Jun  7 09:10:33 2007
@@ -84,7 +84,7 @@
                 ServletApplicationInitializer.class);
 
         ai.initializeApplication(filterConfig.getServletContext());
-        
+
         _registry.eagerLoadServices();
 
         _handler = _registry.getService(
@@ -147,6 +147,8 @@
     /** Shuts down and discards the registry. */
     public final void destroy()
     {
+        destroy(_registry);
+
         _registry.shutdown();
 
         _registry = null;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java?view=diff&rev=545226&r1=545225&r2=545226
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
Thu Jun  7 09:10:33 2007
@@ -181,32 +181,32 @@
         {
             public Messages getContainerMessages()
             {
-                return getResources().getContainerMessages();
+                return _resources.getContainerMessages();
             }
 
             public String getLabel()
             {
-                return getPropertyEditModel().getLabel();
+                return _propertyEditModel.getLabel();
             }
 
             public String getPropertyId()
             {
-                return getPropertyEditModel().getId();
+                return _propertyEditModel.getId();
             }
 
             public Class getPropertyType()
             {
-                return getPropertyEditModel().getPropertyType();
+                return _propertyEditModel.getPropertyType();
             }
 
             public Object getPropertyValue()
             {
-                return getPropertyEditModel().getConduit().get(getObject());
+                return _propertyEditModel.getConduit().get(getObject());
             }
 
             public Translator getTranslator()
             {
-                return _translatorDefaultSource.find(getPropertyEditModel().getPropertyType());
+                return _translatorDefaultSource.find(_propertyEditModel.getPropertyType());
             }
 
             public FieldValidator getValidator(Field field)
@@ -222,7 +222,7 @@
 
             public void setPropertyValue(Object value)
             {
-                getPropertyEditModel().getConduit().set(getObject(), value);
+                _propertyEditModel.getConduit().set(getObject(), value);
             }
         };
 
@@ -349,16 +349,6 @@
     public void recordError(String errorMessage)
     {
         _form.recordError(errorMessage);
-    }
-
-    private ComponentResources getResources()
-    {
-        return _resources;
-    }
-
-    private PropertyModel getPropertyEditModel()
-    {
-        return _propertyEditModel;
     }
 
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Select.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Select.java?view=diff&rev=545226&r1=545225&r2=545226
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Select.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/Select.java
Thu Jun  7 09:10:33 2007
@@ -49,7 +49,7 @@
 
         public Renderer(MarkupWriter writer)
         {
-            super(writer, getEncoder());
+            super(writer, _encoder);
         }
 
         @Override
@@ -57,18 +57,8 @@
         {
             Object value = optionModel.getValue();
 
-            return isOptionValueSelected(value);
+            return value == _value || (value != null && value.equals(_value));
         }
-    }
-
-    private boolean isOptionValueSelected(Object value)
-    {
-        return value == _value || (value != null && value.equals(_value));
-    }
-
-    private ValueEncoder getEncoder()
-    {
-        return _encoder;
     }
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalClassTransformationImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalClassTransformationImpl.java?view=diff&rev=545226&r1=545225&r2=545226
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalClassTransformationImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalClassTransformationImpl.java
Thu Jun  7 09:10:33 2007
@@ -1358,7 +1358,10 @@
 
     public void replaceReadAccess(String fieldName, String methodName)
     {
-        String body = String.format("$_ = %s();", methodName);
+        // Explicitly reference $0 (aka "this") because of TAPESTRY-1511.
+        // $0 is valid even inside a static method.
+
+        String body = String.format("$_ = $0.%s();", methodName);
 
         if (_fieldReadTransforms == null) _fieldReadTransforms = newMap();
 
@@ -1371,7 +1374,10 @@
 
     public void replaceWriteAccess(String fieldName, String methodName)
     {
-        String body = String.format("%s($1);", methodName);
+        // Explicitly reference $0 (aka "this") because of TAPESTRY-1511.
+        // $0 is valid even inside a static method.
+
+        String body = String.format("$0.%s($1);", methodName);
 
         if (_fieldWriteTransforms == null) _fieldWriteTransforms = newMap();
 
@@ -1406,6 +1412,8 @@
         }
     }
 
+    static final int SYNTHETIC = 0x00001000;
+
     private void replaceFieldAccess()
     {
         // Provide empty maps here, to make the code in the inner class a tad
@@ -1429,8 +1437,9 @@
                         : _fieldWriteTransforms;
 
                 String body = transformMap.get(access.getFieldName());
+                if (body == null) return;
 
-                if (body != null) access.replace(body);
+                access.replace(body);
             }
         };
 



Mime
View raw message