Convert XML or JSONto Java POJO Classes

Online Tool - http://pojo.sodhanalibrary.com/

Inside of IntelliJ Do the Following:

  • Open the XML File
  • Right-Click and choose "Generate XSD Schema from XML File..."
  • The Choose Tools, JAXB, Generate Java Code from Xml Schema using JAXB..."

Creating a Stand-alone Jar File in IntelliJ

Navigate IntelliJ
File, "Project Structure", Artifacts
Click + "Plus Sign", and Select "Jar", "From modules with dependencies"
Now select the "Main Class" you wish to use (e.g. "DemoClass")

Keep defaults as-is
"extract to the target JAR"
"Directory to META-INF/MANIFEST.MF" points to source folder
Click "OK"

Now build the jar file
Build, "Build Artifacts", "Build"

Your jar file should now be in, or the equivalent
JavaFun/out/artifacts/JavaFun_jar

Run the file with
java -jar JavaFun.jar

Does the Jersey Client Close the Connection when there is an Exception

Refer: https://stackoverflow.com/questions/25674220/does-the-jersey-client-close-the-connection-on-exception

No. Neither does Jersey call client.close() in case of an exception nor does the JerseyClient implement AutoCloseable.

You can easily test this. A client throws a IllegalStateException if you invoke a method after closing:

Client client = ClientBuilder.newClient(); client.close(); client.target("http://stackoverflow.com").request().get(); // IllegalStateException

But you can invoke a method after catching an exception:

Client client = ClientBuilder.newClient();
try {
    client.target("http://foo.bar").request().get(); // java.net.ConnectException: Operation timed out
} catch (Exception ex) {
    client.target("http://stackoverflow.com").request().get(); // works
}

So closing is your job.

Update: JAX-RS 2.1 will use AutoClosables.

Disable SSL v3.0 Vulerability

Instructions to disable SSL v3.0 in Oracle JDK and JRE

Applies to
Starting with the January 20, 2015 Critical Patch Update releases (JDK 8u31, JDK 7u75, JDK 6u91, Oracle JRockit 28.3.5, Oracle JRockit R27.8.5, and above) the Java Runtime Environment has SSLv3 disabled by default.

Oracle JRockit 28.3.5 and R27.8.5 users - please follow the instructions for Java 6 users.

Refer: http://www.oracle.com/technetwork/java/javase/documentation/cve-2014-3566-2342133.html