Commit 9c9d2cce by David Daney Committed by Tom Tromey

Arrays.java (equals(all variants)): Quit using NullPointerException catching to…

Arrays.java (equals(all variants)): Quit using NullPointerException catching to detect null valued parameters.

2003-09-10  David Daney <ddaney@avtrex.com>

	* java/util/Arrays.java (equals(all variants)): Quit using
	NullPointerException catching to detect null valued parameters.

From-SVN: r71275
parent 4a503716
2003-09-10 David Daney <ddaney@avtrex.com>
* java/util/Arrays.java (equals(all variants)): Quit using
NullPointerException catching to detect null valued parameters.
2003-09-10 Michael Koch <konqueror@gmx.de> 2003-09-10 Michael Koch <konqueror@gmx.de>
* java/net/DatagramSocket.java, * java/net/DatagramSocket.java,
......
/* Arrays.java -- Utility class with methods to operate on arrays /* Arrays.java -- Utility class with methods to operate on arrays
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -398,8 +398,9 @@ public class Arrays ...@@ -398,8 +398,9 @@ public class Arrays
if (a1 == a2) if (a1 == a2)
return true; return true;
try if (null == a1 || null == a2)
{ return false;
// If they're the same length, test each element // If they're the same length, test each element
if (a1.length == a2.length) if (a1.length == a2.length)
{ {
...@@ -409,12 +410,6 @@ public class Arrays ...@@ -409,12 +410,6 @@ public class Arrays
return false; return false;
return true; return true;
} }
}
catch (NullPointerException e)
{
// If one is null, we get a harmless NullPointerException
}
return false; return false;
} }
...@@ -433,8 +428,9 @@ public class Arrays ...@@ -433,8 +428,9 @@ public class Arrays
if (a1 == a2) if (a1 == a2)
return true; return true;
try if (null == a1 || null == a2)
{ return false;
// If they're the same length, test each element // If they're the same length, test each element
if (a1.length == a2.length) if (a1.length == a2.length)
{ {
...@@ -444,11 +440,6 @@ public class Arrays ...@@ -444,11 +440,6 @@ public class Arrays
return false; return false;
return true; return true;
} }
}
catch (NullPointerException e)
{
// If one is null, we get a harmless NullPointerException
}
return false; return false;
} }
...@@ -467,8 +458,9 @@ public class Arrays ...@@ -467,8 +458,9 @@ public class Arrays
if (a1 == a2) if (a1 == a2)
return true; return true;
try if (null == a1 || null == a2)
{ return false;
// If they're the same length, test each element // If they're the same length, test each element
if (a1.length == a2.length) if (a1.length == a2.length)
{ {
...@@ -478,11 +470,6 @@ public class Arrays ...@@ -478,11 +470,6 @@ public class Arrays
return false; return false;
return true; return true;
} }
}
catch (NullPointerException e)
{
// If one is null, we get a harmless NullPointerException
}
return false; return false;
} }
...@@ -501,8 +488,9 @@ public class Arrays ...@@ -501,8 +488,9 @@ public class Arrays
if (a1 == a2) if (a1 == a2)
return true; return true;
try if (null == a1 || null == a2)
{ return false;
// If they're the same length, test each element // If they're the same length, test each element
if (a1.length == a2.length) if (a1.length == a2.length)
{ {
...@@ -512,11 +500,6 @@ public class Arrays ...@@ -512,11 +500,6 @@ public class Arrays
return false; return false;
return true; return true;
} }
}
catch (NullPointerException e)
{
// If one is null, we get a harmless NullPointerException
}
return false; return false;
} }
...@@ -535,8 +518,9 @@ public class Arrays ...@@ -535,8 +518,9 @@ public class Arrays
if (a1 == a2) if (a1 == a2)
return true; return true;
try if (null == a1 || null == a2)
{ return false;
// If they're the same length, test each element // If they're the same length, test each element
if (a1.length == a2.length) if (a1.length == a2.length)
{ {
...@@ -546,11 +530,6 @@ public class Arrays ...@@ -546,11 +530,6 @@ public class Arrays
return false; return false;
return true; return true;
} }
}
catch (NullPointerException e)
{
// If one is null, we get a harmless NullPointerException
}
return false; return false;
} }
...@@ -569,8 +548,9 @@ public class Arrays ...@@ -569,8 +548,9 @@ public class Arrays
if (a1 == a2) if (a1 == a2)
return true; return true;
try if (null == a1 || null == a2)
{ return false;
// If they're the same length, test each element // If they're the same length, test each element
if (a1.length == a2.length) if (a1.length == a2.length)
{ {
...@@ -580,11 +560,6 @@ public class Arrays ...@@ -580,11 +560,6 @@ public class Arrays
return false; return false;
return true; return true;
} }
}
catch (NullPointerException e)
{
// If one is null, we get a harmless NullPointerException
}
return false; return false;
} }
...@@ -603,9 +578,10 @@ public class Arrays ...@@ -603,9 +578,10 @@ public class Arrays
if (a1 == a2) if (a1 == a2)
return true; return true;
if (null == a1 || null == a2)
return false;
// Must use Float.compare to take into account NaN, +-0. // Must use Float.compare to take into account NaN, +-0.
try
{
// If they're the same length, test each element // If they're the same length, test each element
if (a1.length == a2.length) if (a1.length == a2.length)
{ {
...@@ -615,11 +591,6 @@ public class Arrays ...@@ -615,11 +591,6 @@ public class Arrays
return false; return false;
return true; return true;
} }
}
catch (NullPointerException e)
{
// If one is null, we get a harmless NullPointerException
}
return false; return false;
} }
...@@ -638,9 +609,10 @@ public class Arrays ...@@ -638,9 +609,10 @@ public class Arrays
if (a1 == a2) if (a1 == a2)
return true; return true;
if (null == a1 || null == a2)
return false;
// Must use Double.compare to take into account NaN, +-0. // Must use Double.compare to take into account NaN, +-0.
try
{
// If they're the same length, test each element // If they're the same length, test each element
if (a1.length == a2.length) if (a1.length == a2.length)
{ {
...@@ -650,11 +622,6 @@ public class Arrays ...@@ -650,11 +622,6 @@ public class Arrays
return false; return false;
return true; return true;
} }
}
catch (NullPointerException e)
{
// If one is null, we get a harmless NullPointerException
}
return false; return false;
} }
...@@ -674,8 +641,9 @@ public class Arrays ...@@ -674,8 +641,9 @@ public class Arrays
if (a1 == a2) if (a1 == a2)
return true; return true;
try if (null == a1 || null == a2)
{ return false;
// If they're the same length, test each element // If they're the same length, test each element
if (a1.length == a2.length) if (a1.length == a2.length)
{ {
...@@ -685,11 +653,6 @@ public class Arrays ...@@ -685,11 +653,6 @@ public class Arrays
return false; return false;
return true; return true;
} }
}
catch (NullPointerException e)
{
// If one is null, we get a harmless NullPointerException
}
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment