Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Naomi Proctor

Greenhorn
+ Follow
since Apr 04, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Naomi Proctor

Hi All,
Well I've finally go my signed applet to work on Windows Internet Explorer using CAB file and I'm trying to get it to work on MAC Internet Explorer:
I followed the instructions at the following site to create a self-signed applet for testing:
http://developer.apple.com/technotes/tn/tn1175.html
However I am getting a Apple security exception when trying to write to a file output:
/29/2002 @ 8:27:46
here
throwable exception
file writing test
trying to write to file: output.txt
Exception occurred during event dispatching:
com.apple.mrj.JManager.JMAppletSecurityExc: security.checkwrite: output.txt, /Macintosh HD/Applications (Mac OS 9)/Internet Explorer 5 Folder/output.txt
at com.apple.mrj.JManager.JMAppletSecurityOld.checkWrite(JMAppletSecurityOld.java)
at java.io.FileOutputStream.<init>(FileOutputStream.java)
at java.io.FileWriter.<init>(FileWriter.java)
at testapp.actionPerformed(testapp.java:121)
at java.awt.Button.processActionEvent(Button.java)
at java.awt.Button.processEvent(Button.java)
at java.awt.Component.dispatchEventImpl(Component.java)
at java.awt.Component.dispatchEvent(Component.java)
at java.awt.EventDispatchThread.run(EventDispatchThread.java

Here is the code I am using:
public void actionPerformed(ActionEvent e) {

if (e.getSource()==saveM) {
try {

if (Class.forName("com.ms.security.PolicyEngine")!=null) {
System.out.println("FOUND com.ms.security.PolicyEngine");
com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.FILEIO);
System.out.println("got file io permission");
} else {
System.out.println("DID NOT FIND com.ms.security.PolicyEngine");
}
} catch (Throwable t) {
System.out.println("throwable exception");
}
System.out.println("file writing test");
try {
System.out.println("trying to write to file: output.txt");
FileWriter f = new FileWriter("output.txt");
f.write("suceed");
f.close();
System.out.println("SUCEEDED in writing to file");
} catch (IOException a) {
System.out.println("IOEXCEPTION while trying to write to file");
}
} else {
try {
if (Class.forName("com.ms.security.PolicyEngine")
!= null) {
System.out.println("hello");
com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.PRINTING);
System.out.println("got printing permission");
com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.FILEIO);
System.out.println("got file io permission");

} else {
System.out.println("goodbye");
}
} catch (Throwable t) {
System.out.println("here");
}

}

If you have any insight as to what I'm doing wrong, your help would be greatly appreciated.
I am running on a MAC OS 9, IE 5.0, and I installed MRJ 2.2.5.
Thanks,
Naomi
18 years ago
Hi there,
I'm having problems understanding the correct procedure that I have to follow to correctly sign
my applets. The applets are written in 1.1.8 and must work in IE and Netscape on the MAC and
under Windows.
I have a Verisign certificate but there is no Java v1.3 plugin for the MAC so it seems if we
will have to proceed a different way to sign the code on the MAC.
So it looks like I will have to get a Microsoft Authenticode certificate and a Netscape Object Signing
certificate to sign the applets so that they will work on the MAC without the Java 1.3 plugin.
Additionally, I will have to use specific code to enable permissions on IE and Netscape.
For example on IE (thanks Manfred):
com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.FILEIO); com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.UI); com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.USERFILEIO); com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.SYSTEM);
Can anybody verify that this is correct? Is there any other way to do this? If you have any good websites that you can point me to or any other useful information. It would greatly appreciated.
Thanks,
Naomi
[ April 25, 2002: Message edited by: Naomi Proctor ]
18 years ago
Thanks Manfred,
I did what you suggested below but I am still
getting and com.ms.security exception thrown
(see below). Is this because I'm using Verisign
to sign my certificate but Verisign requires
use of the Java plugin. If so, what should I do now? Is there a Java plugin for the Mac? I also read something about self-signed/ing certificates. Is there something else I might be
doing wrong here?
Thanks in advance,
Naomi
hello
got printing permission
got file io permission
got ui permission
got userfileio permission
got system permission
got clientstore permission
got exec permission
got multimedia permission
got netio permission
got property permission
got reflection permission
got registry permission
got security permission
got sysstreams permission
got thread permission
file writer test
com.ms.security.SecurityExceptionEx[testapp/testapp.actionPerformed]: cannot access file c:\output.txt
at com/ms/security/permissions/FileIOPermission.check
at com/ms/security/PolicyEngine.deepCheck
at com/ms/security/PolicyEngine.checkPermission
at com/ms/security/StandardSecurityManager.chk
at com/ms/security/StandardSecurityManager.checkWrite
at java/io/FileOutputStream.<init>
at java/io/FileWriter.<init>
at testapp/testapp.actionPerformed
at java/awt/Button.processActionEvent
at java/awt/Button.processEvent
at java/awt/Component.dispatchEventImpl
at java/awt/Component.dispatchEvent
at java/awt/EventDispatchThread.run
Exception occurred during event dispatching:
com.ms.security.SecurityExceptionEx[testapp/testapp.actionPerformed]: cannot access file c:\output.txt
at com/ms/security/permissions/FileIOPermission.check
at com/ms/security/PolicyEngine.deepCheck
at com/ms/security/PolicyEngine.checkPermission
at com/ms/security/StandardSecurityManager.chk
at com/ms/security/StandardSecurityManager.checkWrite
at java/io/FileOutputStream.<init>
at java/io/FileWriter.<init>
at testapp/testapp.actionPerformed
at java/awt/Button.processActionEvent
at java/awt/Button.processEvent
at java/awt/Component.dispatchEventImpl
at java/awt/Component.dispatchEvent
at java/awt/EventDispatchThread.run

