提交 7fb5273d 编写于 作者: P pchelko

8035320: [parfait] JNI exception pending in jdk/src/windows/native/sun/windows/awt_DnDDS.cpp

Reviewed-by: anthony, serb
上级 4e6fc17a
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -643,6 +643,7 @@ HRESULT __stdcall AwtDragSource::QueryContinueDrag(BOOL fEscapeKeyPressed, DWOR
m_lastmods == modifiers) {//cannot move before cursor change
call_dSCmouseMoved(env, m_peer,
m_actions, modifiers, dragPoint.x, dragPoint.y);
JNU_CHECK_EXCEPTION_RETURN(env, E_UNEXPECTED);
m_dragPoint = dragPoint;
}
......@@ -977,6 +978,10 @@ HRESULT __stdcall AwtDragSource::GetDataHere(FORMATETC __RPC_FAR *pFormatEtc,
if ((matchedFormatEtc.tymed & TYMED_ISTREAM) != 0) {
jboolean isCopy;
jbyte *bBytes = env->GetByteArrayElements(bytes, &isCopy);
if (bBytes == NULL) {
env->PopLocalFrame(NULL);
return E_UNEXPECTED;
}
ULONG act;
HRESULT res = pmedium->pstm->Write((const void *)bBytes, (ULONG)nBytes,
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -603,6 +603,10 @@ jobject AwtDropTarget::ConvertNativeData(JNIEnv* env, jlong fmt, STGMEDIUM *pmed
jobject local = JNU_NewStringPlatform(
env,
pmedium->lpszFileName);
if (env->ExceptionCheck()) {
hr = E_OUTOFMEMORY;
break;
}
jstring fileName = (jstring)env->NewGlobalRef(local);
env->DeleteLocalRef(local);
......@@ -1220,8 +1224,6 @@ AwtDropTarget::call_dTCgetis(JNIEnv* env, jlong istream) {
/*****************************************************************************/
jclass WDTCPIStreamWrapper::javaIOExceptionClazz = (jclass)NULL;
/**
* construct a wrapper
*/
......@@ -1233,16 +1235,6 @@ WDTCPIStreamWrapper::WDTCPIStreamWrapper(STGMEDIUM* stgmedium) {
m_istream = stgmedium->pstm;
m_istream->AddRef();
m_mutex = ::CreateMutex(NULL, FALSE, NULL);
if (javaIOExceptionClazz == (jclass)NULL) {
javaIOExceptionClazz = env->FindClass("java/io/IOException");
if (JNU_IsNull(env, javaIOExceptionClazz)) {
env->ThrowNew(env->FindClass("java/lang/ClassNotFoundException"),
"Cant find java/io/IOException"
);
}
}
}
/**
......@@ -1291,12 +1283,12 @@ jint WDTCPIStreamWrapper::Available() {
JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
if (m_istream->Stat(&m_statstg, STATFLAG_NONAME) != S_OK) {
env->ThrowNew(javaIOExceptionClazz, "IStream::Stat() failed");
JNU_ThrowIOException(env, "IStream::Stat() failed");
return 0;
}
if (m_statstg.cbSize.QuadPart > 0x7ffffffL) {
env->ThrowNew(javaIOExceptionClazz, "IStream::Stat() cbSize > 0x7ffffff");
JNU_ThrowIOException(env, "IStream::Stat() cbSize > 0x7ffffff");
return 0;
}
......@@ -1349,7 +1341,7 @@ jint WDTCPIStreamWrapper::Read() {
return (jint)(actual == 0 ? -1 : b);
default:
env->ThrowNew(javaIOExceptionClazz, "IStream::Read failed");
JNU_ThrowIOException(env, "IStream::Read failed");
}
return (jint)-1;
}
......@@ -1394,6 +1386,7 @@ jint WDTCPIStreamWrapper::ReadBytes(jbyteArray buf, jint off, jint len) {
ULONG actual = 0;
jbyte* local = env->GetByteArrayElements(buf, &isCopy);
HRESULT res;
CHECK_NULL_RETURN(local, (jint)-1);
switch (res = m_istream->Read((void *)(local + off), (ULONG)len, &actual)) {
case S_FALSE:
......@@ -1406,7 +1399,7 @@ jint WDTCPIStreamWrapper::ReadBytes(jbyteArray buf, jint off, jint len) {
default:
env->ReleaseByteArrayElements(buf, local, JNI_ABORT);
env->ThrowNew(javaIOExceptionClazz, "IStream::Read failed");
JNU_ThrowIOException(env, "IStream::Read failed");
}
return (jint)-1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册