980N/A/*
980N/A * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
980N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
980N/A *
980N/A * This code is free software; you can redistribute it and/or modify it
980N/A * under the terms of the GNU General Public License version 2 only, as
980N/A * published by the Free Software Foundation.
980N/A *
980N/A * This code is distributed in the hope that it will be useful, but WITHOUT
980N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
980N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
980N/A * version 2 for more details (a copy is included in the LICENSE file that
980N/A * accompanied this code).
980N/A *
980N/A * You should have received a copy of the GNU General Public License version
980N/A * 2 along with this work; if not, write to the Free Software Foundation,
980N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
980N/A *
980N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
980N/A * or visit www.oracle.com if you need additional information or have any
980N/A * questions.
980N/A */
980N/A
980N/A/* @test
980N/A @bug 4149941
980N/A @summary mark and reset should throw an exception even when the
980N/A underlying stream supports the operations.
980N/A
980N/A*/
980N/A
980N/A
980N/Aimport java.io.*;
980N/A
980N/Apublic class MarkReset {
980N/A
980N/A public static void main(String args[]) throws Exception {
980N/A CharArrayReader car = new CharArrayReader(new char[32]);
980N/A PushbackReader pb = new PushbackReader(car);
980N/A boolean markResult = testMark(pb);
980N/A boolean resetResult = testReset(pb);
980N/A if ((!markResult) || (!resetResult))
980N/A throw new Exception("Mark and reset should not be supported");
980N/A }
980N/A
980N/A static boolean testMark(PushbackReader pb){
980N/A try{
980N/A pb.mark(100);
980N/A } catch (IOException e) {
980N/A return true; // Passed the test successfully
980N/A }
980N/A System.err.println("Mark error");
980N/A return false; // Failed
980N/A }
980N/A
980N/A static boolean testReset(PushbackReader pb){
980N/A try{
980N/A pb.reset();
980N/A } catch (IOException e) {
980N/A return true; // Passed the test successfully
980N/A }
980N/A System.err.println("Reset error");
980N/A return false; // Failed
}
}