java: combine nested if statements

Change-Id: I0457b81668e9427a3c8d6a4af93438b7fb2bb7ba
This commit is contained in:
Noel Grandin
2015-11-05 14:16:35 +02:00
parent dfcb982ae8
commit b73db446ac
34 changed files with 224 additions and 331 deletions

View File

@@ -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;

View File

@@ -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 (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);
}
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

View File

@@ -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);