Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6547358
Votes 0
Synopsis j.l.i.: manifest attribute 'Can-Retransform-Classes' is ignored by isRetransformClassesSupported()
Category java:serviceability
Reported Against b105
Release Fixed 7(b26)
State 10-Fix Delivered, bug
Priority: 2-High
Related Bugs
Submit Date 18-APR-2007
Description
Filed By       : JCK team
JDK            : java full version "1.6.0-fcs"
JCK            : 6a
Platform[s]    : FAIL - seems to be all
switch/Mode    : default
JCK test owner : http://javaweb.sfbay/jcce/tcks/jck/docs/others/owners.jto
Failed tests:
  api/java_lang/instrument/Instrumentation/index.html#Instrumentation[Instrumentation221]
  api/java_lang/instrument/Instrumentation/attach.html#InstrumentationAttach[Instrumentation221]

Problem description
===================
The javadoc specification for the Instrumentation.isRetransformClassesSupported() method at:
  http://java.sun.com/javase/6/docs/api/java/lang/instrument/Instrumentation.html#isRetransformClassesSupported()
states as follows:
  ---Excerpt-from-spec---
  The ability to retransform an already loaded class is an optional capability of a JVM. 
  Retransformation will only be supported if the Can-Retransform-Classes manifest attribute
  is set to true in the agent JAR file (as described in the package specification) and 
  the JVM supports this capability.
  ---End-of-excerpt---

However, when 'Can-Retransform-Classes' manifest attribute does not exist in manifest file
or when it is set to 'false', the call of isRetransformClassesSupported() still returns 'true'.

Please see attached minimized test (test.tar.gz) to reproduce the failure.

Minimized test output:
======================
>java -javaagent:agent1.jar -javaagent:agent2.jar Test
FAILED: agent1 unexpectedly supports retransformation
FAILED: agent2 unexpectedly supports retransformation
main is invoked

Additional info:
================
> uname -a
SunOS d-espb04-125-170 5.10 Generic_118833-33 sun4u sparc  xxxxx W,Ultra-60
Posted Date : 2007-04-18 13:57:36.0
Work Around
N/A
Evaluation
The Instrumentation.isRetransformClassesSupported() function
eventually boils down to a call to src/share/instrument/JPLISAgent.c:

jboolean
isRetransformClassesSupported(JNIEnv * jnienv, JPLISAgent * agent) {
    return retransformableEnvironment(agent) != NULL;
}

retransformableEnvironment() is defined as:

/* Return the environment with the retransformation capability.
 * Create it if it doesn't exist.
 * Return NULL if it can't be created.
 */
jvmtiEnv *
retransformableEnvironment(JPLISAgent * agent) {
}

so it looks like retransformableEnvironment() is not the
right way to determine if RetransformClasses is supported
since it will just return true if it is able to create
the retransformable environment.
Posted Date : 2008-01-31 21:38:40.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang