Skip to content

Commit

Permalink
Clean up debug statements, better gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric Staub committed Jul 27, 2012
1 parent 4c99e6a commit d7d0e5f
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 19 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Expand Up @@ -6,6 +6,18 @@ conf/local
local
logs

# Yanel build directory
/build

# Index files
*.cfs
*.gen
segments_*

# Yarep meta files
*.yarep
yarep-meta/

# local Yanel build configuration
src/build/local.build.properties

Expand Down
Expand Up @@ -141,7 +141,7 @@ public View getView(HttpServletRequest request, String viewId) throws Exception
String[] tags = new String[1];
tags[0] = "contact";
if (trackInfo != null) {
log.warn("DEBUG: Message: " + message);
log.debug("Message: " + message);
if (message != null) {
trackInfo.addTag(message);
}
Expand Down
Expand Up @@ -60,7 +60,7 @@ protected InputStream getContentXML(String viewId) throws Exception {
for (int k = 0; k < userInterests.length; k++) {
//String queryInclModDate = userInterests[k] + " AND mod_date:[" + df.format(lastAccess) + " TO " + df.format(new Date()) + "]"; // INFO: See http://lucene.apache.org/java/2_3_2/queryparsersyntax.html#Range%20Searches
String queryInclModDate = userInterests[k] + " AND yarep_lastModified:[" + lastAccess.getTime() + " TO " + new Date().getTime() + "]"; // INFO: See http://lucene.apache.org/java/2_3_2/queryparsersyntax.html#Range%20Searches
log.warn("DEBUG: Query: " + queryInclModDate);
log.debug("Query: " + queryInclModDate);

org.wyona.yarep.core.Node[] nodesInclModDate = getRealm().getRepository().getSearcher().search(queryInclModDate);

Expand Down
Expand Up @@ -95,7 +95,7 @@ protected InputStream getContentXML(String viewId) throws Exception {
YarepUtil yu = new YarepUtil();

try {
log.warn("DEBUG: Check for nodes which still exist inside the search index, but do not exist anymore inside the repository: " + repo.getName());
log.debug("Check for nodes which still exist inside the search index, but do not exist anymore inside the repository: " + repo.getName());
LuceneSearcher luceneSearcher = (LuceneSearcher) repo.getSearcher();
boolean delete = false;
if (getEnvironment().getRequest().getParameter("delete") != null) {
Expand Down
Expand Up @@ -62,7 +62,7 @@ public static void saveAnnotations(java.util.Set<String> annotations, org.wyona.
sb.append(", ");
}
}
log.warn("DEBUG: Save annotations: " + sb);
log.debug("Save annotations: " + sb);
repo.getNode(path).setProperty(ANNOTATIONS_PROP_NAME, sb.toString());
}
}
Expand Up @@ -135,7 +135,7 @@ public void execute() throws UsecaseException {
anno.setAnnotation(t.trim());
}
String msg = "The following annotations have been saved: " + metadata;
log.warn("DEBUG: Message: " + msg);
log.debug("Message: " + msg);
addInfoMessage(msg);
} catch (Exception e) {
log.error(e, e);
Expand Down
Expand Up @@ -561,7 +561,7 @@ private void addUserToGroups(User user) throws Exception {
}
for (int i = 0; i < groupIDs.length; i++) {
if (getRealm().getIdentityManager().getGroupManager().existsGroup(groupIDs[i])) {
log.warn("DEBUG: Add user '" + user.getEmail() + "' to group: " + groupIDs[i]);
log.debug("Add user '" + user.getEmail() + "' to group: " + groupIDs[i]);
getRealm().getIdentityManager().getGroupManager().getGroup(groupIDs[i]).addMember(user);
} else {
log.warn("No such group: " + groupIDs[i]);
Expand Down Expand Up @@ -706,10 +706,10 @@ protected UserRegistrationBean areSubmittedValuesValid(Document doc, String emai
Element exception = (Element) rootElement.appendChild(doc.createElementNS(NAMESPACE, "zip-not-valid"));
inputsValid = false;
} else {
log.warn("DEBUG: Submitted ZIP: " + zip);
log.debug("Submitted ZIP: " + zip);
String formattedZip = isZipValid(zip);
if (formattedZip != null) {
log.warn("DEBUG: Formatted ZIP: " + formattedZip);
log.debug("Formatted ZIP: " + formattedZip);
if (!zip.equals(formattedZip)) {
log.warn("Submitted zip code '" + zip + "' has been modified: " + formattedZip);
}
Expand Down
Expand Up @@ -64,9 +64,9 @@ protected InputStream getContentXML(String viewId) throws Exception {
java.util.Iterator triggerKeysIt = triggerKeys.iterator();
while(triggerKeysIt.hasNext()) {
TriggerKey triggerKey = (TriggerKey) triggerKeysIt.next();
//log.warn("DEBUG: Check whether trigger's job key '" + scheduler.getTrigger(triggerKey).getJobKey() + "' and job key '" + jobKey + "' match...");
//log.debug("Check whether trigger's job key '" + scheduler.getTrigger(triggerKey).getJobKey() + "' and job key '" + jobKey + "' match...");
if (scheduler.getTrigger(triggerKey).getJobKey().toString().equals(jobKey.toString())) {
log.warn("DEBUG: Trigger and job '" + jd.getDescription() + "' matched: " + scheduler.getTrigger(triggerKey).getNextFireTime());
log.debug("Trigger and job '" + jd.getDescription() + "' matched: " + scheduler.getTrigger(triggerKey).getNextFireTime());
jobEl.setAttribute("next-fire-time", "" + scheduler.getTrigger(triggerKey).getNextFireTime());
}
}
Expand Down
Expand Up @@ -44,12 +44,12 @@ protected InputStream getContentXML(String viewId) throws Exception {

/*
if (org.wyona.commons.clazz.ClazzUtil.implementsInterface(getRealm().getRepository(), "org.wyona.yarep.core.attributes.LuceneSearchableV1")) {
log.warn("DEBUG: Repo is lucene searchable ...");
log.debug("Repo is lucene searchable ...");
org.apache.lucene.search.Searcher searcher = ((org.wyona.yarep.core.attributes.LuceneSearchableV1)getRealm().getRepository()).getLuceneSearcher();
String defaultField = "_FULLTEXT";
org.apache.lucene.queryParser.QueryParser queryParser = new org.apache.lucene.queryParser.QueryParser(defaultField, new org.apache.lucene.analysis.standard.StandardAnalyzer());
log.warn("DEBUG: Default field: " + defaultField);
log.debug("Default field: " + defaultField);
org.apache.lucene.search.Query query = queryParser.parse(queryText);
// How to use StandardAnalyzer with TermQuery? http://stackoverflow.com/questions/1390088/how-do-i-use-standardanalyzer-with-termquery, http://today.java.net/pub/a/today/2003/07/30/LuceneIntro.html
Expand All @@ -61,10 +61,10 @@ protected InputStream getContentXML(String viewId) throws Exception {
//org.apache.lucene.search.Query query = new org.apache.lucene.queryParser.QueryParser("_FULLTEXT", (org.apache.lucene.analysis.Analyzer) Class.forName("org.apache.lucene.analysis.standard.StandardAnalyzer").newInstance()).parse("Sugus");
log.warn("DEBUG: Query: " + query);
log.debug("Query: " + query);
org.apache.lucene.search.Hits hits = searcher.search(query);
for (int i = 0; i < hits.length(); i++) {
log.warn("DEBUG: Hit _PATH: " + hits.doc(i).getField("_PATH").stringValue());
log.debug("Hit _PATH: " + hits.doc(i).getField("_PATH").stringValue());
}
}
*/
Expand Down
Expand Up @@ -160,13 +160,13 @@ private InputStream getContentXML(Repository repo, String yanelPath, String revi
// TODO: Differentiate between users who have access to all comments and only public comments
//java.util.List comments = cMan.getPublicComments(realm, getPath()).getComments();
java.util.List comments = cMan.getAllComments(realm, getPath()).getComments();
log.warn("DEBUG: Resource '" + getPath() + "' has comments: " + comments.size());
log.debug("Resource '" + getPath() + "' has comments: " + comments.size());
// TODO: Add comments to XML root element using a namespace
Document mainDoc = XMLHelper.readDocument(node.getInputStream());
String aggregateComments = getResourceConfigProperty("aggregate-comments");
if (aggregateComments != null && aggregateComments.equals("true")) {
Document commentsDoc = org.wyona.yarep.util.YarepXMLBindingUtil.getDocFromJAXBDataObject(cMan.getAllComments(realm, getPath()));
log.warn("DEBUG: Aggregate comments ...");
log.debug("Aggregate comments ...");
//org.w3c.dom.Node importedNode = mainDoc.getDocumentElement().getOwnerDocument().importNode(commentsDoc.getDocumentElement(), true);
//mainDoc.getDocumentElement().appendChild(importedNode);
//org.w3c.dom.Node importedNode = mainDoc.importNode(commentsDoc.getDocumentElement(), true);
Expand Down
4 changes: 2 additions & 2 deletions src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java
Expand Up @@ -243,7 +243,7 @@ public void init(ServletConfig config) throws ServletException {

if (yanelInstance.isSchedulerEnabled()) {
try {
log.warn("DEBUG: Startup scheduler ...");
log.debug("Startup scheduler ...");
scheduler = StdSchedulerFactory.getDefaultScheduler();

Realm[] realms = yanelInstance.getRealmConfiguration().getRealms();
Expand Down Expand Up @@ -299,7 +299,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response)
String yanelUsecase = request.getParameter(YANEL_USECASE);
if(yanelUsecase != null && yanelUsecase.equals("logout")) {
try {
log.warn("DEBUG: Disable auto login..."); // TODO: The cookie is not always deleted!
log.debug("Disable auto login..."); // TODO: The cookie is not always deleted!
AutoLogin.disableAutoLogin(request, response, getRealm(request).getRepository());
} catch (Exception e) {
log.error("Exception while disabling auto login: " + e.getMessage(), e);
Expand Down
Expand Up @@ -50,7 +50,7 @@ public static void disableAutoLogin(HttpServletRequest request, HttpServletRespo
if (currentCookie != null) {
deleteToken(repo, getYarepPath(getUsername(currentCookie), getToken(currentCookie)));

log.warn("DEBUG: Remove auto login cookie...");
log.debug("Remove auto login cookie...");
Cookie newCookie = new Cookie(COOKIE_NAME, null);
newCookie.setMaxAge(0); // INFO: A zero value tells the browser to delete the cookie immediately.
response.addCookie(newCookie);
Expand Down

0 comments on commit d7d0e5f

Please sign in to comment.