Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ jobs:
$ENV:cert_file=gci -Path $ENV:JAVA_HOME -Filter cacerts -File -Recurse -ErrorAction SilentlyContinue | %{$_.FullName}
copy cacerts "$ENV:cert_file"
- name: Build with Maven
run: ./mvnw test --file pom.xml --log-file maven.log
run: |
./mvnw clean -e --debug --file pom.xml --log-file maven.log
./mvnw test -e --debug --file pom.xml --log-file maven.log
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the formatting in my PR ocmment got screwed up. You need to indent the 2 lines to execute maven to inline with the | on the "run" line.
See here for example:
https://github.com/OpenAS2/OpenAs2App/pull/286/files#diff-2702f6f7d10a1bffbc8596d1a9925b1234bc4c7a6ff4c21ca6b34c13aa75780e

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@riperat NOTE: Because the actions.yml file is invalid it has not run the unit tests so although it looks like it has passed, it has needs a fix per above.

- name: Archive logs
uses: actions/upload-artifact@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: openas2-server-osgi.jar,
Server/lib/commons-lang3-3.4.jar,
Server/lib/commons-logging-1.2.jar,
Server/lib/javax.mail.jar,
Server/lib/jakarta.mail.jar,
Server/lib/bcmail-jdk15on-154.jar,
Server/lib/bcpg-jdk15on-154.jar,
Server/lib/bcpkix-jdk15on-154.jar,
Expand Down
14 changes: 7 additions & 7 deletions Server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
</copy>
<echo message="OS Name: ${os.name}"/>
<exec executable="sh" osfamily="unix">
<arg value="-c"/>
<arg value="-c"/>
<arg line="'chmod uga+x ${package.assembly.dir}/bin/*.sh'"/>
</exec>
<!--Copy config directory to assembly directory -->
Expand Down Expand Up @@ -158,7 +158,7 @@
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcmail-jdk15on</artifactId>
<artifactId>bcjmail-jdk18on</artifactId>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
Expand All @@ -181,8 +181,8 @@
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<groupId>jakarta.mail</groupId>
<artifactId>jakarta.mail-api</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
Expand Down Expand Up @@ -258,8 +258,8 @@
</dependency>
<!-- Removed JavaEE APIs removed from Java 9+ -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
Expand All @@ -271,7 +271,7 @@
</dependency>
<!--
<dependency>
<groupId>javax.activation</groupId>
<groupId>jakarta.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
-->
Expand Down
8 changes: 4 additions & 4 deletions Server/src/config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
enabled="$properties.email.logger.enabled$"
only_active_msg_transfer_errors="false"
log_exception_trace="false"
javax.mail.properties.file="%home%/java.mail.properties"
jakarta.mail.properties.file="%home%/java.mail.properties"
from="openas2"
to="your email address"
smtpserver="your smtp server"
Expand Down Expand Up @@ -66,13 +66,13 @@
userid="userID"
password="pWd"
response_format="xml"/>
<commandProcessor classname="org.openas2.cmd.processor.RestCommandProcessor"
<commandProcessor classname="org.openas2.cmd.processor.RestCommandProcessor"
enabled="$properties.restapi.command.processor.enabled$"
baseuri="http://localhost:8443"
ssl_protocol="TLS"
ssl_keystore="%home%/ssl_certs.jks"
ssl_keystore_password="testas2"
userid="userID"
userid="userID"
password="pWd" />
</commandProcessors>
<processor classname="org.openas2.processor.DefaultProcessor"
Expand All @@ -86,7 +86,7 @@
<!-- This directory polling module will parse the filename to get a sender, receiver and name of file to send to partner.
For instance, a file named MyComapny_OID-PartnerB_OID-OrderID-745634.edi would be sent from MyCompany to PartnerB.
The name of the file sent to the partner will be "OrderID-745634.edi" -->
<!--
<!--
<module classname="org.openas2.processor.receiver.AS2DirectoryPollingModule"
outboxdir="$properties.storageBaseDir$/toAny"
errordir="$properties.storageBaseDir$/toAny/error/$msg.sender.as2_id$-$msg.receiver.as2_id$"
Expand Down
6 changes: 3 additions & 3 deletions Server/src/main/java/org/openas2/BaseSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import org.openas2.util.XMLUtil;
import org.w3c.dom.Node;

