You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by eb...@apache.org on 2020/04/06 13:34:52 UTC

[tomcat-jakartaee-migration] branch master updated (5c96c0b -> 61ba095)

This is an automated email from the ASF dual-hosted git repository.

ebourg pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git.


    from 5c96c0b  Ignore the IntelliJ project files
     new 29ea189  Replaced NonClosing{In,Out}putStream with the equivalent classes from Commons IO
     new 528ccfa  Made the internal classes package private
     new 61ba095  Relocated the dependencies in the shaded jar

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            | 15 ++++
 .../apache/tomcat/jakartaee/ClassConverter.java    |  2 +-
 .../org/apache/tomcat/jakartaee/Converter.java     |  2 +-
 .../java/org/apache/tomcat/jakartaee/Info.java     |  2 +-
 .../org/apache/tomcat/jakartaee/Migration.java     |  7 +-
 .../org/apache/tomcat/jakartaee/NoOpConverter.java |  2 +-
 .../tomcat/jakartaee/NonClosingInputStream.java    | 84 ----------------------
 .../tomcat/jakartaee/NonClosingOutputStream.java   | 60 ----------------
 .../org/apache/tomcat/jakartaee/StringManager.java |  2 +-
 .../org/apache/tomcat/jakartaee/TextConverter.java |  2 +-
 .../java/org/apache/tomcat/jakartaee/Util.java     |  2 +-
 11 files changed, 27 insertions(+), 153 deletions(-)
 delete mode 100644 src/main/java/org/apache/tomcat/jakartaee/NonClosingInputStream.java
 delete mode 100644 src/main/java/org/apache/tomcat/jakartaee/NonClosingOutputStream.java


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


Re: [tomcat-jakartaee-migration] branch master updated (5c96c0b -> 61ba095)

Posted by Mark Thomas <ma...@apache.org>.
On 07/04/2020 09:40, Emmanuel Bourg wrote:
> Le 07/04/2020 à 10:12, Mark Thomas a écrit :
> 
>> The dependencies are only embedded to create a single JAR to make it
>> easier for users to use on the command line. If the code was re-used I'd
>> expect the "standard" JAR to be used and leave the decision on how to
>> handle the dependencies up to the integrator.
> 
> Ok, I assumed the shaded jar was the main artifact. As long as it isn't
> published to Maven Central I'm fine with removing the relocation.

Working out how this could be formally released is still on the TODO list.

I don't view the shaded JAR as the main artefact but I can see it being
pushed to Maven Central at some point. If that does happen it would be
along side the "standard" JAR which would have a POM with the correct
dependencies.

Mark

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


Re: [tomcat-jakartaee-migration] branch master updated (5c96c0b -> 61ba095)

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 07/04/2020 à 10:12, Mark Thomas a écrit :

> The dependencies are only embedded to create a single JAR to make it
> easier for users to use on the command line. If the code was re-used I'd
> expect the "standard" JAR to be used and leave the decision on how to
> handle the dependencies up to the integrator.

Ok, I assumed the shaded jar was the main artifact. As long as it isn't
published to Maven Central I'm fine with removing the relocation.

Emmanuel Bourg

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


Re: [tomcat-jakartaee-migration] branch master updated (5c96c0b -> 61ba095)

Posted by Mark Thomas <ma...@apache.org>.
On 06/04/2020 17:45, Emmanuel Bourg wrote:
> Le 06/04/2020 à 18:33, Mark Thomas a écrit :
> 
>> OK. But that is still 7.2k of classes rather than 2.4k of classes for
>> zero benefit.
>>
>> I'll withdraw my -1 because we are approaching the point where the
>> differences aren't worth the time spent discussing them but I still
>> don't like this change.
> 
> I've removed the duplicated Apache license in the shaded jar, so the
> difference is now near zero.
> 
> I agree this change is trivial and doesn't bring significant changes.
> Apache Commons was created to share and reuse common code used at the
> ASF, I always feel a bit sad when the code produced there isn't reused.
> 
> 
>> And the relocation of the dependencies? At the moment, I only see a
>> downside (harder debugging). What is the benefit?
> 
> Relocating embedded dependencies is a best practice to prevent classpath
> conflicts. If the tools ends up being integrated in a bigger software it
> could clash with another version of BCEL on the classpath.

