I have an XSLT Transformer in Java (actually its Apache FOP rendering to PDF) where I have already set a custom URIResolver (for 'servlet-context:' URIs).
Now I need to use another URIResolver in addition (a CatalogResolver for caching DTDs).
Do I need to write my own URIResolver now that calls either of the two or is there a better w...
I have this horrible habit of typing the below and not catching it until well into testing:
int i = 1;
int j = 2;
i =+ j; //i equals 2, not 3 as intended; assign only, + is unary and works on the j
The correct version, of course, would be
int i = 1;
int j = 2;
i += j; //i equals 3, as intended with additive & assignment compound o...
Hi,
I am trying to execute a command (eg. ps -ef | grep apache) using ProcessBuilder and Process. The code works as long as the output of 'ps -ef' is small. But if the output is too big, the program hangs. Is there a way to fix this? Here is my code based on [http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html]
#### Progra...
Is there an Api for creating a thumbnail from a JPEG
...
Is there a standard way to define a JPA entity that has columns with PostgreSQL network address data types?
Im using OpenJPA
...
I'd like semantics similar to C#'s ref keyword.
...
What's the best BDD framework to use with Java? Why? What are the pros and cons of each framework?
I've found couple of them here, but I'm not sure which one to choose.
Does it make sense to use a BDD framework if I already use a mocking library (e.g. Mockito)?
...
I have the following bit of code in a method called by clicking the send button, or pressing enter in the message text field in a piece of code.
// In class ChatWindow
private void messageTextAreaKeyPressed(java.awt.event.KeyEvent evt) { // Event handler created by Netbeans GUI designer to call this method.
if(evt.getKeyC...
this code is correct??
String note = "text.txt";
FileWriter file = new FileWriter(note);
Scanner sc = new Scanner(System.in);
System.out.println("Enter your name:");
String name = sc.next();
file.close();
How can I pass this file to the program as a command line argument???
...
Something like Environment.StackTrace in .Net.
BTW, Thread.dumpStack() is not what I want - I want to get the stacktrace back, not print it out.
...
Can someone please help with some code for creating a thumbnail for a JPEG in Java.
I'm new at this, so a step by step explanation would be appreciated.
...
How do I search for a specific user object in LDAP that has an associated x509 certificate? Do I need to encode it in a certain way? It looks like the attribute is userCertificate based on looking at JXplorer.
Note: Accessing Active Directory through LDAP
...
Possible Duplicate:
When do you use Javas @Override annotation and why?
From the javadoc for the @Override annotation:
Indicates that a method declaration is
intended to override a method
declaration in a superclass. If a
method is annotated with this
annotation type but does not override
a superclass method, com...
consider this scenario:
I have loaded a Parent entity through hibernate
Parent contains a collection of Children which is large and lazy loaded
The hibernate session is closed after this initial load while the user views the Parent data
The user may choose to view the contents of the lazy Children collection
I now wish to load that col...
Looking through some java code and this just does not seem right. To me, it looks like every time you call projects, you will get a new hashmap, so that this statement is always false
projects.get(soapFileName) != null
Seems like it should have a backing field
public static HashMap<String,WsdlProject> projects = new HashMap<String,Ws...
Hi, I'm involved in a project in which we're doing a visual editor (written in Java). Now, I'm trying to make curves that join two different objects that I'm painting in a class that extends JPanel (this class is what I'm using to paint, inside a JFrame, overriding the method paintComponent). I'm in troubles because I'm using the class Q...
I am using
<url-pattern>/*</url-pattern>
to map all the requests to one sevlet,where i do all the authentication work.
but I want to skip some static content (like css files).so I tried fowrding them from
that sevlet to where the resource file is
if(isResourceFile){
RequestDispatcher dispatcher = getServletContext().getRequestDi...
I want to do some logging while executing my JUnit test. In JUnit 3.x it was always easy to obtain the name of the currently running test case, no matter how the test case was instantiated:
public void testFoo() throws Exception() {
String testName = this.getName();
// [...] do some stuff
}
In JUnit 4 things seem to be not so easy...
This question has been asked in a C++ context but I'm curious about Java. The concerns about virtual methods don't apply (I think), but if you have this situation:
abstract class Pet
{
private String name;
public Pet setName(String name) { this.name = name; return this; }
}
class Cat extends Pet
{
public Cat catchMi...
I'm having this problem with the grails liferay-plugin:
localhost_liferay_portlet_WEB_INF_grails_app_views_test_view_gsp: 17: expecting anything but ''\n''; got it anyway @ line 17, column 170.
1 error
Here's the gsp:
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<div>
<h1>View Page</h1>
The map returned by renderV...