import javax.activation.CommandMap;
import javax.activation.MailcapCommandMap;
import jakarta.activation.CommandMap;
import jakarta.activation.MailcapCommandMap;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -169,7 +169,7 @@ public void destroyPartnershipPollers() {
// something went wrong stopping it - report and keep going but make sure the key is still removed
LOGGER.error("Failed to stop a partnership poller for directory " + entry.getKey() + ": " + meta, e);
stoppedPollerKeys.add(entry.getKey());
}
}
}
for (String pollerKey : stoppedPollerKeys) {
// Remove the poller entry in the map now that we have killed the active poller
Expand Down
12 changes: 6 additions & 6 deletions Server/src/main/java/org/openas2/lib/helper/BCCryptoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
import org.openas2.util.DispositionType;
import org.openas2.util.Properties;

import javax.activation.CommandMap;
import javax.activation.MailcapCommandMap;
import javax.mail.MessagingException;
import javax.mail.internet.ContentType;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
import jakarta.activation.CommandMap;
import jakarta.activation.MailcapCommandMap;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.ContentType;
import jakarta.mail.internet.MimeBodyPart;
import jakarta.mail.internet.MimeMultipart;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.openas2.message.AS2Message;
import org.openas2.message.Message;

import javax.mail.internet.MimeBodyPart;
import jakarta.mail.internet.MimeBodyPart;
import java.io.InputStream;
import java.security.Key;
import java.security.KeyStore;
Expand Down
10 changes: 5 additions & 5 deletions Server/src/main/java/org/openas2/lib/util/MimeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import org.openas2.Session;
import org.openas2.lib.util.javamail.ByteArrayDataSource;

import javax.activation.DataHandler;
import javax.mail.MessagingException;
import javax.mail.internet.InternetHeaders;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
import jakarta.activation.DataHandler;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.InternetHeaders;
import jakarta.mail.internet.MimeBodyPart;
import jakarta.mail.internet.MimeMultipart;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.openas2.lib.util.javamail;

import javax.activation.DataSource;
import jakarta.activation.DataSource;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import org.openas2.lib.message.AS2Standards;

import javax.activation.ActivationDataFlavor;
import javax.activation.DataContentHandler;
import javax.activation.DataSource;
import javax.mail.MessagingException;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMultipart;
import jakarta.activation.ActivationDataFlavor;
import jakarta.activation.DataContentHandler;
import jakarta.activation.DataSource;
import jakarta.mail.MessagingException;
import jakarta.mail.internet.MimeBodyPart;
import jakarta.mail.internet.MimeMultipart;
import java.awt.datatransfer.DataFlavor;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
Expand All @@ -18,11 +18,11 @@

public class DispositionDataContentHandler implements DataContentHandler {
private static final ActivationDataFlavor ADF1;
private static final DataFlavor[] ADFs;
private static final ActivationDataFlavor[] ADFs;

static {
ADF1 = new ActivationDataFlavor(MimeBodyPart.class, AS2Standards.DISPOSITION_TYPE, "Disposition Notification");
ADFs = new DataFlavor[]{ADF1};
ADFs = new ActivationDataFlavor[]{ADF1};
}

public DispositionDataContentHandler() {
Expand Down Expand Up @@ -54,10 +54,15 @@ public Object getTransferData(DataFlavor df, DataSource ds) throws IOException {
return null;
}

public DataFlavor[] getTransferDataFlavors() {
public ActivationDataFlavor[] getTransferDataFlavors() {
return ADFs;
}

@Override
public Object getTransferData(ActivationDataFlavor activationDataFlavor, DataSource dataSource) throws IOException {
return null;
}

public void writeTo(Object obj, String mimeType, OutputStream os) throws IOException {
if (obj instanceof MimeBodyPart) {
try {
Expand Down
26 changes: 13 additions & 13 deletions Server/src/main/java/org/openas2/logging/EmailLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
import org.openas2.params.MessageParameters;
import org.openas2.params.ParameterParser;

import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import jakarta.mail.MessagingException;
import jakarta.mail.PasswordAuthentication;
import jakarta.mail.Transport;
import jakarta.mail.internet.InternetAddress;
import jakarta.mail.internet.MimeMessage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -50,9 +50,9 @@ public void init(Session session, Map<String, String> parameters) throws OpenAS2
getParameter(PARAM_SMTPSERVER, true);

onlyActiveMsgTransferErrors = "true".equalsIgnoreCase(getParameter(PARAM_ONLY_ACTIVE_MSG_TRANSFER_ERRORS, "false"));
// copy system properties then allow override by javax.mail.properties.file
// copy system properties then allow override by jakarta.mail.properties.file
props.putAll(System.getProperties());
String filename = getParameter("javax.mail.properties.file", false);
String filename = getParameter("jakarta.mail.properties.file", false);
if (filename != null) {
ParameterParser parser = createParser();
filename = ParameterParser.parse(filename, parser);
Expand All @@ -61,10 +61,10 @@ public void init(Session session, Map<String, String> parameters) throws OpenAS2
in = new FileInputStream(filename);
props.load(in);
} catch (FileNotFoundException e) {
System.out.println("File not found for attribute javax.mail.properties.file: " + filename);
System.out.println("File not found for attribute jakarta.mail.properties.file: " + filename);
e.printStackTrace();
} catch (IOException e) {
System.out.println("File for attribute javax.mail.properties.file cannot be accessed: " + filename);
System.out.println("File for attribute jakarta.mail.properties.file cannot be accessed: " + filename);
e.printStackTrace();
} finally {
if (in != null) {
Expand Down Expand Up @@ -249,7 +249,7 @@ protected void sendMessage(String subject, String text) throws OpenAS2Exception
String userName = null;
String password = null;
boolean isAuth = false;
javax.mail.Session jmSession = null;
jakarta.mail.Session jmSession = null;
try {
isAuth = "true".equalsIgnoreCase(getParameter("smtpauth", "false"));
} catch (InvalidParameterException e) {
Expand All @@ -276,13 +276,13 @@ protected void sendMessage(String subject, String text) throws OpenAS2Exception
final String pwd = password;
if (isAuth) {
props.put("mail." + protocol + ".user", uid);
jmSession = javax.mail.Session.getDefaultInstance(props, new javax.mail.Authenticator() {
jmSession = jakarta.mail.Session.getDefaultInstance(props, new jakarta.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(uid, pwd);
}
});
} else {
jmSession = javax.mail.Session.getDefaultInstance(props);
jmSession = jakarta.mail.Session.getDefaultInstance(props);
}

if (isDebugOn) {
Expand All @@ -304,7 +304,7 @@ protected PasswordAuthentication getPasswordAuthentication() {
m.setFrom(new InternetAddress(from));
}
m.setSender(new InternetAddress(getParameter(PARAM_FROM, true)));
m.setRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(getParameter(PARAM_TO, true)));
m.setRecipient(jakarta.mail.Message.RecipientType.TO, new InternetAddress(getParameter(PARAM_TO, true)));

m.setSentDate(new Date());
m.setSubject(subject);
Expand Down
24 changes: 12 additions & 12 deletions Server/src/main/java/org/openas2/mail/EmailSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import org.openas2.params.MessageParameters;
import org.openas2.params.ParameterParser;

import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import jakarta.mail.MessagingException;
import jakarta.mail.PasswordAuthentication;
import jakarta.mail.Transport;
import jakarta.mail.internet.InternetAddress;
import jakarta.mail.internet.MimeMessage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand All @@ -43,7 +43,7 @@ public class EmailSender extends BaseComponent {


public void init(Session session, Map<String, String> parameters) throws OpenAS2Exception {
// copy system properties then allow override by javax.mail.properties.file
// copy system properties then allow override by jakarta.mail.properties.file
props.putAll(System.getProperties());
String filename = "Emailer.Parameters.getJavaxMailPropFile";
if (filename != null) {
Expand All @@ -54,10 +54,10 @@ public void init(Session session, Map<String, String> parameters) throws OpenAS2
in = new FileInputStream(filename);
props.load(in);
} catch (FileNotFoundException e) {
System.out.println("File not found for attribute javax.mail.properties.file: " + filename);
System.out.println("File not found for attribute jakarta.mail.properties.file: " + filename);
e.printStackTrace();
} catch (IOException e) {
System.out.println("File for attribute javax.mail.properties.file cannot be accessed: " + filename);
System.out.println("File for attribute jakarta.mail.properties.file cannot be accessed: " + filename);
e.printStackTrace();
} finally {
if (in != null) {
Expand Down Expand Up @@ -152,7 +152,7 @@ protected void sendMessage(String subject, String text) throws OpenAS2Exception
String userName = null;
String password = null;
boolean isAuth = false;
javax.mail.Session jmSession = null;
jakarta.mail.Session jmSession = null;
try {
isAuth = "true".equalsIgnoreCase(getParameter("smtpauth", "false"));
} catch (InvalidParameterException e) {
Expand All @@ -179,13 +179,13 @@ protected void sendMessage(String subject, String text) throws OpenAS2Exception
final String pwd = password;
if (isAuth) {
props.put("mail." + protocol + ".user", uid);
jmSession = javax.mail.Session.getDefaultInstance(props, new javax.mail.Authenticator() {
jmSession = jakarta.mail.Session.getDefaultInstance(props, new jakarta.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(uid, pwd);
}
});
} else {
jmSession = javax.mail.Session.getDefaultInstance(props);
jmSession = jakarta.mail.Session.getDefaultInstance(props);
}

if (isDebugOn) {
Expand All @@ -207,7 +207,7 @@ protected PasswordAuthentication getPasswordAuthentication() {
m.setFrom(new InternetAddress(from));
}
m.setSender(new InternetAddress(getParameter(PARAM_FROM, true)));
m.setRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(getParameter(PARAM_TO, true)));
m.setRecipient(jakarta.mail.Message.RecipientType.TO, new InternetAddress(getParameter(PARAM_TO, true)));

m.setSentDate(new Date());
m.setSubject(subject);
Expand Down
Loading