From 721081f33ce32daf2cb9af786b5c2e5ba82d46c5 Mon Sep 17 00:00:00 2001 From: bryce Date: Mon, 30 May 2005 16:02:38 +0000 Subject: 2005-05-30 Bryce McKinlay PR libgcj/21821 * gnu/java/nio/channels/natFileChannelPosix.cc (open): Don't use MAXPATHLEN. Format exception message using a StringBuffer instead. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100364 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/gnu/java/nio/channels/natFileChannelPosix.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'libjava/gnu/java/nio/channels') diff --git a/libjava/gnu/java/nio/channels/natFileChannelPosix.cc b/libjava/gnu/java/nio/channels/natFileChannelPosix.cc index 742201bde94..24b6396c66c 100644 --- a/libjava/gnu/java/nio/channels/natFileChannelPosix.cc +++ b/libjava/gnu/java/nio/channels/natFileChannelPosix.cc @@ -37,6 +37,7 @@ details. */ #include #include #include +#include #include #include #include @@ -168,13 +169,13 @@ FileChannelImpl::open (jstring path, jint jflags) } if (fd == -1) { - char msg[MAXPATHLEN + 200]; // We choose the formatting here for JDK compatibility, believe // it or not. - sprintf (msg, "%.*s (%.*s)", - MAXPATHLEN + 150, buf, - 40, strerror (errno)); - throw new ::java::io::FileNotFoundException (JvNewStringLatin1 (msg)); + ::java::lang::StringBuffer *msg = new ::java::lang::StringBuffer (path); + msg->append (JvNewStringUTF (" (")); + msg->append (JvNewStringUTF (strerror (errno))); + msg->append (JvNewStringUTF (")")); + throw new ::java::io::FileNotFoundException (msg->toString ()); } _Jv_platform_close_on_exec (fd); -- cgit v1.2.3