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 .
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
31 oObj
.addProperty("MyIllegalProperty", (short)0, null);
33 catch(com
.sun
.star
.beans
.PropertyExistException e
) {
34 e
.printStackTrace((java
.io
.PrintWriter
)log
);
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");
46 oObj
.addProperty("MyLegalProperty", (short)0, "Just a value");
48 catch(com
.sun
.star
.beans
.PropertyExistException e
) {
49 e
.printStackTrace((java
.io
.PrintWriter
)log
);
52 catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
53 e
.printStackTrace((java
.io
.PrintWriter
)log
);
56 catch(com
.sun
.star
.beans
.IllegalTypeException e
) {
57 e
.printStackTrace((java
.io
.PrintWriter
)log
);
63 public boolean _removeProperty() {
64 boolean result
= true;
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
);
76 oObj
.removeProperty("MyLegalProperty");
78 catch(com
.sun
.star
.beans
.UnknownPropertyException e
) {
79 e
.printStackTrace((java
.io
.PrintWriter
)log
);
82 catch(com
.sun
.star
.beans
.NotRemoveableException e
) {
83 e
.printStackTrace((java
.io
.PrintWriter
)log
);