Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfBoundsException #2

Closed
satybald opened this issue Nov 15, 2014 · 4 comments
Closed

ArrayIndexOutOfBoundsException #2

satybald opened this issue Nov 15, 2014 · 4 comments

Comments

@satybald
Copy link

When I try to run FTP Client, I get ArrayIndexOutOfBoundsException.

com.intellij.rt.execution.application.AppMain org.learningconcurrency.ch9.FTPClient
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at org.learningconcurrency.ch9.FTPClient$.main(FTPClient.scala:305)
at org.learningconcurrency.ch9.FTPClient.main(FTPClient.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

Process finished with exit code 1

@axel22
Copy link
Member

axel22 commented Nov 15, 2014

This is because you have to set the argument of the FTPServer (which you need to run before your run the client):

https://github.com/axel22/learning-scala-concurrency/blob/master/src/main/scala/org/learningconcurrency/ch9/FTPClient.scala#L305

This will be explained in detail in the book, but I will add some error handling to produce a reasonable error message if you don't specify the server address.

@axel22
Copy link
Member

axel22 commented Nov 17, 2014

More precisely, you should run the server first:

> run 12345

and select the FTPServer program from the list.
Then, you should run the client:

> run 127.0.0.1:12345

and select the FTPClient program from the list.

@satybald
Copy link
Author

Got it! Thank you @axel22 for explanation.

@axel22
Copy link
Member

axel22 commented Nov 18, 2014

Maybe input arguments should be treated with better error messages. I'll fix this in the coming days.

@axel22 axel22 reopened this Nov 18, 2014
@axel22 axel22 closed this as completed in 27257a9 Nov 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants