diff options
author | Alex Blewitt | 2010-06-04 18:49:05 +0000 |
---|---|---|
committer | Alex Blewitt | 2010-06-05 09:11:02 +0000 |
commit | b0338c95ebd22bb87f3a592858cb96e50ff6d7b1 (patch) | |
tree | 081e441891701fe54ae1677d3f805b1e03b16d26 | |
parent | 2854822da4c717e8df745486b440000639f80d49 (diff) | |
download | egit-b0338c95ebd22bb87f3a592858cb96e50ff6d7b1.tar.gz egit-b0338c95ebd22bb87f3a592858cb96e50ff6d7b1.tar.xz egit-b0338c95ebd22bb87f3a592858cb96e50ff6d7b1.zip |
Remember to dispose the clipboard after use
Once the clipboard is acquired, we should dispose of it afterwards to
prevent memory and resource leaks.
Not all the text on the clipboard will be text; if it isn't, then we'll
get a null back. Handle that case specifically.
If the text begins (or ends) with whitespace, trim it before checking.
Bug: 315589
Change-Id: I1b8eeae47b880b6eef689ca359f9c67e93e7e999
Signed-off-by: Alex Blewitt <Alex.Blewitt@gmail.com>
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java index f5d89526ec..0294c7b0b1 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/RepositorySelectionPage.java @@ -171,12 +171,15 @@ public class RepositorySelectionPage extends BaseWizardPage { Clipboard clippy = new Clipboard(Display.getCurrent()); String text = (String) clippy.getContents(TextTransfer.getInstance()); try { - if(Transport.canHandleProtocol(new URIish(text))) { - preset = text; + if(text != null) { + text = text.trim(); + if(Transport.canHandleProtocol(new URIish(text))) + preset = text; } } catch (URISyntaxException e) { preset = null; } + clippy.dispose(); } this.presetUri = preset; |