ESAPI logger when implemented for class extending SqlMapClientDaoSupport gives class cast exception - esapi

We are using ESAPI logger as per resolution for a flaw reported by Veracode. When we changed the logger for class which extends SqlMapClientDaoSupport it gave class cast exception. The reason is SqlMapClientDaoSupport has a protected data member which is org.apache.commons.logging logger. Is there a way we can use esapi loggers in the classes which extend classes having org.apache.commons.logging?

Related

Getting GWT RPC Serialization Error while populating liststore of ComboBox

I am using GWT 2.9 and I am getting below error
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.NosOptionModel' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.xyz.nos.model.NosOptionModel#6cad8f33
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.NosOptionModel' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.xyz.nos.model.NosOptionModel#5fc5e111
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.NosCaseDetailModel' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.xyz.nos.model.NosCaseDetailModel#af3642f
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.CountryGroupModel' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.xyz.nos.model.CountryGroupModel#51987007
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.client.rpc.SerializationException: Type 'com.xyz.nos.model.NosUser' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.xyz.nos.model.NosUser#28bbfa7f
I am doing GWT RPC for populating liststore of combobox and getting above exception while performing it from EntryPoint class. All the above classes are Pojo's and all the fields of these classes are Serializable
I have tried all possible solutions given in GWT - RPC SerializationException
I have defined my service as below
public interface INamedComboListDataProvider<M> extends RemoteService {
public List<M> load(String name);
}
I also have checked my serializationWhitelist and it only contain following 25 classes
{class com.google.gwt.user.client.ui.TreeListenerCollection=true, class java.lang.String=true, class com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException=true, class com.google.gwt.user.client.ui.FocusListenerCollection=true, class com.google.gwt.user.client.rpc.RpcTokenException=true, class java.util.LinkedList=true, class java.lang.RuntimeException=false, class com.google.gwt.user.client.ui.LoadListenerCollection=true, class com.google.gwt.user.client.ui.ClickListenerCollection=true, class com.google.gwt.user.client.ui.FormHandlerCollection=true, class java.lang.Throwable=false, class com.google.gwt.user.client.ui.KeyboardListenerCollection=true, class com.google.gwt.user.client.ui.MouseListenerCollection=true, class com.google.gwt.user.client.ui.TabListenerCollection=true, class java.util.Vector=true, class com.google.gwt.user.client.ui.ChangeListenerCollection=true, class com.google.gwt.user.client.ui.ScrollListenerCollection=true, class com.google.gwt.user.client.ui.PopupListenerCollection=true, class com.google.gwt.user.client.ui.MouseWheelListenerCollection=true, class java.util.Arrays$ArrayList=true, class java.lang.Exception=false, class java.util.ArrayList=true, class java.util.Collections$EmptyList=true, class java.util.Collections$SingletonList=true, class com.google.gwt.user.client.ui.TableListenerCollection=true}
I also have added project folder structure below
client
model
service
services
util
Common.gwt.xml
Main.gwt.xml
Can anybody guide me where I am going wrong and why does the serializationwhilteList does not contain the pojo models ?

Injection causes WELD-001408: Unsatisfied dependencies

I have a java EE web application in which a particular injection causes following error:
WELD-001408: Unsatisfied dependencies for type GenericDAO with qualifiers #Default
MyBean
#Stateless
public class MyBean extends CustomBean<Entity> {
...
}
CustomBean
public class CustomBean<T extends Serializable> implements Serializable {
#Inject
private GenericDAO<T> genericDAO;
}
GenericDAO
public abstract class GenericDAO<T extends Serializable> implements Serializable {
...
}
The issue appears only if a beans.xml is defined in the application. Deleting this, solves also the issue. In my case beans.xml is needed. Also when removing the GenericDAO<T> genericDAO; injection from the CustomBean, the error does not appear anymore. Also the rest of my injection in other classes, seem to work without any issue.
I've tried to solve that by creating an interface of GenericDAO and inject the interface instead. Also tried to with several anotations like #Local , #Dependent etc but i stumble upon different errors every time.

Issues with CDI when injecting generic type : Wildfly 8.2.0.Final

We are facing weird injection issues in Widfly due to CDI changes. We have interface
public interface Command<I, O> {
}
and many classes implement this interface like this
public class ApproveUserRequests implements Command<ApproveUserRequestsRequest, List<String>> {
}
Application listener classes likes to get list of all classes available and uses injection like this
#Inject
private Instance<Command<I, O>> mActions;
However instance returned by mActions were always null. After debugging source found that the only way to get list of all instances is to use
#Inject
private Instance<Command<?, ?>> mActions;
Also we faced injection issues while using generic types , however using wildcard type helped us.
- See more at: https://developer.jboss.org/thread/256783#sthash.1s6tuXsR.dpuf
The rules for parameterized types have been clarified in CDI 1.2. Have look at Section 5.2.4 Assignability of raw and parameterized types of the spec.

Serialization in GWT 2.5.1

I've updated my project from GWT 2.4.0 to GWT 2.5.1 and suddenly a specific RPC serialization has stopped work (all other are still working).
I have this class:
public class StatusChangeMapEntity extends RecordStamp implements Serializable {
private HashMap<WFStatus, Pair<WFPhase, ArrayList<Pair<AppUser, Date>>>> map;
...
...
}
The exception message is:
Attempt to deserialize an object of type class Pair when an object of type class Slide is expected
The class Slide extends StatusChangeMapEntity and is the object that is being deserialized.
Any ideias how to solve this problems?
Thanks.
I've managed to solve this problem. Basically I've created a class extending the HashMap:
public class MapStatusChanges extends HashMap<WFStatus, Pair<WFPhase, ArrayList<Pair<AppUser, Date>>>> {
...
}
And then created a CustomSerializer to the MapStatusChanges.
It's not a generic solution, but it works until this problem is solved at GWT.
Hope this helps....

Working with EnumSet class in GWT

I am having trouble using EnumSet on the client side.
I get this runtime error message:
java.util.EnumSet.EnumSetImpl is not default instantiable (it must
have a zero-argument constructor or no constructors at all) and has
no custom serializer.
Is this is a known issue?
Here is what I am doing (basically a hello world app)
Service:
String echo (EnumSet<Names> name) throws IllegalArgumentException;
Client:
echoServ.echo (EnumSet.of(Names.JOHN), new AsyncCallback<String>()
{ ....... });
Shared enum class
enum Names { JOHN, NUMAN, OBAMA }
This is a GWT limitation - See http://code.google.com/p/google-web-toolkit/issues/detail?id=3028
The simplest workaround is to use a HashSet until that is fixed
It seems the problem is that EnumSet is not serializable according to GWT's rules:
It is assignable to IsSerializable or Serializable, either because it directly implements one of these interfaces or because it derives from a superclass that does
All non-final, non-transient instance fields are themselves serializable, and
As of GWT 1.5, it must have a default (zero argument) constructor (with any access modifier) or no constructor at all.
See the docs for more info.