avoiding output in the error log
PATCH 1/1 avoiding output in the error log
Hi,this is a patch for egit. The purpose of the patch is to avoid a lot of output in the error log.
Quoted 1 line
From
6f7be5d1a41d356a9b558ac81722e959095ff04dMon Sep 17 00:00:00 2001
From: robert <[email protected]>
Date: Mon, 25 Aug 2008 20:42:39 +0200
Subject: [PATCH] Checks added to avoid a lot of entries in the log
* IResource.exists() must be checked before calling setProperty on it.
* getActiveDecorator() was returning null in some case.
--- .../internal/decorators/GitResourceDecorator.java | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java +7 -3
@@ -143,7 +143,9 @@ if (resources.size() > 0) try { m.accept(new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { - getActiveDecorator().clearDecorationState(resource); + GitResourceDecorator decorator = getActiveDecorator(); + if (decorator != null) + decorator.clearDecorationState(resource); return true; } },
@@ -197,8 +199,10 @@ synchronized (resources) { } // End ResCL void clearDecorationState(IResource r) throws CoreException { - r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); - fireLabelProviderChanged(new LabelProviderChangedEvent(this, r)); + if (r.exists()) { + r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); + fireLabelProviderChanged(new LabelProviderChangedEvent(this, r)); + } } static ResCL myrescl = new ResCL();
Signature · 1 line
1.6.0
onsdagen den 27 augusti 2008 11.34.33 skrev [email protected]:
Quoted 2 lines
Hi,this is a patch for egit. The purpose of the patch is to avoid a lot of output in the error log.
Welcome Robert!
Quoted 17 lines
From
6f7be5d1a41d356a9b558ac81722e959095ff04dMon Sep 17 00:00:00 2001
From: robert <[email protected]>
Date: Mon, 25 Aug 2008 20:42:39 +0200
Subject: [PATCH] Checks added to avoid a lot of entries in the log*
IResource.exists()must be checked before calling setProperty on it.
*getActiveDecorator()was returning null in some case.--- .../internal/decorators/GitResourceDecorator.java | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java +0
-0
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java if (resources.size() > 0) · line 148
Quoted 7 lines
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java +3
-1@@ -143,7 +143,9 @@ if (resources.size() > 0) try { m.accept(new IResourceVisitor() { public boolean visit(IResource resource) throws CoreException { - getActiveDecorator().clearDecorationState(resource); + GitResourceDecorator decorator = getActiveDecorator(); + if (decorator != null) + decorator.clearDecorationState(resource);
When doest his happen?
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java synchronized (resources) { · line 205
Quoted 13 lines
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java +4
-2return true; } },@@ -197,8 +199,10 @@ synchronized (resources) { } // End ResCL void clearDecorationState(IResource r) throws CoreException { - r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); - fireLabelProviderChanged(new LabelProviderChangedEvent(this, r)); + if (r.exists()) { + r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); + fireLabelProviderChanged(new LabelProviderChangedEvent(this, r)); + }
Shawn, you removed the test from the code in 4a230ea1. Perhaps you could care to comment on this patch to restore the test, though slightly different.
if (r.isAccessible()) r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);
-- robin
Quoted 14 lines · Robin Rosenberg
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java synchronized (resources) { · line 205
Quoted 10 lines
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java +4
-2@@ -197,8 +199,10 @@ synchronized (resources) { } // End ResCL void clearDecorationState(IResource r) throws CoreException { - r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); - fireLabelProviderChanged(new LabelProviderChangedEvent(this, r)); + if (r.exists()) { + r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); + fireLabelProviderChanged(new LabelProviderChangedEvent(this, r)); + }Shawn, you removed the test from the code in
4a230ea1. Perhaps you could care to comment on this patch to restore the test, though slightly different.
Quoted 2 lines
if (r.isAccessible()) r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);
This may be a patch queue reordering bug.
If you look at 4a230ea1 I moved the isAccessible test higher up, such that we shouldn't enter into clearDecorationState unless the resource is accessible. But there may currently be two code paths that enter this method, and a patch I did not yet submit had removed the other code path.
So in the short/medium term I agree with your patch, basically undo the second hunk of 4a230ea1. But keep the middle hunk, it was a real bug I ran into.
Signature · 1 line
Shawn.
onsdagen den 27 augusti 2008 22.33.43 skrev Shawn O. Pearce:
Quoted 18 lines
Quoted 14 lines · Robin Rosenberg
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java synchronized (resources) { · line 205
Quoted 10 lines
org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java +4
-2@@ -197,8 +199,10 @@ synchronized (resources) { } // End ResCL void clearDecorationState(IResource r) throws CoreException { - r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); - fireLabelProviderChanged(new LabelProviderChangedEvent(this, r)); + if (r.exists()) { + r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null); + fireLabelProviderChanged(new LabelProviderChangedEvent(this, r)); + }Shawn, you removed the test from the code in
4a230ea1. Perhaps you could care to comment on this patch to restore the test, though slightly different.Quoted 2 lines
if (r.isAccessible()) r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);
Quoted 7 lines
This may be a patch queue reordering bug.
If you look at
4a230ea1I moved the isAccessible test higher up, such that we shouldn't enter into clearDecorationState unless the resource is accessible. But there may currently be two code paths that enter this method, and a patch I did not yet submit had removed the other code path.
Good. So then the question is whether we should use isAccessible() or exists()? Normally this makes no difference, but for a Project (at least) there is a difference. I project that exits is not accessible when closed.
-- robin
Quoted 10 lines · Robin Rosenberg
Quoted 6 lines
Quoted 6 lines
Shawn, you removed the test from the code in
4a230ea1. Perhaps you could care to comment on this patch to restore the test, though slightly different.if (r.isAccessible()) r.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);Good. So then the question is whether we should use
isAccessible()orexists()? Normally this makes no difference, but for a Project (at least) there is a difference. I project that exits is not accessible when closed.
It _has_ to be isAccessible(). You cannot get or set a session property on a closed project.
Signature · 1 line
Shawn.