Zero length string passed to TextLayout constructor #3487

Closed
Corrado972 opened this Issue Jul 20, 2015 · 6 comments

Comments

Projects
None yet
4 participants
@Corrado972

Hello,
I have just run my sketch with Processing v3.0a11 under Windows 7 64 bit.

This row called in draw():
text(testo, myX, myY, myW, myH);

Fail with the error "Zero length string passed to TextLayout constructor" but "testo" isn't empty, it's equal to "Assprz from G5 67509: 5 min ".

With the previous release the execution is without errors.

Bye

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Jul 20, 2015

Member

Works fine here. Please share some code that actually shows the problem.

screen shot 2015-07-20 at 8 11 24 am

Member

benfry commented Jul 20, 2015

Works fine here. Please share some code that actually shows the problem.

screen shot 2015-07-20 at 8 11 24 am

@Corrado972

This comment has been minimized.

Show comment
Hide comment
@Corrado972

Corrado972 Jul 20, 2015

I have a very complex sketch that I cannot post here because it's not public.

The setup() method opens many JDBC connections then, in the end, start a thread that execute many query over the connections.

The draw() method create this string:
String testo = normalizzaTipoJob(info.tipoJob) + ": " + getTempo(info.esecDaMin) + " ";

The two methods normalizzaTipoJob and getTempo returns a string.

In the end of draw() there is the line that cause the error:
text(testo, myX, myY, myW, myH);

The previous line:
String testo = normalizzaTipoJob(info.tipoJob) + ": " + getTempo(info.esecDaMin) + " ";
causes the error, buf if I write instead:
String testo = normalizzaTipoJob(info.tipoJob) + ": " + getTempo(info.esecDaMin);
The execution is ok, so the presence of at least a space in the end of the string cause the error.

I try to semplify the code in a example sketch for you, but I can't reproduce the same error in a more simple sketch.

Very strange!

I have a very complex sketch that I cannot post here because it's not public.

The setup() method opens many JDBC connections then, in the end, start a thread that execute many query over the connections.

The draw() method create this string:
String testo = normalizzaTipoJob(info.tipoJob) + ": " + getTempo(info.esecDaMin) + " ";

The two methods normalizzaTipoJob and getTempo returns a string.

In the end of draw() there is the line that cause the error:
text(testo, myX, myY, myW, myH);

The previous line:
String testo = normalizzaTipoJob(info.tipoJob) + ": " + getTempo(info.esecDaMin) + " ";
causes the error, buf if I write instead:
String testo = normalizzaTipoJob(info.tipoJob) + ": " + getTempo(info.esecDaMin);
The execution is ok, so the presence of at least a space in the end of the string cause the error.

I try to semplify the code in a example sketch for you, but I can't reproduce the same error in a more simple sketch.

Very strange!

@alignedleft

This comment has been minimized.

Show comment
Hide comment
@alignedleft

alignedleft Jul 20, 2015

Member

If you can't reproduce the problem in a simpler sketch, then perhaps the problem is not occurring where you expect. If you can isolate the issue, we can look into it and address it.

Member

alignedleft commented Jul 20, 2015

If you can't reproduce the problem in a simpler sketch, then perhaps the problem is not occurring where you expect. If you can isolate the issue, we can look into it and address it.

@benfry benfry added the cantfix label Jul 27, 2015

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Jul 27, 2015

Member

Closing since I can't reproduce it even after writing a test case myself, and there's nothing we can go on here.

Member

benfry commented Jul 27, 2015

Closing since I can't reproduce it even after writing a test case myself, and there's nothing we can go on here.

@benfry benfry closed this Jul 27, 2015

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Aug 13, 2015

Member

Ran across a version of this and added a fix for 3.0 beta 4.

Member

benfry commented Aug 13, 2015

Ran across a version of this and added a fix for 3.0 beta 4.

@ZachSundberg

This comment has been minimized.

Show comment
Hide comment
@ZachSundberg

ZachSundberg Aug 16, 2015

I don't know if it's a bug or not, but a variation of this problem still exits in the newest beta. It occurs anytime the first character of a string, or the first character after a line break is blank. So:

" the first space is blank"
or
"the space after this break \n is blank"

using trim when passing String variables works in the case of the former, but not the later.

I don't know if it's a bug or not, but a variation of this problem still exits in the newest beta. It occurs anytime the first character of a string, or the first character after a line break is blank. So:

" the first space is blank"
or
"the space after this break \n is blank"

using trim when passing String variables works in the case of the former, but not the later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment