• LnF
  • NEWBIE
  • 0 Points
  • Member since 2011

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

I have a page that iFrames another site and uses a simple class to get the URL and userid.  I changed the class to use the Custom Settings for the URL instead of hardcoding it into the code.  It works; but I get the following error when running the test:  Message:  System.NullPointerException: Attempt to de-reference a null object.  Stack Trace:  Class.clsPMNotes.<init>: line 14, column 1 Class.clsPMNotes.testPMNotes: line 20, column 1

 

It looks like this "PmNotesSite__c.getInstance('DefaultSiteName').Site__c" is the culprit.

 

Here's the class

 

public class clsPMNotes
{
    public string prpIFrameSourceURL {get;set;}
    public clsPMNotes()
    {
         prpIFrameSourceURL = PmNotesSite__c.getInstance('DefaultSiteName').Site__c + Userinfo.getUserId();
    }
    
    public static testMethod void testPMNotes()
    {
        Test.StartTest();
        clsPMNotes obCLS = new clsPMNotes();
        Test.StopTest();
    }
}

 

Thanks much in advance.

  • November 26, 2012
  • Like
  • 0

I have a public site enabled where a public user is supposed to submit a work order request (there is a work order object that is a parent to a proposal object).  The user can go to the page enter in all the information but when submit is clicked the user is redirected to a generic force.com "Authorization Required You must first log in or register before accessing this page."  But the funny thing is that the work order is successfully submitted (I checked in the system) and I get a reply email setting me know that my request was submitted.  It's a standard custom object and thecustom page is only using that object for it's controller.  Is there something I'm missing?  The public access permissions have the CRUD all set to that object and the child object.


  • September 29, 2011
  • Like
  • 0

I have a page that iFrames another site and uses a simple class to get the URL and userid.  I changed the class to use the Custom Settings for the URL instead of hardcoding it into the code.  It works; but I get the following error when running the test:  Message:  System.NullPointerException: Attempt to de-reference a null object.  Stack Trace:  Class.clsPMNotes.<init>: line 14, column 1 Class.clsPMNotes.testPMNotes: line 20, column 1

 

It looks like this "PmNotesSite__c.getInstance('DefaultSiteName').Site__c" is the culprit.

 

Here's the class

 

public class clsPMNotes
{
    public string prpIFrameSourceURL {get;set;}
    public clsPMNotes()
    {
         prpIFrameSourceURL = PmNotesSite__c.getInstance('DefaultSiteName').Site__c + Userinfo.getUserId();
    }
    
    public static testMethod void testPMNotes()
    {
        Test.StartTest();
        clsPMNotes obCLS = new clsPMNotes();
        Test.StopTest();
    }
}

 

Thanks much in advance.

  • November 26, 2012
  • Like
  • 0