summaryrefslogtreecommitdiff
path: root/external/libcmis/libcmis-fix-error-handling.patch
blob: d0f1ae29cebcc811dab0919b0335b150146e1a63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff -ur cmis.org/src/libcmis/xml-utils.cxx cmis/src/libcmis/xml-utils.cxx
--- cmis.org/src/libcmis/xml-utils.cxx	2016-12-09 02:19:47.900961750 +0100
+++ cmis/src/libcmis/xml-utils.cxx	2016-12-09 02:23:56.392206339 +0100
@@ -382,9 +382,14 @@
         // Get the time zone offset
         boost::posix_time::time_duration tzOffset( boost::posix_time::duration_from_string( "+00:00" ) );
 
+        if ( dateTimeStr.empty( ) )
+            return t; // obviously not a time
+
         size_t teePos = dateTimeStr.find( 'T' );
-        string noTzStr = dateTimeStr.substr( 0, teePos + 1 );
+        if ( teePos == string::npos )
+            return t; // obviously not a time
 
+        string noTzStr = dateTimeStr.substr( 0, teePos + 1 );
         string timeStr = dateTimeStr.substr( teePos + 1 );
 
         // Get the TZ if any
@@ -459,10 +459,9 @@
         bool value = false;
         if ( boolStr == "true" || boolStr == "1" )
             value = true;
-        else if ( boolStr == "false" || boolStr == "0" )
-            value = false;
         else
-            throw Exception( string( "Invalid xsd:boolean input: " ) + boolStr );
+            // treat everthing else, including absence of property, as 'false', not as an error
+            value = false;
         return value;
     }