Clone from SWORD java-common project.