diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-11-24 09:41:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-24 10:35:44 +0000 |
commit | 79391ca3091f6b487687d87ca46fb0d3989d3eaf (patch) | |
tree | 65a82d75377304c294869bc645c3d65a4cf8594d /wizards | |
parent | 8540bcc81003a9cc9ff9e11082a8723a7677760a (diff) |
coverity#1326265 Explicit null dereferenced
Change-Id: I802e0f854cb5c560e7a860f2fcec0330e481da6c
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/com/sun/star/wizards/document/OfficeDocument.java | 72 |
1 files changed, 27 insertions, 45 deletions
diff --git a/wizards/com/sun/star/wizards/document/OfficeDocument.java b/wizards/com/sun/star/wizards/document/OfficeDocument.java index a4f166c54def..8a85e68cfdb3 100644 --- a/wizards/com/sun/star/wizards/document/OfficeDocument.java +++ b/wizards/com/sun/star/wizards/document/OfficeDocument.java @@ -102,68 +102,50 @@ public class OfficeDocument private static XFrame createNewPreviewFrame(XMultiServiceFactory xMSF, XTerminateListener listener) { - XToolkit xToolkit = null; + XFrame xFrame = null; try { - xToolkit = UnoRuntime.queryInterface(XToolkit.class, xMSF.createInstance("com.sun.star.awt.Toolkit")); - } - catch (Exception e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } + XToolkit xToolkit = UnoRuntime.queryInterface(XToolkit.class, xMSF.createInstance("com.sun.star.awt.Toolkit")); - //describe the window and its properties - WindowDescriptor aDescriptor = new WindowDescriptor(); - aDescriptor.Type = com.sun.star.awt.WindowClass.TOP; - aDescriptor.WindowServiceName = "window"; - aDescriptor.ParentIndex = -1; - aDescriptor.Parent = null; - aDescriptor.Bounds = new Rectangle(10, 10, 640, 480); - aDescriptor.WindowAttributes = WindowAttribute.BORDER | + //describe the window and its properties + WindowDescriptor aDescriptor = new WindowDescriptor(); + aDescriptor.Type = com.sun.star.awt.WindowClass.TOP; + aDescriptor.WindowServiceName = "window"; + aDescriptor.ParentIndex = -1; + aDescriptor.Parent = null; + aDescriptor.Bounds = new Rectangle(10, 10, 640, 480); + aDescriptor.WindowAttributes = WindowAttribute.BORDER | WindowAttribute.MOVEABLE | WindowAttribute.SIZEABLE | //WindowAttribute.CLOSEABLE | VclWindowPeerAttribute.CLIPCHILDREN; - //create a new blank container window - XWindowPeer xPeer = null; - try - { - xPeer = UnoRuntime.queryInterface(XWindowPeer.class, xToolkit.createWindow(aDescriptor)); - } - catch (IllegalArgumentException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xPeer); + //create a new blank container window + XWindowPeer xPeer = UnoRuntime.queryInterface(XWindowPeer.class, xToolkit.createWindow(aDescriptor)); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xPeer); - //define some further properties of the frame window - //if it's needed .-) - //xPeer->setBackground(...); + //define some further properties of the frame window + //if it's needed .-) + //xPeer->setBackground(...); - //create new empty frame and set window on it - XFrame xFrame = null; - try - { + //create new empty frame and set window on it xFrame = UnoRuntime.queryInterface(XFrame.class, xMSF.createInstance("com.sun.star.frame.Frame")); + xFrame.initialize(xWindow); + + //from now this frame is useable ... + //and not part of the desktop tree. + //You are alone with him .-) + + if (listener != null) + { + Desktop.getDesktop(xMSF).addTerminateListener(listener); + } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } - xFrame.initialize(xWindow); - - //from now this frame is useable ... - //and not part of the desktop tree. - //You are alone with him .-) - - if (listener != null) - { - Desktop.getDesktop(xMSF).addTerminateListener(listener); - } return xFrame; |