[Libreoffice-commits] core.git: qadevOOo/runner qadevOOo/tests swext/mediawiki

jan iversen jani at documentfoundation.org
Sat Jan 23 00:32:19 PST 2016


 qadevOOo/runner/util/utils.java                                     |    3 
 qadevOOo/tests/java/ifc/awt/tree/_XTreeNode.java                    |   14 +-
 qadevOOo/tests/java/ifc/drawing/_DrawingDocumentDrawView.java       |    3 
 swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java |   54 +++++-----
 4 files changed, 41 insertions(+), 33 deletions(-)

New commits:
commit 77031644f16b63c794c1eef0ec4456d37e34fe23
Author: jan iversen <jani at documentfoundation.org>
Date:   Fri Jan 22 15:04:25 2016 +0100

    cid#1326434, 1326446, 1326248, 1326254
    
    null pointer dereferencing, added null check
    
    Change-Id: I78f3ee1eb5d5bd4ebe7b3a6775db4884859dbcf6
    Reviewed-on: https://gerrit.libreoffice.org/21712
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>

diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java
index c3f3458..8582f5f 100644
--- a/qadevOOo/runner/util/utils.java
+++ b/qadevOOo/runner/util/utils.java
@@ -587,7 +587,8 @@ public class utils {
         } catch (com.sun.star.uno.Exception e) {
         }
 
-        xTrans.parseStrict(rUrl);
+        if (xTrans != null)
+            xTrans.parseStrict(rUrl);
 
         return rUrl[0];
     }
diff --git a/qadevOOo/tests/java/ifc/awt/tree/_XTreeNode.java b/qadevOOo/tests/java/ifc/awt/tree/_XTreeNode.java
index 971dab8..d766c96 100644
--- a/qadevOOo/tests/java/ifc/awt/tree/_XTreeNode.java
+++ b/qadevOOo/tests/java/ifc/awt/tree/_XTreeNode.java
@@ -137,12 +137,18 @@ public class _XTreeNode extends MultiMethodTest {
         }
 
         log.println("try to get parrent of children");
-        XTreeNode xParrent = xNode.getParent();
+        if (xNode == null) {
+            log.println("missing xNode");
+            tRes.tested("getParent()", false);
+        }
+        else {
+            XTreeNode xParrent = xNode.getParent();
 
 
-        bOK = oObj.equals(xParrent);
-        log.println("original object and parrent should be the same: " + bOK);
-        tRes.tested("getParent()", bOK);
+            bOK = oObj.equals(xParrent);
+            log.println("original object and parrent should be the same: " + bOK);
+            tRes.tested("getParent()", bOK);
+        }
     }
 
 
diff --git a/qadevOOo/tests/java/ifc/drawing/_DrawingDocumentDrawView.java b/qadevOOo/tests/java/ifc/drawing/_DrawingDocumentDrawView.java
index 082babb..597e44c 100644
--- a/qadevOOo/tests/java/ifc/drawing/_DrawingDocumentDrawView.java
+++ b/qadevOOo/tests/java/ifc/drawing/_DrawingDocumentDrawView.java
@@ -164,7 +164,8 @@ public class _DrawingDocumentDrawView extends MultiPropertyTest {
         }
         log.println("oldZoomValue: "+oldValue);
         log.println("newZoomValue: "+newValue);
-        tRes.tested("ZoomType",(!oldValue.equals(newValue)));
+        if (oldValue != null)
+            tRes.tested("ZoomType",(!oldValue.equals(newValue)));
     }
 
 }
diff --git a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
index 784bc77..a6ee07f 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
@@ -60,40 +60,40 @@ public class MainThreadDialogExecutor implements XCallback
 
     private static boolean GetCallback( XComponentContext xContext, MainThreadDialogExecutor aExecutor )
     {
+        if (aExecutor == null)
+          return false;
+
         try
         {
-            if ( aExecutor != null )
-            {
-                String aThreadName = null;
-                Thread aCurThread = Thread.currentThread();
-                if ( aCurThread != null )
-                    aThreadName = aCurThread.getName();
+            String aThreadName = null;
+            Thread aCurThread = Thread.currentThread();
+            if ( aCurThread != null )
+                aThreadName = aCurThread.getName();
 
-                if ( aThreadName != null && aThreadName.equals( "com.sun.star.thread.WikiEditorSendingThread" ) )
+            if ( aThreadName != null && aThreadName.equals( "com.sun.star.thread.WikiEditorSendingThread" ) )
+            {
+                // the main thread should be accessed asynchronously
+                XMultiComponentFactory xFactory = xContext.getServiceManager();
+                if ( xFactory == null )
+                    throw new com.sun.star.uno.RuntimeException();
+
+                XRequestCallback xRequest = UnoRuntime.queryInterface(
+                    XRequestCallback.class,
+                    xFactory.createInstanceWithContext( "com.sun.star.awt.AsyncCallback", xContext ) );
+                if ( xRequest != null )
                 {
-                    // the main thread should be accessed asynchronously
-                    XMultiComponentFactory xFactory = xContext.getServiceManager();
-                    if ( xFactory == null )
-                        throw new com.sun.star.uno.RuntimeException();
-
-                    XRequestCallback xRequest = UnoRuntime.queryInterface(
-                        XRequestCallback.class,
-                        xFactory.createInstanceWithContext( "com.sun.star.awt.AsyncCallback", xContext ) );
-                    if ( xRequest != null )
+                    xRequest.addCallback( aExecutor, Any.VOID );
+                    do
                     {
-                        xRequest.addCallback( aExecutor, Any.VOID );
-                        do
-                        {
-                            Thread.yield();
-                        }
-                        while( !aExecutor.m_bCalled );
+                        Thread.yield();
                     }
+                    while( !aExecutor.m_bCalled );
                 }
-                else
-                {
-                    // handle it as a main thread
-                    aExecutor.notify( Any.VOID );
-                }
+            }
+            else
+            {
+                // handle it as a main thread
+                aExecutor.notify( Any.VOID );
             }
         }
         catch( Exception e )


More information about the Libreoffice-commits mailing list