From e67194a73b30df1bfdad7565ed37650f8ddccfcc Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 14 Dec 2010 22:05:37 +0100 Subject: [PATCH 1/2] fix NPE --- .../SimplifiableAnnotationInspection.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java index 699fe826fc82..15726fdebcb6 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/style/SimplifiableAnnotationInspection.java @@ -101,17 +101,17 @@ public class SimplifiableAnnotationInspection extends BaseInspection { return; } final PsiNameValuePair[] attributes = parameterList.getAttributes(); - final PsiElement[] annotationChildren = annotation.getChildren(); if (annotationChildren.length >= 2) { final PsiElement child = annotationChildren[1]; if (child instanceof PsiWhiteSpace) { + final String annotationName = nameReferenceElement.getText(); final String replacementText; if (attributes.length > 0) { - replacementText = '@' + nameReferenceElement.getText() + + replacementText = '@' + annotationName + parameterList.getText(); } else { - replacementText = '@' + nameReferenceElement.getText(); + replacementText = '@' + annotationName; } registerError(annotation, replacementText); return; @@ -122,15 +122,23 @@ public class SimplifiableAnnotationInspection extends BaseInspection { if (children.length <= 0) { return; } - registerError(annotation, '@' + nameReferenceElement.getText()); + final String annotationName = nameReferenceElement.getText(); + registerError(annotation, '@' + annotationName); } else if (attributes.length == 1) { final PsiNameValuePair attribute = attributes[0]; @NonNls final String name = attribute.getName(); if (!"value".equals(name)) { return; } - registerError(annotation, '@' + nameReferenceElement.getText() + - '(' + attribute.getValue().getText() + ')'); + final PsiAnnotationMemberValue attributeValue = + attribute.getValue(); + if (attributeValue == null) { + return; + } + final String annotationName = nameReferenceElement.getText(); + final String replacementText = '@' + annotationName + + '(' + attributeValue.getText() + ')'; + registerError(annotation, replacementText); } } } From 15284c7b4574bbc0cd31f5cdce83a05cde3a54f4 Mon Sep 17 00:00:00 2001 From: irengrig Date: Wed, 15 Dec 2010 00:42:02 +0300 Subject: [PATCH 2/2] unversioned files gathering debug logging --- .../openapi/vcs/changes/ChangeListManagerImpl.java | 6 ++++++ .../openapi/vcs/changes/ChangesViewManager.java | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java index 620b77996263..9858ae25140c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java @@ -378,6 +378,9 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec myUpdateException = null; composite.cleanAll(); } + if (LOG.isDebugEnabled()) { + LOG.debug("refresh procedure started, everything = " + wasEverythingDirty); + } } if (wasEverythingDirty) { changeListWorker.notifyStartProcessingChanges(null); @@ -450,6 +453,9 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec } if (takeChanges) { + if (LOG.isDebugEnabled()) { + LOG.debug("refresh procedure finished, size: " + composite.getVFHolder(FileHolder.HolderType.UNVERSIONED).getSize()); + } final boolean statusChanged = ! myComposite.equals(composite); myComposite = composite; if (statusChanged) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java index bd2f5eeaf533..f462a5744e5e 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangesViewManager.java @@ -31,6 +31,7 @@ import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.components.ProjectComponent; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.SimpleToolWindowPanel; @@ -81,6 +82,7 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro @NonNls private static final String ATT_FLATTENED_VIEW = "flattened_view"; @NonNls private static final String ATT_SHOW_IGNORED = "show_ignored"; + private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.ChangesViewManager"); public static ChangesViewI getInstance(Project project) { return PeriodicalTasksCloser.getInstance().safeGetComponent(project, ChangesViewI.class); @@ -208,7 +210,10 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro @Override public void scheduleRefresh() { if (ApplicationManager.getApplication().isHeadlessEnvironment()) return; - myRepaintAlarm.cancelAllRequests(); + int was = myRepaintAlarm.cancelAllRequests(); + if (LOG.isDebugEnabled()) { + LOG.debug("schedule refresh, was " + was); + } myRepaintAlarm.addRequest(new Runnable() { public void run() { refreshView(); @@ -228,6 +233,10 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro new Trinity, Integer, Integer>(manyUnversioned ? Collections.emptyList() : changeListManager.getUnversionedFiles(), unv.getFirst(), unv.getSecond()); + if (LOG.isDebugEnabled()) { + LOG.debug("refresh view, unversioned collections size: " + unversionedPair.getFirst().size() + " unv size passed: " + + unversionedPair.getSecond() + " dirs: " + unversionedPair.getThird()); + } myView.updateModel(changeListManager.getChangeListsCopy(), unversionedPair, changeListManager.getDeletedFiles(), changeListManager.getModifiedWithoutEditing(),