diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java index 9be9f12406dd..b3a7fb1ce535 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java @@ -959,10 +959,10 @@ public class CompileDriver { final TranslatorsOutputSink sink = new TranslatorsOutputSink(context, translators); final Set generatedTypes = new HashSet(); Collection chunkFiles = chunkMap.get(currentChunk); + final Set filesToRecompile = new HashSet(); + final Set allDependent = new HashSet(); try { int round = 0; - final Set filesToRecompile = new HashSet(); - final Set allDependent = new HashSet(); Collection dependentFiles = Collections.emptyList(); final Function>, Pair>> dependencyFilter = new DependentClassesCumulativeFilter(); @@ -1092,19 +1092,18 @@ public class CompileDriver { indicator.popState(); } } - - if (context.getMessageCount(CompilerMessageCategory.ERROR) != 0) { - filesToRecompile.addAll(allDependent); - } - if (filesToRecompile.size() > 0) { - sink.add(null, Collections.emptyList(), VfsUtil.toVirtualFileArray(filesToRecompile)); - } } catch (CacheCorruptedException e) { LOG.info(e); context.requestRebuildNextTime(e.getMessage()); } finally { + if (context.getMessageCount(CompilerMessageCategory.ERROR) != 0) { + filesToRecompile.addAll(allDependent); + } + if (filesToRecompile.size() > 0) { + sink.add(null, Collections.emptyList(), VfsUtil.toVirtualFileArray(filesToRecompile)); + } if (context.getMessageCount(CompilerMessageCategory.ERROR) == 0) { // perform update only if there were no errors, so it is guaranteed that the file was processd by all neccesary compilers sink.flushPostponedItems(); diff --git a/platform/lang-api/src/com/intellij/execution/ui/ExecutionConsole.java b/platform/lang-api/src/com/intellij/execution/ui/ExecutionConsole.java index 4ea881f5d51c..9d554cb51776 100644 --- a/platform/lang-api/src/com/intellij/execution/ui/ExecutionConsole.java +++ b/platform/lang-api/src/com/intellij/execution/ui/ExecutionConsole.java @@ -16,13 +16,12 @@ package com.intellij.execution.ui; import com.intellij.openapi.ui.ComponentContainer; - -import javax.swing.*; +import org.jetbrains.annotations.NonNls; /** * @author Eugene Zhuravlev * Date: Apr 20, 2004 */ public interface ExecutionConsole extends ComponentContainer { - + @NonNls String CONSOLE_CONTENT_ID = "ConsoleContent"; } diff --git a/platform/lang-impl/src/com/intellij/execution/runners/RunContentBuilder.java b/platform/lang-impl/src/com/intellij/execution/runners/RunContentBuilder.java index 2e90764ca8aa..1e7cb1e4e884 100644 --- a/platform/lang-impl/src/com/intellij/execution/runners/RunContentBuilder.java +++ b/platform/lang-impl/src/com/intellij/execution/runners/RunContentBuilder.java @@ -157,7 +157,7 @@ public class RunContentBuilder implements LogConsoleManager, Disposable { } } - final Content consoleContent = ui.createContent("Console", console.getComponent(), "Console", + final Content consoleContent = ui.createContent(ExecutionConsole.CONSOLE_CONTENT_ID, console.getComponent(), "Console", IconLoader.getIcon("/debugger/console.png"), console.getPreferredFocusableComponent()); diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoSymbolModel2.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoSymbolModel2.java index 376febce1227..f7244901207d 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoSymbolModel2.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/GotoSymbolModel2.java @@ -70,11 +70,11 @@ public class GotoSymbolModel2 extends ContributorsBasedGotoByModel { @NotNull public String[] getSeparators() { - return new String[] {".", ":"}; + return new String[] {"."}; } @Override public String getHelpId() { return "procedures.navigating.goto.class"; } -} \ No newline at end of file +} diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapChangeListener.java b/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapChangeListener.java index 281334ff0b52..32c638e61410 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapChangeListener.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/ex/SoftWrapChangeListener.java @@ -18,6 +18,8 @@ package com.intellij.openapi.editor.ex; import com.intellij.openapi.editor.TextChange; import org.jetbrains.annotations.NotNull; +import java.util.Collection; + /** * Defines a contract for the callbacks for soft wraps management notifications (addition/removal). * @@ -32,4 +34,9 @@ public interface SoftWrapChangeListener { * @param softWrap newly registered soft wrap */ void softWrapAdded(@NotNull TextChange softWrap); + + /** + * This method is assumed to be called every time soft wrap(s) is removed. + */ + void softWrapsRemoved(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index 7d1ecdca7eae..122d1f28fcca 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -334,6 +334,12 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi int softWrapLine = myDocument.getLineNumber(softWrap.getStart()); mySizeContainer.update(softWrapLine, softWrapLine, softWrapLine); } + + @Override + public void softWrapsRemoved() { + mySoftWrapsChanged = true; + mySizeContainer.reset(); + } }); EditorHighlighter highlighter = new EmptyEditorHighlighter(myScheme.getAttributes(HighlighterColors.TEXT)); @@ -1055,7 +1061,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi } } - if (logLine == 0) { + if (logLine <= 0) { lineStartOffset = 0; } else if (lineStartOffset < 0) { @@ -1691,25 +1697,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi if (lIterator.getLineNumber() >= lastLineIndex && position.y <= clip.y + clip.height) { paintAfterFileEndBackground(iterationState, g, position, clip, lineHeight, defaultBackground); } - - // Perform additional activity if soft wrap is added or removed during repainting. - // Note: this code lives in this method in assumption that background repainting is the very first activity performed - // during whole editor component repaint. - if (mySoftWrapsChanged) { - mySoftWrapsChanged = false; - validateSize(); - - // Repaint editor to the bottom in order to ensure that its content is shown correctly after new soft wrap introduction. - repaintToScreenBottom(xyToLogicalPosition(position).line); - - // Repaint gutter at all space that is located after active clip in order to ensure that line numbers are correctly redrawn - // in accordance with the newly introduced soft wrap(s). - myGutterComponent.repaint(0, clip.y, myGutterComponent.getWidth(), myGutterComponent.getHeight() - clip.y); - - // Ask caret model to update visual caret position. - //TODO den implement - //getCaretModel().moveToOffset(getCaretModel().getOffset()); - } } private void paintRectangularSelection(Graphics g) { @@ -1908,6 +1895,22 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi } flushCachedChars(g); + + // Perform additional activity if soft wrap is added or removed during repainting. + if (mySoftWrapsChanged) { + mySoftWrapsChanged = false; + validateSize(); + + // Repaint editor to the bottom in order to ensure that its content is shown correctly after new soft wrap introduction. + repaintToScreenBottom(xyToLogicalPosition(position).line); + + // Repaint gutter at all space that is located after active clip in order to ensure that line numbers are correctly redrawn + // in accordance with the newly introduced soft wrap(s). + myGutterComponent.repaint(0, clip.y, myGutterComponent.getWidth(), myGutterComponent.getHeight() - clip.y); + + // Ask caret model to update visual caret position. + getCaretModel().moveToOffset(getCaretModel().getOffset()); + } } private boolean paintSelection() { diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/SoftWrapDataMapper.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/SoftWrapDataMapper.java index 8aa093783ce5..99cd59788f5f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/SoftWrapDataMapper.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/SoftWrapDataMapper.java @@ -192,6 +192,11 @@ public class SoftWrapDataMapper { // If we are here that means that there is no soft wrap on a logical line that corresponds to the target visual line. softWrapLinesBeforeCurrentLogicalLine += softWrapLinesOnCurrentLogicalLine; int logicalLine = defaultLogical.line - softWrapLinesBeforeCurrentLogicalLine; + // There is a possible case that we can't count on given default logical position - e.g. if given visual position line + // is more than total document lines count. + if (logicalLine < 0) { + logicalLine = Math.min(lastSoftWrapLogicalLine + 1, document.getLineCount() - 1); + } int foldedLines = getFoldedLinesBefore(document.getLineStartOffset(logicalLine)); int foldingColumnDiff = visual.column - defaultLogical.column; return new LogicalPosition( diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/SoftWrapsStorage.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/SoftWrapsStorage.java index 627a5ed6ae4e..14a7def3ebe3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/SoftWrapsStorage.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/softwrap/SoftWrapsStorage.java @@ -19,10 +19,7 @@ import com.intellij.openapi.editor.ex.SoftWrapChangeListener; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.concurrent.CopyOnWriteArraySet; /** @@ -125,7 +122,9 @@ public class SoftWrapsStorage { if (index < 0 || index >= myWraps.size()) { return null; } - return myWraps.remove(index); + TextChangeImpl removed = myWraps.remove(index); + notifyListenersAboutRemoval(); + return removed; } /** @@ -133,6 +132,7 @@ public class SoftWrapsStorage { */ public void removeAll() { myWraps.clear(); + notifyListenersAboutRemoval(); } /** @@ -144,4 +144,10 @@ public class SoftWrapsStorage { public boolean addSoftWrapChangeListener(@NotNull SoftWrapChangeListener listener) { return myListeners.add(listener); } + + private void notifyListenersAboutRemoval() { + for (SoftWrapChangeListener listener : myListeners) { + listener.softWrapsRemoved(); + } + } } diff --git a/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java index bcc8d62e5524..05e1ac36c5f9 100644 --- a/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java +++ b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java @@ -198,7 +198,7 @@ public class NameUtil { firstIdentifierLetter = true; } else { - if (prevIsUppercase) { + if (c == ':' || prevIsUppercase) { buffer.append("[A-Za-z\\s0-9\\$]*"); } diff --git a/platform/util/src/com/intellij/util/MergeQuery.java b/platform/util/src/com/intellij/util/MergeQuery.java index ffeeed377d57..1f221aa3e10d 100644 --- a/platform/util/src/com/intellij/util/MergeQuery.java +++ b/platform/util/src/com/intellij/util/MergeQuery.java @@ -38,15 +38,14 @@ public class MergeQuery implements Query{ @NotNull public Collection findAll() { List results = new ArrayList(); - results.addAll(myQuery1.findAll()); - results.addAll(myQuery2.findAll()); + forEach(new CommonProcessors.CollectProcessor(results)); return results; } public T findFirst() { - final T r1 = myQuery1.findFirst(); - if (r1 != null) return r1; - return myQuery2.findFirst(); + final CommonProcessors.FindFirstProcessor processor = new CommonProcessors.FindFirstProcessor(); + forEach(processor); + return processor.getFoundValue(); } public boolean forEach(@NotNull final Processor consumer) { diff --git a/platform/util/src/com/intellij/util/containers/CollectionFactory.java b/platform/util/src/com/intellij/util/containers/CollectionFactory.java index 7f5871ec8702..ff443bee65b5 100644 --- a/platform/util/src/com/intellij/util/containers/CollectionFactory.java +++ b/platform/util/src/com/intellij/util/containers/CollectionFactory.java @@ -60,6 +60,10 @@ public class CollectionFactory { return new HashSet(); } + public static HashMap hashMap() { + return new HashMap(); + } + public static LinkedHashMap linkedMap() { return new LinkedHashMap(); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeModelBuilder.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeModelBuilder.java index f6d6ab11eaa1..862e2875c432 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeModelBuilder.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/TreeModelBuilder.java @@ -221,7 +221,7 @@ public class TreeModelBuilder { final FilePath fp1 = ChangesUtil.getFilePath(o1); final FilePath fp2 = ChangesUtil.getFilePath(o2); - final int diff = fp1.getPath().length() - fp2.getPath().length(); + final int diff = fp1.getIOFile().getPath().length() - fp2.getIOFile().getPath().length(); return diff == 0 ? 0 : (diff < 0 ? -1 : 1); } } diff --git a/platform/xdebugger-api/src/com/intellij/debugger/ui/DebuggerContentInfo.java b/platform/xdebugger-api/src/com/intellij/debugger/ui/DebuggerContentInfo.java index 7d47bca9d67b..c43caa8dd139 100644 --- a/platform/xdebugger-api/src/com/intellij/debugger/ui/DebuggerContentInfo.java +++ b/platform/xdebugger-api/src/com/intellij/debugger/ui/DebuggerContentInfo.java @@ -15,11 +15,12 @@ */ package com.intellij.debugger.ui; +import com.intellij.execution.ui.ExecutionConsole; import org.jetbrains.annotations.NonNls; public interface DebuggerContentInfo { - @NonNls String CONSOLE_CONTENT = "ConsoleContent"; + @NonNls String CONSOLE_CONTENT = ExecutionConsole.CONSOLE_CONTENT_ID; @NonNls String THREADS_CONTENT = "ThreadsContent"; @NonNls String VARIABLES_CONTENT = "VariablesContent"; @NonNls String FRAME_CONTENT = "FrameContent"; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java index 5d2c0ae24082..4dc1cd824f24 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnUtil.java @@ -616,11 +616,17 @@ public class SvnUtil { } public static boolean doesRepositorySupportMergeinfo(final SvnVcs vcs, final SVNURL url) { + SVNRepository repository = null; try { - return vcs.createRepository(url).hasCapability(SVNCapability.MERGE_INFO); + repository = vcs.createRepository(url); + return repository.hasCapability(SVNCapability.MERGE_INFO); } catch (SVNException e) { return false; + } finally { + if (repository != null) { + repository.closeSession(); + } } } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CompareWithBranchAction.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CompareWithBranchAction.java index f95e4eb46ef5..8a54444ffc19 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CompareWithBranchAction.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/actions/CompareWithBranchAction.java @@ -133,6 +133,8 @@ public class CompareWithBranchAction extends AnAction implements DumbAware { SVNWCAccess wcAccess = vcs.createWCAccess(); + SVNRepository repository = null; + SVNRepository repository2 = null; try { SVNAdminAreaInfo info = wcAccess.openAnchor(new File(myVirtualFile.getPath()), false, SVNWCAccess.INFINITE_DEPTH); File anchorPath = info.getAnchor().getRoot(); @@ -150,18 +152,25 @@ public class CompareWithBranchAction extends AnAction implements DumbAware { } SVNURL anchorURL = anchorEntry.getSVNURL(); - SVNRepository repository = vcs.createRepository(anchorURL.toString()); + repository = vcs.createRepository(anchorURL.toString()); SVNReporter reporter = new SVNReporter(info, info.getAnchor().getFile(info.getTargetName()), false, true, SVNDepth.INFINITY, false, false, true, SVNDebugLog.getDefaultLog()); long rev = repository.getLatestRevision(); + repository2 = vcs.createRepository((target == null) ? url.toString() : url.removePathTail().toString()); SvnDiffEditor diffEditor = new SvnDiffEditor((target == null) ? myVirtualFile : myVirtualFile.getParent(), - vcs.createRepository((target == null) ? url.toString() : url.removePathTail().toString()), rev, true); + repository2, rev, true); repository.diff(url, rev, rev, target, true, true, false, reporter, SVNCancellableEditor.newInstance(diffEditor, new SvnProgressCanceller(), null)); changes.addAll(diffEditor.getChangesMap().values()); } finally { wcAccess.close(); + if (repository != null) { + repository.closeSession(); + } + if (repository2 != null) { + repository2.closeSession(); + } } } catch(SVNCancelException ex) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesDialog.java index 04f5fd461595..c41d23cd59c5 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/config/SvnConfigureProxiesDialog.java @@ -27,6 +27,7 @@ import org.jetbrains.idea.svn.SvnConfiguration; import org.jetbrains.idea.svn.SvnServerFileManager; import org.jetbrains.idea.svn.SvnVcs; import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.io.SVNRepository; import javax.swing.*; import java.awt.*; @@ -137,10 +138,16 @@ public class SvnConfigureProxiesDialog extends DialogWrapper implements Validati if (pi != null) { pi.setText("Connecting to " + url); } + SVNRepository repository = null; try { - SvnVcs.getInstance(myProject).createRepository(url).testConnection(); + repository = SvnVcs.getInstance(myProject).createRepository(url); + repository.testConnection(); } catch (SVNException exc) { excRef.set(exc); + } finally { + if (repository != null) { + repository.closeSession(); + } } } }, "Test connection", true, myProject); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchMerger.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchMerger.java index e842e3ea602a..bd6f96a3b02b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchMerger.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/BranchMerger.java @@ -23,6 +23,7 @@ import org.jetbrains.idea.svn.update.UpdateEventHandler; import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNURL; +import org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.wc.SVNDiffClient; import org.tmatesoft.svn.core.wc.SVNDiffOptions; import org.tmatesoft.svn.core.wc.SVNRevision; @@ -55,11 +56,17 @@ public class BranchMerger implements IMerger { myBranchName = branchName; mySourceCopyRevision = sourceCopyRevision; myAtStart = true; + SVNRepository repository = null; try { - mySourceLatestRevision = myVcs.createRepository(mySourceUrl).getLatestRevision(); + repository = myVcs.createRepository(mySourceUrl); + mySourceLatestRevision = repository.getLatestRevision(); } catch (SVNException e) { mySourceLatestRevision = SVNRevision.HEAD.getNumber(); + } finally { + if (repository != null) { + repository.closeSession(); + } } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java index 643064ad4fa8..0e7d36a4b242 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/RepositoryBrowserDialog.java @@ -1099,10 +1099,13 @@ public class RepositoryBrowserDialog extends DialogWrapper { SVNRepository sourceRepository = myVCS.createRepository(sourceURL.toString()); sourceRepository.setCanceller(new SvnProgressCanceller()); SvnDiffEditor diffEditor; - final long rev = sourceRepository.getLatestRevision(); + final long rev; + SVNRepository targetRepository = null; try { + rev = sourceRepository.getLatestRevision(); // generate Map of path->Change - diffEditor = new SvnDiffEditor(sourceRepository, myVCS.createRepository(targetURL.toString()), -1, false); + targetRepository = myVCS.createRepository(targetURL.toString()); + diffEditor = new SvnDiffEditor(sourceRepository, targetRepository, -1, false); final ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(diffEditor, new SvnProgressCanceller(), null); sourceRepository.diff(targetURL, rev, rev, null, true, true, false, new ISVNReporterBaton() { public void report(ISVNReporter reporter) throws SVNException { @@ -1113,6 +1116,9 @@ public class RepositoryBrowserDialog extends DialogWrapper { } finally { sourceRepository.closeSession(); + if (targetRepository != null) { + targetRepository.closeSession(); + } } final String sourceTitle = SVNPathUtil.tail(sourceURL.toString()); final String targetTitle = SVNPathUtil.tail(targetURL.toString()); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java index 076135792f03..01186c0b1f3e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SelectLocationDialog.java @@ -120,12 +120,16 @@ public class SelectLocationDialog extends DialogWrapper { ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() { public void run() { + SVNRepository repos = null; try { - SVNRepository repos = SvnVcs.getInstance(project).createRepository(urlString); + repos = SvnVcs.getInstance(project).createRepository(urlString); result.set(repos.getRepositoryRoot(true)); - repos.closeSession(); } catch (SVNException e) { excRef.set(e); + } finally { + if (repos != null) { + repos.closeSession(); + } } } }, "Detecting repository root", true, project); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java index 9ff2b64db560..45e7114caedb 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnCommittedChangesProvider.java @@ -184,13 +184,17 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi } final String repositoryRoot; + SVNRepository repository = null; try { - final SVNRepository repository = myVcs.createRepository(svnLocation.getURL()); + repository = myVcs.createRepository(svnLocation.getURL()); repositoryRoot = repository.getRepositoryRoot(true).toString(); - repository.closeSession(); } catch (SVNException e) { throw new VcsException(e); + } finally { + if (repository != null) { + repository.closeSession(); + } } final ChangeBrowserSettings.Filter filter = settings.createFilter(); @@ -219,13 +223,18 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi } final String repositoryRoot; + SVNRepository repository = null; try { - final SVNRepository repository = myVcs.createRepository(svnLocation.getURL()); + repository = myVcs.createRepository(svnLocation.getURL()); repositoryRoot = repository.getRepositoryRoot(true).toString(); repository.closeSession(); } catch (SVNException e) { throw new VcsException(e); + } finally { + if (repository != null) { + repository.closeSession(); + } } getCommittedChangesImpl(settings, svnLocation.getURL(), new String[]{""}, maxCount, new Consumer() { @@ -249,13 +258,17 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi } final String repositoryRoot; + SVNRepository repository = null; try { - final SVNRepository repository = myVcs.createRepository(svnLocation.getURL()); + repository = myVcs.createRepository(svnLocation.getURL()); repositoryRoot = repository.getRepositoryRoot(true).toString(); - repository.closeSession(); } catch (SVNException e) { throw new VcsException(e); + } finally { + if (repository != null) { + repository.closeSession(); + } } final MergeTrackerProxy proxy = new MergeTrackerProxy(new Consumer>() { @@ -356,7 +369,17 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi revisionBefore = SVNRevision.create(changeTo.longValue()); } else { - revisionBefore = SVNRevision.create(myVcs.createRepository(url).getLatestRevision()); + SVNRepository repository = null; + final long revision; + try { + repository = myVcs.createRepository(url); + revision = repository.getLatestRevision(); + } finally { + if (repository != null) { + repository.closeSession(); + } + } + revisionBefore = SVNRevision.create(revision); } final SVNRevision revisionAfter; if (dateFrom != null) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateEnvironment.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateEnvironment.java index af66563a46c5..11d5c124c53b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateEnvironment.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/update/SvnIntegrateEnvironment.java @@ -20,10 +20,10 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.update.UpdatedFiles; +import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.SvnBundle; import org.jetbrains.idea.svn.SvnConfiguration; import org.jetbrains.idea.svn.SvnVcs; -import org.jetbrains.annotations.Nullable; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.io.SVNRepository; @@ -131,14 +131,18 @@ public class SvnIntegrateEnvironment extends AbstractSvnUpdateIntegrateEnvironme } else { + SVNRepository repos = null; try { - SVNRepository repos = myVcs.createRepository(svnURL2.toString()); + repos = myVcs.createRepository(svnURL2.toString()); final long latestRev = repos.getLatestRevision(); - repos.closeSession(); return String.valueOf(latestRev); } catch (SVNException e) { return null; + } finally { + if (repos != null) { + repos.closeSession(); + } } } }