your test code throws the correct exception on my side so it will be
something else that is causing the stack smash
I've been doing some tests and it seems that how bigger the strings
i'm adding how faster the error occurs, there must be some kind of
size limit hit there. Maybe it's caused by the way I add items
(requesting record, adding string to attribute, updating record,
requesting record, ....)
using the following ocde I was able to generate a cash file
String item;
int total = 0;
for (int i =0;i<100;i++){
item = "aa" + i;
total += item.length();
System.out.println("trying: " + total);
DataElement base =
record.getAttributeValue(IMAGES_NAMES_ATTRIBUTE_ID);
DataElement de = new DataElement(DataElement.STRING,
item);
base.addElement(de);
record.setAttributeValue(IMAGES_NAMES_ATTRIBUTE_ID,
base);
System.out.println("total: " + total);
}
// 182, 175, 162, 146
try {
localDevice.updateRecord(record);
} catch (ServiceRegistrationException ex) {
Logger.getLogger(VodtecServer.class.getName()).log(Level.SEVERE, null,
ex);
}
output:
#
# An unexpected error has been detected by Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x8ff18f82, pid=10983, tid=2415917968
#
# Java VM: Java HotSpot(TM) Server VM (1.6.0_03-b05 mixed mode)
# Problematic frame:
# C [libbluetooth.so.2+0xbf82] sdp_append_to_buf+0x22
#
# An error report file with more information is saved as
hs_err_pid10983.log
#
# If you would like to submit a bug report, please visit:
#
http://java.sun.com/webapps/bugreport/crash.jsp
#
I mailed the logfile
and something else:
just a remark, might be better to add a message to that
classcastexception so it is clear why it happens (like the javadoc)
System.out.println(de.getSize());
java.lang.ClassCastException
at javax.bluetooth.DataElement.getSize(DataElement.java:562)
On Feb 1, 4:38 pm, "Vlad Skarzhevskyy" <
skarzhevs...@gmail.com> wrote:
> Yes the record size has been committed before the -fno-stack-protector changes.
> Tested and it should produce the Exception if there are too many data elements.
> I did not test the size of each data element. May be this is the case.
>
> I need a complete file system independent example to reproduce the problem.
>
> I tested like this: But only on Fedora 7
>
> ----------------
> DataElement seqLong = new DataElement(DataElement.DATSEQ);
> for (int i = 0; i < 100; i++) {
> seqLong.addElement(new DataElement(DataElement.STRING,
> "BlueCove-long-seq " + i));}
>
> record.setAttributeValue(IMAGES_NAMES_ATTRIBUTE_ID, seqLong);
> ---------------
>