Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Delta Spark migrations fail for some YAML & POM files #442

Closed
ewilkins-csi opened this issue Oct 28, 2024 · 2 comments · Fixed by #443
Closed

BUG: Delta Spark migrations fail for some YAML & POM files #442

ewilkins-csi opened this issue Oct 28, 2024 · 2 comments · Fixed by #443
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ewilkins-csi
Copy link
Contributor

ewilkins-csi commented Oct 28, 2024

Description

The migration to update YAML files with the new delta-spark dependencies as part of the Java 17 upgrade does not gracefully handle YAML files that do not have maps/objects as their root. (I.e. a YAML file which is a list.)

Steps to Reproduce

  1. Create a new project from the 1.10.0-SNAPSHOT archetype
  2. Add a yaml file that is a list, e.g.:
    - name: test1
      desc: "A test item"
    - name: test2
      desc: "Another test item"
  3. Run the build: mvn clean install

Expected Behavior

The migration should simply skip the inapplicable YAML file and finish successfully.

Actual Behavior

The build fails at the root project.

Additional Context

Error:

Execution default of goal org.technologybrewery.baton:baton-maven-plugin:1.1.1:baton-migrate failed: Could not complete migrations!: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')

Stack trace:

Caused by: java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Map (java.util.ArrayList and java.util.Map are in module java.base of loader 'bootstrap')
    at com.boozallen.aissemble.upgrade.util.YamlUtils.loadYaml (YamlUtils.java:46)
    at com.boozallen.aissemble.upgrade.migration.v1_10_0.DeltaSparkYamlMigration.shouldExecuteOnFile (DeltaSparkYamlMigration.java:38)
    at org.technologybrewery.baton.AbstractMigration.execute (AbstractMigration.java:73)
    at org.technologybrewery.baton.BatonMojo.performMigration (BatonMojo.java:226)
    at org.technologybrewery.baton.BatonMojo.execute (BatonMojo.java:180)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)

Definition of Done

  • Following the steps to reproduce causes the expected behavior
  • The NPE caused by a missing dependenciesManagement section during the DeltaSparkPomMigration no longer occurs

Test Steps

  1. Create a new project from the 1.10.0-SNAPSHOT archetype
  2. Add a yaml file that is a list, e.g.:
    - name: test1
      desc: "A test item"
    - name: test2
      desc: "Another test item"
  3. Update the root pom.xml to remove the dependencyManagement section and add the following to the dependencies section:
        <dependency>
          <groupId>io.delta</groupId>
          <artifactId>delta-core_2.12</artifactId>
          <version>2.4.0</version>
        </dependency>
  4. Run the build: mvn clean install
  5. Validate that the build completes successfully
  6. Validate that the delta-core dependency has been updated to delta-spark in the root pom.xml
@ewilkins-csi ewilkins-csi added the bug Something isn't working label Oct 28, 2024
@ewilkins-csi ewilkins-csi added this to the 1.10.0 milestone Oct 28, 2024
@ewilkins-csi ewilkins-csi self-assigned this Oct 28, 2024
@ewilkins-csi ewilkins-csi changed the title BUG: Delta Spark YAML migration fails for some YAML files BUG: Delta Spark migrations fail for some YAML/POM files Oct 28, 2024
@ewilkins-csi ewilkins-csi changed the title BUG: Delta Spark migrations fail for some YAML/POM files BUG: Delta Spark migrations fail for some YAML & POM files Oct 28, 2024
@ewilkins-csi
Copy link
Contributor Author

OTS/DoD with @carter-cundiff

ewilkins-csi added a commit that referenced this issue Oct 28, 2024
Also fixes a bug with the `hasDouble`, `hasInt`, and `hasBoolean`
methods of `YamlObject`. Adds tests for `YamlUtils` including one to
catch the root list issue. Finally, also updates the POM migration to
account for POMs without dependcy management sections.
ewilkins-csi added a commit that referenced this issue Oct 28, 2024
[#442] account for lists in `YamlUtils#loadYaml`
@csun-cpointe
Copy link
Contributor

Test passed!!

Verified build success
Screenshot 2024-10-28 at 3 43 15 PM

Verified delta-core dependency has been updated to delta-spark in the root pom.xml
Screenshot 2024-10-28 at 3 43 57 PM

@ewilkins-csi ewilkins-csi linked a pull request Oct 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants