Fix patch and test suite for edge cases that are expected to differ between JDK 7 and 8 (JDK-7131459)