summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-11-05 14:16:35 +0200
committerNoel Grandin <noel@peralex.com>2015-11-05 14:55:15 +0200
commitb73db446ac9681fdfc4ad602c6da7ce3e36a8588 (patch)
tree6107f4347c188f4c14840c01167b2f05b2f5ad48 /scripting
parentdfcb982ae8810e22204bc15fd7c119a903900a53 (diff)
java: combine nested if statements
Change-Id: I0457b81668e9427a3c8d6a4af93438b7fb2bb7ba
Diffstat (limited to 'scripting')
-rw-r--r--scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java8
-rw-r--r--scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java32
-rw-r--r--scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java6
3 files changed, 20 insertions, 26 deletions
diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java
index f92662e10f1a..f58a9d88d838 100644
--- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java
+++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java
@@ -114,11 +114,9 @@ public class ParcelDescriptor {
}
public String getLanguage() {
- if (language == null) {
- if (document != null) {
- Element e = document.getDocumentElement();
- language = e.getAttribute("language");
- }
+ if (language == null && document != null) {
+ Element e = document.getDocumentElement();
+ language = e.getAttribute("language");
}
return language;
diff --git a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java
index dfbac7c8d2e1..bf4f29a3a896 100644
--- a/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java
+++ b/scripting/java/com/sun/star/script/framework/container/UnoPkgContainer.java
@@ -98,25 +98,23 @@ public class UnoPkgContainer extends ParcelContainer {
try {
DeployedUnoPackagesDB db = getUnoPackagesDB();
- if (db != null) {
- if (db.removePackage(language, url)) {
- writeUnoPackageDB(db);
- ParcelContainer container = registeredPackages.get(url);
-
- if (!container.hasElements()) {
- // When all libraries within a package bundle
- // ( for this language ) are removed also
- // remove the container from its parent
- // Otherwise, a container ( with no containees )
- // representing the uno package bundle will
- // still exist and so will get displayed
- if (container.parent() != null) {
- container.parent().removeChildContainer(container);
- }
+ if (db != null && db.removePackage(language, url)) {
+ writeUnoPackageDB(db);
+ ParcelContainer container = registeredPackages.get(url);
+
+ if (!container.hasElements()) {
+ // When all libraries within a package bundle
+ // ( for this language ) are removed also
+ // remove the container from its parent
+ // Otherwise, a container ( with no containees )
+ // representing the uno package bundle will
+ // still exist and so will get displayed
+ if (container.parent() != null) {
+ container.parent().removeChildContainer(container);
}
-
- registeredPackages.remove(url);
}
+
+ registeredPackages.remove(url);
}
} catch (Exception e) {
//TODO revisit exception handling and exception here
diff --git a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java
index 4e2059b2f5c5..6413745d3617 100644
--- a/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java
+++ b/scripting/java/com/sun/star/script/framework/io/UCBStreamHandler.java
@@ -235,10 +235,8 @@ public class UCBStreamHandler extends URLStreamHandler {
// TODO don't depend on result of available() or size()
// just read stream 'till complete
- if (sz == 0) {
- if (xInputStream.available() > 0) {
- sz = xInputStream.available();
- }
+ if (sz == 0 && xInputStream.available() > 0) {
+ sz = xInputStream.available();
}
LogUtils.DEBUG("size of file " + path + " is " + sz);