Author: imario
Date: Mon May 14 06:31:48 2007
New Revision: 537829

URL: http://svn.apache.org/viewvc?view=rev&rev=537829
Log:
VFS-138: avoid CCE in equals - Thanks to Adam Heath for the patch!

Modified:
    
jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java

Modified: 
jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java
URL: 
http://svn.apache.org/viewvc/jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java?view=diff&rev=537829&r1=537828&r2=537829
==============================================================================
--- 
jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java
 (original)
+++ 
jakarta/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java
 Mon May 14 06:31:48 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@
 public abstract class AbstractFileName
     implements FileName
 {
-    
+
     private final String scheme;
     private final String absPath;
     private FileType type;
@@ -79,7 +79,11 @@
      */
     public boolean equals(final Object obj)
     {
-        final AbstractFileName name = (AbstractFileName) obj;
+               if (!(obj instanceof AbstractFileName))
+               {
+                       return false;
+               }
+               final AbstractFileName name = (AbstractFileName) obj;
         return (getRootURI().equals(name.getRootURI()) && 
getPath().equals(name.getPath()));
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to