IDEMPIERE-455 Discover and fix FindBugs problems / Eclipse warning -> dead code

This commit is contained in:
Carlos Ruiz 2012-12-20 15:46:40 -05:00
parent c39047eb17
commit 740908e0c5
23 changed files with 138 additions and 116 deletions

View File

@ -559,8 +559,6 @@ public class ReplicationLocal extends SvrProcess
// //
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
rowSet = CCachedRowSet.getRowSet(rs); rowSet = CCachedRowSet.getRowSet(rs);
pstmt.close();
pstmt = null;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -568,16 +566,11 @@ public class ReplicationLocal extends SvrProcess
throw new RuntimeException (ex); throw new RuntimeException (ex);
} }
// Close Cursor // Close Cursor
try finally
{ {
if (pstmt != null) DB.close(pstmt);
pstmt.close();
pstmt = null; pstmt = null;
} }
catch (Exception e)
{
s_log.log(Level.SEVERE, "close pstmt", e);
}
return rowSet; return rowSet;
} // getRowSet } // getRowSet

View File

@ -59,12 +59,12 @@ class Base
GridWindow w = new GridWindow(vo); GridWindow w = new GridWindow(vo);
long endDef = System.currentTimeMillis(); long endDef = System.currentTimeMillis();
System.out.println("Load Definition Time in ms = " + String.valueOf(endDef-startTime)); System.out.println("Load Definition Time in ms = " + String.valueOf(endDef-startTime));
if (1==2) // optional step /*if (1==2) // optional step
{ {
w.loadCompete(); w.loadCompete();
long endDefComplete = System.currentTimeMillis(); long endDefComplete = System.currentTimeMillis();
System.out.println("Load Definition Complete Time in ms = " + String.valueOf(endDefComplete-startTime)); System.out.println("Load Definition Complete Time in ms = " + String.valueOf(endDefComplete-startTime));
} }*/
w.query(); w.query();
long endData = System.currentTimeMillis(); long endData = System.currentTimeMillis();
System.out.println("Load Data Time in ms = " + String.valueOf(endData-startTime)); System.out.println("Load Data Time in ms = " + String.valueOf(endData-startTime));

View File

@ -69,8 +69,8 @@ public class LDAP
Attributes answer = ctx.getAttributes(""); Attributes answer = ctx.getAttributes("");
// Print the answer // Print the answer
if (false) //if (false)
dump (answer); // dump (answer);
} }
catch (AuthenticationException e) catch (AuthenticationException e)
{ {

View File

@ -61,10 +61,10 @@ public final class OFXFileBankStatementLoader extends OFXBankStatementHandler im
{ {
return result; return result;
} }
if (m_stream == null) //if (m_stream == null)
{ //{
return result; //return result;
} //}
result = attachInput(m_stream); result = attachInput(m_stream);
} }
catch(Exception e) catch(Exception e)

View File

