Skip to main content

[JAVA2D] Foxtrot

2 replies [Last post]
Anonymous

I have been asked to help evaluate Foxtrot for a client of mine.
Looking through the source code, I am a little concerned. Has anyone
used this or have any experience with it? I am especially concerned
about the following code:

try
{
AccessController.doPrivileged(new PrivilegedExceptionAction()
{
public Object run() throws ClassNotFoundException,
NoSuchMethodException
{
ClassLoader loader = ClassLoader.getSystemClassLoader();
conditionalClass = loader.loadClass("java.awt.Conditional");
sequencedEventClass =
loader.loadClass("java.awt.SequencedEvent");
Class dispatchThreadClass =
loader.loadClass("java.awt.EventDispatchThread");
pumpEventsMethod =
dispatchThreadClass.getDeclaredMethod("pumpEvents", new
Class[]{conditionalClass});
pumpEventsMethod.setAccessible(true);

// See remarks for use of this property in
java.awt.EventDispatchThread
String property = "sun.awt.exception.handler";
String handler = System.getProperty(property);
if (handler == null)
{
handler = ThrowableHandler.class.getName();
System.setProperty(property, handler);
if (debug)
System.out.println("[SunJDK14ConditionalEventPump] Installing AWT
Throwable Handler " + handler);
}
else
{
if (debug)
System.out.println("[SunJDK14ConditionalEventPump] Using already
installed AWT Throwable Handler " + handler);
}
return null;
}
});
}
catch (Throwable x)

It looks like this is getting access to some classes that it shouldn't
have access to.

Thanks for any help or advice.

Irv

--
Before you attempt to beat the odds, be sure you could survive the odds beating you.

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
michaelbushe
Offline
Joined: 2003-06-19

There's no need to be concerned about that code. If you look at the doc of the EvenetDispatchThread, then you'll see that the EDT is grabbing a System property to enable the installation of an exception handler. Foxtrot is enhancing Swing by installing it's own exception handler instead of having jave just log to the console when an exception occurs.

The security stuff is there since any code that accesses a property in the JDK must ask the SecurityManager if accessing a property is allowed by the thread/user/class. This is granted by default (though I've found it failing in JBuilder's debugger, not sure why yet). In an installation where the security setting were restricted so a user can't access a system property, then this would fail. Assuming you are using a standard Java App, this is nothing to be concerened about.

Rosenstrauch, David

I looked at Foxtrot a while back, but decided against using it. My concerns
were somewhat similar to yours: I felt that their dependence on particular
implementation details of Java's event handling system - and the fact that
they've needed to change Foxtrot in response to it breaking when changes were
made in the JDK - made it a bit risky for me to base a system on.

I'm not "diss"ing Foxtrot, here, btw. It's a nice piece of work, and an
elegant solution to the problem. But I just didn't feel like it met my needs
with those drawbacks. Just my $0.02, of course.

DR

> -----Original Message-----
> From: Irving Salisbury III [mailto:irv@DOTECH.COM]
> Sent: Friday, February 13, 2004 9:48 PM
> To: JAVA2D-INTEREST@JAVA.SUN.COM
> Subject: [JAVA2D] Foxtrot
>
>
> I have been asked to help evaluate Foxtrot for a client of mine.
> Looking through the source code, I am a little concerned. Has anyone
> used this or have any experience with it? I am especially concerned
> about the following code:
>
> try
> {
> AccessController.doPrivileged(new PrivilegedExceptionAction()
> {
> public Object run() throws ClassNotFoundException,
> NoSuchMethodException
> {
> ClassLoader loader =
> ClassLoader.getSystemClassLoader();
> conditionalClass =
> loader.loadClass("java.awt.Conditional");
> sequencedEventClass =
> loader.loadClass("java.awt.SequencedEvent");
> Class dispatchThreadClass =
> loader.loadClass("java.awt.EventDispatchThread");
> pumpEventsMethod =
> dispatchThreadClass.getDeclaredMethod("pumpEvents", new
> Class[]{conditionalClass});
> pumpEventsMethod.setAccessible(true);
>
> // See remarks for use of this property in
> java.awt.EventDispatchThread
> String property = "sun.awt.exception.handler";
> String handler = System.getProperty(property);
> if (handler == null)
> {
> handler = ThrowableHandler.class.getName();
> System.setProperty(property, handler);
> if (debug)
> System.out.println("[SunJDK14ConditionalEventPump] Installing AWT
> Throwable Handler " + handler);
> }
> else
> {
> if (debug)
> System.out.println("[SunJDK14ConditionalEventPump] Using already
> installed AWT Throwable Handler " + handler);
> }
> return null;
> }
> });
> }
> catch (Throwable x)
>
> It looks like this is getting access to some classes that it shouldn't
> have access to.
>
> Thanks for any help or advice.
>
> Irv

==============================================================================
This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.
==============================================================================

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".