summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Kempin <edwin.kempin@sap.com>2012-10-25 09:10:35 +0200
committerEdwin Kempin <edwin.kempin@sap.com>2012-10-25 09:27:14 +0200
commit70fef54cc98139348d1b47cc05574069e635e8e0 (patch)
treebedcefb4f421abc57b5e4b8ef53713f0345c875d
parentcb7d0aee0d111ec75cac8f8003e4c2d329356245 (diff)
Do not log RepositoryNotFoundException if non-existing project is accessed
Trying to retrieve a non-existing project from the project cache causes a warning in the error log which prints the full stacktrace of the corresponding RepositoryNotFoundException. This is bad because every try to clone a non-existing project or providing a non-existing project as project argument to any SSH command triggers this warning in the error log. This is not a server error but just a bad request from a user, which shouldn't be logged. In any case the project cache still returns null for non-existing projects. All callers handle the null case, those that require the project to be found throw a NoSuchProjectException so that in this case there is still an exception that can be logged. Change-Id: Ie606b1af6756036d41387c8a9fe3b29f4c6345b3 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectCacheImpl.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectCacheImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectCacheImpl.java
index cb18398334..a7fdb4e8b6 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectCacheImpl.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectCacheImpl.java
@@ -28,6 +28,7 @@ import com.google.inject.Singleton;
import com.google.inject.TypeLiteral;
import com.google.inject.name.Named;
+import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.Repository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -116,7 +117,9 @@ public class ProjectCacheImpl implements ProjectCache {
}
return state;
} catch (ExecutionException e) {
- log.warn(String.format("Cannot read project %s", projectName.get()), e);
+ if (!(e.getCause() instanceof RepositoryNotFoundException)) {
+ log.warn(String.format("Cannot read project %s", projectName.get()), e);
+ }
return null;
}
}