Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.6.1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:Portal(Liferay)
-
Workaround Exists:Yes
-
Workaround Description:
Description
------------------- DnDCache.java
public static DnDCache getInstance(FacesContext context, boolean encoding) {
String viewId = context.getViewRoot().getViewId();
Map map = context.getExternalContext().getSessionMap();
DnDCache cache = (DnDCache) map.get(SESSION_KEY);
if (cache == null) {
cache = new DnDCache();
map.put(SESSION_KEY, cache);
}
return cache;
}
------------------- ISSUE
The instance taken using this method for the DnDCache is in the context of the current running portlet. Hence, if a drag was made from one portlet to another, the dragValue and dropValue properties would be null because the DnDCache instance is local to the source portlet.
public static DnDCache getInstance(FacesContext context, boolean encoding) {
String viewId = context.getViewRoot().getViewId();
Map map = context.getExternalContext().getSessionMap();
DnDCache cache = (DnDCache) map.get(SESSION_KEY);
if (cache == null) {
cache = new DnDCache();
map.put(SESSION_KEY, cache);
}
return cache;
}
------------------- ISSUE
The instance taken using this method for the DnDCache is in the context of the current running portlet. Hence, if a drag was made from one portlet to another, the dragValue and dropValue properties would be null because the DnDCache instance is local to the source portlet.
Assigning to Adnan to make the actual change in the DnDCache.
I've examined and test the supplied code fix. It's my opinion that it's safe to use it as is. A couple of things to note.
1) Make sure we use the appropriate environment detection (servlet vs portlet) logic to execute the desired logic.
2) Do not introduce any runtime dependencies on the Portlet libraries.
3) If #2 requires the use of reflection or other potentially expensive operation, ensure that we do it efficiently (i.e. only do the detection once).