Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

Applet cannot read PARAM values: security exception

Thread view: 
VK - 01 Mar 2008 14:58 GMT
That was a while ago when I last time worked with Java, so I might be
missing some recent security development. Any way:

Having a simple applet with hardcoded params it runs just fine on the
latest Java Plug-in 1.6.0_04 in both IE and Fx. If I put params into
PARAM tags then on getParameter it gives me SecurityException and
"Applet notinited" - the orthography is from plugin makers - in the
browser status bar. Is PARAM usage for applet is now locked? How do
workaround it then?

The applet in question is as simple as:

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

public class SockeR extends Applet {

public void init() {
 this.setBackground(
  // this works just fine, applet gets red:
  Color.red
  // using this instead of the above leads to error:
  //Color.getColor(this.getParameter("bgcolor"), Color.white)
 );
}

public void start() {
}

public void stop() {
}

public void destroy() {
}

public void paint(Graphics g) {
}

public String getAppletInfo() {
}
}
Knute Johnson - 01 Mar 2008 18:28 GMT
> That was a while ago when I last time worked with Java, so I might be
> missing some recent security development. Any way:
[quoted text clipped - 38 lines]
>  }
> }

Your problem is in trying to read the System properties not applet
parameters.  I don't think this method has any use because, on my system
at least, there are no color values in the System properties.  I don't
know if they were removed at some point or what.  Use a decimal or hex
number and create your color with that instead of the string name.  The
Color.decode() ought to be very useful here.

Signature

Knute Johnson
email s/nospam/knute/

Roedy Green - 02 Mar 2008 01:01 GMT
try http://mindprod.com/jgloss/runerrormessages.html#NOTINITED

for the various causes of the not inited error.

--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Roedy Green - 02 Mar 2008 01:19 GMT
>  //Color.getColor(this.getParameter("bgcolor"), Color.white)

getColor gets system properties, something you need to sign the applet
for.

review http://mindprod.com/jgloss/applet.html#RESTRICTIONS

for the list of things you may not do without signing the applet.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.