1. mst
  2. ooo340

Commits

kso  committed 5509639

#i114622# - Workaround for buggy Oracle Beehive server response for lockdiscovery property.

  • Participants
  • Parent commits 37113a7
  • Branches default

Comments (0)

Files changed (1)

File ucb/source/ucp/webdav/LockSequence.cxx

View file
  • Ignore whitespace
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
 using namespace webdav_ucp;
 using namespace com::sun::star;
 
+#define BEEHIVE_BUGS_WORKAROUND
+
 //////////////////////////////////////////////////////////////////////////
 
 struct LockSequenceParseContext
 extern "C" int LockSequence_chardata_callback(
     void *userdata,
     int state,
+#ifdef BEEHIVE_BUGS_WORKAROUND
+    const char *buf1,
+#else
     const char *buf,
+#endif
     size_t len )
 {
     LockSequenceParseContext * pCtx
     if ( !pCtx->pLock )
         pCtx->pLock = new ucb::Lock;
 
+#ifdef BEEHIVE_BUGS_WORKAROUND
+    // Beehive sends XML values containing trailing newlines.
+    if ( buf1[ len - 1 ] == 0x0a )
+        len--;
+
+    char * buf = new char[ len + 1 ]();
+    strncpy( buf, buf1, len );
+#endif
+
     switch ( state )
     {
         case STATE_DEPTH:
 //              @@@
 //          }
             else
-            {
-                pCtx->pLock->Timeout = sal_Int64( -1 );
-                pCtx->hasTimeout = true;
                 OSL_ENSURE( sal_False,
                         "LockSequence_chardata_callback - Unknown timeout!" );
-            }
             break;
 
         case STATE_HREF:
         }
 
     }
+
+#ifdef BEEHIVE_BUGS_WORKAROUND
+    delete [] buf;
+#endif
+
     return 0; // zero to continue, non-zero to abort parsing
 }