[direct-certificate-discovery-tool] r414 committed - Removed System out's

0 views
Skip to first unread message

direct-certifica...@googlecode.com

unread,
Nov 30, 2012, 4:25:29 PM11/30/12
to modular-sp...@googlegroups.com
Revision: 414
Author: Sandeep....@nitorgroup.com
Date: Fri Nov 30 13:25:10 2012
Log: Removed System out's
http://code.google.com/p/direct-certificate-discovery-tool/source/detail?r=414

Modified:

/MSP3_Tool_Production/src/main/java/gov/onc/certLookup/ldap/LdapCertLookUp.java

=======================================
---
/MSP3_Tool_Production/src/main/java/gov/onc/certLookup/ldap/LdapCertLookUp.java
Tue Nov 20 11:14:55 2012
+++
/MSP3_Tool_Production/src/main/java/gov/onc/certLookup/ldap/LdapCertLookUp.java
Fri Nov 30 13:25:10 2012
@@ -3,6 +3,7 @@
import gov.onc.certLookup.CertLookUpException;
import gov.onc.certLookup.CertLookUpFactory;
import gov.onc.certLookup.CertificateInfo;
+import org.apache.log4j.Logger;

import java.io.ByteArrayInputStream;
import java.io.Closeable;
@@ -26,6 +27,7 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;

+import org.apache.log4j.Logger;
import org.xbill.DNS.SRVRecord;


@@ -44,6 +46,7 @@
private SearchControls sc2;
private Boolean success;

+ private Logger log = Logger.getLogger("certDiscoveryLogger");
public CertificateInfo execute(CertificateInfo certInfo)
throws CertLookUpException {

@@ -80,7 +83,7 @@

break;
}else {
- System.out.println("Unable to find certificate at LDAP for: "
+ log.debug("Unable to find certificate at LDAP for: "
+ certInfo.getOrigAddr() + "\n"
+ srvRec.toString());
}
@@ -122,6 +125,7 @@
sc1 = new SearchControls();
// set the scope of the first directory search
sc1.setSearchScope(SearchControls.ONELEVEL_SCOPE);
+ sc1.setReturningAttributes(new String[] { "namingContexts" });
sc2 = new SearchControls();
// set the scope of the search on each found directory
sc2.setSearchScope(SearchControls.SUBTREE_SCOPE);
@@ -153,9 +157,10 @@

String targetDomain = srvRec.getTarget().toString();
try {
- env.put(DirContext.PROVIDER_URL, "ldap://" + targetDomain + ":" +
srvRec.getPort());
+ env.put(DirContext.PROVIDER_URL, "ldap://" + targetDomain + ":" +
srvRec.getPort());

- System.out.println("ldap://" + targetDomain + ":" + srvRec.getPort());
+
+ log.debug("ldap://" + targetDomain + ":" + srvRec.getPort());

DirContext dc = new InitialDirContext(env);
NamingEnumeration directoryNE = null;
@@ -164,13 +169,13 @@
// Here we set the search for the root directory, searching for any
objectClass matches, and the scope is set using the sc1 variable (see above)
directoryNE= dc.search("", "objectClass=*", sc1);

- System.out.println("SC1 :" + sc1);
+ log.debug("SC1 :" + sc1);

while (directoryNE.hasMore()){
SearchResult result1 = (SearchResult) directoryNE.next();

// print DN of each directory found.
- System.out.println("Result.getNameInNamespace: " + result1.getName());
+ log.debug("Result.getNameInNamespace: " + result1.getName());

Attribute foundMail =
findMailAttribute(result1.getNameInNamespace());

@@ -180,7 +185,7 @@
}
dc.close();
} catch (NamingException e) {
- System.out.println("No Results for: " + targetDomain + "\nProblem: " +
e.getLocalizedMessage() + " " + e.getCause());
+ log.debug("No Results for: " + targetDomain + "\nProblem: " +
e.getLocalizedMessage() + " " + e.getCause());
} return null;

}
@@ -231,10 +236,11 @@
while (e.hasMore()) {

SearchResult nodeResult = (SearchResult) e.next();
- System.out.println("Search Result: " + nodeResult.toString()
+ "\n\n");
+ log.debug("Search Result: " + nodeResult.toString() + "\n\n");
Attributes localAttributes = ((SearchResult)
nodeResult).getAttributes();
- localAttribute = localAttributes.get("userCertificate");
- System.out.println("localAttribute: " + localAttribute);
+
+ System.out.println();
+ log.debug("localAttribute: " + localAttribute);

if(localAttribute != null)
return localAttribute;
Reply all
Reply to author
Forward
0 new messages