java

Why is java secure coding important?

I'm having trouble understanding why java secure coding is important. For example, why is it important to declare variables private? I mean I get that it will make it impossible to access those variables from outside the class, but I could simply decompile the class to get the value. Similarly, defining a class as final will make it impo...

Is there a DTD or Schema file for jsp tag files?

I am writing some JSP 2.x tag files. I have searched for a few hours now, but I was not able to find doctype/schema definitions/dtds for jsp based tag files. Does anybody knows if there are dtd/schema files to ease the pain of writing those tag files? It's pretty painful to not have auto completion and so on in eclipse. I have to check ...

Java Enums, JPA and Postgres enums - How do I make them work together?

We have a postgres DB with postgres enums. We are starting to build JPA into our application. We also have Java enums which mirror the postgres enums. Now the big question is how to get JPA to understand Java enums on one side and postgres enums on the other? The Java side should be fairly easy but I'm not sure how to do the postgres sid...

Best java twitter library?

The twitter API site lists 3 java twitter libaries. Twitter4j java-twitter jtwitter Do you know others? What are your experiences in support, ease of use, stability, community, etc. ...

How to 'transform' a String object (containing XML) to an element on an existing JSP page

Currently I have a String object that contains XML elements: String carsInGarage = garage.getCars(); I now want to pass this String as an input/stream source (or some kind of source), but am unsure which one to choose and how to implement it. Most of the solutions I have looked at import the package: javax.xml.transform and accept a ...

Java generics

Is it possible to make a method that will take anything, including objects, Integers etc? I have a method checking the value if it is null and I was thinking perhaps it could be done with generics instead of overloading. Unfortunately, trying nullChecking(Class<? extends Object> value){ ... } won't allow Integers as they extend Number...

Why does my Jnlp program not working with log4j ?

Hello there. I have the following problem: I've deployed in Tomcat a JNLP and an executable JAR files. JNLP file should automatically download the JAR file and execute it. The JAR file is signed and verified. This is done (the downloading part). But when to execute the JAR main class (specified in the JNLP file), a problem occurs: A part...

Building a custom BSD version that supports only Java

What is the process I should use to accomplish the goal of building a version of FreeBSD that is capable of running a Java VM but not capable of any other functionality including, but not limited to: Running any process other than the Java VM Disabling any/all shell access When the Java VM exits, the OS shuts down I need to support J...

Designing an XACML API

Currently, the XACML specification defines a protocol for request / response but leaves it up to interpretation as to how it can be integrated into an enterprise application. I believe that the value of XACML won't be realized unless there is the creation of a new open source project that attempts to develop/standardize around a set of c...

appengine - java persistent

I have 3 class with relation: Member 1-n Tracker Link 1-n Tracker with owned one-to-many bidirectional relationship @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Member { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent(ma...

go beyond Integer.MAX_VALUE constraints in Java

Setting aside the heap's capacity, are there ways to go beyond Integer.MAX_VALUE constraints in Java? Examples are: Collections limit themselves to Integer.MAX_VALUE. StringBuilder / StringBuffer limit themselves to Integer.MAX_VALUE. ...

JAXP XIncludes with xpointer() scheme

Is there a way to use the xpointer() scheme with JAXP? The Xcerces FAQ states that only element() is supported (http://xerces.apache.org/xerces2-j/faq-xinclude.html). But i need to resolve those XIncludes because i have to deal with "legacy" documents. ...

Can I execute multiple instances of a Java class file?

I am thinking of executing multiple instances of same java binary (a socket application) with different configuration files (As a command line parameter). Does the JVM correctly handles this situation? In other words If I haven't any common resources (Files that can be locked etc.) will this approach make any problems? If so what are thi...

How the method resolution and invocation works internally in Python?

How the methods invocation works in Python? I mean, how the python virtual machine interpret it. It's true that the python method resolution could be slower in Python that in Java. What is late binding? What are the differences on the reflection mechanism in these two languages? Where to find good resources explaining these aspects? ...

How to run iReport-nb 3.x.x from whithin another java application?

Hi, I'd like to start using iReport (netbeans edition) and replace the good old classic iReport 3.0.x. Seems like the classic iReport won't be improved anymore and abandoned at some point. The point is that I need to start iReport from another java application. With iReport 3.0 it was pretty easy and straightforward: just invoke it.bu...

Sorting columns in ireport..?

Hi, I am using java-jasper report and ireport to build the report. I want to make my report sortable by column. Can any one help me with this..?? m waiting for reply asap ...

Advantages of MemoryPoolMXBean.getUsage() over Runtime.freeMemory()

I have a requirement to collect statistics of a JVM in regular time intervals using. Later, i need to log the JVM available memory/free memory, used memory, total memory. Following are the two options i have thought of. ManagementFactory.getMemoryPoolMXBeans() and iterating through each MemoryPoolMXBean and finally collecting the stat...

how do you read locale information from session?

The following bit of code sets the Locale from lang param on querystring. <c:if test="${param['lang'] != null}"> <fmt:setLocale value="${param['lang']}" scope="session"/> </c:if> How do I now read that variable? I know its a bit noobish. I need a bit of conditional logic to display one language link if the local hasn't been set ...

What is the best way to relearn a language?

I used to be a Java nerd back in college, but ever since then I haven't touched it. My work for the last 3-4 years has mostly been in Python and C++, and I have forgotten a lot of in's and out's of Java. So, what is the best (and fastest) way to get back in the groove with a language? Any suggestions on small projects that make you use ...

AccessController.doPrivileged

I am trying to figure out what some legacy code is doing. What exactly is this line doing, and why would I need it this way? String lineSeparator = (String) java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction("line.separator")); I found it in the logger implementation of the web/ejb applicatio...