Handle nulls gracefully in the JavaTestRule when reporting errors.

Summary:
It's possible for the rule to be null when trying to figure out whether the source under
test is a java library rule. Handle this without causing buck to blow up.

Test Plan: Visual inspection of the code.
diff --git a/src/com/facebook/buck/java/JavaTestRule.java b/src/com/facebook/buck/java/JavaTestRule.java
index 23b468d..4c4c049 100644
--- a/src/com/facebook/buck/java/JavaTestRule.java
+++ b/src/com/facebook/buck/java/JavaTestRule.java
@@ -465,17 +465,22 @@
       for (BuildTarget sourceUnderTestName : sourceUnderTestNames) {
         // Generates the set by matching its path with the full path names that are passed in.
         BuildRule rule = ruleResolver.get(sourceUnderTestName);
+
         if (rule instanceof JavaLibraryRule) {
           sourceUnderTest.add((JavaLibraryRule) rule);
         } else {
           // In this case, the source under test specified in the build file was not a Java library
           // rule. Since EMMA requires the sources to be in Java, we will throw this exception and
           // not continue with the tests.
+
+          String ruleName = rule == null ? "unknown rule" : rule.getFullyQualifiedName();
+          String type = rule == null ? "unknown_type" : rule.getType().getName();
+
           throw new HumanReadableException(
               "Specified source under test for %s is not a Java library: %s (%s).",
               getBuildTarget().getFullyQualifiedName(),
-              rule.getFullyQualifiedName(),
-              rule.getType());
+              ruleName,
+              type);
         }
       }