Returns the failure reason for the provided fileUploadId or an empty
string but never <code>null</code>.

@param fileUploadId
@return the failure reason or an empty String.
8943
private String getFailureReason(final FileUploadId fileUploadId) {
        String failureReason = "";
        if (artifactUploadState.getFileUploadProgress(fileUploadId) != null) {
            failureReason = artifactUploadState.getFileUploadProgress(fileUploadId).getFailureReason();
        }
        if (StringUtils.isEmpty(failureReason)) {
            return "";
        }
        return failureReason;
    }
21992
@Override
	public boolean upload(String path, File file) {
		Assert.notNull(file, "file to upload is null !");
		return upload(path, file.getName(), file);
	}
71588
def get_failure_reason(self):
        

        reason_key = 'reason'
        cid_key = 'containerID'
        exit_key = 'exitCode'

        pod_status = self.json.get('status', {})
        statuses = pod_status.get('containerStatuses', [])

        # Find the first non-zero exit code from a container
        # and return its 'message' or 'reason' value
        for status in statuses:
            try:
                terminated = status['state']['terminated']
                exit_code = terminated['exitCode']
                if exit_code != 0:
                    reason_dict = {
                        exit_key: exit_code,
                    }

                    if 'containerID' in terminated:
                        reason_dict[cid_key] = terminated['containerID']

                    for key in ['message', 'reason']:
                        try:
                            reason_dict[reason_key] = terminated[key]
                            break
                        except KeyError:
                            continue
                    else:
                        # Both 'message' and 'reason' are missing
                        reason_dict[reason_key] = 'Exit code {code}'.format(
                            code=exit_code
                        )

                    return reason_dict
            except KeyError:
                continue

        # Failing that, return the 'message' or 'reason' value for the
        # pod
        for key in ['message', 'reason']:
            try:
                return {reason_key: pod_status[key]}
            except KeyError:
                continue

        return {reason_key: pod_status['phase']}
1214447
private void getPartList(WebContext ctx, Bucket bucket, String id, String uploadId) {
        if (!multipartUploads.contains(uploadId)) {
            ctx.respondWith().error(HttpResponseStatus.NOT_FOUND, ERROR_MULTIPART_UPLOAD_DOES_NOT_EXIST);
            return;
        }

        Response response = ctx.respondWith();

        response.setHeader(HTTP_HEADER_NAME_CONTENT_TYPE, CONTENT_TYPE_XML);

        XMLStructuredOutput out = response.xml();
        out.beginOutput("ListPartsResult");
        out.property(RESPONSE_BUCKET, bucket.getName());
        out.property("Key", id);
        out.property("UploadId", uploadId);

        outputOwnerInfo(out, "Initiator");
        outputOwnerInfo(out, "Owner");

        File uploadDir = getUploadDir(uploadId);
        int marker = ctx.get("part-number-marker").asInt(0);
        int maxParts = ctx.get("max-parts").asInt(0);

        out.property("StorageClass", "STANDARD");
        out.property("PartNumberMarker", marker);
        if ((marker + maxParts) < uploadDir.list().length) {
            out.property("NextPartNumberMarker", marker + maxParts + 1);
        }

        if (Strings.isFilled(maxParts)) {
            out.property("MaxParts", maxParts);
        }

        boolean truncated = 0 < maxParts && maxParts < uploadDir.list().length;
        out.property("IsTruncated", truncated);

        for (File part : uploadDir.listFiles()) {
            out.beginObject("Part");
            out.property("PartNumber", part.getName());
            out.property("LastModified", RFC822_INSTANT.format(Instant.ofEpochMilli(part.lastModified())));
            try {
                out.property(HTTP_HEADER_NAME_ETAG, Files.hash(part, Hashing.md5()).toString());
            } catch (IOException e) {
                Exceptions.ignore(e);
            }
            out.property("Size", part.length());
            out.endObject();
        }

        out.endOutput();
    }
896592
public static String getInvalidFileTypeMessage(final List<String> fileTypes) {
		if (fileTypes == null) {
			return null;
		}
		return String.format(I18nUtilities.format(null,
			InternalMessages.DEFAULT_VALIDATION_ERROR_FILE_WRONG_TYPE),
			StringUtils.join(fileTypes.toArray(new Object[fileTypes.size()]), ","));
	}
