mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8202582: DateTimeFormatterBuilder.parseOffsetBased unnecessarily calls toString()
Call text.subSequence() before calling toString() on input string Reviewed-by: igerasim
This commit is contained in:
parent
1cb95bd3d1
commit
5b3eaaf632
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2018, 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
|
||||||
|
@ -4262,7 +4262,7 @@ public final class DateTimeFormatterBuilder {
|
||||||
* @return the position after the parse
|
* @return the position after the parse
|
||||||
*/
|
*/
|
||||||
private int parseOffsetBased(DateTimeParseContext context, CharSequence text, int prefixPos, int position, OffsetIdPrinterParser parser) {
|
private int parseOffsetBased(DateTimeParseContext context, CharSequence text, int prefixPos, int position, OffsetIdPrinterParser parser) {
|
||||||
String prefix = text.toString().substring(prefixPos, position).toUpperCase();
|
String prefix = text.subSequence(prefixPos, position).toString().toUpperCase();
|
||||||
if (position >= text.length()) {
|
if (position >= text.length()) {
|
||||||
context.setParsed(ZoneId.of(prefix));
|
context.setParsed(ZoneId.of(prefix));
|
||||||
return position;
|
return position;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue