java.lang.ClassCastException: com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl cannot be cast to javax.net.ssl.HttpsURLConnection

The solution is to change this line

URL url = new URL("https://redmine.xxx.cz/time_entries.xml");

into this line

URL url = new URL(null, "https://redmine.xxx.cz/time_entries.xml", new sun.net.www.protocol.https.Handler());

If you are using simply HTTP protocol (not HTTPS), instead of:

HttpsURLConnection httpCon = (HttpsURLConnection) url.openConnection();

Use this:

HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();

Just drop the "s" in "HttpsURLConnection"