From 658330cb12f8712a0078ae6545b3e08ed860ecf2 Mon Sep 17 00:00:00 2001 From: Derek DeMoro Date: Thu, 20 Jul 2006 22:36:29 +0000 Subject: [PATCH] SPARK-285 link-2-text filter matches too much URL's or text which looks like an URL git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@4628 b35dd754-fafc-0310-a699-88a17e54d16e --- src/java/org/jivesoftware/spark/ui/ChatArea.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/java/org/jivesoftware/spark/ui/ChatArea.java b/src/java/org/jivesoftware/spark/ui/ChatArea.java index ae688677a..e8884d3d2 100644 --- a/src/java/org/jivesoftware/spark/ui/ChatArea.java +++ b/src/java/org/jivesoftware/spark/ui/ChatArea.java @@ -178,7 +178,7 @@ public class ChatArea extends JTextPane implements MouseListener, MouseMotionLis setCursor(HAND_CURSOR); // Make sure the message is not null. - message = message.trim(); + // message = message.trim(); message = message.replaceAll("/\"", ""); if (ModelUtil.hasLength(message)) { try { @@ -225,11 +225,11 @@ public class ChatArea extends JTextPane implements MouseListener, MouseMotionLis boolean underlined = false; - StringTokenizer t = new StringTokenizer(text, " \n", true); - while (t.hasMoreTokens()) { - String textFound = t.nextToken(); + final StringTokenizer tokenizer = new StringTokenizer(text, " \n \tokenizer", true); + while (tokenizer.hasMoreTokens()) { + String textFound = tokenizer.nextToken(); if (textFound.startsWith("http://") || textFound.startsWith("ftp://") - || textFound.startsWith("https://") || textFound.startsWith("www") || textFound.startsWith("\\") || textFound.indexOf("://") != -1) { + || textFound.startsWith("https://") || textFound.startsWith("www.") || textFound.startsWith("\\") || textFound.indexOf("://") != -1) { insertLink(textFound); } else if (!insertImage(textFound)) {