8261450: JShell crashes with SIOOBE in tab completion
Reviewed-by: vromero
This commit is contained in:
parent
b817855340
commit
94f26e4df8
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -593,6 +593,7 @@ public class JavadocFormatter {
|
|||||||
private void reflowTillNow() {
|
private void reflowTillNow() {
|
||||||
while (result.length() > 0 && result.charAt(result.length() - 1) == ' ')
|
while (result.length() > 0 && result.charAt(result.length() - 1) == ' ')
|
||||||
result.delete(result.length() - 1, result.length());
|
result.delete(result.length() - 1, result.length());
|
||||||
|
reflownTo = Math.min(reflownTo, result.length());
|
||||||
reflow(result, reflownTo, indent, limit);
|
reflow(result, reflownTo, indent, limit);
|
||||||
reflownTo = result.length();
|
reflownTo = result.length();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8131019 8169561
|
* @bug 8131019 8169561 8261450
|
||||||
* @summary Test JavadocFormatter
|
* @summary Test JavadocFormatter
|
||||||
* @library /tools/lib
|
* @library /tools/lib
|
||||||
* @modules jdk.compiler/jdk.internal.shellsupport.doc
|
* @modules jdk.compiler/jdk.internal.shellsupport.doc
|
||||||
@ -401,4 +401,16 @@ public class JavadocFormatterTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSpaceAtEndOfLine() {
|
||||||
|
String header = "Class<?> Class<T>.forName(Module module, String name)";
|
||||||
|
String javadoc = """
|
||||||
|
@throws SecurityException
|
||||||
|
<ul>
|
||||||
|
<li> test </li>
|
||||||
|
</ul>
|
||||||
|
""";
|
||||||
|
|
||||||
|
new JavadocFormatter(60, true).formatJavadoc(header, javadoc);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user