added download features but thrown internal error
flavien's git/Projet_JAVA_P2P_STRI2A/pipeline/pr-master This commit looks good Details

pull/108/head
js 4 years ago
parent 0a1cce3127
commit a646836f97

@ -44,11 +44,35 @@ public class DownloadFileGUI extends JPanel{
public void download() {
try {
//clientManagement.download(fileToDownload);
System.out.println("Downloading " + fileToDownload + " ... ");
clientManagement.download(fileToDownload);
ErrorFrame erreur = new ErrorFrame("File " + fileToDownload + " sucessfully downloaded");
} catch (NumberFormatException e) {
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 servers response");
} catch (VersionError e) {
ErrorFrame err = new ErrorFrame("Servers 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 clients 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) {
String fileSelected = jList1.getSelectedValue();
System.out.println("File to download: " + fileSelected);
//DownloadFileGUI interface = new DownloadFileGUI(fileSelected, clientManagement, logger, scanner);
//DownloadFileGUI.download();
DownloadFileGUI dl = new DownloadFileGUI(fileSelected, clientManagement, logger);
dl.download();
}
/** Actions to initiate when button "Back" is initiate */

Loading…
Cancel
Save