Skip to content

Commit 391112f

Browse files
committed
HADOOP-6138. Eliminate the depracate warnings introduced by H-5438. Contributed by He Yongqiang
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@795172 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5478e9a commit 391112f

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,9 @@ Trunk (unreleased changes)
880880
HADOOP-6137. Fix project specific test-patch requirements
881881
(Giridharan Kesavan)
882882

883+
HADOOP-6138. Eliminate the depracate warnings introduced by H-5438.
884+
(He Yongqiang via szetszwo)
885+
883886
Release 0.20.1 - Unreleased
884887

885888
INCOMPATIBLE CHANGES

src/java/org/apache/hadoop/fs/ChecksumFileSystem.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import java.io.*;
2222
import java.util.Arrays;
23+
import java.util.EnumSet;
2324
import java.util.zip.CRC32;
2425

2526
import org.apache.commons.logging.Log;
@@ -360,14 +361,14 @@ protected void writeChunk(byte[] b, int offset, int len, byte[] checksum)
360361
/** {@inheritDoc} */
361362
@Override
362363
public FSDataOutputStream create(Path f, FsPermission permission,
363-
boolean overwrite, int bufferSize, short replication, long blockSize,
364+
EnumSet<CreateFlag> flag, int bufferSize, short replication, long blockSize,
364365
Progressable progress) throws IOException {
365366
Path parent = f.getParent();
366367
if (parent != null && !mkdirs(parent)) {
367368
throw new IOException("Mkdirs failed to create " + parent);
368369
}
369370
final FSDataOutputStream out = new FSDataOutputStream(
370-
new ChecksumFSOutputSummer(this, f, overwrite, bufferSize, replication,
371+
new ChecksumFSOutputSummer(this, f, flag.contains(CreateFlag.OVERWRITE), bufferSize, replication,
371372
blockSize, progress), null);
372373
if (permission != null) {
373374
setPermission(f, permission);

src/java/org/apache/hadoop/fs/FileSystem.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,9 @@ public FSDataOutputStream create(Path f,
500500
long blockSize,
501501
Progressable progress
502502
) throws IOException {
503-
return this.create(f, FsPermission.getDefault(),
504-
overwrite, bufferSize, replication, blockSize, progress);
503+
return this.create(f, FsPermission.getDefault(), overwrite ? EnumSet
504+
.of(CreateFlag.OVERWRITE) : EnumSet.of(CreateFlag.CREATE), bufferSize,
505+
replication, blockSize, progress);
505506
}
506507

507508
/**

src/java/org/apache/hadoop/fs/HarFileSystem.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.net.URI;
2323
import java.net.URISyntaxException;
2424
import java.util.ArrayList;
25+
import java.util.EnumSet;
2526
import java.util.List;
2627

2728
import org.apache.hadoop.conf.Configuration;
@@ -580,7 +581,7 @@ public FSDataOutputStream create(Path f, int bufferSize)
580581

581582
public FSDataOutputStream create(Path f,
582583
FsPermission permission,
583-
boolean overwrite,
584+
EnumSet<CreateFlag> flag,
584585
int bufferSize,
585586
short replication,
586587
long blockSize,

0 commit comments

Comments
 (0)