Skip to content

Commit

Permalink
Split mail in API and Impl (#541)
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
Co-authored-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
jbescos and lukasj committed Aug 18, 2021
1 parent 3005fd7 commit 40da1d9
Show file tree
Hide file tree
Showing 426 changed files with 3,520 additions and 2,848 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Expand Up @@ -4,8 +4,7 @@ nbproject/private/
.m2/
webrev
mbox/.ccls-cache/
.settings
/bin/
.classpath
.project


.settings/
3 changes: 3 additions & 0 deletions demo/src/main/java/sendhtml.java
Expand Up @@ -10,6 +10,9 @@

import java.io.*;
import java.util.Properties;

import jakarta.mail.util.ByteArrayDataSource;

import java.util.Date;

import jakarta.mail.*;
Expand Down
10 changes: 5 additions & 5 deletions dsn/pom.xml
Expand Up @@ -67,11 +67,11 @@
<groupId>com.sun.mail</groupId>
<artifactId>jakarta.mail</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<reporting>
Expand Down
25 changes: 15 additions & 10 deletions dsn/src/main/java/com/sun/mail/dsn/DeliveryStatus.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -16,17 +16,22 @@

package com.sun.mail.dsn;

import java.io.*;
import java.util.*;
import jakarta.mail.MessagingException;
import jakarta.mail.Session;
import jakarta.mail.internet.InternetHeaders;
import jakarta.mail.util.LineOutputStream;
import jakarta.mail.util.StreamProvider;

import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.Vector;
import java.util.logging.Level;

import jakarta.activation.*;
import jakarta.mail.*;
import jakarta.mail.internet.*;

import com.sun.mail.util.LineOutputStream; // XXX
import com.sun.mail.util.PropUtil;
import com.sun.mail.util.MailLogger;
import com.sun.mail.util.PropUtil;

/**
* A message/delivery-status message content, as defined in
Expand Down Expand Up @@ -162,7 +167,7 @@ public void writeTo(OutputStream os) throws IOException {
if (os instanceof LineOutputStream) {
los = (LineOutputStream) os;
} else {
los = new LineOutputStream(os);
los = Session.STREAM_PROVIDER.outputLineStream(os, false);
}

writeInternetHeaders(messageDSN, los);
Expand Down
13 changes: 7 additions & 6 deletions dsn/src/main/java/com/sun/mail/dsn/DispositionNotification.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -19,12 +19,13 @@
import java.io.*;
import java.util.*;

import com.sun.mail.util.MailLogger;
import com.sun.mail.util.PropUtil;

import jakarta.mail.*;
import jakarta.mail.internet.*;

import com.sun.mail.util.LineOutputStream; // XXX
import com.sun.mail.util.PropUtil;
import com.sun.mail.util.MailLogger;
import jakarta.mail.util.LineOutputStream;
import jakarta.mail.util.StreamProvider;

/**
* A message/disposition-notification message content, as defined in
Expand Down Expand Up @@ -112,7 +113,7 @@ public void writeTo(OutputStream os) throws IOException {
if (os instanceof LineOutputStream) {
los = (LineOutputStream) os;
} else {
los = new LineOutputStream(os);
los = Session.STREAM_PROVIDER.outputLineStream(os, false);
}

writeInternetHeaders(notifications, los);
Expand Down
1 change: 1 addition & 0 deletions dsn/src/main/java/module-info.java
Expand Up @@ -18,4 +18,5 @@
exports com.sun.mail.dsn;

requires transitive jakarta.mail;
requires com.sun.mail;
}
11 changes: 1 addition & 10 deletions gimap/pom.xml
Expand Up @@ -62,18 +62,9 @@
</build>

<dependencies>
<!--
Even though gimap.jar works with either the full jakarta.mail.jar
or th mailapi.jar, we want to get the API definitions from
mailapi.jar.
-->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>mailapi</artifactId>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>imap</artifactId>
<artifactId>jakarta.mail</artifactId>
</dependency>
</dependencies>

Expand Down
6 changes: 3 additions & 3 deletions gimap/src/main/java/com/sun/mail/gimap/GmailProvider.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -16,10 +16,10 @@

package com.sun.mail.gimap;

import jakarta.mail.Provider;

import com.sun.mail.util.DefaultProvider;

import jakarta.mail.Provider;

/**
* The Gmail IMAP protocol provider.
*/
Expand Down
6 changes: 3 additions & 3 deletions gimap/src/main/java/com/sun/mail/gimap/GmailSSLProvider.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -16,10 +16,10 @@

package com.sun.mail.gimap;

import jakarta.mail.Provider;

import com.sun.mail.util.DefaultProvider;

import jakarta.mail.Provider;

/**
* The Gmail IMAP protocol provider.
*/
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -22,9 +22,8 @@

import com.sun.mail.iap.*;
import com.sun.mail.imap.protocol.*;
import com.sun.mail.gimap.GmailFolder.FetchProfileItem;

import com.sun.mail.util.MailLogger;
import com.sun.mail.gimap.GmailFolder.FetchProfileItem;

/**
* Extend IMAP support to handle Gmail-specific protocol extensions.
Expand Down
11 changes: 1 addition & 10 deletions gimap/src/main/java/module-info.java
Expand Up @@ -21,14 +21,5 @@
com.sun.mail.gimap.GmailProvider, com.sun.mail.gimap.GmailSSLProvider;

requires jakarta.mail;
/*
following is intentionally optional/static for gimap module to work
with com.sun.mail:jakarta.mail (all-in-one bundle jar)
as well as with com.sun.mail:mailapi + com.sun.mail:imap
the latter deps come through maven dependency tree, therefore
they must be explicitely excluded if the former is being used
to avoid having two jars having same 'jakarta.mail' module name
in the environement
*/
requires static com.sun.mail.imap;
requires com.sun.mail;
}
1 change: 0 additions & 1 deletion imap/pom.xml
Expand Up @@ -34,7 +34,6 @@
<name>Jakarta Mail API imap provider</name>

<properties>
<mail.extraClasses>com/sun/mail/iap/**</mail.extraClasses>
<mail.packages.export>
com.sun.mail.imap; version=${mail.osgiversion},
com.sun.mail.imap.protocol; version=${mail.osgiversion},
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -17,12 +17,13 @@
package com.sun.mail.iap;

import java.util.List;

import com.sun.mail.util.ASCIIUtility;

import java.util.ArrayList;
import java.io.*;
import java.nio.charset.Charset;

import com.sun.mail.util.ASCIIUtility;

/**
* @author John Mani
* @author Bill Shannon
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
Expand Up @@ -32,8 +32,8 @@
import java.util.zip.InflaterInputStream;
import java.lang.reflect.Field;

import com.sun.mail.util.PropUtil;
import com.sun.mail.util.MailLogger;
import com.sun.mail.util.PropUtil;
import com.sun.mail.util.SocketFetcher;
import com.sun.mail.util.TraceInputStream;
import com.sun.mail.util.TraceOutputStream;
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -18,10 +18,11 @@

import java.io.*;
import java.util.*;
import java.nio.charset.StandardCharsets;

import com.sun.mail.util.ASCIIUtility;

import java.nio.charset.StandardCharsets;

/**
* This class represents a response obtained from the input stream
* of an IMAP server.
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
Expand Up @@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down

0 comments on commit 40da1d9

Please sign in to comment.