Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Applet cannot read PARAM values: security exception

Reply
Thread Tools

Applet cannot read PARAM values: security exception

 
 
VK
Guest
Posts: n/a
 
      03-01-2008
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() {
}
}

 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      03-01-2008
VK wrote:
> 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() {
> }
> }
>


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.

--

Knute Johnson
email s/nospam/knute/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      03-02-2008
try http://mindprod.com/jgloss/runerrorm...html#NOTINITED

for the various causes of the not inited error.



--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      03-02-2008
On Sat, 1 Mar 2008 06:58:12 -0800 (PST), VK <(E-Mail Removed)>
wrote, quoted or indirectly quoted someone who said :

> //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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML::Template->param() : You gave me an odd number of parameters to param()! Dave Perl Misc 5 04-26-2011 02:44 AM
When Javascript call applet method, applet throw security exception. crazytazo Java 3 10-06-2008 11:12 PM
Overload by deriv class param; call w base class param ectoplasm C++ 12 07-28-2005 08:20 AM
newLine in <applet>'s <param> tag peter10 Java 5 11-22-2004 05:27 AM
XSLT: How to replace param name with this param's value ? Geathaa XML 2 07-30-2003 06:48 AM



Advertisments