I wrote a Java program to get JSON list from tumblr. It worked well for 5-6 month but now is giving an error. I am trying to remove 22 useless character from front and 1 semicolon from end.
String input = ("good.tumblr.com");
String urlContent = urlReader("http://"+input+"/api/read/json?type=photo&num=0&start=0" );
urlContent=urlContent.substring(22,urlContent.length()-1);
But I am getting
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -23
at java.lang.String.substring(String.java:1967)
at main.main(main.java:27)
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:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
This is the string i will get
" var tumblr_api_read = {"tumblelog":{"title":"","description":"Live Well. Do Good.","name":"good","timezone":"US\/Pacific","cname":false,"feeds":[]},"posts-start":0,"posts-total":2184,"posts-type":"photo","posts":[]}; "
https://github.com/Shiva7071007/tumloader_java/tree/master/src
link to whole program .its work in the begging but its not working now. code is not optimized as this was my first java code.
urlReader? What doesurlContentlook like after you assign the return value from that function?