
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Code("sql") Field - Java Code generation fails
Hi all,
I'm declaring a field in my configuration as "Sql" Code. This field is updated by an @updatable Method.
The rendering in the UI is fine and new lines are visible :
But the generated java code has a bug.
"String literal is not properly closed by a double-quote"
I have tried every thing to avoid this error. "\n", "\\n", "\r\n", "\\r\\n" System.getProperty("line.separator") , char(13) ... but nothing works.
stringBuilderFullQuery
.append("\"")
.append("SELECT ")
.append(" \n")
.append(stringBuilderColumns.toString())
.append(" FROM ")
.append(getValidNamedDBTable(arg1))
.append("\"");
PS : @TextArea works fine, but it is not "user-friendly" when it comes to SQL code.
Thanks.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @safouane BEN MANSOUR ,
simple workaround : replace @code by @TextArea -> works the same w/o syntax highlighting. For pathc download, contact your commercial talend contact.
Otherwise, you can patch it by yourself by updating `org.talend.sdk.component.studio-integration_7.3.1.20210120_1008-patch.jar!/jet_stub/generic/configuration.javajet` with this diff https://github.com/Talend/tdi-studio-se/pull/5257/files
Best regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @safouane BEN MANSOUR ,
This issue rings me a bell...
I fixed something like that in the studio but AFAIR it was for the MEMO_ type widget (so @Code("SQL") also) ... Need to double check this...
What's your env? (ie Studio version and patches applied)
As a workaround, you can put your sql query on one unique line and not multi-lined...
Thanks for the feedback!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi again,
I checked and this issue has been fixed in November 2020 and is available in our monthly patches since `R2020-10` for `maintenance/7.3` and is on `master` (7.4) also.
Best regards.
--
Emmanuel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I confirm that with the Talend TOS V7.4 the code generation does not fail this time when it comes to new lines in sql code.
But I think that the version still unstable because when I execute my job the whole execution fails with at least 3 errors/ugly warnings types:
[statistics] connecting to socket on port 3682
[statistics] connected
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/user1/STUDIO_TALEND_CLOUD/TOS_DI-20210107_1111-V7.4.1M6/configuration/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.12.1/log4j-slf4j-impl-2.12.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/user1/STUDIO_TALEND_CLOUD/TOS_DI-20210107_1111-V7.4.1M6/configuration/.m2/repository/org/talend/sdk/component/slf4j-standard/1.29.0-SNAPSHOT/slf4j-standard-1.29.0-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.talend.sdk.component.runtime.manager.asm.Unsafes (file:/home/user1/STUDIO_TALEND_CLOUD/TOS_DI-20210107_1111-V7.4.1M6/configuration/.m2/repository/org/talend/sdk/component/component-runtime-manager/1.29.0-SNAPSHOT/component-runtime-manager-1.29.0-SNAPSHOT.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of org.talend.sdk.component.runtime.manager.asm.Unsafes
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[statistics] disconnected
Exception in thread "main" java.lang.NoClassDefFoundError: routines/system/DynamicMetadata
at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
at java.base/java.lang.Class.getDeclaredMethod(Class.java:2473)
at org.talend.sdk.component.runtime.record.RecordConverters$MappingMeta.newInstance(RecordConverters.java:529)
at org.talend.sdk.component.runtime.record.RecordConverters.toType(RecordConverters.java:291)
at local_project.test_0_1.test.tSqlForFileInput_1Process(test.java:734)
at local_project.test_0_1.test.runJobInTOS(test.java:1268)
at local_project.test_0_1.test.main(test.java:1115)
Caused by: java.lang.ClassNotFoundException: routines.system.DynamicMetadata
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 8 more
Job test terminé à 15:31 08/03/2021. [Code de sortie = 1]
Best regards.
Safus

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI @safouane BEN MANSOUR
This is a known issue in TOS only products. The issue is not resolved yet but on timeline.
br

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Emmanuel GALLOIS,
Thank you for the info.
Do you know if it is possible to download a patched version of talend for test purposes ?
It is at the moment not possible to ask an update from the support team of talend because that means that my teammates also have to upgrade the product, and we are not ready for this at the moment.
Regards,
Safus

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @safouane BEN MANSOUR ,
simple workaround : replace @code by @TextArea -> works the same w/o syntax highlighting. For pathc download, contact your commercial talend contact.
Otherwise, you can patch it by yourself by updating `org.talend.sdk.component.studio-integration_7.3.1.20210120_1008-patch.jar!/jet_stub/generic/configuration.javajet` with this diff https://github.com/Talend/tdi-studio-se/pull/5257/files
Best regards
