Failed to parse the expression when we have repeated function invocations
Hi, Let's have a lambda expression: x->y->x-y Let's now assign it and invoke it indirectly: f = x->y->x-y; f(2)(1) >From the spec we have: "If the result of evaluating the function name is a LambdaExpression, the LambdaExpression is invoked with the supplied arguments. If the result of evaluating the LambdaExpression is another LambdaExpression, and the syntax contains repeated function invocations, such as func()()..., then the resultant LambdaExpression is in turn evaluated, and so on." During evaluation I'm receiving ParseException: javax.el.ELException: Failed to parse the expression [${(f = x->y->x-y; f(2)(1)}] at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:143) at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:169) at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:230) at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68) at javax.el.ELProcessor.getValue(ELProcessor.java:43) ... Caused by: org.apache.el.parser.ParseException: Encountered " "(" "( "" at line 1, column 23. Was expecting one of: "." ... ")" ... "[" ... ";" ... ">" ... "gt" ... "<" ... "lt" ... ">=" ... "ge" ... "<=" ... "le" ... "==" ... "eq" ... "!=" ... "ne" ... "&&" ... "and" ... "||" ... "or" ... "*" ... "+" ... "-" ... "/" ... "div" ... "%" ... "mod" ... "+=" ... at org.apache.el.parser.ELParser.generateParseException(ELParser.java:3083) at org.apache.el.parser.ELParser.jj_consume_token(ELParser.java:2965) at org.apache.el.parser.ELParser.NonLiteral(ELParser.java:1539) at org.apache.el.parser.ELParser.ValuePrefix(ELParser.java:1369) Regards Violeta
svn 1.8 and auto props
I just saw sebb doing a little experiment in the JMeter repository with svn:auto-props. Infra updated our svn repos to svn 1.8 and 1.8 has Repository Dictated Configuration: http://blogs.collab.net/subversion/the-road-to-repository-dictated-configuration-day-2-autoprops Thinking about the recurrent problems with svn-git or other clients not respecting local auto-props for svn:eol-style, this might be a useful application of RDC. Note that it seems the clients need to support it. So even after adding it we shouldn't immediately drop the auto props settings form our local svn config unless we are sure our clients respect the svn:auto-props. The exact merging rules are given in the blog cited above. Will see how sebb's experiment goes and them might do something similar here. Regards, Rainer - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Various shell-scripting idioms in bin/daemon.sh
On 18.07.2013 06:04, Mladen Turk wrote: > On 07/17/2013 11:59 PM, sebb wrote: >> Regardless, please consider documenting the script to explain why it >> does not use -n/-z if that is necessary to avoid bugs. >> > > It would be the same as documenting why one uses a+=1 instead a++ :) > I don't see where its written that one *must* use -n/-z at the first place. Coming from SunOS 4 times I agree. That "X$var" comparing with "Xvalue" idiom is or at least was very common in system shell scripts. No need to document, that is just practical shell language programming knowledge. The same to not using "-n" or "-z" for platform independent shell script. It seems to me that POSIX and the later Unix standards still do not standardize the allowed shell expression syntax. There is a standard "test" commandline util, but IMHO that's not the same. Regards, Rainer - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1504437 - in /tomcat/trunk/java/org/apache/el: Messages.properties lang/ExpressionBuilder.java parser/AstFunction.java parser/ELParser.java parser/ELParser.jjt
Author: markt Date: Thu Jul 18 11:40:26 2013 New Revision: 1504437 URL: http://svn.apache.org/r1504437 Log: Modify the grammar for function to permit multiple sets of parameters for lambda expressions. Implementing that handling is still a TODO. Modified: tomcat/trunk/java/org/apache/el/Messages.properties tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java tomcat/trunk/java/org/apache/el/parser/AstFunction.java tomcat/trunk/java/org/apache/el/parser/ELParser.java tomcat/trunk/java/org/apache/el/parser/ELParser.jjt Modified: tomcat/trunk/java/org/apache/el/Messages.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/Messages.properties?rev=1504437&r1=1504436&r2=1504437&view=diff == --- tomcat/trunk/java/org/apache/el/Messages.properties (original) +++ tomcat/trunk/java/org/apache/el/Messages.properties Thu Jul 18 11:40:26 2013 @@ -51,6 +51,7 @@ error.fnMapper.paramcount=Function ''{0} error.context.null=ELContext was null # Parser +error.funciton.tooManyMethodParameterSets=There are multiple sets of parameters specified for function [{0}] error.identifier.notjava=The identifier [{0}] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true. error.lambda.tooManyMethodParameterSets=There are more sets of method parameters specified than there are nested lambda expressions Modified: tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java?rev=1504437&r1=1504436&r2=1504437&view=diff == --- tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java (original) +++ tomcat/trunk/java/org/apache/el/lang/ExpressionBuilder.java Thu Jul 18 11:40:26 2013 @@ -212,7 +212,8 @@ public final class ExpressionBuilder imp } int pcnt = m.getParameterTypes().length; -if (node.jjtGetNumChildren() != pcnt) { +// AstFunction->MethodParameters->Parameters() +if (node.jjtGetChild(0).jjtGetNumChildren() != pcnt) { throw new ELException(MessageFactory.get( "error.fnMapper.paramcount", funcNode.getOutputName(), "" + pcnt, "" + node.jjtGetNumChildren())); Modified: tomcat/trunk/java/org/apache/el/parser/AstFunction.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstFunction.java?rev=1504437&r1=1504436&r2=1504437&view=diff == --- tomcat/trunk/java/org/apache/el/parser/AstFunction.java (original) +++ tomcat/trunk/java/org/apache/el/parser/AstFunction.java Thu Jul 18 11:40:26 2013 @@ -97,10 +97,11 @@ public final class AstFunction extends S if (obj instanceof LambdaExpression) { LambdaExpression le = (LambdaExpression) obj; // Build arguments -int numArgs = this.jjtGetNumChildren(); +// TODO handle multiple sets of arguments +int numArgs = this.jjtGetChild(0).jjtGetNumChildren(); Object[] args = new Object[numArgs]; for (int i = 0; i < numArgs; i++) { -args[i] = children[i].getValue(ctx); +args[i] = jjtGetChild(0).jjtGetChild(i).getValue(ctx); } return le.invoke(ctx, args); } @@ -111,15 +112,24 @@ public final class AstFunction extends S this.getOutputName())); } +// Not a lambda expression so must be a function. Check there is just a +// single set of method parameters +if (this.jjtGetNumChildren() != 1) { +throw new ELException(MessageFactory.get( +"error.funciton.tooManyMethodParameterSets", +getOutputName())); +} + +Node parameters = jjtGetChild(0); Class[] paramTypes = m.getParameterTypes(); Object[] params = null; Object result = null; -int numParams = this.jjtGetNumChildren(); +int numParams = parameters.jjtGetNumChildren(); if (numParams > 0) { params = new Object[numParams]; try { for (int i = 0; i < numParams; i++) { -params[i] = this.children[i].getValue(ctx); +params[i] = parameters.jjtGetChild(i).getValue(ctx); params[i] = coerceToType(params[i], paramTypes[i]); } } catch (ELException ele) { Modified: tomcat/trunk/java/org/apache/el/parser/ELParser.java URL: http://svn.apache.org/vi
Re: Various shell-scripting idioms in bin/daemon.sh
On 18 July 2013 10:13, Rainer Jung wrote: > On 18.07.2013 06:04, Mladen Turk wrote: >> On 07/17/2013 11:59 PM, sebb wrote: >>> Regardless, please consider documenting the script to explain why it >>> does not use -n/-z if that is necessary to avoid bugs. >>> >> >> It would be the same as documenting why one uses a+=1 instead a++ :) >> I don't see where its written that one *must* use -n/-z at the first place. > > Coming from SunOS 4 times I agree. That "X$var" comparing with "Xvalue" > idiom is or at least was very common in system shell scripts. No need to > document, that is just practical shell language programming knowledge. I'm willing to accept that; though I think the use of . is not ideal. > The same to not using "-n" or "-z" for platform independent shell > script. It seems to me that POSIX and the later Unix standards still do > not standardize the allowed shell expression syntax. There is a standard > "test" commandline util, but IMHO that's not the same. This is different, because for many, using -n or -z is going to be common practise. If it's important *not* to use them here, then it should be documented why. Clearly the OP did not know why -n and -z were not used. Please let future maintainers know. > Regards, > > Rainer > > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1504475 - in /tomcat/trunk: java/org/apache/el/parser/AstFunction.java java/org/apache/el/parser/AstLambdaExpression.java test/org/apache/el/parser/TestAstLambdaExpression.java
Author: markt Date: Thu Jul 18 13:57:17 2013 New Revision: 1504475 URL: http://svn.apache.org/r1504475 Log: Fix handling expressions of the form: v = (x->y->x-y); v(2)(1) There is still some further clean-up that can be done. Modified: tomcat/trunk/java/org/apache/el/parser/AstFunction.java tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java tomcat/trunk/test/org/apache/el/parser/TestAstLambdaExpression.java Modified: tomcat/trunk/java/org/apache/el/parser/AstFunction.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstFunction.java?rev=1504475&r1=1504474&r2=1504475&view=diff == --- tomcat/trunk/java/org/apache/el/parser/AstFunction.java (original) +++ tomcat/trunk/java/org/apache/el/parser/AstFunction.java Thu Jul 18 13:57:17 2013 @@ -95,15 +95,19 @@ public final class AstFunction extends S Object obj = ctx.getELResolver().getValue(ctx, null, this.localName); if (obj instanceof LambdaExpression) { -LambdaExpression le = (LambdaExpression) obj; // Build arguments -// TODO handle multiple sets of arguments -int numArgs = this.jjtGetChild(0).jjtGetNumChildren(); -Object[] args = new Object[numArgs]; -for (int i = 0; i < numArgs; i++) { -args[i] = jjtGetChild(0).jjtGetChild(i).getValue(ctx); +int i = 0; +while (obj instanceof LambdaExpression && i < this.jjtGetNumChildren()) { +Node parameters = jjtGetChild(i); +int numArgs = parameters.jjtGetNumChildren(); +Object[] args = new Object[numArgs]; +for (int j = 0; j < numArgs; j++) { +args[j] = parameters.jjtGetChild(j).getValue(ctx); +} +obj = ((LambdaExpression) obj).invoke(args); +i++; } -return le.invoke(ctx, args); +return obj; } } Modified: tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java?rev=1504475&r1=1504474&r2=1504475&view=diff == --- tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java (original) +++ tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java Thu Jul 18 13:57:17 2013 @@ -76,7 +76,7 @@ public class AstLambdaExpression extends le.setELContext(ctx); if (jjtGetNumChildren() == 2) { -if (formalParameters.isEmpty()) { +if (formalParameters.isEmpty() && !(parent instanceof AstLambdaExpression)) { // No formal parameters or method parameters so invoke the // expression. If this is a nested expression inform the outer // expression that an invocation has occurred so the correct set @@ -130,7 +130,7 @@ public class AstLambdaExpression extends public void incMethodParameterIndex() { Node parent = jjtGetParent(); -if (parent instanceof AstLambdaExpression) { +if (parent instanceof LambdaExpression) { // Method parameter index is maintained by outermost lambda // expressions as that is where the parameters are ((AstLambdaExpression) parent).incMethodParameterIndex(); Modified: tomcat/trunk/test/org/apache/el/parser/TestAstLambdaExpression.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/el/parser/TestAstLambdaExpression.java?rev=1504475&r1=1504474&r2=1504475&view=diff == --- tomcat/trunk/test/org/apache/el/parser/TestAstLambdaExpression.java (original) +++ tomcat/trunk/test/org/apache/el/parser/TestAstLambdaExpression.java Thu Jul 18 13:57:17 2013 @@ -144,4 +144,14 @@ public class TestAstLambdaExpression { Integer.class); Assert.assertEquals(Integer.valueOf(1), result); } + + +@Test +public void testLambdaAsFunction() { +ELProcessor processor = new ELProcessor(); +Object result = +processor.getValue("v = (x->y->x-y); v(2)(1)", +Integer.class); +Assert.assertEquals(Integer.valueOf(1), result); +} } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Failed to parse the expression when we have repeated function invocations
On 18/07/2013 08:00, Violeta Georgieva wrote: > Hi, > > Let's have a lambda expression: > > x->y->x-y > > Let's now assign it and invoke it indirectly: > > f = x->y->x-y; f(2)(1) Several problems here. 1. The grammar didn't support functions having multiple sets of parameters. 2. The lambda expression handling in AstFunction only handled single parameters sets. 3. The incMethodParameterIndex() can't be used in this case so an alternative solution is required to the problem that addressed. All of these have been fixed in trunk. There is some more clean-up that can now be done. I look forward to your next brain teaser :) Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1504483 - in /tomcat/trunk/java/org/apache/el/parser: AstFunction.java AstLambdaExpression.java
Author: markt Date: Thu Jul 18 14:12:49 2013 New Revision: 1504483 URL: http://svn.apache.org/r1504483 Log: Simplify. Update comments. Modified: tomcat/trunk/java/org/apache/el/parser/AstFunction.java tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java Modified: tomcat/trunk/java/org/apache/el/parser/AstFunction.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstFunction.java?rev=1504483&r1=1504482&r2=1504483&view=diff == --- tomcat/trunk/java/org/apache/el/parser/AstFunction.java (original) +++ tomcat/trunk/java/org/apache/el/parser/AstFunction.java Thu Jul 18 14:12:49 2013 @@ -97,14 +97,11 @@ public final class AstFunction extends S if (obj instanceof LambdaExpression) { // Build arguments int i = 0; -while (obj instanceof LambdaExpression && i < this.jjtGetNumChildren()) { -Node parameters = jjtGetChild(i); -int numArgs = parameters.jjtGetNumChildren(); -Object[] args = new Object[numArgs]; -for (int j = 0; j < numArgs; j++) { -args[j] = parameters.jjtGetChild(j).getValue(ctx); -} -obj = ((LambdaExpression) obj).invoke(args); +while (obj instanceof LambdaExpression && +i < this.jjtGetNumChildren()) { +Node args = jjtGetChild(i); +obj = ((LambdaExpression) obj).invoke( +((AstMethodParameters) args).getParameters(ctx)); i++; } return obj; Modified: tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java?rev=1504483&r1=1504482&r2=1504483&view=diff == --- tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java (original) +++ tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java Thu Jul 18 14:12:49 2013 @@ -29,8 +29,6 @@ import org.apache.el.util.MessageFactory public class AstLambdaExpression extends SimpleNode { -private int methodParameterIndex = 0; - public AstLambdaExpression(int id) { super(id); } @@ -76,23 +74,21 @@ public class AstLambdaExpression extends le.setELContext(ctx); if (jjtGetNumChildren() == 2) { -if (formalParameters.isEmpty() && !(parent instanceof AstLambdaExpression)) { -// No formal parameters or method parameters so invoke the -// expression. If this is a nested expression inform the outer -// expression that an invocation has occurred so the correct set -// of method parameters are used for the next invocation. -incMethodParameterIndex(); +if (formalParameters.isEmpty() && +!(parent instanceof AstLambdaExpression)) { +// No formal parameters or method parameters and not a nested +// expression so invoke the expression. return le.invoke(ctx, (Object[]) null); } else { -// Has formal parameters but no method parameters so return the -// expression for later evaluation +// Has formal parameters but no method parameters or is a nested +// expression so return the expression for later evaluation return le; } } // Always have to invoke the outer-most expression -methodParameterIndex = 2; +int methodParameterIndex = 2; Object result = le.invoke(((AstMethodParameters) children[methodParameterIndex]).getParameters(ctx)); methodParameterIndex++; @@ -111,11 +107,6 @@ public class AstLambdaExpression extends * If the inner most expression(s) do not require parameters then a * value will be returned once the outermost expression that does * require a parameter has been evaluated. - * - * When invoking an expression if it has nested expressions that do not - * have formal parameters then they will be evaluated as as part of that - * invocation. In this case the method parameters associated with those - * nested expressions need to be skipped. */ while (result instanceof LambdaExpression && methodParameterIndex < jjtGetNumChildren()) { @@ -128,17 +119,6 @@ public class AstLambdaExpression extends } -public void incMethodParameterIndex() { -Node parent = jjtGetParent(); -if (parent instanceof LambdaExpression) { -// Method parameter index is maintained by outermost
[Bug 55268] daemon.sh only waits for 10 seconds
https://issues.apache.org/bugzilla/show_bug.cgi?id=55268 Mark Thomas changed: What|Removed |Added Component|Integration |Catalina Version|7.0.42 |6.0.37 Product|Tomcat 7|Tomcat 6 Target Milestone|--- |default --- Comment #5 from Mark Thomas --- Update version -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
8.0-SNAPSHOT updated
Given recent progress, I have uploaded a snapshot of the current state of trunk to the Maven snapshot repository. Note that our Maven builds include full binary distributions (.zip & .tar.gz) so if folks want to test the latest Tomcat 8, they can without having to build from svn. The snapshot repo is here: https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat and the binaries can be found here: https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat/tomcat/8.0-SNAPSHOT/ I think we are at the point where we could do a 8.0.0-alpha release. The specs (Servlet 3.1, JSP 2.3, EL 3.0, WebSocket 1.0) are all implemented. There is still work to do to review the EG disucssions that covered various edge cases / things not in the spec to align the implementation with what the EG agreed was best practice but didn't make it into the spec. Any objections to starting the 8.0.0 release process? Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: 8.0-SNAPSHOT updated
+1 Show must go one, really exited to take a look at this new cat :) 2013/7/18 Nick Williams > No objection here. Things seem to be working well. I'm rather excited > about it. :-) > > Nick > > On Jul 18, 2013, at 11:11 AM, Mark Thomas wrote: > > > Given recent progress, I have uploaded a snapshot of the current state > > of trunk to the Maven snapshot repository. Note that our Maven builds > > include full binary distributions (.zip & .tar.gz) so if folks want to > > test the latest Tomcat 8, they can without having to build from svn. > > > > The snapshot repo is here: > > > https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat > > > > and the binaries can be found here: > > > https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat/tomcat/8.0-SNAPSHOT/ > > > > > > I think we are at the point where we could do a 8.0.0-alpha release. The > > specs (Servlet 3.1, JSP 2.3, EL 3.0, WebSocket 1.0) are all implemented. > > There is still work to do to review the EG disucssions that covered > > various edge cases / things not in the spec to align the implementation > > with what the EG agreed was best practice but didn't make it into the > spec. > > > > Any objections to starting the 8.0.0 release process? > > > > Mark > > > > - > > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: dev-h...@tomcat.apache.org > > > > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > >
Re: 8.0-SNAPSHOT updated
No objection here. Things seem to be working well. I'm rather excited about it. :-) Nick On Jul 18, 2013, at 11:11 AM, Mark Thomas wrote: > Given recent progress, I have uploaded a snapshot of the current state > of trunk to the Maven snapshot repository. Note that our Maven builds > include full binary distributions (.zip & .tar.gz) so if folks want to > test the latest Tomcat 8, they can without having to build from svn. > > The snapshot repo is here: > https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat > > and the binaries can be found here: > https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat/tomcat/8.0-SNAPSHOT/ > > > I think we are at the point where we could do a 8.0.0-alpha release. The > specs (Servlet 3.1, JSP 2.3, EL 3.0, WebSocket 1.0) are all implemented. > There is still work to do to review the EG disucssions that covered > various edge cases / things not in the spec to align the implementation > with what the EG agreed was best practice but didn't make it into the spec. > > Any objections to starting the 8.0.0 release process? > > Mark > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Failed to parse the expression when we have repeated function invocations
2013/7/18 Mark Thomas wrote: > > On 18/07/2013 08:00, Violeta Georgieva wrote: > > Hi, > > > > Let's have a lambda expression: > > > > x->y->x-y > > > > Let's now assign it and invoke it indirectly: > > > > f = x->y->x-y; f(2)(1) > > Several problems here. > > 1. The grammar didn't support functions having multiple sets of parameters. > > 2. The lambda expression handling in AstFunction only handled single > parameters sets. > > 3. The incMethodParameterIndex() can't be used in this case so an > alternative solution is required to the problem that addressed. > > All of these have been fixed in trunk. There is some more clean-up that > can now be done. > > I look forward to your next brain teaser :) > ;) If I modify the example above like this f = ()->y->2-y; f()(1) Then I'm receiving an exception: javax.el.ELException: Only [0] arguments were provided for a lambda expression that requires at least [1] at javax.el.LambdaExpression.invoke(LambdaExpression.java:60) at javax.el.LambdaExpression.invoke(LambdaExpression.java:92) at org.apache.el.parser.AstFunction.getValue(AstFunction.java:103) at org.apache.el.parser.AstSemicolon.getValue(AstSemicolon.java:37) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188) at javax.el.ELProcessor.getValue(ELProcessor.java:45)
svn commit: r1504558 - /tomcat/trunk/res/findbugs/filter-false-positives.xml
Author: markt Date: Thu Jul 18 17:34:37 2013 New Revision: 1504558 URL: http://svn.apache.org/r1504558 Log: Filter out three false positives (the only warnings the trunk code base currently generates) Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1504558&r1=1504557&r2=1504558&view=diff == --- tomcat/trunk/res/findbugs/filter-false-positives.xml (original) +++ tomcat/trunk/res/findbugs/filter-false-positives.xml Thu Jul 18 17:34:37 2013 @@ -229,6 +229,12 @@ + + + + + + @@ -490,6 +496,12 @@ + + + + + + @@ -608,6 +620,12 @@ + + + + + + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Failed to parse the expression when we have repeated function invocations
On 18/07/2013 18:24, Violeta Georgieva wrote: > 2013/7/18 Mark Thomas wrote: >> >> On 18/07/2013 08:00, Violeta Georgieva wrote: >>> Hi, >>> >>> Let's have a lambda expression: >>> >>> x->y->x-y >>> >>> Let's now assign it and invoke it indirectly: >>> >>> f = x->y->x-y; f(2)(1) >> >> Several problems here. >> >> 1. The grammar didn't support functions having multiple sets of > parameters. >> >> 2. The lambda expression handling in AstFunction only handled single >> parameters sets. >> >> 3. The incMethodParameterIndex() can't be used in this case so an >> alternative solution is required to the problem that addressed. >> >> All of these have been fixed in trunk. There is some more clean-up that >> can now be done. >> >> I look forward to your next brain teaser :) >> > > ;) > > If I modify the example above like this > > f = ()->y->2-y; f()(1) Thanks for all the testing. I'll convert all the the lambda expression tests to their functional versions and make sure they all pass. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: 8.0-SNAPSHOT updated
Henri, On 7/18/13 12:16 PM, Henri Gomez wrote: > +1 > > Show must go one, really exited to take a look at this new cat :) Agreed. Great job lately, Mark, with pushing everything through. I'm glad to see that the bits you left until the end (because they looked like they might be ugly) turned out to be fairly straightforward. Thanks for continuing to be a great release manager. -chris signature.asc Description: OpenPGP digital signature
svn commit: r1504657 - in /tomcat/trunk: java/org/apache/el/parser/AstFunction.java java/org/apache/el/parser/AstLambdaExpression.java test/org/apache/el/parser/TestAstLambdaExpression.java
Author: markt Date: Thu Jul 18 20:56:44 2013 New Revision: 1504657 URL: http://svn.apache.org/r1504657 Log: Yet more adventures with lambda expressions. I suspect - but haven't yet checked - that there is scope to make the code more efficient and/or reduce duplication. Modified: tomcat/trunk/java/org/apache/el/parser/AstFunction.java tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java tomcat/trunk/test/org/apache/el/parser/TestAstLambdaExpression.java Modified: tomcat/trunk/java/org/apache/el/parser/AstFunction.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstFunction.java?rev=1504657&r1=1504656&r2=1504657&view=diff == --- tomcat/trunk/java/org/apache/el/parser/AstFunction.java (original) +++ tomcat/trunk/java/org/apache/el/parser/AstFunction.java Thu Jul 18 20:56:44 2013 @@ -98,12 +98,18 @@ public final class AstFunction extends S // Build arguments int i = 0; while (obj instanceof LambdaExpression && -i < this.jjtGetNumChildren()) { +i < jjtGetNumChildren()) { Node args = jjtGetChild(i); obj = ((LambdaExpression) obj).invoke( ((AstMethodParameters) args).getParameters(ctx)); i++; } +if (i < jjtGetNumChildren()) { +// Haven't consumed all the sets of parameters therefore +// there were too many sets of parameters +throw new ELException(MessageFactory.get( +"error.lambda.tooManyMethodParameterSets")); +} return obj; } } Modified: tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java?rev=1504657&r1=1504656&r2=1504657&view=diff == --- tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java (original) +++ tomcat/trunk/java/org/apache/el/parser/AstLambdaExpression.java Thu Jul 18 20:56:44 2013 @@ -36,22 +36,39 @@ public class AstLambdaExpression extends @Override public Object getValue(EvaluationContext ctx) throws ELException { -// Check that there are not more sets of method parameters than there -// are nested lambda expressions +// Check; +// - that there are not more sets of method parameters than there are +// nested lambda expressions +// - if any of the nested expressions declare formal parameters int methodParameterSetCount = jjtGetNumChildren() - 2; -if (methodParameterSetCount > 0) { -// We know this node is an expression -methodParameterSetCount--; -Node n = this.jjtGetChild(1); -while (methodParameterSetCount > 0) { -if (n.jjtGetNumChildren() <2 || -!(n.jjtGetChild(0) instanceof AstLambdaParameters)) { -throw new ELException(MessageFactory.get( -"error.lambda.tooManyMethodParameterSets")); +boolean declaresParameters = false; +// We know this node is an expression +int lambdaExpressionCount = 1; +// child at index 1 is the expression +Node n = jjtGetChild(1); +while (n instanceof AstLambdaExpression) { +lambdaExpressionCount++; +if (n.jjtGetChild(0) instanceof AstLambdaParameters) { +if (!declaresParameters && +n.jjtGetChild(0).jjtGetNumChildren() > 0) { +declaresParameters = true; } n = n.jjtGetChild(1); -methodParameterSetCount--; +} else { +n = null; +} +} +if (methodParameterSetCount > lambdaExpressionCount) { +throw new ELException(MessageFactory.get( +"error.lambda.tooManyMethodParameterSets")); +} +// Also need to check parents for declaration of formal parameters +n = parent; +while (!declaresParameters && n instanceof AstLambdaExpression) { +if (n.jjtGetChild(0).jjtGetNumChildren() > 0) { +declaresParameters = true; } +n = n.jjtGetParent(); } // First child is always parameters even if there aren't any @@ -74,10 +91,9 @@ public class AstLambdaExpression extends le.setELContext(ctx); if (jjtGetNumChildren() == 2) { -if (formalParameters.isEmpty() && -!(parent instanceof AstLambdaExpression)) { -// No formal parameters or method parameters and not a nested -
Re: Failed to parse the expression when we have repeated function invocations
On 18/07/2013 18:36, Mark Thomas wrote: > On 18/07/2013 18:24, Violeta Georgieva wrote: >> 2013/7/18 Mark Thomas wrote: >>> I look forward to your next brain teaser :) >>> >> >> ;) >> >> If I modify the example above like this >> >> f = ()->y->2-y; f()(1) > > Thanks for all the testing. > > I'll convert all the the lambda expression tests to their functional > versions and make sure they all pass. Converting those tests highlighted some related issues. After another round of changes the tests all pass. Over to you... Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: 8.0-SNAPSHOT updated
Great news. I had successfully implemented webrtc with tomcat7 websockets. looking forward to build a complete telephony solutions using tomcat8 -- View this message in context: http://tomcat.10.x6.nabble.com/8-0-SNAPSHOT-updated-tp5001961p5001977.html Sent from the Tomcat - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1504753 - in /tomcat/trunk/java/org/apache: catalina/startup/ContextConfig.java tomcat/util/descriptor/web/FragmentJarScannerCallback.java
Author: jboynes Date: Fri Jul 19 03:11:40 2013 New Revision: 1504753 URL: http://svn.apache.org/r1504753 Log: Extract FragmentJarScannerCallback to descriptor package so it can be reused by Jasper Added: tomcat/trunk/java/org/apache/tomcat/util/descriptor/web/FragmentJarScannerCallback.java (with props) Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1504753&r1=1504752&r2=1504753&view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Jul 19 03:11:40 2013 @@ -24,7 +24,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; -import java.net.JarURLConnection; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; @@ -75,7 +74,6 @@ import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.JarScanType; import org.apache.tomcat.JarScanner; -import org.apache.tomcat.JarScannerCallback; import org.apache.tomcat.util.ExceptionUtils; import org.apache.tomcat.util.bcel.classfile.AnnotationElementValue; import org.apache.tomcat.util.bcel.classfile.AnnotationEntry; @@ -96,6 +94,7 @@ import org.apache.tomcat.util.descriptor import org.apache.tomcat.util.descriptor.web.ErrorPage; import org.apache.tomcat.util.descriptor.web.FilterDef; import org.apache.tomcat.util.descriptor.web.FilterMap; +import org.apache.tomcat.util.descriptor.web.FragmentJarScannerCallback; import org.apache.tomcat.util.descriptor.web.JspPropertyGroup; import org.apache.tomcat.util.descriptor.web.JspPropertyGroupDescriptorImpl; import org.apache.tomcat.util.descriptor.web.LoginConfig; @@ -1949,7 +1948,15 @@ public class ContextConfig implements Li protected Map processJarsForWebFragments() { JarScanner jarScanner = context.getJarScanner(); -FragmentJarScannerCallback callback = new FragmentJarScannerCallback(); +boolean delegate = false; +if (context instanceof StandardContext) { +delegate = ((StandardContext) context).getDelegate(); +} +FragmentJarScannerCallback callback = +new FragmentJarScannerCallback(webXmlParser, delegate); +if (!callback.isOk()) { +ok = false; +} jarScanner.scan(JarScanType.PLUGGABILITY, context.getServletContext(), callback); @@ -2649,115 +2656,6 @@ public class ContextConfig implements Li return result; } -private class FragmentJarScannerCallback implements JarScannerCallback { - -private static final String FRAGMENT_LOCATION = -"META-INF/web-fragment.xml"; -private final Map fragments = new HashMap<>(); - -@Override -public void scan(JarURLConnection jarConn, boolean isWebapp) -throws IOException { - -URL url = jarConn.getURL(); -URL resourceURL = jarConn.getJarFileURL(); -Jar jar = null; -InputStream is = null; -WebXml fragment = new WebXml(); - -fragment.setWebappJar(isWebapp); -if (context instanceof StandardContext) { -fragment.setDelegate(((StandardContext) context).getDelegate()); -} - -try { -// Only web application JARs are checked for web-fragment.xml -// files -if (isWebapp) { -jar = JarFactory.newInstance(url); -is = jar.getInputStream(FRAGMENT_LOCATION); -} - -if (is == null) { -// If there is no web.xml, normal JAR no impact on -// distributable -fragment.setDistributable(true); -} else { -InputSource source = new InputSource( -resourceURL.toString() + "!/" + FRAGMENT_LOCATION); -source.setByteStream(is); -if (!webXmlParser.parseWebXml(source, fragment, true)) { -ok = false; -} -} -} finally { -if (jar != null) { -jar.close(); -} -fragment.setURL(url); -if (fragment.getName() == null) { -fragment.setName(fragment.getURL().toString()); -} -fragment.setJarName(extractJarFileName(url)); -fragments.put(fragment.getName(), fragment); -} -} - -private String extra
svn commit: r1504755 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
Author: jboynes Date: Fri Jul 19 03:15:47 2013 New Revision: 1504755 URL: http://svn.apache.org/r1504755 Log: Check needs to happen after call to scan Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1504755&r1=1504754&r2=1504755&view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Jul 19 03:15:47 2013 @@ -1954,13 +1954,13 @@ public class ContextConfig implements Li } FragmentJarScannerCallback callback = new FragmentJarScannerCallback(webXmlParser, delegate); -if (!callback.isOk()) { -ok = false; -} jarScanner.scan(JarScanType.PLUGGABILITY, context.getServletContext(), callback); +if (!callback.isOk()) { +ok = false; +} return callback.getFragments(); } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
ELException: Function ':v' not found
Hi, While I was playing with collections I decided to change a bit one of our tests (o.a.el.stream.TestCollectionOperations.testMaxLambda01()) and instead of beans.stream().max((x,y)->x.name.compareTo(y.name)) I made it like this: comparison = v->(x,y)->v(x).compareTo(v(y)) beans.stream().max(comparison(x->x.name)) That thrown an exception: Caused by: javax.el.ELException: Function ':v' not found at org.apache.el.parser.AstFunction.getValue(AstFunction.java:118) at org.apache.el.parser.AstValue.getValue(AstValue.java:134) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:188) at javax.el.LambdaExpression.invoke(LambdaExpression.java:78) at javax.el.LambdaExpression.invoke(LambdaExpression.java:92) at org.apache.el.stream.Stream.compare(Stream.java:453) at org.apache.el.stream.Stream.max(Stream.java:299) Regards Violeta