Browse Source

Polish contribution

See gh-30710
pull/30980/head
Sam Brannen 3 years ago
parent
commit
525621c4d8
  1. 2
      spring-core/src/main/java/org/springframework/util/unit/DataSize.java
  2. 7
      spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java
  3. 5
      spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaders.java

2
spring-core/src/main/java/org/springframework/util/unit/DataSize.java

@ -1,5 +1,5 @@ @@ -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.

7
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaderAccessor.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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) {

5
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompHeaders.java

@ -280,11 +280,12 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable @@ -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)};
}
/**

Loading…
Cancel
Save