@@ -2544,7 +2544,7 @@ private void createFakeDirectoryIfNecessary(Path f)
2544
2544
// we only make the LIST call; the codepaths to get here should not
2545
2545
// be reached if there is an empty dir marker -and if they do, it
2546
2546
// is mostly harmless to create a new one.
2547
- if (!key .isEmpty () && !s3Exists (f , EnumSet . of ( StatusProbeEnum .List ) )) {
2547
+ if (!key .isEmpty () && !s3Exists (f , StatusProbeEnum .DIRECTORIES )) {
2548
2548
LOG .debug ("Creating new fake directory at {}" , f );
2549
2549
createFakeDirectory (key );
2550
2550
}
@@ -3058,8 +3058,7 @@ S3AFileStatus s3GetFileStatus(final Path path,
3058
3058
}
3059
3059
3060
3060
// execute the list
3061
- boolean executeList = probes .contains (StatusProbeEnum .List );
3062
- if (executeList ) {
3061
+ if (probes .contains (StatusProbeEnum .List )) {
3063
3062
try {
3064
3063
// this will find a marker dir / as well as an entry.
3065
3064
// When making a simple "is this a dir check" all is good.
@@ -3119,45 +3118,6 @@ S3AFileStatus s3GetFileStatus(final Path path,
3119
3118
}
3120
3119
}
3121
3120
3122
- // Neither any normal file HEAD nor a LIST found an object
3123
- // Look for the dir marker
3124
- // TODO: decide whether to cut or not. We currently skip this entire probe.
3125
- boolean checkMarker = false && probes .contains (StatusProbeEnum .DirMarker );
3126
- if (!key .isEmpty () && checkMarker ) {
3127
- String newKey = maybeAddTrailingSlash (key );
3128
- try {
3129
- ObjectMetadata meta = getObjectMetadata (newKey );
3130
-
3131
- if (objectRepresentsDirectory (newKey , meta .getContentLength ())) {
3132
- LOG .debug ("Found file (with /): fake directory" );
3133
- // this used to self-declare as empty; now it decides
3134
- // based on whether a list was also executed in the current
3135
- // series of probes
3136
- return new S3AFileStatus (
3137
- executeList
3138
- ? Tristate .TRUE
3139
- : Tristate .UNKNOWN ,
3140
- path , username );
3141
- } else {
3142
- LOG .warn ("Found file (with /): real file? should not happen: {}" ,
3143
- key );
3144
-
3145
- return new S3AFileStatus (meta .getContentLength (),
3146
- dateToLong (meta .getLastModified ()),
3147
- path ,
3148
- getDefaultBlockSize (path ),
3149
- username ,
3150
- meta .getETag (),
3151
- meta .getVersionId ());
3152
- }
3153
- } catch (AmazonServiceException e ) {
3154
- if (e .getStatusCode () != SC_404 || isUnknownBucket (e )) {
3155
- throw translateException ("getFileStatus" , newKey , e );
3156
- }
3157
- } catch (AmazonClientException e ) {
3158
- throw translateException ("getFileStatus" , newKey , e );
3159
- }
3160
- }
3161
3121
LOG .debug ("Not Found: {}" , path );
3162
3122
throw new FileNotFoundException ("No such file or directory: " + path );
3163
3123
}
@@ -3560,6 +3520,7 @@ private CopyResult copyFile(String srcKey, String dstKey, long size,
3560
3520
copyObjectRequest .setNewObjectMetadata (dstom );
3561
3521
Optional .ofNullable (srcom .getStorageClass ())
3562
3522
.ifPresent (copyObjectRequest ::setStorageClass );
3523
+ incrementStatistic (OBJECT_COPY_REQUESTS );
3563
3524
Copy copy = transfers .copy (copyObjectRequest );
3564
3525
copy .addProgressListener (progressListener );
3565
3526
CopyOutcome copyOutcome = CopyOutcome .waitForCopy (copy );
0 commit comments