NPE during retrieval in module with multiple content roots containing source roots

Issue #1345 resolved
Piotr Kożuchowski created an issue

Got this error when I’ve tried to retrieve Report from scratch org (using mdapi Retrieve Metadata):

The report was not in the src folder at that time, I’ve had “Subscribed Only” unchecked. This seems to happen when retrieving any metadata.

I’ve attached idea.log where you can find stack trace. I hope you will find it helpful.

Kind Regards,

Piotr

IntelliJ IDEA 2019.1.3 (Ultimate Edition)
Build #IU-191.7479.19, built on May 28, 2019
Licensed to Piotr Kożuchowski
Subscription is active until January 30, 2020
JRE: 1.8.0_202-release-1483-b58 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

Comments (12)

  1. Scott Wells repo owner

    Thanks, Piotr. Here's the issue:

    2019-07-15 16:23:02,323 [16229957]  DEBUG - .ForceComSfdxMetadataRetriever - projectRoot = C:/Users/piotr/IdeaProjects/DevToolkit 
    2019-07-15 16:23:02,323 [16229957]  DEBUG - .ForceComSfdxMetadataRetriever - defaultSourceRoot = null 
    2019-07-15 16:23:02,323 [16229957]  DEBUG - .ForceComSfdxMetadataRetriever - testSourceRoot = null 
    

    Notice that the value for defaultSourceRoot is null. Do you mind providing the bottom portion of your .iml file that looks like:

      <component name="NewModuleRootManager" inherit-compiler-output="true">
        <exclude-output />
        <content url="file://$MODULE_DIR$">
          <sourceFolder url="file://$MODULE_DIR$/force-app/main/default" isTestSource="false" />
          <sourceFolder url="file://$MODULE_DIR$/config" isTestSource="false" />
          <sourceFolder url="file://$MODULE_DIR$/manifest" isTestSource="false" />
          <sourceFolder url="file://$MODULE_DIR$/force-app/test/default" isTestSource="true" />
        </content>
        <orderEntry type="jdk" jdkName="IlluminatedCloud (df17-manifest-testing/df17)" jdkType="IlluminatedCloud" />
        <orderEntry type="sourceFolder" forTests="false" />
      </component>
    

    I'd like to see how your content roots and source roots are configured. Hopefully this is just a simple matter of configuration, though if not it should let me know more about the nature of the underlying bug if it goes that direction.

  2. Piotr Kożuchowski reporter
      <component name="NewModuleRootManager" inherit-compiler-output="true">
        <exclude-output />
        <content url="file://$MODULE_DIR$">
          <sourceFolder url="file://$MODULE_DIR$/config" isTestSource="false" />
          <sourceFolder url="file://$MODULE_DIR$/force-app/pkozuchowskiLibrary/test" isTestSource="true" />
          <sourceFolder url="file://$MODULE_DIR$/force-app" isTestSource="false" />
        </content>
        <content url="file://$MODULE_DIR$/force-app">
          <sourceFolder url="file://$MODULE_DIR$/force-app/pkozuchowskiLibrary/default" isTestSource="false" />
        </content>
        <orderEntry type="jdk" jdkName="IlluminatedCloud (DevToolkit/SandboxScratch)" jdkType="IlluminatedCloud" />
        <orderEntry type="sourceFolder" forTests="false" />
      </component>
    

    Now that you mention it, this part may be messy here… I have 2x default folder, maybe that’s why it fails.
    I will see what happens if I clean it up.

  3. Scott Wells repo owner

    Yes, I think that's the issue. Try consolidating into a single content root with the same source roots and I bet it works properly. Please let me know either way.

  4. Piotr Kożuchowski reporter

    Once I’ve removed one of “default” folders, the issue disappeared. I thought it’s more of general problem than issue with configuration of my project 🙂

  5. Scott Wells repo owner

    Thanks for letting me know. I'll see if there's anything I can do to detect this type of configuration and handle it better.

  6. Scott Wells repo owner

    Issue tracker grooming. If this is still an issue, please feel free to reopen, ideally with a concrete reproduction scenario.

  7. Log in to comment