java

What's the best way to secure a query string with Java?

When a user signs up in our Struts application, we want to send them an email that includes a link to a different page. The link needs to include a unique identifier in its query string so the destination page can identify the user and react accordingly. To improve the security of this system, I'd like to first encrypt the query string ...

RMI and exceptions

I am new to using RMI and I am relatively new to using exceptions. I want to be able to throw an exception over RMI (is this possible?) I have a simple server which serves up students and I have delete method which if the student doesn't exist I want to throw a custom exception of StudentNotFoundException which extends RemoteException...

Is there a varargs null check function in Java or Apache Commons?

I've got four variables and I want to check if any one of them is null. I can do if (null == a || null == b || null == c || null == d) { ... } but what I really want is if (anyNull(a, b, c, d)) { ... } but I don't want to write it myself. Does this function exist in any common Java library? I checked Commons Lang and didn't...

Java Heap Space error in glassfish

I am using a fresh Glassfish install with very little customizations. I have a Message Driven Bean (ObjectUpdateMDB) that listens to a topic, then updates the object it receives in a database. There are a lot of objects being updated. After a while of running I get this exception: SEVERE: JTS5031: Exception [org.omg.CORBA.INTERNAL: ...

Searching for Generic Asynchronous Java Job Execution Framework / Library

I am looking for a generic asynchronous Java job execution framework that could handle Callables or Runnables. It would be similar to java.util.concurrent.ExecutorService, (and possibly wrap ExecutorService), but it would also have the following features: The ability to persist jobs to a database in case the application goes down while...

Read URL to string Java with cookies

Hi, I need to read from an URL to String, and this is not a problem, but some sites demand for cookies to be enabled to provide content. So I need a way to get a content even if the cookies need to be accepted? Cheers ...

C# Interop with C vs Interop with Java: Which is better/easier/faster?

I have an application in C# that currently authenticates to LDAP. We want to extend functionality to support IBM's Tivoli Access Manager, which is comprised of a Policy Server, and an LDAP server (and other modules as well). Unfortunately authenticating with the LDAP server for our customer is not acceptable, thus we must bind with the p...

Eclipse plugin - Class object

I am creating an eclipse plugin, and I need Class object of selected file, not IType. Is it possible, and how is the best way to do it? Edit: when I think about it, the best way is to add it like run as (like junit, profiler, or other plugins are doing). I suppose they must have access to Class (if X is class in question), because they ...

Java 6 on Mac PowerPC with Mac OS X 10.4

Is it possible to get Java 6 running on a Mac PowerPC with Mac OS X 10.4? AFAIK SoyLatte is only available for Intel processors. ...

Read error response body in Java

In Java, this code throws an exception when the HTTP result is 404 range: URL url = new URL("http://stackoverflow.com/asdf404notfound"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.getInputStream(); // throws! In my case, I happen to know that the content is 404, but I'd still like to read the body of the r...

Tomcat service: quotes in wrapper.conf

I wanted to set up remote debugging from Eclipse. Tomcat is running as a service on windows. That bit is fine, a quick google pointed me towards the correct settings to add to wrapper.conf to enable this. There were entries already in wrapper.conf, so I copy/pasted the last entry and modified it: wrapper.java.additional.8="-Djava.end...

Java Nimbus LAF with transparent text fields

I have an application that uses disabled JTextFields in several places which are intended to be transparent - allowing the background to show through instead of the text field's normal background. When running the new Nimbus LAF these fields are opaque (despite setting setOpaque(false)), and my UI is broken. It's as if the LAF is ignor...

Java - switching back to main thread?

Hi How can I switch back to main thread from a different thread when there is an exception. When an exception is raised on a child thread, I want a notification to be sent to main thread and execute a method from the main thread. How can I do this? Thanks. Additional information I am calling a method from my main method and starting ...

Problem writing to serial port from Java

Duplicate of Implementation of Xmodem Protocol in Java Hi, I've got to implement the xmodem protocol to receive a file from a target device. For that, I have to request the file, then for every 128-byte packet received, I have to send an acknowledgment. My problem is when I open an outputstream to request the file, it will write but...

java lang verify error

java.lang.VerifyError: (class: a method: parse signature: ()Z) Incompatible argument to function public boolean parse() { } What does this error mean and how to fix these kind of errors ...

Java JVM time zone names via java.text.SimpleDateFormat

Javadocs on java.text.SimpleDateFormat state the following on the "z" pattern letter: z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 General time zone: Time zones are interpreted as text if they have names. For time zones representing a GMT offset value, the following syntax is used ... Question ...

The case against checked exceptions

For a number of years now I have been unable to get a decent answer to the following question: why are some developers so against checked exceptions. I have had numerous conversations, read things on blog, read what Bruce Eckel had to say (the first person I saw speak out against them). I am currently writing some new code and paying...

Netbeans 6.5: Change an environment variable during run/debug/test?

Up until Netbeans 6.1, I was using the following recipe to change the PATH environment variable during run/debug/test tasks: in the build.xml file I included: <property environment="env"/> <target name="-init-macrodef-java"> <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1&quot;&gt; <at...

recognise combobox deselect when using Swing + models?

I'm trying to write a nice GUI in Swing that uses the proper Model-Delegate pattern as much as possible. I have a JComboBox that when changed, needs to update the model with the new data. To get the currently selected item, I am using: fooCombo.addItemListener(new ItemListener() { public void itemStateChanged(final ItemEvent arg0) {...

Flow of struts

Can anyone tell me the control flow of struts. Which program will be called first? ...