Android Question java.lang.string

drgottjr

Expert
Licensed User
Longtime User
i was able to cause this:
"[Java.lang.string"
to be embedded in a string that i piece together in my app. no error thrown, nothing appeared in the log.
i'm wondering if anyone can think of some reason - just off the top of their head - how this could
occur. in the old days i would start thinking about a buffer or stack overflow. but between the basic
wrapper and underlying native calls, i wouldn't even know where to begin. it starts with a "[" the "J" was definitely capital; i can't swear the "s" in string was lower case. no closing "]"

at first i thought it was an anomaly with the emulator, but i was able to make it occur again with the
same input. at the time, some other issues were more important, so i let it slide.

in the app, a user inputs a search term. the app tries to find it in a database. if it can't find an exact match, it follows a series of rules to massage the search term, either by breaking it up into chunks and/or searching for similar terms. at the end - regardless of success, if any - it pieces what it found back together and displays the result, as a string.

so, if the result, after massaging and breaking up and piecing back together is supposed to be:
"foo" & " " & "bar",
what i see on the screen, under very specific circumstances which i cannot for the moment duplicate, would be "foo [Java.lang.string bar". the app then continues as if nothing occurred.

it only occurs with a long search term (7-8 words) and if one or more terms requires some kind of massage for a match. searches for up to 5 words in the term can be handled without this occurring (after 1000's of searches), with or without massaging. exactly which rule, if any, might cause the problem, i can't say at this time. i've started some scaffolding to see if i can spot where something might be occurring.

in any case, i wanted to ask if anyone has ever seen such output (with no error or log message thrown by the system) or, based on any android memory management expertise, how such a string might magically insert itself into my basic string. the only compiler warnings i see relate to unused variables. thanks.
 

drgottjr

Expert
Licensed User
Longtime User
i was able to cause this:
"[Java.lang.string"
to be embedded in a string that i piece together in my app. no error thrown, nothing appeared in the log.
i'm wondering if anyone can think of some reason - just off the top of their head - how this could
occur. in the old days i would start thinking about a buffer or stack overflow. but between the basic
wrapper and underlying native calls, i wouldn't even know where to begin. it starts with a "[" the "J" was definitely capital; i can't swear the "s" in string was lower case. no closing "]"

at first i thought it was an anomaly with the emulator, but i was able to make it occur again with the
same input. at the time, some other issues were more important, so i let it slide.

in the app, a user inputs a search term. the app tries to find it in a database. if it can't find an exact match, it follows a series of rules to massage the search term, either by breaking it up into chunks and/or searching for similar terms. at the end - regardless of success, if any - it pieces what it found back together and displays the result, as a string.

so, if the result, after massaging and breaking up and piecing back together is supposed to be:
"foo" & " " & "bar",
what i see on the screen, under very specific circumstances which i cannot for the moment duplicate, would be "foo [Java.lang.string bar". the app then continues as if nothing occurred.

it only occurs with a long search term (7-8 words) and if one or more terms requires some kind of massage for a match. searches for up to 5 words in the term can be handled without this occurring (after 1000's of searches), with or without massaging. exactly which rule, if any, might cause the problem, i can't say at this time. i've started some scaffolding to see if i can spot where something might be occurring.

in any case, i wanted to ask if anyone has ever seen such output (with no error or log message thrown by the system) or, based on any android memory management expertise, how such a string might magically insert itself into my basic string. the only compiler warnings i see relate to unused variables. thanks.


a follow up. this is what it looks like:
cap2.png
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
a follow up. this is what it looks like:View attachment 18937


here's what it looks like if i capture the so called "final list" of identified terms in the log (separated by CRLF's):

finallist before processing:
mackerel
filet,
cooked@ *mi-cuit often refers to fresh foie gras, not preserved. mi-cru mi-cuit means "seared"
grilled,@
mousseline
cold@
of
cauliflower,
shimeji
à la grecque,
sharp juice *i don't know if spicy applies; it's sharp, eg with lemon or oysters or anchovy. not hot
[Ljava.lang.String;@413fa068??

notice last entry. the 2 "??" are appended by my app for terms which it has not been able to identify in its database.
the last term is missing, apparently clobbered by [Ljava.lang.String...

any thought?
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
here's what it looks like if i capture the so called "final list" of identified terms in the log (separated by CRLF's):

finallist before processing:
mackerel
filet,
cooked@ *mi-cuit often refers to fresh foie gras, not preserved. mi-cru mi-cuit means "seared"
grilled,@
mousseline
cold@
of
cauliflower,
shimeji
à la grecque,
sharp juice *i don't know if spicy applies; it's sharp, eg with lemon or oysters or anchovy. not hot
[Ljava.lang.String;@413fa068??

notice last entry. the 2 "??" are appended by my app for terms which it has not been able to identify in its database.
the last term is missing, apparently clobbered by [Ljava.lang.String...

any thought?


found it. false alarm. passed a string array instead of a string. sorry.
 
Upvote 0
Top