Skip to content

Commit

Permalink
Merge pull request #34 from rooney/OC-5645
Browse files Browse the repository at this point in the history
OC-5645 Remove hard coded values from HostAccessService
  • Loading branch information
kkrumlian committed Jul 2, 2014
2 parents 7d2ae43 + b37da32 commit aedbe58
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.util.Date;
import java.util.Properties;
import java.util.concurrent.CopyOnWriteArrayList;
import java.net.URL;
import java.net.MalformedURLException;

@Service
public class HostAccessService {
Expand All @@ -39,9 +41,19 @@ public HostAccessService(Properties resources) {
}

private void getEnterpriseHosts() {
final String host = Strings.nullToEmpty(resources.getProperty("hostlist.host"));
final String url = Strings.nullToEmpty(resources.getProperty("hostlist.url"));
final Integer port = 443;
String host = "";
if (! Strings.isNullOrEmpty(url)) {
try {
URL hostListURL = new URL(url);
host = hostListURL.getHost();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
final Integer port = Integer.parseInt(Strings.nullToEmpty(resources.getProperty("hostlist.port")));
final String username = Strings.nullToEmpty(resources.getProperty("hostlist.username"));
final String password = Strings.nullToEmpty(resources.getProperty("hostlist.password"));
boolean result = false;
Expand Down Expand Up @@ -73,7 +85,7 @@ private void getEnterpriseHosts() {
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
} finally {
// When HttpClient instance is no longer needed,
// shut down the connection manager to ensure
// immediate deallocation of all system resources
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/resources.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
allowHosts=localhost:8080,svn.akazaresearch.com:8444,svn.akazaresearch.com:8081,64.119.157.114:8060,64.119.157.114:8061,64.119.157.114:8062,64.119.157.114:8063,64.119.157.114:8064,64.119.157.114:8065,64.119.157.114:8066,64.119.157.114:8067,64.119.157.114:8068,64.119.157.114:8069,64.119.157.114:8070,64.119.157.114:8071,64.119.157.114:8072,64.119.157.114:8073,192.168.15.66:8080
hostlist.host=
hostlist.url=
hostlist.port=
hostlist.username=
hostlist.password=
hostlist.password=

0 comments on commit aedbe58

Please sign in to comment.