[Libreoffice-commits] core.git: Branch 'libreoffice-5-2-1' - framework/qa framework/source

Tor Lillqvist tml at collabora.com
Fri Aug 12 08:10:23 UTC 2016


 framework/qa/complex/XTitle/CheckXTitle.java |   13 ++++++-------
 framework/source/loadenv/loadenv.cxx         |   18 +++---------------
 2 files changed, 9 insertions(+), 22 deletions(-)

New commits:
commit 2c01fd3e36ae74bc35b11197ffa6dc4c6638249d
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Aug 10 17:33:22 2016 +0300

    Revert "tdf#98837 - Fail loading a new document with read only property ..."
    
    There was not really a good enough reason for the change, and it
    causes unfortunate regressions in 3rd-party code that previously
    worked fine. (It also caused two regressions in LO's own code, but
    those were already fixed.)
    
    This reverts commit 5334ff287c65f028753171c7b38da7ffbcebc1cc.
    
    (cherry picked from commit 38a3743e0c5d52f9386f74097fd512d3133fbbe3)
    
    Change-Id: Iec36345fa3663bc5d96ce3e74d334c7aa075ada2
    Reviewed-on: https://gerrit.libreoffice.org/28036
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/framework/qa/complex/XTitle/CheckXTitle.java b/framework/qa/complex/XTitle/CheckXTitle.java
index e798732..8912470 100644
--- a/framework/qa/complex/XTitle/CheckXTitle.java
+++ b/framework/qa/complex/XTitle/CheckXTitle.java
@@ -217,11 +217,12 @@ public class CheckXTitle
         xDisProv = null;
     }
 
-    /** @short checks loading of new document with readonly set to true
+    /** @short checks creation of new empty document with readonly set to true
 
-        @descr loads a new document with readonly mode set to true.
-               this should fail because new doc can not be opened in
-               read only mode
+        @descr creation of a new document with readonly property set
+               to true.  this should not fail even if as such it can
+               be seen as a slightly silly thing to do. But existing
+               3rd-party code depends on it to work.
     */
     @Test public void checkLoadingWithReadOnly()
     {
@@ -239,10 +240,8 @@ public class CheckXTitle
         try{
                 xDoc = m_xLoader.loadComponentFromURL("private:factory/swriter", "_default", 0, lArgs);
         } catch (Exception e) {
-            //exception is expected. do nothing
         }
-
-        assertNull("Loading new document with read only mode true should have failed", xDoc);
+        assertNotNull("Creating a new document read with ReadOnly property true should work (even if slightly silly)", xDoc);
     }
 
     private XMultiServiceFactory getMSF()
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index a7fcf57..b6f6f4c 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -552,25 +552,13 @@ LoadEnv::EContentType LoadEnv::classifyContent(const OUString&
                   in a special way .-)
     */
 
-    utl::MediaDescriptor stlMediaDescriptor(lMediaDescriptor);
-    utl::MediaDescriptor::const_iterator pIt;
-
     // creation of new documents
     if (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_PRIVATE_FACTORY))
-    {
-        //tdf#98837 - check if read only prop is set to true for a new document
-        //if yes then fail loading as doc needs to be saved before being opened
-        //in read only mode
-        pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_READONLY());
-        if( pIt == stlMediaDescriptor.end() ||
-            pIt->second == uno::Any(false)
-          )
-            return E_CAN_BE_LOADED;
-        SAL_INFO("fwk", "LoadEnv::classifyContent(): new document can not be loaded in read only mode");
-        return E_UNSUPPORTED_CONTENT;
-    }
+        return E_CAN_BE_LOADED;
 
     // using of an existing input stream
+    utl::MediaDescriptor                 stlMediaDescriptor(lMediaDescriptor);
+    utl::MediaDescriptor::const_iterator pIt;
     if (ProtocolCheck::isProtocol(sURL,ProtocolCheck::E_PRIVATE_STREAM))
     {
         pIt = stlMediaDescriptor.find(utl::MediaDescriptor::PROP_INPUTSTREAM());


More information about the Libreoffice-commits mailing list