The dependencies are only embedded to create a single JAR to make it
easier for users to use on the command line. If the code was re-used I'd
expect the "standard" JAR to be used and leave the decision on how to
handle the dependencies up to the integrator.

Mark

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


Re: [tomcat-jakartaee-migration] branch master updated (5c96c0b -> 61ba095)

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 06/04/2020 à 18:33, Mark Thomas a écrit :

> OK. But that is still 7.2k of classes rather than 2.4k of classes for
> zero benefit.
> 
> I'll withdraw my -1 because we are approaching the point where the
> differences aren't worth the time spent discussing them but I still
> don't like this change.

I've removed the duplicated Apache license in the shaded jar, so the
difference is now near zero.

I agree this change is trivial and doesn't bring significant changes.
Apache Commons was created to share and reuse common code used at the
ASF, I always feel a bit sad when the code produced there isn't reused.


> And the relocation of the dependencies? At the moment, I only see a
> downside (harder debugging). What is the benefit?

Relocating embedded dependencies is a best practice to prevent classpath
conflicts. If the tools ends up being integrated in a bigger software it
could clash with another version of BCEL on the classpath.

Emmanuel Bourg

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


Re: [tomcat-jakartaee-migration] branch master updated (5c96c0b -> 61ba095)

Posted by Mark Thomas <ma...@apache.org>.
On 06/04/2020 17:18, Emmanuel Bourg wrote:
> Le 06/04/2020 à 17:50, Mark Thomas a écrit :
> 
>>>     from 5c96c0b  Ignore the IntelliJ project files
>>>      new 29ea189  Replaced NonClosing{In,Out}putStream with the equivalent classes from Commons IO
>>
>> -1. It adds 220k of bloat for no benefit.
> 
> No the dependencies are shaded with the minimizeJar option enabled, only
> the classes used are kept in the final jar.

OK. But that is still 7.2k of classes rather than 2.4k of classes for
zero benefit.

I'll withdraw my -1 because we are approaching the point where the
differences aren't worth the time spent discussing them but I still
don't like this change.

>>>      new 528ccfa  Made the internal classes package private
>>
>> I am close to -1 on this change.
>>
>> I would rather these were left public at this stage in the development
>> of this tool to make it as easy as possible for folks to tinker with
>> this code, re-using the bits that work for them. Longer term I had the
>> possibility in mind that users might need to register custom Converters
>> so making that package private seems very out of place.
>>
>> I get that we can always relax visibility rules later but this change
>> looks premature to me.
> 
> Ok sounds fair, I've reverted it.

And the relocation of the dependencies? At the moment, I only see a
downside (harder debugging). What is the benefit?

Mark

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


Re: [tomcat-jakartaee-migration] branch master updated (5c96c0b -> 61ba095)

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 06/04/2020 à 17:50, Mark Thomas a écrit :

>>     from 5c96c0b  Ignore the IntelliJ project files
>>      new 29ea189  Replaced NonClosing{In,Out}putStream with the equivalent classes from Commons IO
> 
> -1. It adds 220k of bloat for no benefit.

No the dependencies are shaded with the minimizeJar option enabled, only
the classes used are kept in the final jar.


>>      new 528ccfa  Made the internal classes package private
> 
> I am close to -1 on this change.
> 
> I would rather these were left public at this stage in the development
> of this tool to make it as easy as possible for folks to tinker with
> this code, re-using the bits that work for them. Longer term I had the
> possibility in mind that users might need to register custom Converters
> so making that package private seems very out of place.
> 
> I get that we can always relax visibility rules later but this change
> looks premature to me.

Ok sounds fair, I've reverted it.

Emmanuel Bourg

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


Re: [tomcat-jakartaee-migration] branch master updated (5c96c0b -> 61ba095)

Posted by Mark Thomas <ma...@apache.org>.
On 06/04/2020 14:34, ebourg@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> ebourg pushed a change to branch master
> in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git.
> 
> 
>     from 5c96c0b  Ignore the IntelliJ project files
>      new 29ea189  Replaced NonClosing{In,Out}putStream with the equivalent classes from Commons IO

-1. It adds 220k of bloat for no benefit.

>      new 528ccfa  Made the internal classes package private

I am close to -1 on this change.

I would rather these were left public at this stage in the development
of this tool to make it as easy as possible for folks to tinker with
this code, re-using the bits that work for them. Longer term I had the
possibility in mind that users might need to register custom Converters
so making that package private seems very out of place.

