Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions actor/src/main/scala/org/apache/pekko/util/ByteString.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2728,8 +2728,7 @@ object CompactByteString {
val copyLength = Math.max(Math.min(array.length - copyOffset, length), 0)
if (copyLength == 0) empty
else {
val copyArray = new Array[Byte](copyLength)
System.arraycopy(array, copyOffset, copyArray, 0, copyLength)
val copyArray = java.util.Arrays.copyOfRange(array, copyOffset, copyOffset + copyLength)
ByteString.ByteString1C(copyArray)
}
}
Expand Down Expand Up @@ -2789,16 +2788,14 @@ final class ByteStringBuilder extends Builder[Byte, ByteString] {

private def clearTemp(): Unit = {
if (_tempLength > 0) {
val arr = new Array[Byte](_tempLength)
System.arraycopy(_temp, 0, arr, 0, _tempLength)
val arr = java.util.Arrays.copyOf(_temp, _tempLength)
_builder += ByteString1(arr)
_tempLength = 0
}
}

private def resizeTemp(size: Int): Unit = {
val newtemp = new Array[Byte](size)
if (_tempLength > 0) System.arraycopy(_temp, 0, newtemp, 0, _tempLength)
val newtemp = if (_temp eq null) new Array[Byte](size) else java.util.Arrays.copyOf(_temp, size)
_temp = newtemp
_tempCapacity = _temp.length
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ class SnapshotSerializer(val system: ExtendedActorSystem) extends BaseSerializer
val manifest =
if (remaining == 0) ""
else {
val manifestBytes = new Array[Byte](remaining)
System.arraycopy(bytes, 4, manifestBytes, 0, remaining)
val manifestBytes = java.util.Arrays.copyOfRange(bytes, 4, 4 + remaining)
migrateManifestToPekkoIfNecessary(new String(manifestBytes, UTF_8))
}
(serializerId, manifest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ private[pekko] class ImmutableLongMap[A >: Null] private (private val keys: Arra
val i = Arrays.binarySearch(keys, key)
if (i >= 0) {
// existing key, replace value
val newValues = new Array[A](values.length)
System.arraycopy(values, 0, newValues, 0, values.length)
val newValues = values.clone()
newValues(i) = value
new ImmutableLongMap(keys, newValues)
} else {
Expand Down