Closed Bug 320471 Opened 20 years ago Closed 3 years ago

remove NativeProxy.c file from jss source tree - dead code

Categories

(JSS Graveyard :: Library, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: alvolkov.bgs, Unassigned)

Details

This file has two functions JSS_getPtrFromProxy, JSS_ptrToByteArray that duplicate functions in jssutil.c. File NativeProxy.c is not compiled during normal build process. Looks like a dead code.
NativeProxy.c and NativeProxy.java seems to have quite a few references in JSS code, EG: CipherContextProxy.java, KeyProxy.java, ModuleProxy.java etc . If this is dead code, then quite a few classes will have to be modified. Listing of reference to NativeProxy: ./org/mozilla/jss/pkcs11/CipherContextProxy.java import org.mozilla.jss.util.NativeProxy; final class CipherContextProxy extends NativeProxy { ./org/mozilla/jss/pkcs11/KeyProxy.java abstract class KeyProxy extends org.mozilla.jss.util.NativeProxy { ./org/mozilla/jss/pkcs11/ModuleProxy.java final class ModuleProxy extends NativeProxy { ./org/mozilla/jss/pkcs11/PK11Cert.java class CertProxy extends org.mozilla.jss.util.NativeProxy { ./org/mozilla/jss/pkcs11/PK11Cipher.java import org.mozilla.jss.util.NativeProxy; ./org/mozilla/jss/pkcs11/PK11Signature.java class SigContextProxy extends NativeProxy { ./org/mozilla/jss/pkcs11/TokenProxy.java import org.mozilla.jss.util.NativeProxy; public final class TokenProxy extends NativeProxy { ./org/mozilla/jss/ssl/common.c /* remains because SocketProxy extends org.mozilla.jss.util.NativeProxy*/ ./org/mozilla/jss/tests/SelfTest.java //NativeProxy.assertRegistryEmpty(); ./org/mozilla/jss/util/NativeProxy.c /* This file does not contain native methods of NativeProxy; rather, it * provides utility functions for using NativeProxys in C code */ * Given a NativeProxy, extract the pointer and store it at the given * nativeProxy: a JNI reference to a NativeProxy. * the NativeProxy. JSS_getPtrFromProxy(JNIEnv *env, jobject nativeProxy, void **ptr) jclass nativeProxyClass; PR_ASSERT(env!=NULL && nativeProxy != NULL && ptr != NULL); nativeProxyClass = (*env)->FindClass(env, "org/mozilla/jss/util/NativeProxy"); if(nativeProxyClass == NULL) { /* make sure what we got was really a NativeProxy object */ PR_ASSERT( (*env)->IsInstanceOf(env, nativeProxy, nativeProxyClass) ); byteArrayField = (*env)->GetFieldID(env, nativeProxyClass, "mPointer", byteArray = (jbyteArray) (*env)->GetObjectField(env, nativeProxy, * into a NativeProxy constructor. ./org/mozilla/jss/util/NativeProxy.h * Given a NativeProxy, extract the pointer and store it at the given * nativeProxy: a JNI reference to a NativeProxy. * the NativeProxy. JSS_getPtrFromProxy(JNIEnv *env, jobject nativeProxy, void **ptr); * into a NativeProxy constructor. ./org/mozilla/jss/util/Tunnel.java ./org/mozilla/jss/util/SECerrs.h ./org/mozilla/jss/util/NativeProxy.java * NativeProxy, a superclass for Java classes that mirror C data structures. public abstract class NativeProxy private NativeProxy() { * Create a NativeProxy from a byte array representing a C pointer. * This is the only way to create a NativeProxy, it should be called * NativeProxy instance acts as a proxy for that native data structure. public NativeProxy(byte[] pointer) { if( ! (obj instanceof NativeProxy) ) { if( ((NativeProxy)obj).mPointer.length != mPointer.length) { if(mPointer[i] != ((NativeProxy)obj).mPointer[i]) { * Subclasses of NativeProxy must define this method to clean up * <p>You don't call this method; NativeProxy.finalize() calls it for you. * Finalize this NativeProxy by releasing its native resources. * class MyProxy extends NativeProxy { * <p>In debug mode, we keep track of all NativeProxy objects in a * static registry. Whenever a NativeProxy is constructed, it * NativeProxy.finalize() from their subclasses of NativeProxy, so that * Register a NativeProxy instance. * Unregister a NativeProxy instance. * @see NativeProxy#getRegistryIndex * @return The index of this NativeProxy in the NativeProxy registry. * @see NativeProxy#getRegistryIndices " NativeProxys are still registered."); Debug.trace(Debug.OBNOXIOUS, "NativeProxy registry is empty"); ./org/mozilla/jss/util/java_ids.h * NativeProxy #define NATIVE_PROXY_CLASS_NAME "org/mozilla/jss/util/NativeProxy" ./org/mozilla/jss/util/jssutil.c ** Given a NativeProxy, extract the pointer and store it at the given ** nativeProxy: a JNI reference to a NativeProxy. ** the NativeProxy. JSS_getPtrFromProxy(JNIEnv *env, jobject nativeProxy, void **ptr) jclass nativeProxyClass; PR_ASSERT(env!=NULL && nativeProxy != NULL && ptr != NULL); if( nativeProxy == NULL ) { proxyClass = (*env)->GetObjectClass(env, nativeProxy); nativeProxyClass = (*env)->FindClass( if(nativeProxyClass == NULL) { /* make sure what we got was really a NativeProxy object */ PR_ASSERT( (*env)->IsInstanceOf(env, nativeProxy, nativeProxyClass) ); byteArray = (jbyteArray) (*env)->GetObjectField(env, nativeProxy, ** Given an object which contains a NativeProxy, extract the pointer ** from the NativeProxy and store it at the given address. ** proxyOwner: an object which contains a NativeProxy member. ** proxyFieldName: the name of the NativeProxy member. ** proxyFieldSig: the signature of the NativeProxy member. ** into a NativeProxy constructor. ./org/mozilla/jss/util/jssutil.h ** Given a NativeProxy, extract the pointer and store it at the given ** nativeProxy: a JNI reference to a NativeProxy. ** the NativeProxy. JSS_getPtrFromProxy(JNIEnv *env, jobject nativeProxy, void **ptr); ** Given an object which contains a NativeProxy, extract the pointer ** from the NativeProxy and store it at the given address. ** proxyOwner: an object which contains a NativeProxy member. ** proxyFieldName: the name of the NativeProxy member. ** proxyFieldSig: the signature of the NativeProxy member. * into a NativeProxy constructor.
Version: unspecified → 4.2
Priority: -- → P3
QA Contact: libraries
QA Contact: libraries → jss-qa
Assignee: gbmozilla → nobody
JSS development has moved from the Mozilla community to the Dogtag PKI community. Please re-file this bug at https://github.com/dogtagpki/jss if it is still relevant. Thank you!
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.