Results 1 to 2 of 2

Thread: duplicating values

  1. #1
    Join Date
    Jan 2009

    duplicating values

    I have a method:

    public final void writeToTable(final Collection<Object> row) {
    PdfPCell cell = null;
    int col = 0;
    for (Object value : row) {
    if (value instanceof Collection) {
    cell = new PdfPCell(
    convertToParagraph((Collection<Object>) value));
    } else if (value instanceof Number) {
    cell = new PdfPCell(new Paragraph(
    getFormattedNumber((Number) value)));
    } else if(cell == null) {

    cell = new PdfPCell(new Paragraph(removeSpecialText(value.toString())));

    I just added the code in red and now the code is producing duplicate information in different rows, but in reality there is different info. that goes into every row/column.

    Please help me! and i wish i could just take out the cell == null but i can't because nullpointerexception is thrown if i have an empty column.

  2. #2
    Join Date
    Dec 2002
    Calgary, Canada
    instead you should post here where exactly is null pointer exception thrown from.
    What you should do is, see which value is null and then change it to an empty string, that way you wont have to use if (cell==null)
    You must have a logic to handle null values first


    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles