[SCM-786] Add missing dependency on junit to maven-scm-test
update code to avoid bug in JDK < 1.7