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

翻译失败 #771

Closed
Piean opened this issue Jun 3, 2021 · 9 comments
Closed

翻译失败 #771

Piean opened this issue Jun 3, 2021 · 9 comments

Comments

@Piean
Copy link

Piean commented Jun 3, 2021

问题详情

问题描述

有时候会翻译失败,插件报:未知错误
之后使用翻译失败的词语,就一直翻译失败
换其它词可以翻译成功

环境 & 错误日志

  • 插件版本: v3.1.1
  • IDE版本: IntelliJ IDEA 2021.1.2
  • 操作系统版本: Windows 10
  • 错误日志:
    翻译失败: 未知错误

Plugin v3.1.1
IntelliJ IDEA 2021.1.2
Build #IU-211.7442.40, built on June 1, 2021
Runtime version: 11.0.11+9-b1341.57 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
OS: Windows 10 10.0

cn.yiiguxing.plugin.translate.trans.TranslateException: 有道翻译 :: 翻译失败: 未知错误
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:129)
	at cn.yiiguxing.plugin.translate.trans.TranslateService$translate$$inlined$executeOnPooledThread$1.run(Applications.kt:184)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:265)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.LinkageError: loader constraint violation: loader com.intellij.ide.plugins.cl.PluginClassLoader @3de06fd8 wants to load interface kotlin.text.MatchResult. A different interface with the same name was previously loaded by com.intellij.util.lang.PathClassLoader @49dc7102. (kotlin.text.MatchResult is in unnamed module of loader com.intellij.util.lang.PathClassLoader @49dc7102, parent loader 'platform')
	at cn.yiiguxing.plugin.translate.trans.text.YoudaoDictDocument$Factory.blocks(YoudaoDictDocument.kt:294)
	at cn.yiiguxing.plugin.translate.trans.text.YoudaoDictDocument$Factory.getDocument(YoudaoDictDocument.kt:144)
	at cn.yiiguxing.plugin.translate.trans.YoudaoTranslation.toTranslation(YoudaoTranslation.kt:63)
	at cn.yiiguxing.plugin.translate.trans.YoudaoTranslator.parserResult(YoudaoTranslator.kt:109)
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.doTranslate$lambda-3(AbstractTranslator.kt:91)
	at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:531)
	at com.intellij.util.io.HttpRequests.process(HttpRequests.java:513)
	at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:332)
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.doTranslate(AbstractTranslator.kt:88)
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:100)
	... 12 more
@YiiGuxing YiiGuxing added the bug/crash 💥 Uh-oh! label Jun 3, 2021
@YiiGuxing
Copy link
Owner

请问是翻译什么内容导致的?

@Piean
Copy link
Author

Piean commented Jun 3, 2021

@YiiGuxing 这个不是固定的,我暂时也没有发现规律
比如翻译“指标”就会报错
image
加个其它字就可以,比如:“新指标”
image
翻译:saleroom 也报错
image

@YiiGuxing
Copy link
Owner

可以到插件的设置页把本地缓存清除了试试

@Piean
Copy link
Author

Piean commented Jun 4, 2021

好的,我清除缓存再试试。
另外设置里的“最大历史记录长度”修改无效,会自动变回50

@YiiGuxing
Copy link
Owner

Dingtalk_20210604092832

主要是我这边无法复现。。。。这个应该是接口当时返回了异常的内容,解析的时候出错了,这个内容又被插件缓存到了本地,所以你后续的翻译也报异常了。
可以到插件的设置页把本地缓存清除了再试试:
Dingtalk_20210604094208

@Piean
Copy link
Author

Piean commented Jun 4, 2021

是用着用着突然就有词语翻译失败,错误日志都是一样的,我重启之后之前失败的词也能成功,总之就是不确定什么词会失败,什么时候会失败,确实难搞。
另外我初步怀疑有可能和我禁用了Kotlin插件有关系,我先启用然后再使用一段时间看看,谢谢

@YiiGuxing
Copy link
Owner

YiiGuxing commented Jun 4, 2021

是用着用着突然就有词语翻译失败,错误日志都是一样的,我重启之后之前失败的词也能成功,总之就是不确定什么词会失败,什么时候会失败,确实难搞。
另外我初步怀疑有可能和我禁用了Kotlin插件有关系,我先启用然后再使用一段时间看看,谢谢

可能真的是这个问题哦,错误信息说有两相同的接口被尝试加载,所以抛了异常。。。之前没细看还以为解析的时候正则匹配出了异常呢。。。

@tonels
Copy link

tonels commented Jul 2, 2021

我这里也遇到了翻译异常

翻译失败: 未知错误

Plugin v3.1.1
IntelliJ IDEA 2020.3.3
Build #IU-203.7717.56, built on March 15, 2021
Runtime version: 11.0.10+8-b1145.96 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
OS: Windows 10 10.0

cn.yiiguxing.plugin.translate.trans.TranslateException: Google 翻译 :: 翻译失败: 未知错误
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:129)
	at cn.yiiguxing.plugin.translate.trans.TranslateService$translate$$inlined$executeOnPooledThread$1.run(Applications.kt:184)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:270)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.HttpRetryException: cannot retry due to redirection, in streaming mode
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2713)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2699)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1854)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
	at com.intellij.util.io.HttpRequests$RequestImpl.getInputStream(HttpRequests.java:391)
	at com.intellij.util.io.HttpRequests$RequestImpl.readString(HttpRequests.java:461)
	at com.intellij.util.io.HttpRequests$Request.readString(HttpRequests.java:104)
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.doTranslate$lambda-3(AbstractTranslator.kt:90)
	at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:541)
	at com.intellij.util.io.HttpRequests.process(HttpRequests.java:523)
	at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:355)
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.doTranslate(AbstractTranslator.kt:88)
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:100)
	... 12 more

@tonels
Copy link

tonels commented Jul 3, 2021

我这里也遇到了翻译异常

翻译失败: 未知错误

Plugin v3.1.1
IntelliJ IDEA 2020.3.3
Build #IU-203.7717.56, built on March 15, 2021
Runtime version: 11.0.10+8-b1145.96 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
OS: Windows 10 10.0

cn.yiiguxing.plugin.translate.trans.TranslateException: Google 翻译 :: 翻译失败: 未知错误
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:129)
	at cn.yiiguxing.plugin.translate.trans.TranslateService$translate$$inlined$executeOnPooledThread$1.run(Applications.kt:184)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:20)
	at com.intellij.util.RunnableCallable.call(RunnableCallable.java:11)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.call(ApplicationImpl.java:270)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.HttpRetryException: cannot retry due to redirection, in streaming mode
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2713)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2699)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1854)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250)
	at com.intellij.util.io.HttpRequests$RequestImpl.getInputStream(HttpRequests.java:391)
	at com.intellij.util.io.HttpRequests$RequestImpl.readString(HttpRequests.java:461)
	at com.intellij.util.io.HttpRequests$Request.readString(HttpRequests.java:104)
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.doTranslate$lambda-3(AbstractTranslator.kt:90)
	at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:541)
	at com.intellij.util.io.HttpRequests.process(HttpRequests.java:523)
	at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:355)
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.doTranslate(AbstractTranslator.kt:88)
	at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:100)
	... 12 more

第二天早上又好了,可能是当天谷歌翻译允许请求数超了,不给用了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants