@@ -121,13 +121,15 @@ public java.io.File makeRequestS3(String packageId, String directoryId, String f
121121 // Download the file
122122 java .io .File file = null ;
123123 try {
124- file = downloadFileFromS3 (systemFile , fileToDownload , forceProxy );
124+ file = downloadFileS3 (systemFile , fileToDownload , password , forceProxy , 0 );
125125 } catch (GetDownloadUrlsException e ) {
126- throw new DownloadFileException ("Unable to get download URLs" );
126+ throw new DownloadFileException (e . getMessage () );
127127 } catch (LimitExceededException e ){
128128 try {
129- file = downloadFileFromS3 (systemFile , fileToDownload , true , Integer .parseInt (e .getMessage ().toString ()));
130- } catch (GetDownloadUrlsException | LimitExceededException e1 ) {
129+ file = downloadFileS3 (systemFile , fileToDownload , password , true , Integer .parseInt (e .getMessage ().toString ()));
130+ } catch (GetDownloadUrlsException e1 ) {
131+ throw new DownloadFileException (e .getMessage ());
132+ } catch (LimitExceededException e1 ) {
131133 throw new DownloadFileException ("Unable to get download URLs" );
132134 }
133135 }catch (Exception e ){
@@ -232,11 +234,7 @@ private java.io.File downloadFile(java.io.File outFile, File ssFile) throws Down
232234 return outFile ;
233235 }
234236
235- private java .io .File downloadFileFromS3 (java .io .File systemFile , File fileToDownload , boolean forceProxy ) throws DownloadFileException , PasswordRequiredException , GetDownloadUrlsException , LimitExceededException {
236- return downloadFileFromS3 (systemFile , fileToDownload , forceProxy , 0 );
237- }
238-
239- private java .io .File downloadFileFromS3 (java .io .File outFile , File ssFile , boolean forceProxy , int filePart ) throws DownloadFileException , PasswordRequiredException , GetDownloadUrlsException , LimitExceededException {
237+ private java .io .File downloadFileS3 (java .io .File outFile , File ssFile , String password , boolean forceProxy , int filePart ) throws DownloadFileException , PasswordRequiredException , GetDownloadUrlsException , LimitExceededException {
240238
241239 Progress progress = new Progress (this .progress , ssFile .getFileId ());
242240 progress .setTotal (ssFile .getFileSize ());
@@ -256,7 +254,7 @@ private java.io.File downloadFileFromS3(java.io.File outFile, File ssFile, boole
256254
257255 GetDownloadUrlsHandler urlHandler = new GetDownloadUrlsHandler (uploadManager ,ssFile .getParts ());
258256 String checksum = calculateChecksum (packageInfo .getPackageCode (), packageInfo .getKeyCode ());
259- urlHandler .fetchDownloadUrls (packageInfo .getPackageId (), ssFile .getFileId (), this .directoryId , part , forceProxy , checksum );//do we need password here?
257+ urlHandler .fetchDownloadUrls (packageInfo .getPackageId (), ssFile .getFileId (), this .directoryId , part , forceProxy , password , checksum );
260258
261259 while (!urlHandler .getCurrentDownloadUrls ().isEmpty ()) {
262260
@@ -309,7 +307,7 @@ private java.io.File downloadFileFromS3(java.io.File outFile, File ssFile, boole
309307 }
310308 urlHandler .removeUrl ();
311309 part ++;
312- urlHandler .fetchDownloadUrls (packageInfo .getPackageId (), ssFile .getFileId (), this .directoryId , part , forceProxy , checksum );
310+ urlHandler .fetchDownloadUrls (packageInfo .getPackageId (), ssFile .getFileId (), this .directoryId , part , forceProxy , password , checksum );
313311 }
314312 }catch (LimitExceededException e ){
315313 throw new LimitExceededException (e .getMessage ());
0 commit comments