Two Problems with Signed Applets on Macintosh

 (Apple Bug #2671180 and #2696766)

    The applet above is being used to report two bugs.  Bug #2671180 has been processed and Apple has decided not to fix it.  Bug # 2696766 is still going through the system.

Bug # 2671180:  This applet is signed using Sun's JDK 1.1 javakey signing system.  It runs properly under Apple's Applet Runner and Internet Explorer 5.0 for Macintosh OS 9 / MRJ 2.2.4, as well as on Windows environments such as Sun's Applet Viewer.  It runs properly in Internet Explorer 5.1 preview for OS X GM.  The problem is that the same applet will not be accepted as signed in Applet Launcher using OS X GM.  This is a lack of backward compatibility for Java JDK 1.1 signing.  Apple has decided not to fix this bug.  However, the following workaround allows you to run signed code in Applet Launcher on OS X:  

  1. Create a file called ".java.policy" (note both dots) with the following contents: 
    grant codeBase "http://relevant_domain.com/folder/JAR_Name.jar" {
    permission java.security.AllPermission;
    };
  2. Put the file in the home folder (e.g. users/Your_name)

 

Bug # 2696766:  Some users have gotten error messages trying to load this and other signed applets on OS 9.  For some users the error messages have occurred consistently, but some never get error messages and some get the error messages but they later go away.  For example, one user in France with Macintosh OS 9.0, Internet Explorer 5.01 (2022) and MRJ 2.2.4 got the following messages:
An exception occurred:
java.lang.ClassNotFoundException: SigningTest
at com.apple.mrj.JManager.JMAppletClassLoader_IMPL.loadClass(JMAppletClassLoaderOld.java)
at com.apple.mrj.JManager.JMAppletClassLoader_IMPL.loadClass(JMAppletClassLoaderOld.java)
at com.apple.mrj.JManager.JMAppletClassLoader_ROOT.loadClass(JMAppletClassLoaderOld.java)
at com.apple.mrj.JManager.JMAppletViewer_OLD.doLoadCode(JMAppletViewerOld.java) 
at com.apple.mrj.JManager.JMAppletViewer_OLD.setState(JMAppletViewerOld.java)
at com.apple.mrj.JManager.JMViewerEvent.post(JMAppletViewerOld.java)
at com.apple.mrj.JManager.AVDispatcherThread.run(JMAppletViewerOld.java)

The problem was fixed by the following steps aimed at clearing the cache (the user believes that steps 1B and 5 were the important ones):

1.  In Internet Explorer 5.0 choose:
    A.  Edit | Preferences | Web browser | Advanced |Cache | Empty Now.
    B.  Edit | Preferences | Web browser | Advanced |Cache | Update pages | Always
2.  Move the MRJ Cache folder in System Folder : Preferences  -> Trash
3.  Move the identitydb.obj file in System Folder : Preferences  -> Trash
4.  Create an mrj.properties file and put it into the folder: System Folder | Extensions | MRJ Libraries | Lib.
5.  When you accept the digital certificate for the software, do not check the "Always trust this signature" box; instead indicate trust each time you use the software by clicking the "Yes" button.

Other caching problems were fixed by:

6.  Re-saving the html page from which the applet is called.  This appears to overcome cache issues in the user's network.

The mrj.properties file is:
com.apple.mrj.useJarCaching false
com.apple.mrj.cache.verbose true
com.apple.mrj.cache.verbose.miss true
com.apple.mrj.cache.verbose.hit true

Surprisingly for a putative cache problem, the user asserts that the problem was present the first time the applet was accessed.  

    It appears that the combination of MRJ 2.2.5 and step #6 is enough to overcome all cache issues.  

    If you have any insights, workarounds or comments about this test page please contact Mickey Segal.  A listing of  many Macintosh Java bugs with demonstration applets is at this link, including information on how to add any necessary Java plugins.

    The source code is shown below and can be downloaded from this link :

import java.awt.*;
import java.applet.*;

public class SigningTest extends Applet {

public void init() {}

public void paint(Graphics g)
{
    try
    {
        String userHome = System.getProperty("user.home");
        g.drawString("Signing worked. The user.home property is: " + userHome, 10, 30);
    }
    catch (SecurityException e)
    {
    g.drawString("Signing didn't work. The SecurityException is: " + e.getMessage(), 10, 10);
    } 
}
} // END OF Class SigningTest