Re: commons-fileupload2-jakarta

2023-07-12 Thread Martin Tzvetanov Grigorov
Hi,

On 2023/07/09 14:45:21 Emmanuel Bourg wrote:
> Dumb question: what's the benefit of using commons-fileupload in 2023 
> instead of the equivalent file upload feature of the  Servlet API?

Last time when I tried to replace Commons Fileupload with pure Servlet API I 
faced these issues:

1) The Servlet API does not provide hooks to follow the upload progress

2) The Servlet API does not provide a way to cleanup after processing the 
uploaded files, i.e. the commons-fileupload Cleaner

This was 2016 (https://issues.apache.org/jira/browse/WICKET-5192) so things may 
have changed in the meantime! 

Regards,
Martin

> 
> The use case I had in mind was to support file upload in very old 
> Servlet containers still in production (Tomcat 6 or Jetty 7 for example, 
> both EOL), but servers supporting the Jakarta API are recent and have 
> the file upload feature integrated. I'd expect commons-fileupload to go 
> to dormant in the near future rather than adapted for the jakarta namespace.
> 
> What did I miss?
> 
> Emmanuel Bourg
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
> 
> 

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



Re: [commons-lang] 04/04: Throw IllegalArgumentException instead of InternalError in the builder package

2023-07-12 Thread Gilles Sadowski
Hi.

Le mer. 12 juil. 2023 à 14:44,  a écrit :
>
> This is an automated email from the ASF dual-hosted git repository.
>
> ggregory pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/commons-lang.git
>
> commit 2e3feda04337baa483bc26b66f238161dc6c97ac
> Author: Gary Gregory 
> AuthorDate: Wed Jul 12 08:44:38 2023 -0400
>
> Throw IllegalArgumentException instead of InternalError in the builder
> package

The diff below contains a bunch of (formatting ?) changes that
have nothing to do with this commit message.

Regards,
Gilles

> ---
>  src/changes/changes.xml|   1 +
>  .../commons/lang3/builder/CompareToBuilder.java| 752 
> ++---
>  .../commons/lang3/builder/EqualsBuilder.java   |  20 +-
>  .../commons/lang3/builder/HashCodeBuilder.java |   9 +-
>  .../apache/commons/lang3/builder/Reflection.java   |  44 ++
>  .../lang3/builder/ReflectionDiffBuilder.java   |   7 +-
>  .../lang3/builder/ReflectionToStringBuilder.java   |  14 +-
>  7 files changed, 434 insertions(+), 413 deletions(-)
>
> diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> index 26d7be48c..da3522029 100644
> --- a/src/changes/changes.xml
> +++ b/src/changes/changes.xml
> @@ -123,6 +123,7 @@ The  type attribute can be add,update,fix,remove.
>  Update Javadoc for the insert methods in ArrayUtils #1078.
>  Deprecate ExceptionUtils.ExceptionUtils().
>  TypeUtils.getRawType() throws a NullPointerException on 
> Wildcard GenericArrayType.
> +Throw IllegalArgumentException instead of InternalError in the 
> builder package.
>  
>  Add GitHub coverage.yml.
>  Add EnumUtils.getEnumSystemProperty(...).
> diff --git 
> a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java 
> b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
> index 38c69e613..3d411bb15 100644
> --- a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
> +++ b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
> @@ -97,19 +97,37 @@ import org.apache.commons.lang3.ObjectUtils;
>  public class CompareToBuilder implements Builder {
>
>  /**
> - * Current state of the comparison as appended fields are checked.
> - */
> -private int comparison;
> -
> -/**
> - * Constructor for CompareToBuilder.
> + * Appends to {@code builder} the comparison of {@code lhs}
> + * to {@code rhs} using the fields defined in {@code clazz}.
>   *
> - * Starts off assuming that the objects are equal. Multiple calls are
> - * then made to the various append methods, followed by a call to
> - * {@link #toComparison} to get the result.
> + * @param lhs  left-hand object
> + * @param rhs  right-hand object
> + * @param clazz  {@link Class} that defines fields to be compared
> + * @param builder  {@link CompareToBuilder} to append to
> + * @param useTransients  whether to compare transient fields
> + * @param excludeFields  fields to exclude
>   */
> -public CompareToBuilder() {
> -comparison = 0;
> +private static void reflectionAppend(
> +final Object lhs,
> +final Object rhs,
> +final Class clazz,
> +final CompareToBuilder builder,
> +final boolean useTransients,
> +final String[] excludeFields) {
> +
> +final Field[] fields = clazz.getDeclaredFields();
> +AccessibleObject.setAccessible(fields, true);
> +for (int i = 0; i < fields.length && builder.comparison == 0; i++) {
> +final Field field = fields[i];
> +if (!ArrayUtils.contains(excludeFields, field.getName())
> +&& !field.getName().contains("$")
> +&& (useTransients || 
> !Modifier.isTransient(field.getModifiers()))
> +&& !Modifier.isStatic(field.getModifiers())) {
> +// IllegalAccessException can't happen. Would get a Security 
> exception instead.
> +// Throw a runtime exception in case the impossible happens.
> +builder.append(Reflection.getUnchecked(field, lhs), 
> Reflection.getUnchecked(field, rhs));
> +}
> +}
>  }
>
>  /**
> @@ -183,10 +201,11 @@ public class CompareToBuilder implements 
> Builder {
>   *
>   * 
>   * Static fields will not be compared
> - * If {@code compareTransients} is {@code true},
> + * If the {@code compareTransients} is {@code true},
>   * compares transient members.  Otherwise ignores them, as they
>   * are likely derived fields.
> - * Superclass fields will be compared
> + * Compares superclass fields up to and including {@code 
> reflectUpToClass}.
> + * If {@code reflectUpToClass} is {@code null}, compares all 
> superclass fields.
>   * 
>   *
>   * If both {@code lhs} and {@code rhs} are {@code null},
> @@ -194,17 +213,41 @@ public class Compa

Re: [commons-lang] 04/04: Throw IllegalArgumentException instead of InternalError in the builder package

2023-07-12 Thread Gary Gregory
There must be something messed up with EOLs despite my git autocrlf
settings... sorry about that.

Gary

On Wed, Jul 12, 2023, 08:51 Gilles Sadowski  wrote:

> Hi.
>
> Le mer. 12 juil. 2023 à 14:44,  a écrit :
> >
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > ggregory pushed a commit to branch master
> > in repository https://gitbox.apache.org/repos/asf/commons-lang.git
> >
> > commit 2e3feda04337baa483bc26b66f238161dc6c97ac
> > Author: Gary Gregory 
> > AuthorDate: Wed Jul 12 08:44:38 2023 -0400
> >
> > Throw IllegalArgumentException instead of InternalError in the
> builder
> > package
>
> The diff below contains a bunch of (formatting ?) changes that
> have nothing to do with this commit message.
>
> Regards,
> Gilles
>
> > ---
> >  src/changes/changes.xml|   1 +
> >  .../commons/lang3/builder/CompareToBuilder.java| 752
> ++---
> >  .../commons/lang3/builder/EqualsBuilder.java   |  20 +-
> >  .../commons/lang3/builder/HashCodeBuilder.java |   9 +-
> >  .../apache/commons/lang3/builder/Reflection.java   |  44 ++
> >  .../lang3/builder/ReflectionDiffBuilder.java   |   7 +-
> >  .../lang3/builder/ReflectionToStringBuilder.java   |  14 +-
> >  7 files changed, 434 insertions(+), 413 deletions(-)
> >
> > diff --git a/src/changes/changes.xml b/src/changes/changes.xml
> > index 26d7be48c..da3522029 100644
> > --- a/src/changes/changes.xml
> > +++ b/src/changes/changes.xml
> > @@ -123,6 +123,7 @@ The  type attribute can be
> add,update,fix,remove.
> >   due-to="Dimitrios Efthymiou">Update Javadoc for the insert methods in
> ArrayUtils #1078.
> >  Deprecate ExceptionUtils.ExceptionUtils().
> >  TypeUtils.getRawType() throws a
> NullPointerException on Wildcard GenericArrayType.
> > +Throw IllegalArgumentException instead of InternalError in the
> builder package.
> >  
> >  Add GitHub coverage.yml.
> >  Add EnumUtils.getEnumSystemProperty(...).
> > diff --git
> a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
> b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
> > index 38c69e613..3d411bb15 100644
> > ---
> a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
> > +++
> b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
> > @@ -97,19 +97,37 @@ import org.apache.commons.lang3.ObjectUtils;
> >  public class CompareToBuilder implements Builder {
> >
> >  /**
> > - * Current state of the comparison as appended fields are checked.
> > - */
> > -private int comparison;
> > -
> > -/**
> > - * Constructor for CompareToBuilder.
> > + * Appends to {@code builder} the comparison of {@code lhs}
> > + * to {@code rhs} using the fields defined in {@code clazz}.
> >   *
> > - * Starts off assuming that the objects are equal. Multiple
> calls are
> > - * then made to the various append methods, followed by a call to
> > - * {@link #toComparison} to get the result.
> > + * @param lhs  left-hand object
> > + * @param rhs  right-hand object
> > + * @param clazz  {@link Class} that defines fields to be compared
> > + * @param builder  {@link CompareToBuilder} to append to
> > + * @param useTransients  whether to compare transient fields
> > + * @param excludeFields  fields to exclude
> >   */
> > -public CompareToBuilder() {
> > -comparison = 0;
> > +private static void reflectionAppend(
> > +final Object lhs,
> > +final Object rhs,
> > +final Class clazz,
> > +final CompareToBuilder builder,
> > +final boolean useTransients,
> > +final String[] excludeFields) {
> > +
> > +final Field[] fields = clazz.getDeclaredFields();
> > +AccessibleObject.setAccessible(fields, true);
> > +for (int i = 0; i < fields.length && builder.comparison == 0;
> i++) {
> > +final Field field = fields[i];
> > +if (!ArrayUtils.contains(excludeFields, field.getName())
> > +&& !field.getName().contains("$")
> > +&& (useTransients ||
> !Modifier.isTransient(field.getModifiers()))
> > +&& !Modifier.isStatic(field.getModifiers())) {
> > +// IllegalAccessException can't happen. Would get a
> Security exception instead.
> > +// Throw a runtime exception in case the impossible
> happens.
> > +builder.append(Reflection.getUnchecked(field, lhs),
> Reflection.getUnchecked(field, rhs));
> > +}
> > +}
> >  }
> >
> >  /**
> > @@ -183,10 +201,11 @@ public class CompareToBuilder implements
> Builder {
> >   *
> >   * 
> >   * Static fields will not be compared
> > - * If {@code compareTransients} is {@code true},
> > + * If the {@code compareTransients} is {@code true},
> >   * compares transient members.  Otherwise ignores them, as

[pool] Creating the 2.x branch

2023-07-12 Thread Phil Steitz
I think the code in master is close to releasable modulo the breaking
change that we have agreed should move to 3.x.  The clean way to proceed on
the 2.x branch would be to go back to the commit that introduced the new
exception type parameter, cut the branch from there and then port all of
the subsequent changes.  That would be a lot of manual work to do
individually, referencing each commit.  Do we think that this is necessary?

I see two alternatives.  One is to cut the 2.x branch from master and write
a script to make the changes to remove the type parameters, then do one
commit to revert that change.  Second is to do basically the same thing,
only creating the branch from the prior commit, then one big commit to both
port subsequent changes and get rid of the type parameters.

I am OK if people think we need to go back to the breaking commit and
individually port commits from there.  It will just take a little longer.
I am also obviously open to any better suggestions on how to do this.

Phil


Re: [pool] Creating the 2.x branch

2023-07-12 Thread Gary Gregory
My initial impression is that creating a script that edits sources
correctly will take longer to write than editing the head of master to
remove some of the generics. Recall that the code has other generics.

I am guessing that a manual edit is probably a half day to a full day of
work, I'm not sure how much editing the tests would need.

My gut feel is that it is safer to take the head of master, create a 2.x.y
branch and edit that, and switch master to 3.0.0. This pretty much
guarantees that neither branch will miss any fix.

Gary


On Wed, Jul 12, 2023, 14:29 Phil Steitz  wrote:

> I think the code in master is close to releasable modulo the breaking
> change that we have agreed should move to 3.x.  The clean way to proceed on
> the 2.x branch would be to go back to the commit that introduced the new
> exception type parameter, cut the branch from there and then port all of
> the subsequent changes.  That would be a lot of manual work to do
> individually, referencing each commit.  Do we think that this is necessary?
>
> I see two alternatives.  One is to cut the 2.x branch from master and write
> a script to make the changes to remove the type parameters, then do one
> commit to revert that change.  Second is to do basically the same thing,
> only creating the branch from the prior commit, then one big commit to both
> port subsequent changes and get rid of the type parameters.
>
> I am OK if people think we need to go back to the breaking commit and
> individually port commits from there.  It will just take a little longer.
> I am also obviously open to any better suggestions on how to do this.
>
> Phil
>


Re: [pool] Creating the 2.x branch

2023-07-12 Thread Phil Steitz



> On Jul 12, 2023, at 7:14 PM, Gary Gregory  wrote:
> 
> My initial impression is that creating a script that edits sources
> correctly will take longer to write than editing the head of master to
> remove some of the generics. Recall that the code has other generics.
> 
> I am guessing that a manual edit is probably a half day to a full day of
> work, I'm not sure how much editing the tests would need.
> 
> My gut feel is that it is safer to take the head of master, create a 2.x.y
> branch and edit that, and switch master to 3.0.0. This pretty much
> guarantees that neither branch will miss any fix.

Thanks, Gary.  I will take that approach.  

Phil
> 
> Gary
> 
> 
>> On Wed, Jul 12, 2023, 14:29 Phil Steitz  wrote:
>> 
>> I think the code in master is close to releasable modulo the breaking
>> change that we have agreed should move to 3.x.  The clean way to proceed on
>> the 2.x branch would be to go back to the commit that introduced the new
>> exception type parameter, cut the branch from there and then port all of
>> the subsequent changes.  That would be a lot of manual work to do
>> individually, referencing each commit.  Do we think that this is necessary?
>> 
>> I see two alternatives.  One is to cut the 2.x branch from master and write
>> a script to make the changes to remove the type parameters, then do one
>> commit to revert that change.  Second is to do basically the same thing,
>> only creating the branch from the prior commit, then one big commit to both
>> port subsequent changes and get rid of the type parameters.
>> 
>> I am OK if people think we need to go back to the breaking commit and
>> individually port commits from there.  It will just take a little longer.
>> I am also obviously open to any better suggestions on how to do this.
>> 
>> Phil
>> 

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org