GrammaticalFramework / GF

Archive of monolithic GF repository until 2018-07-25
http://www.grammaticalframework.org/
Other
189 stars 51 forks source link

Crash while switching between languages. #18

Closed sunilsunny565 closed 7 years ago

sunilsunny565 commented 7 years ago

This is the log

java.lang.RuntimeException: An error occured while executing doInBackground()
                                                                             at android.os.AsyncTask$3.done(AsyncTask.java:304)
                                                                             at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
                                                                             at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
                                                                             at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                             at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                             at java.lang.Thread.run(Thread.java:818)
                                                                          Caused by: org.grammaticalframework.pgf.PGFError: The concrete syntax is not loaded
                                                                             at org.grammaticalframework.pgf.Concr.linearize(Native Method)
                                                                             at com.gftranslation.GFTranslator.translate(GFTranslator.java:368)
                                                                             at com.proxy.businessobject.OfflineTranslate$3.doInBackground(OfflineTranslate.java:391)
                                                                             at com.proxy.businessobject.OfflineTranslate$3.doInBackground(OfflineTranslate.java:383)
                                                                             at android.os.AsyncTask$2.call(AsyncTask.java:292)
                                                                             at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                             at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
                                                                             at java.lang.Thread.run(Thread.java:818) 
krangelov commented 7 years ago

The error says:

The concrete syntax is not loaded

This means that you use a grammar where each concrete language is stored in a different file. In this case you need call:

concr.load("concr file name")

before using that language. Here concr refers to the object corresponding to that language.

На 8.11.2017 г. 6:55 "sunilsunny565" notifications@github.com написа:

This is the log

java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:304) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) Caused by: org.grammaticalframework.pgf.PGFError: The concrete syntax is not loaded at org.grammaticalframework.pgf.Concr.linearize(Native Method) at com.gftranslation.GFTranslator.translate(GFTranslator.java:368) at com.proxy.businessobject.OfflineTranslate$3.doInBackground(OfflineTranslate.java:391) at com.proxy.businessobject.OfflineTranslate$3.doInBackground(OfflineTranslate.java:383) at android.os.AsyncTask$2.call(AsyncTask.java:292) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrammaticalFramework/GF/issues/18, or mute the thread https://github.com/notifications/unsubscribe-auth/ATBZZFCPqmAPWaxydAN_-aLXSyrQF0seks5s0UJBgaJpZM4QV4SV .

sunilsunny565 commented 7 years ago

Thanks for the quick response. Ok,But I am loading concrete syntax on start. The log says

Trying to open gfoffline/App.pgf
gfoffline/App.pgf loaded (608 ms)
Trying to load gfoffline/AppJpn.pgf_c
Trying to load gfoffline/AppEng.pgf_c
gfoffline/AppJpn.pgf_c loaded (940 ms)
gfoffline/AppEng.pgf_c loaded (2227 ms)

And English to Japanese works 1st time, then I switch to Japanese to English which also works just fine. The issue happens when I switch back again to English to Japanese. I have to load the concrete syntax again?.

krangelov commented 7 years ago

Are you sure that you don't unload one of the languages somewhere, or that you accidentally start using another language? I don't know any other reason why that might happen.

On 8 November 2017 at 07:48, sunilsunny565 notifications@github.com wrote:

Thanks for the quick response. Ok,But I am loading concrete syntax on start. The log says

Trying to open gfoffline/App.pgf gfoffline/App.pgf loaded (608 ms) Trying to load gfoffline/AppJpn.pgf_c Trying to load gfoffline/AppEng.pgf_c gfoffline/AppJpn.pgf_c loaded (940 ms) gfoffline/AppEng.pgf_c loaded (2227 ms)

And English to Japanese works 1st time, then I switch to Japanese to English which also works just fine. The issue happens when I switch back again to English to Japanese. I have to load the concrete syntax again?.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GrammaticalFramework/GF/issues/18#issuecomment-342726235, or mute the thread https://github.com/notifications/unsubscribe-auth/ATBZZMkcMcsUKuWcI39eTqfH7OuoyQ9jks5s0U6rgaJpZM4QV4SV .

sunilsunny565 commented 7 years ago

Yes you are right. While setting setTargetLanguage unload of previous concrete syntax is happening,I didn't noticed it. I think I have to handle this myself, anyway thanks for pointing me in right direction.