[jira] [Closed] (GROOVY-7751) CallableStatement leak in Sql.call() method

2016-03-10 Thread John Wagenleitner (JIRA)

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

John Wagenleitner closed GROOVY-7751.
-
   Resolution: Fixed
 Assignee: John Wagenleitner
Fix Version/s: 2.4.7

Merged the PR that should ensure the {{CallableStatement}}'s are added to the 
statement cache if caching is enabled.

Thanks for reporting the issue.

> CallableStatement leak in Sql.call() method
> ---
>
> Key: GROOVY-7751
> URL: https://issues.apache.org/jira/browse/GROOVY-7751
> Project: Groovy
>  Issue Type: Bug
>  Components: SQL processing
>Affects Versions: 2.4.5
>Reporter: Alexey Vladykin
>Assignee: John Wagenleitner
> Fix For: 2.4.7
>
>
> All {{Sql.call(...)}} methods ultimately delegate to 
> {{Sql.callWithRows(...)}} method where we have:
> {code:java}
> try {
> statement = connection.prepareCall(sql);
> // ...
> } finally {
> // ...
> closeResources(connection, statement);
> }
> {code}
> The problem is that statement is unconditionally parsed and compiled each 
> time, but the {{closeResources()}} method only closes it when statement 
> caching is disabled. So with statement caching enabled we end up allocating 
> and leaking a new CallableStatement instance per {{Sql.call()}} invocation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (GROOVY-7751) CallableStatement leak in Sql.call() method

2016-03-10 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GROOVY-7751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15190390#comment-15190390
 ] 

ASF GitHub Bot commented on GROOVY-7751:


Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/263


> CallableStatement leak in Sql.call() method
> ---
>
> Key: GROOVY-7751
> URL: https://issues.apache.org/jira/browse/GROOVY-7751
> Project: Groovy
>  Issue Type: Bug
>  Components: SQL processing
>Affects Versions: 2.4.5
>Reporter: Alexey Vladykin
>
> All {{Sql.call(...)}} methods ultimately delegate to 
> {{Sql.callWithRows(...)}} method where we have:
> {code:java}
> try {
> statement = connection.prepareCall(sql);
> // ...
> } finally {
> // ...
> closeResources(connection, statement);
> }
> {code}
> The problem is that statement is unconditionally parsed and compiled each 
> time, but the {{closeResources()}} method only closes it when statement 
> caching is disabled. So with statement caching enabled we end up allocating 
> and leaking a new CallableStatement instance per {{Sql.call()}} invocation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] groovy pull request: GROOVY-7751 - CallableStatement leak in Sql.c...

2016-03-10 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/263


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Created] (GROOVY-7785) StackoverflowException when using too many chained method calls

2016-03-10 Thread Daniel Kuppitz (JIRA)
Daniel Kuppitz created GROOVY-7785:
--

 Summary: StackoverflowException when using too many chained method 
calls
 Key: GROOVY-7785
 URL: https://issues.apache.org/jira/browse/GROOVY-7785
 Project: Groovy
  Issue Type: Bug
Affects Versions: 2.4.6
Reporter: Daniel Kuppitz


If the following statement is pasted into a Groovy shell, it's going to throw a 
{{StackoverflowException}}:

{code}
new 

[GitHub] groovy pull request: Documentation - typo and styling

2016-03-10 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/289


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] groovy pull request: Documentation - typo and styling

2016-03-10 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/288


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Created] (GROOVY-7784) TypeChecked/CompileStatic: IndexOutOfBoundsException

2016-03-10 Thread Gregory Moltchadski (JIRA)
Gregory Moltchadski created GROOVY-7784:
---

 Summary: TypeChecked/CompileStatic: IndexOutOfBoundsException
 Key: GROOVY-7784
 URL: https://issues.apache.org/jira/browse/GROOVY-7784
 Project: Groovy
  Issue Type: Bug
  Components: Compiler
Affects Versions: 2.4.6
Reporter: Gregory Moltchadski


Compiling the following:

-
import groovy.transform.TypeChecked

import java.nio.file.Files
import java.nio.file.Paths

@TypeChecked
class IOOBE
{
  def ioobe()
  {
Files.write(Paths.get('foo.bar'), { ['foo', 'bar'].iterator() });
  }
}
-

(closure is used to automatically coerce Iterator to Iterable),
produces the following exception during compilation:

-
Error:Groovyc: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.LinkedList.checkElementIndex(LinkedList.java:555)
at java.util.LinkedList.get(LinkedList.java:476)
at 
org.codehaus.groovy.ast.expr.TupleExpression.getExpression(TupleExpression.java:89)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.inferSAMType(StaticTypeCheckingVisitor.java:2342)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.inferClosureParameterTypes(StaticTypeCheckingVisitor.java:2318)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2282)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2970)
at 
org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66)
at 
org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:71)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
at 
org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at 
org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
at 
org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1774)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2107)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2066)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1086)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249)
at 
org.codehaus.groovy.transform.StaticTypesTransformation.visit(StaticTypesTransformation.java:66)
at 
org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
at 
org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
at 
org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1055)
at 
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
at 
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
at 
org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)
at 
org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at 
org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:134)
at 

