anupam409 / google-api-translate-java

Automatically exported from code.google.com/p/google-api-translate-java
0 stars 0 forks source link

java.lang.Exception: [google-api-translate-java] Error retrieving translation. #104

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi there,

I'm currently running on Windows 7 and using your latest 
google-api-translate-java-0.92.jar, but receiving the following error for which 
there seems to be no resolution. Please help.

There was a problem translating your text
java.lang.Exception: [google-api-translate-java] Error retrieving translation.
    at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:123)
    at com.google.api.translate.Translate.execute(Translate.java:69)
    at org.google.translate.desktop.main.TranslateForm.translateActionPerformed(TranslateForm.java:305)
    at org.google.translate.desktop.main.TranslateForm.access$400(TranslateForm.java:29)
    at org.google.translate.desktop.main.TranslateForm$5.actionPerformed(TranslateForm.java:89)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.IOException: Error writing to server
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:116)
    ... 29 more
Caused by: java.io.IOException: Error writing to server
    at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at com.google.api.GoogleAPI.retrieveJSON(GoogleAPI.java:112)
    ... 29 more

Original issue reported on code.google.com by jasdeepharibhajan on 1 Oct 2010 at 9:27

GoogleCodeExporter commented 9 years ago
Hi.. don't know if it will help you but i think i had the same pb.. and I fixed 
it replacing the name of the site directly by the ip in the 
Translate.setHttpReferrer method.. like this :
Translate.setHttpReferrer("http://x:x:x:x") instead of 
Translate.setHttpReferrer("http:/www.mysite.com")

Good luck..

Original comment by antoine....@gmail.com on 27 Oct 2010 at 11:31

GoogleCodeExporter commented 9 years ago
Hello...
had the same problem and fixed it by analyzing the string...
if it was "" or " " it threw that error. when it encountered that i simply 
bypassed the translate call.

have fun

Original comment by AnDrei...@gmail.com on 28 Oct 2010 at 7:00

GoogleCodeExporter commented 9 years ago

Original comment by rich.mid...@gmail.com on 6 Nov 2010 at 4:51

GoogleCodeExporter commented 9 years ago
Hoe can you bypass the translate call?

Original comment by vasanth....@gmail.com on 15 Mar 2011 at 6:54