[jira] Created: (VELOCITY-736) Introspection regression from 1.5 to 1.6.2

View: New views
7 Messages — Rating Filter:   Alert me  

[jira] Created: (VELOCITY-736) Introspection regression from 1.5 to 1.6.2

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Introspection regression from 1.5 to 1.6.2
------------------------------------------

                 Key: VELOCITY-736
                 URL: https://issues.apache.org/jira/browse/VELOCITY-736
             Project: Velocity
          Issue Type: Bug
          Components: Engine
    Affects Versions: 1.6.2
         Environment: Sun JDK 1.6.0_16
            Reporter: David Esposito


When upgrading from Velcocity 1.5 to 1.6.2, the following snippet of code changed behavior.

In Velocity 1.5, the output was:

The file upload exceeded 100

In Velocity 1.6.2, the output is:

The file upload exceeded $ex.permittedSize

There is nothing in the velocity log file to help me identify why it's not resolving 'permittedSize' to the correct bean method.

Here is a test program to replicate the problem. The context variable in question is the Commons FileUpload exception class documented here:

http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.SizeLimitExceededException.html

I am using commons-fileupload-1.2.jar

import java.io.StringWriter;
import org.apache.commons.fileupload.FileUploadBase;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.context.Context;

public class Main {
    public static void main(String[] args) throws Exception{
        VelocityEngine e = new VelocityEngine();
                String testTemplate = "The file upload exceeded $ex.permittedSize";
                StringWriter out = new StringWriter();

                Context ctx = new VelocityContext();
                FileUploadBase.FileSizeLimitExceededException ex = new FileUploadBase.FileSizeLimitExceededException("too big!", 50, 100);
                ctx.put("ex",ex);

                e.evaluate(ctx, out, "Tester", testTemplate);

                System.out.println(out.toString());
    }
}


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-736) Introspection regression from 1.5 to 1.6.2

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763068#action_12763068 ]

Christoph Reck commented on VELOCITY-736:
-----------------------------------------

Interesting why this worked in 1.5...

The api doc lists for Class FileUploadBase.SizeLimitExceededException:
Methods inherited from class org.apache.commons.fileupload.FileUploadBase.SizeException
  getActualSize, getPermittedSize

And Class FileUploadBase.SizeException has:
Method Summary
  long getActualSize()
  long getPermittedSize()

which means these are package private and therefore not allowed to be used externally.

Can someone independently try it in 1.5 and 1.6 to confirm this is a regression?


> Introspection regression from 1.5 to 1.6.2
> ------------------------------------------
>
>                 Key: VELOCITY-736
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-736
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6.2
>         Environment: Sun JDK 1.6.0_16
>            Reporter: David Esposito
>
> When upgrading from Velcocity 1.5 to 1.6.2, the following snippet of code changed behavior.
> In Velocity 1.5, the output was:
> The file upload exceeded 100
> In Velocity 1.6.2, the output is:
> The file upload exceeded $ex.permittedSize
> There is nothing in the velocity log file to help me identify why it's not resolving 'permittedSize' to the correct bean method.
> Here is a test program to replicate the problem. The context variable in question is the Commons FileUpload exception class documented here:
> http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.SizeLimitExceededException.html
> I am using commons-fileupload-1.2.jar
> import java.io.StringWriter;
> import org.apache.commons.fileupload.FileUploadBase;
> import org.apache.velocity.VelocityContext;
> import org.apache.velocity.app.VelocityEngine;
> import org.apache.velocity.context.Context;
> public class Main {
>     public static void main(String[] args) throws Exception{
>         VelocityEngine e = new VelocityEngine();
> String testTemplate = "The file upload exceeded $ex.permittedSize";
> StringWriter out = new StringWriter();
> Context ctx = new VelocityContext();
> FileUploadBase.FileSizeLimitExceededException ex = new FileUploadBase.FileSizeLimitExceededException("too big!", 50, 100);
> ctx.put("ex",ex);
> e.evaluate(ctx, out, "Tester", testTemplate);
> System.out.println(out.toString());
>     }
> }

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-736) Introspection regression from 1.5 to 1.6.2

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763095#action_12763095 ]

