java

Simple XML deserialization

I am trying out the Simple XML serializer. I am more interested in deserialization from XML->Java. Here is my code as a unit test: import java.io.StringReader; import java.io.StringWriter; import junit.framework.TestCase; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Root; import org.simpleframework.xml.Seri...

Problem with WSDL

I've recently been working on an ACORD P&C compliant web service and have run into some trouble with errors from wsimport saying it is unable to parse one of the xsd files. The error message is: [ERROR] Unable to parse "D:\projects\DICACORD\DicAcordQuoteRq.xsd" : Illegal character in opaque part at index 2: D:\projects\DICACORD\...

Apache Velocity: Is there a standard way of verifying the correctness of a template from the command line?

Our website uses the Apache Velocity template language. Our Content Management System already checks any generated XML documents for well-formedness. We've been asked to check documents to catch Velocity syntax errors before pushing the files to the live site. Is there a standard way of verifying the correctness of a Velocity template...

what is the difference between 'super' and 'extends' in Java Generics

I am trying to learn Java generics. I am not clear when you will use <T extends Foo> and when you will use <T super Foo>. What do each one of these things mean about T? Lets say I have <T extends Comparable> and <T super Comparable>, what do each of these mean? I've read several tutorials at sun.com but I'm still lost. Can somebody illu...

How can I inherit the system's anti-alias setting for painting text to off-screen images like swing does?

When I run my swing GUI applications under Java 6, they automatically use my configured sub-pixel anti-alias settings for all fonts. The result is much improved over standard AA options. But when I paint to an image I can find no way to initialize the graphics context to use the system's AA configuration. Trying to play around with Ja...

Can I merge Emma coverage data from unit and integration test targets?

We have our TeamCity builds set up using a build chain, so that our unit tests and and integration tests can run in parallel when triggered by a commit: Build Chain - dependant on: Unit tests Integration tests I am looking for a way that we can combine/merge the coverage data generated by the unit and integration tests in the build...

Javadoc for JavaFX (not JavaFX api!); from source? from project scenegraph?

The API JavaFX comes with is for the JavaFX langage, which I have one reason to learn, but more reasons not to. I know Project Scenegraph (scenegraph.dev.java.net, AKA Scenario) is ambiguously the same library. I would just generate javadocs from Project Scenegraph, but it hasn't seen an update since 2007 and the mailing lists are dead. ...

What does "disabled echoing" means?

The readPassword() method of the Console class has echoing disabled. What's echo? ...

Socket closing problem - last portion of data is lost.

I have a Java program that accepts connections, receives HTTP requests and sends HTTP replies and some data stored in file (this is a part of caching proxy). Removing everything irrelevant, my code looks like this: FileInputStream fileInputStream = new FileInputStream(file); OutputStream outputStream = socket.getOutputStream(); byte[] b...

How can I change the size of frame?

I have a frame which has a menu item for choosing the font and its size, when the user choose her/his font size, all the text of buttons, panels, which are in my program (has many frames) will be changed but they will be bigger than the size of frames. What should I do for changing the size of my frames at run-time? Edit: Also with usin...

Curly brackets in JSP code

I have a JSP page I am working on and I am confused by some of the formatting/coding. There are sections where it's obvious what's going on: <% if (.....) { %> <input type=hidden name="blahblah" value="moreblah"> <% } %> But now I see sections where I have no idea how or why it works/compiles: <% { ...

Best approach to serialize XML to stream with Java?

We serialize/deserialize XML using XStream... and just got an OutOfMemory exception. Firstly I don't understand why we're getting the error as we have 500MB allocated to the server. Question is - what changes should we make to stay out of trouble? We want to ensure this implementation scales. Currently we have ~60K objects, ea...

Search email inbox using javax.mail

I was trying to see if there was a way to search an email inbox from javax.mail. Say I wanted to send a query and have the it return emails to us. Can we parse returned HTML and extract data. Also, if the above is possible how would I "translate" those messages returned by that server to POP3 messages? E.g. we have extracted: Subject: F...

Java's 'tnameserv' takes 3+ minutes to be "Ready", why?

I'm trying to help a dev of an app I'd like to use trouble shoot a problem utilizing Corba Server on Linux. I narrowed down the problem to tnameserv taking over 3 minutes to become ready after invocation. What exactly is tnameserv trying to do in those 3 minutes and is there anyway I can speed it up? The app failed because it tried ...

How to call stored procedure to read return value and out parameter both in Spring?

I have a stored procedure which returns an Integer as well as an Out Parameter which is of type VARCHAR. I am using Spring 2.5.6 and unable to find a way to read the return value as well as Out Parameter at the same time. SimpleJdbcCall.executeFunction(..) have a facility to read the stored procedure return value but no facility for Ou...

Check String whether it contains only Latin characters?

Greetings, I am developing GWT application where user can enter his details in Japanese. But the 'userid' and 'password' should only contain English characters(Latin Alphabet). How to validate Strings for this? ...

Is there an equivalent to Boost::Python for Java?

I've been working with Boost::Python to expose some high-performance code to python recently, and it's just a dream to work with. I'd like to be able to maintain a single C++ codebase and expose it to Python via Boost, and to Java as well. I know about JNI, but I was wondering if there's something equivalent to Boost::Python, but targe...

QuickFIX/J Multiple Logon

Currently, the example provided in QuickFIX/J, only allow single executor to talk with single banzai. From the settings in configuration file : SenderCompID TargetCompID Their behavior is as follow : Executor - I only allowed single connection from someone called Banzai Banzai - My name is Banzai, and I will only connect to Exectuor ...

Why is addBirth method returns null???

I have this method but in run-time it will be thrown nullpointerexception,why? my method: public static boolean isAddBirth(String name, String family, String fatherName, String mName, String dOfBirth, String pOfBirth) { ResultSet rst; boolean bool = false; Statement stmt; try { stmt = conn.createStatement(); ...

Java: Nested Tree Structure

I am looking for a way to create a nested tree structure in my GUI. I have a few "boxes" that have items in them. I would like the boxes to be collapsed but expanded when clicked on, like the way folders are navigated on the sidebar. The first way I considered was treating the "boxes" as JList, with the items in each box stored in a nest...