long1eu / flutter_i18n

This plugin create a binding between your translations from .arb files and your Flutter app.
Apache License 2.0
251 stars 55 forks source link

Uncaught exception in plugin #91

Closed Lootwig closed 5 years ago

Lootwig commented 5 years ago

Got this error - might be an easy one given the assertion message:

java.lang.Throwable: Assertion failed: Write access is allowed inside write-action only (see com.intellij.openapi.application.Application.runWriteAction())
    at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:180)
    at com.intellij.openapi.application.impl.ApplicationImpl.assertWriteAccessAllowed(ApplicationImpl.java:1283)
    at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.processEvent(PersistentFSImpl.java:686)
    at com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl.createChildDirectory(PersistentFSImpl.java:436)
    at com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry.createChildDirectory(VirtualFileSystemEntry.java:283)
    at eu.long1.flutter.i18n.files.FileHelpers.getResourceFolder(FileHelpers.kt:11)
    at eu.long1.flutter.i18n.files.FileHelpers.getValuesFolder(FileHelpers.kt:15)
    at eu.long1.flutter.i18n.workers.I18nFileGenerator.<init>(I18nFileGenerator.kt:24)
    at eu.long1.flutter.i18n.workers.Initializer$runActivity$$inlined$scheduleAtFixedRate$1$lambda$1.compute(actions.kt:74)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:922)
    at eu.long1.flutter.i18n.workers.Initializer$runActivity$$inlined$scheduleAtFixedRate$1.run(Timer.kt:150)
    at java.base/java.util.TimerThread.mainLoop(Timer.java:556)
    at java.base/java.util.TimerThread.run(Timer.java:506)
acheronian commented 5 years ago

Got the same exception, could be caused by the new flutter plugin release.

Edit: Another error occured after restarting intellij idea

kotlin.KotlinNullPointerException at eu.long1.flutter.i18n.workers.I18nFileGenerator.generate(I18nFileGenerator.kt:42) at eu.long1.flutter.i18n.workers.Initializer$runActivity$$inlined$scheduleAtFixedRate$1$lambda$1.compute(actions.kt:74) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:922) at eu.long1.flutter.i18n.workers.Initializer$runActivity$$inlined$scheduleAtFixedRate$1.run(Timer.kt:150) at java.base/java.util.TimerThread.mainLoop(Timer.java:556) at java.base/java.util.TimerThread.run(Timer.java:506)

noordawod commented 5 years ago

This will be fixed once #98 is merged.

noordawod commented 5 years ago

This is now resolved in v1.1.0. Please upgrade through the Plugins page in your IDE.

acheronian commented 5 years ago

Sadly, the issue has not been resolved yet:

kotlin.KotlinNullPointerException at eu.long1.flutter.i18n.workers.I18nFileGenerator.generate(I18nFileGenerator.kt:57) at eu.long1.flutter.i18n.workers.Initializer$runActivity$$inlined$scheduleAtFixedRate$1$lambda$1$1.compute(actions.kt:74) at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runWriteAction$16(ApplicationImpl.java:1004) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:982) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1004) at eu.long1.flutter.i18n.workers.Initializer$runActivity$$inlined$scheduleAtFixedRate$1$lambda$1.run(Initializer.kt:286) at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:312) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:433) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:416) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:824) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:773) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:412) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:704) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:411) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Using Intellij IDEA 2019.2.3 and Flutter dev 1.10.14

noordawod commented 5 years ago

Thanks for the report, appreciate it. I'm assuming this error is just informative and the plugin succeeds in generating the i18n file, is this correct?

acheronian commented 5 years ago

No, i18n.dart file hasn't changed since the plugin stopped working. Adding fields to the language arb-files does not re-generate i18n.dart file.

noordawod commented 5 years ago

Hmm, I'm stumped. I am still unable to reproduce this behaviour on my IDE...

acheronian commented 5 years ago

Found the issue: Apparently, flutter_i18n at some point stopped parsing country codes for .arb files (e.g. "strings_en_US.arb"). Removed the country codes and the plugin started working as usual.

However, I cannot recall if this was supported at all so, my bad ^^