@ -129,8 +129,8 @@ public class MEXPFormat extends X_EXP_Format {
{ {
String key = new String(value+version); String key = new String(value+version);
MEXPFormat retValue=null; MEXPFormat retValue=null;
if(retValue!=null) //if(retValue!=null)
return retValue; // return retValue;
StringBuilder whereClause = new StringBuilder(X_EXP_Format.COLUMNNAME_Value).append("=?") StringBuilder whereClause = new StringBuilder(X_EXP_Format.COLUMNNAME_Value).append("=?")
.append(" AND AD_Client_ID = ?") .append(" AND AD_Client_ID = ?")

View File

@ -416,9 +416,9 @@ public class MIssue extends X_AD_Issue
*/ */
public String report() public String report()
{ {
if (true) //if (true)
return "-"; return "-";
StringBuilder parameter = new StringBuilder("?"); /*StringBuilder parameter = new StringBuilder("?");
if (getRecord_ID() == 0) // don't report if (getRecord_ID() == 0) // don't report
return "ID=0"; return "ID=0";
if (getRecord_ID() == 1) // new if (getRecord_ID() == 1) // new
@ -479,7 +479,7 @@ public class MIssue extends X_AD_Issue
} }
return msg.toString(); return msg.toString();
} }
return readResponse(in); return readResponse(in);*/
} // report } // report
/** /**
@ -487,7 +487,7 @@ public class MIssue extends X_AD_Issue
* @param in input stream * @param in input stream
* @return error message * @return error message
*/ */
private String readResponse(InputStreamReader in) /*private String readResponse(InputStreamReader in)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int Record_ID = 0; int Record_ID = 0;
@ -539,7 +539,7 @@ public class MIssue extends X_AD_Issue
if (RequestDocumentNo != null) if (RequestDocumentNo != null)
setRequestDocumentNo(RequestDocumentNo); setRequestDocumentNo(RequestDocumentNo);
return null; return null;
} // readResponse } // readResponse*/
/** /**
* String Representation * String Representation

View File

@ -59,9 +59,9 @@ public class MMovementConfirm extends X_M_MovementConfirm implements DocAction
if (checkExisting) if (checkExisting)
{ {
MMovementConfirm[] confirmations = move.getConfirmations(false); MMovementConfirm[] confirmations = move.getConfirmations(false);
for (int i = 0; i < confirmations.length; i++) if (confirmations.length > 0)
{ {
MMovementConfirm confirm = confirmations[i]; MMovementConfirm confirm = confirmations[0];
return confirm; return confirm;
} }
} }

View File

@ -50,9 +50,6 @@ public class MTemplate extends X_CM_Template
public static MTemplate get (Properties ctx, int CM_Template_ID, String trxName) public static MTemplate get (Properties ctx, int CM_Template_ID, String trxName)
{ {
MTemplate retValue = new MTemplate (ctx, CM_Template_ID, trxName); MTemplate retValue = new MTemplate (ctx, CM_Template_ID, trxName);
if (retValue != null)
return retValue;
retValue = new MTemplate (ctx, CM_Template_ID, null);
return retValue; return retValue;
} // get } // get

View File

@ -192,10 +192,10 @@ public final class NaturalAccountMap<K,V> extends CCache<K,V>
{ {
String s = st.nextToken().trim(); String s = st.nextToken().trim();
// Ignore, if is it header line // Ignore, if is it header line
if (s.startsWith("[") && s.endsWith("]"))
return "";
if (s == null) if (s == null)
s = ""; s = "";
if (s.startsWith("[") && s.endsWith("]"))
return "";
// //
if (i == 0) // A - Value if (i == 0) // A - Value
Value = s; Value = s;

View File

@ -1957,6 +1957,7 @@ public abstract class PO
* To reload call load() - not updated * To reload call load() - not updated
* @return true if saved * @return true if saved
*/ */
@SuppressWarnings("unused")
public boolean save() public boolean save()
{ {
CLogger.resetLast(); CLogger.resetLast();

View File

@ -60,18 +60,18 @@ public class ArchiveEngine
// Do we need to Archive ? // Do we need to Archive ?
MClient client = MClient.get(layout.getCtx()); MClient client = MClient.get(layout.getCtx());
String aaClient = client.getAutoArchive(); String aaClient = client.getAutoArchive();
String aaRole = null; // role.getAutoArchive(); // TODO
String aa = aaClient; String aa = aaClient;
if (aa == null) if (aa == null)
aa = MClient.AUTOARCHIVE_None; aa = MClient.AUTOARCHIVE_None;
/* String aaRole = null; // role.getAutoArchive(); // TODO
if (aaRole != null) if (aaRole != null)
{ {
if (aaRole.equals(MClient.AUTOARCHIVE_AllReportsDocuments)) if (aaRole.equals(MClient.AUTOARCHIVE_AllReportsDocuments))
aa = aaRole; aa = aaRole;
else if (aaRole.equals(MClient.AUTOARCHIVE_Documents) && !aaClient.equals(MClient.AUTOARCHIVE_AllReportsDocuments)) else if (aaRole.equals(MClient.AUTOARCHIVE_Documents) && !aaClient.equals(MClient.AUTOARCHIVE_AllReportsDocuments))
aa = aaRole; aa = aaRole;
} }*/
// Mothing to Archive // Nothing to Archive
if (aa.equals(MClient.AUTOARCHIVE_None)) if (aa.equals(MClient.AUTOARCHIVE_None))
return null; return null;
// Archive External only // Archive External only
@ -110,18 +110,18 @@ public class ArchiveEngine
// Do we need to Archive ? // Do we need to Archive ?
MClient client = MClient.get(Env.getCtx()); MClient client = MClient.get(Env.getCtx());
String aaClient = client.getAutoArchive(); String aaClient = client.getAutoArchive();
String aaRole = null; // role.getAutoArchive(); // TODO
String aa = aaClient; String aa = aaClient;
if (aa == null) if (aa == null)
aa = MClient.AUTOARCHIVE_None; aa = MClient.AUTOARCHIVE_None;
/* String aaRole = null; // role.getAutoArchive(); // TODO
if (aaRole != null) if (aaRole != null)
{ {
if (aaRole.equals(MClient.AUTOARCHIVE_AllReportsDocuments)) if (aaRole.equals(MClient.AUTOARCHIVE_AllReportsDocuments))
aa = aaRole; aa = aaRole;
else if (aaRole.equals(MClient.AUTOARCHIVE_Documents) && !aaClient.equals(MClient.AUTOARCHIVE_AllReportsDocuments)) else if (aaRole.equals(MClient.AUTOARCHIVE_Documents) && !aaClient.equals(MClient.AUTOARCHIVE_AllReportsDocuments))
aa = aaRole; aa = aaRole;
} }*/
// Mothing to Archive // Nothing to Archive
if (aa.equals(MClient.AUTOARCHIVE_None)) if (aa.equals(MClient.AUTOARCHIVE_None))
return; return;
// Archive External only // Archive External only

View File

@ -152,7 +152,7 @@ public class Secure implements SecureInterface
{ {
cc = Cipher.getInstance("DES/ECB/PKCS5Padding"); cc = Cipher.getInstance("DES/ECB/PKCS5Padding");
// Key // Key
if (false) /*if (false)
{ {
KeyGenerator keygen = KeyGenerator.getInstance("DES"); KeyGenerator keygen = KeyGenerator.getInstance("DES");
m_key = keygen.generateKey(); m_key = keygen.generateKey();
@ -164,8 +164,8 @@ public class Secure implements SecureInterface
sb.append(key[i]).append(","); sb.append(key[i]).append(",");
log.info(sb.toString()); log.info(sb.toString());
} }
else else*/
m_key = new javax.crypto.spec.SecretKeySpec m_key = new javax.crypto.spec.SecretKeySpec
(new byte[] {100,25,28,-122,-26,94,-3,-26}, "DES"); (new byte[] {100,25,28,-122,-26,94,-3,-26}, "DES");
} }
catch (Exception ex) catch (Exception ex)

View File

@ -335,21 +335,16 @@ public class ExportFormatGenerator extends SvrProcess
tabledir = MTable.get(getCtx(), tableName); tabledir = MTable.get(getCtx(), tableName);
if(tabledir==null) if(tabledir==null)
return 0; return 0;
// throw new Exception ("Ilegal Table Name"); // throw new Exception ("Illegal Table Name");
formatLine.setValue(tabledir.getTableName()+"_Reference"); formatLine.setValue(tabledir.getTableName()+"_Reference");
formatLine.setName("Referenced "+ tabledir.getTableName()); formatLine.setName("Referenced "+ tabledir.getTableName());
//formatLine.setType(MEXPFormatLine.TYPE_XMLElement); //formatLine.setType(MEXPFormatLine.TYPE_XMLElement);
if (tabledir!=null) String format_value = createFormat(tabledir);
{ int embedded = ((MEXPFormat)m_formats.get(format_value)).getEXP_Format_ID();
String format_value = createFormat(tabledir); formatLine.setType(MEXPFormatLine.TYPE_ReferencedEXPFormat);
int embedded = ((MEXPFormat)m_formats.get(format_value)).getEXP_Format_ID(); formatLine.setEXP_EmbeddedFormat_ID(embedded);
formatLine.setType(MEXPFormatLine.TYPE_ReferencedEXPFormat);
formatLine.setEXP_EmbeddedFormat_ID(embedded);
}
else
formatLine.setType(MEXPFormatLine.TYPE_XMLElement);
} }
formatLine.setAD_Column_ID(col.getAD_Column_ID()); formatLine.setAD_Column_ID(col.getAD_Column_ID());
formatLine.saveEx(); formatLine.saveEx();

View File

@ -183,14 +183,14 @@ public class DataElementHandler extends AbstractElementHandler {
} }
// for debug GenericPO. // for debug GenericPO.
if (false) { /*if (false) {
POInfo poInfo = POInfo.getPOInfo(ctx, get_ID(ctx, "AD_Table", d_tablename), getTrxName(ctx)); POInfo poInfo = POInfo.getPOInfo(ctx, get_ID(ctx, "AD_Table", d_tablename), getTrxName(ctx));
if (poInfo == null) if (poInfo == null)
log.info("poInfo is null."); log.info("poInfo is null.");
for (int i = 0; i < poInfo.getColumnCount(); i++) { for (int i = 0; i < poInfo.getColumnCount(); i++) {
log.info(d_tablename+" column: "+poInfo.getColumnName(i)); log.info(d_tablename+" column: "+poInfo.getColumnName(i));
} }
} }*/
// globalqss: set AD_Client_ID to the client setted in adempieredata // globalqss: set AD_Client_ID to the client setted in adempieredata
if (getClientId(ctx) > 0 && genericPO.getAD_Client_ID() != getClientId(ctx)) if (getClientId(ctx) > 0 && genericPO.getAD_Client_ID() != getClientId(ctx))
genericPO.set_ValueOfColumn("AD_Client_ID", getClientId(ctx)); genericPO.set_ValueOfColumn("AD_Client_ID", getClientId(ctx));

View File

@ -136,7 +136,6 @@ public class AlertProcessor extends AdempiereServer
{ {
if (i > 0) if (i > 0)
message.append(Env.NL); message.append(Env.NL);
String trxName = null; // assume r/o
MAlertRule rule = rules[i]; MAlertRule rule = rules[i];
if (!rule.isValid()) if (!rule.isValid())
@ -147,7 +146,7 @@ public class AlertProcessor extends AdempiereServer
String sql = rule.getPreProcessing(); String sql = rule.getPreProcessing();
if (sql != null && sql.length() > 0) if (sql != null && sql.length() > 0)
{ {
int no = DB.executeUpdate(sql, false, trxName); int no = DB.executeUpdate(sql, false, null);
if (no == -1) if (no == -1)
{ {
ValueNamePair error = CLogger.retrieveError(); ValueNamePair error = CLogger.retrieveError();
@ -166,9 +165,9 @@ public class AlertProcessor extends AdempiereServer
{ {
String text = null; String text = null;
if (MSysConfig.getBooleanValue(MSysConfig.ALERT_SEND_ATTACHMENT_AS_XLS, true, Env.getAD_Client_ID(getCtx()))) if (MSysConfig.getBooleanValue(MSysConfig.ALERT_SEND_ATTACHMENT_AS_XLS, true, Env.getAD_Client_ID(getCtx())))
text = getExcelReport(rule, sql, trxName, attachments); text = getExcelReport(rule, sql, null, attachments);
else else
text = getPlainTextReport(rule, sql, trxName, attachments); text = getPlainTextReport(rule, sql, null, attachments);
if (text != null && text.length() > 0) if (text != null && text.length() > 0)
{ {
message.append(text); message.append(text);
@ -189,7 +188,7 @@ public class AlertProcessor extends AdempiereServer
sql = rule.getPostProcessing(); sql = rule.getPostProcessing();
if (sql != null && sql.length() > 0) if (sql != null && sql.length() > 0)
{ {
int no = DB.executeUpdate(sql, false, trxName); int no = DB.executeUpdate(sql, false, null);
if (no == -1) if (no == -1)
{ {
ValueNamePair error = CLogger.retrieveError(); ValueNamePair error = CLogger.retrieveError();
@ -201,17 +200,7 @@ public class AlertProcessor extends AdempiereServer
break; break;
} }
} // Post } // Post
/** Trx */
if (trxName != null)
{
Trx trx = Trx.get(trxName, false);
if (trx != null)
{
trx.commit();
trx.close();
}
}
} // for all rules } // for all rules
// Update header if error // Update header if error
@ -361,7 +350,6 @@ public class AlertProcessor extends AdempiereServer
* @param attachments (ignored) * @param attachments (ignored)
* @return list of rows & values * @return list of rows & values
* @throws Exception * @throws Exception
* @deprecated
*/ */
private String getPlainTextReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments) private String getPlainTextReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
throws Exception throws Exception

View File

@ -73,20 +73,20 @@ public class FCHtmlEditorKit extends HTMLEditorKit {
// state where it thinks that image was loaded. // state where it thinks that image was loaded.
// ImageView is calling getImage to get image for // ImageView is calling getImage to get image for
// measurement and painting when image was loaded // measurement and painting when image was loaded
if (false) { /*if (false) {
return getClass().getClassLoader(). return getClass().getClassLoader().
getResource("javax/swing/text/html/icons/image-delayed.gif"); getResource("javax/swing/text/html/icons/image-delayed.gif");
} else { } else {*/
String src = (String)elem.getAttributes(). String src = (String)elem.getAttributes().
getAttribute(HTML.Attribute.SRC); getAttribute(HTML.Attribute.SRC);
//System.out.println("img load: " + src.substring(4)); //System.out.println("img load: " + src.substring(4));
URL url = getClass().getClassLoader(). URL url = getClass().getClassLoader().
getResource(src.substring(4)); getResource(src.substring(4));
if (url != null) { if (url != null) {
// System.out.println("load image: " + url); // System.out.println("load image: " + url);
return url; return url;
}
} }
//}
return null; return null;
} }
private static Image smileImage = null; private static Image smileImage = null;

View File

@ -701,14 +701,14 @@ public final class AdempierePLAF
try try
{ {
Method[] methods = startClass.getMethods(); Method[] methods = startClass.getMethods();
for (int i = 0; i < methods.length; i++) if (methods.length > 0)
{ {
if (Modifier.isStatic(methods[i].getModifiers()) && methods[i].getName().equals("main")) if (Modifier.isStatic(methods[0].getModifiers()) && methods[0].getName().equals("main"))
{ {
String[] startArgs = new String[args.length-1]; String[] startArgs = new String[args.length-1];
for (int ii = 1; ii < args.length; ii++) for (int ii = 1; ii < args.length; ii++)
startArgs[ii-i] = args[ii]; startArgs[ii] = args[ii];
methods[i].invoke(null, new Object[] {startArgs}); methods[0].invoke(null, new Object[] {startArgs});
} }
return; return;
} }

View File

@ -244,9 +244,9 @@ public class VTreeMaintenance extends TreeMaintenance
public void propertyChange (PropertyChangeEvent e) public void propertyChange (PropertyChangeEvent e)
{ {
MTreeNode tn = (MTreeNode)e.getNewValue(); MTreeNode tn = (MTreeNode)e.getNewValue();
log.info(tn.toString());
if (tn == null) if (tn == null)
return; return;
log.info(tn.toString());
ListModel model = centerList.getModel(); ListModel model = centerList.getModel();
int size = model.getSize(); int size = model.getSize();
int index = -1; int index = -1;

View File

@ -355,10 +355,10 @@ public final class VPanel extends CTabbedPane
fieldMinWidth = field.getPreferredSize().width > fieldMinWidth ? field.getPreferredSize().width : fieldMinWidth; fieldMinWidth = field.getPreferredSize().width > fieldMinWidth ? field.getPreferredSize().width : fieldMinWidth;
} }
// Link Label to Field // Link Label to Field
if (label != null) //if (label != null)
label.setLabelFor(field); label.setLabelFor(field);
else if (mField.isCreateMnemonic()) //else if (mField.isCreateMnemonic())
setMnemonic(editor, mField.getMnemonic()); //setMnemonic(editor, mField.getMnemonic());
} }
} // addField } // addField

View File

@ -68,8 +68,8 @@ public final class IniDialog extends JDialog implements ActionListener
log.warning("No license in resource "); log.warning("No license in resource ");
url = new URL("http://www.adempiere.org/license.htm"); url = new URL("http://www.adempiere.org/license.htm");
} }
if (url == null) //if (url == null)
cmd_reject(); //cmd_reject();
// //
licensePane.setPage(url); licensePane.setPage(url);
AdempierePLAF.showCenterScreen(this); AdempierePLAF.showCenterScreen(this);

View File

@ -326,10 +326,14 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = null;
if (f != null)
from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = null;
if (t != null)
to = new Timestamp(t.getTime());
if (from == null && to != null) if (from == null && to != null)
sql.append(" AND TRUNC(c.StatementDate) <= ?"); sql.append(" AND TRUNC(c.StatementDate) <= ?");
@ -401,10 +405,14 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = null;
if (f != null)
from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = null;
if (t != null)
to = new Timestamp(t.getTime());
log.fine("Date From=" + from + ", To=" + to); log.fine("Date From=" + from + ", To=" + to);

View File

@ -311,10 +311,14 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = null;
if (f != null)
from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = null;
if (t != null)
to = new Timestamp(t.getTime());
if (from == null && to != null) if (from == null && to != null)
sql.append(" AND TRUNC(i.MovementDate) <= ?"); sql.append(" AND TRUNC(i.MovementDate) <= ?");
@ -359,10 +363,14 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
{ {
Date f = fDateFrom.getValue(); Date f = fDateFrom.getValue();
Timestamp from = new Timestamp(f.getTime()); Timestamp from = null;
if (f != null)
from = new Timestamp(f.getTime());
Date t = fDateTo.getValue(); Date t = fDateTo.getValue();
Timestamp to = new Timestamp(t.getTime()); Timestamp to = null;
if (t != null)
to = new Timestamp(t.getTime());
log.fine("Date From=" + from + ", To=" + to); log.fine("Date From=" + from + ", To=" + to);

View File

@ -45,6 +45,7 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
@ -310,17 +311,15 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
{ {
Date f = fDateFrom.getValue();
Timestamp from = null; Timestamp from = null;
if (fDateFrom.getValue() != null) { if (f != null)
Date f = fDateFrom.getValue();
from = new Timestamp(f.getTime()); from = new Timestamp(f.getTime());
}
Date t = fDateTo.getValue();
Timestamp to = null; Timestamp to = null;
if (fDateTo.getValue() != null) { if (t != null)
Date t = fDateTo.getValue();
to = new Timestamp(t.getTime()); to = new Timestamp(t.getTime());
}
if (from == null && to != null) if (from == null && to != null)
sql.append(" AND TRUNC(p.DateTrx) <= ?"); sql.append(" AND TRUNC(p.DateTrx) <= ?");
@ -332,8 +331,25 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
if (!"".equals(fAmtFrom.getText()) || !"".equals(fAmtTo.getText())) if (!"".equals(fAmtFrom.getText()) || !"".equals(fAmtTo.getText()))
{ {
BigDecimal from = new BigDecimal(fAmtFrom.getValue()); String f = fAmtFrom.getValue();
BigDecimal to = new BigDecimal(fAmtTo.getValue()); BigDecimal from = null;
if (f != null) {
try {
from = new BigDecimal(fAmtFrom.getValue());
} catch (NumberFormatException e) {
fAmtFrom.setValue(null);
}
}
String t = fAmtTo.getValue();
BigDecimal to = null;
if (t != null) {
try {
to = new BigDecimal(fAmtTo.getValue());
} catch (NumberFormatException e) {
fAmtTo.setValue(null);
}
}
if (from == null && to != null) if (from == null && to != null)
sql.append(" AND p.PayAmt <= ?"); sql.append(" AND p.PayAmt <= ?");
@ -373,17 +389,15 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
if (fDateFrom.getValue() != null || fDateTo.getValue() != null) if (fDateFrom.getValue() != null || fDateTo.getValue() != null)
{ {
Date f = fDateFrom.getValue();
Timestamp from = null; Timestamp from = null;
if (fDateFrom.getValue() != null) { if (f != null)
Date f = fDateFrom.getValue();
from = new Timestamp(f.getTime()); from = new Timestamp(f.getTime());
}
Date t = fDateTo.getValue();
Timestamp to = null; Timestamp to = null;
if (fDateTo.getValue() != null) { if (t != null)
Date t = fDateTo.getValue();
to = new Timestamp(t.getTime()); to = new Timestamp(t.getTime());
}
log.fine("Date From=" + from + ", To=" + to); log.fine("Date From=" + from + ", To=" + to);
@ -400,8 +414,26 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
if (!"".equals(fAmtFrom.getText()) || !"".equals(fAmtTo.getText())) if (!"".equals(fAmtFrom.getText()) || !"".equals(fAmtTo.getText()))
{ {
BigDecimal from = new BigDecimal(fAmtFrom.getValue()); String f = fAmtFrom.getValue();
BigDecimal to = new BigDecimal(fAmtTo.getValue()); BigDecimal from = null;
if (f != null) {
try {
from = new BigDecimal(fAmtFrom.getValue());
} catch (NumberFormatException e) {
fAmtFrom.setValue(null);
}
}
String t = fAmtTo.getValue();
BigDecimal to = null;
if (t != null) {
try {
to = new BigDecimal(fAmtTo.getValue());
} catch (NumberFormatException e) {
fAmtTo.setValue(null);
}
}
log.fine("Amt From=" + from + ", To=" + to); log.fine("Amt From=" + from + ", To=" + to);
if (from == null && to != null) if (from == null && to != null)