Andreas Pax Lück

+ Follow
since Nov 04, 2009
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andreas Pax Lück

Hi friends.

I'm using the Jython library in my Java project in order to provide Python code execution.

I'd like to restrict access to specific Java classes/packages as well as invocations of Jython's built-in functions.

I implemented an own class loader and set it in Jyhton interpreter:

But the Jython library also provides Python's built-in functions that aren't implemented as Java code, so I cannot catch them with the custom class loader. Here's a list with those supported functions: Built-in functions

How can I detect disallowed function invocations (for example: open(filename[, mode[, bufsize]])) in Pyhton user code? Is there any special hooking mechanism that can be used during code parsing or execution?

I reversed some Jython classes and searched for any possibility but its intrinsic processes aren't very easy to understand.


11 years ago
Alright, my friends... This was very tricky... I just like this forum! Your good advices navigated me to the intrinsic issue!

Actually, there were two issues who prevented my application from terminating. The first very important thing is:

  • If you use tray icons you have to remove them from the system bar - otherwise, the JVM won't quit.

  • You can just obtain (and remove) all icons with following piece of code:

    And my second fail was that I created a special Timer thread that enqueued items into the event dispatching queue, continiously, if the application wasn't currently minimized.

    I'm glad that we localized all these bugs because this wasn't easy to find out.

    Very good work! Thank you so much!

    Best regards

    12 years ago
    Hi friends! I hope you can help because I cannot see the mistake.

    I've got a GUI application with a JFrame, a JOptionPane which appears and becomes closed and some daemon threads. The default close operation of the JFrame is set to "hide on close". Previously, I terminated my application by calling System.exit(0). But now, I have to replace this approach because of some GUI tests with the FEST library.

    I tried to interrupt all created daemon threads and to invoke the dispose method on the JFrame but the JVM doesn't exit. In the end there are following threads running:
  • Thread [AWT-Shutdown] (Running)
  • Daemon Thread [AWT-Windows] (Running)
  • Thread [AWT-EventQueue-0] (Running)
  • Thread [DestroyJavaVM] (Running)

  • I also tried to dispose all still existing frames and windows with following piece of code:

    The console outputs show following (curious) windows. I only know some of them:

    all frames:

    .::. Glass Wave Spider - Server control panel
    all windows:
    de.paxoftwer.gws.server.gui.view.ConsoleFrame[mainFrame,464,204,752x595,invalid,hidden,layout=java.awt.BorderLayout,title=.::. Glass Wave Spider - Server control panel,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,9,36,734x550,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]

    What is "SharedOwnerFrame" or "Frame" or "PopupMessageWindow"?

    Finally, the meantioned threads are keeping alive and the JVM doesn't terminate. I tried to reproduce this issue with a very simple example but the invalid behavior didn't occur. I don't see the essential difference between this example and my application. The application uses the system tray (if this is important).

    Thanks for your help.

    Best regards

    12 years ago
    Thanks, my friends. Now, I found the really stupid bug in my code.

    Take a look at the stack trace: It's eye-catching that the handler method of the windows closed event invokes the handler method of the cancel button which triggers dispose. Usually, it cannot be possible that this is repeated all the time.

    But obviously, I created a loop with help of the windows closed handler. Following important (forgotten) method from the piece of code above creates this loop:

    Thanks for all your help. You showed me the possible area of the bug.

    Best regards

    Uncle PAX
    13 years ago
    This equals all the time:

    at client.gui.FileTransmissionDialog.dispose(
    at client.gui.FileTransmissionDialog.cancelButtonActionPerformed(
    at client.gui.FileTransmissionDialog.thisWindowClosed(
    at client.gui.FileTransmissionDialog.access$6(
    at client.gui.FileTransmissionDialog$7.windowClosed(
    at java.awt.Window.processWindowEvent(Unknown Source)
    at javax.swing.JDialog.processWindowEvent(Unknown Source)
    at java.awt.Window.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at Source)

    13 years ago
    It's an endless GIF animation. But even if I remove this GIF image from the dialog this bug occurs.

    I was running Java 1.6_18 and now I tried 1.6_21. No success.
    13 years ago
    The JDialog's further highlights:

  • uses CardLayout
  • shows an animated GIF file with animation loop
  • contains a JTable with an own cell renderer (nothing special)
  • 13 years ago
    Hi Java friends.

    I'm confronted with a really strange issue. I cannot reproduce the problem in another case, but only in this single case. Perhaps, you did already gather some experiences with this:

    I'm showing a modal JDialog in a main frame context. The default close operation was set on DISPOSE_ON_CLOSE. As soon as I close the JDialog its dispose method is invoked continuously all the time. It never ends and the CPU usage increase on 100%.

    I checked similiar JDialogs of my application but the strange behaviour doesn't occur. The main frame which creates the JDialog instance doesn't store any reference to it and the JDialog doesn't execute any further threads.

    I have no idea what's going wrong. Is it a JVM bug? Or is there's something wrong with my implementation?

    Best regards

    Uncle PAX

    This is a piece of the source code. The file transmission thread isn't active when the JDialog becomes disposed. But the AWT event dispatching thread calls the dispose method immediatly without blocking the AWT queue.
    13 years ago
    these are interesting information. does the nethood location also have a common caption? i realized that its name isn't "NetHood" on systems with a different language than english.
    14 years ago
    ok, that's really bad.

    thanks for your help.

    best regards

    14 years ago
    Hi friends!

    I need to display network shares in a JFileChooser. It's possible to show the network shares of the concerning host via the network button. But I'd also like to display them hardcoded by invokation of:

    The JFileChooser doesn't do nothing in this case. If I do specify the explicit share ressource it works:

    I don't know the shared folders. So, I want to show the list of all shared folders of the concerning host. Is this impossible?

    Best regards

    14 years ago

    i've got exactly the same complication. but i don't really understand what's meant with swing in this case. does the swing library contain a special resource loader or something else?

    my animated gif isn't set on unlimited animation repetition. but i have to show the gif animation more than one time anyhow.

    how can i reload the image file again?

    best regards

    14 years ago
    Hi Rob.

    Thanks for your answer. I'd like to excuse my belated reply, I was a bit busy in the previous weeks.

    I informed me about this multicast communication. The key note is that this connectionless kind of communication provides the possiblity that participants join any group and every message which is sent to this group will be obtained by every group member. A group is defined by a class D network IP address.

    I think, this approach would solve my concern. But I've got a question: The group is defined by a class D address. If another (further) application uses the same IP in any way, does my application produce any conflicts?

    I implemented a ping prototype which does only work localy. This means, if the client and the server are running on the same machine, the ping request arrives the server. But if there's a further server on the network running on another machine, no ping comes in.

    This is the client's ping:

    And here's the server:

    As already mentioned, it does only work if server and client are running on the same computer. The computers are connected via a router on my network. The client code for the listening to answers isn't shown in the code above. First, it starts the listener in a separate thread and then it sends the ping.

    Do you know what's wrong with my solution?

    Best regards

    Hi friends!

    I searched the internet about my problem, but didn't really find satisfying answers. This thread seemed to be interesting:

    I have to develop a kind of server application which does listen, among other things, for ping requests and answer to the specific machine. This client machine doesn't know the IP address. So I tried to ping to but this IP was rejected. Is there any way to send a request to all participants without the knowledge of their IPs?

    Best regards