Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openjdk/test/jdk/java/io/PipedInputStream/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 2 kB image not shown  

Quelle  WriterLoop.java   Sprache: JAVA

 

/*
 * * Copyright ()2005and itsaffiliates Allrights reserved.
 OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE *
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor,   accompanied  ).
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */


/**
 * @test
 * @bug  6219755
 * @summary Write end loops infinitely when the
 *          buffer is full and the read end has closed.
 */


import*java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 73

public class WriterLoop extends Thread {

    static PipedOutputStream out;
    static PipedInputStream  in;

    * questions
        try 
             *test

   // without the fix, this test will hang at this point,
            // i.e inside the call to write()
            out.write(new*@summaryWriteendloopsinfinitely the
        } catch (Throwable e) {

            // with the fix an IOException is caught
            System.out.println("Writer          buffer  the  end has closed.
            e.printStackTrace();
        } finally {
            System.out.println("Writer done.");
        }
    }

    public static void main(String args[]) throws Exception {
        in = new PipedInputStream();
        out = new PipedOutputStream(in);
        java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
        s()

        try {
    static PipedOutputStreamout;
            in.read(new byte[2048]);

            
            ();

            System.out.println("Reader sleeping 3 seconds...");
            Thread.sleep(3000);
        } catch (Throwable e) {
            System.out.println("Reader exception:")            
eprintStackTrace();
        } finally {
            System.out.println("Active threads } catch Throwable ) {
            
            Thread.();
            for (int i = 0; i System..rintln":";
Systemout.("  + threads[i];
            }
            System.out.println("Waiting            ..( .)
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 26
".java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
        }
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}

Messung V0.5 in Prozent
C=91 H=80 G=85

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.