Polish contribution

See gh-30710
This commit is contained in:
Sam Brannen
2023-08-01 11:19:54 +03:00
parent 01e90bbd0e
commit 525621c4d8
3 changed files with 8 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -239,11 +239,12 @@ public class StompHeaderAccessor extends SimpMessageHeaderAccessor {
public long[] getHeartbeat() {
String rawValue = getFirstNativeHeader(STOMP_HEARTBEAT_HEADER);
int pos = rawValue != null ? rawValue.indexOf(',') : -1;
int pos = (rawValue != null ? rawValue.indexOf(',') : -1);
if (pos == -1) {
return Arrays.copyOf(DEFAULT_HEARTBEAT, 2);
}
return new long[] {Long.parseLong(rawValue, 0, pos, 10), Long.parseLong(rawValue, pos + 1, rawValue.length(), 10)};
return new long[] {Long.parseLong(rawValue, 0, pos, 10),
Long.parseLong(rawValue, pos + 1, rawValue.length(), 10)};
}
public void setAcceptVersion(String acceptVersion) {

View File

@@ -280,11 +280,12 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
@Nullable
public long[] getHeartbeat() {
String rawValue = getFirst(HEARTBEAT);
int pos = rawValue != null ? rawValue.indexOf(',') : -1;
int pos = (rawValue != null ? rawValue.indexOf(',') : -1);
if (pos == -1) {
return null;
}
return new long[] {Long.parseLong(rawValue, 0, pos, 10), Long.parseLong(rawValue, pos + 1, rawValue.length(), 10)};
return new long[] {Long.parseLong(rawValue, 0, pos, 10),
Long.parseLong(rawValue, pos + 1, rawValue.length(), 10)};
}
/**