Deploying component with error gives Null Pointer Exception

Issue #541 resolved
Zachary Buck created an issue

Before updating, my visualforce component would give back compiler errors when I attempted to deploy it. After updating, I get a null pointer exception instead. It doesn't appear to be all errors that cause the null pointer exception, but my dumb mistake isn't highlighted anymore, so I'm not 100% sure what's causing it. Also, we're not using the tooling API at the moment--we have IlluminatedCloud set to use the metadata API for our deploys instead.

Comments (21)

  1. Zachary Buck reporter

    Turning on the Tooling API isn't much more helpful; deployment fails, but I get very little information back regarding the issue.

    Screenshot_3.png

  2. Scott Wells repo owner

    Zachary, let me take a look. I don't remember changing anything in the past two updates in this area, but it's entirely possible I did. It's also possible something changed with Spring '17...or some combination of the two. I'll let you know if I can't reproduce it so I can get additional details. Assuming it's something simple either way, I'll try to turn around a fix for you ASAP.

  3. Scott Wells repo owner

    Yep, at a glance this appears to be a change from Spring '17. It looks like under certain circumstances the errors returned from the metadata API in response to a deployment sometimes aren't including a problem type (should be ERROR or WARNING). I can handle that situation and gracefully degrade to ERROR. Let me test this a bit more, but looks like that may be what's going on.

  4. Zachary Buck reporter

    Wow... thank you so much! I appreciate the quick response... this was a big blocker for us, so I'm excited the issue was relatively easy to diagnose. If there's anything you need from me, I'll be happy to provide it.

  5. Scott Wells repo owner

    Zachary, do you mind installing this using Settings>Plugins>Install Plugin from disk and also adding the following class for debug logging:

    #com.illuminatedcloud.intellij.builder.ForceComBuilderUtil
    

    The only differences between this build and the current official build are some debug logging to show the metadata API deployment failure in detail and more defensive handling of that deployment failure in case of the absence of expected information such as the problem type.

    Please try to reproduce the problem. Either way (success or failure), please provide the resulting idea.log so I can see what the server is sending you in response that was causing this issue. Thanks!

  6. Scott Wells repo owner

    Thanks. So the important extract from the log is:

    2017-02-14 11:34:51,912 [ 118710]   INFO - er.ForceComMetadataApiDeployer - Deployment status = FAILED 
    2017-02-14 11:34:51,922 [ 118720]  DEBUG - ij.builder.ForceComBuilderUtil - Converting deploy message:
    {
      "changed": false,
      "componentType": "ApexComponent",
      "created": false,
      "createdDate": {
        ...
      },
      "deleted": false,
      "fileName": "components/Account_RelatedList_ActivityHistory.component",
      "fullName": "Account_RelatedList_ActivityHistory",
      "success": false
    } 
    

    That's a very sparsely-populated error response coming back from the server with no error message, no problem type, etc. In just a few minutes I'm going to post another build for you to try that will show the full server response so I can see if the relevant info is hidden somewhere else in the response.

  7. Scott Wells repo owner

    Okay, here's another build with a little more logging that will dump the entire server response. We'll be looking for a line that reads "Processing the deployment result:". Please send over the log when you have it and hopefully it'll provide more insight into what's happening.

  8. Zachary Buck reporter

    That line isn't coming up for me for the most recent deploy. I double checked that I had the right build installed (by installing it again), and made sure the debug log config was still there. I'll attach the log anyway.

  9. Scott Wells repo owner

    Ahhh...you'll need to enable debug logging for:

    #com.illuminatedcloud.intellij.builder.ForceComMetadataApiDeployer
    

    That should give you a TON of additional info. Please send over a log with that enabled. Sorry I didn't notice that wasn't set to DEBUG level from the get-go!

  10. Scott Wells repo owner

    Thanks. So stripping out some noise, this is what you're getting back:

    {
      "checkOnly": false,
      "completedDate": {},
      "createdBy": "0051400000Biz1W",
      "createdByName": "<redacted>",
      "createdDate": {},
      "details": {
        "componentFailures": [
          {
            "changed": false,
            "componentType": "ApexComponent",
            "created": false,
            "createdDate": {},
            "deleted": false,
            "fileName": "components/Account_RelatedList_ActivityHistory.component",
            "fullName": "Account_RelatedList_ActivityHistory",
            "success": false
          }
        ],
        "componentSuccesses": [
          {
            "changed": true,
            "componentType": "",
            "created": false,
            "createdDate": {},
            "deleted": false,
            "fileName": "package.xml",
            "fullName": "package.xml",
            "success": true
          }
        ],
        "runTestResult": {
          "numFailures": 0,
          "numTestsRun": 0,
          "totalTime": 0.0
        }
      },
      "done": true,
      "id": "0Af5B000005S1PISA0",
      "ignoreWarnings": false,
      "lastModifiedDate": {},
      "numberComponentErrors": 1,
      "numberComponentsDeployed": 0,
      "numberComponentsTotal": 1,
      "numberTestErrors": 0,
      "numberTestsCompleted": 0,
      "numberTestsTotal": 0,
      "rollbackOnError": false,
      "runTestsEnabled": false,
      "startDate": {},
      "status": "FAILED",
      "success": false
    } 
    

    As you can see, there's very little detail in that response in terms of the error. We can see that there was a failure for the VF component, but not the nature of the error. Assuming that with the latest build I gave you, it's not giving errors from response processing (i.e., the NPE), that may be the best I can do with what they're giving back.

    A few questions:

    • What happens if you use the Tooling API to deploy this? Do you get a more useful error message back? Why aren't you using the Tooling API instead of the Metadata API?
    • What happens if you try to save this in the Salesforce Setup UI? That also uses the Metadata API and I'm curious as to whether it yields a more useful error message.
  11. Zachary Buck reporter

    I'm baffled--this started as soon as I installed the latest update, but you're right... even the setup pages are giving me a null pointer exception. Regarding metadata vs tooling, long story short, we wanted to use the old compiler. The new one has some inconsistencies that were driving us nuts. Thank you for looking into this. I'm not sure what's going on, but it appears to be on Salesforce's side. Is there any problem with sticking with the build you sent me so I can bypass the NPE when deploying this file?

    By the way... this is the relevant section from the log when I deploy using the tooling API. Not sure if it's useful for you, but for your edification:

    2017-02-14 12:17:30,707 [1088566]  ERROR - pplication.impl.LaterInvocator - IntelliJ IDEA 2016.3.4  Build #IU-163.12024.16 
    2017-02-14 12:17:30,707 [1088566]  ERROR - pplication.impl.LaterInvocator - JDK: 1.8.0_112-release 
    2017-02-14 12:17:30,707 [1088566]  ERROR - pplication.impl.LaterInvocator - VM: OpenJDK Server VM 
    2017-02-14 12:17:30,707 [1088566]  ERROR - pplication.impl.LaterInvocator - Vendor: JetBrains s.r.o 
    2017-02-14 12:17:30,707 [1088566]  ERROR - pplication.impl.LaterInvocator - OS: Windows 10 
    2017-02-14 12:17:30,707 [1088566]  ERROR - pplication.impl.LaterInvocator - Last Action: ShowSettings 
    2017-02-14 12:17:39,720 [1097579]   INFO - y.ReflectionServiceFactoryBean - Creating Service {urn:tooling.soap.sforce.com}ToolingService from class com.sforce.soap.tooling.ToolingApi 
    2017-02-14 12:17:50,099 [1107958]   INFO - cloud.client.ForceComApiClient - JAXB initialization for com.sforce.soap.tooling.SessionHeader took 473ms. 
    2017-02-14 12:17:52,096 [1109955]   INFO - der.ForceComToolingApiDeployer - Starting deployment with a polling interval of 5000 milliseconds. 
    2017-02-14 12:17:57,376 [1115235]   WARN - der.ForceComToolingApiDeployer - Component failure reported for components/Account_RelatedList_ActivityHistory.component with no problem type. Assuming ERROR. 
    2017-02-14 12:17:57,377 [1115236]   WARN - der.ForceComToolingApiDeployer - Component failure reported for components/Account_RelatedList_ActivityHistory.component with no problem. 
    2017-02-14 12:17:57,377 [1115236]   WARN - der.ForceComToolingApiDeployer -   Found ERROR for ApexComponent components/Account_RelatedList_ActivityHistory.component: <unknown> 
    2017-02-14 12:17:57,377 [1115236]   INFO - der.ForceComToolingApiDeployer -   Reporting error for C:/Users/madha/Source/Hughes-Marino/src/components/Account_RelatedList_ActivityHistory.component 
    2017-02-14 12:18:13,201 [1131060]   INFO - ide.actions.ShowFilePathAction - 
    Exit code 1 
    
  12. Scott Wells repo owner

    Thanks for confirming that this occurs outside of IC. As you can hopefully appreciate, it's tough being the glue between two complex systems (Salesforce and IntelliJ IDEA) that are both constantly evolving! I certainly bring my own set of bugs/issues to the table, but unfortunately issues in either of those two systems tend to surface as IC issues until proven otherwise. For deployment issues, it's often useful to see if the same problem exists in both APIs (Tooling vs. Metadata) and/or in the Salesforce tools (Setup which uses the Metadata API and Developer Console which uses the Tooling API). Since you've successfully done the latter now, I think perhaps the best next step is to see if you can create a simple, standalone reproduction of this issue that you can include in a support case with Salesforce. If you can do that hopefully they'll turn around a quick fix for it. We ran into a few regressions in Spring '17 last week and all but one have already been resolved by Salesforce.

  13. Scott Wells repo owner

    Oh, and I'm going to keep this issue open to track the changes I made to fix the original NPE. And speaking of that, you're totally fine staying on that test build. When I release another official build with the same fix, you'll be prompted to update to it.

  14. Log in to comment