1 /**
2 * @test
3 * @bug 7070134
4 * @summary Hotspot crashes with sigsegv from PorterStemmer
5 *
6 * @run shell Test7070134.sh
7 */
8
9 /*
10
11 Porter stemmer in Java. The original paper is in
12
13 Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14,
14 no. 3, pp 130-137,
15
16 http://www.tartarus.org/~martin/PorterStemmer
17
18 The software is completely free for any purpose, unless notes at the head
19 of the program text indicates otherwise (which is rare). In any case,
20 the notes about licensing are never more restrictive than the BSD License.
21
22 In every case where the software is not written by me (Martin Porter),
23 this licensing arrangement has been endorsed by the contributor, and it is
24 therefore unnecessary to ask the contributor again to confirm it.
25
26 I have not asked any contributors (or their employers, if they have them)
44
45 Release 3
46
47 Considerably revised 4/9/00 in the light of many helpful suggestions
48 from Brian Goetz of Quiotix Corporation (brian@quiotix.com).
49
50 Release 4
51
52 */
53
54 import java.io.*;
55
56 /**
57 * Stemmer, implementing the Porter Stemming Algorithm
58 *
59 * The Stemmer class transforms a word into its root form. The input
60 * word can be provided a character at time (by calling add()), or at once
61 * by calling one of the various stem(something) methods.
62 */
63
64 class Stemmer
65 { private char[] b;
66 private int i, /* offset into b */
67 i_end, /* offset to end of stemmed word */
68 j, k;
69 private static final int INC = 50;
70 /* unit of size whereby b is increased */
71 public Stemmer()
72 { b = new char[INC];
73 i = 0;
74 i_end = 0;
75 }
76
77 /**
78 * Add a character to the word being stemmed. When you are finished
79 * adding characters, you can call stem(void) to stem the word.
80 */
81
82 public void add(char ch)
83 { if (i == b.length)
84 { char[] new_b = new char[i+INC];
|
1 /**
2 * @test
3 * @bug 7070134
4 * @summary Hotspot crashes with sigsegv from PorterStemmer
5 * @modules java.base/jdk.internal.misc
6 * @library /testlibrary
7 * @run driver jdk.test.lib.FileInstaller words words
8 * @run main/othervm -Xbatch Stemmer words
9 */
10
11 /*
12
13 Porter stemmer in Java. The original paper is in
14
15 Porter, 1980, An algorithm for suffix stripping, Program, Vol. 14,
16 no. 3, pp 130-137,
17
18 http://www.tartarus.org/~martin/PorterStemmer
19
20 The software is completely free for any purpose, unless notes at the head
21 of the program text indicates otherwise (which is rare). In any case,
22 the notes about licensing are never more restrictive than the BSD License.
23
24 In every case where the software is not written by me (Martin Porter),
25 this licensing arrangement has been endorsed by the contributor, and it is
26 therefore unnecessary to ask the contributor again to confirm it.
27
28 I have not asked any contributors (or their employers, if they have them)
46
47 Release 3
48
49 Considerably revised 4/9/00 in the light of many helpful suggestions
50 from Brian Goetz of Quiotix Corporation (brian@quiotix.com).
51
52 Release 4
53
54 */
55
56 import java.io.*;
57
58 /**
59 * Stemmer, implementing the Porter Stemming Algorithm
60 *
61 * The Stemmer class transforms a word into its root form. The input
62 * word can be provided a character at time (by calling add()), or at once
63 * by calling one of the various stem(something) methods.
64 */
65
66 public class Stemmer
67 { private char[] b;
68 private int i, /* offset into b */
69 i_end, /* offset to end of stemmed word */
70 j, k;
71 private static final int INC = 50;
72 /* unit of size whereby b is increased */
73 public Stemmer()
74 { b = new char[INC];
75 i = 0;
76 i_end = 0;
77 }
78
79 /**
80 * Add a character to the word being stemmed. When you are finished
81 * adding characters, you can call stem(void) to stem the word.
82 */
83
84 public void add(char ch)
85 { if (i == b.length)
86 { char[] new_b = new char[i+INC];
|