[jira] [Created] (TAP5-1520) ConcurrentModificationException while modify unclaimed private collection from different Threads

2011-05-05 Thread Maxim Ulanovskiy (JIRA)
ConcurrentModificationException while modify unclaimed private collection from 
different Threads


 Key: TAP5-1520
 URL: https://issues.apache.org/jira/browse/TAP5-1520
 Project: Tapestry 5
  Issue Type: Bug
  Components: tapestry-core
Affects Versions: 5.2.5
Reporter: Maxim Ulanovskiy


TestCase: create two parallel requests to the page bellow
first request to read action - /TestConcurrency.read
second request to write action - /TestConcurrency.write

TestConcurrency.tml:
...
t:actionlink t:id=readread/t:actionlink
t:actionlink t:id=writewrite/t:actionlink
...

public class TestConcurrency {

private ListString testDie = new ArrayListString();

public void onActivate() {
for(int i=0; i1000; i++)
testDie.add(init);
}

void onActionFromRead() {
for(String s : testDie)
System.out.println(s);
}
void onActionFromWrite() {
for(int i=0; i10; i++)
testDie.add(testDie+i);
}
}

From what I've found out with debugger is that direct access to ListString 
testDie is replaced with UnclaimedFieldWorker.UnclaimedFieldConduit  but when 
PerthreadManagerImpl is called  it fails to find thread local value in 
internal map and returnes default value - the same object for both threads:
public class PerthreadManagerImpl {

T PerThreadValueT createValue(final Object key)
{
return new PerThreadValueT()
{
public T get()
{
return get(null);
}

public T get(T defaultValue)
{
Map map = getPerthreadMap();
//  NO SUCH KEY IN map 
if (map.containsKey(key))
{
Object storedValue = map.get(key);

if (storedValue == NULL_VALUE)
return null;

return (T) storedValue;
}

return defaultValue;
}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Closed] (TAP5-1520) ConcurrentModificationException while modify unclaimed private collection from different Threads

2011-05-05 Thread Thiago H. de Paula Figueiredo (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thiago H. de Paula Figueiredo closed TAP5-1520.
---

Resolution: Invalid

Hi!

The error here is in your code: you should never initialize a field with a 
non-atomic value. An event handler like onActivate(), @BeginRender or some 
event triggered by Form.

Please post in the user mailing list before posting bugs.

Cheers!

Thiago

 ConcurrentModificationException while modify unclaimed private collection 
 from different Threads
 

 Key: TAP5-1520
 URL: https://issues.apache.org/jira/browse/TAP5-1520
 Project: Tapestry 5
  Issue Type: Bug
  Components: tapestry-core
Affects Versions: 5.2.5
Reporter: Maxim Ulanovskiy

 TestCase: create two parallel requests to the page bellow
 first request to read action - /TestConcurrency.read
 second request to write action - /TestConcurrency.write
 TestConcurrency.tml:
 ...
 t:actionlink t:id=readread/t:actionlink
 t:actionlink t:id=writewrite/t:actionlink
 ...
 public class TestConcurrency {
 private ListString testDie = new ArrayListString();
 
 public void onActivate() {
 for(int i=0; i1000; i++)
 testDie.add(init);
 }
 void onActionFromRead() {
 for(String s : testDie)
 System.out.println(s);
 }
 void onActionFromWrite() {
 for(int i=0; i10; i++)
 testDie.add(testDie+i);
 }
 }
 From what I've found out with debugger is that direct access to ListString 
 testDie is replaced with UnclaimedFieldWorker.UnclaimedFieldConduit  but when 
 PerthreadManagerImpl is called  it fails to find thread local value in 
 internal map and returnes default value - the same object for both threads:
 public class PerthreadManagerImpl {
 T PerThreadValueT createValue(final Object key)
 {
 return new PerThreadValueT()
 {
 public T get()
 {
 return get(null);
 }
 public T get(T defaultValue)
 {
 Map map = getPerthreadMap();
 //  NO SUCH KEY IN map 
 if (map.containsKey(key))
 {
 Object storedValue = map.get(key);
 if (storedValue == NULL_VALUE)
 return null;
 return (T) storedValue;
 }
 return defaultValue;
 }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


svn commit: r1099864 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/base/ test/app1/ test/java/org/apache/tapestry5/corelib/base/ test/java/org/apache/tapestr

2011-05-05 Thread robertdzeigler
Author: robertdzeigler
Date: Thu May  5 16:31:50 2011
New Revision: 1099864

URL: http://svn.apache.org/viewvc?rev=1099864view=rev
Log:
TAP5-1496: Link components should support easily adding request parameters to 
the generated link

Added:
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkQueryParameters.tml

tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/LinkQueryParameters.java
Modified:

tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java

tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/base/AbstractLinkTest.java

tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java

tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java?rev=1099864r1=1099863r2=1099864view=diff
==
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java
 Thu May  5 16:31:50 2011
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2007, 2008, 2009, 2011 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.
@@ -22,6 +22,8 @@ import org.apache.tapestry5.dom.Element;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 
+import java.util.Map;
+
 /**
  * Provides base utilities for classes that generate clickable links.
  */
@@ -41,6 +43,14 @@ public abstract class AbstractLink imple
 @Parameter(false)
 private boolean disabled;
 
+/**
+ * If specified, the parameters are added to the link as query parameters 
in key=value fashion.
+ * Both values will be coerced to string using value encoder.
+ * @since 5.3
+ */
+@Parameter(allowNull = false)
+private MapString, ? parameters;
+
 @Inject
 private ComponentResources resources;
 
@@ -84,6 +94,8 @@ public abstract class AbstractLink imple
  */
 protected final void writeLink(MarkupWriter writer, Link link, Object... 
namesAndValues)
 {
+addParameters(link);
+
 element = writer.element(a, href, buildHref(link));
 
 writer.attributes(namesAndValues);
@@ -94,6 +106,21 @@ public abstract class AbstractLink imple
 }
 
 /**
+ * Adds any user-defined parameters as query parameters.
+ * @param link
+ */
+protected final void addParameters(Link link)
+{
+   if (!resources.isBound(parameters))
+   return;
+
+   for(Map.EntryString,? entry : parameters.entrySet())
+   {
+   link.addParameterValue(entry.getKey(), entry.getValue());
+   }
+}
+
+/**
  * Returns the most recently rendered {@link org.apache.tapestry5.Link} 
for this component. Subclasses calculate
  * their link value as they render, and the value is valid until the end 
of the request, or the next time the same
  * component renders itself (if inside a loop).

Added: 
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkQueryParameters.tml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkQueryParameters.tml?rev=1099864view=auto
==
--- 
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkQueryParameters.tml 
(added)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkQueryParameters.tml 
Thu May  5 16:31:50 2011
@@ -0,0 +1,30 @@
+html t:type=border 
xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; 
xmlns:p=tapestry:parameter
+h1Link Query Parameter Demo/h1
+
+ul
+lia t:type=pagelink page=LinkQueryParametersPage Link With No 
Parameters/a/li
+lia t:type=pagelink page=LinkQueryParameters 
parameters=emptyParametersPage Link With Explicitly Empty Parameters/a/li
+lia t:type=pagelink page=LinkQueryParameters 
parameters=nonEmptyParametersPage Link With Parameters/a/li
+
+lia t:type=actionlinkAction Link With No Parameters/a/li
+lia t:type=actionlink parameters=emptyParametersAction Link 
With Explicitly Empty Parameters/a/li
+lia t:type=actionlink parameters=nonEmptyParametersAction Link 
With Parameters/a/li
+
+lia t:type=eventlink event=parameterCheckEvent Link With No 

[jira] [Resolved] (TAP5-1496) Link components should support easily adding request parameters to the generated link

2011-05-05 Thread Robert Zeigler (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Zeigler resolved TAP5-1496.
--

   Resolution: Fixed
Fix Version/s: 5.3.0

Fixed. New parameter name is parameters rather than the more verbose 
requestParameters.

 Link components should support easily adding request parameters to the 
 generated link
 -

 Key: TAP5-1496
 URL: https://issues.apache.org/jira/browse/TAP5-1496
 Project: Tapestry 5
  Issue Type: Improvement
  Components: tapestry-core
Affects Versions: 5.3
Reporter: Robert Zeigler
Assignee: Robert Zeigler
Priority: Minor
 Fix For: 5.3.0


 It would be nice to have a parameters or requestParameters component 
 parameter for the link components.  This would take the form of a map with 
 the keys being the parameter names and the values being the parameter values. 
  Currently, if you need parameter values, the simplest solution is to forgo 
 the component and generate your own link.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TAP5-1496) Link components should support easily adding request parameters to the generated link

2011-05-05 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/TAP5-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13029456#comment-13029456
 ] 

Hudson commented on TAP5-1496:
--

Integrated in tapestry-trunk-freestyle #337 (See 
[https://builds.apache.org/hudson/job/tapestry-trunk-freestyle/337/])
TAP5-1496: Link components should support easily adding request parameters 
to the generated link


 Link components should support easily adding request parameters to the 
 generated link
 -

 Key: TAP5-1496
 URL: https://issues.apache.org/jira/browse/TAP5-1496
 Project: Tapestry 5
  Issue Type: Improvement
  Components: tapestry-core
Affects Versions: 5.3
Reporter: Robert Zeigler
Assignee: Robert Zeigler
Priority: Minor
 Fix For: 5.3.0


 It would be nice to have a parameters or requestParameters component 
 parameter for the link components.  This would take the form of a map with 
 the keys being the parameter names and the values being the parameter values. 
  Currently, if you need parameter values, the simplest solution is to forgo 
 the component and generate your own link.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Assigned] (TAP5-999) Implement an agnostic tapestry.js layer + adapters to allow developers to switch from prototype to jquery

2011-05-05 Thread Howard M. Lewis Ship (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Howard M. Lewis Ship reassigned TAP5-999:
-

Assignee: Howard M. Lewis Ship

 Implement an agnostic tapestry.js layer + adapters to allow developers to 
 switch from prototype to jquery
 -

 Key: TAP5-999
 URL: https://issues.apache.org/jira/browse/TAP5-999
 Project: Tapestry 5
  Issue Type: Wish
  Components: tapestry-core
Affects Versions: 5.1.0.7, 5.0.19
Reporter: Christophe Cordenier
Assignee: Howard M. Lewis Ship

 As per the discussion on the mailing about Tapestry 5 and jQuery, i create 
 this JIRA to compile the toughts of everyone for this feature.
 As Howard said on the mailing list, goals are :
 Goal #1: Backwards compatibility
 Goal #2: Documented
 Goal #3: Plugability / Extensibility / Overridablilty
 First design thoughts suggested by howard are (extracted from Howard's 
 answer) :
 1. tapestry.js defines a Tapestry namespace with key function properties for 
 the standard stuff
 2. split current tapestry.js into more smaller files
 3. In addition to tapestry.js, ... include either 
 tapestry-prototype-adapter.js (plus prototype.js and scriptaculous.js) OR 
 tapestry-jquery-adapter.js (plus jquery.js).
 4. tapestry.js [should] be smaller handlers that often just fire additional 
 events; a cascade of events that eventually results in server-side requests
 Objectives :
 1. make certain parts more pluggable i.e. Popup Bubbles
 2. write javascript with functional closures
 3. ... element could have at most one active animation; the animation would 
 have to complete before the next one (cf. jQuery animation and queuing 
 mechanism)
 Challenges :
 1. Remove prototype code from tapestry.js
 2. Keep backward compatibility with existing Tapestry object

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


svn commit: r1100036 - in /tapestry/tapestry5/trunk: plastic/src/main/java/org/apache/tapestry5/plastic/ tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/ tapestry-core/src/main/java/o

2011-05-05 Thread robertdzeigler
Author: robertdzeigler
Date: Fri May  6 03:26:02 2011
New Revision: 1100036

URL: http://svn.apache.org/viewvc?rev=1100036view=rev
Log:
TAP5-1495: Tapestry's property expression language should support map creation
Fix minor typo in plastic documentation
Clarify parameters parameter documentation in AbstractLink.

Modified:

tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/InstructionBuilder.java

tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g

tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g

tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/base/AbstractLink.java

tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/test/app1/LinkQueryParameters.tml

tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java

tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java

tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EchoBean.java

tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/PropertyConduitSourceImplTest.java

Modified: 
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/InstructionBuilder.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/InstructionBuilder.java?rev=1100036r1=1100035r2=1100036view=diff
==
--- 
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/InstructionBuilder.java
 (original)
+++ 
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/InstructionBuilder.java
 Fri May  6 03:26:02 2011
@@ -28,7 +28,7 @@ import java.lang.reflect.Method;
  * try/catch blocks}, is more like a DSL (domain specific language), and is 
based on callbacks. This looks better in
  * Groovy and will be more reasonable once JDK 1.8 closures are available; in 
the meantime, it means some deeply nested
  * inner classes, but helps ensure that correct bytecode is generated and 
helps to limit the amount of bookkeeping is
- * necessary on the part of coce using InstructionBuilder.
+ * necessary on the part of code using InstructionBuilder.
  */
 @SuppressWarnings(rawtypes)
 public interface InstructionBuilder

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g?rev=1100036r1=1100035r2=1100036view=diff
==
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionLexer.g
 Fri May  6 03:26:02 2011
@@ -1,4 +1,4 @@
-// Copyright 2008, 2010 The Apache Software Foundation
+// Copyright 2008, 2010, 2011 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.
@@ -53,7 +53,10 @@ RPAREN   :   ')';
 LBRACKET:  '[';
 RBRACKET:  ']';
 COMMA  :   ',';
-BANG:  '!';
+BANG   :   '!';
+LBRACE :   '{';
+RBRACE :   '}';
+COLON  :   ':';
 
 fragment QUOTE
:   '\'';

Modified: 
tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g?rev=1100036r1=1100035r2=1100036view=diff
==
--- 
tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g
 (original)
+++ 
tapestry/tapestry5/trunk/tapestry-core/src/main/antlr/org/apache/tapestry5/internal/antlr/PropertyExpressionParser.g
 Fri May  6 03:26:02 2011
@@ -1,4 +1,4 @@
-// Copyright 2008, 2009 The Apache Software Foundation
+// Copyright 2008, 2009, 2011 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.
@@ -30,6 +30,8 @@ tokens
INVOKE;
// A List (top level, or as method parameter)
LIST;
+   //A Map (top level, or as 

[jira] [Updated] (TAP5-1495) Tapestry's property expression language should support map creation

2011-05-05 Thread Robert Zeigler (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Zeigler updated TAP5-1495:
-

Summary: Tapestry's property expression language should support map 
creation  (was: tapestry expressions should support a map creation)

 Tapestry's property expression language should support map creation
 ---

 Key: TAP5-1495
 URL: https://issues.apache.org/jira/browse/TAP5-1495
 Project: Tapestry 5
  Issue Type: Improvement
  Components: tapestry-core
Affects Versions: 5.3
Reporter: Robert Zeigler
Assignee: Robert Zeigler

 Currently, tapestry expressions support property access, method calls, null 
 checks (?.), and quick list creation (['a',b,...]), but there is no support 
 for map creation.
 It would be nice to be able to write:
 {a=b,c=d} 
 to quickly and easily create maps.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TAP5-1495) Tapestry's property expression language should support map creation

2011-05-05 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/TAP5-1495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13029717#comment-13029717
 ] 

Hudson commented on TAP5-1495:
--

Integrated in tapestry-trunk-freestyle #338 (See 
[https://builds.apache.org/hudson/job/tapestry-trunk-freestyle/338/])
TAP5-1495: Tapestry's property expression language should support map 
creation
Fix minor typo in plastic documentation
Clarify parameters parameter documentation in AbstractLink.


 Tapestry's property expression language should support map creation
 ---

 Key: TAP5-1495
 URL: https://issues.apache.org/jira/browse/TAP5-1495
 Project: Tapestry 5
  Issue Type: Improvement
  Components: tapestry-core
Affects Versions: 5.3
Reporter: Robert Zeigler
Assignee: Robert Zeigler

 Currently, tapestry expressions support property access, method calls, null 
 checks (?.), and quick list creation (['a',b,...]), but there is no support 
 for map creation.
 It would be nice to be able to write:
 {a=b,c=d} 
 to quickly and easily create maps.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Resolved] (TAP5-1495) Tapestry's property expression language should support map creation

2011-05-05 Thread Robert Zeigler (JIRA)

 [ 
https://issues.apache.org/jira/browse/TAP5-1495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Zeigler resolved TAP5-1495.
--

   Resolution: Fixed
Fix Version/s: 5.3.0

Final map syntax: {a: b, c: d}

 Tapestry's property expression language should support map creation
 ---

 Key: TAP5-1495
 URL: https://issues.apache.org/jira/browse/TAP5-1495
 Project: Tapestry 5
  Issue Type: Improvement
  Components: tapestry-core
Affects Versions: 5.3
Reporter: Robert Zeigler
Assignee: Robert Zeigler
 Fix For: 5.3.0


 Currently, tapestry expressions support property access, method calls, null 
 checks (?.), and quick list creation (['a',b,...]), but there is no support 
 for map creation.
 It would be nice to be able to write:
 {a=b,c=d} 
 to quickly and easily create maps.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira