The MySQL database holds about 18K rows in the 'Contatto' table and a few dozen in 'Iscrizione' table. List view of both models do work with no problem, as does Contatto detail view. However when I try to create a new 'Iscrizione' entity by clicking the "Nuovo" button in the 'Iscrizione' list view, I get a window.alert() modal dialog that says "Invalid or unexpected token".
The Eclipse console does not show any exceptions, while the browser console shows this:
Does it work if you change your browser language to English?
Have you a custom controller for Iscrizione? If yes, put it here.
Also put here your own i18n labels and messages.
Try to remove all Iscrizione properties except note. Does it work? if yes, try to put back the properties one by one, until we find the guilty property.
Help others in this forum as I help you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does it work if you change your browser language to English?
no
Have you a custom controller for Iscrizione?
no
Also put here your own i18n labels and messages.
I have none
Try to remove all Iscrizione properties except note. Does it work?
if yes, try to put back the properties one by one, until we find the guilty property.
After those tests I isolated the line of code that causes the problem:
if I comment out that line, the error doesn't show anymore. As soon as I remove the comment and put that line back into the code, the error shows up again.
Last edit: Lucio Crusca 2021-04-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So we can figure out what is the culprit column. Then revise the data for that column looking for a strange character. If you don't find any, create a sample dataset with just 10 records that fails and attach here the records so I couldl revise them. Of course, don't use real names or emails for the sample.
Help others in this forum as I help you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've now cleaned up cognome and email columns and here is the current status:
MariaDB [acearc]>select uuid from Contatto where email like '%>%' or email like '%<%' or email like '%&%' or cognome like '%>%' or cognome like '%<%' or cognome like '%&%';
Empty set (0.031 sec)
However the 'Invalid or unexpected token' error still shows up.
I'm absolutely convinced it's being caused by a problem with my data, but I don't know what to look for after <, > and &. Are there any other characters, such as non-ASCII accented letters or the like, that can cause the error? Manually looking through 17000+ records is not feasible, nor guessing a 10 records subset that contains the problematic data.
Please note that those 17000+ records were imported by means of a LOAD DATA INFILE statement, from a CSV file, that in turn was a backup of a previous (very old) Postgresql database: I don't know if that makes any difference, but I'm sure most of the data didn't go through OX input validation.
Last edit: Lucio Crusca 2021-05-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Are there any other characters, such as non-ASCII accented letters or the like, that can cause the error?
Look for " and '
Look also for [ ] { } ,
Although all the above character should be supported.
through 17000+ records
Such big dataset are not going to be performante with @DescriptionsList. @DescriptionsList only works nicely with small datasets, though this is something we want to improve in the future. The standard html combo (select) has also that problem given it load all the data into the page.
Anyways, I'm interested in solve the issue with your data. If you could put here a file including the CSV for your data, with only the key and the cognom. Beware, in order that the key will not be a official person identifier (like dni), and only include the cognom, so it will be impossible to identify a real person from the data. Attach the file and I will try the find the bad characters.
Help others in this forum as I help you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for you support, but I can't attach the data here, since the problem is with the email field, not cognome (I tried setting to NULL all email values on a copy of my database and the error disappeared, while setting to NULL all cognome it kept showing up).
Now I'm going to look for the other characters you mentioned. If I won't find any, I could send the data to you privately, if you want.
EDIT: I couldn't find any of the characters you mentioned in the email field. Moreover, I checked all values of the email field against a regex that validates RFC 5322 syntax and they are all valid (regex found here).
For the time being I removed the email field from my @DescriptionList, and I can live without it for a good while, but I'd like to see this solved sooner or later, just for the sake of it.
Last edit: Lucio Crusca 2021-05-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just tried using emails in a @DescriptionsList and they work fine for me. Did you try usethe email field alone in the @DescriptionsList? Does it work in that case?
I could send the data to you privately, if you want.
No problem, you can send me the data privately. I'm interested in fix the issue.
Help others in this forum as I help you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a "Contatto" model like this:
Then I have a "Iscrizione" model like this:
The MySQL database holds about 18K rows in the 'Contatto' table and a few dozen in 'Iscrizione' table. List view of both models do work with no problem, as does Contatto detail view. However when I try to create a new 'Iscrizione' entity by clicking the "Nuovo" button in the 'Iscrizione' list view, I get a window.alert() modal dialog that says "Invalid or unexpected token".
The Eclipse console does not show any exceptions, while the browser console shows this:
How do I find the cause?
Hi Lucio,
Does it work if you change your browser language to English?
Have you a custom controller for Iscrizione? If yes, put it here.
Also put here your own i18n labels and messages.
Try to remove all Iscrizione properties except note. Does it work? if yes, try to put back the properties one by one, until we find the guilty property.
Help others in this forum as I help you.
no
no
I have none
After those tests I isolated the line of code that causes the problem:
if I comment out that line, the error doesn't show anymore. As soon as I remove the comment and put that line back into the code, the error shows up again.
Last edit: Lucio Crusca 2021-04-30
Hi Lucio,
Surely the problem is some character in the data that breaks the HTML, perhaps a <. I don't know
Try only with cognome, thus:
Does it fail?
Then only with email:
So we can figure out what is the culprit column. Then revise the data for that column looking for a strange character. If you don't find any, create a sample dataset with just 10 records that fails and attach here the records so I couldl revise them. Of course, don't use real names or emails for the sample.
Help others in this forum as I help you.
I've now cleaned up
cognomeandemailcolumns and here is the current status:MariaDB [acearc]>select uuid from Contatto where email like '%>%' or email like '%<%' or email like '%&%' or cognome like '%>%' or cognome like '%<%' or cognome like '%&%';
Empty set (0.031 sec)
However the 'Invalid or unexpected token' error still shows up.
I'm absolutely convinced it's being caused by a problem with my data, but I don't know what to look for after <, > and &. Are there any other characters, such as non-ASCII accented letters or the like, that can cause the error? Manually looking through 17000+ records is not feasible, nor guessing a 10 records subset that contains the problematic data.
Please note that those 17000+ records were imported by means of a
LOAD DATA INFILEstatement, from a CSV file, that in turn was a backup of a previous (very old) Postgresql database: I don't know if that makes any difference, but I'm sure most of the data didn't go through OX input validation.Last edit: Lucio Crusca 2021-05-25
Hi Lucio:
Look for " and '
Look also for [ ] { } ,
Although all the above character should be supported.
Such big dataset are not going to be performante with @DescriptionsList. @DescriptionsList only works nicely with small datasets, though this is something we want to improve in the future. The standard html combo (select) has also that problem given it load all the data into the page.
Anyways, I'm interested in solve the issue with your data. If you could put here a file including the CSV for your data, with only the key and the cognom. Beware, in order that the key will not be a official person identifier (like dni), and only include the cognom, so it will be impossible to identify a real person from the data. Attach the file and I will try the find the bad characters.
Help others in this forum as I help you.
Thanks for you support, but I can't attach the data here, since the problem is with the
emailfield, notcognome(I tried setting to NULL allemailvalues on a copy of my database and the error disappeared, while setting to NULL allcognomeit kept showing up).Now I'm going to look for the other characters you mentioned. If I won't find any, I could send the data to you privately, if you want.
EDIT: I couldn't find any of the characters you mentioned in the
emailfield. Moreover, I checked all values of theemailfield against a regex that validates RFC 5322 syntax and they are all valid (regex found here).For the time being I removed the email field from my @DescriptionList, and I can live without it for a good while, but I'd like to see this solved sooner or later, just for the sake of it.
Last edit: Lucio Crusca 2021-05-26
Hi Lucio:
I just tried using emails in a @DescriptionsList and they work fine for me. Did you try usethe email field alone in the @DescriptionsList? Does it work in that case?
No problem, you can send me the data privately. I'm interested in fix the issue.
Help others in this forum as I help you.