IDEMPIERE-455 Discover and fix FindBugs problems / Eclipse warning -> raw type

This commit is contained in:
Richard Morales 2012-12-18 12:03:23 -05:00
parent 16773b295b
commit dce3b0d46f
7 changed files with 40 additions and 23 deletions

View File

@ -102,8 +102,8 @@ public abstract class AdempiereServer implements Runnable
/** Initial nap is seconds */
private int m_initialNap = 0;
/** Milliseconds to sleep - 10 Min default */
protected long m_sleepMS = 600000;
/** Milliseconds to sleep - 0 Sec default */
protected long m_sleepMS = 0;
/** Sleeping */
private volatile boolean m_sleeping = true;
/** Server start time */
@ -178,6 +178,17 @@ public abstract class AdempiereServer implements Runnable
*/
public void run ()
{
final Thread currentThread = Thread.currentThread();
final String oldThreadName = currentThread.getName();
String newThreadName = getName();
boolean renamed = false;
if (!oldThreadName.equals(newThreadName)) {
try {
currentThread.setName(newThreadName);
renamed = true;
} catch (SecurityException e) {}
}
m_sleeping = false;
if (m_start == 0)
m_start = System.currentTimeMillis();
@ -202,7 +213,7 @@ public abstract class AdempiereServer implements Runnable
lastRun = new Timestamp(p_startWork);
}
}
m_nextWork = MSchedule.getNextRunMS(lastRun.getTime(),
p_model.getScheduleType(), p_model.getFrequencyType(),
p_model.getFrequency(), p_model.getCronPattern());
@ -214,7 +225,12 @@ public abstract class AdempiereServer implements Runnable
p_model.setDateLastRun(lastRun);
p_model.setDateNextRun(new Timestamp(m_nextWork));
p_model.saveEx();
m_sleeping = true;
m_sleeping = true;
if (renamed) {
// Revert the name back if the current thread was renamed.
// We do not check the exception here because we know it works.
currentThread.setName(oldThreadName);
}
} // run
/**

View File

@ -82,6 +82,7 @@ import org.zkoss.zul.Div;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Space;
import org.zkoss.zul.Style;
import org.zkoss.zul.TreeModel;
import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Vlayout;
import org.zkoss.zul.West;
@ -1051,10 +1052,10 @@ DataStatusListener, IADTabpanel, IdSpace
private void deleteNode(int recordId) {
if (recordId <= 0) return;
SimpleTreeModel model = (SimpleTreeModel) treePanel.getTree().getModel();
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) treePanel.getTree().getModel();
if (treePanel.getTree().getSelectedItem() != null) {
DefaultTreeNode<Object> treeNode = (DefaultTreeNode<Object>) treePanel.getTree().getSelectedItem().getValue();
DefaultTreeNode<Object> treeNode = treePanel.getTree().getSelectedItem().getValue();
MTreeNode data = (MTreeNode) treeNode.getData();
if (data.getNode_ID() == recordId) {
model.removeNode(treeNode);
@ -1075,7 +1076,7 @@ DataStatusListener, IADTabpanel, IdSpace
boolean summary = gridTab.getValueAsBoolean("IsSummary");
String imageIndicator = (String)gridTab.getValue("Action"); // Menu - Action
//
SimpleTreeModel model = (SimpleTreeModel) treePanel.getTree().getModel();
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) treePanel.getTree().getModel();
DefaultTreeNode<Object> treeNode = model.getRoot();
MTreeNode root = (MTreeNode) treeNode.getData();
MTreeNode node = new MTreeNode (gridTab.getRecord_ID(), 0, name, description,
@ -1096,9 +1097,9 @@ DataStatusListener, IADTabpanel, IdSpace
treePanel.getTree().onInitRender();
}
SimpleTreeModel model = (SimpleTreeModel) treePanel.getTree().getModel();
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) treePanel.getTree().getModel();
if (treePanel.getTree().getSelectedItem() != null) {
DefaultTreeNode<Object> treeNode = (DefaultTreeNode<Object>) treePanel.getTree().getSelectedItem().getValue();
DefaultTreeNode<Object> treeNode = treePanel.getTree().getSelectedItem().getValue();
MTreeNode data = (MTreeNode) treeNode.getData();
if (data.getNode_ID() == recordId) {
int[] path = model.getPath(treeNode);

View File

@ -51,6 +51,7 @@ import org.zkoss.zul.DefaultTreeNode;
import org.zkoss.zul.Space;
import org.zkoss.zul.Splitter;
import org.zkoss.zul.Tree;
import org.zkoss.zul.TreeModel;
import org.zkoss.zul.TreeNode;
import org.zkoss.zul.Treeitem;
@ -304,8 +305,8 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
log.info("Selected=" + selected);
if (selected != null) // allow add if not in tree
{
SimpleTreeModel tm = (SimpleTreeModel) centerTree.getModel();
DefaultTreeNode<?> stn = tm.find(tm.getRoot(), selected.id);
SimpleTreeModel tm = (SimpleTreeModel)(TreeModel<?>) centerTree.getModel();
DefaultTreeNode<Object> stn = tm.find(tm.getRoot(), selected.id);
if (stn != null) {
int[] path = tm.getPath(stn);
Treeitem ti = centerTree.renderItemByPath(path);
@ -348,7 +349,7 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
log.info("Item=" + item);
if (item != null)
{
SimpleTreeModel model = (SimpleTreeModel) centerTree.getModel();
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) centerTree.getModel();
DefaultTreeNode<Object> stn = model.find(model.getRoot(), item.id);
if (stn != null) {
MTreeNode tNode = (MTreeNode) stn.getData();
@ -377,7 +378,7 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
log.info("Item=" + item);
if (item != null)
{
SimpleTreeModel model = (SimpleTreeModel) centerTree.getModel();
SimpleTreeModel model = (SimpleTreeModel)(TreeModel<?>) centerTree.getModel();
DefaultTreeNode<Object> stn = model.find(model.getRoot(), item.id);
if (stn != null)
model.removeNode(stn);

View File

@ -40,7 +40,7 @@ import org.zkoss.zul.event.ListDataEvent;
* @author Andrew Kimball
*
*/
public class ListModelTable extends ListModelList implements ListModelExt
public class ListModelTable extends ListModelList<Object> implements ListModelExt<Object>
{
/**
*
@ -117,7 +117,7 @@ public class ListModelTable extends ListModelList implements ListModelExt
*/
private void ensureRowSize()
{
Iterator<List<Object>> rowIterator = (Iterator<List<Object>>)this.getInnerList().iterator();
Iterator<List<Object>> rowIterator = (Iterator<List<Object>>)(Object)this.getInnerList().iterator();
while (rowIterator.hasNext())
{
@ -324,7 +324,7 @@ public class ListModelTable extends ListModelList implements ListModelExt
* (non-Javadoc)
* @see org.zkoss.zul.ListModelList#sort(java.util.Comparator, boolean)
*/
public void sort(Comparator cmpr, boolean ascending)
public void sort(Comparator<Object> cmpr, boolean ascending)
{
if (sorter != null)
sorter.sort(cmpr, ascending);

View File

@ -41,7 +41,7 @@ import org.zkoss.zul.event.TreeDataEvent;
* @author Low Heng Sin
*
*/
public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel implements TreeitemRenderer<Object>, EventListener<Event> {
public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> implements TreeitemRenderer<Object>, EventListener<Event> {
/**
*
@ -174,7 +174,6 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel implements T
return (DefaultTreeNode<Object>) super.getRoot();
}
@Override
public DefaultTreeNode<Object> getChild(Object parent, int index) {
return (DefaultTreeNode<Object>) super.getChild((TreeNode<Object>)parent, index);
}

View File

@ -953,7 +953,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
private void setValueAccordingToClass(PO po, POInfo poinfo, DataField field, int idxcol) {
CompiereService m_cs = getCompiereService();
// Evaluate the type of the column and assign a proper variable
Class columnClass = poinfo.getColumnClass(idxcol);
Class<?> columnClass = poinfo.getColumnClass(idxcol);
Object value = null;
String strValue = field.getVal();
String lookupValue = field.getLval();
@ -1047,7 +1047,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
//Is ctx variable
if (fieldInput.getAD_Column_ID() == 0 && fieldInput.getColumnName() != null) {
String varName = fieldInput.getColumnName();
Class columnClass = getVariableType(varName, fieldInput.getAD_Reference_ID());
Class<?> columnClass = getVariableType(varName, fieldInput.getAD_Reference_ID());
Object objVal = convertToObj(field.getVal(),columnClass,varName);
requestCtx.put(varName, objVal);

View File

@ -435,7 +435,7 @@ public class AbstractService {
* @param m_webservicetype
* @return
*/
protected Object convertToObj(String strValue,Class columnClass,String colName){
protected Object convertToObj(String strValue,Class<?> columnClass,String colName){
Object value = null;
@ -494,8 +494,8 @@ public class AbstractService {
* @param displayType
* @return
*/
protected Class getVariableType(String columnName,int displayType){
Class ColumnClass= null;
protected Class<?> getVariableType(String columnName,int displayType){
Class<?> ColumnClass= null;
if (columnName.equals("AD_Language") || columnName.equals("EntityType"))
{
ColumnClass = String.class;