Christoph Reck commented on VELOCITY-736:
-----------------------------------------

I tested it with 1.5, where it works; whereas in 1.6.2 it fails - so this is a regression.

It seems to be due to the protected class org.apache.commons.fileupload.FileUploadBase$SizeException - see:

> javap -protected 'org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException'
Compiled from "FileUploadBase.java"
public class org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException extends org.apache.commons.fileupload.FileUploadBase$SizeException{
    public org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException();
    public org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException(java.lang.String);
    public org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException(java.lang.String, long, long);
}

> javap -protected 'org.apache.commons.fileupload.FileUploadBase$SizeException'
Compiled from "FileUploadBase.java"
public abstract class org.apache.commons.fileupload.FileUploadBase$SizeException extends org.apache.commons.fileupload.FileUploadException{
    protected org.apache.commons.fileupload.FileUploadBase$SizeException(java.lang.String, long, long);
    public long getActualSize();
    public long getPermittedSize();
}

Seems to be duplicate of VELOCITY-579


> Introspection regression from 1.5 to 1.6.2
> ------------------------------------------
>
>                 Key: VELOCITY-736
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-736
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6.2
>         Environment: Sun JDK 1.6.0_16
>            Reporter: David Esposito
>
> When upgrading from Velcocity 1.5 to 1.6.2, the following snippet of code changed behavior.
> In Velocity 1.5, the output was:
> The file upload exceeded 100
> In Velocity 1.6.2, the output is:
> The file upload exceeded $ex.permittedSize
> There is nothing in the velocity log file to help me identify why it's not resolving 'permittedSize' to the correct bean method.
> Here is a test program to replicate the problem. The context variable in question is the Commons FileUpload exception class documented here:
> http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.SizeLimitExceededException.html
> I am using commons-fileupload-1.2.jar
> import java.io.StringWriter;
> import org.apache.commons.fileupload.FileUploadBase;
> import org.apache.velocity.VelocityContext;
> import org.apache.velocity.app.VelocityEngine;
> import org.apache.velocity.context.Context;
> public class Main {
>     public static void main(String[] args) throws Exception{
>         VelocityEngine e = new VelocityEngine();
> String testTemplate = "The file upload exceeded $ex.permittedSize";
> StringWriter out = new StringWriter();
> Context ctx = new VelocityContext();
> FileUploadBase.FileSizeLimitExceededException ex = new FileUploadBase.FileSizeLimitExceededException("too big!", 50, 100);
> ctx.put("ex",ex);
> e.evaluate(ctx, out, "Tester", testTemplate);
> System.out.println(out.toString());
>     }
> }

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-736) Introspection regression from 1.5 to 1.6.2

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763537#action_12763537 ]

Nathan Bubna commented on VELOCITY-736:
---------------------------------------

Ick.  Thanks for confirming, Christoph.  I've got a little time today, so i'll see about setting up a testcase and fixing this.

> Introspection regression from 1.5 to 1.6.2
> ------------------------------------------
>
>                 Key: VELOCITY-736
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-736
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6.2
>         Environment: Sun JDK 1.6.0_16
>            Reporter: David Esposito
>
> When upgrading from Velcocity 1.5 to 1.6.2, the following snippet of code changed behavior.
> In Velocity 1.5, the output was:
> The file upload exceeded 100
> In Velocity 1.6.2, the output is:
> The file upload exceeded $ex.permittedSize
> There is nothing in the velocity log file to help me identify why it's not resolving 'permittedSize' to the correct bean method.
> Here is a test program to replicate the problem. The context variable in question is the Commons FileUpload exception class documented here:
> http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.SizeLimitExceededException.html
> I am using commons-fileupload-1.2.jar
> import java.io.StringWriter;
> import org.apache.commons.fileupload.FileUploadBase;
> import org.apache.velocity.VelocityContext;
> import org.apache.velocity.app.VelocityEngine;
> import org.apache.velocity.context.Context;
> public class Main {
>     public static void main(String[] args) throws Exception{
>         VelocityEngine e = new VelocityEngine();
> String testTemplate = "The file upload exceeded $ex.permittedSize";
> StringWriter out = new StringWriter();
> Context ctx = new VelocityContext();
> FileUploadBase.FileSizeLimitExceededException ex = new FileUploadBase.FileSizeLimitExceededException("too big!", 50, 100);
> ctx.put("ex",ex);
> e.evaluate(ctx, out, "Tester", testTemplate);
> System.out.println(out.toString());
>     }
> }

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-736) Introspection regression from 1.5 to 1.6.2

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12763601#action_12763601 ]