646160
public static function getUploadErrorMessage(int $errorCode): string
    {
        switch ($errorCode) {
            case \UPLOAD_ERR_INI_SIZE:
                return 'The uploaded file exceeds the upload_max_filesize directive in php.ini';
            case \UPLOAD_ERR_FORM_SIZE:
                return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
            case \UPLOAD_ERR_PARTIAL:
                return 'The uploaded file was only partially uploaded';
            case \UPLOAD_ERR_NO_FILE:
                return 'No file was uploaded';
            case \UPLOAD_ERR_NO_TMP_DIR:
                return 'Missing a temporary folder';
            case \UPLOAD_ERR_CANT_WRITE:
                return 'Failed to write file to disk';
            case \UPLOAD_ERR_EXTENSION:
                return 'File upload stopped by extension';
            default:
                return 'Unknown upload error';
        }
    }
657148
def get_vdp_failure_reason(self, reply):
        
        try:
            fail_reason = reply.partition(
                "filter")[0].replace('\t', '').split('\n')[-2]
            if len(fail_reason) == 0:
                fail_reason = vdp_const.retrieve_failure_reason % (reply)
        except Exception:
            fail_reason = vdp_const.retrieve_failure_reason % (reply)
        return fail_reason
262979
@Override
    public void uploadFailed(final FailedEvent event) {
        assertStateConsistency(fileUploadId, event.getFilename());

        if (!isUploadInterrupted()) {
            interruptUploadDueToUploadFailed();
        }
        publishUploadFailedAndFinishedEvent(fileUploadId, event.getReason());
    }
162423
private String getOldCodeId(FileStatus srcStat ) throws IOException {
    if (codec.id.equals("xor") || codec.id.equals("rs")) {
      return codec.id;
    } else {
      // Search for xor/rs parity files
      if (ParityFilePair.getParityFile(
        Codec.getCodec("xor"), srcStat, this.conf) != null)
        return "xor";
      if (ParityFilePair.getParityFile(
        Codec.getCodec("rs"), srcStat, this.conf) != null)
        return "rs";
    }
    return null;
  }
1000162
private String getIdFromFilename(String filename) {
        if (!StringUtils.hasText(filename) || filename.indexOf('_') < 0) {
            return null;
        }
        return filename.substring(0, filename.lastIndexOf('_'));
    }
1332303
public function cancelFromId($FileUploadId)
    {
        $Service = sprintf(self::API_UPLOAD_CANCEL, $FileUploadId);
        $rest    = $this->callService('DELETE', $Service);

        return $rest->getSuccess();
    }
197624
public ChunkedUploadResponse getChunkedUpload(String accountId, String chunkedUploadId) throws ApiException {
    return getChunkedUpload(accountId, chunkedUploadId, null);
  }
816738
private URI findFile(final String filePath, final boolean upload) {
        try {
            URI fileURI;
            try {
                fileURI = _hadoopDefaultFS.getUri().resolve(filePath);
            } catch (final Exception e) {
                fileURI = null;
            }

            if ((fileURI == null || !_hadoopDefaultFS.exists(new Path(fileURI))) && upload) {
                final File file = new File(filePath);
                if (!file.isFile()) {
                    throw new IllegalArgumentException("'" + filePath + " does not exist, or is not a file");
                }

                final String fileName = file.toPath().getFileName().toString();
                return _applicationDriver
                        .copyFileToHdfs(file, DATACLEANER_TEMP_DIR + "/" + UUID.randomUUID() + fileName);
            }

            return fileURI;
        } catch (final IOException e) {
            throw new IllegalArgumentException("Path '" + filePath + "' is not a proper file path");
        }
    }
830966
@Override
    public FileIO failIfNotExists(final boolean... failOnFNF) {
        this.failIfNotExists = (failOnFNF != null) && ((failOnFNF.length == 0) || ((failOnFNF.length > 0) && failOnFNF[0]));
        return this;
    }
686132
private String getFinalPath(String uploadPath) {
		if (uploadPath == null) {
			throw new IllegalArgumentException("uploadPath can not be null.");
		}
		
		uploadPath = uploadPath.trim();
		if (uploadPath.startsWith("/") || uploadPath.startsWith("\\")) {
			if (baseUploadPath.equals("/")) {
				return uploadPath;
			} else {
				return baseUploadPath + uploadPath;
			}
		} else {
			return baseUploadPath + File.separator + uploadPath;
		}
	}
1150780
@NullSafe
  private File validateDirectory(File directory) {
    return Optional.ofNullable(directory).filter(File::isDirectory)
      .orElseThrow(() -> newIllegalArgumentException("File [%s] is not a valid directory", directory));
  }
819940
public java.lang.String getUploadPathRegex() {
    java.lang.Object ref = uploadPathRegex_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      uploadPathRegex_ = s;
      return s;
    }
  }