#vulnerable code 
                              public static byte[] classAsBytes(final String className)
      throws ClassNotFoundException {
    try {
      final URL resource = ClassUtils.class.getClassLoader().getResource(
          convertClassNameToFileName(className));
      final BufferedInputStream stream = new BufferedInputStream(
          resource.openStream());
      final byte[] result = new byte[resource.openConnection()
                                     .getContentLength()];

      int i;
      int counter = 0;
      while ((i = stream.read()) != -1) {
        result[counter] = (byte) i;
        counter++;
      }

      stream.close();

      return result;
    } catch (final IOException e) {
      throw new ClassNotFoundException("", e);
    }
  } 
                            #location 21 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              public static byte[] classAsBytes(final String className)
      throws ClassNotFoundException {
    final URL resource = ClassUtils.class.getClassLoader().getResource(
        convertClassNameToFileName(className));
    try(BufferedInputStream stream = new BufferedInputStream(
          resource.openStream())) {
      final byte[] result = new byte[resource.openConnection()
                                     .getContentLength()];

      int i;
      int counter = 0;
      while ((i = stream.read()) != -1) {
        result[counter] = (byte) i;
        counter++;
      }

      return result;
    } catch (final IOException e) {
      throw new ClassNotFoundException("", e);
    }
  }