Community articlerelease method (Certificate)
Added by IBM contributorIBM on May 2, 2012
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars




Description

This method is required when the HardGC flag is false. When the HardGC flag is false, memory used by this object is not recovered during normal JVM garbage collection. As a result, you must call the release method when you are finished with this object.
It is safe to call the release method when the HardGC flag is true; in this case no action is taken.
Note: If you want to release an array of objects, you must iterate through the array and call this method on each object.

Method

public static void release ( );


Parameters

There are no parameters for this method.

Returns

Nothing. The release method does not throw an exception if an error occurs.

Example

   public void serverSign(FormNodeP form) throws UWIException
   {
   IntHolder theStatus;
   FormNodeP buttonNode;
   Certificate  [] certList;
   Signature theSignature;
   String signerCommonName;
   boolean encodedResult;
   int certCount;
   int correctCert = -1;
   int i;
 
      if ((buttonNode = theForm.dereferenceEx(null, "PAGE1.SIGBUTTON1", 
         0, FormNodeP.UFL_ITEM_REFERENCE, null)) == null)
      {
         throw new UWIException("Could not locate SIGBUTTON1 node.");
      }
 
      theStatus = new IntHolder();
 
      certList = buttonNode.getCertificateList(null, theStatus);
 
      if (theStatus.value == SecurityUserStatusType.SUSTATUS_INPUT_REQUIRED)
      {
        for (i=0; i<certCount; i++)
        {
          certList [i].release();
        }
         throw new UWIException("User input required to sign form.");
      }
 
      certCount = certList.length;
 
      encodedResult = new BooleanHolder;
 
      for (i=0; i<certCount; i++)
      {
         signerCommonName = certList [i].getDataByPath(
            "Subject: CN", false, encodedResult);
         if (signerCommonName.equals("IBM Forms Server"))
         {
            correctCert = i;
            break;
         }
      }
 
      if (correctCert == -1)
      {
        for (i=0; i<certCount; i++)
        {
          certList [i].release();
        }
        throw new UWIException("Could not locate required certificate");
      }
 
      theSignature = buttonNode.signForm(certList [correctCert], null, 
         theStatus);
      theSignature.release();
 
      /* release each certificate */
      for (i=0; i<certCount; i++)
      {
        certList [i].release();
      }
 
      if (theStatus.value == SUSTATUS_INPUT_REQUIRED)
      {
         throw new UWIException("User input required to sign form.");
      }
 
   }


Parent topic:
Certificate class