Originally posted by Manfred Leonhardt:
Hi Naomi,
You only need to use the Sun HTML converter if you want to use Java2 on browsers by using the plug-in.
Go back to your original HTML file.
You need to actually ask the user for permission to perform any I/O unders Java 1.1.x and browsers. You need to have something like the following lines in your java code:
com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.FILEIO); com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.UI); com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.USERFILEIO); com.ms.security.PolicyEngine.assertPermission(com.ms.security.PermissionID.SYSTEM);
I am not sure which one (or more) you need.
Regards,
Manfred.

18 years ago
Hi There,
I'm having some problems printing a java applet that uses a jar file. I have signed and verified signing
with verisign certificate. When I try to print the applet I get the following error in the IE java console
window:
got frame
com.ms.security.SecurityExceptionEx[testapp/testapp.actionPerformed]
at com/ms/security/PolicyEngine.deepCheck
at com/ms/security/PolicyEngine.checkPermission
at com/ms/security/StandardSecurityManager.chk
at com/ms/security/StandardSecurityManager.checkPrintJobAccess
at com/ms/awt/WToolkit.getPrintJob
at testapp/testapp.actionPerformed
at java/awt/Button.processActionEvent
at java/awt/Button.processEvent
at java/awt/Component.dispatchEventImpl
at java/awt/Component.dispatchEvent
at java/awt/EventDispatchThread.run
Exception occurred during event dispatching:
com.ms.security.SecurityExceptionEx[testapp/testapp.actionPerformed]
at com/ms/security/PolicyEngine.deepCheck
at com/ms/security/PolicyEngine.checkPermission
at com/ms/security/StandardSecurityManager.chk
at com/ms/security/StandardSecurityManager.checkPrintJobAccess
at com/ms/awt/WToolkit.getPrintJob
at testapp/testapp.actionPerformed
at java/awt/Button.processActionEvent
at java/awt/Button.processEvent
at java/awt/Component.dispatchEventImpl
at java/awt/Component.dispatchEvent
at java/awt/EventDispatchThread.run
One site I read said that I has to convert my HTML files using Sun's html converter so I tried this
but now when I try to print I the printer dialog box comes up but I get the following error in the Java
console window and a blank page is printed (you can see here it's not even getting the frame)

Exception occurred during event dispatching:
java.lang.NullPointerException
at sun.awt.windows.WGraphics.clone(Unknown Source)
at sun.awt.windows.WPrintGraphics.clone(Unknown Source)
at sun.java2d.SunGraphics2D.create(Unknown Source)
at sun.awt.windows.WPrintGraphics.create(Unknown Source)
at sun.awt.windows.WPrintGraphicsWrapper.create(Unknown Source)
at sun.awt.windows.WPrintJob.getGraphics(Unknown Source)
at testapp.testapp.actionPerformed(testapp.java:52)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Please help!! I have to use 1.1.8 in this example and this code also has to work on the MAC. Am
I going to have to use a Java Plugin and is there one available for the MAC? Any information/help
you can provide will be greatly appreciated. Here is my test code:
public class testapp extends Applet implements ActionListener {
private Button print;
public void init() {
print=new Button("print");
print.addActionListener(this);
add(print);
}
//get the browser frame (to use as the owner when creating a dialog)
private Frame getBrowserFrame() {
Container c = this.getParent();
while (c != null) {
if (c instanceof Frame) {
System.out.println("got frame");
return((Frame)c);
}
c = c.getParent();
}
return ((Frame)c);
}
public void actionPerformed(ActionEvent e) {
PrintJob pj = getToolkit().getPrintJob(getBrowserFrame(), "printing" , null);
if (pj != null) {
System.out.println("got print job");
Graphics pg = pj.getGraphics();
System.out.println("after got graphics");
if (pg!=null) {
System.out.println("got graphics");
printComponents(pg);
System.out.println("printed components");
pg.dispose();
System.out.println("dispose graphics");
} else {
System.out.println("graphics is null");
}
pj.end();
} else {
System.out.println("printjob is null");
}
System.out.println("ending printing");
}
}
Thanks,
Naomi
18 years ago
Hi,
I using Java 1.1.8 on Mac OS 9.2 (IE). I have one big panel (twice the size of my screen) that contains labels. A scrollbar is used to horizonatally scroll the big panel using the scrollbar
adjustment listener:
public void adjustmentValueChanged(AdjustmentEvent e) {
panPlaceValueII.invalidateAll();
panPlaceValueII.setLocation(10+(e.getValue()*-1),panPlaceValueII.getLocation().y);
panPlaceValueII.validateAll();
panPlaceValueII.repaint();
this.validate();
this.doLayout();
this.repaint();
}
My problem is that labels that go off the screen when draggin the scrollbar are not repainted properly and I end up with a big mess of gray lines and white lines and such UNTILL I let go of the scrollbar at which point everything is repainted properly. It is like something is not being validated but I am explicitly validating and updating everything (panels labels) in my validateAll() method This code works on Windows but not on the MAC. I have to use Java 1.1.8. I also notice I do not
have this problem when I draw lines on the panels just when I put labels (components) on the panels. Any help would be greatly appreciated!!!
18 years ago