/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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. See the GNU General Public License
* 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, Boston, MA 02110-1301 USA.
*
* 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 4181483
* @summary Test if DataInputStream methods will check if the stream
* has been closed.
*/
public enum OpsAfterClose {
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
byte buf[] = new byte[2];
} catch (IOException io) {
return true;
}
return false;
} },
try {
byte buf[] = new byte[2];
int len = 1;
} catch (IOException io) {
return true;
}
return false;
} },
try {
return false;
} catch (IOException io) {
return true;
}
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
return true;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
is.markSupported();
return true;
} },
try {
return true; // No Exception thrown on windows
} catch (IOException io) {
return true; // Exception thrown on solaris and linux
}
}},
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
is.readDouble();
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} },
try {
} catch (IOException io) {
return true;
}
return false;
} };
boolean failed = false;
"f.txt");
f.createNewFile();
f.deleteOnExit();
try {
new FileInputStream(f));
try {
if (testDataInputStream(dis)) {
failed = true;
}
} finally {
}
} finally {
}
}
throws Exception {
boolean failed = false;
boolean result;
if (!result) {
failed = true;
}
}
if (failed) {
" above for :" + is);
}
return failed;
}
}