IDEMPIERE-455 Discover and fix FindBugs problems / Eclipse warning -> suppress unchecked

This commit is contained in:
Richard Morales 2012-12-20 15:47:59 -05:00
parent 740908e0c5
commit d0c6f4127a
16 changed files with 33 additions and 2 deletions

View File

@ -3707,6 +3707,7 @@ public class GridTable extends AbstractTableModel
}
@SuppressWarnings("unchecked")
private boolean isValueChanged(Object oldValue, Object value)
{
if ( isNotNullAndIsEmpty(oldValue) ) {

View File

@ -86,6 +86,7 @@ public class POIterator<T extends PO> implements Iterator<T> {
* @param index
* @return PO or null if index is invalid
*/
@SuppressWarnings("unchecked")
public T get(int index) {
if (index <= (idList.size() - 1)) {
Object[] ids = idList.get(index);

View File

@ -78,6 +78,7 @@ public class POResultSet<T extends PO> {
* @return PO or null if reach the end of resultset
* @throws DBException
*/
@SuppressWarnings("unchecked")
public T next() throws DBException {
if (currentPO != null) {
T po = currentPO;

View File

@ -378,6 +378,7 @@ public class PrintUtil
* Dump Stream Print Services
* @param docFlavor flavor
*/
@SuppressWarnings("unchecked")
public static void dump (DocFlavor docFlavor)
{
System.out.println();

View File

@ -212,6 +212,7 @@ public class SerializableMatrixImpl<T extends Serializable> implements Serializa
byte[] data = swapFile.read(segment);
swapFile.free(segment);
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
@SuppressWarnings("unchecked")
ArrayList<List<T>> rows = (ArrayList<List<T>>) ois.readObject();
this.m_rows = rows;
currentPage = pages.get(index);

View File

@ -233,6 +233,7 @@ public class MReportTree
if (node != null && node.isSummary ())
{
@SuppressWarnings("unchecked")
Enumeration<MTreeNode> en = (Enumeration<MTreeNode>)node.preorderEnumeration ();
StringBuffer sb = new StringBuffer ();
while (en.hasMoreElements ())

View File

@ -126,6 +126,7 @@ public class CLogErrorBuffer extends Handler
{
checkContext();
@SuppressWarnings("unchecked")
LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
if (!isLoggable (record) || m_logs == null)
return;
@ -141,7 +142,9 @@ public class CLogErrorBuffer extends Handler
// We have an error
if (record.getLevel() == Level.SEVERE)
{
@SuppressWarnings("unchecked")
LinkedList<LogRecord> m_errors = (LinkedList<LogRecord>) Env.getCtx().get(ERRORS_KEY);
@SuppressWarnings("unchecked")
LinkedList<LogRecord[]> m_history = (LinkedList<LogRecord[]>) Env.getCtx().get(HISTORY_KEY);
if (m_errors.size() >= ERROR_SIZE)
{
@ -301,7 +304,9 @@ public class CLogErrorBuffer extends Handler
{
checkContext();
@SuppressWarnings("unchecked")
LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
@SuppressWarnings("unchecked")
LinkedList<LogRecord> m_errors = (LinkedList<LogRecord>) Env.getCtx().get(ERRORS_KEY);
LogRecord[] retValue = null;
if (errorsOnly)
@ -331,8 +336,11 @@ public class CLogErrorBuffer extends Handler
{
checkContext();
@SuppressWarnings("unchecked")
LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
@SuppressWarnings("unchecked")
LinkedList<LogRecord> m_errors = (LinkedList<LogRecord>) Env.getCtx().get(ERRORS_KEY);
@SuppressWarnings("unchecked")
LinkedList<LogRecord[]> m_history = (LinkedList<LogRecord[]>) Env.getCtx().get(HISTORY_KEY);
synchronized (m_errors)
{
@ -362,6 +370,7 @@ public class CLogErrorBuffer extends Handler
//
if (errorsOnly)
{
@SuppressWarnings("unchecked")
LinkedList<LogRecord[]> m_history = (LinkedList<LogRecord[]>) Env.getCtx().get(HISTORY_KEY);
for (int i = 0; i < m_history.size(); i++)
{
@ -376,6 +385,7 @@ public class CLogErrorBuffer extends Handler
}
else
{
@SuppressWarnings("unchecked")
LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
for (int i = 0; i < m_logs.size(); i++)
{
@ -419,8 +429,11 @@ public class CLogErrorBuffer extends Handler
{
checkContext();
@SuppressWarnings("unchecked")
LinkedList<LogRecord> m_logs = (LinkedList<LogRecord>) Env.getCtx().get(LOGS_KEY);
@SuppressWarnings("unchecked")
LinkedList<LogRecord> m_errors = (LinkedList<LogRecord>) Env.getCtx().get(ERRORS_KEY);
@SuppressWarnings("unchecked")
LinkedList<LogRecord[]> m_history = (LinkedList<LogRecord[]>) Env.getCtx().get(HISTORY_KEY);
StringBuilder sb = new StringBuilder ("CLogErrorBuffer[");
sb.append("Errors=").append(m_errors.size())

View File

@ -127,7 +127,8 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
SessionManager.setSessionApplication(this);
Session session = Executions.getCurrent().getDesktop().getSession();
Map<String, Object>map = (Map<String, Object>) session.removeAttribute(SAVED_CONTEXT);
@SuppressWarnings("unchecked")
Map<String, Object>map = (Map<String, Object>) session.removeAttribute(SAVED_CONTEXT);
if (map != null && !map.isEmpty())
{
onChangeRole(map);

View File

@ -937,7 +937,8 @@ DataStatusListener, IADTabpanel, IdSpace
* @param event
* @see EventListener#onEvent(Event)
*/
public void onEvent(Event event)
@SuppressWarnings("unchecked")
public void onEvent(Event event)
{
if (event.getTarget() == listPanel.getListbox())
{

View File

@ -61,6 +61,7 @@ public class ADTreeOnDropListener implements EventListener<Event> {
/**
* @param event
*/
@SuppressWarnings("unchecked")
public void onEvent(Event event) throws Exception {
if (event instanceof DropEvent) {
DropEvent de = (DropEvent) event;

View File

@ -69,6 +69,7 @@ public class ListModelTable extends ListModelList<Object> implements ListModelEx
*
* @param collection The collection of objects with which to initialise the list
*/
@SuppressWarnings("unchecked")
public ListModelTable(Collection<?> collection)
{
super(collection);
@ -117,6 +118,7 @@ public class ListModelTable extends ListModelList<Object> implements ListModelEx
*/
private void ensureRowSize()
{
@SuppressWarnings("unchecked")
Iterator<List<Object>> rowIterator = (Iterator<List<Object>>)(Object)this.getInnerList().iterator();
while (rowIterator.hasNext())
@ -171,6 +173,7 @@ public class ListModelTable extends ListModelList<Object> implements ListModelEx
* @param columnIndex the index of the column whose value is to be queried
* @return The object stored at the specified position
*/
@SuppressWarnings("unchecked")
public Object getDataAt(int rowIndex, int columnIndex)
{
List<Object> modelRow;
@ -199,6 +202,7 @@ public class ListModelTable extends ListModelList<Object> implements ListModelEx
* @param row the index of the row whose value is to be set
* @param col the index of the column whose value is to be set
*/
@SuppressWarnings("unchecked")
public void setDataAt(Object aValue, int row, int col)
{
List<Object> vector;

View File

@ -45,6 +45,7 @@ public class SimpleListModel extends AbstractListModel<Object> implements Listit
this(new ArrayList<Object>());
}
@SuppressWarnings("unchecked")
public SimpleListModel(List<?> list) {
this.list = (List<Object>)list;
}

View File

@ -174,6 +174,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
return (DefaultTreeNode<Object>) super.getRoot();
}
@SuppressWarnings("unchecked")
public DefaultTreeNode<Object> getChild(Object parent, int index) {
return (DefaultTreeNode<Object>) super.getChild((TreeNode<Object>)parent, index);
}

View File

@ -385,6 +385,7 @@ public class CalendarWindow extends Window implements EventListener<Event> {
private void btnSwitchTimeZoneClicked() {
Map<?, ?> zone = calendars.getTimeZones();
if (!zone.isEmpty()) {
@SuppressWarnings("unchecked")
Map.Entry<TimeZone, String> me = (Map.Entry<TimeZone, String>) zone.entrySet().iterator().next();
calendars.removeTimeZone((TimeZone) me.getKey());
calendars.addTimeZone((String) me.getValue(), (TimeZone) me.getKey());

View File

@ -42,6 +42,7 @@ public class Zk {
selector = "#"+id+" "+selector;
executor = (JavascriptExecutor) ((WrapsDriver)element).getWrappedDriver();
}
@SuppressWarnings("unchecked")
List<WebElement> list = (List<WebElement>) executor.executeScript("return jq('" + selector + "').get();");
return list;
}

View File

@ -272,6 +272,7 @@ public class AbstractService {
protected Map<String, Object> getRequestCtx() {
HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
@SuppressWarnings("unchecked")
Map<String,Object> reqCtx= (Map<String,Object>)req.getAttribute("RequestCtx");
if(reqCtx==null){
reqCtx = new HashMap<String, Object>();