Nathan Bubna commented on VELOCITY-736:
---------------------------------------

I've been thinking about this.  The oft-stated intention of Velocity is to provide access to "public methods declared in public classes (or public interface)".  The method in question is public and it is being called on an instance of a public subclass, but it is not actually declared in a public class.  So, it was something of an undocumented, unintentional fluke that this worked previously.  Such regressions are undesirable, but are arguably bug fixes.   Certainly in the work for 1.6, we never thought about supporting "public methods declared *or inherited* by public classes".

That said, i think the Commons-FileUpload folks are correct to have the SizeException class be protected and you are clearly justified to expect that a public method inherited by a public subclass should be callable via VTL.  So it feels like more than a regression, this is exposing a bug in our "oft-stated intention".

Though i haven't looked deeply at it, my instinct is that fixing this will either carry a significant performance penalty for ClassMap, require an even wider broadening of the methods support and/or undo other recent fixes.  Unless further examination proves me wrong on that, it is not very likely that this will be un-regressed in 1.6.x.  Right now, i'm guessing that fixing this will lead to a broadening of supported methods and thus be only fit for 1.7.

> Introspection regression from 1.5 to 1.6.2
> ------------------------------------------
>
>                 Key: VELOCITY-736
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-736
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6.2
>         Environment: Sun JDK 1.6.0_16
>            Reporter: David Esposito
>
> When upgrading from Velcocity 1.5 to 1.6.2, the following snippet of code changed behavior.
> In Velocity 1.5, the output was:
> The file upload exceeded 100
> In Velocity 1.6.2, the output is:
> The file upload exceeded $ex.permittedSize
> There is nothing in the velocity log file to help me identify why it's not resolving 'permittedSize' to the correct bean method.
> Here is a test program to replicate the problem. The context variable in question is the Commons FileUpload exception class documented here:
> http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.SizeLimitExceededException.html
> I am using commons-fileupload-1.2.jar
> import java.io.StringWriter;
> import org.apache.commons.fileupload.FileUploadBase;
> import org.apache.velocity.VelocityContext;
> import org.apache.velocity.app.VelocityEngine;
> import org.apache.velocity.context.Context;
> public class Main {
>     public static void main(String[] args) throws Exception{
>         VelocityEngine e = new VelocityEngine();
> String testTemplate = "The file upload exceeded $ex.permittedSize";
> StringWriter out = new StringWriter();
> Context ctx = new VelocityContext();
> FileUploadBase.FileSizeLimitExceededException ex = new FileUploadBase.FileSizeLimitExceededException("too big!", 50, 100);
> ctx.put("ex",ex);
> e.evaluate(ctx, out, "Tester", testTemplate);
> System.out.println(out.toString());
>     }
> }

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Updated: (VELOCITY-736) Introspection regression from 1.5 to 1.6.2

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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

Nathan Bubna updated VELOCITY-736:
----------------------------------

    Attachment: Velocity736TestCase.java

Spent a little time trying to replicate the problem in a simple test case, with no success.  Apparently i misunderstood the nature of the bug.  Calling getDeclaredMethods on a public subclass of a protected and abstract superclass does return the superclass's public methods.

Not sure what is causing the observed problem.  Any ideas, Christoph?

