Skip to content

Commit

Permalink
Update for Java 21
Browse files Browse the repository at this point in the history
Migrate all code and dependencies to Java21 from Java 17. Remove unnecessary .jar's and amend deprecated API calls.
  • Loading branch information
C4J committed Feb 23, 2025
1 parent 8432503 commit 929a04d
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 115 deletions.
2 changes: 1 addition & 1 deletion b6sftpSend/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java 17 JDK">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java 21 JDK">
<attributes>
<attribute name="module" value="true"/>
</attributes>
Expand Down
2 changes: 1 addition & 1 deletion b6sftpSend/.project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>b6sftpSend</name>
<name>b7sftpSend</name>
<comment></comment>
<projects>
</projects>
Expand Down
2 changes: 1 addition & 1 deletion b6sftpSend/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.compliance=21
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Java 17 JDK"/>
<installed facet="java" version="17"/>
<runtime name="Java 21 JDK"/>
<installed facet="java" version="21"/>
</faceted-project>
File renamed without changes.
15 changes: 8 additions & 7 deletions b6sftpSend/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
To include a user specific buildfile here, simply create one in the same
directory with the processing instruction <?eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="b6sftpSend">
<project basedir="." default="build" name="b7sftpSend">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="17"/>
<property name="source" value="17"/>
<path id="b6sftpSend.classpath">
<property name="target" value="21"/>
<property name="source" value="21"/>
<path id="b7sftpSend.classpath">
<pathelement location="bin"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<copy includeemptydirs="false" todir="bin" overwrite="true" preservelastmodified="true">
<fileset dir="src" excludes="**/doc-files/**">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
Expand All @@ -34,7 +34,8 @@
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="b6sftpSend.classpath"/>
<classpath refid="b7sftpSend.classpath"/>
<compilerarg value="-proc:full"/>
</javac>
</target>
<target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
Expand Down
Binary file modified b6sftpSend/sftpSend.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion b6sftpSend/src/com/commander4j/sftp/Transfer.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class Transfer extends Thread
public static JUtility utils = new JUtility();
public static EmailQueue emailqueue = new EmailQueue();
public static EmailThread emailthread;
public static String version = "4.60";
public static String version = "4.70";
public static Long pollFrequencySeconds = (long) 0;

