8254192: ExtraSharedClassListFile contains extra white space at end of line
Reviewed-by: iklam, ccheung, mchung
This commit is contained in:
parent
f3ce45f2a1
commit
546620bb9e
@ -87,44 +87,47 @@ bool ClassListParser::parse_one_line() {
|
|||||||
if (*_line == '#') { // comment
|
if (*_line == '#') { // comment
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// The line is output TRACE_RESOLVE
|
|
||||||
|
{
|
||||||
|
int len = (int)strlen(_line);
|
||||||
|
int i;
|
||||||
|
// Replace \t\r\n\f with ' '
|
||||||
|
for (i=0; i<len; i++) {
|
||||||
|
if (_line[i] == '\t' || _line[i] == '\r' || _line[i] == '\n' || _line[i] == '\f') {
|
||||||
|
_line[i] = ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove trailing newline/space
|
||||||
|
while (len > 0) {
|
||||||
|
if (_line[len-1] == ' ') {
|
||||||
|
_line[len-1] = '\0';
|
||||||
|
len --;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_line_len = len;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the line is output TRACE_RESOLVE
|
||||||
if (strncmp(_line, LambdaFormInvokers::lambda_form_invoker_tag(),
|
if (strncmp(_line, LambdaFormInvokers::lambda_form_invoker_tag(),
|
||||||
strlen(LambdaFormInvokers::lambda_form_invoker_tag())) == 0) {
|
strlen(LambdaFormInvokers::lambda_form_invoker_tag())) == 0) {
|
||||||
LambdaFormInvokers::append(os::strdup((const char*)_line, mtInternal));
|
LambdaFormInvokers::append(os::strdup((const char*)_line, mtInternal));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// valid line
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_class_name = _line;
|
||||||
_id = _unspecified;
|
_id = _unspecified;
|
||||||
_super = _unspecified;
|
_super = _unspecified;
|
||||||
_interfaces->clear();
|
_interfaces->clear();
|
||||||
_source = NULL;
|
_source = NULL;
|
||||||
_interfaces_specified = false;
|
_interfaces_specified = false;
|
||||||
|
|
||||||
{
|
|
||||||
int len = (int)strlen(_line);
|
|
||||||
int i;
|
|
||||||
// Replace \t\r\n with ' '
|
|
||||||
for (i=0; i<len; i++) {
|
|
||||||
if (_line[i] == '\t' || _line[i] == '\r' || _line[i] == '\n') {
|
|
||||||
_line[i] = ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove trailing newline/space
|
|
||||||
while (len > 0) {
|
|
||||||
if (_line[len-1] == ' ') {
|
|
||||||
_line[len-1] = '\0';
|
|
||||||
len --;
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_line_len = len;
|
|
||||||
_class_name = _line;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((_token = strchr(_line, ' ')) == NULL) {
|
if ((_token = strchr(_line, ' ')) == NULL) {
|
||||||
// No optional arguments are specified.
|
// No optional arguments are specified.
|
||||||
return true;
|
return true;
|
||||||
|
@ -141,14 +141,12 @@ public class CDS {
|
|||||||
// Throw exception on invalid input
|
// Throw exception on invalid input
|
||||||
private static void validateInputLines(String[] lines) {
|
private static void validateInputLines(String[] lines) {
|
||||||
for (String s: lines) {
|
for (String s: lines) {
|
||||||
// There might be a trailing '\f' for line in ExtraClassListFile, do trim first.
|
if (!s.startsWith("[LF_RESOLVE]") && !s.startsWith("[SPECIES_RESOLVE]")) {
|
||||||
String line = s.trim();
|
throw new IllegalArgumentException("Wrong prefix: " + s);
|
||||||
if (!line.startsWith("[LF_RESOLVE]") && !line.startsWith("[SPECIES_RESOLVE]")) {
|
|
||||||
throw new IllegalArgumentException("Wrong prefix: " + line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] parts = line.split(" ");
|
String[] parts = s.split(" ");
|
||||||
boolean isLF = line.startsWith("[LF_RESOLVE]");
|
boolean isLF = s.startsWith("[LF_RESOLVE]");
|
||||||
|
|
||||||
if (isLF) {
|
if (isLF) {
|
||||||
if (parts.length != 4) {
|
if (parts.length != 4) {
|
||||||
@ -176,7 +174,7 @@ public class CDS {
|
|||||||
private static Object[] generateLambdaFormHolderClasses(String[] lines) {
|
private static Object[] generateLambdaFormHolderClasses(String[] lines) {
|
||||||
Objects.requireNonNull(lines);
|
Objects.requireNonNull(lines);
|
||||||
validateInputLines(lines);
|
validateInputLines(lines);
|
||||||
Stream<String> lineStream = Arrays.stream(lines).map(String::trim);
|
Stream<String> lineStream = Arrays.stream(lines);
|
||||||
Map<String, byte[]> result = SharedSecrets.getJavaLangInvokeAccess().generateHolderClasses(lineStream);
|
Map<String, byte[]> result = SharedSecrets.getJavaLangInvokeAccess().generateHolderClasses(lineStream);
|
||||||
int size = result.size();
|
int size = result.size();
|
||||||
Object[] retArray = new Object[size * 2];
|
Object[] retArray = new Object[size * 2];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user