IDEMPIERE-455 Discover and fix FindBugs problems / Eclipse warnings on pipo.legacy

This commit is contained in:
Carlos Ruiz 2013-02-07 11:14:24 -05:00
parent 1640fec333
commit 4356fa8f64
18 changed files with 42 additions and 11 deletions

View File

@ -170,6 +170,7 @@ public class PackOut extends SvrProcess
packagedir += File.separator;
packagename = packagedir + rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name);
includesdir = rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name) + File.separator +"**";
@SuppressWarnings("unused")
boolean success = (new File(packagename+File.separator+"doc"+File.separator)).mkdirs();
String file_document = packagename+File.separator+"doc"+File.separator+rs1.getString(X_AD_Package_Exp.COLUMNNAME_Name)+"Doc.xml";
packageDocStream = new FileOutputStream (file_document, false);
@ -457,6 +458,7 @@ public class PackOut extends SvrProcess
File destGZipFile = new File(packagename+".tar.gz");
//delete the old packages if necessary
@SuppressWarnings("unused")
boolean success = destZipFile.delete();
success = destTarFile.delete();
success = destGZipFile.delete();

View File

@ -60,6 +60,7 @@ import org.compiere.util.Env;
public class PackRoll extends SvrProcess {
/** Package from Record */
private int m_AD_Package_Imp_ID = 0;
@SuppressWarnings("unused")
private String m_Processing = null;
StringBuffer sql = null;
StringBuffer sqlB = null;
@ -96,6 +97,7 @@ public class PackRoll extends SvrProcess {
sqlB = new StringBuffer("UPDATE AD_Package_Imp "
+ "SET PK_Status = 'Uninstalling' "
+ "WHERE AD_Package_Imp_ID = " + m_AD_Package_Imp_ID);
@SuppressWarnings("unused")
int no = DB.executeUpdate(sqlB.toString(), get_TrxName());
log.info("Starting Package Reversal");

View File

@ -45,6 +45,7 @@ public class CodeSnipitElementHandler extends AbstractElementHandler {
public void startElement(Properties ctx, Element element) throws SAXException {
String elementValue = element.getElementValue();
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
String Object_Status = null;
log.info(elementValue);
@ -61,6 +62,7 @@ public class CodeSnipitElementHandler extends AbstractElementHandler {
int idDetail=0;
InputStream source; // Stream for reading from the source file.
OutputStream copy; // Stream for writing the copy.
@SuppressWarnings("unused")
File currentDirectory = new File(".");
String packagePath=null;

View File

@ -36,7 +36,6 @@ import org.adempiere.pipo.IDFinder;
import org.adempiere.pipo.exception.POSaveFailedException;
import org.compiere.model.MTable;
import org.compiere.model.PO;
import org.compiere.model.POInfo;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -200,13 +199,13 @@ public class DataElementHandler extends AbstractElementHandler {
genericPO.set_ValueOfColumn("Name", d_rowname);
// Set defaults.
//TODO: get defaults from configuration
HashMap defaults = new HashMap();
HashMap thisDefault = (HashMap)defaults.get(d_tablename);
HashMap<Object, Object> defaults = new HashMap<Object, Object>();
HashMap<?, ?> thisDefault = (HashMap<?, ?>)defaults.get(d_tablename);
if (thisDefault != null) {
Iterator iter = thisDefault.values().iterator();
ArrayList thisValue = null;
Iterator<?> iter = thisDefault.values().iterator();
ArrayList<?> thisValue = null;
while (iter.hasNext()) {
thisValue = (ArrayList)iter.next();
thisValue = (ArrayList<?>)iter.next();
if (((String)(thisValue.get(2))).equals("String"))
genericPO.set_ValueOfColumn((String)thisValue.get(0), (String)thisValue.get(1));
else if (((String)(thisValue.get(2))).equals("Integer"))

View File

@ -40,6 +40,7 @@ public class DistFileElementHandler extends AbstractElementHandler {
public void startElement(Properties ctx, Element element) throws SAXException {
String elementValue = element.getElementValue();
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
String Object_Status = null;
Attributes atts = element.attributes;

View File

@ -54,7 +54,9 @@ public class FormAccessElementHandler extends AbstractElementHandler {
sqlB = new StringBuffer ("SELECT count(*) FROM AD_Form_Access WHERE AD_Role_ID=? and AD_Form_ID=?");
int count = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),roleid,formid);
@SuppressWarnings("unused")
String Object_Status = null;
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
if (count>0){
Object_Status = "Update";

View File

@ -108,7 +108,7 @@ public class MenuElementHandler extends AbstractElementHandler {
m_Menu.setAD_Task_ID(id);
}
name = atts.getValue("ADWorkbenchNameID");
/*name = atts.getValue("ADWorkbenchNameID");
if (name != null && name.trim().length() > 0) {
int id = get_IDWithColumn(ctx, "AD_Workbench", "Name", name);
if (id <= 0) {
@ -116,7 +116,7 @@ public class MenuElementHandler extends AbstractElementHandler {
return;
}
m_Menu.setAD_Workbench_ID(id);
}
}*/
name = atts.getValue("ADWorkflowNameID");
if (name != null && name.trim().length() > 0) {
@ -319,12 +319,12 @@ public class MenuElementHandler extends AbstractElementHandler {
atts.addAttribute("", "", "ADTaskNameID", "CDATA", name);
} else
atts.addAttribute("", "", "ADTaskNameID", "CDATA", "");
if (m_Menu.getAD_Workbench_ID() > 0) {
/*if (m_Menu.getAD_Workbench_ID() > 0) {
sql = "SELECT Name FROM AD_Workbench WHERE AD_Workbench_ID=?";
name = DB.getSQLValueString(null, sql, m_Menu.getAD_Workbench_ID());
atts.addAttribute("", "", "ADWorkbenchNameID", "CDATA", name);
} else
atts.addAttribute("", "", "ADWorkbenchNameID", "CDATA", "");
atts.addAttribute("", "", "ADWorkbenchNameID", "CDATA", "");*/
if (m_Menu.getAD_Workflow_ID() > 0) {
sql = "SELECT Name FROM AD_Workflow WHERE AD_Workflow_ID=?";
name = DB.getSQLValueString(null, sql, m_Menu.getAD_Workflow_ID());

View File

@ -52,7 +52,9 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
sqlB = new StringBuffer ("SELECT count(*) FROM AD_Role_OrgAccess WHERE AD_Role_ID=? and AD_Org_ID=?");
int count = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),roleid,orgid);
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
@SuppressWarnings("unused")
String Object_Status = null;
if (count>0){
Object_Status = "Update";

View File

@ -54,7 +54,9 @@ public class ProcessAccessElementHandler extends AbstractElementHandler {
sqlB = new StringBuffer ("SELECT count(*) FROM AD_Process_Access WHERE AD_Role_ID=? and AD_Process_ID=?");
int count = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),roleid,processid);
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
@SuppressWarnings("unused")
String Object_Status = null;
if (count>0){

View File

@ -47,6 +47,7 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
element.skip = true;
return;
}
@SuppressWarnings("unused")
String name = atts.getValue("Name");
String value = atts.getValue("Value");
int AD_Reference_ID = 0;

View File

@ -42,7 +42,9 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
public void startElement(Properties ctx, Element element)
throws SAXException {
String elementValue = element.getElementValue();
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
@SuppressWarnings("unused")
String Object_Status = null;
log.info(elementValue);

View File

@ -37,7 +37,9 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
public void startElement(Properties ctx, Element element) throws SAXException {
String elementValue = element.getElementValue();
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
@SuppressWarnings("unused")
String Object_Status = null;
log.info(elementValue);
@ -49,6 +51,7 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
PreparedStatement pstmt = DB.prepareStatement(sql, getTrxName(ctx));
try {
if(DBType.equals("ALL")) {
@SuppressWarnings("unused")
int n = pstmt.executeUpdate();
log.info("Executed SQL Statement: "+ atts.getValue("statement"));
}
@ -69,6 +72,7 @@ public class SQLStatementElementHandler extends AbstractElementHandler {
Connection m_con = DB.getConnectionRW(true);
try {
Statement stmt = m_con.createStatement();
@SuppressWarnings("unused")
int n = stmt.executeUpdate (atts.getValue("statement"));
log.info("Executed SQL Statement for PostgreSQL: "+ atts.getValue("statement"));
// Postgres needs to commit DDL statements

View File

@ -54,7 +54,9 @@ public class TaskAccessElementHandler extends AbstractElementHandler {
sqlB = new StringBuffer ("SELECT count(*) FROM AD_Task_Access WHERE AD_Role_ID=? and AD_Task_ID=?");
int count = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),roleid,taskid);
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
@SuppressWarnings("unused")
String Object_Status = null;
if (count>0){
Object_Status = "Update";

View File

@ -62,7 +62,9 @@ public class UserRoleElementHandler extends AbstractElementHandler {
sqlB = new StringBuffer ("SELECT count(*) FROM AD_User_Roles WHERE AD_User_ID = ? and AD_Role_ID = ?");
int count = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),userid,roleid);
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
@SuppressWarnings("unused")
String Object_Status = null;
if (count>0){
//AD_Backup_ID = copyRecord("AD_Role",m_Role);

View File

@ -61,7 +61,9 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
sqlB = new StringBuffer ("SELECT count(*) FROM AD_Window_Access WHERE AD_Role_ID=? and AD_Window_ID=?");
int count = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),roleid,windowid);
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
@SuppressWarnings("unused")
String Object_Status = null;
if (count>0){
Object_Status = "Update";

View File

@ -54,7 +54,9 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler {
sqlB = new StringBuffer ("SELECT count(*) FROM AD_Workflow_Access WHERE AD_Role_ID=? and AD_Workflow_ID=?");
int count = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),roleid,workflowid);
@SuppressWarnings("unused")
int AD_Backup_ID = -1;
@SuppressWarnings("unused")
String Object_Status = null;
if (count>0){
Object_Status = "Update";

View File

@ -24,7 +24,6 @@ import org.adempiere.pipo.AbstractElementHandler;
import org.adempiere.pipo.Element;
import org.adempiere.pipo.PackOut;
import org.adempiere.pipo.exception.POSaveFailedException;
import org.compiere.model.X_AD_WF_NextCondition;
import org.compiere.model.X_AD_WF_NodeNext;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -187,6 +186,7 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
return atts;
}
/*
private AttributesImpl createWorkflowNodeNextConditionBinding(
AttributesImpl atts, X_AD_WF_NextCondition m_WF_NodeNextCondition) {
String sql = null;
@ -271,4 +271,5 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
return atts;
}
*/
}

View File

@ -15,11 +15,13 @@ import test.AdempiereTestCase;
public class PackOutTest extends AdempiereTestCase {
// Test: Specific variables
@SuppressWarnings("unused")
private MLocation location = null;
public void testPackOut() {
PackOut m_PackOut = new PackOut();
@SuppressWarnings("unused")
PackInHandler m_PackInHandler = new PackInHandler();
Trx m_trx = Trx.get(getTrxName(), true);
int m_ad_process_id = IDFinder.get_IDWithColumn("ad_process", "Name", "PackOut", getAD_Client_ID(), getTrxName());
@ -70,6 +72,7 @@ public class PackOutTest extends AdempiereTestCase {
saveResult = m_PackDetail.save();
assertTrue("X_AD_Package_Exp_Detail.save()", saveResult);
@SuppressWarnings("unused")
int m_ad_record_id = IDFinder.get_IDWithColumn("ad_package_exp", "Name", "test2packJunit", getAD_Client_ID(), getTrxName());
ProcessInfo m_ProcessInfo = new ProcessInfo("PackOut", m_ad_process_id, m_ad_table_id, m_MPackageExp.get_ID());