Skip to content

Commit

Permalink
Add back non-essential whitespace to avoid too many non-essential diffs.
Browse files Browse the repository at this point in the history
  • Loading branch information
janvanmansum committed Apr 3, 2024
1 parent de83c73 commit c2aa106
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public class FileUtil implements java.io.Serializable {

public FileUtil() {
}


public static String getFileExtension(String fileName){
String ext = null;
Expand Down Expand Up @@ -590,7 +590,7 @@ private static boolean isFITSFile(File file) {
return isFITSFile(ins);
} catch (IOException ex) {
logger.fine("IOException: "+ ex.getMessage());
}
}

return false;
}
Expand Down Expand Up @@ -835,7 +835,7 @@ public static File saveInputStreamInTempFile(InputStream inputStream, Long fileS
throws IOException, FileExceedsMaxSizeException, FileExceedsStorageQuotaException {
return saveInputStreamInTempFile(inputStream, fileSizeLimit, null);
}

public static File saveInputStreamInTempFile(InputStream inputStream, Long fileSizeLimit, Long storageQuotaLimit)
throws IOException, FileExceedsMaxSizeException, FileExceedsStorageQuotaException {
Path tempFile = Files.createTempFile(Paths.get(getFilesTempDirectory()), "tmp", "upload");
Expand All @@ -848,14 +848,14 @@ public static File saveInputStreamInTempFile(InputStream inputStream, Long fileS
Long fileSize = tempFile.toFile().length();
if (fileSizeLimit != null && fileSize > fileSizeLimit) {
try {tempFile.toFile().delete();} catch (Exception ex) {}
throw new FileExceedsMaxSizeException(MessageFormat.format(BundleUtil.getStringFromBundle("file.addreplace.error.file_exceeds_limit"), bytesToHumanReadable(fileSize), bytesToHumanReadable(fileSizeLimit)));
throw new FileExceedsMaxSizeException(MessageFormat.format(BundleUtil.getStringFromBundle("file.addreplace.error.file_exceeds_limit"), bytesToHumanReadable(fileSize), bytesToHumanReadable(fileSizeLimit)));
}

if (storageQuotaLimit != null && fileSize > storageQuotaLimit) {
try {tempFile.toFile().delete();} catch (Exception ex) {}
throw new FileExceedsStorageQuotaException(MessageFormat.format(BundleUtil.getStringFromBundle("file.addreplace.error.quota_exceeded"), bytesToHumanReadable(fileSize), bytesToHumanReadable(storageQuotaLimit)));
throw new FileExceedsStorageQuotaException(MessageFormat.format(BundleUtil.getStringFromBundle("file.addreplace.error.quota_exceeded"), bytesToHumanReadable(fileSize), bytesToHumanReadable(storageQuotaLimit)));
}

return tempFile.toFile();
}
throw new IOException("Failed to save uploaded file.");
Expand Down Expand Up @@ -1206,7 +1206,7 @@ public static boolean isTermsPopupRequired(DatasetVersion datasetVersion) {
}
return answer;
}

/**
* Provide download URL if no Terms of Use, no guestbook, and not
* restricted.
Expand Down Expand Up @@ -1781,5 +1781,5 @@ public static String getStorageDriver(DataFile dataFile) {
String storageIdentifier = dataFile.getStorageIdentifier();
return storageIdentifier.substring(0, storageIdentifier.indexOf(DataAccess.SEPARATOR));
}

}

0 comments on commit c2aa106

Please sign in to comment.