summaryrefslogtreecommitdiff
path: root/libjava/gnu/java
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-30 16:02:38 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-30 16:02:38 +0000
commit721081f33ce32daf2cb9af786b5c2e5ba82d46c5 (patch)
tree6e6ccc596c4328349a4c6539a7c9819425f459b6 /libjava/gnu/java
parent09391e073692ca1bd1a79c1dfc329496acd7a003 (diff)
downloadgcc-721081f33ce32daf2cb9af786b5c2e5ba82d46c5.tar.gz
2005-05-30 Bryce McKinlay <mckinlay@redhat.com>
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
Diffstat (limited to 'libjava/gnu/java')
-rw-r--r--libjava/gnu/java/nio/channels/natFileChannelPosix.cc11
1 files changed, 6 insertions, 5 deletions
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 <java/lang/NullPointerException.h>
#include <java/lang/System.h>
#include <java/lang/String.h>
+#include <java/lang/StringBuffer.h>
#include <java/lang/Thread.h>
#include <java/nio/ByteBuffer.h>
#include <java/nio/MappedByteBufferImpl.h>
@@ -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);