[jira] [Updated] (GROOVY-7784) TypeChecked/CompileStatic: IndexOutOfBoundsException

2016-03-10 Thread Gregory Moltchadski (JIRA)

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

Gregory Moltchadski updated GROOVY-7784:

Description: 
Compiling the following:

{code:title=IOOBE.groovy|borderStyle=solid}
import groovy.transform.TypeChecked

import java.nio.file.Files
import java.nio.file.Paths

@TypeChecked
class IOOBE
{
  def ioobe()
  {
Files.write(Paths.get('foo.bar'), { ['foo', 'bar'].iterator() });
  }
}
{code}

(closure is used to automatically coerce Iterator to Iterable),
produces the following exception during compilation:

{code}
Error:Groovyc: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.LinkedList.checkElementIndex(LinkedList.java:555)
at java.util.LinkedList.get(LinkedList.java:476)
at 
org.codehaus.groovy.ast.expr.TupleExpression.getExpression(TupleExpression.java:89)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.inferSAMType(StaticTypeCheckingVisitor.java:2342)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.inferClosureParameterTypes(StaticTypeCheckingVisitor.java:2318)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallArguments(StaticTypeCheckingVisitor.java:2282)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethodCallExpression(StaticTypeCheckingVisitor.java:2970)
at 
org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66)
at 
org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:71)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
at 
org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at 
org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
at 
org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1774)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2107)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2066)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1086)
at 
org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
at 
org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249)
at 
org.codehaus.groovy.transform.StaticTypesTransformation.visit(StaticTypesTransformation.java:66)
at 
org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
at 
org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
at 
org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1055)
at 
org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
at 
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
at 
org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)
at 
org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at 
org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at 

[jira] [Updated] (GROOVY-7783) Redundant computation in ObservableList

2016-03-10 Thread Monika Dhok (JIRA)

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

Monika Dhok updated GROOVY-7783:

Attachment: ObservableList.patch

> Redundant computation in ObservableList
> ---
>
> Key: GROOVY-7783
> URL: https://issues.apache.org/jira/browse/GROOVY-7783
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.4.6
>Reporter: Monika Dhok
> Attachments: ObservableList.patch, Test.java
>
>
> There appears to be redundant computaions in "ObservableList.retainAll"
> methods in version 2.4.6. I have attached a test and proposed a small 
> patch which ensures that "contains" method is called on hashset of
> input collection. This patch gives X speed up on my 
> machine for the provided test. 
> Also, one more possibility to fix the issue is by using TreeSet as suggested 
> in 
> https://issues.apache.org/jira/browse/GROOVY-5739 as well. 
> Similar patches can be applied for three other methods, 
> ObservableList.removeAll, ObservableSet.retainAll, ObservableSet.removeAll.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (GROOVY-7783) Redundant computation in ObservableList

2016-03-10 Thread Monika Dhok (JIRA)
Monika Dhok created GROOVY-7783:
---

 Summary: Redundant computation in ObservableList
 Key: GROOVY-7783
 URL: https://issues.apache.org/jira/browse/GROOVY-7783
 Project: Groovy
  Issue Type: Bug
  Components: groovy-runtime
Affects Versions: 2.4.6
Reporter: Monika Dhok


There appears to be redundant computaions in "ObservableList.retainAll"
methods in version 2.4.6. I have attached a test and proposed a small 
patch which ensures that "contains" method is called on hashset of
input collection. This patch gives X speed up on my 
machine for the provided test. 

Also, one more possibility to fix the issue is by using TreeSet as suggested in 
https://issues.apache.org/jira/browse/GROOVY-5739 as well. 
Similar patches can be applied for three other methods, 
ObservableList.removeAll, ObservableSet.retainAll, ObservableSet.removeAll.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] groovy pull request: Documentation - typo and styling

2016-03-10 Thread kotomoto
GitHub user kotomoto opened a pull request:

https://github.com/apache/groovy/pull/289

Documentation - typo and styling

Documentation on closures - removed unnecessary 'is' word and added a comma.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/kotomoto/groovy GROOVY_2_4_X

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/groovy/pull/289.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #289


commit c8591a84f28d072358618eafa5e3d6a4000d4f1a
Author: kotomoto 
Date:   2016-03-10T11:02:07Z

Documentation - typo and styling




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] groovy pull request: Documentation - typo and styling

2016-03-10 Thread kotomoto
GitHub user kotomoto opened a pull request:

https://github.com/apache/groovy/pull/288

Documentation - typo and styling

Documentation on closures - removed unnecessary 'is' word and added a comma.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/kotomoto/groovy master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/groovy/pull/288.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #288


commit 2113109dc3a8c94a5f46bca44b26305a16f6afd2
Author: kotomoto 
Date:   2016-03-10T08:04:35Z

Documentation - typo and styling




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---