Guest User

Untitled

a guest
Oct 25th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.22 KB | None | 0 0
  1. import java.rmi.*;
  2. import java.rmi.server.*;
  3. import java.net.*;
  4. import java.io.*;
  5. import java.util.*;
  6. import java.rmi.registry.LocateRegistry;
  7. import java.rmi.registry.Registry;
  8.  
  9. public class Client extends UnicastRemoteObject implements CClient {
  10. private static int PORT = 6060;
  11.  
  12. static RmiServer h = null;
  13.  
  14. public String username;
  15. public boolean editor;
  16.  
  17. public static String message; //mensagens do servidor
  18.  
  19. public Client() throws RemoteException {
  20. this.username = username;
  21. this.editor = false;
  22. }
  23.  
  24. public String getUsername() throws RemoteException{
  25. return username;
  26. }
  27.  
  28. public void setUsername(String user) throws RemoteException{
  29. this.username = user;
  30. }
  31.  
  32. public boolean getEditor() throws RemoteException{
  33. return editor;
  34. }
  35.  
  36. public void setEditor(boolean e) throws RemoteException{
  37. this.editor = e;
  38. }
  39.  
  40. public void print_on_client(String s) throws RemoteException {
  41. System.out.println(s);
  42. }
  43.  
  44. public void message_client(String s) throws RemoteException{
  45. message = s;
  46. }
  47.  
  48. public static void downloadSong(String songName, String ip){
  49. Socket s = null;
  50. int FILE_SIZE = 7971310;
  51. try {
  52. s = new Socket(ip, PORT);//change
  53.  
  54. DataOutputStream out = new DataOutputStream(s.getOutputStream());
  55. // DataInputStream in= new DataInputStream(s.getInputStream());
  56. String texto = "download;"+songName;
  57.  
  58. // WRITE INTO THE SOCKET
  59. out.writeUTF(texto);
  60.  
  61. int bytesRead;
  62. int current = 0;
  63. FileOutputStream fos = null;
  64. BufferedOutputStream bos = null;
  65.  
  66. try {
  67. byte [] mybytearray = new byte [FILE_SIZE];
  68. InputStream is = s.getInputStream();
  69.  
  70. String userHomeFolder = System.getProperty("user.home")+"\\Desktop";
  71.  
  72. fos = new FileOutputStream(userHomeFolder+"\\"+songName+".wav");
  73. bos = new BufferedOutputStream(fos);
  74. bytesRead = is.read(mybytearray,0,mybytearray.length);
  75. current = bytesRead;
  76.  
  77. do {
  78. bytesRead = is.read(mybytearray, current, (mybytearray.length-current));
  79. if(bytesRead > 0)
  80. current += bytesRead;
  81. } while(bytesRead > 0);
  82.  
  83. bos.write(mybytearray, 0 , current);
  84. bos.flush();
  85.  
  86. }
  87. finally {
  88. if (fos != null) fos.close();
  89. if (bos != null) bos.close();
  90. if (s != null) s.close();
  91. }
  92.  
  93. System.out.println("Download feito");
  94.  
  95. } catch (EOFException e) {
  96. System.out.println("EOF:" + e.getMessage());
  97. } catch (IOException e) {
  98. System.out.println("IO:" + e.getMessage());
  99. } finally {
  100. if (s != null)
  101. try {
  102. s.close();
  103. } catch (IOException e) {
  104. System.out.println("close:" + e.getMessage());
  105. }
  106. }
  107. }
  108.  
  109. public static void uploadSong(String songName, String ip){
  110. Socket s = null;
  111. //int FILE_SIZE = 7971310;
  112. try {
  113. FileInputStream fis = null;
  114. BufferedInputStream bis = null;
  115. OutputStream os = null;
  116.  
  117. s = new Socket(ip, PORT);//change
  118. String userHomeFolder = System.getProperty("user.home")+"\\Desktop";
  119. File file = new File(userHomeFolder+"\\"+songName+".wav");
  120. DataOutputStream out = new DataOutputStream(s.getOutputStream());
  121. String texto = "upload;"+songName;
  122. out.writeUTF(texto);
  123.  
  124. byte [] mybytearray = new byte [(int) file.length()];
  125. fis = new FileInputStream(file);
  126. bis = new BufferedInputStream(fis);
  127. bis.read(mybytearray,0,mybytearray.length);
  128. os = s.getOutputStream();
  129. os.write(mybytearray,0,mybytearray.length);
  130. os.flush();
  131.  
  132. System.out.println("Upload completed");
  133.  
  134.  
  135. } catch (EOFException e) {
  136. System.out.println("EOF:" + e.getMessage());
  137. } catch (IOException e) {
  138. System.out.println("IO:" + e.getMessage());
  139. } finally {
  140. if (s != null)
  141. try {
  142. s.close();
  143. } catch (IOException e) {
  144. System.out.println("close:" + e.getMessage());
  145. }
  146. }
  147. }
  148.  
  149. public static void menu(Client c, BufferedReader reader, String name, String password){
  150. try{
  151. while(true){
  152. System.out.println("\n1- Search song");
  153. System.out.println("2- Details of an album");
  154. System.out.println("3- Details of an artist");
  155. System.out.println("4- Write a review of an album");
  156. System.out.println("5- Share with friends uploaded song");
  157. if (c.getEditor()) {
  158. System.out.println("6- Manage information");
  159. System.out.println("7- Make an user a new editor");
  160. }
  161. System.out.println("0- Logout");
  162. System.out.print("> ");
  163. Scanner sc = new Scanner(System.in);
  164. String num = sc.next();
  165.  
  166. switch(num){
  167. case "1":
  168. System.out.println("\n1- Trough artist");
  169. System.out.println("2- Trough album");
  170. System.out.println("3- Trough genre");
  171. System.out.print("4- By song name\n> ");
  172. String aux1 = sc.next();
  173. String artist11 = "";
  174. String ip = "";
  175. String ip2 = "";
  176. String multicast = "";
  177. switch(aux1){
  178. case "1":
  179. System.out.print("\nType artist's name:\n> ");
  180. artist11 = reader.readLine();
  181. String m11 = "type|partial search artist;info|" + artist11 + ";username|" + name;
  182. h.search_song(m11);
  183. if(message.equals("yes-artist")){
  184. message = "";
  185. System.out.print("\nChoose one song:\n> ");
  186. String song11 = reader.readLine();
  187. System.out.println("\n1- Duration");
  188. System.out.println("2- Composer");
  189. System.out.println("3- Lyrics");
  190. System.out.println("4- Upload");
  191. System.out.print("5- Download\n> ");
  192. String aux11 = reader.readLine();
  193.  
  194. switch(aux11){
  195. case "1":
  196. String m111 = "type|search music by artist;artist name|" + artist11 + ";song name|" + song11 + ";option|duration;username|" + name;
  197. h.search_song(m111);
  198. continue;
  199. case "2":
  200. String m112 = "type|search music by artist;artist name|" + artist11 + ";song name|" + song11 + ";option|composer;username|" + name;
  201. h.search_song(m112);
  202. continue;
  203. case "3":
  204. String m113 = "type|search music by artist;artist name|" + artist11 + ";song name|" + song11 + ";option|lyrics;username|" + name;
  205. h.search_song(m113);
  206. continue;
  207. case "4":
  208. String m114 = "type|search music by artist;artist name|" + artist11 + ";song name|" + song11 + ";option|uploadServerIP;username|" + name; //por protocolo e alterar search song
  209. h.search_song(m114);
  210. multicast = message;
  211.  
  212. String m1141 = multicast + ",type|search music by artist;artist name|" + artist11 + ";song name|" + song11 + ";option|serverIP;username|" + name;
  213. h.search_song(m1141);
  214.  
  215. ip = message;
  216. ip2 = message.split("/")[1];
  217. uploadSong(song11, ip2);
  218. continue;
  219. case "5":
  220. String m115 = "type|search music by artist;artist name|" + artist11 + ";song name|" + song11 + ";option|downloadServerIP;username|" + name; //por protocolo e alterar search song
  221. h.search_song(m115);
  222. ip = message;
  223. if (!message.equals("message"))
  224. downloadSong(song11, ip);
  225. continue;
  226. default:
  227. continue;
  228. }
  229. }
  230. else{
  231. continue;
  232. }
  233. case "2":
  234. System.out.print("\nType album's name:\n> ");
  235. String album12 = reader.readLine();
  236. String m12 = "type|partial search album;info|" + album12 + ";username|" + name;
  237. h.search_song(m12);
  238. if(message.equals("yes-album")){
  239. System.out.print("\nChoose one song:\n> ");
  240. String song12 = reader.readLine();
  241. System.out.println("\n1- Duration");
  242. System.out.println("2- Composer");
  243. System.out.println("3- Lyrics");
  244. System.out.println("4- Upload");
  245. System.out.print("5- Download\n> ");
  246. String aux12 = reader.readLine();
  247.  
  248. switch(aux12){
  249. case "1":
  250. String m121 = "type|search music by album;album name|" + album12 + ";song name|" + song12 + ";option|duration;username|" + name;
  251. h.search_song(m121);
  252. continue;
  253. case "2":
  254. String m122 = "type|search music by album;album name|" + album12 + ";song name|" + song12 + ";option|composer;username|" + name;
  255. h.search_song(m122);
  256. continue;
  257. case "3":
  258. String m123 = "type|search music by album;album name|" + album12 + ";song name|" + song12 + ";option|lyrics;username|" + name;
  259. h.search_song(m123);
  260. continue;
  261. case "4":
  262. String m124 = "type|search music by album;album name|" + album12 + ";song name|" + song12 + ";option|uploadServerIP;username|" + name; //por protocolo e alterar search song
  263. h.search_song(m124);
  264. ip = message;
  265. if (!message.equals("message"))
  266. uploadSong(song12, ip);
  267. continue;
  268. case "5":
  269. String m125 = "type|search music by album;album name|" + album12 + ";song name|" + song12 + ";option|downloadServerIP;username|" + name; //por protocolo e alterar search song
  270. h.search_song(m125);
  271. ip = message;
  272. if (!message.equals("message"))
  273. downloadSong(song12, ip);
  274. continue;
  275. default:
  276. continue;
  277. }
  278. }
  279. else{
  280. continue;
  281. }
  282. case "3":
  283. System.out.print("\nType genre:\n> ");
  284. /*String genre1 = reader.readLine();
  285. h.search_song(name, genre1, "partial search album"); to be completed*/
  286. //??
  287. case "4":
  288. System.out.print("\nType song's name:\n> ");
  289. String song14 = reader.readLine();
  290. System.out.println("\n1- Duration");
  291. System.out.println("2- Composer");
  292. System.out.println("3- Lyrics");
  293. System.out.println("4- Upload");
  294. System.out.print("5- Download\n> ");
  295. String aux14 = reader.readLine();
  296.  
  297. switch(aux14){
  298. case "1":
  299. String m141 = "type|search music;song name|" + song14 + ";option|duration;username|" + name;
  300. h.search_song(m141);
  301. continue;
  302. case "2":
  303. String m142 = "type|search music;song name|" + song14 + ";option|composer;username|" + name;
  304. h.search_song(m142);
  305. continue;
  306. case "3":
  307. String m143 = "type|search music;song name|" + song14 + ";option|lyrics;username|" + name;
  308. h.search_song(m143);
  309. continue;
  310. case "4":
  311. String m144 = "type|search music;song name|" + song14 + ";option|uploadServerIP;username|" + name; //por protocolo e alterar search song
  312. h.search_song(m144);
  313. ip = message;
  314. if (!message.equals("message"))
  315. uploadSong(song14, ip);
  316. continue;
  317. case "5":
  318. String m145 = "type|search music;song name|" + song14 + ";option|downloadServerIP;username|" + name; //por protocolo e alterar search song
  319. h.search_song(m145);
  320. ip = message;
  321. if (!message.equals("message"))
  322. downloadSong(song14, ip);
  323. continue;
  324. default:
  325. continue;
  326. }
  327. default:
  328. continue;
  329. }
  330. case "2":
  331. System.out.print("\nType artist's name:\n> ");
  332. String artist2 = reader.readLine();
  333. System.out.print("\nType album's name:\n> ");
  334. String album2 = reader.readLine();
  335. System.out.println("\n1- Description");
  336. System.out.println("2- List of songs");
  337. System.out.print("3- Reviews\n> ");
  338. String aux2 = sc.next();
  339. switch(aux2){
  340. case "1":
  341. h.details_album(name, artist2, album2, "description", "details album");
  342. continue;
  343. case "2":
  344. h.details_album(name, artist2, album2, "list of songs", "details album");
  345. continue;
  346. case "3":
  347. h.details_album(name, artist2, album2, "reviews", "details album");
  348. continue;
  349. default:
  350. continue;
  351. }
  352. case "3":
  353. System.out.print("\nType artist's name:\n> ");
  354. String artist3 = reader.readLine();
  355. h.details_artist(name, artist3, "details artist");
  356. continue;
  357. case "4":
  358. System.out.print("\nType album's name:\n> ");
  359. String album4 = reader.readLine();
  360.  
  361. String score4 = null;
  362. while(true){
  363. System.out.print("\nType album's score (0 to 10):\n> ");
  364. score4 = reader.readLine();
  365. try{
  366. int score41 = Integer.parseInt(score4);
  367. if(score41>=0 && score41<=10){
  368. break;
  369. }
  370. else{
  371. System.out.println("That input is invalid");
  372. continue;
  373. }
  374. }
  375. catch(NumberFormatException e){
  376. System.out.println("That input is invalid");
  377. continue;
  378. }
  379. }
  380.  
  381. System.out.print("\nWrite review (300 characters):\n> ");
  382. String review4 = reader.readLine();
  383. String review42;
  384. if(review4.length()>300)
  385. review42 = review4.substring(0,300);
  386. else
  387. review42 = review4;
  388.  
  389. h.review(name, album4, review42, score4, "review");
  390. continue;
  391. case "5":
  392.  
  393. continue;
  394. case "6":
  395. if(c.getEditor()){
  396. System.out.println("\n1- Insert");
  397. System.out.print("2- Change\n> ");
  398. String aux8 = sc.next();
  399. switch(aux8){
  400. case "1":
  401. System.out.println("\n1- Artist");
  402. System.out.println("2- Album");
  403. System.out.print("3- Song\n> ");
  404. String aux81 = sc.next();
  405. switch(aux81){
  406. case "1":
  407. System.out.print("\nType artist's name:\n> ");
  408. String artist811 = reader.readLine();
  409. System.out.print("\nType artist's description:\n> ");
  410. String description811 = reader.readLine();
  411. System.out.print("\nType artist's working period:\n> ");
  412. String period811 = reader.readLine();
  413.  
  414. String m811 = "type|insert artist;artist name|" + artist811 + ";description|" + description811 + ";groupPeriod|" + period811 + ";username|" + name;
  415. h.manage_info(m811);
  416. continue;
  417. case "2":
  418. System.out.print("\nType artist's name:\n> ");
  419. String artist812 = reader.readLine();
  420. System.out.print("\nType album's name:\n> ");
  421. String album812 = reader.readLine();
  422. System.out.print("\nType album's genre:\n> ");
  423. String genre812 = reader.readLine();
  424. System.out.print("\nType album's description:\n> ");
  425. String description812 = reader.readLine();
  426. System.out.print("\nType album's date:\n> ");
  427. String date812 = reader.readLine();
  428.  
  429. String m812 = "type|insert album;artist name|" + artist812 + ";album name|" + album812 + ";genre|" + genre812 + ";description|" + description812 + ";date|" + date812 + ";username|" + name;
  430. h.manage_info(m812);
  431. continue;
  432. case "3":
  433. System.out.print("\nType artist's name:\n> ");
  434. String artist813 = reader.readLine();
  435. System.out.print("\nType album's name:\n> ");
  436. String album813 = reader.readLine();
  437. System.out.print("\nType song's name:\n> ");
  438. String song813 = reader.readLine();
  439. System.out.print("\nType song's duration:\n> ");
  440. String duration813 = reader.readLine();
  441. System.out.print("\nType song's composer:\n> ");
  442. String composer813 = reader.readLine();
  443. System.out.print("\nType song's lyrics:\n> ");
  444. String lyrics813 = reader.readLine();
  445.  
  446. String m813 = "type|insert song;artist name|" + artist813 + ";album name|" + album813 + ";song name|" + song813 + ";duration|" + duration813 + ";compositor|" + composer813 + ";lyrics|" + lyrics813 + ";username|" + name;
  447. h.manage_info(m813);
  448. continue;
  449. default:
  450. continue;
  451. }
  452. case "2":
  453. System.out.println("\n1- Artist");
  454. System.out.println("2- Album");
  455. System.out.print("3- Song\n> ");
  456. String aux82 = sc.next();
  457. switch(aux82){
  458. case "1":
  459. System.out.println("\n1- Artist's name");
  460. System.out.println("2- Artist's description");
  461. System.out.print("3- Artist's working period\n> ");
  462. String aux821 = reader.readLine();
  463.  
  464. System.out.print("\nType artist's name:\n> ");
  465. String artist821 = reader.readLine();
  466. switch(aux821){
  467. case "1":
  468. System.out.print("\nType artist's new name:\n> ");
  469. String newartist8211 = reader.readLine();
  470. String m8211 = "type|change artist;artist name|" + artist821 + ";option|name;new information|" + newartist8211 + ";username|" + name;
  471. h.manage_info(m8211);
  472. continue;
  473. case "2":
  474. System.out.print("\nType artist's new description:\n> ");
  475. String newd8212 = reader.readLine();
  476. String m8212 = "type|change artist;artist name|" + artist821 + ";option|description;new information|" + newd8212 + ";username|" + name;
  477. h.manage_info(m8212);
  478. continue;
  479. case "3":
  480. System.out.print("\nType artist's new working period:\n> ");
  481. String newp8213 = reader.readLine();
  482. String m8213 = "type|change artist;artist name|" + artist821 + ";option|groupPeriod;new information|" + newp8213 + ";username|" + name;
  483. h.manage_info(m8213);
  484. continue;
  485. default:
  486. continue;
  487. }
  488. case "2":
  489. System.out.println("\n1- Album's name");
  490. System.out.println("2- Album's description");
  491. System.out.println("3- Album's genre");
  492. System.out.print("4- Album's date\n> ");
  493. String aux822 = reader.readLine();
  494.  
  495. System.out.print("\nType artist's name:\n> ");
  496. String artist822 = reader.readLine();
  497. System.out.print("\nType album's name:\n> ");
  498. String album822 = reader.readLine();
  499. switch(aux822){
  500. case "1":
  501. System.out.print("\nType album's new name:\n> ");
  502. String newalbum8221 = reader.readLine();
  503. String m8221 = "type|change album;artist name|" + artist822 + ";album name|" + album822 +";option|name;new information|" + newalbum8221 + ";username|" + name;
  504. h.manage_info(m8221);
  505. continue;
  506. case "2":
  507. System.out.print("\nType album's new description:\n> ");
  508. String newdesc8222 = reader.readLine();
  509. String m8222 = "type|change album;artist name|" + artist822 + ";album name|" + album822 +";option|description;new information|" + newdesc8222 + ";username|" + name;
  510. h.manage_info(m8222);
  511. continue;
  512. case "3":
  513. System.out.print("\nType album's new genre:\n> ");
  514. String newgenre8223 = reader.readLine();
  515. String m8223 = "type|change album;artist name|" + artist822 + ";album name|" + album822 +";option|genre;new information|" + newgenre8223 + ";username|" + name;
  516. h.manage_info(m8223);
  517. continue;
  518. case "4":
  519. System.out.print("\nType album's new date:\n> ");
  520. String newdate8224 = reader.readLine();
  521. String m8224 = "type|change album;artist name|" + artist822 + ";album name|" + album822 +";option|date;new information|" + newdate8224 + ";username|" + name;
  522. h.manage_info(m8224);
  523. continue;
  524. default:
  525. continue;
  526. }
  527. case "3":
  528. System.out.println("\n1- Song's name");
  529. System.out.println("2- Song's duration");
  530. System.out.println("3- Songs's composer");
  531. System.out.print("4- Song's lyrics\n> ");
  532. String aux823 = reader.readLine();
  533.  
  534. System.out.print("\nType artist's name:\n> ");
  535. String artist823 = reader.readLine();
  536. System.out.print("\nType album's name:\n> ");
  537. String album823 = reader.readLine();
  538. System.out.print("\nType song's name:\n> ");
  539. String song823 = reader.readLine();
  540. switch(aux823){
  541. case "1":
  542. System.out.print("\nType song's new name:\n> ");
  543. String newsong8231 = reader.readLine();
  544. String m8231 = "type|change song;artist name|" + artist823 + ";album name|" + album823 + ";song name|" + song823 + ";option|name;new information|" + newsong8231 + ";username|" + name;
  545. h.manage_info(m8231);
  546. continue;
  547. case "2":
  548. System.out.print("\nType song's new duration:\n> ");
  549. String newdur8232 = reader.readLine();
  550. String m8232 = "type|change song;artist name|" + artist823 + ";album name|" + album823 + ";song name|" + song823 + ";option|duration;new information|" + newdur8232 + ";username|" + name;
  551. h.manage_info(m8232);
  552. continue;
  553. case "3":
  554. System.out.print("\nType song's new composer:\n> ");
  555. String newcomp8233 = reader.readLine();
  556. String m8233 = "type|change song;artist name|" + artist823 + ";album name|" + album823 + ";song name|" + song823 + ";option|composer;new information|" + newcomp8233 + ";username|" + name;
  557. h.manage_info(m8233);
  558. continue;
  559. case "4":
  560. System.out.print("\nType song's new lyrics:\n> ");
  561. String newlyrics8234 = reader.readLine();
  562. String m8234 = "type|change song;artist name|" + artist823 + ";album name|" + album823 + ";song name|" + song823 + ";option|composer;new lyrics|" + newlyrics8234 + ";username|" + name;
  563. h.manage_info(m8234);
  564. continue;
  565. default:
  566. continue;
  567. }
  568. default:
  569. continue;
  570. }
  571. default:
  572. continue;
  573. }
  574. }
  575. else{
  576. continue;
  577. }
  578. case "7":
  579. if(c.getEditor()){
  580. System.out.print("\nType username:\n> ");
  581. String user9 = reader.readLine();
  582. h.editor(name, user9, "change to editor");
  583. continue;
  584. }
  585. else
  586. continue;
  587. case "0":
  588. h.logout(name);
  589. System.exit(0);
  590. default:
  591. continue;
  592. }
  593. }
  594. }
  595. catch(RemoteException e){
  596. System.out.println("Something went wrong, please try again");
  597. lookup_connection(c, reader, name, password);
  598. }
  599. catch(IOException e){
  600. System.out.println("Exception: " + e);
  601. }
  602. }
  603.  
  604. public static void lookup_connection(Client c, BufferedReader reader, String name, String password){
  605. boolean bool = false;
  606.  
  607. try{
  608. while(true){
  609. h = (RmiServer) Naming.lookup("rmi://localhost:1099/XPTO");
  610. boolean aux = h.test_server();
  611. if(aux){
  612. h.enter(c, name, password, "login");
  613. menu(c, reader, name, password);
  614. break;
  615. }
  616. else{
  617. continue;
  618. }
  619. }
  620. }
  621. catch (Exception e){
  622. System.out.print("");
  623. }
  624. }
  625.  
  626. public static void main(String args[]) {
  627. String a;
  628.  
  629. String password = null;
  630. String name = null;
  631. Client c = null;
  632.  
  633. System.getProperties().put("java.security.policy", "policy.all");
  634. System.setSecurityManager(new RMISecurityManager());
  635.  
  636. InputStreamReader input = new InputStreamReader(System.in);
  637. BufferedReader reader = new BufferedReader(input);
  638. try {
  639. h = (RmiServer) Naming.lookup("rmi://localhost:1099/XPTO");
  640. c = new Client();
  641.  
  642. while(true){
  643. System.out.print("\nType login or register\n> ");
  644. a = reader.readLine();
  645. if(a.equals("login")){
  646. System.out.print("\nWhat is your username?\n> ");
  647. name = reader.readLine();
  648. System.out.print("\nWhat is your password?\n> ");
  649. password = reader.readLine();
  650. h.enter((CClient) c, name, password, "login");
  651. if (message.equals("no")){
  652. System.out.println("\nWrong information, try again");
  653. continue;
  654. }
  655. else if (message.equals("yes")){
  656. System.out.println(c.getEditor());
  657. menu(c, reader, name, password);
  658. }
  659. }
  660. else if(a.equals("register")){
  661. System.out.print("\nWhat is your username?\n> ");
  662. name = reader.readLine();
  663. System.out.print("\nWhat is your password? \n> ");
  664. password = reader.readLine();
  665. h.enter((CClient) c, name, password, "register");
  666. if (message.equals("no")){
  667. System.out.println("Username already exists, try again");
  668. continue;
  669. }
  670. else if (message.equals("yes")){
  671. menu(c, reader, name, password);
  672. }
  673. }
  674. else{
  675. System.out.println("Something went wrong, try again");
  676. continue;
  677. }
  678. }
  679. }
  680. catch (RemoteException e) {
  681. lookup_connection(c, reader, name, password);
  682. }
  683. catch (NotBoundException e) {
  684. System.out.println("Exception: " + e);
  685. }
  686. catch (IOException e){
  687. System.out.println("Exception: " + e);
  688. }
  689. }
  690. }
Advertisement
Add Comment
Please, Sign In to add comment