Committed by
Gerrit Code Review
Use StandardCharsets where possible
Change-Id: I7fd997b2ce57ad1704d988e55966bacac954f00a
Showing
2 changed files
with
4 additions
and
5 deletions
| ... | @@ -44,7 +44,7 @@ import java.io.FileNotFoundException; | ... | @@ -44,7 +44,7 @@ import java.io.FileNotFoundException; |
| 44 | import java.io.IOException; | 44 | import java.io.IOException; |
| 45 | import java.io.InputStream; | 45 | import java.io.InputStream; |
| 46 | import java.net.URI; | 46 | import java.net.URI; |
| 47 | -import java.nio.charset.Charset; | 47 | +import java.nio.charset.StandardCharsets; |
| 48 | import java.nio.file.NoSuchFileException; | 48 | import java.nio.file.NoSuchFileException; |
| 49 | import java.util.List; | 49 | import java.util.List; |
| 50 | import java.util.Locale; | 50 | import java.util.Locale; |
| ... | @@ -213,7 +213,7 @@ public class ApplicationArchive | ... | @@ -213,7 +213,7 @@ public class ApplicationArchive |
| 213 | 213 | ||
| 214 | // Returns the substring of maximum possible length from the specified bytes. | 214 | // Returns the substring of maximum possible length from the specified bytes. |
| 215 | private String substring(byte[] bytes, int length) { | 215 | private String substring(byte[] bytes, int length) { |
| 216 | - return new String(bytes, 0, Math.min(bytes.length, length), Charset.forName("UTF-8")); | 216 | + return new String(bytes, 0, Math.min(bytes.length, length), StandardCharsets.UTF_8); |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | /** | 219 | /** | ... | ... |
| ... | @@ -30,7 +30,7 @@ | ... | @@ -30,7 +30,7 @@ |
| 30 | package org.onlab.packet; | 30 | package org.onlab.packet; |
| 31 | 31 | ||
| 32 | import java.nio.ByteBuffer; | 32 | import java.nio.ByteBuffer; |
| 33 | -import java.nio.charset.Charset; | 33 | +import java.nio.charset.StandardCharsets; |
| 34 | import java.util.Arrays; | 34 | import java.util.Arrays; |
| 35 | 35 | ||
| 36 | /** | 36 | /** |
| ... | @@ -124,8 +124,7 @@ public class LLDPOrganizationalTLV extends LLDPTLV { | ... | @@ -124,8 +124,7 @@ public class LLDPOrganizationalTLV extends LLDPTLV { |
| 124 | * @return This LLDP Organizationally Specific TLV. | 124 | * @return This LLDP Organizationally Specific TLV. |
| 125 | */ | 125 | */ |
| 126 | public LLDPOrganizationalTLV setInfoString(final String infoString) { | 126 | public LLDPOrganizationalTLV setInfoString(final String infoString) { |
| 127 | - final byte[] infoStringBytes = infoString.getBytes(Charset | 127 | + final byte[] infoStringBytes = infoString.getBytes(StandardCharsets.UTF_8); |
| 128 | - .forName("UTF-8")); | ||
| 129 | return this.setInfoString(infoStringBytes); | 128 | return this.setInfoString(infoStringBytes); |
| 130 | } | 129 | } |
| 131 | 130 | ... | ... |
-
Please register or login to post a comment