Clean up code to conform to basic checkstyle
Issue gh-3746
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009 the original author or authors.
|
||||
* Copyright 2009-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009 the original author or authors.
|
||||
* Copyright 2009-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009 the original author or authors.
|
||||
* Copyright 2009-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009 the original author or authors.
|
||||
* Copyright 2009-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009 the original author or authors.
|
||||
* Copyright 2009-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.security.remoting.dns;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.NameNotFoundException;
|
||||
@@ -56,35 +57,35 @@ public class JndiDnsResolver implements DnsResolver {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.springframework.security.remoting.dns.DnsResolver#resolveIpAddress(java.lang
|
||||
* .String)
|
||||
*/
|
||||
public String resolveIpAddress(String hostname) {
|
||||
return resolveIpAddress(hostname, ctxFactory.getCtx());
|
||||
return resolveIpAddress(hostname, this.ctxFactory.getCtx());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.springframework.security.remoting.dns.DnsResolver#resolveServiceEntry(java.
|
||||
* lang.String, java.lang.String)
|
||||
*/
|
||||
public String resolveServiceEntry(String serviceType, String domain) {
|
||||
return resolveServiceEntry(serviceType, domain, ctxFactory.getCtx());
|
||||
return resolveServiceEntry(serviceType, domain, this.ctxFactory.getCtx());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.springframework.security.remoting.dns.DnsResolver#resolveServiceIpAddress(java
|
||||
* .lang.String, java.lang.String)
|
||||
*/
|
||||
public String resolveServiceIpAddress(String serviceType, String domain) {
|
||||
DirContext ctx = ctxFactory.getCtx();
|
||||
DirContext ctx = this.ctxFactory.getCtx();
|
||||
String hostname = resolveServiceEntry(serviceType, domain, ctx);
|
||||
return resolveIpAddress(hostname, ctx);
|
||||
}
|
||||
@@ -106,7 +107,8 @@ public class JndiDnsResolver implements DnsResolver {
|
||||
|
||||
// This method is needed, so that we can use only one DirContext for
|
||||
// resolveServiceIpAddress().
|
||||
private String resolveServiceEntry(String serviceType, String domain, DirContext ctx) {
|
||||
private String resolveServiceEntry(String serviceType, String domain,
|
||||
DirContext ctx) {
|
||||
String result = null;
|
||||
try {
|
||||
String query = new StringBuilder("_").append(serviceType).append("._tcp.")
|
||||
@@ -122,8 +124,8 @@ public class JndiDnsResolver implements DnsResolver {
|
||||
.hasMoreElements();) {
|
||||
String[] record = recordEnum.next().toString().split(" ");
|
||||
if (record.length != 4) {
|
||||
throw new DnsLookupException("Wrong service record for query "
|
||||
+ query + ": [" + Arrays.toString(record) + "]");
|
||||
throw new DnsLookupException("Wrong service record for query " + query
|
||||
+ ": [" + Arrays.toString(record) + "]");
|
||||
}
|
||||
int priority = Integer.parseInt(record[0]);
|
||||
int weight = Integer.parseInt(record[1]);
|
||||
@@ -141,8 +143,8 @@ public class JndiDnsResolver implements DnsResolver {
|
||||
}
|
||||
}
|
||||
catch (NamingException e) {
|
||||
throw new DnsLookupException("DNS lookup failed for service " + serviceType
|
||||
+ " at " + domain, e);
|
||||
throw new DnsLookupException(
|
||||
"DNS lookup failed for service " + serviceType + " at " + domain, e);
|
||||
}
|
||||
|
||||
// remove the "." at the end
|
||||
@@ -160,7 +162,8 @@ public class JndiDnsResolver implements DnsResolver {
|
||||
}
|
||||
catch (NamingException e) {
|
||||
if (e instanceof NameNotFoundException) {
|
||||
throw new DnsEntryNotFoundException("DNS entry not found for:" + query, e);
|
||||
throw new DnsEntryNotFoundException("DNS entry not found for:" + query,
|
||||
e);
|
||||
}
|
||||
throw new DnsLookupException("DNS lookup failed for: " + query, e);
|
||||
}
|
||||
@@ -170,7 +173,8 @@ public class JndiDnsResolver implements DnsResolver {
|
||||
|
||||
public DirContext getCtx() {
|
||||
Hashtable<String, String> env = new Hashtable<String, String>();
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY,
|
||||
"com.sun.jndi.dns.DnsContextFactory");
|
||||
env.put(Context.PROVIDER_URL, "dns:"); // This is needed for IBM JDK/JRE
|
||||
InitialDirContext ictx;
|
||||
try {
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* DNS resolution.
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
/*
|
||||
* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Enables use of Spring's <code>HttpInvoker</code> extension points to
|
||||
* present the <code>principal</code> and <code>credentials</code> located
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Remote client related functionality.
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
/*
|
||||
* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
/*
|
||||
* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Enables use of Spring's RMI remoting extension points to propagate the <code>SecurityContextHolder</code> (which
|
||||
* should contain an <code>Authentication</code> request token) from one JVM to the remote JVM.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009 the original author or authors.
|
||||
* Copyright 2009-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
/*
|
||||
* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
/*
|
||||
* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
||||
Reference in New Issue
Block a user