sync with master
[platform/framework/native/appfw.git] / src / base / collection / FBaseColArrayList.cpp
index a523413..aa77a80 100644 (file)
@@ -285,13 +285,13 @@ result
 ArrayList::IndexOf(const Object& obj, int startIndex, int& index) const
 {
        SysTryReturnResult(NID_BASE_COL, startIndex >= 0 && startIndex < __count, E_OUT_OF_RANGE, "The startIndex(%d) MUST be greater than or equal to 0, and less than the number of elements(%d).", startIndex, __count);
-
        return IndexOf(obj, startIndex, (__count - startIndex), index);
 }
 
 result
 ArrayList::IndexOf(const Object& obj, int startIndex, int count, int& index) const
 {
+       SysTryReturnResult(NID_BASE_COL, __count != 0, E_OBJ_NOT_FOUND, "The arraylist is empty.");
        SysTryReturnResult(NID_BASE_COL, startIndex >= 0 && count >= 0, E_OUT_OF_RANGE, "Both of the startIndex(%d) and count(%d) MUST be greater than or equal to 0.", startIndex, count);
        SysTryReturnResult(NID_BASE_COL, startIndex < __count, E_OUT_OF_RANGE,
                "The startIndex(%d) MUST be less than the number of elements(%d).", startIndex, __count);
@@ -323,6 +323,7 @@ ArrayList::LastIndexOf(const Object& obj, int& index) const
                }
        }
 
+       SysLogException(NID_BASE_COL, E_OBJ_NOT_FOUND, "The object is not in the list.");
        return E_OBJ_NOT_FOUND;
 }
 
@@ -393,15 +394,10 @@ ArrayList::Remove(const Object& obj)
 {
        int index = 0;
        result r = IndexOf(obj, index);
-       if (IsFailed(r))
-       {
-               return E_OBJ_NOT_FOUND;
-       }
-       else
-       {
-               return RemoveAt(index);
-       }
-
+       SysTryReturnResult(NID_BASE_COL, r == E_SUCCESS, r, "Propagating.");
+       r = RemoveAt(index);
+       SysTryReturnResult(NID_BASE_COL, r == E_SUCCESS, r, "Propagating.")
+       return r;
 }
 
 result