* [ 1673714 ] String comparison using == is wrong
contribution from Stefan Huehner
This commit is contained in:
parent
9d312c1f2d
commit
f6eb3a10a7
|
@ -76,5 +76,6 @@
|
|||
<classpathentry excluding="org/compiere/utils/DigestOfFile.java" kind="src" path="JasperReportsWebApp/src"/>
|
||||
<classpathentry kind="lib" path="JasperReportsTools/lib/barbecue-1.1.jar"/>
|
||||
<classpathentry kind="lib" path="JasperReportsTools/lib/jasperreports-1.3.0.jar"/>
|
||||
<classpathentry kind="src" path="webCM/src/main/servlet"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -97,7 +97,7 @@ public class AmtInWords_ES implements AmtInWords
|
|||
soFar = numNames[number % 10];
|
||||
number /= 10;
|
||||
String s = Integer.toString (number);
|
||||
if (s.endsWith ("2") && soFar != "")
|
||||
if (s.endsWith ("2") && !soFar.equals(""))
|
||||
soFar = " VEINTI" + soFar.trim ();
|
||||
else if (soFar.equals(""))
|
||||
soFar = tensNames[number % 10] + soFar;
|
||||
|
@ -112,7 +112,7 @@ public class AmtInWords_ES implements AmtInWords
|
|||
// End e-Evolution ogi-cd
|
||||
if (number > 1)
|
||||
soFar = "S" + soFar;
|
||||
if (number == 1 && soFar != "")
|
||||
if (number == 1 && !soFar.equals(""))
|
||||
number = 0;
|
||||
return numNames[number] + " CIENTO" + soFar;
|
||||
} // convertLessThanOneThousand
|
||||
|
|
|
@ -78,7 +78,7 @@ public class CComboBox extends JComboBox
|
|||
public CComboBox(final Object items[], String key)
|
||||
{
|
||||
this(items);
|
||||
if (key.equals(null))
|
||||
if (key == null)
|
||||
return;
|
||||
for (int i = 0; i < 0; i++)
|
||||
{
|
||||
|
|
|
@ -126,7 +126,7 @@ public abstract class PrintElement implements ImageObserver
|
|||
p_maxWidth = maxWidth;
|
||||
//
|
||||
p_FieldAlignmentType = FieldAlignmentType;
|
||||
if (p_FieldAlignmentType.equals(null) || p_FieldAlignmentType.equals(MPrintFormatItem.FIELDALIGNMENTTYPE_Default))
|
||||
if (p_FieldAlignmentType == null || p_FieldAlignmentType.equals(MPrintFormatItem.FIELDALIGNMENTTYPE_Default))
|
||||
p_FieldAlignmentType = MPrintFormatItem.FIELDALIGNMENTTYPE_LeadingLeft;
|
||||
//
|
||||
p_sizeCalculated = calculateSize();
|
||||
|
|
|
@ -446,10 +446,10 @@ public class WebField
|
|||
{
|
||||
ValueNamePair p = (ValueNamePair)list[i];
|
||||
key = p.getValue();
|
||||
if (key.equals(null) || key.length() == 0)
|
||||
if (key == null || key.length() == 0)
|
||||
key = "??";
|
||||
String name = p.getName();
|
||||
if (name.equals(null) || name.length() == 0)
|
||||
if (name == null || name.length() == 0)
|
||||
name = "???";
|
||||
name = Util.maskHTML(name);
|
||||
options[i] = new option(key).addElement(name);
|
||||
|
|
|
@ -66,7 +66,7 @@ public class Adempiere implements Serializable
|
|||
*/
|
||||
public static String getProperty (String key) throws SQLException
|
||||
{
|
||||
if (key .equals(null) || key.length() == 0)
|
||||
if (key == null || key.length() == 0)
|
||||
return "null";
|
||||
return System.getProperty(key, "NotFound");
|
||||
} // environment
|
||||
|
|
|
@ -66,7 +66,7 @@ public class Compiere implements Serializable
|
|||
*/
|
||||
public static String getProperty (String key) throws SQLException
|
||||
{
|
||||
if (key.equals(null) || key.length() == 0)
|
||||
if (key == null || key.length() == 0)
|
||||
return "null";
|
||||
return System.getProperty(key, "NotFound");
|
||||
} // environment
|
||||
|
|
|
@ -325,7 +325,7 @@ public class Request {
|
|||
private static String getParameterAsString(HttpServletRequest request, String parameterName) {
|
||||
String l_szReturn = new String("");
|
||||
|
||||
if (!request.getParameter(parameterName).equals(null) && !request.getParameter(parameterName).equals("")) {
|
||||
if (request.getParameter(parameterName) != null && !request.getParameter(parameterName).equals("")) {
|
||||
l_szReturn = request.getParameter(parameterName).toString();
|
||||
l_szReturn = l_szReturn.replace("\r","");
|
||||
l_szReturn = l_szReturn.replace("\n","");
|
||||
|
@ -343,7 +343,7 @@ public class Request {
|
|||
private static int getParameterAsInt(HttpServletRequest request, String parameterName) {
|
||||
int l_nID = 0;
|
||||
|
||||
if (!request.getParameter(parameterName).equals(null) && !request.getParameter(parameterName).equals("")) {
|
||||
if (request.getParameter(parameterName) != null && !request.getParameter(parameterName).equals("")) {
|
||||
try {
|
||||
l_nID = Integer.parseInt(request.getParameter(parameterName));
|
||||
} catch (Exception e) {
|
||||
|
@ -363,7 +363,7 @@ public class Request {
|
|||
private static BigDecimal getParameterAsBD(HttpServletRequest request, String parameterName) {
|
||||
BigDecimal l_bdValue = new BigDecimal(0);
|
||||
|
||||
if (!request.getParameter(parameterName).equals(null) && !request.getParameter(parameterName).equals("")) {
|
||||
if (request.getParameter(parameterName) != null && !request.getParameter(parameterName).equals("")) {
|
||||
try {
|
||||
String l_szValue = request.getParameter(parameterName);
|
||||
l_szValue = l_szValue.replace(",", ".");
|
||||
|
@ -404,7 +404,7 @@ public class Request {
|
|||
SimpleDateFormat ger = new SimpleDateFormat("dd.MM.yyyy");
|
||||
long time = 0;
|
||||
|
||||
if (!request.getParameter(parameterName).equals(null) && !request.getParameter(parameterName).equals("")) {
|
||||
if (request.getParameter(parameterName) != null && !request.getParameter(parameterName).equals("")) {
|
||||
try {
|
||||
myDate = ger.parse(request.getParameter(parameterName).toString());
|
||||
time = myDate.getTime();
|
||||
|
|
Loading…
Reference in New Issue