Hi,
I'm wondering why the "assert" keyword is so underused in Java? I've almost never seen them used, but I think they're a great idea. I certainly much prefer the brevity of:
assert (param != null : "Param cannot be null");
to the verbosity of:
if (param == null) {
throw new IllegalArgumentException("Param cannot be null");
}
...
Hello,
We're using Spring 2.5.4/Hibernate 3.2/Websphere Application Server 6.1.0.17. We've deployed the application on an AIX box. The next day when I come in, I try to log into the application. I get this exception on the page:
Error 500: Request processing failed; nested exception is org.springframework.dao.DataAccessResourceFailu...
Is there anybody who has successfully accessed a Web service from an Oracle stored procedure? If so, was it a Java stored procedure? A PL/SQL stored procedure?
Is there any reason why I should not be trying to access a WS from a stored proc?
Here are a couple refs that I found so far
Database Web Services
Calling external Web Servi...
Question: Is excepion handling in Java actually slow?
Conventinal wisdom, as well as a lot of Google results, says that exceptional logic shouldn't be used for normal program flow in Java. Two reasons are usually given, 1) its really slow - even an order of magnitude slower than regular code (the reasons given vary), and 2) its messy ...
While looking at a micro-optimization question that I asked yesterday (here), I found something strange: an or statement in Java is running slightly faster than looking up a boolean value in an array of booleans.
In my tests, running the below algorithms on long values from 0 to 1 billion, alg1 is about 2% faster. (I have altered the ...
im trying to kick off a Runnable classes run method however i keep getting a NullPointerException, Im using WebSpheres commonj.workmanager to get an instance of executorService.this is the code im using.
executorService.execute(new Runnable()
{
public void run()
{
System.out.println("Inside run ()method..");
...
Let's say I have a List object and an iterator for that list.
Now I sort the list with java.util.Collections.sort()
What happens to the iterator?
Is its behavior still defined and can it still be used?
If not, can I prevent destroying the iterators for the list?
I know, this problem could be circumvented by changing the program de...
Hello everybody,
I am trying to use a RS-232 serial port on my PC with javax.comm class. I am newby on that API, so first of all I go through the documentation and I find out that the first thing you should do is "list" all the ports from the class CommPortListener and pick up one of them.
That worked just fine! Problem is, now, that m...
In Java, the hash code for a String object is computed as
s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
using int arithmetic, where s[i] is the ith character of the string, n is the length of the string, and ^ indicates exponentiation.
Why is 31 used as a multiplier?
I understand that the multiplier should be a relatively large prime ...
Hi,
I have a collection of HTML documents for which I need to parse the contents of the <meta> tags in the <head> section. These are the only HTML tags whose values I'm interested in, i.e. I don't need to parse anything in the <body> section.
I've attempted to parse these values using the XPath support provided by JDom. However, this i...
I'm using db4o 6.4.54 in OSGi environment as a model storage. Every time I restart OSGi framework, the database appears to be empty, although the file is there and not empty definitely.
I have the following configuration:
A core bundle, which depends on the standard db4o_osgi bundle provided by db4o. An UI bundle, which depends on the ...
I have a JPanel to which I'd like to add JPEG and PNG images that I generate on the fly.
All the examples I've seen so far in the Swing Tutorials, specially in the Swing examples use ImageIcons.
I'm generating these images as byte arrays, and they are usually larger than the common icon they use in the examples, at 640x480.
Is there ...
I am using a JSP bean and when I do an assignment to a new object, it gets over-written on a submit to the previous object.
<jsp:useBean id="base" class="com.example.StandardBase" scope="session" />
...
//base object id = 396
base = new Base()
//base object id = 1000
and on a resubmit of the page I get
<jsp:useBean id="base" class="...
To implement data access code in our application we need some framework to wrap around jdbc (ORM is not our choice, because of scalability).
The coolest framework I used to work with is Spring-Jdbc. However, the policy of my company is to avoid external dependencies, especially spring, J2EE, etc.
So we are thinking about writing own han...
What is the most direct and/or efficient way to convert a char[] into a CharSequence?
...
I'd like to write a plugin that does something with the currently edited file in Eclipse. But I'm not sure how to properly get the file's full path.
This is what I do now:
IFile file = (IFile) window.getActivePage().getActiveEditor.getEditorInput().
getAdapter(IFile.class);
Now I have an IFile object, and I can retrieve it's path...
Here is what I'm doing :
Create a workbook in memory (book = new HSSFWorkbook(), ...)
Save it to disk (book.write(...))
Open in Excel (ok)
Create another workbook in Excel, which links to the first one (=PoiWorkbook?xls!A1)
Close Excel
Then everytime I open the second workbook again, all the links are #N/A, unless I also open the POI...
The title pretty much sums it.
...
This is a design question and good practice question. How do you structure your Java web development such that a lot of logic is not in the JSP file. Should you use any of the JSP tags for if structures or loops. I see a lot of code where the logic is hard to follow because of poorly designed JSP files. And then when you want to outp...
Hi
I recently started facelets development, and a couple of days ago made my first useful custom tag. Now I would like to have autocompletion support in eclipse, like I have for standard taglibs like h, c and ui.
Is there any easy way (less than 30 min work) to enable tool support for custom tags?
I'm using eclipse 3.4 with jboss tool...