You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2015/11/03 00:54:52 UTC

Fwd: tomee git commit: JDK 6

you changed a test changing jndi names: why removing java:app/jdbc/?

Also LocalFileHandler is now broken cause we can't use any dependency for
this one (it is likely used before common.loader).

Since it is not setup by default it is ok IMO to have to build this part
with java 7 since the main runtime will stay java 6 and most of users are
using java 7/8 IMO - wouldnt be different from what tomcat and us do for
websockets since few years.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

---------- Forwarded message ----------
From: <an...@apache.org>
Date: 2015-11-02 15:51 GMT-08:00
Subject: tomee git commit: JDK 6
To: commits@tomee.apache.org


Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x 5b9a12fc6 -> a783e6dea


JDK 6

LocalFileHandlerTest needs attention


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/a783e6de
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/a783e6de
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/a783e6de

Branch: refs/heads/tomee-1.7.x
Commit: a783e6deac7f5ea15c378d2585c7cdff3f5a88b7
Parents: 5b9a12f
Author: AndyGee <an...@gmx.de>
Authored: Tue Nov 3 00:50:51 2015 +0100
Committer: AndyGee <an...@gmx.de>
Committed: Tue Nov 3 00:50:51 2015 +0100

----------------------------------------------------------------------
 .../main/java/org/superbiz/dsdef/Persister.java |  4 ++--
 .../dsdef/DataSourceDefinitionTest.java         |  2 +-
 pom.xml                                         |  4 ++--
 tomee/tomee-juli/pom.xml                        |  9 ++++----
 .../jul/handler/rotating/LocalFileHandler.java  | 23 ++++++++++----------
 .../handler/rotating/LocalFileHandlerTest.java  |  5 ++---
 6 files changed, 22 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
----------------------------------------------------------------------
diff --git
a/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
b/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
index 4b70bd3..df4f4ae 100644
---
a/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
+++
b/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
@@ -26,14 +26,14 @@ import javax.sql.DataSource;
                       className = "org.h2.jdbcx.JdbcDataSource",
                       user = "sa",
                       password = "",
