summaryrefslogtreecommitdiff
path: root/swext
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-10-15 14:43:35 +0200
committerNoel Grandin <noel@peralex.com>2014-10-16 08:15:48 +0200
commit973eb2f6db60c0939299a968a3121e3310e6d1f5 (patch)
tree9eece355c20bc4d930e7e58943fc2d33bedfcfd0 /swext
parentfa652cdd2314f485359119a8ff081a7afd1c01b0 (diff)
java: reduce the depth of some deeply nested if blocks
Change-Id: I3c0c7f08d4d8ea594e72fc0d9b93d085d4ab4bf5
Diffstat (limited to 'swext')
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/Helper.java50
1 files changed, 25 insertions, 25 deletions
diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
index 1eb42040139b..9d58de7a3b90 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
@@ -331,39 +331,39 @@ public class Helper
//scrape the HTML source and find the EditURL
// TODO/LATER: Use parser in future
- String sResultURL = "";
int nInd = sWebPage.indexOf( "http-equiv=\"refresh\"" );
- if ( nInd != -1 )
+ if ( nInd == -1 )
+ return "";
+
+ String sResultURL = "";
+ int nContent = sWebPage.indexOf( "content=", nInd );
+ if ( nContent > 0 )
{
- int nContent = sWebPage.indexOf( "content=", nInd );
- if ( nContent > 0 )
+ int nURL = sWebPage.indexOf( "URL=", nContent );
+ if ( nURL > 0 )
{
- int nURL = sWebPage.indexOf( "URL=", nContent );
- if ( nURL > 0 )
- {
- int nEndURL = sWebPage.indexOf('"', nURL );
- if ( nEndURL > 0 )
- sResultURL = sWebPage.substring( nURL + 4, nEndURL );
- }
+ int nEndURL = sWebPage.indexOf('"', nURL );
+ if ( nEndURL > 0 )
+ sResultURL = sWebPage.substring( nURL + 4, nEndURL );
}
+ }
- try
- {
- URL aURL = new URL( sURL );
- if ( !sResultURL.startsWith( aURL.getProtocol() ))
- {
- //if the url is only relative then complete it
- if ( sResultURL.startsWith( "/" ) )
- sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + sResultURL;
- else
- sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + aURL.getPath() + sResultURL;
- }
- }
- catch ( MalformedURLException ex )
+ try
+ {
+ URL aURL = new URL( sURL );
+ if ( !sResultURL.startsWith( aURL.getProtocol() ))
{
- ex.printStackTrace();
+ //if the url is only relative then complete it
+ if ( sResultURL.startsWith( "/" ) )
+ sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + sResultURL;
+ else
+ sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + aURL.getPath() + sResultURL;
}
}
+ catch ( MalformedURLException ex )
+ {
+ ex.printStackTrace();
+ }
return sResultURL;