Avoid potential negative array index access to cached text.
[LibreOffice.git] / qadevOOo / tests / java / ifc / sdb / _XCompletedConnection.java
blob12542edaaec4d037b4098bbf404eba0f58867ed2
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc.sdb;
21 import lib.MultiMethodTest;
22 import lib.StatusException;
24 import com.sun.star.sdb.XCompletedConnection;
25 import com.sun.star.sdbc.XConnection;
26 import com.sun.star.task.XInteractionHandler;
28 /**
29 * Testing <code>com.sun.star.sdb.XCompletedConnection</code>
30 * interface methods :
31 * <ul>
32 * <li><code> connectWithCompletion()</code></li>
33 * </ul> <p>
34 * The following object relations required :
35 * <ul>
36 * <li> <code>'XCompletedConnection.Handler'</code> : passed as parameter
37 * to <code>connectWithCompletion</code> method. </li>
38 * </ul>
39 * @see com.sun.star.sdb.XCompletedConnection
40 * @see com.sun.star.task.XInteractionHandler
41 * @see com.sun.star.sdbc.XConnection
43 public class _XCompletedConnection extends MultiMethodTest {
45 // oObj filled by MultiMethodTest
46 public XCompletedConnection oObj = null ;
48 /**
49 * Test call the method with handler passed as object relation.
50 * Then value returned is checked.<p>
51 * Has OK status if not null value returned. <&nbsp>
52 * FAILED if exception occurred, null value returned or object
53 * relation was not found.
55 public void _connectWithCompletion() throws StatusException {
56 XInteractionHandler handler = (XInteractionHandler)
57 tEnv.getObjRelation("XCompletedConnection.Handler") ;
59 if (handler == null) {
60 log.println("Required object relation not found !") ;
61 tRes.tested("connectWithCompletion()", false) ;
62 return ;
65 XConnection con = null ;
66 try {
67 con = oObj.connectWithCompletion(handler) ;
68 } catch (com.sun.star.sdbc.SQLException e) {
69 throw new StatusException("Exception while method calling", e) ;
72 tRes.tested("connectWithCompletion()", con != null) ;
74 } // finish class _XCompletedConnection