On Wed, 2013-04-24 at 09:47 +0300, Ioan Eugen Stan wrote:
> Hi Oleg,
> 
> I re-factored the code and switched to Java 1.6 language (for-each,
> @Overrides, etc). I didn't expect to cause a mess. I didn't expect
> people to still require Java 1.5 since it's EOL for such a long time.
> There is no right answer to your question, I don't particularly like
> having different requirements. On the other hand, I favor moving
> forward, although I also recognize the need to maintain compatibility
> to older platforms. Ideally we can solve that problem if we ensure
> that some branches (like 0.7.x) require Java 1.5, while in new
> releases we can require a different Java version if needed. This has
> the disadvantage that it will put a harder burden on maintenance.
> 
> In our case we can require Java 1.5 for mime4j-core. For dom we can
> keep 1.6 or do some work to revert back.
> 
> Cheers,

It is not about expecting people to use older versions of JRE but rather
providing a reasonable level of compatibility. We can build against 1.5
and at the same time to recommend users to run 1.6 or newer. Upgrading
to 1.6 buys us almost nothing (the only nice to have functionality I can
think of is String constructors taking charset as java.nio.Charset
instead of String).

I am attaching a patch for your review that restores full 1.5
compatibility. The changes, as you can see, are very minor and affect
only three classes. I also had to downgrade Commons IO to version 2.2
but as it turned out we are not using any new functionality at all. So,
I do not see this as a loss.

If I hear no objections I'll commit the patch in a few days. So, please
complain loudly if you find anything disagreeable.

Oleg
diff --git a/core/pom.xml b/core/pom.xml
index cf8bcb8..bf5259a 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -48,15 +48,6 @@
     <build>
         <plugins>
             <plugin>
-                <!-- Mime4j is used in projects that still use java-1.5 so please be careful when changing this -->
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.0</version>
-                <configuration>
-                    <source>1.5</source>
-                    <target>1.5</target>
-                </configuration>
-            </plugin>
-            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jar-plugin</artifactId>
                 <executions>
diff --git a/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageImplFactory.java b/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageImplFactory.java
index dd1cf97..c5d09ef 100644
--- a/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageImplFactory.java
+++ b/dom/src/main/java/org/apache/james/mime4j/message/DefaultMessageImplFactory.java
@@ -24,7 +24,6 @@ package org.apache.james.mime4j.message;
  */
 public class DefaultMessageImplFactory implements MessageImplFactory {
 
-    @Override
     public MessageImpl messageImpl() {
         return new MessageImpl();
     }
diff --git a/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java b/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java
index 74bb2ef..a405ca3 100644
--- a/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java
+++ b/dom/src/main/java/org/apache/james/mime4j/message/EntityBuilder.java
@@ -73,7 +73,6 @@ class EntityBuilder implements ContentHandler {
         }
     }
 
-    @Override
     public void startMessage() throws MimeException {
         if (stack.isEmpty()) {
             stack.push(this.entity);
@@ -85,24 +84,20 @@ class EntityBuilder implements ContentHandler {
         }
     }
 
-    @Override
     public void endMessage() throws MimeException {
         expect(Message.class);
         stack.pop();
     }
 
-    @Override
     public void startHeader() throws MimeException {
         stack.push(new HeaderImpl());
     }
 
-    @Override
     public void field(Field field) throws MimeException {
         expect(Header.class);
         ((Header) stack.peek()).addField(field);
     }
 
-    @Override
     public void endHeader() throws MimeException {
         expect(Header.class);
         Header h = (Header) stack.pop();
@@ -110,7 +105,6 @@ class EntityBuilder implements ContentHandler {
         ((Entity) stack.peek()).setHeader(h);
     }
 
-    @Override
     public void startMultipart(final BodyDescriptor bd) throws MimeException {
         expect(Entity.class);
 
@@ -121,7 +115,6 @@ class EntityBuilder implements ContentHandler {
         stack.push(multiPart);
     }
 
-    @Override
     public void body(BodyDescriptor bd, final InputStream is) throws MimeException, IOException {
         expect(Entity.class);
 
@@ -154,12 +147,10 @@ class EntityBuilder implements ContentHandler {
         entity.setBody(body);
     }
 
-    @Override
     public void endMultipart() throws MimeException {
         stack.pop();
     }
 
-    @Override
     public void startBodyPart() throws MimeException {
         expect(Multipart.class);
 
@@ -168,20 +159,17 @@ class EntityBuilder implements ContentHandler {
         stack.push(bodyPart);
     }
 
-    @Override
     public void endBodyPart() throws MimeException {
         expect(BodyPart.class);
         stack.pop();
     }
 
-    @Override
     public void epilogue(InputStream is) throws MimeException, IOException {
         expect(MultipartImpl.class);
         ByteSequence bytes = loadStream(is);
         ((MultipartImpl) stack.peek()).setEpilogueRaw(bytes);
     }
 
-    @Override
     public void preamble(InputStream is) throws MimeException, IOException {
         expect(MultipartImpl.class);
         ByteSequence bytes = loadStream(is);
@@ -194,7 +182,6 @@ class EntityBuilder implements ContentHandler {
      * @param is the raw contents of the entity.
      * @throws UnsupportedOperationException
      */
-    @Override
     public void raw(InputStream is) throws MimeException, IOException {
         throw new UnsupportedOperationException("Not supported");
     }
diff --git a/mbox/src/main/java/org/apache/james/mime4j/mboxiterator/MboxIterator.java b/mbox/src/main/java/org/apache/james/mime4j/mboxiterator/MboxIterator.java
index 90abf9d..de97997 100644
--- a/mbox/src/main/java/org/apache/james/mime4j/mboxiterator/MboxIterator.java
+++ b/mbox/src/main/java/org/apache/james/mime4j/mboxiterator/MboxIterator.java
@@ -253,8 +253,6 @@ public class MboxIterator implements Iterable<CharBufferWrapper>, Closeable {
                 .append("\nlimit:\t").append(buffer.limit())
                 .append("\nremaining:\t").append(buffer.remaining())
                 .append("\nposition:\t").append(buffer.position())
-                .append("\nis direct:\t").append(buffer.isDirect())
-                .append("\nhas array:\t").append(buffer.hasArray())
                 .append("\nbuffer:\t").append(buffer.isReadOnly())
                 .append("\nclass:\t").append(buffer.getClass());
         return sb.toString();
diff --git a/pom.xml b/pom.xml
index cb1596d..a3b24f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,11 +64,11 @@
     </distributionManagement>
 
     <properties>
-        <target.jdk>1.6</target.jdk>
+        <target.jdk>1.5</target.jdk>
         <commons-logging.version>1.1.1</commons-logging.version>
         <log4j.version>1.2.14</log4j.version>
         <junit.version>4.10</junit.version>
-        <commons-io.version>2.4</commons-io.version>
+        <commons-io.version>2.2</commons-io.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>
 

Reply via email to