-                      name = "java:app/jdbc/persister",
+                      name = "persister",
                       initialPoolSize = 1,
                       maxPoolSize = 3
 )
 @Named
 public class Persister {

-    @Resource(lookup = "java:app/jdbc/persister")
+    @Resource(name = "persister")
     private DataSource ds;

     public DataSource getDs() {

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
----------------------------------------------------------------------
diff --git
a/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
b/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
index ba9c3f2..1b392e2 100644
---
a/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
+++
b/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
@@ -99,7 +99,7 @@ public class DataSourceDefinitionTest {

     @Test
     public void lookup() throws NamingException {
-        final Object o =
container.getContext().lookup("java:app/jdbc/persister");
+        final Object o = container.getContext().lookup("java:persister");
         assertNotNull(o);
         assertEquals(persister.getDs(), o);
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ea81a76..0a18f15 100644
--- a/pom.xml
+++ b/pom.xml
@@ -237,12 +237,12 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
-          <version>3.1</version>
+          <version>3.2</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.17</version>
+          <version>2.18.1</version>
         </plugin>
         <plugin> <!-- maven-dependency-plugin:properties doesn't work as
well as this one for us -->
           <groupId>org.apache.geronimo.buildsupport</groupId>

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/tomee/tomee-juli/pom.xml
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/pom.xml b/tomee/tomee-juli/pom.xml
index bc578f8..9550a1c 100644
--- a/tomee/tomee-juli/pom.xml
+++ b/tomee/tomee-juli/pom.xml
@@ -36,6 +36,10 @@
       <optional>true</optional>
     </dependency>
     <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency>
+    <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <scope>provided</scope>
@@ -63,11 +67,6 @@
       <version>${jmh.version}</version>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>

   <properties>

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
----------------------------------------------------------------------
diff --git
a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
index 6850f1c..ffa61aa 100644
---
a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
+++
b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
@@ -16,6 +16,8 @@
  */
 package org.apache.tomee.jul.handler.rotating;

+import org.apache.commons.io.FileUtils;
+
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -27,8 +29,6 @@ import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.UnsupportedEncodingException;
-import java.nio.file.Files;
-import java.nio.file.attribute.BasicFileAttributes;
 import java.sql.Timestamp;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
@@ -377,14 +377,13 @@ public class LocalFileHandler extends Handler {
             if (archives != null) {
                 for (final File archive : archives) {
                     try {
-                        final BasicFileAttributes attr =
Files.readAttributes(archive.toPath(), BasicFileAttributes.class);
-                        if (now - attr.creationTime().toMillis() >
purgeExpiryDuration) {
-                            if (!Files.deleteIfExists(archive.toPath())) {
+                        if (FileUtils.isFileOlder(archive, now -
purgeExpiryDuration)) {
+                            if (!FileUtils.deleteQuietly(archive)) {
                                 // Do not try to delete on exit cause we
will find it again
-                                reportError("Can't delete " +
archive.getAbsolutePath() + ".", null, ErrorManager.GENERIC_FAILURE);
+                                reportError("Failed to delete " +
archive.getAbsolutePath() + ".", null, ErrorManager.GENERIC_FAILURE);
                             }
                         }
-                    } catch (final IOException e) {
+                    } catch (final Exception e) {
                         throw new IllegalStateException(e);
                     }
                 }
@@ -402,11 +401,11 @@ public class LocalFileHandler extends Handler {
             if (logs != null) {
                 for (final File file : logs) {
                     try {
-                        final BasicFileAttributes attr =
Files.readAttributes(file.toPath(), BasicFileAttributes.class);
-                        if (attr.creationTime().toMillis() < now && now -
attr.lastModifiedTime().toMillis() > archiveExpiryDuration) {
+                        final boolean older = FileUtils.isFileOlder(file,
now);
+                        if (older && now - file.lastModified() >
archiveExpiryDuration) {
                             createArchive(file);
                         }
-                    } catch (final IOException e) {
+                    } catch (final Exception e) {
                         throw new IllegalStateException(e);
                     }
                 }
@@ -497,10 +496,10 @@ public class LocalFileHandler extends Handler {
             }
         }
         try {
-            if (!Files.deleteIfExists(source.toPath())) {
+            if (!FileUtils.deleteQuietly(source)) {
                 reportError("Can't delete " + source.getAbsolutePath() +
".", null, ErrorManager.GENERIC_FAILURE);
             }
-        } catch (final IOException e) {
+        } catch (final Exception e) {
             throw new IllegalStateException(e);
         }
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/a783e6de/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
----------------------------------------------------------------------
diff --git
a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
index 6279b11..3bc872d 100644
---
a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
+++
b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
@@ -34,7 +34,6 @@ import java.util.logging.Formatter;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;

-import static java.lang.System.lineSeparator;
 import static java.util.Arrays.asList;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -99,7 +98,7 @@ public class LocalFileHandlerTest {

         final InputStream is = new FileInputStream(new File(out,
"test.day1.1.log"));
         final List<String> lines = IOUtils.readLines(is);
-        assertEquals(19, lines.size());
+        //TODO - Why is this 96 on my machine? assertEquals(19,
lines.size());
         assertEquals(string10chars, lines.iterator().next());
         is.close();

@@ -122,7 +121,7 @@ public class LocalFileHandlerTest {
     public static class MessageOnlyFormatter extends Formatter {
         @Override
         public String format(final LogRecord record) {
-            return record.getMessage() + lineSeparator();
+            return record.getMessage() + String.format("%n");
         }
     }
 }

Re: Fwd: tomee git commit: JDK 6

Posted by Romain Manni-Bucau <rm...@gmail.com>.
there is java 6 API for these things but got some surprises using them and
not j7 one on some UNIx. I would really prefer to go with j7 code even in
1.7 than j6. If we manage to do a 7.x AND 1.7 vote (ie both in the same
thread) I'm +1 to remove it from 1.7.x and I can do the extraction in a
module on 7.x if everybody is happy with it. If we can't I'm tempted to
keep it like that since it is the less hurting solution IMO to get this
included.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-11-02 17:09 GMT-08:00 agumbrecht <ag...@tomitribe.com>:

> Well we just need a JDK6 compatible & green build solution for 1.7.x and
> TTx,
> so I'm going to let you work this one out the best way you see fit.
>
> All PMCs should be commenting on this and working towards a solution that
> is
> backwards compatible and does not break the status quo for any application
> that is running on a TomEE 1.7.x, it must be 100% compatible, this includes
> the build.
>
> When we have this then it will be safe to take a snapshot, and also do a
> roll for a 1.7.3 release. If these changes are not required then we should
> not backport them at all. 1.7.x is currently our only production stable
> branch. I'm a big -1 for any code in this branch that 'needs' Java 7+ to
> work.
>
> Andy.
>
>
>
>
>
> -----
>     --
>     Andy Gumbrecht
>
>     http://www.tomitribe.com
>     agumbrecht@tomitribe.com
>     https://twitter.com/AndyGeeDe
>
>     TomEE treibt Tomitribe ! | http://tomee.apache.org
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Fwd-tomee-git-commit-JDK-6-tp4676696p4676701.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Re: Fwd: tomee git commit: JDK 6

Posted by agumbrecht <ag...@tomitribe.com>.
Well we just need a JDK6 compatible & green build solution for 1.7.x and TTx,
so I'm going to let you work this one out the best way you see fit. 

All PMCs should be commenting on this and working towards a solution that is
backwards compatible and does not break the status quo for any application
that is running on a TomEE 1.7.x, it must be 100% compatible, this includes
the build.

When we have this then it will be safe to take a snapshot, and also do a
roll for a 1.7.3 release. If these changes are not required then we should
not backport them at all. 1.7.x is currently our only production stable
branch. I'm a big -1 for any code in this branch that 'needs' Java 7+ to
work.

Andy.





-----
    -- 
    Andy Gumbrecht

    http://www.tomitribe.com
    agumbrecht@tomitribe.com
    https://twitter.com/AndyGeeDe

    TomEE treibt Tomitribe ! | http://tomee.apache.org
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Fwd-tomee-git-commit-JDK-6-tp4676696p4676701.html
Sent from the TomEE Dev mailing list archive at Nabble.com.

Re: Fwd: tomee git commit: JDK 6

Posted by Romain Manni-Bucau <rm...@gmail.com>.
well not exactly, it should be delivered by default but not configured
using it.

Alternative is to extract this part in another module on 7.x, then users
can import this jar "manually" - but it shouldnt be in tomee-juli cause 1.x
and 7.x tomee-juli are not compatible.

I have no strong opinion on this but I dont like much "optional" modules
since it is synonym of dead code.



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-11-02 16:20 GMT-08:00 agumbrecht <ag...@tomitribe.com>:

> So we should maven profile this part of the build as an optional extra that
> is not included by default, at least for the 1.7.x build. Will have a look
> at that tomorrow.
>
>
>
> -----
>     --
>     Andy Gumbrecht
>
>     http://www.tomitribe.com
>     agumbrecht@tomitribe.com
>     https://twitter.com/AndyGeeDe
>
>     TomEE treibt Tomitribe ! | http://tomee.apache.org
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Fwd-tomee-git-commit-JDK-6-tp4676696p4676699.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Re: Fwd: tomee git commit: JDK 6

Posted by agumbrecht <ag...@tomitribe.com>.
So we should maven profile this part of the build as an optional extra that
is not included by default, at least for the 1.7.x build. Will have a look
at that tomorrow.



-----
    -- 
    Andy Gumbrecht

    http://www.tomitribe.com
    agumbrecht@tomitribe.com
    https://twitter.com/AndyGeeDe

    TomEE treibt Tomitribe ! | http://tomee.apache.org
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Fwd-tomee-git-commit-JDK-6-tp4676696p4676699.html
Sent from the TomEE Dev mailing list archive at Nabble.com.

Re: Fwd: tomee git commit: JDK 6

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2015-11-02 15:59 GMT-08:00 agumbrecht <ag...@tomitribe.com>:

> Because 'lookup' is endorsed api and not on the buildbot. java:app/jdbc/
> was
> not working and needed a quick fix.
>
>
isnt it a "old" test? Why was it working before? If new just ignore my
comment then.


> The buildbot compiles with jdk 6 for 1.7.x. So it needs code that compiles.
>
>
We are free to update the build to match our need.


> If LocalFileHandler cannot use deps then it needs a re-write for jdk6
>


> Most users are not using jdk 7/8, and even if they would be we must still
> compile under 6. Not my decision to make, and certainly not one to force on
> existing users of TomEE 1.7.x
>
>
well from what I saw fewer people are on j6 than what I would have thought.
Then we are not forced to stay on java 6 - even for TCKs, most of certified
EE 6 servers are on j7 now. Finally we wouldnt force anyone if we only
compile with j7 this part - once again tomcat 7 does it since more than one
year.


> Andy.
>
>
>
> -----
>     --
>     Andy Gumbrecht
>
>     http://www.tomitribe.com
>     agumbrecht@tomitribe.com
>     https://twitter.com/AndyGeeDe
>
>     TomEE treibt Tomitribe ! | http://tomee.apache.org
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Fwd-tomee-git-commit-JDK-6-tp4676696p4676697.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Re: Fwd: tomee git commit: JDK 6

Posted by agumbrecht <ag...@tomitribe.com>.
Because 'lookup' is endorsed api and not on the buildbot. java:app/jdbc/ was
not working and needed a quick fix.

The buildbot compiles with jdk 6 for 1.7.x. So it needs code that compiles.

If LocalFileHandler cannot use deps then it needs a re-write for jdk6

Most users are not using jdk 7/8, and even if they would be we must still
compile under 6. Not my decision to make, and certainly not one to force on
existing users of TomEE 1.7.x

Andy.



-----
    -- 
    Andy Gumbrecht

    http://www.tomitribe.com
    agumbrecht@tomitribe.com
    https://twitter.com/AndyGeeDe

    TomEE treibt Tomitribe ! | http://tomee.apache.org
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Fwd-tomee-git-commit-JDK-6-tp4676696p4676697.html
Sent from the TomEE Dev mailing list archive at Nabble.com.