Apply patch from Dinesh Bolkensteyn to

fix the NPE. The indentation check should
still be reporting an error in the tryBlock.
This commit is contained in:
Oliver Burn 2011-10-29 20:23:37 +11:00
parent 6267c7260d
commit b441a1e751
3 changed files with 9 additions and 4 deletions

View File

@ -1146,9 +1146,14 @@ resources
{#resources = #([RESOURCES, "RESOURCES"], #resources);}
;
resource
: modifiers typeSpec[true] IDENT ASSIGN expression
: modifiers typeSpec[true] IDENT resource_assign
{#resource = #([RESOURCE, "RESOURCE"], #resource);}
;
resource_assign
: ASSIGN^ expression
;
// an exception handler

View File

@ -11,7 +11,8 @@ class InputValidTryResourcesIndent
// Taken from JDK7 java.lang.Package src code.
private static Manifest loadManifest(String fn) {
try (FileInputStream fis = new FileInputStream(fn);
JarInputStream jis = new JarInputStream(fis, false))
// This should be an error
JarInputStream jis = new JarInputStream(fis, false))
{
return jis.getManifest();
} catch (IOException e)

View File

@ -734,13 +734,12 @@ public class IndentationCheckTest extends BaseCheckTestSupport
}
@Test
@Ignore
public void testTryResources() throws Exception
{
final DefaultConfiguration checkConfig =
createCheckConfig(IndentationCheck.class);
final String[] expected = {
"something is expected, but there is a NullPointerException",
//"something is expected, but there is nothing",
};
verify(checkConfig, getPath("indentation/InputValidTryResourcesIndent.java"),
expected);