added download features but thrown internal error
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/pr-master This commit looks good
All checks were successful
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/pr-master This commit looks good
This commit is contained in:
parent
0a1cce3127
commit
a646836f97
@ -44,11 +44,35 @@ public class DownloadFileGUI extends JPanel{
|
|||||||
|
|
||||||
public void download() {
|
public void download() {
|
||||||
try {
|
try {
|
||||||
//clientManagement.download(fileToDownload);
|
System.out.println("Downloading " + fileToDownload + " ... ");
|
||||||
|
clientManagement.download(fileToDownload);
|
||||||
ErrorFrame erreur = new ErrorFrame("File " + fileToDownload + " sucessfully downloaded");
|
ErrorFrame erreur = new ErrorFrame("File " + fileToDownload + " sucessfully downloaded");
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
ErrorFrame erreur = new ErrorFrame("File " + fileToDownload + " unsucessfully downloaded, wrong number");
|
ErrorFrame erreur = new ErrorFrame("File " + fileToDownload + " unsucessfully downloaded, wrong number");
|
||||||
|
} catch (InternalError e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Client internal error");
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Server host is unknown");
|
||||||
|
} catch (IOException e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Request cannot be send or response cannot be received");
|
||||||
|
} catch (TransmissionError e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Message received is too big");
|
||||||
|
} catch (ProtocolError e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Cannot decode server’s response");
|
||||||
|
} catch (VersionError e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Server’s response use bad version of the protocol");
|
||||||
|
} catch (SizeError e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Cannot handle this packets because of internal representation limitations of numbers on the client");
|
||||||
|
} catch (InternalRemoteError e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Server internal error");
|
||||||
|
} catch (ProtocolRemoteError e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Server cannot decode client’s request");
|
||||||
|
} catch (VersionRemoteError e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Server cannot decode this version of the protocol");
|
||||||
|
} catch (NotFound e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("Server has not this file in directory");
|
||||||
|
} catch (EmptyFile e) {
|
||||||
|
ErrorFrame err = new ErrorFrame("File is empty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,8 +121,8 @@ public class DownloadSelectionGen extends javax.swing.JPanel {
|
|||||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
|
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
String fileSelected = jList1.getSelectedValue();
|
String fileSelected = jList1.getSelectedValue();
|
||||||
System.out.println("File to download: " + fileSelected);
|
System.out.println("File to download: " + fileSelected);
|
||||||
//DownloadFileGUI interface = new DownloadFileGUI(fileSelected, clientManagement, logger, scanner);
|
DownloadFileGUI dl = new DownloadFileGUI(fileSelected, clientManagement, logger);
|
||||||
//DownloadFileGUI.download();
|
dl.download();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Actions to initiate when button "Back" is initiate */
|
/** Actions to initiate when button "Back" is initiate */
|
||||||
|
Loading…
Reference in New Issue
Block a user