Skip to content


Return in a finally blockWhat will happen if we return a value in a finally block?

If the finally block executes successfully the return in the finally block will override the return value set in the try-catch block.

package org.magicworldz.basic.finallyreturn;

public class FinallyReturn {
    public static void main(String[] args) {
        var app = new FinallyReturn();

    public int finallyReturn(int ret) {
        try {
            return ret;
        } finally {
            return 0;


Traps in MySQL Version 5.6.27 Versus 5.6.33

MySQL different version may have different behaviors or maybe it's bug, even if execute exactly same SQL.

MySQL's default transaction islocation leve is READ REPEATABLE. If we, * Change transaction isolation level and execute update SQL as following


INSERT INTO table (...);
In version 5.6.27, will receive error.

Error Code Error Message
1665 Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITED.

It will pass in version 5.6.33 or later.

Run PostgreSQL in Docker

It's easy and environment independent to run the PostgreSQL Docker. * Get rid of the environment mess up while upgrading to a newer version * Better management via Docker

Command to Run the PostgreSQL Docker

docker run --name ${name} -e POSTGRES_PASSWORD=${PW} -e POSTGRES_USER=${USER} -e POSTGRES_DB=${DEFAULT DATABSE} --mount type=bind,source=${SOURCE ABS PATH},target=${TARGET PATH IN THE DOCKER} -p 5432:5432 -d postgres:latest

Fetch Old Release Archies in Ubuntu

Rcently, when building a MySQL 5.6 Docker in Ubuntu 14.04, got errors:

W: Failed to fetch  404  Not Found [IP: 80]

W: Failed to fetch  404  Not Found [IP: 80]

W: Failed to fetch  404  Not Found [IP: 80]

W: Failed to fetch  404  Not Found [IP: 80]

W: Failed to fetch  404  Not Found [IP: 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.