@@ -2544,7 +2544,7 @@ private void createFakeDirectoryIfNecessary(Path f)
25442544 // we only make the LIST call; the codepaths to get here should not
25452545 // be reached if there is an empty dir marker -and if they do, it
25462546 // 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 )) {
25482548 LOG .debug ("Creating new fake directory at {}" , f );
25492549 createFakeDirectory (key );
25502550 }
@@ -3058,8 +3058,7 @@ S3AFileStatus s3GetFileStatus(final Path path,
30583058 }
30593059
30603060 // execute the list
3061- boolean executeList = probes .contains (StatusProbeEnum .List );
3062- if (executeList ) {
3061+ if (probes .contains (StatusProbeEnum .List )) {
30633062 try {
30643063 // this will find a marker dir / as well as an entry.
30653064 // When making a simple "is this a dir check" all is good.
@@ -3119,45 +3118,6 @@ S3AFileStatus s3GetFileStatus(final Path path,
31193118 }
31203119 }
31213120
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- }
31613121 LOG .debug ("Not Found: {}" , path );
31623122 throw new FileNotFoundException ("No such file or directory: " + path );
31633123 }
@@ -3560,6 +3520,7 @@ private CopyResult copyFile(String srcKey, String dstKey, long size,
35603520 copyObjectRequest .setNewObjectMetadata (dstom );
35613521 Optional .ofNullable (srcom .getStorageClass ())
35623522 .ifPresent (copyObjectRequest ::setStorageClass );
3523+ incrementStatistic (OBJECT_COPY_REQUESTS );
35633524 Copy copy = transfers .copy (copyObjectRequest );
35643525 copy .addProgressListener (progressListener );
35653526 CopyOutcome copyOutcome = CopyOutcome .waitForCopy (copy );
0 commit comments