bump product version to 5.0.4.1
[LibreOffice.git] / ucb / qa / complex / tdoc / _XPropertyContainer.java
bloba5c996b83964a37f037eac28537e754e5da3e421
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 .
18 package complex.tdoc;
20 import com.sun.star.beans.XPropertyContainer;
21 import share.LogWriter;
23 public class _XPropertyContainer {
24 public XPropertyContainer oObj = null;
25 private final LogWriter log = null;
27 public boolean _addProperty() {
28 boolean result = true;
29 // add illegal property
30 try {
31 oObj.addProperty("MyIllegalProperty", (short)0, null);
33 catch(com.sun.star.beans.PropertyExistException e) {
34 e.printStackTrace((java.io.PrintWriter)log);
35 result = false;
37 catch(com.sun.star.lang.IllegalArgumentException e) {
38 e.printStackTrace((java.io.PrintWriter)log);
39 log.println("'IllegalArgument' Unexpected but correct.");
41 catch(com.sun.star.beans.IllegalTypeException e) {
42 log.println("'IllegalType' Correctly thrown");
44 // add valid property
45 try {
46 oObj.addProperty("MyLegalProperty", (short)0, "Just a value");
48 catch(com.sun.star.beans.PropertyExistException e) {
49 e.printStackTrace((java.io.PrintWriter)log);
50 result = false;
52 catch(com.sun.star.lang.IllegalArgumentException e) {
53 e.printStackTrace((java.io.PrintWriter)log);
54 result = false;
56 catch(com.sun.star.beans.IllegalTypeException e) {
57 e.printStackTrace((java.io.PrintWriter)log);
58 result = false;
60 return result;
63 public boolean _removeProperty() {
64 boolean result = true;
65 try {
66 oObj.removeProperty("MyIllegalProperty");
68 catch(com.sun.star.beans.UnknownPropertyException e) {
69 log.println("'UnknownProperty' Correctly thrown");
71 catch(com.sun.star.beans.NotRemoveableException e) {
72 e.printStackTrace((java.io.PrintWriter)log);
73 result = false;
75 try {
76 oObj.removeProperty("MyLegalProperty");
78 catch(com.sun.star.beans.UnknownPropertyException e) {
79 e.printStackTrace((java.io.PrintWriter)log);
80 result = false;
82 catch(com.sun.star.beans.NotRemoveableException e) {
83 e.printStackTrace((java.io.PrintWriter)log);
84 result = false;
86 return result;