MyBatis foreach update can't see all item parameters from collection - foreach

I'm trying to use foreach loop in #Update with my mapper and unexpectedly mybatis has a problem with resolving all parameters from collection. Some details below:
#Update("<script>"
+ "<foreach collection='objects' item='item' separator=';'>"
+ "UPDATE some_table "
+ "SET field_x=#{item.x}, "
+ "field_y=#{item.y} "
+ "WHERE field_z=#{item.z} AND field_a=#{item.a}"
+ "</foreach>"
+ "</script>")
void update(#Param("objects") List<SomeObject> objects);
and:
public class SomeObject {
private String z;
private SomeEnum a;
private BigDecimal x;
private Integer y;
}
method call returned:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_1.dailyAmount', mode=IN, javaType=class java.math.BigDecimal, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #5 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.h2.jdbc.JdbcSQLException: Invalid value "5" for parameter "parameterIndex" [90008-196]
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy33.update(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy43.updateLimits(Unknown Source)
at pl.raiffeisen.ekd.blik.core.persistence.DataProvider.updateLimits(DataProvider.java:76)
at pl.raiffeisen.ekd.blik.api.rest.settings.SettingsController.updateLimits(SettingsController.java:136)
at pl.raiffeisen.ekd.blik.test.rest.SettingsControllerTest.testUpdateLimitsSuccessPath(SettingsControllerTest.java:532)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_1.dailyAmount', mode=IN, javaType=class java.math.BigDecimal, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #5 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.h2.jdbc.JdbcSQLException: Invalid value "5" for parameter "parameterIndex" [90008-196]
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:89)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:93)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:64)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 38 more
Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #5 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.h2.jdbc.JdbcSQLException: Invalid value "5" for parameter "parameterIndex" [90008-196]
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:55)
at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:87)
... 50 more
Caused by: org.h2.jdbc.JdbcSQLException: Invalid value "5" for parameter "parameterIndex" [90008-196]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.getInvalidValueException(DbException.java:228)
at org.h2.jdbc.JdbcPreparedStatement.setParameter(JdbcPreparedStatement.java:1444)
at org.h2.jdbc.JdbcPreparedStatement.setBigDecimal(JdbcPreparedStatement.java:384)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:67)
at com.sun.proxy.$Proxy58.setBigDecimal(Unknown Source)
at org.apache.ibatis.type.BigDecimalTypeHandler.setNonNullParameter(BigDecimalTypeHandler.java:32)
at org.apache.ibatis.type.BigDecimalTypeHandler.setNonNullParameter(BigDecimalTypeHandler.java:27)
at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:53)
... 51 more
after debugging I saw this: (at: org.h2.jdbc.JdbcPreparedStatement:1002)
this = prep19: UPDATE some_table SET field_x=?, field_y=? WHERE field_z=? AND field_a=? ;
UPDATE transaction_limit SET field_x=?, field_y=? WHERE field_z=? AND field_a=? ;
UPDATE transaction_limit SET field_x=?, field_y=? WHERE field_z=? AND type=? ;
{1: 250.00, 2: 1, 3: 'qwerty123', 4: 'VALUE1'}
It should be something like this: (example values)
{1: 250.00, 2: 1, 3: 'qwerty123', 4: 'VALUE1',
5: 750.00, 6: 4, 7: 'qwerty123', 8: 'VALUE2',
9: 500.00, 10: 3, 11: 'qwerty123', 12: 'VALUE3'}
Could anyone tell me why there is only one object mapped from list instead of all three (passed 3 element list to method)?

I have resolved this issue. Database H2 obviously doesn't support foreach script. With PostgreSQL everything is ok.

Related

java.lang.NoClassDefFoundError: io/confluent/connect/avro/AvroConverterConfig

