Make exception handling java 7 compatible