marhali / easy-i18n

This is a IntelliJ IDE based plugin for internationalization. Supports the most common translation file types.
MIT License
80 stars 25 forks source link

Escape quotes issue [inc. IDE report] #241

Open Aspience opened 1 year ago

Aspience commented 1 year ago

Plugin version: 4.4.0 Webstorm version: 2022.2.4

Hi! Big thank you for the great plugin. Very useful and accelerates work :) There is issue when a translation value has the escaped double quotes. Also pay attention to the fact that this is an array. Example: { "foo": [ { "bar": "have a nice \"day\"" } ] } IDE report: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 167 path $.hrefText at de.marhali.easyi18n.io.IOHandler.write(IOHandler.java:134) at de.marhali.easyi18n.DataStore.lambda$saveToPersistenceLayer$1(DataStore.java:78) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023) at de.marhali.easyi18n.DataStore.saveToPersistenceLayer(DataStore.java:76) at de.marhali.easyi18n.InstanceManager.processUpdate(InstanceManager.java:89) at de.marhali.easyi18n.tabs.TableView.lambda$onUpdateData$2(TableView.java:86) at de.marhali.easyi18n.tabs.mapper.TableModelMapper.setValueAt(TableModelMapper.java:111) at java.desktop/javax.swing.JTable.setValueAt(JTable.java:2787) at java.desktop/javax.swing.JTable.editingStopped(JTable.java:4785) at java.desktop/javax.swing.AbstractCellEditor.fireEditingStopped(AbstractCellEditor.java:152) at java.desktop/javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(DefaultCellEditor.java:375) at java.desktop/javax.swing.DefaultCellEditor.stopCellEditing(DefaultCellEditor.java:234) at java.desktop/javax.swing.JTable$GenericEditor.stopCellEditing(JTable.java:5557) at java.desktop/javax.swing.DefaultCellEditor$EditorDelegate.actionPerformed(DefaultCellEditor.java:392) at java.desktop/javax.swing.JTextField.fireActionPerformed(JTextField.java:525) at java.desktop/javax.swing.JTextField.postActionEvent(JTextField.java:740) at java.desktop/javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:856) at java.desktop/javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1810) at java.desktop/javax.swing.JComponent.processKeyBinding(JComponent.java:2950) at java.desktop/javax.swing.JComponent.processKeyBindings(JComponent.java:2998) at java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2912) at java.desktop/java.awt.Component.processEvent(Component.java:6425) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1964) at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:886) at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1166) at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1023) at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:849) at com.intellij.ide.IdeKeyboardFocusManager.lambda$dispatchEvent$0(IdeKeyboardFocusManager.java:48) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105) at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624) at com.intellij.ide.IdeKeyboardFocusManager.dispatchEvent(IdeKeyboardFocusManager.java:48) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4903) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:918) at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:827) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:760) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:450) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:449) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113) at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:447) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:493) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 167 path $.hrefText at com.google.gson.Gson.fromJson(Gson.java:1006) at com.google.gson.Gson.fromJson(Gson.java:956) at com.google.gson.Gson.fromJson(Gson.java:905) at com.google.gson.Gson.fromJson(Gson.java:876) at de.marhali.easyi18n.io.parser.json.JsonArrayMapper.lambda$write$1(JsonArrayMapper.java:26) at de.marhali.easyi18n.io.parser.ArrayMapper.write(ArrayMapper.java:54) at de.marhali.easyi18n.io.parser.json.JsonArrayMapper.write(JsonArrayMapper.java:24) at de.marhali.easyi18n.io.parser.json.JsonMapper.write(JsonMapper.java:63) at de.marhali.easyi18n.io.parser.json.JsonParserStrategy.write(JsonParserStrategy.java:60) at de.marhali.easyi18n.io.IOHandler.write(IOHandler.java:108) ... 66 more Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 167 path $.hrefText at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1597) at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:491) at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:414) at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:725) at com.google.gson.internal.bind.TypeAdapters$28.read(TypeAdapters.java:697) at com.google.gson.internal.bind.TypeAdapters$34$1.read(TypeAdapters.java:917) at com.google.gson.Gson.fromJson(Gson.java:991) ... 75 more