Remove use of java1.7 API, make it Java6 compatible.