public static void main(String[] args)
Expand Down
165 changes: 93 additions & 72 deletions b6sftpSend/xml/config/email.xml
Original file line number Diff line number Diff line change
@@ -1,74 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<emailSettings>
<!-- Example Version-->
<!-- The section called "configuration" is always the active one - rename as appropriate-->
<!-- SMTP No Authentication Example -->
<configuration2>
<property name="mail.smtp.starttls.enable" encrypted="no" value="false"/>
<property name="mail.smtp.host" encrypted="no" value="smtp.demo.com"/>
<property name="mail.smtp.socketFactory.port" encrypted="no" value="25"/>
<property name="mail.smtp.user" encrypted="no" value="demo@email.com"/>
<property name="mail.smtp.password" encrypted="no" value=""/>
<property name="mail.smtp.socketFactory.class" encrypted="no" value="javax.net.ssl.SSLSocketFactory"/>
<property name="mail.smtp.auth" encrypted="no" value="false"/>
<property name="mail.smtp.port" encrypted="no" value="25"/>
<property name="mail.smtp.from" encrypted="no" value="demo@email.com"/>
<property name="mail.debug" encrypted="no" value="true"/>
</configuration2>
<!-- Microsoft smtp.live.com Example -->
<configuration>
<property name="mail.smtp.auth" encrypted="no" value="true"/>
<property name="mail.smtp.starttls.enable" encrypted="no" value="true"/>
<property name="mail.smtp.host" encrypted="no" value="smtp.live.com"/>
<property name="mail.smtp.socketFactory.port" encrypted="no" value="25"/>
<property name="mail.smtp.user" encrypted="no" value="email@outlook.com"/>
<property name="mail.smtp.password" encrypted="no" value="password"/>
<property name="mail.smtp.socketFactory.class" encrypted="no" value="javax.net.ssl.SSLSocketFactory"/>
<property name="mail.smtp.auth" encrypted="no" value="true"/>
<property name="mail.smtp.port" encrypted="no" value="25"/>
<property name="mail.smtp.from" encrypted="no" value="email@outlook.com"/>
<property name="mail.debug" encrypted="no" value="true"/>
</configuration>
<!-- Google gmail Example -->
<configuration1>
<property name="mail.smtp.auth" encrypted="no" value="true"/>
<property name="mail.smtp.starttls.enable" encrypted="no" value="true"/>
<property name="mail.smtp.host" encrypted="no" value="smtp.gmail.com"/>
<property name="mail.smtp.socketFactory.port" encrypted="no" value="465"/>
<property name="mail.smtp.user" encrypted="no" value="email@gmail.com"/>
<property name="mail.smtp.password" encrypted="no" value="password"/>
<property name="mail.smtp.socketFactory.class" encrypted="no" value="javax.net.ssl.SSLSocketFactory"/>
<property name="mail.smtp.auth" encrypted="no" value="true"/>
<property name="mail.smtp.port" encrypted="no" value="465"/>
<property name="mail.smtp.from" encrypted="no" value="email@gmail.com"/>
<property name="mail.debug" encrypted="no" value="true"/>
</configuration1>
<!-- Distribution Lists are referred to within message mapping Config.xml -->
<distributionList id="StartStop" enabled="N" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>
<distributionList id="LabelSync" enabled="N" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>
<distributionList id="Logs" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>
<distributionList id="Config" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>
<distributionList id="Monitor" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>
<distributionList id="Info" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>
<distributionList id="Error" enabled="Y" maxFrequencyMins="5">
<toAddressList>example@email.com</toAddressList>
</distributionList>
<distributionList id="SSCC" enabled="Y" maxFrequencyMins="5">
<toAddressList>example@email.com</toAddressList>
</distributionList>
<distributionList id="OrderAssigned" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>
<emailSettings>

<!-- Example Version-->

<!-- The section called "configuration" is always the active one - rename as appropriate-->

<!-- SMTP No Authentication Example -->

<configuration2>
<property name="mail.smtp.starttls.enable" value="false"/>
<property name="mail.smtp.host" value="smtp.demo.com"/>
<property name="mail.smtp.socketFactory.port" value="25"/>
<property name="mail.smtp.user" value="demo@email.com"/>
<property name="mail.smtp.password" value=""/>
<property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
<property name="mail.smtp.auth" value="false"/>
<property name="mail.smtp.port" value="25"/>
<property name="mail.smtp.from" value="demo@email.com"/>
<property name="mail.debug" value="true"/>
</configuration2>

<!-- Microsoft smtp.live.com Example -->

<configuration>
<property name="mail.smtp.auth" value="true"/>
<property name="mail.smtp.starttls.enable" value="true"/>
<property name="mail.smtp.host" value="smtp.live.com"/>
<property name="mail.smtp.socketFactory.port" value="25"/>
<property name="mail.smtp.user" value="email@outlook.com"/>
<property name="mail.smtp.password" value="password"/>
<property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
<property name="mail.smtp.auth" value="true"/>
<property name="mail.smtp.port" value="25"/>
<property name="mail.smtp.from" value="email@outlook.com"/>
<property name="mail.debug" value="true"/>
</configuration>

<!-- Google gmail Example -->

<configuration1>
<property name="mail.smtp.auth" value="true"/>
<property name="mail.smtp.starttls.enable" value="true"/>
<property name="mail.smtp.host" value="smtp.gmail.com"/>
<property name="mail.smtp.socketFactory.port" value="465"/>
<property name="mail.smtp.user" value="email@gmail.com"/>
<property name="mail.smtp.password" value="password"/>
<property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
<property name="mail.smtp.auth" value="true"/>
<property name="mail.smtp.port" value="465"/>
<property name="mail.smtp.from" value="email@gmail.com"/>
<property name="mail.debug" value="true"/>
</configuration1>


