< prev index next >

test/serviceability/tmtools/jstack/JstackThreadTest.java

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.util.Arrays;
  25 import jdk.test.lib.JDKToolLauncher;
  26 import jdk.test.lib.OutputAnalyzer;
  27 import jdk.test.lib.ProcessTools;
  28 import utils.Utils;
  29 import java.util.concurrent.CountDownLatch;
  30 
  31 /*
  32  * @test JstackThreadTest
  33  * @bug 8151442
  34  * @summary jstack doesn't close quotation marks properly with threads' name greater than 1996 characters
  35  * @modules java.base/jdk.internal.misc
  36  * @library /testlibrary
  37  * @build jdk.test.lib.*
  38  * @run main JstackThreadTest
  39  */
  40 public class JstackThreadTest {
  41   static class NamedThread extends Thread {
  42    CountDownLatch latch;
  43    NamedThread(String name, CountDownLatch latch) {
  44       this.latch = latch;
  45       setName(name);
  46 
  47     }
  48     @Override
  49     public void run() {
  50      latch.countDown();
  51      Utils.sleep();
  52     }
  53    }
  54 
  55   public static void main(String[] args) throws Exception {
  56     StringBuilder sb = new StringBuilder();
  57      /*create a string more than 1996 character */




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.util.Arrays;
  25 import jdk.test.lib.JDKToolLauncher;
  26 import jdk.test.lib.process.OutputAnalyzer;
  27 import jdk.test.lib.process.ProcessTools;
  28 import utils.Utils;
  29 import java.util.concurrent.CountDownLatch;
  30 
  31 /*
  32  * @test JstackThreadTest
  33  * @bug 8151442
  34  * @summary jstack doesn't close quotation marks properly with threads' name greater than 1996 characters
  35  * @modules java.base/jdk.internal.misc
  36  * @library /test/lib

  37  * @run main JstackThreadTest
  38  */
  39 public class JstackThreadTest {
  40   static class NamedThread extends Thread {
  41    CountDownLatch latch;
  42    NamedThread(String name, CountDownLatch latch) {
  43       this.latch = latch;
  44       setName(name);
  45 
  46     }
  47     @Override
  48     public void run() {
  49      latch.countDown();
  50      Utils.sleep();
  51     }
  52    }
  53 
  54   public static void main(String[] args) throws Exception {
  55     StringBuilder sb = new StringBuilder();
  56      /*create a string more than 1996 character */


< prev index next >