> Introspection regression from 1.5 to 1.6.2
> ------------------------------------------
>
>                 Key: VELOCITY-736
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-736
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6.2
>         Environment: Sun JDK 1.6.0_16
>            Reporter: David Esposito
>         Attachments: Velocity736TestCase.java
>
>
> When upgrading from Velcocity 1.5 to 1.6.2, the following snippet of code changed behavior.
> In Velocity 1.5, the output was:
> The file upload exceeded 100
> In Velocity 1.6.2, the output is:
> The file upload exceeded $ex.permittedSize
> There is nothing in the velocity log file to help me identify why it's not resolving 'permittedSize' to the correct bean method.
> Here is a test program to replicate the problem. The context variable in question is the Commons FileUpload exception class documented here:
> http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.SizeLimitExceededException.html
> I am using commons-fileupload-1.2.jar
> import java.io.StringWriter;
> import org.apache.commons.fileupload.FileUploadBase;
> import org.apache.velocity.VelocityContext;
> import org.apache.velocity.app.VelocityEngine;
> import org.apache.velocity.context.Context;
> public class Main {
>     public static void main(String[] args) throws Exception{
>         VelocityEngine e = new VelocityEngine();
> String testTemplate = "The file upload exceeded $ex.permittedSize";
> StringWriter out = new StringWriter();
> Context ctx = new VelocityContext();
> FileUploadBase.FileSizeLimitExceededException ex = new FileUploadBase.FileSizeLimitExceededException("too big!", 50, 100);
> ctx.put("ex",ex);
> e.evaluate(ctx, out, "Tester", testTemplate);
> System.out.println(out.toString());
>     }
> }

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-736) Introspection regression from 1.5 to 1.6.2

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12773486#action_12773486 ]

David Esposito commented on VELOCITY-736:
-----------------------------------------

Hi Guys,

I was hoping for a resolution one way or the other on this. If it's not going to be "fixed", I will need to work around it ... If it is, when could I expect the fix to be included?

Nathan, addressing the detail of "public methods declared in public classes" ... Why isn't it as simple as "public methods"? .. Why does the protection of the class have any relevance? From an end-user perspective, I would expect that I can invoke any 'getter' that I can from my Java code regardless of the inheritance scheme of the class ... In this case, I have the Javadocs and source code of the Commons-Fileupload classes to understand what the developers intended, but if it's a closed source library I'm using, I would have to decompile the binaries to figure out why my methods aren't being invoke from VTL.

-Dave

> Introspection regression from 1.5 to 1.6.2
> ------------------------------------------
>
>                 Key: VELOCITY-736
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-736
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6.2
>         Environment: Sun JDK 1.6.0_16
>            Reporter: David Esposito
>         Attachments: Velocity736TestCase.java
>
>
> When upgrading from Velcocity 1.5 to 1.6.2, the following snippet of code changed behavior.
> In Velocity 1.5, the output was:
> The file upload exceeded 100
> In Velocity 1.6.2, the output is:
> The file upload exceeded $ex.permittedSize
> There is nothing in the velocity log file to help me identify why it's not resolving 'permittedSize' to the correct bean method.
> Here is a test program to replicate the problem. The context variable in question is the Commons FileUpload exception class documented here:
> http://commons.apache.org/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.SizeLimitExceededException.html
> I am using commons-fileupload-1.2.jar
> import java.io.StringWriter;
> import org.apache.commons.fileupload.FileUploadBase;
> import org.apache.velocity.VelocityContext;
> import org.apache.velocity.app.VelocityEngine;
> import org.apache.velocity.context.Context;
> public class Main {
>     public static void main(String[] args) throws Exception{
>         VelocityEngine e = new VelocityEngine();
> String testTemplate = "The file upload exceeded $ex.permittedSize";
> StringWriter out = new StringWriter();
> Context ctx = new VelocityContext();
> FileUploadBase.FileSizeLimitExceededException ex = new FileUploadBase.FileSizeLimitExceededException("too big!", 50, 100);
> ctx.put("ex",ex);
> e.evaluate(ctx, out, "Tester", testTemplate);
> System.out.println(out.toString());
>     }
> }

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...