test_class.declarator: CONF_TMPJARS = "tmpjars"
test_class.modifier: private static final
test_class.original_string: private static final String CONF_TMPJARS = "tmpjars";
test_class.type: String
test_class.var_name: CONF_TMPJARS
test_class.declarator: mTempDir = new TemporaryFolder()
test_class.modifier: @Rule
    public
test_class.original_string: @Rule
    public TemporaryFolder mTempDir = new TemporaryFolder();
test_class.type: TemporaryFolder
test_class.var_name: mTempDir
test_class.file: kiji-mapreduce/src/test/java/org/kiji/mapreduce/util/TestJars.java
test_class.identifier: TestJars
test_case.body: @Test
    public void testGetJarPathForClassNotFound() throws ClassNotFoundException, IOException {
      try {
        // This will throw an exception because this class is not in a jar when being run.
        Jars.getJarPathForClass(TestJars.class);
        fail("ClassNotFoundException");
      } catch (ClassNotFoundException ce) {
        assertEquals("Unable to find containing jar for class org.kiji.mapreduce.util.TestJars",
        ce.getMessage());
      }
    }
test_case.class_method_signature: TestJars.testGetJarPathForClassNotFound()
test_case.full_signature: @Test public void testGetJarPathForClassNotFound()
test_case.identifier: testGetJarPathForClassNotFound
test_case.invocations: getJarPathForClass fail assertEquals getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetJarPathForClassNotFound()
focal_class.file: kiji-mapreduce/src/main/java/org/kiji/mapreduce/util/Jars.java
focal_class.identifier: Jars
focal_class.class_method_signature: Jars.Jars()
focal_class.full_signature: private  Jars()
focal_class.identifier: Jars
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  Jars()
focal_class.class_method_signature: Jars.getJarPathForClass(Class<? extends Object> classObj)
focal_class.full_signature: public static String getJarPathForClass(Class<? extends Object> classObj)
focal_class.identifier: getJarPathForClass
focal_class.modifiers: public static
focal_class.parameters: (Class<? extends Object> classObj)
focal_class.return: String
focal_class.signature: String getJarPathForClass(Class<? extends Object> classObj)
focal_method.body: public static String getJarPathForClass(Class<? extends Object> classObj)
        throws ClassNotFoundException, IOException {
      ClassLoader loader = classObj.getClassLoader();
      String classFile = classObj.getName().replaceAll("\\.", "/") + ".class";
      for (Enumeration<URL> itr = loader.getResources(classFile); itr.hasMoreElements();) {
        URL url = itr.nextElement();
        if ("jar".equals(url.getProtocol())) {
          String toReturn = url.getPath();
          if (toReturn.startsWith("file:")) {
            toReturn = toReturn.substring("file:".length());
          }
          // URLDecoder is a misnamed class, since it actually decodes
          // x-www-form-urlencoded MIME type rather than actual
          // URL encoding (which the file path has). Therefore it would
          // decode +s to ' 's which is incorrect (spaces are actually
          // either unencoded or encoded as "%20"). Replace +s first, so
          // that they are kept sacred during the decoding process.
          toReturn = toReturn.replaceAll("\\+", "%2B");
          toReturn = URLDecoder.decode(toReturn, "UTF-8");
          return toReturn.replaceAll("!.*$", "");
        }
      }
      throw new ClassNotFoundException(
          "Unable to find containing jar for class " + classObj.getName());
    }
focal_method.class_method_signature: Jars.getJarPathForClass(Class<? extends Object> classObj)
focal_method.full_signature: public static String getJarPathForClass(Class<? extends Object> classObj)
focal_method.identifier: getJarPathForClass
focal_method.invocations: getClassLoader replaceAll getName getResources hasMoreElements nextElement equals getProtocol getPath startsWith substring length replaceAll decode replaceAll getName
focal_method.modifiers: public static
focal_method.parameters: (Class<? extends Object> classObj)
focal_method.return: String
focal_method.signature: String getJarPathForClass(Class<? extends Object> classObj)