The below code shows the different ways one can declare and initialize an Array in Java: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 import java.util.Arrays; public class ArraysDemo { public static void main(String[] args) { int[] a1 = new int[]{1,2,3,4}; ...
Read More »Testing the File Upload API in Spring Boot
In one of my previous post, I had created an API to upload file. In this post I will write a JUnit test to test the API. We will test the complete flow right from uploading till it is copied to the file system and then we will also see how to mock the FileService class so that the uploaded ...
Read More »Open-source collaboration, or how we finally added merge-on-refresh to Apache Lucene
The open-source software movement is a clearly a powerful phenomenon. A diverse (in time, geography, interests, gender (hmm not really, not yet, hrmph), race, skills, use-cases, age, corporate employer, motivation, IDEs (or,Emacs (with all of its recursive parens)), operating system, …) group of passionate developers work together, using surprisingly primitive digital tooling and asynchronous communication channels, devoid of emotion and ...
Read More »Always Name Your Thread Pools
Our software tends to use a lot of thread pools – mostly through java.util.concurrent.ExecutorService implementations (Created via Executors.new.... We create these for various async use-cases, and they can be seen all over the place. All of these executors have a thread factory. It’s hidden in the default factory method, but you can supply a thread factory. If not supplied, a ...
Read More »Introduction into GraalVM (Community Edition): GraalVM for the rest of us
1. Introduction Along the previous parts of the tutorial we have talked a lot about GraalVM‘s groundbreaking impact on the JVM, its future and the ecosystem. The question we have left with is: if GraalVM is so awesome, and most of the time, is a drop-in replacement for traditional OpenJDK distribution, should it become the default choice for everyone? Yes, ...
Read More »9 Of The Best Java Testing Frameworks For 2021
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way to develop a new app. It holds more significance if you are a full-stack developer or expert programmer. Most developers prefer Java because of its platform independence ...
Read More »Apache Camel 3.9 – No more saw tooth JVM garbage collection
We continue our effort to optimize Apache Camel. This is blog post part 7 which covers are latest effort on dramatically reducing the object allocations caused by Camel while routing messages. The good news is that we have overachieved and was able to reduce object allocations to ZERO!!! – so no more JVM memory usage graphs with saw tooth (note: ...
Read More »Handling Injection Attacks in Java
An injection attack is the insertion of malicious data from the client to the application using SQL or XXE (XML External Entity).It is important to prevent injection attacks because it allows attackers to spoof identity, tamper with existing data, disclosure all the data, destroy the data, become the administrator, etc. SQL Injection If the attacker introduces something like ‘ or ...
Read More »Introduction into GraalVM (Community Edition): GraalVM as a Polyglot Platform
1. Introduction Until now we have discussed the GraalVM exclusively in the context of the JVM platform. It is not surprising taking into account all the advantages that JVM applications and services could get out of the GraalVM compiler and native image builder. Table Of Contents 1. Introduction 2. The Truffle Framework 3. Truffle for Language Implementors 3.1. The Power ...
Read More »