|
|
|
@ -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 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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|