I get that we can always relax visibility rules later but this change
looks premature to me.

>      new 61ba095  Relocated the dependencies in the shaded jar

Again, I am close to -1 on this change.

Why? I don't see the need for this. It just makes debugging potentially
harder.

Mark

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


[tomcat-jakartaee-migration] 02/03: Made the internal classes package private

Posted by eb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ebourg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit 528ccfade4ef07ac5ee240767ed7fe09ead71ab5
Author: Emmanuel Bourg <eb...@apache.org>
AuthorDate: Mon Apr 6 15:27:15 2020 +0200

    Made the internal classes package private
---
 src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java | 2 +-
 src/main/java/org/apache/tomcat/jakartaee/Converter.java      | 2 +-
 src/main/java/org/apache/tomcat/jakartaee/Info.java           | 2 +-
 src/main/java/org/apache/tomcat/jakartaee/NoOpConverter.java  | 2 +-
 src/main/java/org/apache/tomcat/jakartaee/StringManager.java  | 2 +-
 src/main/java/org/apache/tomcat/jakartaee/TextConverter.java  | 2 +-
 src/main/java/org/apache/tomcat/jakartaee/Util.java           | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java b/src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java
index 4b7777b..3b7f3bc 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/ClassConverter.java
@@ -25,7 +25,7 @@ import org.apache.bcel.classfile.Constant;
 import org.apache.bcel.classfile.ConstantUtf8;
 import org.apache.bcel.classfile.JavaClass;
 
