Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import scala.jdk.CollectionConverters._
import scala.reflect.ClassTag
import scala.util.control.NonFatal

import com.google.common.io.ByteStreams

import org.apache.spark.{SparkConf, SparkException, TaskContext}
import org.apache.spark.internal.Logging
import org.apache.spark.internal.LogKeys._
Expand Down Expand Up @@ -905,7 +903,7 @@ private[storage] class PartiallySerializedBlock[T](
// We want to close the output stream in order to free any resources associated with the
// serializer itself (such as Kryo's internal buffers). close() might cause data to be
// written, so redirect the output stream to discard that data.
redirectableOutputStream.setOutputStream(ByteStreams.nullOutputStream())
redirectableOutputStream.setOutputStream(OutputStream.nullOutputStream())
serializationStream.close()
} finally {
discarded = true
Expand Down
5 changes: 5 additions & 0 deletions scalastyle-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,11 @@ This file is divided into 3 sections:
<customMessage>Use readFully of JavaUtils/SparkStreamUtils/Utils instead.</customMessage>
</check>

<check customId="nullOutputStream" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
<parameters><parameter name="regex">\bByteStreams\.nullOutputStream\b</parameter></parameters>
<customMessage>Use OutputStream.nullOutputStream instead.</customMessage>
</check>

<check customId="maputils" level="error" class="org.scalastyle.file.RegexChecker" enabled="true">
<parameters><parameter name="regex">org\.apache\.commons\.collections4\.MapUtils\b</parameter></parameters>
<customMessage>Use org.apache.spark.util.collection.Utils instead.</customMessage>
Expand Down