#vulnerable code 
                                private void fastScannerSpeedTest(Pattern pattern) throws Exception
    {
        try
        {
            for (int i = 10; i-- > 0;)
            {

                InputStreamReader reader = getReader();
                System.out.print("Fast " + i + ":\t");
                FastScanner scanner = FastScannerFactory.getReader(reader, pattern);

                long start = System.currentTimeMillis();
                try
                {
                    int ctr = 0;
                    @SuppressWarnings("unused")
                    String t;
                    while ((t = scanner.next()) != null)
                    {
                        // System.out.println(t);
                        ctr++;
                    }
                    System.out.print(ctr + "\t");

                }
                catch (NoSuchElementException e)
                {
                }
                System.out.println((System.currentTimeMillis() - start) + " ms");
            }
        }
        catch (Exception e)
        {
            System.out.println(
                    "If you want to run FastScannerSpeedTestOnSocket, you'll need to run FastScannerTestSocketSource first");
        }
    } 
                            #location 10 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                private void fastScannerSpeedTest(Pattern pattern) throws Exception
    {
        try
        {
            for (int i = 10; i-- > 0;)
            {
                Socket echoSocket = new Socket("127.0.0.1", FastScannerTestSocketSource.portNumber);

                InputStreamReader reader = getReader(echoSocket);
                System.out.print("Fast " + i + ":\t");
                FastScanner scanner = FastScannerFactory.getReader(reader, pattern);

                long start = System.currentTimeMillis();
                try
                {
                    int ctr = 0;
                    @SuppressWarnings("unused")
                    String t;
                    while ((t = scanner.next()) != null)
                    {
                        // System.out.println(t);
                        ctr++;
                    }
                    System.out.print(ctr + "\t");

                }
                catch (NoSuchElementException e)
                {
                }
                System.out.println((System.currentTimeMillis() - start) + " ms");
            }
        }
        catch (Exception e)
        {
            System.out.println(
                    "If you want to run FastScannerSpeedTestOnSocket, you'll need to run FastScannerTestSocketSource first");
        }
    }