harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r816622 - in /harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent: commands/ClassType.cpp commands/ReferenceType.cpp core/PacketParser.cpp
Date Fri, 18 Sep 2009 13:13:15 GMT
Author: hindessm
Date: Fri Sep 18 13:13:14 2009
New Revision: 816622

URL: http://svn.apache.org/viewvc?rev=816622&view=rev
Log:
More fixes for missing exception handling.  These changes fix "[#HARMONY-6304]
[jdktools][jdwp] TimeoutExceptions causing test failures in Java 6 branch".

Modified:
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ClassType.cpp
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ReferenceType.cpp
    harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ClassType.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ClassType.cpp?rev=816622&r1=816621&r2=816622&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ClassType.cpp
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ClassType.cpp
Fri Sep 18 13:13:14 2009
@@ -466,6 +466,8 @@
 ClassType::NewInstanceHandler::Execute(JNIEnv *jni) 
 {
     m_clazz = m_cmdParser->command.ReadReferenceTypeID(jni);
+    JDWP_CHECK_NOT_NULL(m_clazz);
+
     if (AgentBase::GetClassManager().IsClass(jni, m_clazz) != JNI_TRUE) {
         JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "NewInstance: not a class: refTypeID=%p", m_clazz));
         AgentException e(JDWP_ERROR_INVALID_CLASS);
@@ -474,6 +476,7 @@
     }
 
     m_thread = m_cmdParser->command.ReadThreadID(jni);
+    JDWP_CHECK_NOT_NULL(m_thread);
     m_methodID = m_cmdParser->command.ReadMethodID(jni);
     int passedArguments = m_cmdParser->command.ReadInt();
 

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ReferenceType.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ReferenceType.cpp?rev=816622&r1=816621&r2=816622&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ReferenceType.cpp
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/commands/ReferenceType.cpp
Fri Sep 18 13:13:14 2009
@@ -37,6 +37,8 @@
     jclass jvmClass = m_cmdParser->command.ReadReferenceTypeID(jni);
     // Can be: InternalErrorException, OutOfMemoryException,
     // JDWP_ERROR_INVALID_CLASS, JDWP_ERROR_INVALID_OBJECT
+    JDWP_CHECK_NOT_NULL(jvmClass);
+
     JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "Signature: received: refTypeID=%p", jvmClass));
 
     char* classSignature = 0;

Modified: harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp?rev=816622&r1=816621&r2=816622&view=diff
==============================================================================
--- harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp
(original)
+++ harmony/enhanced/jdktools/branches/java6/modules/jpda/src/main/native/jdwp/common/agent/core/PacketParser.cpp
Fri Sep 18 13:13:14 2009
@@ -316,11 +316,20 @@
         // if it is a ClassObjectID
         jobject obj = GetObjectManager().MapFromObjectID(jni, rtid);
         if (obj) {
+          obj = jni->NewLocalRef(obj);
+          if (!obj) {
+            JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "Out of memory calling NewLocalRef"));
+            AgentException ex(JDWP_ERROR_OUT_OF_MEMORY);
+            JDWP_SET_EXCEPTION(ex);
+            return 0;
+          }
           jclass clsType = jni->GetObjectClass(obj);
           jboolean isClass = jni->IsAssignableFrom(clsType, jni->GetObjectClass(clsType));

           if (isClass) {
             JDWP_TRACE(LOG_RELEASE, (LOG_DATA_FL, "## ReadReferenceTypeIDOrNul: read : ObjectID
is a ClassObjectID"));
             cls = static_cast<jclass> (obj);
+            jni->DeleteLocalRef(obj);
+            
             jboolean isValidID = GetObjectManager().FindObjectID(jni, cls, rtid); 
             if(!isValidID) {
               JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "## ReadReferenceTypeIDOrNul: read :
ID is an invalid ObjectID"));
@@ -328,6 +337,12 @@
               JDWP_SET_EXCEPTION(ex);
               return 0;
             }
+          } else {
+            jni->DeleteLocalRef(obj);
+            JDWP_TRACE(LOG_RELEASE, (LOG_ERROR_FL, "## ReadReferenceTypeIDOrNul: read : ID
is not a ClassObjectID"));
+            AgentException ex(JDWP_ERROR_INVALID_CLASS);
+            JDWP_SET_EXCEPTION(ex);
+            return 0;
           }
         }
     }



Mime
View raw message