App publishing improvements #385
Merged
tcdlpds
merged 2 commits from rajitha/device-mgt-core:stream-api
into master
5 months ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'rajitha/device-mgt-core:stream-api'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Purpose
releaseDTO.setUuid(UUID.randomUUID().toString());
releaseDTO.setAppHashValue(md5OfApp);
releaseDTO.setInstallerName(applicationArtifact.getInstallerName());
Format code
} catch (StorageManagementException e) {
String msg = "Error occurred while md5sum value retrieving process: application UUID "
+ releaseDTO.getUuid();
log.error(msg, e);
Check if throwing the error to the caller is required
log.error(msg);
throw new ApplicationManagementException(msg);
}
String md5OfApp = applicationStorageManager.getMD5(Files.newInputStream(Paths.get(applicationArtifact.getInstallerPath())));
Format code
}
applicationReleaseDTO.setAppHashValue(md5OfApp);
applicationStorageManager
Format code
applicationReleaseDTO.setPackageName(packageName);
String deletingAppHashValue = applicationReleaseDTO.getAppHashValue();
applicationReleaseDTO.setAppHashValue(md5OfApp);
applicationStorageManager.uploadReleaseArtifact(applicationReleaseDTO, deviceType,
Format code
applicationReleaseDTO.get().setInstallerName(applicationArtifact.getInstallerName());
String deletingAppHashValue = applicationReleaseDTO.get().getAppHashValue();
applicationReleaseDTO.get().setAppHashValue(md5OfApp);
applicationStorageManager.
Format code
String deviceType, InputStream binaryFile, int tenantId) throws ResourceManagementException {
try {
byte [] content = IOUtils.toByteArray(binaryFile);
//byte [] content = IOUtils.toByteArray(binaryFile);
Remove commented line if not necessary
}
@Override
public String getAbsolutePathOfFile(String hashVal, String folderName, String fileName, int tenantId) {
Can be converted to an static method
}
private static FileDescriptor resolve(String []urlSegments) throws FileTransferServiceHelperUtilException {
if (urlSegments.length < 4) {
Add a comment why this length check is necessary and use a constant for the numeric literal
String appHash = urlSegments[urlSegments.length - 3];
try {
InputStream fileStream = DataHolder.getInstance().
Close the stream.
Stream closes where the places this stream is getting use.
bufferedOutputStream.write(buffer, 0, n);
}
} finally {
inputStream.close();
Why thie close statement is removed? Also required to close the BufferedOutputStream as well.
Since both the streams are implements
AutoCloseable
interface, there is no such need to close streams manually when used with try-with-resource block.edde23df16
to2eb73213f3
5 months ago541853df30
into master 5 months agoReviewers
541853df30
.