Skip to content

Why use finally

I never properly understood the use of the finally statement. Can anyone tell me what the difference is between: on the one hand and: On the other Answer They differ if the try-block completes by throwing a java.lang.Throwable that is not a java.lang.Exception, for instance because it is a java.lang.Error suc…

“unable to locate Spring NamespaceHandler” error

I’m creating a stand-alone Sava application with Spring, to handle the JDBC access. The application works fine on every test and I decided that I need a jar to be deployed our clients. They might not have spring in their classpath, so I used maven-assembly-plugin to handle the jar creation with dependen…

Content-Length header already present

I am using the Apache HttpClient (4.1) included in Android to execute a HttpPut. I have verified that I only have 1 content-length header. However, every time I send the request, I get a protocol exception about the Content-Length header already specified. Caused by: org.apache.http.ProtocolException: Content…

Is there an equivalent to memcpy() in Java?

I have a byte[] and would like to copy it into another byte[]. Maybe I am showing my simple ‘C’ background here, but is there an equivalent to memcpy() on byte arrays in Java? Answer You might try System.arraycopy or make use of array functions in the Arrays class like java.util.Arrays.copyOf. Bot…