Skip to content

Tag: java

groovy call private method in Java super class

I have an abstract Java class MyAbstractClass with a private method. There is a concrete implementation MyConcreteClass. In my groovy test class I have I get an error that there is no such method signature for somePrivateMethod. I know groovy can call private methods but I’m guessing the problem is that…

Increasing JRE Memory Usage in Eclipse

I read in another question that you can increase the JRE memory allowance for an app through Window -> Preferences in Eclipse, but I can’t seem to find anything related to heap memory allocation. Editing -xms/xmx values in eclipse.ini doesn’t help since those are for Eclipse itself. Answer I be…

HttpURLConnection timeout settings

I want to return false if the URL takes more then 5 seconds to connect – how is this possible using Java? Here is the code I am using to check if the URL is valid Answer HttpURLConnection has a setConnectTimeout method. Just set the timeout to 5000 milliseconds, and then catch java.net.SocketTimeoutExce…

Using Regular Expressions

I am having problems trying to use the regular expression that I used in JavaScript. On a web page, you may have: Renewal Date: 03 May 2010
I just want to be able to …

What does the Java assert keyword do, and when should it be used?

What are some real life examples to understand the key role of assertions? Answer Assertions (by way of the assert keyword) were added in Java 1.4. They are used to verify the correctness of an invariant in the code. They should never be triggered in production code, and are indicative of a bug or misuse of a…

What is the “owning side” in an ORM mapping?

What exactly does the owning side mean? What is an explanation with some mapping examples (one to many, one to one, many to one)? The following text is an excerpt from the description of @OneToOne in Java EE 6 documentation. You can see the concept owning side in it. Defines a single-valued association to ano…