Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 JAVA


  Fastjson just fixed a bug which might cause out of memory issue

Fastjson just fixed a bug which might cause service down a few days ago. This bug is caused by some mishandling of special character \x which is an escaped character to indicate hexdecimal number. The impact of this bug would be big if the attacker constructs a malicious data which would cause the service down. The code which causes the issue is in com.alibaba.fastjson.parser.JSONLexerBase#scanString, when a JSON string is passed in, fastjson would parse the string character by character, when it finds the \x, it would try to process the following two characters automatically an...

3,026 0       FASTJSON BUG NEWS ALIBABA


  Fix issue where no Java virtual machine found when launching Eclipse

In cases where a new Eclipse is installed or the location of the Java virtual machine binaries has been changed, you may face issue when launching Eclipse. The error would look like.And if you go to the location specified in the error message, there is no such path indeed. And when clicks OK, the program just exits. The issue here is that it tries to find the java.exe binary and launch the program but it failed to locate it and hence exits.To fix this, you first need to ensure you have Java installed on your system no matter it's a JRE or JDK. Then navigate to the Eclipse installation pat...

2,856 0       JAVA LAUNCH ECLIPSE ECLIPSE.INI


  The difference between System.load and System.loadLibrary in Java

When writing code using native library in Java, normally the first step is loading some native library.static{  System.load("D:" + File.separator + "Hello.dll");}JDK provides two ways to load libraries:System.load(String filename)System.loadLibrary(String libname)This post will try to explain the differences of these two ways.According to Java Doc on System.load(), it has below description.Loads the native library specified by the filename argument. The filename argument must be an absolute path name.The parameter of this method should be an absolute file path with the exten...

25,676 1       SYSTEM.LOADLIBRARY SYSTEM.LOAD JAVA JNI NATIVE


  Java Interview Questions

Currently there are many articles online which summarize the list of Java interview questions. Some cover lots of basic questions and some cover some specific questions in specific area such as multithreading. In this post, we will not cover the really basic questions, we will cover something different. For basic question, you can read Java Interview Questions。BasicWhat is primitive data type? How many primitive data types in Java? What are they?-- A primitive type is predefined by the language and is named by a reserved keyword. Primitive values do not share state with other ...

8,996 0       JAVA SECURITY INTERVIEW CAREER MULTITHREADING QUESTION JAVA INTERVIEW JAVA CORE


  Why using + to concatenate string in Java loop is not a good option

String concatenation is a common operation in Java programming. It is to concatenate multiple strings into a single string. Java provides a String class which is an immutable class which means the object cannot be mutated once instantiated.Once a String object is instantiated, its properties cannot be changed anymore, so when concatenating strings, it's actually create a new String instance to store the concatenated string values. For example, below is a simple string concatenation example.String s = "abcd";s = s.concat("ef");When this piece of code is executed, a new String instance is create...

10,007 0       JAVA STRING JAVA 8


  Why can System.out.println be used to exit while loop

Let's first take a look at one simple Java thread code snippet which is supposed to exit the while loop after the first loop run.public class StopThread { private static boolean stopRequested; public static void main(String[] args) throws InterruptedException { Thread backgroundThread = new Thread(new Runnable() { @Override public void run() { int i = 0; while (!stopRequested) { i++; } } }); backgroundThread.start(); TimeUnit.SECONDS.sleep(1); stopRequested = true; }}But the truth is that the loop may not exit and keep running. The reason is that the updated stopRequested value will be in the ...

2,334 0       JAVA THREAD VOLATILE


  How to Set Spring profile With Example

Technology:  Spring Profiles provides a way to isolates the parts of application configuration, it will make available only in certain environments. It is mainly useful it wants to load spring beans based on environment configuration, for example if the operating system is windows we can load some specific spring beans, if it is other than load different spring beans. One more scenario where spring profiles widely used, like for QA environment we will use some database which is hosted locally, for UAT we will use some different host database, for production it will vary, in this scenario`...

16,558 0       SPRING APPLICATIONS PROFILE DEVELOPMENT JAVA


  Why Use Java?

 Java was developed by Sun Micro-systems back in 1995 to function as high level programming language and serve as a computing platform. This gets regularly updated with new features and better compatibility. The latest version is Java SE 8.0 which released in 2014, March. Java has gained immense popularity while there have been various platforms to match up with the Java configurations like Java SE for Macintosh, Windows and UNIX, Java ME for Mobile Applications and Java EE for Enterprise Applications. Java is nowadays used in most of the enterprises and business units in networked a...

1,955 0       JAVA APPLICATION DEVELOPMENT JAVA WEB DEVELOPMENT JAVA OUTSOURCING COMPANY