Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 83298 Details for
Bug 207567
HTML2TextReader reader get stuck in infinite loop
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Unified patch
clipboard.txt (text/plain), 2.94 KB, created by
George Lindholm
on 2007-11-19 23:01:56 EST
(
hide
)
Description:
Unified patch
Filename:
MIME Type:
Creator:
George Lindholm
Created:
2007-11-19 23:01:56 EST
Size:
2.94 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.jira.ui >Index: src/org/eclipse/mylyn/internal/jira/ui/html/HTML2TextReader.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/html/HTML2TextReader.java,v >retrieving revision 1.5 >diff -u -r1.5 HTML2TextReader.java >--- src/org/eclipse/mylyn/internal/jira/ui/html/HTML2TextReader.java 3 Nov 2007 01:23:15 -0000 1.5 >+++ src/org/eclipse/mylyn/internal/jira/ui/html/HTML2TextReader.java 20 Nov 2007 03:59:58 -0000 >@@ -88,7 +88,7 @@ > > /** > * Transforms the HTML text from the reader to formatted text. >- * >+ * > * @param reader > * the reader > * @param presentation >@@ -140,7 +140,9 @@ > @Override > protected String computeSubstitution(int c) throws IOException { > >- if (c == '<') >+ if (c == -1) { >+ return null; >+ } else if (c == '<') > return processHTMLTag(); > else if (fIgnore) > return EMPTY_STRING; >#P org.eclipse.mylyn.jira.tests >Index: src/org/eclipse/mylyn/jira/tests/HTML2TextReaderTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.tests/src/org/eclipse/mylyn/jira/tests/HTML2TextReaderTest.java,v >retrieving revision 1.4 >diff -u -r1.4 HTML2TextReaderTest.java >--- src/org/eclipse/mylyn/jira/tests/HTML2TextReaderTest.java 26 Jun 2007 01:16:23 -0000 1.4 >+++ src/org/eclipse/mylyn/jira/tests/HTML2TextReaderTest.java 20 Nov 2007 03:59:59 -0000 >@@ -8,7 +8,15 @@ > package org.eclipse.mylyn.jira.tests; > > import java.io.IOException; >+import java.io.Reader; > import java.io.StringReader; >+import java.util.concurrent.Callable; >+import java.util.concurrent.ExecutionException; >+import java.util.concurrent.ExecutorService; >+import java.util.concurrent.Executors; >+import java.util.concurrent.FutureTask; >+import java.util.concurrent.TimeUnit; >+import java.util.concurrent.TimeoutException; > > import junit.framework.TestCase; > >@@ -49,4 +57,39 @@ > assertEquals(" ", new String(chars, 0, len)); > } > >+ public void testHeadCpuLoop() { >+ assertTrue(testCpuLoop("b <head> a ")); >+ } >+ >+ public void testPreCpuLoop() { >+ assertTrue(testCpuLoop("b <pre> b ")); >+ } >+ >+ private boolean testCpuLoop(final String text) { >+ ExecutorService executor = Executors.newFixedThreadPool(1); >+ FutureTask<Boolean> future = new FutureTask<Boolean>(new Callable<Boolean>() { >+ public Boolean call() { >+ Reader stringReader = new StringReader(text); >+ >+ HTML2TextReader html2TextReader = new HTML2TextReader(stringReader, null); >+ try { >+ char[] chars = new char[text.length()]; >+ int len = html2TextReader.read(chars, 0, chars.length); >+ return true; >+ } catch (Throwable e) { >+ return false; >+ } >+ } >+ }); >+ try { >+ executor.execute(future); >+ >+ return future.get(2, TimeUnit.SECONDS); >+ >+ } catch (Throwable e) { >+ future.cancel(true); >+ } >+ return false; >+ } >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 207567
:
83280
|
83290
|
83291
| 83298 |
83299