<!-- Distribution Lists are referred to within message mapping Config.xml -->

<distributionList id="StartStop" enabled="N" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>

<distributionList id="LabelSync" enabled="N" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>

<distributionList id="Logs" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>

<distributionList id="Config" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>

<distributionList id="Monitor" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>

<distributionList id="Info" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>

<distributionList id="Error" enabled="Y" maxFrequencyMins="5">
<toAddressList>example@email.com</toAddressList>
</distributionList>

<distributionList id="SSCC" enabled="Y" maxFrequencyMins="5">
<toAddressList>example@email.com</toAddressList>
</distributionList>

<distributionList id="OrderAssigned" enabled="Y" maxFrequencyMins="0">
<toAddressList>example@email.com</toAddressList>
</distributionList>


</emailSettings>
72 changes: 42 additions & 30 deletions b6sftpSend/xml/config/sftpSend.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
<!-- Example Version-->
<!-- Standard username and password logon example -->
<sftpSend2>

<!-- Example Version-->

<!-- Standard username and password logon example -->

<sftpSend2>

<general>
<value id="title" encrypted="no">SFTP Example</value>
<value id="emailEnabled" encrypted="no">false</value>
<value id="title" encrypted="no">SFTP Example</value>
<value id="emailEnabled" encrypted="no">false</value>
</general>
<security>
<value id="remoteHost" encrypted="no">1.2.3.4</value>
<value id="remotePort" encrypted="no">22</value>
<value id="checkKnownHosts" encrypted="no">no</value>
<value id="knownHostsFile" encrypted="no">./ssh/known_hosts</value>
<value id="authType" encrypted="no">user password</value>
<value id="username" encrypted="no">testuser</value>
<value id="password" encrypted="no">testpassword</value>
<value id="privateKeyFile" encrypted="no">./ssh/sftpSend</value>
<value id="privateKeyPasswordProtected" encrypted="no">no</value>
<value id="privateKeyPassword" encrypted="no"/>
</security>
<source>
<value id="localDir" encrypted="no">./send/</value>
<value id="localFileMask" encrypted="no">*.xml</value>
<value id="backupDir" encrypted="no"/>
<value id="pollFrequencySeconds" encrypted="no">5000</value>
</source>
<destination>
<value id="remoteDir" encrypted="no">/remote/</value>
<value id="tempFileExtension" encrypted="no">.tmp</value>
</destination>
</sftpSend2>
<!-- public key and username example - comment out above and uncomment below to use -->
<!-- <sftpSend2>

<security>
<value id="remoteHost" encrypted="no">1.2.3.4</value>
<value id="remotePort" encrypted="no">22</value>
<value id="checkKnownHosts" encrypted="no">no</value>
<value id="knownHostsFile" encrypted="no">./ssh/known_hosts</value>
<value id="authType" encrypted="no">user password</value>
<value id="username" encrypted="no">testuser</value>
<value id="password" encrypted="no">testpassword</value>
<value id="privateKeyFile" encrypted="no">./ssh/sftpSend</value>
<value id="privateKeyPasswordProtected" encrypted="no">no</value>
<value id="privateKeyPassword" encrypted="no"/>
</security>

<source>
<value id="localDir" encrypted="no">./send/</value>
<value id="localFileMask" encrypted="no">*.xml</value>
<value id="backupDir" encrypted="no"></value>
<value id="pollFrequencySeconds" encrypted="no">5000</value>
</source>

<destination>
<value id="remoteDir" encrypted="no">/remote/</value>
<value id="tempFileExtension" encrypted="no">.tmp</value>
</destination>

</sftpSend2>

<!-- public key and username example - comment out above and uncomment below to use -->

<!-- <sftpSend2>
<security>
<value id="remoteHost" encrypted="no">1.2.3.4</value>
Expand All @@ -57,4 +67,6 @@
</destination>
</sftpSend2> -->


</config>

0 comments on commit 929a04d

Please sign in to comment.