kafka2.12-2.4.0 confluent5.4.1
I am trying to use Confluent's Schema-register.
But when I start schema-register and connect-Distributed.
Connect logs did not report errors.
connect-avro-distributed.properties
key.converter=io.confluent.connect.avro.AvroConverter
key.converter.schema.registry.url=http://k2:8081
value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schema.registry.url=http://k2:8081
internal.key.converter=org.apache.kafka.connect.json.JsonConverter
internal.value.converter=org.apache.kafka.connect.json.JsonConverter
internal.key.converter.schemas.enable=false
internal.value.converter.schemas.enable=false
plugin.path=/usr/local/tools/confluent-5.4.1/share/java,/usr/local/tools/kafka/kafka_2.12-2.4.0/plugin
I have configured the confluent jar address so that connect can find the class. (plugin.path)
But when I POST the conector request.
{
"name": "dbz-mysql-avro-connector",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "xx.xx.xx.xx",
"database.port": "3306",
"database.user": "debezium",
"database.history.kafka.topic": "dbhistory.debezium.mysql.avro",
"database.password": "123456",
"database.server.id": "184124",
"database.server.name": "debezium",
"key.converter": "io.confluent.connect.avro.AvroConverter",
"value.converter": "io.confluent.connect.avro.AvroConverter",
"key.converter.schema.registry.url": "http://k2:8081",
"value.converter.schema.registry.url": "http://k2:8081",
"table.whitelist": "debeziumdb.hosttable",
"database.history.kafka.bootstrap.servers": "k1:9092,k2:9092,k3:9092"
}
}
Throw the Exception.
[2020-04-23 10:37:00,064] INFO Creating task dbz-mysql-avro-connector-0 (org.apache.kafka.connect.runtime.Worker:419)
[2020-04-23 10:37:00,065] INFO ConnectorConfig values:
config.action.reload = restart
connector.class = io.debezium.connector.mysql.MySqlConnector
errors.log.enable = false
errors.log.include.messages = false
errors.retry.delay.max.ms = 60000
errors.retry.timeout = 0
errors.tolerance = none
header.converter = null
key.converter = class io.confluent.connect.avro.AvroConverter
name = dbz-mysql-avro-connector
tasks.max = 1
transforms = []
value.converter = class io.confluent.connect.avro.AvroConverter
(org.apache.kafka.connect.runtime.ConnectorConfig:347)
[2020-04-23 10:37:00,065] INFO EnrichedConnectorConfig values:
config.action.reload = restart
connector.class = io.debezium.connector.mysql.MySqlConnector
errors.log.enable = false
errors.log.include.messages = false
errors.retry.delay.max.ms = 60000
errors.retry.timeout = 0
errors.tolerance = none
header.converter = null
key.converter = class io.confluent.connect.avro.AvroConverter
name = dbz-mysql-avro-connector
tasks.max = 1
transforms = []
value.converter = class io.confluent.connect.avro.AvroConverter
(org.apache.kafka.connect.runtime.ConnectorConfig$EnrichedConnectorConfig:347)
[2020-04-23 10:37:00,067] INFO TaskConfig values:
task.class = class io.debezium.connector.mysql.MySqlConnectorTask
(org.apache.kafka.connect.runtime.TaskConfig:347)
[2020-04-23 10:37:00,067] INFO Instantiated task dbz-mysql-avro-connector-0 with version 1.1.0.Final of type io.debezium.connector.mysql.MySqlConnectorTask (org.apache.kafka.connect.runtime.Worker:434)
[2020-04-23 10:37:00,067] ERROR Failed to start task dbz-mysql-avro-connector-0 (org.apache.kafka.connect.runtime.Worker:470)
java.lang.NoClassDefFoundError: io/confluent/connect/avro/AvroConverterConfig
at io.confluent.connect.avro.AvroConverter.configure(AvroConverter.java:61)
at org.apache.kafka.connect.runtime.isolation.Plugins.newConverter(Plugins.java:293)
at org.apache.kafka.connect.runtime.Worker.startTask(Worker.java:440)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.startTask(DistributedHerder.java:1140)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.access$1700(DistributedHerder.java:125)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder$13.call(DistributedHerder.java:1155)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder$13.call(DistributedHerder.java:1151)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
[2020-04-23 10:37:00,071] INFO [Worker clientId=connect-1, groupId=connect-cluster] Finished starting connectors and tasks (org.apache.kafka.connect.runtime.distributed.DistributedHerder:1125)
All jars are in this directory.
Now what can I do to allow the class to be introduced, or does the version of confluent not exist in the class?
Thanks.
I finally solved this exception.
I did not use the confluent platform, just installed the schema-registry component.
To be precise, I only installed the community version and only activated the schema-registry component.
Then I downloaded the Avro jar package on the official website, and finally put it in the plugin completely, and started the connect successfully.
Confluent Avro jar address
And, I executed the following statement so that it can be read.
export CLASSPATH=/usr/local/tools/kafka/kafka_2.12-2.4.0/plugin/*
Looks like your kafka-connect-avro-converter is not compatible with other confluent jars. your Q does not list the kafka-connect-avro-converter jar as well. Can you add the correct version jar of kafka-connect-avro-converter in your classpath.

Xtext: quickfix give an ConcurrentModificationException Exception

Writing a quickfix routing using the semantic model to fix and error, a ConcurrentModificationException is created:
org.eclipse.emf.common.util.WrappedException: java.util.ConcurrentModificationException
at org.eclipse.xtext.ui.editor.quickfix.IssueResolution.apply(IssueResolution.java:78)
at org.eclipse.xtext.ui.editor.quickfix.QuickAssistCompletionProposal.apply(QuickAssistCompletionProposal.java:36)
...
The method implemented:
#Fix(DslValidator.INVALID_NORMALISED_FLOW)
def fixNormalised_ParameterDeclarations(Issue issue, IssueResolutionAcceptor acceptor) {
acceptor.accept(issue, 'Normalize the parameters', 'Capitalize the name.', 'upcase.png') [ element, context |
var param = element as ParameterDeclarations
//var index_s = issue.data // index provided from the validator
var index = 1 // dummy index
for (name : param.declare.get(index).identifier) {
param.declare.get(index - 1).identifier.add(name)
}
param.declare.drop(index)
]
}
The input syntax look like a:int, b:int and must be converted to a, b:int where
ParameterDeclarations:
(
declare+=VariableDeclare
(',' declare+=VariableDeclare)*
) | (
connection=ConnectionName
) | (
not_connected?='void'?
);
VariableDeclare:
identifier+=VariableName (',' identifier+=VariableName)* ':' type=Type;
In the syntax a and b are instances of VariableName and int of Type.
How do I resolve the exception?
Updates:
Stack trace:
eclipse.buildId=4.7.3.M20180301-0715
java.version=1.8.0_161
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_ZA
Framework arguments: -product org.eclipse.platform.ide
Command-line arguments: -product org.eclipse.platform.ide -data /home/johan/workspace/sofl_dsl_2018_April/../runtime-EclipseXtext -dev file:/home/johan/workspace/sofl_dsl_2018_April/.metadata/.plugins /org.eclipse.pde.core/Launch Runtime Eclipse/dev.properties -os linux -ws gtk -arch x86_64
org.eclipse.ui
Error
Sun Apr 08 18:29:26 SAST 2018
Unhandled event loop exception
org.eclipse.emf.common.util.WrappedException: java.util.ConcurrentModificationException
at org.eclipse.xtext.ui.editor.quickfix.IssueResolution.apply(IssueResolution.java:78)
at org.eclipse.xtext.ui.editor.quickfix.QuickAssistCompletionProposal.apply(QuickAssistCompletionProposal.java:36)
at org.eclipse.xtext.ui.editor.hover.AnnotationWithQuickFixesHover$AnnotationInformationControl.apply(AnnotationWithQuickFixesHover.java:536)
at org.eclipse.xtext.ui.editor.hover.AnnotationWithQuickFixesHover$AnnotationInformationControl.access$2(AnnotationWithQuickFixesHover.java:513)
at org.eclipse.xtext.ui.editor.hover.AnnotationWithQuickFixesHover$AnnotationInformationControl$5.widgetSelected(AnnotationWithQuickFixesHover.java:507)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5348)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374)
at org.eclipse.swt.widgets.Widget.sendSelectionEvent(Widget.java:1488)
at org.eclipse.swt.widgets.Link.gtk_button_release_event(Link.java:384)
at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1957)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:6193)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5608)
at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9282)
at org.eclipse.swt.widgets.Display.eventProc(Display.java:1328)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2116)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4181)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Caused by: java.util.ConcurrentModificationException
at org.eclipse.emf.common.util.AbstractEList$EIterator.checkModCount(AbstractEList.java:760)
at org.eclipse.emf.common.util.AbstractEList$EIterator.doNext(AbstractEList.java:714)
at org.eclipse.emf.common.util.AbstractEList$EIterator.next(AbstractEList.java:694)
at tuks.sofl.ui.quickfix.DslQuickfixProvider.lambda$0(DslQuickfixProvider.java:41)
at org.eclipse.xtext.ui.editor.model.edit.SemanticModificationWrapper$1.process(SemanticModificationWrapper.java:36)
at org.eclipse.xtext.ui.editor.model.edit.SemanticModificationWrapper$1.process(SemanticModificationWrapper.java:1)
at org.eclipse.xtext.util.concurrent.IUnitOfWork$Void.exec(IUnitOfWork.java:37)
at org.eclipse.xtext.ui.editor.model.edit.ReconcilingUnitOfWork.exec(ReconcilingUnitOfWork.java:56)
at org.eclipse.xtext.ui.editor.model.edit.ReconcilingUnitOfWork.exec(ReconcilingUnitOfWork.java:1)
at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:91)
at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.modify(XtextDocument.java:428)
at org.eclipse.xtext.ui.editor.model.XtextDocument.internalModify(XtextDocument.java:162)
at org.eclipse.xtext.ui.editor.model.XtextDocument.modify(XtextDocument.java:155)
at org.eclipse.xtext.ui.editor.model.edit.SemanticModificationWrapper.apply(SemanticModificationWrapper.java:32)
at org.eclipse.xtext.ui.editor.quickfix.IssueResolution.apply(IssueResolution.java:76)
... 42 more
Making a copy of the list (the correct way) and use the right method to remove an element in a list:
#Fix(DslValidator.INVALID_NORMALISED_FLOW)
def fixNormalised_ParameterDeclarations(Issue issue, IssueResolutionAcceptor acceptor) {
acceptor.accept(issue, 'Normalize the parameters', 'Capitalize the name.', 'upcase.png') [ element, context |
var param = element as ParameterDeclarations
var index = 1 // dummy index
val copier = new EcoreUtil.Copier();
var names_to_add = copier.copyAll(param.declare.get(index).identifier)
//for (name : param.declare.get(index).identifier) {
for (name : names_to_add) {
param.declare.get(index - 1).identifier.add(name)
}
param.declare.remove(index) // Also fix here use remove and not drop
]
}

groovy.lang.MissingMethodException: No signature of method: com.x.License.add() is applicable for argument types: (com.x.License) values

I'm using a scheduled job to retrieve the licenses every so often. When I retrieve the licenses for each license I want to add that license to a hashmap per account. In the hashmap I have an Account and a list of Licenses. For each license I try to check if there already is a list of Licenses in the hashmap, if there isn't I make a new list and that works fine. But if there is a list I try to add it to that list and that where it throws an error for some reason
licenses.each{license->
List<License> licensesPerAccount = accountLicenseMap.get(license.account)
log.info("initial licenseperaccount " + licensesPerAccount)
if(licensesPerAccount == null) {
accountLicenseMap.put(license.account, license as List<License>)
} else{
log.info("licenseperaccount in else is " + licensesPerAccount)
licensesPerAccount.push(license)
log.info("licenseperaccount now is " + licensesPerAccount)
accountLicenseMap.put(license.account, licensesPerAccount)
}
}
This is the error it throws:
ERROR 2017-12-27 10:12:59,045 grails.plugins.quartz.listeners.ExceptionPrinterJobListener - Exception occurred in job: Grails Job
org.quartz.JobExecutionException: groovy.lang.MissingMethodException: No signature of method: com.x.License.add() is applicable for argument types: (com.x.License) values: [com.x.License : 10]
Possible solutions: any(), find(com.x.License), any(groovy.lang.Closure), wait(), last(), save()
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:111)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: groovy.lang.MissingMethodException: No signature of method: com.x.License.add() is applicable for argument types: (com.x.License) values: [com.x.License : 10]
Possible solutions: any(), find(com.x.License), any(groovy.lang.Closure), wait(), last(), save()
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoMetaMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:253)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.call(PogoMetaMethodSite.java:71)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at com.x.NewLicenseJob$_execute_closure1$$EQezpeTI.doCall(NewLicenseJob.groovy:32)
at sun.reflect.GeneratedMethodAccessor629.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.ri.ReloadedTypeInvoker$2.invoke(ReloadedTypeInvoker.java:133)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1461)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
at groovy.lang.Closure.call(Closure.java:426)
at com.x.NewLicenseJob$_execute_closure1.call(NewLicenseJob.groovy)
at groovy.lang.Closure.call(Closure.java:442)
at com.x.NewLicenseJob$_execute_closure1.call(NewLicenseJob.groovy)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2056)
at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at com.x.NewLicenseJob$$EQezpeT2.execute(NewLicenseJob.groovy:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springsource.loaded.ri.ReloadedTypeInvoker$2.invoke(ReloadedTypeInvoker.java:133)
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1461)
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:104)
... 2 common frames omitted
And this is what it logs:
INFO 2017-12-27 10:12:59,029 grails.app.jobs.com.x.NewLicenseJob - initial licenseperaccount null
Hibernate: select account0_.id as id1_4_0_, account0_.approve_hours_by_manager as approve_2_4_0_, account0_.brand_id as brand_id3_4_0_, account0_.check_tags as check_ta4_4_0_, account0_.checkin_at_work_module as checkin_5_4_0_, account0_.cj1_export as cj6_4_0_, account0_.company_id as company_7_4_0_, account0_.csv_import as csv_impo8_4_0_, account0_.default_date_pattern as default_9_4_0_, account0_.default_date_time_pattern as default10_4_0_, account0_.default_time_pattern as default11_4_0_, account0_.default_time_zone as default12_4_0_, account0_.default_view as default13_4_0_, account0_.deleted as deleted14_4_0_, account0_.display_as_decimal as display15_4_0_, account0_.instant_feedback as instant16_4_0_, account0_.language as languag17_4_0_, account0_.match_registration_hours as match_r18_4_0_, account0_.payroll_hours as payroll19_4_0_, account0_.project_tags as project20_4_0_, account0_.separate_date as separat21_4_0_, account0_.show_charts as show_ch22_4_0_, account0_.templa_link as templa_23_4_0_, account0_.vip_export as vip_exp24_4_0_ from account account0_ where account0_.id=?
Hibernate: select company0_.id as id1_14_0_, company0_.account_id as account_2_14_0_, company0_.address as address3_14_0_, company0_.city as city4_14_0_, company0_.cocnumber as cocnumbe5_14_0_, company0_.country as country6_14_0_, company0_.deleted as deleted7_14_0_, company0_.emailaddress as emailadd8_14_0_, company0_.logo_url as logo_url9_14_0_, company0_.name as name10_14_0_, company0_.phonenumber as phonenu11_14_0_, company0_.province as provinc12_14_0_, company0_.vatnumber as vatnumb13_14_0_, company0_.website as website14_14_0_, company0_.zipcode as zipcode15_14_0_ from company company0_ where company0_.id=?
INFO 2017-12-27 10:12:59,045 grails.app.jobs.com.x.NewLicenseJob - initial licenseperaccount null
INFO 2017-12-27 10:12:59,045 grails.app.jobs.com.x.NewLicenseJob - initial licenseperaccount [com.x.License : 9]
INFO 2017-12-27 10:12:59,045 grails.app.jobs.com.x.NewLicenseJob - licenseperaccount in else is [com.x.License : 9]
I fixed it by creating the list as follows:
List<License> licenseList = []
licenseList << license
accountLicenseMap.put(license.account, licenseList)
Instead of doing accountLicenseMap.put(license.account, license as List<License>)

Update query in Neo4j 2.2.3 error

We have a query that updates relationship props :
MATCH (body_id:BodyId{body_id : 126414})<-[to_body_id:TO_BODY_ID{end : 99999999999999}]-(body:Body)
-[body_to_target:BODY_TO_TARGET{end : 99999999999999}]-(target:Target)
-[to_target_id:TO_TARGET_ID{end : 99999999999999}]->(target_id:TargetId{target_id : 126414})
WHERE ((id(body) = 28888220))
with body_to_target
SET body_to_target.start = 1434535407147
And sometimes we get this error:
Neo.DatabaseError.Statement.ExecutionFailure: java.lang.Long cannot be
cast to org.neo4j.index.impl.lucene.RelationshipId
A piece of stack when running from Java:
Caused by: java.lang.RuntimeException: Error executing cypher statement(s) [{code=Neo.DatabaseError.Statement.ExecutionFailure, message=java.lang.Long cannot be cast to org.neo4j.index.impl.lucene.RelationshipId, stackTrace=java.lang.ClassCastException: java.lang.Long cannot be cast to org.neo4j.index.impl.lucene.RelationshipId
at org.neo4j.index.impl.lucene.RelationshipId.equals(RelationshipId.java:43)
at java.util.HashMap.removeNode(HashMap.java:819)
at java.util.HashMap.remove(HashMap.java:798)
at java.util.HashSet.remove(HashSet.java:235)
at org.neo4j.index.impl.lucene.ExactTxData.remove(ExactTxData.java:158)
at org.neo4j.index.impl.lucene.TxDataHolder.remove(TxDataHolder.java:48)
at org.neo4j.index.impl.lucene.LuceneTransactionState.insert(LuceneTransactionState.java:86)
at org.neo4j.index.impl.lucene.LuceneTransactionState.add(LuceneTransactionState.java:41)
at org.neo4j.index.impl.lucene.LuceneIndex$RelationshipIndex.addRelationship(LuceneIndex.java:452)
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations$3.visit(StateHandlingStatementOperations.java:1379)
at org.neo4j.kernel.impl.api.store.CacheLayer.relationshipVisit(CacheLayer.java:489)
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipVisit(StateHandlingStatementOperations.java:1238)
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipAddToLegacyIndex(StateHandlingStatementOperations.java:1373)
at org.neo4j.kernel.impl.api.OperationsFacade.relationshipAddToLegacyIndex(OperationsFacade.java:881)
at org.neo4j.kernel.impl.coreapi.LegacyIndexProxy$Type$2.add(LegacyIndexProxy.java:169)
at org.neo4j.kernel.impl.coreapi.LegacyIndexProxy.internalAdd(LegacyIndexProxy.java:517)
at org.neo4j.kernel.impl.coreapi.LegacyIndexProxy.add(LegacyIndexProxy.java:383)
at org.neo4j.kernel.impl.coreapi.AbstractAutoIndexerImpl.propertyChanged(AbstractAutoIndexerImpl.java:70)
at org.neo4j.kernel.impl.api.LegacyPropertyTrackers.relationshipChangeStoreProperty(LegacyPropertyTrackers.java:98)
at org.neo4j.kernel.impl.api.StateHandlingStatementOperations.relationshipSetProperty(StateHandlingStatementOperations.java:648)
at org.neo4j.kernel.impl.api.ConstraintEnforcingEntityOperations.relationshipSetProperty(ConstraintEnforcingEntityOperations.java:171)
at org.neo4j.kernel.impl.api.LockingStatementOperations.relationshipSetProperty(LockingStatementOperations.java:340)
at org.neo4j.kernel.impl.api.OperationsFacade.relationshipSetProperty(OperationsFacade.java:665)
at org.neo4j.cypher.internal.spi.v2_2.TransactionBoundQueryContext$RelationshipOperations.setProperty(TransactionBoundQueryContext.scala:216)
at org.neo4j.cypher.internal.compiler.v2_2.spi.DelegatingOperations.setProperty(DelegatingQueryContext.scala:126)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.org$neo4j$cypher$internal$compatibility$ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$super$setProperty(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$setProperty$1.apply$mcV$sp(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$setProperty$1.apply(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations$$anonfun$setProperty$1.apply(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext.org$neo4j$cypher$internal$compatibility$ExceptionTranslatingQueryContext$$translateException(ExceptionTranslatingQueryContext.scala:182)
at org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContext$ExceptionTranslatingOperations.setProperty(ExceptionTranslatingQueryContext.scala:151)
at org.neo4j.cypher.internal.compiler.v2_2.spi.UpdateCountingQueryContext$CountingOps.setProperty(UpdateCountingQueryContext.scala:132)
at org.neo4j.cypher.internal.compiler.v2_2.mutation.PropertySetAction.exec(PropertySetAction.scala:52)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.ExecuteUpdateCommandsPipe.org$neo4j$cypher$internal$compiler$v2_2$pipes$ExecuteUpdateCommandsPipe$$exec(ExecuteUpdateCommandsPipe.scala:56)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.ExecuteUpdateCommandsPi$$$$3fd0ddfab96df657454927b510aaae$$$$ands$1$$anonfun$apply$2.apply(ExecuteUpdateCommandsPipe.scala:45)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.ExecuteUpdateCommandsPi$$$$3fd0ddfab96df657454927b510aaae$$$$ands$1$$anonfun$apply$2.apply(ExecuteUpdateCommandsPipe.scala:45)
at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)
at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.EmptyResultPipe.internalCreateResults(EmptyResultPipe.scala:29)
at org.neo4j.cypher.internal.compiler.v2_2.pipes.PipeWithSource.createResults(Pipe.scala:122)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.DefaultExecutionResultBuilderFactory$ExecutionWorkflowBuilder.createResults(DefaultExecutionResultBuilderFactory.scala:92)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.DefaultExecutionResultBuilderFactory$ExecutionWorkflowBuilder.build(DefaultExecutionResultBuilderFactory.scala:64)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:121)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:105)
at org.neo4j.cypher.internal.compiler.v2_2.executionplan.ExecutionPlanBuilder$$anon$1.run(ExecutionPlanBuilder.scala:69)
at org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$ExecutionPlanWrapper$$anonfun$run$1.apply(CompatibilityFor2_2.scala:173)
at org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$ExecutionPlanWrapper$$anonfun$run$1.apply(CompatibilityFor2_2.scala:173)
at org.neo4j.cypher.internal.compatibility.exceptionHandlerFor2_2$.runSafely(CompatibilityFor2_2.scala:105)
at org.neo4j.cypher.internal.compatibility.CompatibilityFor2_2$ExecutionPlanWrapper.run(CompatibilityFor2_2.scala:172)
at org.neo4j.cypher.internal.PreparedPlanExecution.execute(PreparedPlanExecution.scala:28)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:108)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:102)
at org.neo4j.cypher.javacompat.internal.ServerExecutionEngine.executeQuery(ServerExecutionEngine.java:61)
at org.neo4j.server.rest.transactional.TransactionHandle.executeStatements(TransactionHandle.java:327)
at org.neo4j.server.rest.transactional.TransactionHandle.execute(TransactionHandle.java:258)
at org.neo4j.server.rest.transactional.TransactionHandle.execute(TransactionHandle.java:103)
at org.neo4j.server.rest.web.TransactionalService$1.write(TransactionalService.java:192)
at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:71)
at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:57)
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:800)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540)
at java.lang.Thread.run(Thread.java:745)
}]
at org.neo4j.jdbc.rest.StreamingParser.handleErrors(StreamingParser.java:359)
at org.neo4j.jdbc.rest.StreamingParser.skipTo(StreamingParser.java:333)
at org.neo4j.jdbc.rest.StreamingParser.nextResult(StreamingParser.java:148)
at org.neo4j.jdbc.rest.StreamingParser$2.hasNext(StreamingParser.java:283)
at org.neo4j.jdbc.rest.TransactionalQueryExecutor.executeQuery(TransactionalQueryExecutor.java:209)
at org.neo4j.jdbc.Neo4jConnection.executeQuery(Neo4jConnection.java:388)
... 8 more
How can we solve this

XText can not insert line before current quickfix point (XText version 2.9)

In my Xtext project I want to use quickfix to insert a new line before the current line for the missing cross-reference.But it gives following exception.
!ENTRY org.eclipse.core.jobs 4 2 2015-06-02 17:22:05.616
!MESSAGE An internal error occurred during: "Select and reveal referenced object".
!STACK 0
java.lang.IllegalArgumentException: The feature 'content' is not a valid feature
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eStructuralFeature(BasicEObjectImpl.java:733)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eObjectForURIFragmentSegment(BasicEObjectImpl.java:551)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:766)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.getEObject(ResourceImpl.java:742)
at org.eclipse.xtext.resource.XtextResource.access$1(XtextResource.java:1)
at org.eclipse.xtext.resource.XtextResource$1.getEObject(XtextResource.java:115)
at org.eclipse.xtext.resource.DefaultFragmentProvider.getEObject(DefaultFragmentProvider.java:28)
at org.eclipse.xtext.resource.XtextResource.basicGetEObject(XtextResource.java:346)
at org.eclipse.xtext.resource.XtextResource.getEObject(XtextResource.java:332)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:235)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener.findEObjectByURI(LanguageSpecificURIEditorOpener.java:159)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener$2.process(LanguageSpecificURIEditorOpener.java:125)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener$2.process(LanguageSpecificURIEditorOpener.java:1)
at org.eclipse.xtext.util.concurrent.IUnitOfWork$Void.exec(IUnitOfWork.java:37)
at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:121)
at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.internalReadOnly(XtextDocument.java:520)
at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.readOnly(XtextDocument.java:492)
at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:133)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener.selectAndReveal(LanguageSpecificURIEditorOpener.java:121)
at org.eclipse.xtext.ui.editor.LanguageSpecificURIEditorOpener$1.run(LanguageSpecificURIEditorOpener.java:88)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
My Code is very simple liking this:
acceptor.accept(issue, "Create label", "Create a new jump label", null) [ element, context |
if (element instanceof ContinueCommand) {
var lineNum = issue.lineNumber
var doc = context.xtextDocument
// If use doc.getLineOffset(lineNum). It works and inserts newline after current line.
var offset = doc.getLineOffset(lineNum-1)
var id = doc.get(issue.offset, issue.length)
var toInsert = "!" + id + " : comment\n"
doc.replace(offset, 0, toInsert)
}
]
I tried it in other quickfix methods (not for cross-references). It works good. I use xtext version 2.9.
Has anybody the same problem?

Resources