-public class ClassConverter implements Converter {
+class ClassConverter implements Converter {
 
     @Override
     public boolean accepts(String filename) {
diff --git a/src/main/java/org/apache/tomcat/jakartaee/Converter.java b/src/main/java/org/apache/tomcat/jakartaee/Converter.java
index f3d62ec..cf22616 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Converter.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Converter.java
@@ -20,7 +20,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
-public interface Converter {
+interface Converter {
 
     boolean accepts(String filename);
 
diff --git a/src/main/java/org/apache/tomcat/jakartaee/Info.java b/src/main/java/org/apache/tomcat/jakartaee/Info.java
index a8de1a0..c1ad499 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Info.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Info.java
@@ -19,7 +19,7 @@ package org.apache.tomcat.jakartaee;
 import java.io.IOException;
 import java.util.Properties;
 
-public class Info {
+class Info {
 
     private static final String VERSION;
 
diff --git a/src/main/java/org/apache/tomcat/jakartaee/NoOpConverter.java b/src/main/java/org/apache/tomcat/jakartaee/NoOpConverter.java
index cd1152a..3444ebf 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/NoOpConverter.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/NoOpConverter.java
@@ -20,7 +20,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
-public class NoOpConverter implements Converter {
+class NoOpConverter implements Converter {
 
     @Override
     public boolean accepts(String filename) {
diff --git a/src/main/java/org/apache/tomcat/jakartaee/StringManager.java b/src/main/java/org/apache/tomcat/jakartaee/StringManager.java
index 7df8faf..8e1680f 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/StringManager.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/StringManager.java
@@ -49,7 +49,7 @@ import java.util.ResourceBundle;
  * @author Mel Martinez [mmartinez@g1440.com]
  * @see java.util.ResourceBundle
  */
-public class StringManager {
+class StringManager {
 
     private static int LOCALE_CACHE_SIZE = 10;
 
diff --git a/src/main/java/org/apache/tomcat/jakartaee/TextConverter.java b/src/main/java/org/apache/tomcat/jakartaee/TextConverter.java
index d0a0db2..3911850 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/TextConverter.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/TextConverter.java
@@ -25,7 +25,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 
-public class TextConverter implements Converter {
+class TextConverter implements Converter {
 
     private static final List<String> supportedExtensions;
 
diff --git a/src/main/java/org/apache/tomcat/jakartaee/Util.java b/src/main/java/org/apache/tomcat/jakartaee/Util.java
index 2a2ae81..4c2bce6 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Util.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Util.java
@@ -20,7 +20,7 @@ import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-public class Util {
+class Util {
 
     public enum EESpecProfile { TOMCAT, EE };
 


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


Re: [tomcat-jakartaee-migration] 01/03: Replaced NonClosing{In, Out}putStream with the equivalent classes from Commons IO

Posted by Rémy Maucherat <re...@apache.org>.
On Tue, Apr 7, 2020 at 11:05 AM Emmanuel Bourg <eb...@apache.org> wrote:

> Le 07/04/2020 à 09:41, Rémy Maucherat a écrit :
>
> > Reimplemeting ... It was already done, and this was a better trivial
> > solution. This is a veto (unlike Mark I will not withdraw it), so please
> > revert this commit.
>
> Remy, this is honestly more a rant on an insignificant detail than a
> reasonably justified veto. It doesn't affect the correctness, the
> performance or the maintainability of the tool. I'm tempted to translate
> this as "Don't touch my project" and an incitation to go work on
> something else.
>
> The dependency graph of this tool is very likely to grow as its features
> expand (think about adding a CLI parser, providing the tool as a
> Maven/Gradle plugin or an Ant task), and I wouldn't be surprised to see
> Commons IO brought to the classpath sooner or later anyway (or the
> overhead diluted).
>

This is exactly the reason why we don't use Maven in Tomcat, dependencies
creep up because it is "normal".

Rémy

Re: [tomcat-jakartaee-migration] 01/03: Replaced NonClosing{In, Out}putStream with the equivalent classes from Commons IO

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 07/04/2020 à 09:41, Rémy Maucherat a écrit :

> Reimplemeting ... It was already done, and this was a better trivial
> solution. This is a veto (unlike Mark I will not withdraw it), so please
> revert this commit.

Remy, this is honestly more a rant on an insignificant detail than a
reasonably justified veto. It doesn't affect the correctness, the
performance or the maintainability of the tool. I'm tempted to translate
this as "Don't touch my project" and an incitation to go work on
something else.

The dependency graph of this tool is very likely to grow as its features
expand (think about adding a CLI parser, providing the tool as a
Maven/Gradle plugin or an Ant task), and I wouldn't be surprised to see
Commons IO brought to the classpath sooner or later anyway (or the
overhead diluted).

Emmanuel Bourg

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


Re: [tomcat-jakartaee-migration] 01/03: Replaced NonClosing{In, Out}putStream with the equivalent classes from Commons IO

Posted by Rémy Maucherat <re...@apache.org>.
On Mon, Apr 6, 2020 at 3:45 PM Emmanuel Bourg <eb...@apache.org> wrote:

> Le 06/04/2020 à 15:38, Rémy Maucherat a écrit :
>
> >     commit 29ea1891489060f3b3e40259098def5ae47645ef
> >     Author: Emmanuel Bourg <ebourg@apache.org <mailto:ebourg@apache.org
> >>
> >     AuthorDate: Mon Apr 6 15:24:35 2020 +0200
> >
> >         Replaced NonClosing{In,Out}putStream with the equivalent classes
> >     from Commons IO
> >
> >
> > Ah, the beauty of having Maven. Actual benefit: zero. Trouble with
> > updating dependencies: one. Possible incompatibilities: one.
> > So I think it's a total of -2 for the commit.
>
> Sorry but I'm not sure to understand your objection. Commons IO is dead
> stable, these classes have been around for over 10 years and haven't
> changed much since. There is really no point reimplementing them.
>

Reimplemeting ... It was already done, and this was a better trivial
solution. This is a veto (unlike Mark I will not withdraw it), so please
revert this commit.

Rémy

Re: [tomcat-jakartaee-migration] 01/03: Replaced NonClosing{In, Out}putStream with the equivalent classes from Commons IO

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 06/04/2020 à 15:38, Rémy Maucherat a écrit :

>     commit 29ea1891489060f3b3e40259098def5ae47645ef
>     Author: Emmanuel Bourg <ebourg@apache.org <ma...@apache.org>>
>     AuthorDate: Mon Apr 6 15:24:35 2020 +0200
> 
>         Replaced NonClosing{In,Out}putStream with the equivalent classes
>     from Commons IO
> 
> 
> Ah, the beauty of having Maven. Actual benefit: zero. Trouble with
> updating dependencies: one. Possible incompatibilities: one.
> So I think it's a total of -2 for the commit.

Sorry but I'm not sure to understand your objection. Commons IO is dead
stable, these classes have been around for over 10 years and haven't
changed much since. There is really no point reimplementing them.

Emmanuel Bourg

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


Re: [tomcat-jakartaee-migration] 01/03: Replaced NonClosing{In, Out}putStream with the equivalent classes from Commons IO

Posted by Rémy Maucherat <re...@apache.org>.
On Mon, Apr 6, 2020 at 3:34 PM <eb...@apache.org> wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> ebourg pushed a commit to branch master
> in repository
> https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git
>
> commit 29ea1891489060f3b3e40259098def5ae47645ef
> Author: Emmanuel Bourg <eb...@apache.org>
> AuthorDate: Mon Apr 6 15:24:35 2020 +0200
>
>     Replaced NonClosing{In,Out}putStream with the equivalent classes from
> Commons IO
>

Ah, the beauty of having Maven. Actual benefit: zero. Trouble with updating
dependencies: one. Possible incompatibilities: one.
So I think it's a total of -2 for the commit.

Rémy


> ---
>  pom.xml                                            |  5 ++
>  .../org/apache/tomcat/jakartaee/Migration.java     |  7 +-
>  .../tomcat/jakartaee/NonClosingInputStream.java    | 84
> ----------------------
>  .../tomcat/jakartaee/NonClosingOutputStream.java   | 60 ----------------
>  4 files changed, 10 insertions(+), 146 deletions(-)
>
> diff --git a/pom.xml b/pom.xml
> index cf7f18b..ab74cfe 100644
> --- a/pom.xml
> +++ b/pom.xml
> @@ -71,6 +71,11 @@
>        <artifactId>bcel</artifactId>
>        <version>6.4.1</version>
>      </dependency>
> +    <dependency>
> +      <groupId>commons-io</groupId>
> +      <artifactId>commons-io</artifactId>
> +      <version>2.6</version>
> +    </dependency>
>    </dependencies>
>
>    <build>
> diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java
> b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
> index 734ebd8..5d8fdf1 100644
> --- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java
> +++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
> @@ -36,6 +36,9 @@ import java.util.jar.Manifest;
>  import java.util.logging.Level;
>  import java.util.logging.Logger;
>
> +import org.apache.commons.io.input.CloseShieldInputStream;
> +import org.apache.commons.io.output.CloseShieldOutputStream;
> +
>  public class Migration {
>
>      private static final Logger logger =
> Logger.getLogger(Migration.class.getCanonicalName());
> @@ -131,8 +134,8 @@ public class Migration {
>
>      private boolean migrateArchive(InputStream src, OutputStream dest)
> throws IOException {
>          boolean result = true;
> -        try (JarInputStream jarIs = new JarInputStream(new
> NonClosingInputStream(src));
> -                JarOutputStream jarOs = new JarOutputStream(new
> NonClosingOutputStream(dest))) {
> +        try (JarInputStream jarIs = new JarInputStream(new
> CloseShieldInputStream(src));
> +                JarOutputStream jarOs = new JarOutputStream(new
> CloseShieldOutputStream(dest))) {
>              Manifest manifest = jarIs.getManifest();
>              if (manifest != null) {
>                  // Make a safe copy to leave original manifest untouched.
> diff --git
> a/src/main/java/org/apache/tomcat/jakartaee/NonClosingInputStream.java
> b/src/main/java/org/apache/tomcat/jakartaee/NonClosingInputStream.java
> deleted file mode 100644
> index 53f883c..0000000
> --- a/src/main/java/org/apache/tomcat/jakartaee/NonClosingInputStream.java
> +++ /dev/null
> @@ -1,84 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements.  See the NOTICE file distributed with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You under the Apache License, Version 2.0
> - * (the "License"); you may not use this file except in compliance with
> - * the License.  You may obtain a copy of the License at
> - *
> - *      http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing, software
> - * distributed under the License is distributed on an "AS IS" BASIS,
> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> - * See the License for the specific language governing permissions and
> - * limitations under the License.
> - */
> -package org.apache.tomcat.jakartaee;
> -
> -import java.io.IOException;
> -import java.io.InputStream;
> -
> -public class NonClosingInputStream extends InputStream {
> -
> -    private InputStream wrapped;
> -
> -
> -    public NonClosingInputStream(InputStream wrapped) {
> -        this.wrapped = wrapped;
> -    }
> -
> -
> -    @Override
> -    public int read() throws IOException {
> -        return wrapped.read();
> -    }
> -
> -
> -    @Override
> -    public int read(byte[] b) throws IOException {
> -        return wrapped.read(b);
> -    }
> -
> -
> -    @Override
> -    public int read(byte[] b, int off, int len) throws IOException {
> -        return wrapped.read(b, off, len);
> -    }
> -
> -
> -    @Override
> -    public long skip(long n) throws IOException {
> -        return wrapped.skip(n);
> -    }
> -
> -
> -    @Override
> -    public int available() throws IOException {
> -        return wrapped.available();
> -    }
> -
> -
> -    @Override
> -    public void close() throws IOException {
> -        // NO-OP
> -    }
> -
> -
> -    @Override
> -    public synchronized void mark(int readlimit) {
> -        wrapped.mark(readlimit);
> -    }
> -
> -
> -    @Override
> -    public synchronized void reset() throws IOException {
> -        wrapped.reset();
> -    }
> -
> -
> -    @Override
> -    public boolean markSupported() {
> -        return wrapped.markSupported();
> -    }
> -}
> diff --git
> a/src/main/java/org/apache/tomcat/jakartaee/NonClosingOutputStream.java
> b/src/main/java/org/apache/tomcat/jakartaee/NonClosingOutputStream.java
> deleted file mode 100644
> index b4ee198..0000000
> --- a/src/main/java/org/apache/tomcat/jakartaee/NonClosingOutputStream.java
> +++ /dev/null
> @@ -1,60 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one or more
> - * contributor license agreements.  See the NOTICE file distributed with
> - * this work for additional information regarding copyright ownership.
> - * The ASF licenses this file to You under the Apache License, Version 2.0
> - * (the "License"); you may not use this file except in compliance with
> - * the License.  You may obtain a copy of the License at
> - *
> - *      http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing, software
> - * distributed under the License is distributed on an "AS IS" BASIS,
> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> - * See the License for the specific language governing permissions and
> - * limitations under the License.
> - */
> -package org.apache.tomcat.jakartaee;
> -
> -import java.io.IOException;
> -import java.io.OutputStream;
> -
> -public class NonClosingOutputStream extends OutputStream {
> -
> -    private OutputStream wrapped;
> -
> -
> -    public NonClosingOutputStream(OutputStream wrapped) {
> -        this.wrapped = wrapped;
> -    }
> -
> -
> -    @Override
> -    public void write(int b) throws IOException {
> -        wrapped.write(b);
> -    }
> -
> -
> -    @Override
> -    public void write(byte[] b) throws IOException {
> -        wrapped.write(b);
> -    }
> -
> -
> -    @Override
> -    public void write(byte[] b, int off, int len) throws IOException {
> -        wrapped.write(b, off, len);
> -    }
> -
> -
> -    @Override
> -    public void flush() throws IOException {
> -        wrapped.flush();
> -    }
> -
> -
> -    @Override
> -    public void close() throws IOException {
> -        // NO-OP
> -    }
> -}
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

[tomcat-jakartaee-migration] 01/03: Replaced NonClosing{In, Out}putStream with the equivalent classes from Commons IO

Posted by eb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ebourg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit 29ea1891489060f3b3e40259098def5ae47645ef
Author: Emmanuel Bourg <eb...@apache.org>
AuthorDate: Mon Apr 6 15:24:35 2020 +0200

    Replaced NonClosing{In,Out}putStream with the equivalent classes from Commons IO
---
 pom.xml                                            |  5 ++
 .../org/apache/tomcat/jakartaee/Migration.java     |  7 +-
 .../tomcat/jakartaee/NonClosingInputStream.java    | 84 ----------------------
 .../tomcat/jakartaee/NonClosingOutputStream.java   | 60 ----------------
 4 files changed, 10 insertions(+), 146 deletions(-)

diff --git a/pom.xml b/pom.xml
index cf7f18b..ab74cfe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,6 +71,11 @@
       <artifactId>bcel</artifactId>
       <version>6.4.1</version>
     </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <version>2.6</version>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
index 734ebd8..5d8fdf1 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
@@ -36,6 +36,9 @@ import java.util.jar.Manifest;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.commons.io.input.CloseShieldInputStream;
+import org.apache.commons.io.output.CloseShieldOutputStream;
+
 public class Migration {
 
     private static final Logger logger = Logger.getLogger(Migration.class.getCanonicalName());
@@ -131,8 +134,8 @@ public class Migration {
 
     private boolean migrateArchive(InputStream src, OutputStream dest) throws IOException {
         boolean result = true;
-        try (JarInputStream jarIs = new JarInputStream(new NonClosingInputStream(src));
-                JarOutputStream jarOs = new JarOutputStream(new NonClosingOutputStream(dest))) {
+        try (JarInputStream jarIs = new JarInputStream(new CloseShieldInputStream(src));
+                JarOutputStream jarOs = new JarOutputStream(new CloseShieldOutputStream(dest))) {
             Manifest manifest = jarIs.getManifest();
             if (manifest != null) {
                 // Make a safe copy to leave original manifest untouched.
diff --git a/src/main/java/org/apache/tomcat/jakartaee/NonClosingInputStream.java b/src/main/java/org/apache/tomcat/jakartaee/NonClosingInputStream.java
deleted file mode 100644
index 53f883c..0000000
--- a/src/main/java/org/apache/tomcat/jakartaee/NonClosingInputStream.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jakartaee;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class NonClosingInputStream extends InputStream {
-
-    private InputStream wrapped;
-
-
-    public NonClosingInputStream(InputStream wrapped) {
-        this.wrapped = wrapped;
-    }
-
-
-    @Override
-    public int read() throws IOException {
-        return wrapped.read();
-    }
-
-
-    @Override
-    public int read(byte[] b) throws IOException {
-        return wrapped.read(b);
-    }
-
-
-    @Override
-    public int read(byte[] b, int off, int len) throws IOException {
-        return wrapped.read(b, off, len);
-    }
-
-
-    @Override
-    public long skip(long n) throws IOException {
-        return wrapped.skip(n);
-    }
-
-
-    @Override
-    public int available() throws IOException {
-        return wrapped.available();
-    }
-
-
-    @Override
-    public void close() throws IOException {
-        // NO-OP
-    }
-
-
-    @Override
-    public synchronized void mark(int readlimit) {
-        wrapped.mark(readlimit);
-    }
-
-
-    @Override
-    public synchronized void reset() throws IOException {
-        wrapped.reset();
-    }
-
-
-    @Override
-    public boolean markSupported() {
-        return wrapped.markSupported();
-    }
-}
diff --git a/src/main/java/org/apache/tomcat/jakartaee/NonClosingOutputStream.java b/src/main/java/org/apache/tomcat/jakartaee/NonClosingOutputStream.java
deleted file mode 100644
index b4ee198..0000000
--- a/src/main/java/org/apache/tomcat/jakartaee/NonClosingOutputStream.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomcat.jakartaee;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-public class NonClosingOutputStream extends OutputStream {
-
-    private OutputStream wrapped;
-
-
-    public NonClosingOutputStream(OutputStream wrapped) {
-        this.wrapped = wrapped;
-    }
-
-
-    @Override
-    public void write(int b) throws IOException {
-        wrapped.write(b);
-    }
-
-
-    @Override
-    public void write(byte[] b) throws IOException {
-        wrapped.write(b);
-    }
-
-
-    @Override
-    public void write(byte[] b, int off, int len) throws IOException {
-        wrapped.write(b, off, len);
-    }
-
-
-    @Override
-    public void flush() throws IOException {
-        wrapped.flush();
-    }
-
-
-    @Override
-    public void close() throws IOException {
-        // NO-OP
-    }
-}


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


[tomcat-jakartaee-migration] 03/03: Relocated the dependencies in the shaded jar

Posted by eb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ebourg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit 61ba09577afc9fecf542d19c5cad6e79f1008ebd
Author: Emmanuel Bourg <eb...@apache.org>
AuthorDate: Mon Apr 6 15:31:29 2020 +0200

    Relocated the dependencies in the shaded jar
---
 pom.xml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/pom.xml b/pom.xml
index ab74cfe..61ef6f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -121,6 +121,16 @@
               <shadedArtifactAttached>true</shadedArtifactAttached>
               <minimizeJar>true</minimizeJar>
               <createDependencyReducedPom>false</createDependencyReducedPom>
+              <relocations>
+                <relocation>
+                  <pattern>org.apache.bcel</pattern>
+                  <shadedPattern>org.apache.tomcat.jakartaee.bcel</shadedPattern>
+                </relocation>
+                <relocation>
+                  <pattern>org.apache.commons</pattern>
+                  <shadedPattern>org.apache.tomcat.jakartaee.commons</shadedPattern>
+                </relocation>
+              </relocations>
             </configuration>
           </execution>
         </executions>


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