Opened 6 years ago

Closed 5 years ago

#2139 closed task (fixed)

Switch to Java 11 (or later)

Reported by: Nicklas Nordborg Owned by:
Priority: major Milestone: BASE 3.16
Component: build Version:
Keywords: Cc:

Description (last modified by Nicklas Nordborg)

Drop support for Java 8. The code should be compiler with Java 11 (or later) compiler. This would be at least one release after #2138. See also #2129.

@SuppressWarnings were added in [7622]/#2138. They can probably be solved when we can write code for Java 11 and don't have to also support Java 8.

We should remove the JAI JAR files as part of this. It seems like Java 11 has at least basic support for reading TIFF images via the ImageIO API (see [7639]).

Change History (15)

comment:1 by Nicklas Nordborg, 6 years ago

Description: modified (diff)

comment:2 by Nicklas Nordborg, 6 years ago

Milestone: BASE Future ReleaseBASE 3.16

comment:3 by Nicklas Nordborg, 6 years ago

Description: modified (diff)

comment:4 by Nicklas Nordborg, 6 years ago

Description: modified (diff)

comment:5 by Nicklas Nordborg, 6 years ago

In 7711:

References #2139: Switch to Java 11 (or later)

Changed build script to specify Java 11. Biggest change is that the 'source' and 'target' parameters have merged to 'release' parameter and that 'bootclasspath' is no longer supported when compiling against java versions > 8.

comment:6 by Nicklas Nordborg, 6 years ago

In 7712:

References #2139: Switch to Java 11 (or later)

Removed JAI. Also fixed incorrect information about which servlet API version we use.

comment:7 by Nicklas Nordborg, 6 years ago

In 7713:

References #2139: Switch to Java 11 (or later)

Replaced the finalize() methods in StaticCache with a cleaner-based approach.

comment:8 by Nicklas Nordborg, 6 years ago

In 7715:

References #2139: Switch to Java 11 (or later)

Removed the DbControl.finalize() method and replaced it with a State class that also holds the database connections (via Hibernate).

In case the DbControl is not closed properly the State class log a warning message and close the database connections. It will no longer perform a full rollback of batchers and other actions (they may contain a reference to the DbControl which would prevent a cleanup).

The Cleaner instance that was in the StaticCache has been moved to Application. Cleanup actions can be registered with Application.registerCleanup().

comment:9 by Nicklas Nordborg, 6 years ago

In 7716:

References #2139: Switch to Java 11 (or later)

Removed the SessionControl.finalize() method without a replacement since it is impossible to reach the finalize() method while still being logged in. The reason is that the Application instance keeps a cache with all existing SessionControl instances and they are either automatically closed and removed by a timer or a shutdown hook.

comment:10 by Nicklas Nordborg, 6 years ago

In 7717:

References #2139: Switch to Java 11 (or later)

Removed a call to new Float().

comment:11 by Nicklas Nordborg, 6 years ago

In 7718:

References #2139: Switch to Java 11 (or later)

Fixed the call to ClassLoader.getPackage() in JarClassLoader. It now uses the ClassLoader.getDefinedPackage() instead and iterates up the parent chain of class loaders.

comment:12 by Nicklas Nordborg, 6 years ago

In 7719:

References #2139: Switch to Java 11 (or later)

Updated the documentation.

comment:13 by Nicklas Nordborg, 6 years ago

In 7727:

References #2139: Switch to Java 11 (or later)

Added a missing JAR file with classes needed for sending e-mail. Got stacktrace:

net.sf.basedb.core.BaseException: Could not send email for message:Message[id=8483; name=Test message]
	at net.sf.basedb.core.Message.sendAsEmail(Message.java:466)
	at net.sf.basedb.core.Message.onAfterCommit(Message.java:298)
	at net.sf.basedb.core.DbControl.commit(DbControl.java:546)
	at TestMessage.test_create(TestMessage.java:82)
	at TestMessage.test_all(TestMessage.java:47)
	at TestAll.main(TestAll.java:127)
Caused by: org.apache.commons.mail.EmailException: Sending the email to the following server failed : localhost:2525
	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1469)
	at org.apache.commons.mail.Email.send(Email.java:1496)
	at net.sf.basedb.core.Message.sendAsEmail(Message.java:461)
	... 5 more
Caused by: java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
	at javax.activation.MailcapCommandMap.<init>(MailcapCommandMap.java:179)
	at javax.activation.CommandMap.getDefaultCommandMap(CommandMap.java:85)
	at javax.activation.DataHandler.getCommandMap(DataHandler.java:167)
	at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:629)
	at javax.activation.DataHandler.writeTo(DataHandler.java:329)
	at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:340)
	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1575)
	at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2271)
	at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2231)
	at javax.mail.Transport.send(Transport.java:123)
	at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1459)
	... 7 more
Caused by: java.lang.ClassNotFoundException: com.sun.activation.registries.LogSupport
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 18 more

comment:14 by Nicklas Nordborg, 5 years ago

In 7732:

References #2139: Switch to Java 11 (or later)

Changed some references to external Javadoc and fixed an error related to Thread.stop() that no longer exists.

comment:15 by Nicklas Nordborg, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.