• slonghi
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi,

 

I am deseralizing the json string into an object which contains a list of another object, and getting this error:

 

Internal Salesforce Error: 17692538-4726 (1351590007) (1351590007) 



My code has been working up until this Wednesday. Was there any change that has been applied to cs2 env? This the test code I have:

 

public with sharing class JSONTest {
    public class InvoiceStatement {
        Long invoiceNumber;
        Datetime statementDate;
        Decimal totalPrice;
       
        public InvoiceStatement(Long i, Datetime dt, Decimal price)
        {
            invoiceNumber = i;
            statementDate = dt;
            totalPrice = price;
        }
    }
   
    public class InvoiceStatementResponse {
        Integer errorCode;
        List<InvoiceStatement> statements;
       
        public InvoiceStatementResponse(Integer errorCode) {
            this.errorCode = errorCode;
            statements = new List<InvoiceStatement>();
        }
    }
   
    public static void SerializeRoundtrip() {
        Datetime dt = Datetime.now();
        // Create a few invoices.
   
        InvoiceStatement inv1 = new InvoiceStatement(1,Datetime.valueOf(dt),1000);
        InvoiceStatement inv2 = new InvoiceStatement(2,Datetime.valueOf(dt),500);
        // Add the invoices to a list.
   
        List<InvoiceStatement> invoices = new List<InvoiceStatement>();
        invoices.add(inv1);
        invoices.add(inv2);
        
         InvoiceStatementResponse resp = new InvoiceStatementResponse(0);
         resp.statements = invoices;
                 
        String JSONString = JSON.serialize(resp);
        System.debug('Serialized list of invoices into JSON format: ' + JSONString);
       
        InvoiceStatementResponse dresp = (InvoiceStatementResponse)JSON.deserialize(JSONString, InvoiceStatementResponse.class);
        System.debug('dresp=' + dresp);
    }
   
    private static testmethod void mytest() {
        JSONTest.SerializeRoundtrip();
    }
   
}

 

Any help is appreciated.