diff --git a/base/src/org/adempiere/pipo/PackInHandler.java b/base/src/org/adempiere/pipo/PackInHandler.java index e93f60e800..fc061f41c9 100644 --- a/base/src/org/adempiere/pipo/PackInHandler.java +++ b/base/src/org/adempiere/pipo/PackInHandler.java @@ -333,7 +333,7 @@ public class PackInHandler extends DefaultHandler { else if (elementValue.equals("menu")) { log.info(elementValue+" "+atts.getValue("ADMenuNameID")); //String entitytype = atts.getValue("EntityType"); - //if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode == true ) { + //if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode == true ) { d_menu[menu_seq][0] = atts.getValue("ADMenuNameID"); d_menu[menu_seq][1] = atts.getValue("ADWindowNameID"); @@ -358,7 +358,7 @@ public class PackInHandler extends DefaultHandler { else if (elementValue.equals("window")) { log.info(elementValue+" "+atts.getValue("Name")); String entitytype = atts.getValue("EntityType"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { String name = atts.getValue("Name"); int id= get_ID("AD_Window", name); m_Window = new MWindow(m_ctx, id, m_trxName); @@ -430,7 +430,7 @@ public class PackInHandler extends DefaultHandler { else if (elementValue.equals("tab")) { log.info(elementValue+" "+atts.getValue("ADTabNameID")); String entitytype = atts.getValue("EntityType"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0) { String name = atts.getValue("ADTabNameID"); int tableid = get_IDWithColumn("AD_Table", "TableName", atts.getValue("ADTableNameID")); @@ -522,7 +522,7 @@ public class PackInHandler extends DefaultHandler { else if (elementValue.equals("field")) { log.info(elementValue+" "+atts.getValue("Name")); String entitytype = atts.getValue("EntityType"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0) { String name = atts.getValue("Name"); String tabname = atts.getValue("ADTabNameID"); String colname = atts.getValue("ADColumnNameID"); @@ -617,7 +617,7 @@ public class PackInHandler extends DefaultHandler { log.info(elementValue+" "+atts.getValue("Name")); int id = 0; String entitytype = atts.getValue("EntityType"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { String name = atts.getValue("Name"); @@ -678,7 +678,7 @@ public class PackInHandler extends DefaultHandler { log.info(elementValue+" "+atts.getValue("Name")); String entitytype = atts.getValue("EntityType"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { String name = atts.getValue("Name"); int id = get_IDWithMaster("AD_Process_Para", name, "AD_Process", atts.getValue("ADProcessNameID")); @@ -819,7 +819,7 @@ public class PackInHandler extends DefaultHandler { log.info(elementValue+" "+atts.getValue("ColumnName")); int success=0; String entitytype = atts.getValue("EntityType"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { String columnName = atts.getValue("ColumnName"); int tableid = get_IDWithColumn("AD_Table", "TableName", atts.getValue("ADTableNameID")); @@ -1438,7 +1438,7 @@ public class PackInHandler extends DefaultHandler { else if (elementValue.equals("task")) { log.info(elementValue+" "+atts.getValue("ADTaskNameID")); String entitytype = atts.getValue("EntityType"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { String name = atts.getValue("ADTaskNameID"); int id = get_ID("AD_Task", name); m_Task = new MTask(m_ctx, id, m_trxName); @@ -1470,7 +1470,7 @@ public class PackInHandler extends DefaultHandler { log.info(elementValue+" "+atts.getValue("ADFormNameID")); String entitytype = atts.getValue("EntityType"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { String name = atts.getValue("ADFormNameID"); int id = get_ID("AD_Form", name); m_Form = new MForm(m_ctx, id, m_trxName); @@ -1577,7 +1577,7 @@ public class PackInHandler extends DefaultHandler { log.info(elementValue+" "+atts.getValue("ADWorkbenchNameID")); String entitytype = atts.getValue("EntityType"); String name = atts.getValue("ADWorkbenchNameID"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { int id = get_ID("AD_Workbench", name); m_Workbench = new X_AD_Workbench(m_ctx, id, m_trxName); if (id > 0){ @@ -2089,7 +2089,7 @@ public class PackInHandler extends DefaultHandler { String entitytype = atts.getValue("EntityType"); String name = atts.getValue("ADReportViewColID"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { int id = get_ID("AD_Reportview_Col", name); m_Reportview_Col = new X_AD_ReportView_Col(m_ctx, id, m_trxName); if (id > 0){ @@ -2127,11 +2127,11 @@ public class PackInHandler extends DefaultHandler { int n = pstmt.executeUpdate(); log.info("Executed SQL Statement: "+ atts.getValue("statement")); } - else if(DB.isOracle() == true & DBType.equals("Oracle")){ + else if(DB.isOracle() == true && DBType.equals("Oracle")){ pstmt.executeUpdate(); log.info("Executed SQL Statement for Oracle: "+ atts.getValue("statement")); } - /* else if(DB.isSybase() == true & DBType.equals("Sybase")){ + /* else if(DB.isSybase() == true && DBType.equals("Sybase")){ pstmt.executeUpdate(); log.info("Exceuted SQL Statement for Sybase"); } @@ -2146,7 +2146,7 @@ public class PackInHandler extends DefaultHandler { String entitytype = atts.getValue("EntityType"); String name = atts.getValue("name"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { int id = get_ID("AD_Reference", name); m_Reference = new X_AD_Reference(m_ctx, id, m_trxName); @@ -2180,7 +2180,7 @@ public class PackInHandler extends DefaultHandler { log.info(elementValue+" "+atts.getValue("Name")); //TODO: Solve for date issues with valuefrom valueto String entitytype = atts.getValue("EntityType"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { String name = atts.getValue("Name"); int Referenceid = get_IDWithColumn("AD_Reference", "Name", atts.getValue("ADRefenceNameID")); int id = get_IDWithMaster("AD_Ref_List", name, "AD_Reference",Referenceid); @@ -2215,7 +2215,7 @@ public class PackInHandler extends DefaultHandler { String entitytype = atts.getValue("EntityType"); String name = atts.getValue("ADRefenceNameID"); - if (entitytype.compareTo("U") == 0 | entitytype.compareTo("D") == 0 & m_UpdateMode.compareTo("true") == 0 ) { + if (entitytype.compareTo("U") == 0 || entitytype.compareTo("D") == 0 && m_UpdateMode.compareTo("true") == 0 ) { sqlB = new StringBuffer ("SELECT AD_Reference_ID FROM AD_Reference WHERE Name= ?"); int id = DB.getSQLValue(m_trxName,sqlB.toString(),name); sqlB = new StringBuffer ("SELECT Count(*) FROM AD_Ref_Table WHERE AD_Reference_ID= ?"); diff --git a/base/src/org/adempiere/pipo/PackOut.java b/base/src/org/adempiere/pipo/PackOut.java index c32953d6b0..ae303f1f39 100644 --- a/base/src/org/adempiere/pipo/PackOut.java +++ b/base/src/org/adempiere/pipo/PackOut.java @@ -451,7 +451,7 @@ public class PackOut extends SvrProcess m_Menu = new X_AD_Menu (getCtx(), rs.getInt("AD_Menu_ID"), null); atts = createmenuBinding(atts,m_Menu); hd_menu.startElement("","","menu",atts); - if ( rs.getInt("AD_WINDOW_ID") > 0 | rs.getInt("AD_WORKFLOW_ID") > 0 | rs.getInt("AD_TASK_ID") > 0 | rs.getInt("AD_PROCESS_ID") > 0 | rs.getInt("AD_FORM_ID") > 0 | rs.getInt("AD_WORKBENCH_ID") > 0) + if ( rs.getInt("AD_WINDOW_ID") > 0 || rs.getInt("AD_WORKFLOW_ID") > 0 || rs.getInt("AD_TASK_ID") > 0 || rs.getInt("AD_PROCESS_ID") > 0 || rs.getInt("AD_FORM_ID") > 0 || rs.getInt("AD_WORKBENCH_ID") > 0) { //Call CreateWindow. if (rs.getInt("AD_WINDOW_ID") > 0) @@ -526,7 +526,7 @@ public class PackOut extends SvrProcess m_Menu = new X_AD_Menu (getCtx(), rs.getInt("AD_Menu_ID"), null); atts = createmenuBinding(atts,m_Menu); hd_menu.startElement("","","menu",atts); - if ( rs.getInt("AD_WINDOW_ID") > 0 | rs.getInt("AD_WORKFLOW_ID") > 0 | rs.getInt("AD_TASK_ID") > 0 | rs.getInt("AD_PROCESS_ID") > 0 | rs.getInt("AD_FORM_ID") > 0 | rs.getInt("AD_WORKBENCH_ID") > 0) + if ( rs.getInt("AD_WINDOW_ID") > 0 || rs.getInt("AD_WORKFLOW_ID") > 0 || rs.getInt("AD_TASK_ID") > 0 || rs.getInt("AD_PROCESS_ID") > 0 || rs.getInt("AD_FORM_ID") > 0 || rs.getInt("AD_WORKBENCH_ID") > 0) { //Call CreateWindow. if (rs.getInt("AD_WINDOW_ID") > 0) @@ -875,12 +875,12 @@ public class PackOut extends SvrProcess + "Upper(ColumnName)= '"+col_Name+"'"; String cName = DB.getSQLValueString(null,sql2,table_id); if (cName != null){ - if (cName.toUpperCase().equals(col_Name) & key1 == 0 ){ + if (cName.toUpperCase().equals(col_Name) && key1 == 0 ){ atts.addAttribute("","","key1name","CDATA",cName); atts.addAttribute("","","lookupkey1name","CDATA",""+rs.getObject(col_Name)); key1 = 1; } - else if (cName.toUpperCase().equals(col_Name) & key1 == 1 ){ + else if (cName.toUpperCase().equals(col_Name) && key1 == 1 ){ atts.addAttribute("","","key2name","CDATA",cName); atts.addAttribute("","","lookupkey2name","CDATA",""+rs.getObject(col_Name)); key1 = 2; diff --git a/base/src/org/compiere/cm/CacheHandler.java b/base/src/org/compiere/cm/CacheHandler.java index cae8363375..6aa9327f7b 100644 --- a/base/src/org/compiere/cm/CacheHandler.java +++ b/base/src/org/compiere/cm/CacheHandler.java @@ -180,8 +180,8 @@ public class CacheHandler { if (JNPURL.indexOf("jnp://")>=0) { JNPURL = JNPURL.substring(JNPURL.indexOf("jnp://")+6); } - if (JNPURL.indexOf(":")>=0) { - JNPURL = JNPURL.substring(0,JNPURL.indexOf(":")); + if (JNPURL.indexOf(':')>=0) { + JNPURL = JNPURL.substring(0,JNPURL.indexOf(':')); } if (JNPURL.length()>0) { return JNPURL; diff --git a/base/src/org/compiere/cm/StringUtil.java b/base/src/org/compiere/cm/StringUtil.java index 74978639e0..403ae1d2fb 100644 --- a/base/src/org/compiere/cm/StringUtil.java +++ b/base/src/org/compiere/cm/StringUtil.java @@ -236,8 +236,8 @@ public class StringUtil { */ public static String getNextWord(String tempStr) { String word = ""; - if (tempStr.indexOf(" ")>=0) { - word=tempStr.substring(0,tempStr.indexOf(" ")); + if (tempStr.indexOf(' ')>=0) { + word=tempStr.substring(0,tempStr.indexOf(' ')); } else { word=tempStr; } diff --git a/base/src/org/compiere/impexp/ImpFormatRow.java b/base/src/org/compiere/impexp/ImpFormatRow.java index 80fdaf4eb0..c7dcd41080 100644 --- a/base/src/org/compiere/impexp/ImpFormatRow.java +++ b/base/src/org/compiere/impexp/ImpFormatRow.java @@ -277,7 +277,7 @@ public final class ImpFormatRow // callout if (callout != null) { - int methodStart = callout.lastIndexOf("."); + int methodStart = callout.lastIndexOf('.'); try { if (methodStart != -1) // no class @@ -424,7 +424,7 @@ public final class ImpFormatRow ts = new Timestamp (System.currentTimeMillis()); // String dateString = ts.toString(); - return dateString.substring(0, dateString.indexOf(".")); // cut off miliseconds + return dateString.substring(0, dateString.indexOf('.')); // cut off miliseconds } // parseNumber /** @@ -463,14 +463,14 @@ public final class ImpFormatRow */ private String parseNumber (String info) { - boolean hasPoint = info.indexOf(".") != -1; - boolean hasComma = info.indexOf(",") != -1; + boolean hasPoint = info.indexOf('.') != -1; + boolean hasComma = info.indexOf(',') != -1; // delete thousands if (hasComma && m_decimalPoint.equals(".")) info = info.replace(',', ' '); if (hasPoint && m_decimalPoint.equals(",")) info = info.replace('.', ' '); - hasComma = info.indexOf(",") != -1; + hasComma = info.indexOf(',') != -1; // replace decimal if (hasComma && m_decimalPoint.equals(",")) diff --git a/base/src/org/compiere/impexp/OFX1ToXML.java b/base/src/org/compiere/impexp/OFX1ToXML.java index a541b01b42..1c9230580c 100644 --- a/base/src/org/compiere/impexp/OFX1ToXML.java +++ b/base/src/org/compiere/impexp/OFX1ToXML.java @@ -75,7 +75,7 @@ public final class OFX1ToXML extends InputStream implements Runnable write("\n"); write(" 0) { @@ -113,18 +113,18 @@ public final class OFX1ToXML extends InputStream implements Runnable while(m_ofx != "") { addCloseTag = false; - tagStart = m_ofx.indexOf("<"); + tagStart = m_ofx.indexOf('<'); if (tagStart == -1) { break; } - tagEnd = m_ofx.indexOf(">"); + tagEnd = m_ofx.indexOf('>'); if (tagEnd <= tagStart + 1) { throw new IOException("PARSE ERROR: Invalid tag"); } tag = m_ofx.substring(tagStart + 1, tagEnd); - if (tag.indexOf(" ") != -1) + if (tag.indexOf(' ') != -1) { throw new IOException("PARSE ERROR: Invalid tag"); } diff --git a/base/src/org/compiere/model/GridTab.java b/base/src/org/compiere/model/GridTab.java index bfbf8e9edc..fc02435a0b 100644 --- a/base/src/org/compiere/model/GridTab.java +++ b/base/src/org/compiere/model/GridTab.java @@ -2376,7 +2376,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable String cmd = st.nextToken().trim(); Callout call = null; String method = null; - int methodStart = cmd.lastIndexOf("."); + int methodStart = cmd.lastIndexOf('.'); try { if (methodStart != -1) // no class diff --git a/base/src/org/compiere/model/GridTable.java b/base/src/org/compiere/model/GridTable.java index 098c10b455..867b699e05 100644 --- a/base/src/org/compiere/model/GridTable.java +++ b/base/src/org/compiere/model/GridTable.java @@ -267,7 +267,7 @@ public class GridTable extends AbstractTableModel if (m_whereClause.length() > 0) { where.append(" WHERE "); - if (m_whereClause.indexOf("@") == -1) + if (m_whereClause.indexOf('@') == -1) where.append(m_whereClause); else // replace variables where.append(Env.parseContext(m_ctx, m_WindowNo, m_whereClause, false)); @@ -1721,7 +1721,7 @@ public class GridTable extends AbstractTableModel // MTable table = MTable.get (m_ctx, m_AD_Table_ID); PO po = null; - if (Record_ID != -1) + if (table.isSingleKey()) po = table.getPO(Record_ID, null); else // Multi - Key po = table.getPO(getWhereClause(rowData), null); diff --git a/base/src/org/compiere/model/MBPGroup.java b/base/src/org/compiere/model/MBPGroup.java index f14cd0f233..240ba42990 100644 --- a/base/src/org/compiere/model/MBPGroup.java +++ b/base/src/org/compiere/model/MBPGroup.java @@ -227,7 +227,7 @@ public class MBPGroup extends X_C_BP_Group */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) return insert_Accounting("C_BP_Group_Acct", "C_AcctSchema_Default", null); return success; } // afterSave diff --git a/base/src/org/compiere/model/MBPartner.java b/base/src/org/compiere/model/MBPartner.java index e640a7e51f..a9bd6a5fc6 100644 --- a/base/src/org/compiere/model/MBPartner.java +++ b/base/src/org/compiere/model/MBPartner.java @@ -1059,7 +1059,7 @@ public class MBPartner extends X_C_BPartner */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) { // Trees insert_Tree(MTree_Base.TREETYPE_BPartner); diff --git a/base/src/org/compiere/model/MBPartnerInfo.java b/base/src/org/compiere/model/MBPartnerInfo.java index fc58c5d9c1..22af75058b 100644 --- a/base/src/org/compiere/model/MBPartnerInfo.java +++ b/base/src/org/compiere/model/MBPartnerInfo.java @@ -60,7 +60,7 @@ public class MBPartnerInfo extends X_RV_BPartner { if (sb.length() > 0) sb.append(" OR "); - sb.append("UPPER(Contact) LIKE ?"); + sb.append("UPPER(ContactName) LIKE ?"); } EMail = getFindParameter (EMail); if (EMail != null) diff --git a/base/src/org/compiere/model/MBankAccount.java b/base/src/org/compiere/model/MBankAccount.java index 76cd1d9c92..8caa684b2d 100644 --- a/base/src/org/compiere/model/MBankAccount.java +++ b/base/src/org/compiere/model/MBankAccount.java @@ -121,7 +121,7 @@ public class MBankAccount extends X_C_BankAccount */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) return insert_Accounting("C_BankAccount_Acct", "C_AcctSchema_Default", null); return success; } // afterSave diff --git a/base/src/org/compiere/model/MCStage.java b/base/src/org/compiere/model/MCStage.java index d2d30891d3..07e9b830ea 100644 --- a/base/src/org/compiere/model/MCStage.java +++ b/base/src/org/compiere/model/MCStage.java @@ -119,7 +119,7 @@ public class MCStage extends X_CM_CStage { if (RelativeURL.endsWith("/")) RelativeURL = RelativeURL.substring(0, RelativeURL.length()-1); - int index = RelativeURL.lastIndexOf("/"); + int index = RelativeURL.lastIndexOf('/'); if (index != -1) RelativeURL = RelativeURL.substring(index+1); } diff --git a/base/src/org/compiere/model/MCashBook.java b/base/src/org/compiere/model/MCashBook.java index 84552c6c99..48b85c06f4 100644 --- a/base/src/org/compiere/model/MCashBook.java +++ b/base/src/org/compiere/model/MCashBook.java @@ -141,7 +141,7 @@ public class MCashBook extends X_C_CashBook */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) insert_Accounting("C_CashBook_Acct", "C_AcctSchema_Default", null); return success; diff --git a/base/src/org/compiere/model/MCharge.java b/base/src/org/compiere/model/MCharge.java index 433d4c08e0..b57b6c9c87 100644 --- a/base/src/org/compiere/model/MCharge.java +++ b/base/src/org/compiere/model/MCharge.java @@ -140,7 +140,7 @@ public class MCharge extends X_C_Charge */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) insert_Accounting("C_Charge_Acct", "C_AcctSchema_Default", null); return success; diff --git a/base/src/org/compiere/model/MCost.java b/base/src/org/compiere/model/MCost.java index 075f832fe7..161cf9546b 100644 --- a/base/src/org/compiere/model/MCost.java +++ b/base/src/org/compiere/model/MCost.java @@ -840,7 +840,7 @@ public class MCost extends X_M_Cost pstmt = null; } // - if (newAverageAmt != null & newAverageAmt.signum() != 0) + if (newAverageAmt != null && newAverageAmt.signum() != 0) { s_log.finer(product.getName() + " = " + newAverageAmt); return newAverageAmt; @@ -943,7 +943,7 @@ public class MCost extends X_M_Cost pstmt = null; } // - if (newAverageAmt != null & newAverageAmt.signum() != 0) + if (newAverageAmt != null && newAverageAmt.signum() != 0) { s_log.finer(product.getName() + " = " + newAverageAmt); return newAverageAmt; diff --git a/base/src/org/compiere/model/MMailText.java b/base/src/org/compiere/model/MMailText.java index bfbd0eb834..dffbeb21eb 100644 --- a/base/src/org/compiere/model/MMailText.java +++ b/base/src/org/compiere/model/MMailText.java @@ -144,7 +144,7 @@ public class MMailText extends X_R_MailText */ private String parse (String text) { - if (text.indexOf("@") == -1) + if (text.indexOf('@') == -1) return text; // Parse User text = parse (text, m_user); @@ -164,20 +164,20 @@ public class MMailText extends X_R_MailText */ private String parse (String text, PO po) { - if (po == null || text.indexOf("@") == -1) + if (po == null || text.indexOf('@') == -1) return text; String inStr = text; String token; StringBuffer outStr = new StringBuffer(); - int i = inStr.indexOf("@"); + int i = inStr.indexOf('@'); while (i != -1) { outStr.append(inStr.substring(0, i)); // up to @ inStr = inStr.substring(i+1, inStr.length()); // from first @ - int j = inStr.indexOf("@"); // next @ + int j = inStr.indexOf('@'); // next @ if (j < 0) // no second tag { inStr = "@" + inStr; @@ -188,7 +188,7 @@ public class MMailText extends X_R_MailText outStr.append(parseVariable(token, po)); // replace context inStr = inStr.substring(j+1, inStr.length()); // from second @ - i = inStr.indexOf("@"); + i = inStr.indexOf('@'); } outStr.append(inStr); // add remainder diff --git a/base/src/org/compiere/model/MMeasureCalc.java b/base/src/org/compiere/model/MMeasureCalc.java index c5c7626470..2e6600c41a 100644 --- a/base/src/org/compiere/model/MMeasureCalc.java +++ b/base/src/org/compiere/model/MMeasureCalc.java @@ -352,7 +352,7 @@ public class MMeasureCalc extends X_PA_MeasureCalc sb.append(")"); } // BPG - if (bpColumn.indexOf(".") == -1) + if (bpColumn.indexOf('.') == -1) bpColumn = tableName + "." + bpColumn; if (listBPG.size() == 1) sb.append(" AND EXISTS (SELECT * FROM C_BPartner bpx WHERE ") @@ -403,7 +403,7 @@ public class MMeasureCalc extends X_PA_MeasureCalc sb.append(")"); } // Category - if (pColumn.indexOf(".") == -1) + if (pColumn.indexOf('.') == -1) pColumn = tableName + "." + pColumn; if (listPC.size() == 1) sb.append(" AND EXISTS (SELECT * FROM M_Product px WHERE ") diff --git a/base/src/org/compiere/model/MOrder.java b/base/src/org/compiere/model/MOrder.java index ec5b1be96a..b80fdd3fa5 100644 --- a/base/src/org/compiere/model/MOrder.java +++ b/base/src/org/compiere/model/MOrder.java @@ -564,7 +564,7 @@ public class MOrder extends X_C_Order implements DocAction */ public File createPDF (File file) { - ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.ORDER, getC_Invoice_ID()); + ReportEngine re = ReportEngine.get (getCtx(), ReportEngine.ORDER, getC_Order_ID()); if (re == null) return null; return re.getPDF(file); diff --git a/base/src/org/compiere/model/MPriceListVersion.java b/base/src/org/compiere/model/MPriceListVersion.java index b0e30f1e27..b9957da01e 100644 --- a/base/src/org/compiere/model/MPriceListVersion.java +++ b/base/src/org/compiere/model/MPriceListVersion.java @@ -18,6 +18,7 @@ package org.compiere.model; import java.sql.*; import java.util.*; +import java.util.logging.*; import org.compiere.util.*; /** @@ -68,6 +69,79 @@ public class MPriceListVersion extends X_M_PriceList_Version setM_PriceList_ID(pl.getM_PriceList_ID()); } // MPriceListVersion + /** Product Prices */ + private MProductPrice[] m_pp = null; + /** Price List */ + private MPriceList m_pl = null; + + /** + * Get Parent PriceList + * @return price List + */ + public MPriceList getPriceList() + { + if (m_pl == null && getM_PriceList_ID() != 0) + m_pl = MPriceList.get (getCtx(), getM_PriceList_ID(), null); + return m_pl; + } // PriceList + + + /** + * Get Product Price + * @param refresh true if refresh + * @return product price + */ + public MProductPrice[] getProductPrice (boolean refresh) + { + if (m_pp != null && !refresh) + return m_pp; + m_pp = getProductPrice(null); + return m_pp; + } // getProductPrice + + /** + * Get Product Price + * @param whereClause optional where clause + * @return product price + */ + public MProductPrice[] getProductPrice (String whereClause) + { + ArrayList list = new ArrayList(); + String sql = "SELECT * FROM M_ProductPrice WHERE M_PriceList_Version_ID=?"; + if (whereClause != null) + sql += " " + whereClause; + PreparedStatement pstmt = null; + try + { + pstmt = DB.prepareStatement (sql, get_TrxName ()); + pstmt.setInt (1, getM_PriceList_Version_ID()); + ResultSet rs = pstmt.executeQuery (); + while (rs.next ()) + list.add (new MProductPrice(getCtx(), rs, get_TrxName())); + rs.close (); + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + log.log (Level.SEVERE, sql, e); + } + try + { + if (pstmt != null) + pstmt.close (); + pstmt = null; + } + catch (Exception e) + { + pstmt = null; + } + // + MProductPrice[] pp = new MProductPrice[list.size()]; + list.toArray(pp); + return pp; + } // getProductPrice + /** * Set Name to Valid From Date. * If valid from not set, use today diff --git a/base/src/org/compiere/model/MProductCategory.java b/base/src/org/compiere/model/MProductCategory.java index 0053effd76..1cc69c5212 100644 --- a/base/src/org/compiere/model/MProductCategory.java +++ b/base/src/org/compiere/model/MProductCategory.java @@ -148,7 +148,7 @@ public class MProductCategory extends X_M_Product_Category */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) insert_Accounting("M_Product_Category_Acct", "C_AcctSchema_Default", null); return success; diff --git a/base/src/org/compiere/model/MProductPrice.java b/base/src/org/compiere/model/MProductPrice.java index e39083f168..d6ec7edf1d 100644 --- a/base/src/org/compiere/model/MProductPrice.java +++ b/base/src/org/compiere/model/MProductPrice.java @@ -168,4 +168,18 @@ public class MProductPrice extends X_M_ProductPrice setPriceStd (PriceStd); } // setPrice + /** + * String Representation + * @return info + */ + public String toString() + { + StringBuffer sb = new StringBuffer ("MProductPrice["); + sb.append(getM_PriceList_Version_ID()) + .append(",M_Product_ID=").append (getM_Product_ID()) + .append(",PriceList=").append(getPriceList()) + .append("]"); + return sb.toString (); + } // toString + } // MProductPrice diff --git a/base/src/org/compiere/model/MProject.java b/base/src/org/compiere/model/MProject.java index d4e586c15b..7021d85ed9 100644 --- a/base/src/org/compiere/model/MProject.java +++ b/base/src/org/compiere/model/MProject.java @@ -477,7 +477,7 @@ public class MProject extends X_C_Project */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) { insert_Accounting("C_Project_Acct", "C_AcctSchema_Default", null); insert_Tree(MTree_Base.TREETYPE_Project); diff --git a/base/src/org/compiere/model/MTax.java b/base/src/org/compiere/model/MTax.java index 503ac43eca..a094b6499f 100644 --- a/base/src/org/compiere/model/MTax.java +++ b/base/src/org/compiere/model/MTax.java @@ -341,7 +341,7 @@ public class MTax extends X_C_Tax */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) insert_Accounting("C_Tax_Acct", "C_AcctSchema_Default", null); return success; diff --git a/base/src/org/compiere/model/MWithholding.java b/base/src/org/compiere/model/MWithholding.java index 7764b8a334..8e335651fe 100644 --- a/base/src/org/compiere/model/MWithholding.java +++ b/base/src/org/compiere/model/MWithholding.java @@ -58,7 +58,7 @@ public class MWithholding extends X_C_Withholding */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) insert_Accounting("C_Withholding_Acct", "C_AcctSchema_Default", null); return success; diff --git a/base/src/org/compiere/model/PP_PayFlowPro.java b/base/src/org/compiere/model/PP_PayFlowPro.java index cc43ec751e..7eb7f4af9b 100644 --- a/base/src/org/compiere/model/PP_PayFlowPro.java +++ b/base/src/org/compiere/model/PP_PayFlowPro.java @@ -167,7 +167,7 @@ public final class PP_PayFlowPro extends PaymentProcessor while (st.hasMoreTokens()) { String token = st.nextToken(); - int pos = token.indexOf("="); + int pos = token.indexOf('='); String name = token.substring(0, pos); String value = token.substring(pos+1); // diff --git a/base/src/org/compiere/model/Scriptlet.java b/base/src/org/compiere/model/Scriptlet.java index f418c24368..a99534fb2b 100644 --- a/base/src/org/compiere/model/Scriptlet.java +++ b/base/src/org/compiere/model/Scriptlet.java @@ -235,7 +235,7 @@ public class Scriptlet // filter if (key == null || key.length() == 0 || key.startsWith("P") // Preferences - || (key.indexOf("|") != -1 && !key.startsWith(String.valueOf(WindowNo))) // other Window Settings + || (key.indexOf('|') != -1 && !key.startsWith(String.valueOf(WindowNo))) // other Window Settings ) continue; diff --git a/base/src/org/compiere/process/AssetDelivery.java b/base/src/org/compiere/process/AssetDelivery.java index c49cf33b26..c6aca3867c 100644 --- a/base/src/org/compiere/process/AssetDelivery.java +++ b/base/src/org/compiere/process/AssetDelivery.java @@ -88,7 +88,7 @@ public class AssetDelivery extends SvrProcess long start = System.currentTimeMillis(); // Test - if (m_client.getSMTPHost() == null) + if (m_client.getSMTPHost() == null || m_client.getSMTPHost().length() == 0) throw new Exception ("No Client SMTP Info"); if (m_client.getRequestEMail() == null) throw new Exception ("No Client Request User"); diff --git a/base/src/org/compiere/process/ImportBPartner.java b/base/src/org/compiere/process/ImportBPartner.java index fbe91e37b3..16552951c1 100644 --- a/base/src/org/compiere/process/ImportBPartner.java +++ b/base/src/org/compiere/process/ImportBPartner.java @@ -100,7 +100,7 @@ public class ImportBPartner extends SvrProcess // Set BP_Group sql = new StringBuffer ("UPDATE I_BPartner i " + "SET GroupValue=(SELECT MAX(Value) FROM C_BP_Group g WHERE g.IsDefault='Y'" - + " AND g.AD_Client_ID=i.AD_Client_ID"); + + " AND g.AD_Client_ID=i.AD_Client_ID) "); sql.append("WHERE GroupValue IS NULL AND C_BP_Group_ID IS NULL" + " AND I_IsImported<>'Y'").append(clientCheck); no = DB.executeUpdate(sql.toString(), get_TrxName()); diff --git a/base/src/org/compiere/process/InventoryValue.java b/base/src/org/compiere/process/InventoryValue.java index b4531e13ea..defb658c7a 100644 --- a/base/src/org/compiere/process/InventoryValue.java +++ b/base/src/org/compiere/process/InventoryValue.java @@ -225,9 +225,9 @@ public class InventoryValue extends SvrProcess // Update Prices no = DB.executeUpdate ("UPDATE T_InventoryValue iv " + "SET PricePO = " - + "(SELECT currencyConvert (po.PriceList,po.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, po.AD_Client_ID,po.AD_Org_ID)" + + "(SELECT MAX(currencyConvert (po.PriceList,po.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, po.AD_Client_ID,po.AD_Org_ID))" + " FROM M_Product_PO po WHERE po.M_Product_ID=iv.M_Product_ID" - + " AND po.IsCurrentVendor='Y' AND RowNum=1), " + + " AND po.IsCurrentVendor='Y'), " + "PriceList = " + "(SELECT currencyConvert(pp.PriceList,pl.C_Currency_ID,iv.C_Currency_ID,iv.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID)" + " FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp" diff --git a/base/src/org/compiere/process/PaySelectionCreateCheck.java b/base/src/org/compiere/process/PaySelectionCreateCheck.java index b2c1307e58..2a5478407b 100644 --- a/base/src/org/compiere/process/PaySelectionCreateCheck.java +++ b/base/src/org/compiere/process/PaySelectionCreateCheck.java @@ -54,7 +54,7 @@ public class PaySelectionCreateCheck extends SvrProcess log.log(Level.SEVERE, "Unknown Parameter: " + name); } p_C_PaySelection_ID = getRecord_ID(); - if (p_PaymentRule != null & p_PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDebit)) + if (p_PaymentRule != null && p_PaymentRule.equals(X_C_Order.PAYMENTRULE_DirectDebit)) p_PaymentRule = null; } // prepare diff --git a/base/src/org/compiere/process/PeriodStatus.java b/base/src/org/compiere/process/PeriodStatus.java index e9813ac4ae..ca236a157e 100644 --- a/base/src/org/compiere/process/PeriodStatus.java +++ b/base/src/org/compiere/process/PeriodStatus.java @@ -63,7 +63,7 @@ public class PeriodStatus extends SvrProcess log.info ("C_Period_ID=" + p_C_Period_ID + ", PeriodAction=" + p_PeriodAction); MPeriod period = new MPeriod (getCtx(), p_C_Period_ID, get_TrxName()); if (period.get_ID() == 0) - throw new IllegalArgumentException("@NotFound@ @C_Period_ID@=" + p_C_Period_ID); + throw new AdempiereUserError("@NotFound@ @C_Period_ID@=" + p_C_Period_ID); StringBuffer sql = new StringBuffer ("UPDATE C_PeriodControl "); sql.append("SET PeriodStatus='"); diff --git a/base/src/org/compiere/process/TableCreateColumns.java b/base/src/org/compiere/process/TableCreateColumns.java index c414ba0c68..9661c535bd 100644 --- a/base/src/org/compiere/process/TableCreateColumns.java +++ b/base/src/org/compiere/process/TableCreateColumns.java @@ -143,7 +143,7 @@ public class TableCreateColumns extends SvrProcess || tn.endsWith("_V1") // views || tn.startsWith("A_A") // asset tables not yet || tn.startsWith("A_D") // asset tables not yet - || tn.indexOf("$") != -1 // oracle system tables + || tn.indexOf('$') != -1 // oracle system tables || tn.indexOf("EXPLAIN") != -1 // explain plan ) { diff --git a/base/src/org/compiere/tools/FileUtil.java b/base/src/org/compiere/tools/FileUtil.java index 034cbbe5c6..a4579bc382 100644 --- a/base/src/org/compiere/tools/FileUtil.java +++ b/base/src/org/compiere/tools/FileUtil.java @@ -361,7 +361,7 @@ public class FileUtil if (name == null) return false; // ignore files with ~ and this file - if (name.indexOf("~") != -1 || name.equals("FileUtil.java")) + if (name.indexOf('~') != -1 || name.equals("FileUtil.java")) return false; // return name.indexOf(filterString) != -1; diff --git a/base/src/org/compiere/util/EnvLoader.java b/base/src/org/compiere/util/EnvLoader.java index 10bba079da..ab95eaab45 100644 --- a/base/src/org/compiere/util/EnvLoader.java +++ b/base/src/org/compiere/util/EnvLoader.java @@ -137,7 +137,7 @@ public class EnvLoader { String s = st.nextToken(); // System.out.println(">" + s + "<"); - int pos = s.indexOf("="); // first "=" + int pos = s.indexOf('='); // first "=" if (pos > 0) prop.setProperty(prefix + s.substring(0, pos), s.substring(pos+1)); } diff --git a/base/src/org/compiere/util/FileUpload.java b/base/src/org/compiere/util/FileUpload.java index 3ca7cb61cd..6ee92e2745 100644 --- a/base/src/org/compiere/util/FileUpload.java +++ b/base/src/org/compiere/util/FileUpload.java @@ -130,7 +130,7 @@ public class FileUpload // int formDataLength = request.getContentLength(); String contentType = request.getContentType(); - int index = contentType.lastIndexOf("="); + int index = contentType.lastIndexOf('='); String boundary = contentType.substring(index+1); log.fine(formDataLength + " - " + boundary); int sizeKB = formDataLength/1024; diff --git a/base/src/org/compiere/util/WebUtil.java b/base/src/org/compiere/util/WebUtil.java index 278f7b836b..972d81061d 100644 --- a/base/src/org/compiere/util/WebUtil.java +++ b/base/src/org/compiere/util/WebUtil.java @@ -242,7 +242,7 @@ public final class WebUtil outStr.append(inStr.substring(0, i)); // up to &# inStr = inStr.substring(i+2, inStr.length()); // from &# - int j = inStr.indexOf(";"); // next ; + int j = inStr.indexOf(';'); // next ; if (j < 0) // no second tag { inStr = "&#" + inStr; diff --git a/base/src/org/compiere/wf/MWFActivity.java b/base/src/org/compiere/wf/MWFActivity.java index 8163d943f0..79e68ca7fe 100644 --- a/base/src/org/compiere/wf/MWFActivity.java +++ b/base/src/org/compiere/wf/MWFActivity.java @@ -1249,12 +1249,12 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable if (variableName == null || (variableName != null && variableName.length() == 0)) value = null; - else if (variableName.indexOf("@") != -1 && m_po != null) // we have a variable + else if (variableName.indexOf('@') != -1 && m_po != null) // we have a variable { // Strip - int index = variableName.indexOf("@"); + int index = variableName.indexOf('@'); String columnName = variableName.substring(index+1); - index = columnName.indexOf("@"); + index = columnName.indexOf('@'); if (index == -1) { log.warning(nPara.getAttributeName() @@ -1486,7 +1486,7 @@ public class MWFActivity extends X_AD_WF_Activity implements Runnable else if (email != null && email.length() > 0) { // Just one - if (email.indexOf(";") == -1) + if (email.indexOf(';') == -1) { email = email.trim(); if (!m_emails.contains(email)) diff --git a/client/src/org/compiere/acct/AcctViewerData.java b/client/src/org/compiere/acct/AcctViewerData.java index cd94ebd01f..4e57c13cef 100644 --- a/client/src/org/compiere/acct/AcctViewerData.java +++ b/client/src/org/compiere/acct/AcctViewerData.java @@ -413,7 +413,7 @@ class AcctViewerData rm.addColumn(new RColumn(ctx, column, DisplayType.Date)); else if (column.startsWith("UserElement")) { - if (column.indexOf("1") != -1) + if (column.indexOf('1') != -1) rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref1)); else rm.addColumn(new RColumn(ctx, column, DisplayType.TableDir, null, 0, m_ref2)); @@ -473,7 +473,7 @@ class AcctViewerData String columnName = ase.getColumnName(); if (columnName.startsWith("UserElement")) { - if (columnName.indexOf("1") != -1) + if (columnName.indexOf('1') != -1) m_ref1 = ase.getDisplayColumnName(); else m_ref2 = ase.getDisplayColumnName(); diff --git a/client/src/org/compiere/apps/APanel.java b/client/src/org/compiere/apps/APanel.java index 2d897f9606..3c95451917 100644 --- a/client/src/org/compiere/apps/APanel.java +++ b/client/src/org/compiere/apps/APanel.java @@ -1402,7 +1402,7 @@ public final class APanel extends CPanel String cmd = st.nextToken().trim(); Callout call = null; String method = null; - int methodStart = cmd.lastIndexOf("."); + int methodStart = cmd.lastIndexOf('.'); try { if (methodStart != -1) // no class @@ -2238,7 +2238,7 @@ public final class APanel extends CPanel public String getSelectedTabName() { String title = m_curWinTab.getTitleAt(m_curWinTab.getSelectedIndex()); title = title.substring(title.indexOf("")+6); - title = title.substring(0,title.indexOf("<")); + title = title.substring(0,title.indexOf('<')); return title; } diff --git a/client/src/org/compiere/apps/Attachment.java b/client/src/org/compiere/apps/Attachment.java index 66a1d5dedc..69267c0f1c 100644 --- a/client/src/org/compiere/apps/Attachment.java +++ b/client/src/org/compiere/apps/Attachment.java @@ -455,7 +455,7 @@ public final class Attachment extends CDialog return; String fileName = getFileName(index); - String ext = fileName.substring (fileName.lastIndexOf(".")); + String ext = fileName.substring (fileName.lastIndexOf('.')); log.config( "Ext=" + ext); JFileChooser chooser = new JFileChooser(); diff --git a/client/src/org/compiere/apps/ProcessCtl.java b/client/src/org/compiere/apps/ProcessCtl.java index 4d60a6c332..bad2e18fe4 100644 --- a/client/src/org/compiere/apps/ProcessCtl.java +++ b/client/src/org/compiere/apps/ProcessCtl.java @@ -422,7 +422,7 @@ public class ProcessCtl extends Thread { String summary = m_pi.getSummary(); log.finer("unlock - " + summary); - if (summary != null && summary.indexOf("@") != -1) + if (summary != null && summary.indexOf('@') != -1) m_pi.setSummary(Msg.parseTranslation(Env.getCtx(), summary)); m_parent.unlockUI(m_pi); } diff --git a/client/src/org/compiere/apps/WindowMenu.java b/client/src/org/compiere/apps/WindowMenu.java index adb297a59f..4a56c79641 100644 --- a/client/src/org/compiere/apps/WindowMenu.java +++ b/client/src/org/compiere/apps/WindowMenu.java @@ -42,7 +42,7 @@ public class WindowMenu extends JMenu { private void setEnvText(JMenu menu, String msg) { String text = Msg.getMsg(Env.getCtx(), msg); - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1 && text.length() > pos) // We have a nemonic { char ch = text.toUpperCase().charAt(pos+1); @@ -57,7 +57,7 @@ public class WindowMenu extends JMenu { private void setEnvText(JMenuItem menu, String msg) { String text = Msg.getMsg(Env.getCtx(), msg); - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1 && text.length() > pos) // We have a nemonic { char ch = text.toUpperCase().charAt(pos+1); diff --git a/client/src/org/compiere/apps/form/ArchiveViewer.java b/client/src/org/compiere/apps/form/ArchiveViewer.java index 32a8cbb166..09d39a4cd1 100644 --- a/client/src/org/compiere/apps/form/ArchiveViewer.java +++ b/client/src/org/compiere/apps/form/ArchiveViewer.java @@ -506,7 +506,7 @@ public class ArchiveViewer extends CTabbedPane String ss = nameQField.getText(); if (ss != null && ss.length() > 0) { - if (ss.indexOf("%") != -1 || ss.indexOf("_") != -1) + if (ss.indexOf('%') != -1 || ss.indexOf('_') != -1) sql.append(" AND Name LIKE ").append(DB.TO_STRING(ss)); else sql.append(" AND Name=").append(DB.TO_STRING(ss)); @@ -516,7 +516,7 @@ public class ArchiveViewer extends CTabbedPane ss = descriptionQField.getText(); if (ss != null && ss.length() > 0) { - if (ss.indexOf("%") != -1 || ss.indexOf("_") != -1) + if (ss.indexOf('%') != -1 || ss.indexOf('_') != -1) sql.append(" AND Description LIKE ").append(DB.TO_STRING(ss)); else sql.append(" AND Description=").append(DB.TO_STRING(ss)); @@ -526,7 +526,7 @@ public class ArchiveViewer extends CTabbedPane ss = helpQField.getText(); if (ss != null && ss.length() > 0) { - if (ss.indexOf("%") != -1 || ss.indexOf("_") != -1) + if (ss.indexOf('%') != -1 || ss.indexOf('_') != -1) sql.append(" AND Help LIKE ").append(DB.TO_STRING(ss)); else sql.append(" AND Help=").append(DB.TO_STRING(ss)); diff --git a/client/src/org/compiere/apps/search/Find.java b/client/src/org/compiere/apps/search/Find.java index 0f9e1e53a5..7aaa989930 100644 --- a/client/src/org/compiere/apps/search/Find.java +++ b/client/src/org/compiere/apps/search/Find.java @@ -623,12 +623,12 @@ public final class Find extends CDialog // fix a bug with virtualColumn + isSelectionColumn not yielding results GridField field = getTargetMField(ColumnName); String ColumnSQL = field.getColumnSQL(false); - if (value.toString().indexOf("%") != -1) + if (value.toString().indexOf('%') != -1) m_query.addRestriction(ColumnSQL, MQuery.LIKE, value, ColumnName, ved.getDisplay()); else m_query.addRestriction(ColumnSQL, MQuery.EQUAL, value, ColumnName, ved.getDisplay()); /* - if (value.toString().indexOf("%") != -1) + if (value.toString().indexOf('%') != -1) m_query.addRestriction(ColumnName, MQuery.LIKE, value, ColumnName, ved.getDisplay()); else m_query.addRestriction(ColumnName, MQuery.EQUAL, value, ColumnName, ved.getDisplay()); diff --git a/client/src/org/compiere/apps/search/FindValueRenderer.java b/client/src/org/compiere/apps/search/FindValueRenderer.java index f63984d15f..e9b638e323 100644 --- a/client/src/org/compiere/apps/search/FindValueRenderer.java +++ b/client/src/org/compiere/apps/search/FindValueRenderer.java @@ -125,7 +125,7 @@ public final class FindValueRenderer extends DefaultTableCellRenderer if (value instanceof Boolean) cb.setSelected(((Boolean)value).booleanValue()); else - cb.setSelected(value.toString().indexOf("Y") != -1); + cb.setSelected(value.toString().indexOf('Y') != -1); return cb; } return c; diff --git a/client/src/org/compiere/apps/search/InfoBPartner.java b/client/src/org/compiere/apps/search/InfoBPartner.java index 70ee9041dc..645cf2c381 100644 --- a/client/src/org/compiere/apps/search/InfoBPartner.java +++ b/client/src/org/compiere/apps/search/InfoBPartner.java @@ -223,8 +223,8 @@ public class InfoBPartner extends Info if (value.equals("%")) fieldName.setText(value); // No Numbers entered - else if ((value.indexOf("0")+value.indexOf("1")+value.indexOf("2")+value.indexOf("3")+value.indexOf("4") +value.indexOf("5") - +value.indexOf("6")+value.indexOf("7")+value.indexOf("8")+value.indexOf("9")) == -10) + else if ((value.indexOf('0')+value.indexOf('1')+value.indexOf('2')+value.indexOf('3')+value.indexOf('4') +value.indexOf('5') + +value.indexOf('6')+value.indexOf('7')+value.indexOf('8')+value.indexOf('9')) == -10) { if (value.startsWith("%")) fieldName.setText(value); diff --git a/client/src/org/compiere/apps/search/InfoProduct.java b/client/src/org/compiere/apps/search/InfoProduct.java index 69c5be6a41..4529e2998d 100644 --- a/client/src/org/compiere/apps/search/InfoProduct.java +++ b/client/src/org/compiere/apps/search/InfoProduct.java @@ -437,7 +437,7 @@ public final class InfoProduct extends Info implements ActionListener { for (int i = 0; i < p_layout.length; i++) { - if (p_layout[i].getColSQL().indexOf("?") != -1) + if (p_layout[i].getColSQL().indexOf('?') != -1) pstmt.setInt(index++, M_Warehouse_ID); } } diff --git a/client/src/org/compiere/grid/VPanel.java b/client/src/org/compiere/grid/VPanel.java index 1478113caa..959fc26e0f 100644 --- a/client/src/org/compiere/grid/VPanel.java +++ b/client/src/org/compiere/grid/VPanel.java @@ -109,7 +109,7 @@ public final class VPanel extends CPanel if (mField.isCreateMnemonic()) return; String text = mField.getHeader(); - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1 && text.length() > pos) // We have a nemonic - creates Ctrl_Shift_ { char mnemonic = text.toUpperCase().charAt(pos+1); @@ -263,7 +263,7 @@ public final class VPanel extends CPanel private void setMnemonic (CLabel label, char predefinedMnemonic) { String text = label.getText(); - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1 && predefinedMnemonic != 0) { text = text.substring(0, pos) + text.substring(pos+1); @@ -292,7 +292,7 @@ public final class VPanel extends CPanel { VCheckBox cb = (VCheckBox)editor; String text = cb.getText(); - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1 && predefinedMnemonic != 0) { text = text.substring(0, pos) + text.substring(pos+1); @@ -314,7 +314,7 @@ public final class VPanel extends CPanel { VButton b = (VButton)editor; String text = b.getText(); - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1 && predefinedMnemonic != 0) { text = text.substring(0, pos) + text.substring(pos+1); diff --git a/client/src/org/compiere/grid/VPayment.java b/client/src/org/compiere/grid/VPayment.java index 9f2da87e73..b4f2a627c9 100644 --- a/client/src/org/compiere/grid/VPayment.java +++ b/client/src/org/compiere/grid/VPayment.java @@ -1157,7 +1157,7 @@ public class VPayment extends CDialog if (error.length() != 0) { kNumberField.setBackground(AdempierePLAF.getFieldBackground_Error()); - if (error.indexOf("?") == -1) + if (error.indexOf('?') == -1) { ADialog.error(m_WindowNo, this, error); dataOK = false; diff --git a/client/src/org/compiere/grid/VTabbedPane.java b/client/src/org/compiere/grid/VTabbedPane.java index 5e2bed7deb..7d2dbce0cf 100644 --- a/client/src/org/compiere/grid/VTabbedPane.java +++ b/client/src/org/compiere/grid/VTabbedPane.java @@ -19,7 +19,6 @@ package org.compiere.grid; import java.awt.*; import java.util.*; import javax.swing.*; -import org.compiere.*; import org.compiere.apps.*; import org.compiere.model.*; import org.compiere.swing.*; diff --git a/client/src/org/compiere/grid/ed/VBinary.java b/client/src/org/compiere/grid/ed/VBinary.java index 94bcb45222..17426c420f 100644 --- a/client/src/org/compiere/grid/ed/VBinary.java +++ b/client/src/org/compiere/grid/ed/VBinary.java @@ -87,7 +87,7 @@ public class VBinary extends JButton else { text = m_data.getClass().getName(); - int index = text.lastIndexOf("."); + int index = text.lastIndexOf('.'); if (index != -1) text = text.substring(index+1); } diff --git a/client/src/org/compiere/grid/ed/VLookup.java b/client/src/org/compiere/grid/ed/VLookup.java index de5c67f2f9..8f3af66fc3 100644 --- a/client/src/org/compiere/grid/ed/VLookup.java +++ b/client/src/org/compiere/grid/ed/VLookup.java @@ -662,8 +662,8 @@ public class VLookup extends JComponent boolean cancelled = false; // String col = m_lookup.getColumnName(); // fully qualified name - if (col.indexOf(".") != -1) - col = col.substring(col.indexOf(".")+1); + if (col.indexOf('.') != -1) + col = col.substring(col.indexOf('.')+1); // Zoom / Validation String whereClause = getWhereClause(); // diff --git a/client/src/org/compiere/grid/tree/VTreePanel.java b/client/src/org/compiere/grid/tree/VTreePanel.java index 81bbea88f8..3322c4a5ae 100644 --- a/client/src/org/compiere/grid/tree/VTreePanel.java +++ b/client/src/org/compiere/grid/tree/VTreePanel.java @@ -871,7 +871,7 @@ public final class VTreePanel extends CPanel { // Only first word of Label String label = nd.toString().trim(); - int space = label.indexOf(" "); + int space = label.indexOf(' '); // if (space != -1) // label = label.substring(0, space); diff --git a/client/src/org/compiere/pos/SubBPartner.java b/client/src/org/compiere/pos/SubBPartner.java index c6760a53f8..b84bdd2091 100644 --- a/client/src/org/compiere/pos/SubBPartner.java +++ b/client/src/org/compiere/pos/SubBPartner.java @@ -31,7 +31,7 @@ import org.compiere.util.*; * * @author Comunidad de Desarrollo OpenXpertya * *Basado en Codigo Original Modificado, Revisado y Optimizado de: - * *Copyright © Jorg Janke + * *Copyright � Jorg Janke * @version $Id: SubBPartner.java,v 1.1 2004/07/12 04:10:04 jjanke Exp $ */ public class SubBPartner extends PosSubPanel @@ -224,7 +224,7 @@ public class SubBPartner extends PosSubPanel String Value = query; String Name = (allNumber ? null : query); String Contact = (allNumber ? null : query); - String EMail = (query.indexOf("@") != -1 ? query : null); + String EMail = (query.indexOf('@') != -1 ? query : null); String Phone = (noNumber ? null : query); String City = null; // diff --git a/client/src/org/compiere/pos/SubCurrentLine.java b/client/src/org/compiere/pos/SubCurrentLine.java index 4715f138ed..c870c763e3 100644 --- a/client/src/org/compiere/pos/SubCurrentLine.java +++ b/client/src/org/compiere/pos/SubCurrentLine.java @@ -32,7 +32,7 @@ import org.compiere.util.*; * * @author Comunidad de Desarrollo OpenXpertya * *Basado en Codigo Original Modificado, Revisado y Optimizado de: - * *Copyright © Jorg Janke + * *Copyright � Jorg Janke * @version $Id: SubCurrentLine.java,v 1.3 2004/07/24 04:31:52 jjanke Exp $ */ public class SubCurrentLine extends PosSubPanel implements ActionListener { @@ -275,7 +275,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener { * @return true if deleted */ public void deleteLine (int row) { - if (m_order != null & row != -1 ) + if (m_order != null && row != -1 ) { MOrderLine[] lineas = m_order.getLines(); int numLineas = lineas.length; @@ -295,7 +295,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener { * * @author Comunidad de Desarrollo OpenXpertya * *Basado en Codigo Original Modificado, Revisado y Optimizado de: - * *Copyright © ConSerTi + * *Copyright � ConSerTi */ public void deleteOrder () { if (m_order != null) @@ -338,7 +338,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener { * * @author Comunidad de Desarrollo OpenXpertya * *Basado en Codigo Original Modificado, Revisado y Optimizado de: - * *Copyright © ConSerTi + * *Copyright � ConSerTi */ public void newOrder() { @@ -394,7 +394,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener { /** * @author Comunidad de Desarrollo OpenXpertya * *Basado en Codigo Original Modificado, Revisado y Optimizado de: - * *Copyright © ConSerTi + * *Copyright � ConSerTi */ public void setBPartner() { diff --git a/client/src/org/compiere/print/Viewer.java b/client/src/org/compiere/print/Viewer.java index d8dfea9f2b..d3a20f94ab 100644 --- a/client/src/org/compiere/print/Viewer.java +++ b/client/src/org/compiere/print/Viewer.java @@ -809,12 +809,12 @@ public class Viewer extends CFrame String ext = outFile.getPath(); // no extension - if (ext.lastIndexOf(".") == -1) + if (ext.lastIndexOf('.') == -1) { ADialog.error(m_WindowNo, this, "FileInvalidExtension"); return; } - ext = ext.substring(ext.lastIndexOf(".")+1).toLowerCase(); + ext = ext.substring(ext.lastIndexOf('.')+1).toLowerCase(); log.config( "File=" + outFile.getPath() + "; Type=" + ext); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); @@ -858,7 +858,7 @@ public class Viewer extends CFrame if (AD_ReportView_ID != 0) { String name = m_reportEngine.getName(); - int index = name.lastIndexOf("_"); + int index = name.lastIndexOf('_'); if (index != -1) name = name.substring(0,index); pf = MPrintFormat.createFromReportView(m_ctx, AD_ReportView_ID, name); diff --git a/dbPort/src/org/compiere/db/DB_Fyracle.java b/dbPort/src/org/compiere/db/DB_Fyracle.java index 193129bfef..648af7bc75 100644 --- a/dbPort/src/org/compiere/db/DB_Fyracle.java +++ b/dbPort/src/org/compiere/db/DB_Fyracle.java @@ -440,7 +440,7 @@ public class DB_Fyracle implements AdempiereDatabase { dateString.append(myDate.substring(0, 10)); dateString.append("','YYYY-MM-DD')"); } else { - dateString.append(myDate.substring(0, myDate.indexOf("."))); // cut + dateString.append(myDate.substring(0, myDate.indexOf('.'))); // cut // off // miliseconds dateString.append("','YYYY-MM-DD HH24:MI:SS')"); diff --git a/dbPort/src/org/compiere/db/DB_Oracle.java b/dbPort/src/org/compiere/db/DB_Oracle.java index 03f8f264f0..78b199ed32 100644 --- a/dbPort/src/org/compiere/db/DB_Oracle.java +++ b/dbPort/src/org/compiere/db/DB_Oracle.java @@ -434,7 +434,7 @@ public class DB_Oracle implements AdempiereDatabase, OracleConnectionCacheCallba } else { - dateString.append(myDate.substring(0, myDate.indexOf("."))); // cut off miliseconds + dateString.append(myDate.substring(0, myDate.indexOf('.'))); // cut off miliseconds dateString.append("','YYYY-MM-DD HH24:MI:SS')"); } return dateString.toString(); diff --git a/dbPort/src/org/compiere/db/DB_PostgreSQL.java b/dbPort/src/org/compiere/db/DB_PostgreSQL.java index 76fb7165d4..1bdbb3390d 100755 --- a/dbPort/src/org/compiere/db/DB_PostgreSQL.java +++ b/dbPort/src/org/compiere/db/DB_PostgreSQL.java @@ -325,7 +325,7 @@ public class DB_PostgreSQL implements AdempiereDatabase } else { - dateString.append(myDate.substring(0, myDate.indexOf("."))); // cut off miliseconds + dateString.append(myDate.substring(0, myDate.indexOf('.'))); // cut off miliseconds dateString.append("','YYYY-MM-DD HH24:MI:SS')"); } return dateString.toString(); @@ -580,7 +580,7 @@ public class DB_PostgreSQL implements AdempiereDatabase { if (IXName == null || IXName.length()==0) return "0"; - if (IXName.endsWith("_KEY")) + if (IXName.toUpperCase().endsWith("_KEY")) return "1"+IXName; else return "0"; diff --git a/dbPort/src/org/compiere/dbPort/Convert.java b/dbPort/src/org/compiere/dbPort/Convert.java index e4a5f56925..4e199dbb8d 100644 --- a/dbPort/src/org/compiere/dbPort/Convert.java +++ b/dbPort/src/org/compiere/dbPort/Convert.java @@ -244,7 +244,7 @@ public abstract class Convert while (m.find()) { String group = m.group(); // SQL string - if (group.indexOf("/") != -1) // / in string + if (group.indexOf('/') != -1) // / in string group = group.replace('/', MASK); if (group.indexOf('$') != -1) // Group character needs to be escaped group = Util.replace(group, "$", "\\$"); diff --git a/dbPort/src/org/compiere/dbPort/ConvertDialog.java b/dbPort/src/org/compiere/dbPort/ConvertDialog.java index 329eace2b4..328e22a8ea 100644 --- a/dbPort/src/org/compiere/dbPort/ConvertDialog.java +++ b/dbPort/src/org/compiere/dbPort/ConvertDialog.java @@ -313,7 +313,7 @@ public class ConvertDialog extends CFrame implements ActionListener // Output file name String fileName = file.getAbsolutePath(); - int pos = fileName.lastIndexOf("."); + int pos = fileName.lastIndexOf('.'); if (pos == -1) fileName += target; else diff --git a/dbPort/src/org/compiere/dbPort/Convert_PostgreSQL.java b/dbPort/src/org/compiere/dbPort/Convert_PostgreSQL.java index aa0c9da926..dca105ba49 100644 --- a/dbPort/src/org/compiere/dbPort/Convert_PostgreSQL.java +++ b/dbPort/src/org/compiere/dbPort/Convert_PostgreSQL.java @@ -325,10 +325,10 @@ public class Convert_PostgreSQL extends Convert_SQL92 { signature.append(", "); // name ALIAS FOR $1 String p = parameters[i].trim(); - alias.append(p.substring(0, p.indexOf(" "))).append( + alias.append(p.substring(0, p.indexOf(' '))).append( " ALIAS FOR $").append(i + 1).append(";\n"); // Datatape - signature.append(p.substring(p.lastIndexOf(" ") + 1)); + signature.append(p.substring(p.lastIndexOf(' ') + 1)); } } signature.append(")"); @@ -358,7 +358,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { group = m.group(); m.appendReplacement(sb, ""); if (group.startsWith("RETURN")) - sb.append("RETURNS").append(group.substring(group.indexOf(" "))); + sb.append("RETURNS").append(group.substring(group.indexOf(' '))); sb.append(" '\nDECLARE\n").append(alias); // add aliases here // log.info("2>" + sb.toString() + "<2"); @@ -457,10 +457,10 @@ public class Convert_PostgreSQL extends Convert_SQL92 { signature.append(", "); // name ALIAS FOR $1 String p = parameters[i].trim(); - alias.append(p.substring(0, p.indexOf(" "))).append( + alias.append(p.substring(0, p.indexOf(' '))).append( " ALIAS FOR $").append(i + 1).append(";\n"); // Datatape - signature.append(p.substring(p.lastIndexOf(" ") + 1)); + signature.append(p.substring(p.lastIndexOf(' ') + 1)); } } signature.append(")"); @@ -490,7 +490,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { group = m.group(); m.appendReplacement(sb, ""); if (group.startsWith("RETURN")) - sb.append("RETURNS").append(group.substring(group.indexOf(" "))); + sb.append("RETURNS").append(group.substring(group.indexOf(' '))); sb.append(" '\nDECLARE\n").append(alias); // add aliases here // log.info("2>" + sb.toString() + "<2"); @@ -551,11 +551,11 @@ public class Convert_PostgreSQL extends Convert_SQL92 { // trigger Name int triggerPos = stmt.toUpperCase().indexOf(" TRIGGER ") + 9; String triggerName = stmt.substring(triggerPos); - triggerName = triggerName.substring(0, triggerName.indexOf(" ")); + triggerName = triggerName.substring(0, triggerName.indexOf(' ')); // table name String tableName = stmt .substring(stmt.toUpperCase().indexOf(" ON ") + 4); - tableName = tableName.substring(0, tableName.indexOf(" ")); + tableName = tableName.substring(0, tableName.indexOf(' ')); // Function Drop if (orReplacePos != -1) { @@ -692,7 +692,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { while (m.find()) { String group = m.group(); // System.out.print("-> " + group); - int pos = group.indexOf("."); + int pos = group.indexOf('.'); String seqName = group.substring(0, pos); String funcName = group.substring(pos + 1); group = funcName + "('" + seqName + "')"; @@ -1062,21 +1062,21 @@ public class Convert_PostgreSQL extends Convert_SQL92 { { select = sqlStatement.substring(charIndex - currentToken.length()); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); - updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); + updateFields = updateFields.substring(0, updateFields.lastIndexOf(')')); break; } else if (")=".equals(previousToken)) { select = sqlStatement.substring(charIndex - currentToken.length()); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); - updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); + updateFields = updateFields.substring(0, updateFields.lastIndexOf(')')); break; } else if (previousToken != null && previousToken.endsWith(")=")) { select = sqlStatement.substring(charIndex - currentToken.length()); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); - updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); + updateFields = updateFields.substring(0, updateFields.lastIndexOf(')')); break; } @@ -1085,14 +1085,14 @@ public class Convert_PostgreSQL extends Convert_SQL92 { { select = sqlStatement.substring(charIndex - 1); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); - updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); + updateFields = updateFields.substring(0, updateFields.lastIndexOf(')')); break; } else if (currentToken.endsWith(")=(SELECT")) { select = sqlStatement.substring(charIndex - 7); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); - updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); + updateFields = updateFields.substring(0, updateFields.lastIndexOf(')')); break; } else if ("=(".equals(currentToken) || (currentToken != null && currentToken.startsWith("=("))) @@ -1101,7 +1101,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { { select = sqlStatement.substring(charIndex - currentToken.length()); updateFields = sqlStatement.substring(updateFieldsBegin, charIndex); - updateFields = updateFields.substring(0, updateFields.lastIndexOf(")")); + updateFields = updateFields.substring(0, updateFields.lastIndexOf(')')); break; } } @@ -1119,7 +1119,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { updateFields = updateFields.substring(1); int subQueryEnd = 0; - int subQueryStart = select.indexOf("("); + int subQueryStart = select.indexOf('('); String subWhere = null; int open = -1; for (int i = subQueryStart; i < select.length(); i++) { @@ -1244,7 +1244,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { if (f < 0) { updateField = updateFields; joinField = joinFields.trim(); - if (joinField.indexOf(".") < 0 && isIdentifier(joinField)) { + if (joinField.indexOf('.') < 0 && isIdentifier(joinField)) { joinField = joinAlias + "." + joinField; } @@ -1292,7 +1292,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { // fieldsjoin.indexOf(','); joinField = joinFields.substring(0, fj).trim(); - if (joinField.indexOf(".") < 0 && isIdentifier(joinField)) { + if (joinField.indexOf('.') < 0 && isIdentifier(joinField)) { joinField = joinAlias + "." + joinField; } Update.append(updateField.trim()); @@ -1365,7 +1365,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { if (c == '(') result = result + t.toString(); else if (isIdentifier(t.toString()) && - t.toString().indexOf(".") == -1) + t.toString().indexOf('.') == -1) result = result + alias + "." + t.toString(); else result = result + t.toString(); @@ -1381,7 +1381,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { if (t.length() > 0) { if (isIdentifier(t.toString()) && - t.toString().indexOf(".") == -1) + t.toString().indexOf('.') == -1) result = result + alias + "." + t.toString(); else result = result + t.toString(); @@ -1572,10 +1572,10 @@ public class Convert_PostgreSQL extends Convert_SQL92 { if ("VALUES".equalsIgnoreCase(tokens[3]) || "SELECT".equalsIgnoreCase(tokens[3])) return sqlStatement; - if (tokens[2].indexOf("(") > 0) + if (tokens[2].indexOf('(') > 0) return sqlStatement; - else if ((tokens[3].indexOf("(") < 0) || - tokens[3].indexOf("(") > 0) { + else if ((tokens[3].indexOf('(') < 0) || + tokens[3].indexOf('(') > 0) { table = tokens[2]; alias = tokens[3]; } else { @@ -1588,7 +1588,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { alias = tokens[3]; } if (table != null && alias != null ) { - if (alias.indexOf("(") > 0) alias = alias.substring(0, alias.indexOf("(")); + if (alias.indexOf('(') > 0) alias = alias.substring(0, alias.indexOf('(')); String converted = sqlStatement.replaceFirst("\\s"+alias+"\\s", " "); converted = converted.replaceAll("\\b"+alias+"\\.", table+"."); return converted; @@ -1636,7 +1636,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { if (begin_col != -1) { column = sqlStatement.substring(begin_col); - end_col = begin_col + column.indexOf(" "); + end_col = begin_col + column.indexOf(' '); column = sqlStatement.substring(begin_col, end_col); // System.out.println(" column:" + column + " begincolumn:" + // begin_col + "en column:" + end_col ); @@ -1644,7 +1644,7 @@ public class Convert_PostgreSQL extends Convert_SQL92 { // + 1)); type = sqlStatement.substring(end_col + 1) + " "; // System.out.println(" type 1 :" + type); - type = type.substring(0, type.indexOf(" ")); + type = type.substring(0, type.indexOf(' ')); // System.out.println(" type:" + type); if (action.equals(" ADD ")) DDL = sqlStatement @@ -1663,11 +1663,11 @@ public class Convert_PostgreSQL extends Convert_SQL92 { begin_default = sqlStatement.toUpperCase().indexOf( " DEFAULT ") + 9; defaultvalue = sqlStatement.substring(begin_default); - int nextspace = defaultvalue.indexOf(" "); + int nextspace = defaultvalue.indexOf(' '); String rest = null; if (nextspace > -1) { rest = defaultvalue.substring(nextspace); - defaultvalue = defaultvalue.substring(0, defaultvalue.indexOf(" ")); + defaultvalue = defaultvalue.substring(0, defaultvalue.indexOf(' ')); } if (defaultvalue.equalsIgnoreCase("NULL")) { diff --git a/dbPort/src/org/compiere/model/MColumn.java b/dbPort/src/org/compiere/model/MColumn.java index d8ae454f32..c78a080d9b 100644 --- a/dbPort/src/org/compiere/model/MColumn.java +++ b/dbPort/src/org/compiere/model/MColumn.java @@ -302,7 +302,7 @@ public class MColumn extends X_AD_Column String defaultValue = getDefaultValue(); if (defaultValue != null && defaultValue.length() > 0 - && defaultValue.indexOf("@") == -1) // no variables + && defaultValue.indexOf('@') == -1) // no variables { if (DisplayType.isText(getAD_Reference_ID()) || getAD_Reference_ID() == DisplayType.List @@ -346,7 +346,7 @@ public class MColumn extends X_AD_Column String defaultValue = getDefaultValue(); if (defaultValue != null && defaultValue.length() > 0 - && defaultValue.indexOf("@") == -1) // no variables + && defaultValue.indexOf('@') == -1) // no variables { if (DisplayType.isText(getAD_Reference_ID()) || getAD_Reference_ID() == DisplayType.List diff --git a/dbPort/src/org/compiere/model/MCountry.java b/dbPort/src/org/compiere/model/MCountry.java index d81b0e651b..f15e34b971 100644 --- a/dbPort/src/org/compiere/model/MCountry.java +++ b/dbPort/src/org/compiere/model/MCountry.java @@ -319,7 +319,7 @@ public final class MCountry extends X_C_Country while (st.hasMoreTokens()) { String s = st.nextToken().trim(); - int pos = s.indexOf(";"); + int pos = s.indexOf(';'); String name = Util.initCap(s.substring(0,pos)); String cc = s.substring(pos+1); System.out.println(cc + " - " + name); diff --git a/dbPort/src/org/compiere/model/MIssue.java b/dbPort/src/org/compiere/model/MIssue.java index 0b288f42bb..4f4ab5385d 100644 --- a/dbPort/src/org/compiere/model/MIssue.java +++ b/dbPort/src/org/compiere/model/MIssue.java @@ -481,7 +481,7 @@ public class MIssue extends X_AD_Issue String pair = st.nextToken(); try { - int index = pair.indexOf("="); + int index = pair.indexOf('='); if (pair.startsWith("RECORDID=")) { String info = pair.substring(index+1); diff --git a/dbPort/src/org/compiere/model/MLocation.java b/dbPort/src/org/compiere/model/MLocation.java index 02e9519c0e..76f6fd4489 100644 --- a/dbPort/src/org/compiere/model/MLocation.java +++ b/dbPort/src/org/compiere/model/MLocation.java @@ -401,13 +401,13 @@ public class MLocation extends X_C_Location implements Comparator StringBuffer outStr = new StringBuffer(); String token; - int i = inStr.indexOf("@"); + int i = inStr.indexOf('@'); while (i != -1) { outStr.append (inStr.substring(0, i)); // up to @ inStr = inStr.substring(i+1, inStr.length()); // from first @ - int j = inStr.indexOf("@"); // next @ + int j = inStr.indexOf('@'); // next @ if (j < 0) { token = ""; // no second tag @@ -443,7 +443,7 @@ public class MLocation extends X_C_Location implements Comparator outStr.append("@").append(token).append("@"); inStr = inStr.substring(j+1, inStr.length()); // from second @ - i = inStr.indexOf("@"); + i = inStr.indexOf('@'); } outStr.append(inStr); // add the rest of the string diff --git a/dbPort/src/org/compiere/model/MLookupFactory.java b/dbPort/src/org/compiere/model/MLookupFactory.java index 73112da08d..228ce1618e 100644 --- a/dbPort/src/org/compiere/model/MLookupFactory.java +++ b/dbPort/src/org/compiere/model/MLookupFactory.java @@ -184,7 +184,7 @@ public class MLookupFactory info.ValidationCode = ""; // Variables in SQL WHERE - if (info.Query.indexOf("@") != -1) + if (info.Query.indexOf('@') != -1) { // String newSQL = Env.parseContext(ctx, WindowNo, info.Query, false); String newSQL = Env.parseContext(ctx, 0, info.Query, false); // only global @@ -416,7 +416,7 @@ public class MLookupFactory if (WhereClause != null) { String where = WhereClause; - if (where.indexOf("@") != -1) + if (where.indexOf('@') != -1) where = Env.parseContext(ctx, WindowNo, where, false); if (where.length() == 0 && WhereClause.length() != 0) s_log.severe ("Could not resolve: " + WhereClause); @@ -425,7 +425,7 @@ public class MLookupFactory if (where.length() != 0) { realSQL.append(" WHERE ").append(where); - if (where.indexOf(".") == -1) + if (where.indexOf('.') == -1) s_log.log(Level.SEVERE, "getLookup_Table - " + TableName + ": WHERE should be fully qualified: " + WhereClause); zoomQuery = new MQuery (TableName); @@ -437,7 +437,7 @@ public class MLookupFactory if (OrderByClause != null) { realSQL.append(" ORDER BY ").append(OrderByClause); - if (OrderByClause.indexOf(".") == -1) + if (OrderByClause.indexOf('.') == -1) s_log.log(Level.SEVERE, "getLookup_Table - " + TableName + ": ORDER BY must fully qualified: " + OrderByClause); } diff --git a/dbPort/src/org/compiere/model/MQuery.java b/dbPort/src/org/compiere/model/MQuery.java index b4686fe122..4163639aeb 100644 --- a/dbPort/src/org/compiere/model/MQuery.java +++ b/dbPort/src/org/compiere/model/MQuery.java @@ -136,7 +136,7 @@ public class MQuery implements Serializable { if (P_String_To == null) { - if (P_String.indexOf("%") == -1) + if (P_String.indexOf('%') == -1) query.addRestriction(ParameterName, MQuery.EQUAL, P_String, Name, Info); else diff --git a/dbPort/src/org/compiere/model/MRole.java b/dbPort/src/org/compiere/model/MRole.java index 4be0624d05..a66b454ee9 100644 --- a/dbPort/src/org/compiere/model/MRole.java +++ b/dbPort/src/org/compiere/model/MRole.java @@ -1874,7 +1874,7 @@ public final class MRole extends X_AD_Role { String userLevel = getUserLevel(); // Format 'SCO' - if (userLevel.indexOf("S") != -1) // System cannot change anything + if (userLevel.indexOf('S') != -1) // System cannot change anything return true; boolean retValue = true; diff --git a/dbPort/src/org/compiere/model/MSequence.java b/dbPort/src/org/compiere/model/MSequence.java index 3896ca238c..62183d514a 100644 --- a/dbPort/src/org/compiere/model/MSequence.java +++ b/dbPort/src/org/compiere/model/MSequence.java @@ -255,7 +255,8 @@ public class MSequence extends X_AD_Sequence selectSQL = "SELECT CurrentNext, CurrentNextSys, IncrementNo, Prefix, Suffix, AD_Sequence_ID " + "FROM AD_Sequence " + "WHERE Name=?" - + " AND AD_Client_ID IN (0,?)" + //jz fix duplicated nextID + " AND AD_Client_ID IN (0,?)" + + " AND AD_Client_ID = ?" + " AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' " + "ORDER BY AD_Client_ID DESC " + " FOR UPDATE OF AD_Sequence "; @@ -268,7 +269,8 @@ public class MSequence extends X_AD_Sequence //end vpj-cd e-evolution 09/02/2005 PostgreSQL + "FROM AD_Sequence " + "WHERE Name=?" - + " AND AD_Client_ID IN (0,?)" + //jz fix duplicated nextID + " AND AD_Client_ID IN (0,?)" + + " AND AD_Client_ID = ?" + " AND IsActive='Y' AND IsTableID='N' AND IsAutoSequence='Y' " + " ORDER BY AD_Client_ID DESC "; USE_PROCEDURE = true; diff --git a/dbPort/src/org/compiere/model/MWarehouse.java b/dbPort/src/org/compiere/model/MWarehouse.java index e8894dd32e..96535a4279 100644 --- a/dbPort/src/org/compiere/model/MWarehouse.java +++ b/dbPort/src/org/compiere/model/MWarehouse.java @@ -218,7 +218,7 @@ public class MWarehouse extends X_M_Warehouse */ protected boolean afterSave (boolean newRecord, boolean success) { - if (newRecord & success) + if (newRecord && success) insert_Accounting("M_Warehouse_Acct", "C_AcctSchema_Default", null); return success; diff --git a/dbPort/src/org/compiere/model/PO.java b/dbPort/src/org/compiere/model/PO.java index 70511967cb..104aaf1521 100644 --- a/dbPort/src/org/compiere/model/PO.java +++ b/dbPort/src/org/compiere/model/PO.java @@ -1975,7 +1975,7 @@ public abstract class PO { lobAdd (value, i, dt); // If no changes set UpdatedBy explicitly to ensure commit of lob - if (!changes & !updatedBy) + if (!changes && !updatedBy) { int AD_User_ID = Env.getContextAsInt(p_ctx, "#AD_User_ID"); set_ValueNoCheck("UpdatedBy", new Integer(AD_User_ID)); diff --git a/dbPort/src/org/compiere/util/Evaluator.java b/dbPort/src/org/compiere/util/Evaluator.java index b78089c941..d79a364abb 100644 --- a/dbPort/src/org/compiere/util/Evaluator.java +++ b/dbPort/src/org/compiere/util/Evaluator.java @@ -238,11 +238,11 @@ public class Evaluator // log.fine( "MField.parseDepends", parseString); String s = parseString; // while we have variables - while (s.indexOf("@") != -1) + while (s.indexOf('@') != -1) { - int pos = s.indexOf("@"); + int pos = s.indexOf('@'); s = s.substring(pos+1); - pos = s.indexOf("@"); + pos = s.indexOf('@'); if (pos == -1) continue; // error number of @@ not correct String variable = s.substring(0, pos); diff --git a/dbPort/src/org/compiere/util/Msg.java b/dbPort/src/org/compiere/util/Msg.java index 3738cfbd21..16b1987ddb 100644 --- a/dbPort/src/org/compiere/util/Msg.java +++ b/dbPort/src/org/compiere/util/Msg.java @@ -630,13 +630,13 @@ public final class Msg String token; StringBuffer outStr = new StringBuffer(); - int i = inStr.indexOf("@"); + int i = inStr.indexOf('@'); while (i != -1) { outStr.append(inStr.substring(0, i)); // up to @ inStr = inStr.substring(i+1, inStr.length()); // from first @ - int j = inStr.indexOf("@"); // next @ + int j = inStr.indexOf('@'); // next @ if (j < 0) // no second tag { inStr = "@" + inStr; @@ -647,7 +647,7 @@ public final class Msg outStr.append(translate(ctx, token)); // replace context inStr = inStr.substring(j+1, inStr.length()); // from second @ - i = inStr.indexOf("@"); + i = inStr.indexOf('@'); } outStr.append(inStr); // add remainder diff --git a/install/src/org/compiere/install/ConfigOracle.java b/install/src/org/compiere/install/ConfigOracle.java index b2d94a9661..d3fb4ca8ca 100644 --- a/install/src/org/compiere/install/ConfigOracle.java +++ b/install/src/org/compiere/install/ConfigOracle.java @@ -243,7 +243,7 @@ public class ConfigOracle extends Config { if (line.length() > 0 && Character.isLetter(line.charAt(0)) // no # ( - && line.indexOf("=") != -1 + && line.indexOf('=') != -1 && line.indexOf("EXTPROC_") == -1 && line.indexOf("_HTTP") == -1) { diff --git a/install/src/org/compiere/install/KeyStoreMgt.java b/install/src/org/compiere/install/KeyStoreMgt.java index d0ffe7fc66..39d0048e7d 100644 --- a/install/src/org/compiere/install/KeyStoreMgt.java +++ b/install/src/org/compiere/install/KeyStoreMgt.java @@ -353,7 +353,7 @@ public class KeyStoreMgt */ public static String escapeCommas(String in) { - if (in == null || in.indexOf(",") == -1) + if (in == null || in.indexOf(',') == -1) return in; StringBuffer out = new StringBuffer(); char[] chars = in.toCharArray(); diff --git a/looks/src/org/compiere/plaf/CompiereColor.java b/looks/src/org/compiere/plaf/CompiereColor.java index 8fbef8963d..d5e63d2ae3 100644 --- a/looks/src/org/compiere/plaf/CompiereColor.java +++ b/looks/src/org/compiere/plaf/CompiereColor.java @@ -960,7 +960,7 @@ public class CompiereColor implements Serializable m_secondaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",Lower=")+7, str.indexOf(",Start=")), new ColorUIResource(m_secondaryColor)); m_startPoint = Integer.parseInt(str.substring(str.indexOf(",Start=")+7, str.indexOf(",RDistance="))); - setGradientRepeatDistance(str.substring(str.indexOf(",RDistance=")+11, str.lastIndexOf("]"))); + setGradientRepeatDistance(str.substring(str.indexOf(",RDistance=")+11, str.lastIndexOf(']'))); } else if (str.indexOf("[Line ") != -1) { @@ -970,7 +970,7 @@ public class CompiereColor implements Serializable m_secondaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",BackColor=")+11, str.indexOf(",Width=")), new ColorUIResource(m_secondaryColor)); setLineWidth(str.substring(str.indexOf(",Width=")+7, str.indexOf(",Distance="))); - setLineDistance(str.substring(str.indexOf(",Distance=")+10, str.lastIndexOf("]"))); + setLineDistance(str.substring(str.indexOf(",Distance=")+10, str.lastIndexOf(']'))); } else if (str.indexOf("[Texture ") != -1) { @@ -978,7 +978,7 @@ public class CompiereColor implements Serializable setTextureURL (str.substring(str.indexOf(" GraphURL=")+10, str.indexOf(",Taint="))); m_primaryColor = ThemeUtils.parseColor(str.substring(str.indexOf(",Taint=")+7, str.indexOf(",Alpha=")), new ColorUIResource(m_primaryColor)); - setTextureCompositeAlpha (str.substring(str.indexOf(",Alpha=")+7, str.lastIndexOf("]"))); + setTextureCompositeAlpha (str.substring(str.indexOf(",Alpha=")+7, str.lastIndexOf(']'))); } } // parseString diff --git a/looks/src/org/compiere/plaf/CompiereTabbedPaneUI.java b/looks/src/org/compiere/plaf/CompiereTabbedPaneUI.java index 40540e8470..ac92a951b1 100644 --- a/looks/src/org/compiere/plaf/CompiereTabbedPaneUI.java +++ b/looks/src/org/compiere/plaf/CompiereTabbedPaneUI.java @@ -804,7 +804,7 @@ public class CompiereTabbedPaneUI extends MetalTabbedPaneUI calculate = false; // No spaces in title String title = tabPane.getTitleAt(tabIndex); - int pos = title.indexOf(" "); + int pos = title.indexOf(' '); if (calculate && pos == -1) calculate = false; if (!calculate) @@ -839,7 +839,7 @@ public class CompiereTabbedPaneUI extends MetalTabbedPaneUI calculate = false; // No spaces in title String title = tabPane.getTitleAt(tabIndex); - int pos = title.indexOf(" "); + int pos = title.indexOf(' '); if (calculate && pos == -1) calculate = false; if (!calculate) diff --git a/looks/src/org/compiere/swing/CButton.java b/looks/src/org/compiere/swing/CButton.java index 0145a2cc78..3d6cc75639 100644 --- a/looks/src/org/compiere/swing/CButton.java +++ b/looks/src/org/compiere/swing/CButton.java @@ -229,7 +229,7 @@ public class CButton extends JButton implements CEditor super.setText(text); return; } - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1) // We have a nemonic - creates ALT-_ { int mnemonic = text.toUpperCase().charAt(pos+1); @@ -255,7 +255,7 @@ public class CButton extends JButton implements CEditor super.setText(text); return; } - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1) // We have a nemonic - creates ALT-_ { int mnemonic = text.toUpperCase().charAt(pos+1); diff --git a/looks/src/org/compiere/swing/CCheckBox.java b/looks/src/org/compiere/swing/CCheckBox.java index 24646bac32..c12ee7f6c9 100644 --- a/looks/src/org/compiere/swing/CCheckBox.java +++ b/looks/src/org/compiere/swing/CCheckBox.java @@ -281,7 +281,7 @@ public class CCheckBox extends JCheckBox implements CEditor { if (text == null) return text; - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1) // We have a nemonic { char ch = text.charAt(pos+1); diff --git a/looks/src/org/compiere/swing/CCheckBoxMenuItem.java b/looks/src/org/compiere/swing/CCheckBoxMenuItem.java index 017aa9faeb..4b2e8f0d2f 100644 --- a/looks/src/org/compiere/swing/CCheckBoxMenuItem.java +++ b/looks/src/org/compiere/swing/CCheckBoxMenuItem.java @@ -73,7 +73,7 @@ public class CCheckBoxMenuItem extends JCheckBoxMenuItem super.setText(text); return; } - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_ { int mnemonic = text.toUpperCase().charAt(pos+1); diff --git a/looks/src/org/compiere/swing/CDialog.java b/looks/src/org/compiere/swing/CDialog.java index dd3a478f9e..a773f357d2 100644 --- a/looks/src/org/compiere/swing/CDialog.java +++ b/looks/src/org/compiere/swing/CDialog.java @@ -221,7 +221,7 @@ public class CDialog extends JDialog { if (title != null) { - int pos = title.indexOf("&"); + int pos = title.indexOf('&'); if (pos != -1 && title.length() > pos) // We have a nemonic { int mnemonic = title.toUpperCase().charAt(pos+1); diff --git a/looks/src/org/compiere/swing/CFrame.java b/looks/src/org/compiere/swing/CFrame.java index 1dff8a2c1a..306f57c376 100644 --- a/looks/src/org/compiere/swing/CFrame.java +++ b/looks/src/org/compiere/swing/CFrame.java @@ -96,7 +96,7 @@ public class CFrame extends JFrame { if (title != null) { - int pos = title.indexOf("&"); + int pos = title.indexOf('&'); if (pos != -1 && title.length() > pos) // We have a nemonic { int mnemonic = title.toUpperCase().charAt(pos+1); diff --git a/looks/src/org/compiere/swing/CLabel.java b/looks/src/org/compiere/swing/CLabel.java index acaa279f30..ddba01532f 100644 --- a/looks/src/org/compiere/swing/CLabel.java +++ b/looks/src/org/compiere/swing/CLabel.java @@ -227,7 +227,7 @@ public class CLabel extends JLabel { if (text == null) return text; - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1) // We have a nemonic { char ch = text.charAt(pos+1); diff --git a/looks/src/org/compiere/swing/CMenuItem.java b/looks/src/org/compiere/swing/CMenuItem.java index b5c2f4190c..07f3a31ea9 100644 --- a/looks/src/org/compiere/swing/CMenuItem.java +++ b/looks/src/org/compiere/swing/CMenuItem.java @@ -68,7 +68,7 @@ public class CMenuItem extends JMenuItem super.setText(text); return; } - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_ { int mnemonic = text.toUpperCase().charAt(pos+1); diff --git a/looks/src/org/compiere/swing/CTabbedPane.java b/looks/src/org/compiere/swing/CTabbedPane.java index 8695404ac4..8a7b959926 100644 --- a/looks/src/org/compiere/swing/CTabbedPane.java +++ b/looks/src/org/compiere/swing/CTabbedPane.java @@ -178,7 +178,7 @@ public class CTabbedPane extends JTabbedPane String title = text; if (!title.startsWith("")) { - int pos = title.indexOf("&"); + int pos = title.indexOf('&'); if (pos != -1) title = title.substring(0, pos) + title.substring(pos+1); } @@ -229,7 +229,7 @@ public class CTabbedPane extends JTabbedPane String title = text; if (!title.startsWith("")) { - int pos = title.indexOf("&"); + int pos = title.indexOf('&'); if (pos != -1) // We have a nemonic - creates ALT-_ title = title.substring(0, pos) + title.substring(pos+1); } @@ -256,7 +256,7 @@ public class CTabbedPane extends JTabbedPane // if (!text.startsWith("")) { - int pos = text.indexOf("&"); + int pos = text.indexOf('&'); if (pos != -1 && text.length() > pos) // We have a nemonic - creates ALT-_ { keyCode = text.toUpperCase().charAt(pos+1); diff --git a/looks/src/org/compiere/swing/ThemeUtils.java b/looks/src/org/compiere/swing/ThemeUtils.java index 2612600bd3..9aeb767256 100644 --- a/looks/src/org/compiere/swing/ThemeUtils.java +++ b/looks/src/org/compiere/swing/ThemeUtils.java @@ -63,11 +63,11 @@ public final class ThemeUtils { int b = 0; int a = 255; if (information.indexOf("a=") == -1) - b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf("]"))); + b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf(']'))); else { b = Integer.parseInt(information.substring(information.indexOf("b=")+2, information.indexOf(",a="))); - a = Integer.parseInt(information.substring(information.indexOf("a=")+2, information.indexOf("]"))); + a = Integer.parseInt(information.substring(information.indexOf("a=")+2, information.indexOf(']'))); } ColorUIResource retValue = new ColorUIResource(new Color(r, g, b, a)); // System.out.println(" - " + retValue.toString()); @@ -107,7 +107,7 @@ public final class ThemeUtils { style = Font.ITALIC; else if (s.equals("bolditalic")) style = Font.BOLD | Font.ITALIC; - int size = Integer.parseInt(information.substring(information.indexOf(",size=")+6, information.lastIndexOf("]"))); + int size = Integer.parseInt(information.substring(information.indexOf(",size=")+6, information.lastIndexOf(']'))); FontUIResource retValue = new FontUIResource(name,style,size); // System.out.println(" - " + retValue.toString()); return retValue; diff --git a/looks/src/org/compiere/util/Ini.java b/looks/src/org/compiere/util/Ini.java index 0ce971c2fd..612fd91a0f 100644 --- a/looks/src/org/compiere/util/Ini.java +++ b/looks/src/org/compiere/util/Ini.java @@ -615,7 +615,7 @@ public final class Ini implements Serializable String value = (String)s_prop.get(key); if (value == null || value.length() == 0) return null; - int index = value.indexOf("|"); + int index = value.indexOf('|'); if (index == -1) return null; try @@ -658,7 +658,7 @@ public final class Ini implements Serializable String value = (String)s_prop.get(key); if (value == null || value.length() == 0) return null; - int index = value.indexOf("|"); + int index = value.indexOf('|'); if (index == -1) return null; try diff --git a/migration/src/oracle/DBDifference.java b/migration/src/oracle/DBDifference.java index 79594bf235..7b1009846b 100644 --- a/migration/src/oracle/DBDifference.java +++ b/migration/src/oracle/DBDifference.java @@ -1502,7 +1502,7 @@ public class DBDifference { continue; } String value = data2.getValueForColumn(columns2.get(m).getColumnName()); - if (value != null && value.indexOf("'") != -1) { + if (value != null && value.indexOf(''') != -1) { value = value.replaceAll("'", "''"); } if (and) { @@ -1721,8 +1721,8 @@ public class DBDifference { + data2.getValueForColumn(columnName).replaceAll("'", "''") + "'"; } else if (type.equals("DATE")) { String date = data2.getValueForColumn(columnName); - if (date.indexOf(" ") != -1) { - date = date.substring(0, date.indexOf(" ")); + if (date.indexOf(' ') != -1) { + date = date.substring(0, date.indexOf(' ')); } insertStatement += "to_date('" + date + "','" + TIME_FORMAT + "')"; } else if (type.equals("NUMBER")) { diff --git a/print/src/org/compiere/print/DataEngine.java b/print/src/org/compiere/print/DataEngine.java index 82f1a7d138..11b3d613d7 100644 --- a/print/src/org/compiere/print/DataEngine.java +++ b/print/src/org/compiere/print/DataEngine.java @@ -455,7 +455,7 @@ public class DataEngine // -- Standard Column -- else { - int index = FunctionColumn.indexOf("@"); + int index = FunctionColumn.indexOf('@'); StringBuffer sb = new StringBuffer(); if (ColumnSQL != null && ColumnSQL.length() > 0) { diff --git a/print/src/org/compiere/print/ReportEngine.java b/print/src/org/compiere/print/ReportEngine.java index 79be67ffde..563287c240 100644 --- a/print/src/org/compiere/print/ReportEngine.java +++ b/print/src/org/compiere/print/ReportEngine.java @@ -1024,6 +1024,12 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) */ public static ReportEngine get (Properties ctx, int type, int Record_ID) { + if (Record_ID < 1) + { + log.log(Level.WARNING, "No PrintFormat for Record_ID=" + Record_ID + + ", Type=" + type); + return null; + } // Order - Print Shipment or Invoice if (type == ORDER) { @@ -1100,10 +1106,11 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) + " c.IsMultiLingualDocument, COALESCE(dt.DocumentCopies,0) " + "FROM M_Movement d" + " INNER JOIN AD_Client c ON (d.AD_Client_ID=c.AD_Client_ID)" - + " INNER JOIN AD_PrintForm pf ON (c.AD_Client_ID=pf.AD_Client_ID)" + + " INNER JOIN AD_PrintForm pf ON (d.AD_Client_ID=pf.AD_Client_ID OR pf.AD_Client_ID=0)" + " LEFT OUTER JOIN C_DocType dt ON (d.C_DocType_ID=dt.C_DocType_ID) " + "WHERE d.M_Movement_ID=?" // info from PrintForm - + " AND pf.AD_Org_ID IN (0,d.AD_Org_ID) ORDER BY pf.AD_Org_ID DESC"; + + " AND pf.AD_Org_ID IN (0,d.AD_Org_ID) AND pf.Movement_PrintFormat_ID IS NOT NULL " + + "ORDER BY pf.AD_Client_ID DESC, pf.AD_Org_ID DESC"; else // Get PrintFormat from Org or 0 of document client sql = "SELECT pf.Order_PrintFormat_ID,pf.Shipment_PrintFormat_ID," // 1..2 // Prio: 1. BPartner 2. DocType, 3. PrintFormat (Org) // see InvoicePrint @@ -1148,8 +1155,9 @@ queued-job-count = 0 (class javax.print.attribute.standard.QueuedJobCount) } else if (type == MOVEMENT) { AD_PrintFormat_ID = rs.getInt(1); - log.fine("PF 2 ="+AD_PrintFormat_ID); - //TODO VHARCQ SQL needs change for copies VHARCQ= rs.getInt(8); + copies = rs.getInt(3); + if (copies == 0) + copies = 1; } else { diff --git a/serverApps/src/main/servlet/org/compiere/wstore/JSPEnv.java b/serverApps/src/main/servlet/org/compiere/wstore/JSPEnv.java index 96080154b8..35b37e76bb 100644 --- a/serverApps/src/main/servlet/org/compiere/wstore/JSPEnv.java +++ b/serverApps/src/main/servlet/org/compiere/wstore/JSPEnv.java @@ -19,7 +19,6 @@ package org.compiere.wstore; import java.util.*; import javax.servlet.http.*; -import org.compiere.model.*; import org.compiere.util.*; /** diff --git a/serverApps/src/main/servlet/org/compiere/wstore/SearchServlet.java b/serverApps/src/main/servlet/org/compiere/wstore/SearchServlet.java index eaba28b5c4..8cb4d60f4b 100644 --- a/serverApps/src/main/servlet/org/compiere/wstore/SearchServlet.java +++ b/serverApps/src/main/servlet/org/compiere/wstore/SearchServlet.java @@ -16,37 +16,16 @@ *****************************************************************************/ package org.compiere.wstore; -import org.compiere.util.CLogger; -import org.compiere.util.DB; -import org.compiere.util.Env; -import org.compiere.util.WebEnv; -import org.compiere.util.WebSessionCtx; -import org.compiere.util.Util; -import org.compiere.util.WebUtil; -import org.compiere.model.MBPartner; -import org.compiere.model.MClient; -import org.compiere.model.MOrg; -import org.compiere.model.MWarehouse; -import org.apache.taglibs.standard.tag.el.core.ExpressionUtil; -import org.apache.ecs.xhtml.option; -import org.apache.log4j.lf5.LogLevel; +import java.io.*; +import java.sql.*; +import java.util.*; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.RequestDispatcher; -import java.io.IOException; -import java.io.PrintWriter; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.Properties; -import java.util.logging.Level; -import sun.rmi.runtime.Log; +import javax.servlet.*; +import javax.servlet.http.*; + +import org.compiere.model.*; +import org.compiere.util.*; /** * Location Servlet diff --git a/serverRoot/src/main/server/org/compiere/acct/Doc_Allocation.java b/serverRoot/src/main/server/org/compiere/acct/Doc_Allocation.java index 9d78120b56..94e8fb3a42 100644 --- a/serverRoot/src/main/server/org/compiere/acct/Doc_Allocation.java +++ b/serverRoot/src/main/server/org/compiere/acct/Doc_Allocation.java @@ -20,7 +20,6 @@ import java.math.*; import java.sql.*; import java.util.*; import java.util.logging.*; -import org.apache.taglibs.standard.lang.jstl.*; import org.compiere.model.*; import org.compiere.util.*; diff --git a/serverRoot/src/main/server/org/compiere/server/EMailProcessor.java b/serverRoot/src/main/server/org/compiere/server/EMailProcessor.java index 07fe99de59..fc67c99254 100644 --- a/serverRoot/src/main/server/org/compiere/server/EMailProcessor.java +++ b/serverRoot/src/main/server/org/compiere/server/EMailProcessor.java @@ -464,13 +464,13 @@ public class EMailProcessor if (index != -1) { String finalRecipient = deliveryMessage.substring(index); - int atIndex = finalRecipient.indexOf("@"); + int atIndex = finalRecipient.indexOf('@'); if (atIndex != -1) { index = finalRecipient.lastIndexOf(' ', atIndex); if (index != -1) finalRecipient = finalRecipient.substring(index+1); - atIndex = finalRecipient.indexOf("@"); + atIndex = finalRecipient.indexOf('@'); if (atIndex != -1) index = finalRecipient.indexOf(' ', atIndex); if (index != -1) diff --git a/serverRoot/src/main/server/org/compiere/server/Scheduler.java b/serverRoot/src/main/server/org/compiere/server/Scheduler.java index 43c59f0197..174d24df3d 100644 --- a/serverRoot/src/main/server/org/compiere/server/Scheduler.java +++ b/serverRoot/src/main/server/org/compiere/server/Scheduler.java @@ -193,12 +193,12 @@ public class Scheduler extends AdempiereServer if (variable == null || (variable != null && variable.length() == 0)) value = null; - else if (variable.indexOf("@") != -1) // we have a variable + else if (variable.indexOf('@') != -1) // we have a variable { // Strip - int index = variable.indexOf("@"); + int index = variable.indexOf('@'); String columnName = variable.substring(index+1); - index = columnName.indexOf("@"); + index = columnName.indexOf('@'); if (index == -1) { log.warning(sPara.getColumnName() diff --git a/serverRoot/src/main/servlet/org/compiere/web/AdempiereMonitor.java b/serverRoot/src/main/servlet/org/compiere/web/AdempiereMonitor.java index dcf1e54d1b..520cb02b48 100644 --- a/serverRoot/src/main/servlet/org/compiere/web/AdempiereMonitor.java +++ b/serverRoot/src/main/servlet/org/compiere/web/AdempiereMonitor.java @@ -206,7 +206,7 @@ public class AdempiereMonitor extends HttpServlet String msg = (start ? "Started" : "Stopped") + ": "; m_message.addElement(new strong(msg)); // - String serverID = action.substring(action.indexOf("_")+1); + String serverID = action.substring(action.indexOf('_')+1); boolean ok = false; if (serverID.equals("All")) { diff --git a/serverRoot/src/main/servlet/org/compiere/web/AdempiereMonitorFilter.java b/serverRoot/src/main/servlet/org/compiere/web/AdempiereMonitorFilter.java index ebdf14f890..fc7607dd5f 100644 --- a/serverRoot/src/main/servlet/org/compiere/web/AdempiereMonitorFilter.java +++ b/serverRoot/src/main/servlet/org/compiere/web/AdempiereMonitorFilter.java @@ -131,7 +131,7 @@ public class AdempiereMonitorFilter implements Filter BASE64Decoder decoder = new BASE64Decoder(); String namePassword = new String (decoder.decodeBuffer(userInfo)); // log.fine("checkAuthorization - Name:Password=" + namePassword); - int index = namePassword.indexOf(":"); + int index = namePassword.indexOf(':'); String name = namePassword.substring(0, index); String password = namePassword.substring(index+1); MUser user = MUser.get(Env.getCtx(), name, password); diff --git a/webCM/src/main/servlet/org/compiere/cm/MediaBroadcast.java b/webCM/src/main/servlet/org/compiere/cm/MediaBroadcast.java index d4fa963f4c..11bfcc7763 100644 --- a/webCM/src/main/servlet/org/compiere/cm/MediaBroadcast.java +++ b/webCM/src/main/servlet/org/compiere/cm/MediaBroadcast.java @@ -57,14 +57,14 @@ public class MediaBroadcast extends HttpServletCM String baseURL = requestURL.substring(0,requestURL.indexOf(serverName)+serverName.length()+6)+request.getContextPath(); String relativeURL = requestURL.substring(baseURL.length()); // If the relativeURL still contains / we will simply strip them off... - if (relativeURL.indexOf("/")>=0) - relativeURL = relativeURL.substring(relativeURL.lastIndexOf("/")+1); + if (relativeURL.indexOf('/')>=0) + relativeURL = relativeURL.substring(relativeURL.lastIndexOf('/')+1); // We should have only an ID before the first dot. Integer mediaID = null; try { - if (relativeURL.indexOf(".")>=0) { - mediaID = Integer.parseInt(relativeURL.substring(0,relativeURL.indexOf("."))); + if (relativeURL.indexOf('.')>=0) { + mediaID = Integer.parseInt(relativeURL.substring(0,relativeURL.indexOf('.'))); } else { mediaID = Integer.parseInt(relativeURL); }