sonar-openedge icon indicating copy to clipboard operation
sonar-openedge copied to clipboard

Proparse error on empty lines in df. Typically when description has new line.

Open Tranborg opened this issue 2 years ago • 6 comments

Discussed in https://github.com/Riverside-Software/sonar-openedge/discussions/980

Originally posted by Tranborg August 1, 2022 Hi! Proparse of the df-file will crash on this empty line here in this example. Probably Progress dictionary creates those extra empty lines when entering long descriptions on a field in database schema.

ADD FIELD "ActiveTo" OF "AccountingSchema" AS datetime-tz 
  DESCRIPTION "Datetime when this record was updated and replaced by new version data, or deleted.

If this value is ? (N/A) it means it is the latest version"
  FORMAT "9999-99-99 HH:MM:SS+HH:MM"
  INITIAL "?"
  LABEL "Active To"
  POSITION 55
  MAX-WIDTH 12
  COLUMN-LABEL ""
  ORDER 40

Tranborg avatar Aug 01 '22 11:08 Tranborg

Is there any stack trace ? I can't reproduce the issue ; new lines are handled in quoted strings, so that shouldn't be a problem.

gquerret avatar Aug 01 '22 11:08 gquerret

INFO:   No pattern found - Leaving...
        [exec] INFO: Sensor OpenEdgeCodeColorizer [openedge] (done) | time=22709ms
        [exec] INFO: Sensor OpenEdgeDBColorizer [openedge]
        [exec] ERROR: Unable to lex file df/twin360.dfINFO: Sensor OpenEdgeDBColorizer [openedge] (done) | time=269ms
        [exec] INFO: Sensor OpenEdgeSensor [openedge]
        [exec] java.lang.IllegalArgumentException: 59 is not a valid line offset for pointer. File df/twin360.df has 0 character(s) at line 432
        [exec] 	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
        [exec] 	at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:339)
        [exec] 	at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:272)
        [exec] 	at org.sonar.plugins.openedge.sensor.OpenEdgeDBColorizer.highlightFile(OpenEdgeDBColorizer.java:92)
        [exec] 	at org.sonar.plugins.openedge.sensor.OpenEdgeDBColorizer.execute(OpenEdgeDBColorizer.java:57)
        [exec] 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
        [exec] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
        [exec] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
        [exec] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
        [exec] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
        [exec] 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
        [exec] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        [exec] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        [exec] 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:392)
        [exec] 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:388)
        [exec] 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:357)
        [exec] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        [exec] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        [exec] 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:150)
        [exec] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        [exec] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        [exec] 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
        [exec] 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
        [exec] 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        [exec] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        [exec] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        [exec] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        [exec] 	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        [exec] 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        [exec] 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
        [exec] 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        [exec] 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        [exec] 	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        [exec] 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        [exec] 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
        [exec] INFO: Sensor OpenEdgeSensor [openedge] (done) | time=2875ms
        [exec] INFO: Sensor OpenEdgeDBSensor [openedge]
        [exec] INFO: Analyzing df/twin360.df
        [exec] INFO: Sensor OpenEdgeDBSensor [openedge] (done) | time=216ms
        [exec] INFO: Sensor OpenEdgeWarningsSensor [openedge]
        [exec] INFO: Found warning on non-existing file ..\src\Twin\IO\In\Deal\Twin360ApiStpClient.cls
        [exec] INFO: Found warning on non-existing file ..\src\Twin\StaticTool\RateDaysLibrary.cls
        [exec] INFO: 1563 warning files imported
        [exec] INFO: Sensor OpenEdgeWarningsSensor [openedge] (done) | time=159ms
        [exec] INFO: Sensor OpenEdgeProparseSensor [openedge]

Tranborg avatar Aug 01 '22 11:08 Tranborg

And the line 432 is this. Se pic.

image

Tranborg avatar Aug 01 '22 11:08 Tranborg

This is just a warning message, the syntax highlight can't be executed for this file. Can you check if the end of line characters match the platform ? This is the most usual cause of this kind of issue.

gquerret avatar Aug 01 '22 11:08 gquerret

You mean this? Windows; Preferenses; Workspace; New text file line delimiter?

image

Seems right.

When we create the twin360.df from dictionary it is done by this .p code.

... RUN prodict/dump_df.p ("ALL", locSchemaFile, "").

and this is run from DevStudio Run Configuration... hmm Cannot find any new line delimiter...

image

Tranborg avatar Aug 01 '22 12:08 Tranborg

No, just by having a look at the content of the file in Notepad++ (for example), in menu View -> Show symbols -> Show End of line. The EOL symbols have to be consistent through the file, it sometimes happens that the newline character injected by the Data dictionary in multi line descriptions is not consistent.

gquerret avatar Aug 01 '22 12:08 gquerret

Not reproduced.

gquerret avatar Sep 08 '22 15:09 gquerret