java

Issue Parsing XML Document using SaxParser - 2047 character limit?

I have created a class that extends the SaxParser DefaultHandler class. My intent is to store the XML input in a series of objects while preserving the data integrity of the original XML data. During testing, I notice that some of the node data was being truncated arbitrarily on input. For example: Input: <temperature>-125</temperatu...

RMI: Does the client have to have all implementations or just interfaces?

Does client have to have all implementations or just interfaces? In details: let we have remote interface Foo: public interface Foo extends Remote { FooMessage getFooMessage () throws RemoteException; void setFooMessage (FooMessage fm) throws RemoteException; } Communication between client and server is happening by means of ...

Efficient way to convert unknown objects to appropriate Method.invoke arguments?

I'm writing a reflection-based RPC service that gets arguments passed in via a variety of mechanisms. Sometimes the arguments correctly match the parameter type, sometimes they're always strings, and sometimes they're wrapped up in dynamically typed "scripty" objects that need the appropriate value extracted out. Before I can call meth...

Anyone have any luck writing a very fast tiff viewer/editor in Java?

I have explored several leads (sample apps) in the JAI/ImageIO arena, and have so far come up lacking in performance. It may just be that Java is not the platform for fast viewing/scaling/editing of tiff files. I am looking to produce performance similar to Irfanview, but so far haven't found what I am looking for. JAI\ImageIO seems p...

Mozilla Parser for screen scraping

I'm writing an app that takes in HTML code of a page and extracts certain elements (such as tables) of the page and returns the html code for those elements. I'm attempting to do this in java using the Mozilla parser to simplify the navigation through the page, but I'm having trouble extracting the html code needed. Maybe my whole appr...

Disk caching http Library for Java: Does it exist?

Apache HttpClient does not have caching as far as I can see so my question is do you know about a Http library that can cache to disk? It would be fun to implement it myself but before i do it, it is better to check if it already exists :-) Requirements: Support for Http 1.1 Can cache to disk (ex: a folder) Support for a maximum cache s...

Catching webservice exception with CXF: NoClassDefFoundError: SOAPFaultBuilder

Hey all, I've been using Apache CXF wsdl2java generated code to call methods from a webservice for some time now, which so far has been working fine.. The problem I'm having is that when the webservice (implemented just down the hall from me) legitimately throws a soap exception, CXF comes up with the following Error message: Could ...

Bad to use very large strings? (Java)

Are there any negatives to creating huge strings? For instance, if we're reading in text from a potentially huge text file: while (scanner.hasNext()) { someString += scanner.next(); } // do something cool with someString Would processing the file line by line be (generally) a better solution, and why? Thanks ...

Good open-source Swing/Java component for doing MSN-like popup notifications

Hi there, I am looking for a good open-source Java component for implementing popup notifications in a Swing desktop application. The component should be able to function like the ones commonly seen in instant messaging applications such as MSN Messenger, so that just as someone sends you a message, a little ontop window slides up from...

Hibernate and Scala

I have been toying with Scala and I was wondering if anyone had had any experience with using hibernate and mysql as a persistent store for scala objects? Does it work out of the box or is there a lot to do? ...

WITH statement in Java

In VB.NET there is the WITH command that lets you omit an object name and only access the methods and properties needed. For example: With foo .bar() .reset(true) myVar = .getName() End With Is there any such syntax within Java? Thanks! ...

Why can't I retrieve an item from a HashSet without enumeration?

I'm looking for insight into the heads of HashSet designers. As far as I am aware, my question applies to both Java and C# HashSets, making me think there must be some good reason for it, though I can't think of any myself. After I have inserted an item into a HashSet, why is it impossible to retrieve that item without enumeration, hard...

JSF - calling FacesContext.getCurrentInstance() in a static context

Am I right in thinking that this may not be the best idea: private static Application app = FacesContext.getCurrentInstance() .getApplication(); ... or any other call to FacesContext.getCurrentInstance() when you can't be sure that the current thread of execution is due to a servlet request? The way I understand it, FacesCont...

Multiplying long values?

class Main { public static void main (String[] args){ long value = 1024 * 1024 * 1024 * 80; System.out.println(Long.MAX_VALUE); System.out.println(value); } } Output is: 9223372036854775807 0 It's correct if long value = 1024 * 1024 * 1024 * 80L;! ...

Ways to standardize logging in a large Java application

In a large application logging is essential, but when many developers work on the code, the logs can become chaotic. One might write: log.info("Loaded " + rowCount + " recodrs from the database."); Another might do something like: log.debug("Records read={}", rowCount); A third developer might think this is the proper way: log.tra...

Which Java framework for building social/collaborative app ?

I would like to get your opinion on this topic : I'd like to build some social/collaborative app : not much media sharing, but mainly tagging, collaborative text content (as wikis), user profile, tagging and some points system (digg/hackernews-like ?) ...

How to create a true singleton in java?

I am facing a problem with my singleton when used across multiple class loaders. E.g Singleton accessed by multiple EJBs. Is there any way to create a singleton which has only one instance across all class loader? I am looking for pure java solution either using custom class loader or some other way. ...

How can I get aop:config to work with BeanFactoryPostProcessor in spring

I am trying to prototype some aop logic to handle logging logic. While I am doing it, I thought I would be nice to use BeanFactoryPostProcessor (not BeanPostProcessor) to automatically set bean name to 'name' property of target beans, so I can use it for logging if needed. I got the aop autoproxying logic (aop:config) working before...

JAXB - Add a node to the XML as html link

I have a basic JavaBean in my service layer and originally it was not designed for marshalling. This object is used by both JAX-WS, JAX-RS, and Servlets in other layers of my application. I want to take advantage of a drill down type effect in my REST services so my question is: How do I make one of the fields/properties of the javabe...

Spring RDBMS vs JDBCTemplate

How much of a performance difference is there between these two models? What kind of reasons are there for using one over the other? In my application I am using a lot of the same statements over and returning both Objects and primitives. There are a few oracle stored procedure calls and performance on these is a top priority. ...