Blog (page 7)

spring-security-saml2-service-provider example

This is a guide on how to create a simple service provider with Spring Security 5’s new Saml2 service provider library. If you are looking to create an identity provider, or for a more comprehensive resource on SAML and its integration, please see this guide instead. When creating your project, please reference the following project structure. …

Is SimpleDateFormat thread safe?

Java’s SimpleDateFormat is not thread safe. It can easily be made thread safe by enclosing it within a ThreadLocal construct. For example:

How to use JPackage Tool CLI for MacOS apps

As part of Java 14 and 15, a new utility was added to replace the legacy JavaFX app called javapackager. While it is currently part of the incubator, it will be part of the general release of JDK 16 and greater. It allows you to create standalone applications that are OS specific and do not …

Python - Read and write a file to S3 from Apache Spark on AWS EMR

The following is an example Python script which will attempt to read in a JSON formatted text file using the S3A protocol available within Amazon’s S3 API. It then parses the JSON and writes back out to an S3 bucket of your choice. Please note this code is configured to overwrite any existing file, change …

ORA-01000: Oracle maximum open cursors exceeded in Spring Boot

I have noticed this error on occasion if a large number of queries were executed in a short time. Even though connections were being managed with a jdbcTemplate, the cursors were not getting closed. This issue was not related to the application code structure, transaction management, nor anything else relating to the connection, yet the …

Java - How to pack or unpack an unsigned integer from a byte array

When dealing with sockets and streams, sometimes it is necessary to read packed or encoded bytes, shorts, floats, or integers which may be unsigned. The following examples will identify how to convert these unsigned values into a byte array or convert bytes into an unsigned value. The following examples will produce results in the endianness of …