[DCM-1209]if path is empty, query can not be set.
authordahyeong.kim <dahyeong.kim@samsung.com>
Thu, 11 Apr 2013 12:52:34 +0000 (21:52 +0900)
committerdahyeong.kim <dahyeong.kim@samsung.com>
Thu, 11 Apr 2013 12:52:34 +0000 (21:52 +0900)
Change-Id: Iefa954f9a45536a43101f0df6775088e72d271a0
Signed-off-by: dahyeong.kim <dahyeong.kim@samsung.com>
src/base/utility/FBaseUtilUri.cpp

index 87d6d37..8147f53 100644 (file)
@@ -1631,73 +1631,60 @@ Uri::ParseHierarchicalUri(const Tizen::Base::String& str, int startSsp, Tizen::B
 {
        result r = E_SUCCESS;
        int curIndex = startSsp;
-//     bool isServerAuth;
 
        String tempPath;
        String queSharp(L"?#");
        String doubleSlash(L"//");
 
-       bool startsWith = str.StartsWith(doubleSlash, curIndex);
-
        int position = 0;
        bool isPath = false;
-       int temp = 0;
+       int temp = -1;
+
+       bool startsWith = str.StartsWith(doubleSlash, curIndex);
 
        if (startsWith)
        {
                curIndex += 2;
-//             int indexOf;
 
                String special(L"/?#");
-
                int index = Scan(str, curIndex, special);
-               if (index > (int) curIndex)
+               if (index > curIndex)
                {
                        r = str.SubString(curIndex, index - curIndex, authority);
                        if (IsFailed(r))
                        {
                                goto CATCH;
                        }
-
-                       //bool isServer;
-                       //r = ParseAuthority(str, curIndex, isServer);
-                       //if (IsFailed(r)) goto CATCH;
                }
-               else if (index < (int) str.GetLength())
-               {
-                       // allow an empty authority
-//                     authority = String::Empty();
-                       // empty statement
-               }
-               else
+               else if (index >= str.GetLength())
                {
                        r = E_INVALID_FORMAT;
                        goto CATCH;
                }
+
                curIndex += authority.GetLength();
+               if (curIndex == str.GetLength())
+               {
+                       r = E_SUCCESS;
+                       goto CATCH;
+               }
        }
 
-       r = queSharp.IndexOf(str[0], 0, temp);
-       if (r == E_SUCCESS)
+       queSharp.IndexOf(str[0], 0, temp);
+       if (temp >= 0)
        {
                position = 0;
        }
        else
        {
-               position = Scan(str, curIndex, queSharp); // may be empty
-               if (position < 0)
-               {
-                       r = E_INVALID_FORMAT;
-                       goto CATCH;
-               }
+               position = Scan(str, curIndex, queSharp);
 
-               if (position == curIndex)
+               if (position == curIndex && authority.GetLength() == 0)
                {
-                       // There is no path and query
-                       r = E_SUCCESS;
+                       // If both authority and path are empty, it returns error.
+                       r = E_INVALID_FORMAT;
                        goto CATCH;
                }
-
        }
 
        r = str.SubString(curIndex, position - curIndex, tempPath);