{"thread":{"id":"15215","subject":"[egit PATCH] avoiding output in the error log","startedAt":"2008-08-27T09:34:33Z","lastAt":"2008-08-27T22:00:22Z","messageCount":5,"participants":["robert_no.spam_m@yahoo.fr","Robin Rosenberg","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"88713","messageId":"218798.11648.bm@omp221.mail.ukl.yahoo.com","threadId":"15215","inReplyTo":null,"subject":"[egit PATCH] avoiding output in the error log","fromName":"","fromEmail":"robert_no.spam_m@yahoo.fr","sentAt":"2008-08-27T09:34:33Z","receivedAt":"2008-08-27T09:34:33Z","isPatch":true,"sender":{"key":"robert_no.spam_m@yahoo.fr","avatar":null},"body":"Hi,this is a patch for egit. The purpose of the patch\nis to avoid a lot of output in the error log.\n\n>From 6f7be5d1a41d356a9b558ac81722e959095ff04d Mon Sep 17 00:00:00 2001\nFrom: robert <robert_no.spam_m@yahoo.fr>\nDate: Mon, 25 Aug 2008 20:42:39 +0200\nSubject: [PATCH] Checks added to avoid a lot of entries in the log\n\n* IResource.exists() must be checked before calling setProperty on it.\n* getActiveDecorator() was returning null in some case.\n---\n .../internal/decorators/GitResourceDecorator.java  |   10 +++++++---\n 1 files changed, 7 insertions(+), 3 deletions(-)\n\ndiff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\nindex 5857eaf..7c10ec6 100644\n--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\n+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\n@@ -143,7 +143,9 @@ if (resources.size() > 0)\n \t\t\t\t\ttry {\n \t\t\t\t\t\tm.accept(new IResourceVisitor() {\n \t\t\t\t\t\t\tpublic boolean visit(IResource resource) throws CoreException {\n-\t\t\t\t\t\t\t\tgetActiveDecorator().clearDecorationState(resource);\n+\t\t\t\t\t\t\t\tGitResourceDecorator decorator = getActiveDecorator();\n+\t\t\t\t\t\t\t\tif (decorator != null)\n+\t\t\t\t\t\t\t\t\tdecorator.clearDecorationState(resource);\n \t\t\t\t\t\t\t\treturn true;\n \t\t\t\t\t\t\t}\n \t\t\t\t\t\t},\n@@ -197,8 +199,10 @@ synchronized (resources) {\n \t} // End ResCL\n \n \tvoid clearDecorationState(IResource r) throws CoreException {\n-\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n-\t\tfireLabelProviderChanged(new LabelProviderChangedEvent(this, r));\n+\t\tif (r.exists()) {\n+\t\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n+\t\t\tfireLabelProviderChanged(new LabelProviderChangedEvent(this, r));\n+\t\t}\n \t}\n \n \tstatic ResCL myrescl = new ResCL();\n-- \n1.6.0\n"},{"id":"88775","messageId":"200808272228.07060.robin.rosenberg.lists@dewire.com","threadId":"15215","inReplyTo":"218798.11648.bm@omp221.mail.ukl.yahoo.com","subject":"Re: [egit PATCH] avoiding output in the error log","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-08-27T20:28:06Z","receivedAt":"2008-08-27T20:28:06Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"onsdagen den 27 augusti 2008 11.34.33 skrev robert_no.spam_m@yahoo.fr:\n> Hi,this is a patch for egit. The purpose of the patch\n> is to avoid a lot of output in the error log.\n\nWelcome Robert!\n\n> \n> From 6f7be5d1a41d356a9b558ac81722e959095ff04d Mon Sep 17 00:00:00 2001\n> From: robert <robert_no.spam_m@yahoo.fr>\n> Date: Mon, 25 Aug 2008 20:42:39 +0200\n> Subject: [PATCH] Checks added to avoid a lot of entries in the log\n> \n> * IResource.exists() must be checked before calling setProperty on it.\n> * getActiveDecorator() was returning null in some case.\n> ---\n>  .../internal/decorators/GitResourceDecorator.java  |   10 +++++++---\n>  1 files changed, 7 insertions(+), 3 deletions(-)\n> \n> diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\n> index 5857eaf..7c10ec6 100644\n> --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\n> +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java\n> @@ -143,7 +143,9 @@ if (resources.size() > 0)\n>  \t\t\t\t\ttry {\n>  \t\t\t\t\t\tm.accept(new IResourceVisitor() {\n>  \t\t\t\t\t\t\tpublic boolean visit(IResource resource) throws CoreException {\n> -\t\t\t\t\t\t\t\tgetActiveDecorator().clearDecorationState(resource);\n> +\t\t\t\t\t\t\t\tGitResourceDecorator decorator = getActiveDecorator();\n> +\t\t\t\t\t\t\t\tif (decorator != null)\n> +\t\t\t\t\t\t\t\t\tdecorator.clearDecorationState(resource);\n\nWhen doest his happen?\n\n>  \t\t\t\t\t\t\t\treturn true;\n>  \t\t\t\t\t\t\t}\n>  \t\t\t\t\t\t},\n> @@ -197,8 +199,10 @@ synchronized (resources) {\n>  \t} // End ResCL\n>  \n>  \tvoid clearDecorationState(IResource r) throws CoreException {\n> -\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n> -\t\tfireLabelProviderChanged(new LabelProviderChangedEvent(this, r));\n> +\t\tif (r.exists()) {\n> +\t\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n> +\t\t\tfireLabelProviderChanged(new LabelProviderChangedEvent(this, r));\n> +\t\t}\n\nShawn, you removed the test from the code in 4a230ea1. Perhaps you could care to\ncomment on this patch to restore the test, though slightly different.\n\n\t\tif (r.isAccessible())\n\t\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n\n-- robin\n"},{"id":"88777","messageId":"20080827203343.GN26523@spearce.org","threadId":"15215","inReplyTo":"200808272228.07060.robin.rosenberg.lists@dewire.com","subject":"Re: [egit PATCH] avoiding output in the error log","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-08-27T20:33:43Z","receivedAt":"2008-08-27T20:33:43Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:\n> > @@ -197,8 +199,10 @@ synchronized (resources) {\n> >  \t} // End ResCL\n> >  \n> >  \tvoid clearDecorationState(IResource r) throws CoreException {\n> > -\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n> > -\t\tfireLabelProviderChanged(new LabelProviderChangedEvent(this, r));\n> > +\t\tif (r.exists()) {\n> > +\t\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n> > +\t\t\tfireLabelProviderChanged(new LabelProviderChangedEvent(this, r));\n> > +\t\t}\n> \n> Shawn, you removed the test from the code in 4a230ea1. Perhaps you could care to\n> comment on this patch to restore the test, though slightly different.\n> \n> \t\tif (r.isAccessible())\n> \t\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n\nThis may be a patch queue reordering bug.\n\nIf you look at 4a230ea1 I moved the isAccessible test higher up,\nsuch that we shouldn't enter into clearDecorationState unless the\nresource is accessible.  But there may currently be two code paths\nthat enter this method, and a patch I did not yet submit had removed\nthe other code path.\n\nSo in the short/medium term I agree with your patch, basically undo\nthe second hunk of 4a230ea1.  But keep the middle hunk, it was a\nreal bug I ran into.\n\n-- \nShawn.\n"},{"id":"88794","messageId":"200808272350.56819.robin.rosenberg.lists@dewire.com","threadId":"15215","inReplyTo":"20080827203343.GN26523@spearce.org","subject":"Re: [egit PATCH] avoiding output in the error log","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-08-27T21:50:56Z","receivedAt":"2008-08-27T21:50:56Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"onsdagen den 27 augusti 2008 22.33.43 skrev Shawn O. Pearce:\n> Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:\n> > > @@ -197,8 +199,10 @@ synchronized (resources) {\n> > >  \t} // End ResCL\n> > >  \n> > >  \tvoid clearDecorationState(IResource r) throws CoreException {\n> > > -\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n> > > -\t\tfireLabelProviderChanged(new LabelProviderChangedEvent(this, r));\n> > > +\t\tif (r.exists()) {\n> > > +\t\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n> > > +\t\t\tfireLabelProviderChanged(new LabelProviderChangedEvent(this, r));\n> > > +\t\t}\n> > \n> > Shawn, you removed the test from the code in 4a230ea1. Perhaps you could care to\n> > comment on this patch to restore the test, though slightly different.\n> > \n> > \t\tif (r.isAccessible())\n> > \t\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n> \n> This may be a patch queue reordering bug.\n> \n> If you look at 4a230ea1 I moved the isAccessible test higher up,\n> such that we shouldn't enter into clearDecorationState unless the\n> resource is accessible.  But there may currently be two code paths\n> that enter this method, and a patch I did not yet submit had removed\n> the other code path.\n\nGood. So then the question is whether we should use isAccessible() or exists()? Normally\nthis makes no difference, but for a Project (at least) there is a difference. I project that exits\nis not accessible when closed. \n\n-- robin\n"},{"id":"88795","messageId":"20080827220022.GP26523@spearce.org","threadId":"15215","inReplyTo":"200808272350.56819.robin.rosenberg.lists@dewire.com","subject":"Re: [egit PATCH] avoiding output in the error log","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-08-27T22:00:22Z","receivedAt":"2008-08-27T22:00:22Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:\n> > > \n> > > Shawn, you removed the test from the code in 4a230ea1. Perhaps you could care to\n> > > comment on this patch to restore the test, though slightly different.\n> > > \n> > > \t\tif (r.isAccessible())\n> > > \t\t\tr.setSessionProperty(GITFOLDERDIRTYSTATEPROPERTY, null);\n> \n> Good. So then the question is whether we should use isAccessible() or exists()? Normally\n> this makes no difference, but for a Project (at least) there is a difference. I project that exits\n> is not accessible when closed. \n\nIt _has_ to be isAccessible().  You cannot get or set a session\nproperty on a closed project.\n\n-- \nShawn.\n"}]}