Skip to content

Commit

Permalink
Merge pull request #61 from gdgib/G2-1478-UpgradeLJ
Browse files Browse the repository at this point in the history
G2-1478 Upgrade re-maven to use new jackson version
  • Loading branch information
gdgib authored Oct 26, 2023
2 parents ae32fe2 + 0eb5b19 commit b35c909
Show file tree
Hide file tree
Showing 9 changed files with 325 additions and 317 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public Path load(Path path) {
try {
Git.open(retVal.toFile()).pull().call();
} catch (GitAPIException | IOException e) {
throw new RuntimeException(e);
throw new RuntimeException(String.format("Failed to open \"%1$s\"", retVal), e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ public Artifact<MavenCoordinates> load(MavenCoordinates coordinates, IReassertGr
final MavenPOM pom = readPom(pomPath);
builder.vertex(pom).edge(pom, artifact, new Describes());

final Collection<ILicenseApplied> licenses = getLicenses(pom);
for (ILicenseApplied license : licenses) {
builder.vertex(license).edge(artifact, license, new Notice());
}

if (pom.getParent() != null) {
final MavenCoordinates parentCoordinates = validate(pom.getParent().getCoordinates());
builder.callback(new Artifact<>(this, parentCoordinates), new Inherits(), artifact);
Expand All @@ -214,6 +209,11 @@ public Artifact<MavenCoordinates> load(MavenCoordinates coordinates, IReassertGr
{
final Path resolvedPath = getResolvedCacheArea().apply(unpackaged);
final MavenPOM resolved = readPom(resolvedPath);

final Collection<ILicenseApplied> licenses = getLicenses(resolved);
for (ILicenseApplied license : licenses) {
builder.vertex(license).edge(artifact, license, new Notice());
}

final List<MavenDependency> dependencies = resolved.getDependencies();
if ((dependencies != null) && !dependencies.isEmpty()) for (MavenDependency dependency : dependencies) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ public Object resolveEntity(String publicID, String systemID, String baseURI, St
}
});

final XmlMapper mapper = new XmlMapper(new XmlFactory(xmlInputFactory, null));
mapper.registerModule(new ParanamerModule());
mapper.registerModule(new MavenXmlModule());
mapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);
return mapper;
final XmlMapper.Builder builder = XmlMapper.builder(new XmlFactory(xmlInputFactory, null));
builder.addModule(new ParanamerModule());
builder.addModule(new MavenXmlModule());
builder.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS);
return builder.build();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@Data
@Builder(toBuilder = true)
@RequiredArgsConstructor
@RequiredArgsConstructor(onConstructor_ = { @JsonCreator(mode = JsonCreator.Mode.DISABLED) })
@JsonIgnoreProperties(ignoreUnknown = true)
public class MavenDependency {
@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

@Data
@Builder(toBuilder = true)
@RequiredArgsConstructor
@RequiredArgsConstructor(onConstructor_ = { @JsonCreator(mode = JsonCreator.Mode.DISABLED) })
@JsonIgnoreProperties(ignoreUnknown = true)
@JacksonXmlRootElement(namespace = "http://maven.apache.org/POM/4.0.0")
public class MavenPOM implements IDescriptor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@Data
@Builder(toBuilder = true)
@RequiredArgsConstructor
@RequiredArgsConstructor(onConstructor_ = { @JsonCreator(mode = JsonCreator.Mode.DISABLED) })
@JsonIgnoreProperties(ignoreUnknown = true)
public class MavenParent {
@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
import com.fasterxml.jackson.module.paranamer.ParanamerModule;
Expand All @@ -31,6 +32,7 @@
@RunWith(Parameterized.class)
public abstract class ATestStandardLicenseParser {
public interface ITestCase {
@JsonIgnore
public ILicenseApplied getLicenseApplied();

public String getPurpose();
Expand All @@ -48,7 +50,7 @@ public static <TestCase extends ITestCase> List<Object[]> computeTestParameters(
try (final InputStream stream = HResource.getResourceAsStream(testCaseType, file, true)) {
testCases = reader.<TestCase>readValues(stream).readAll();
} catch (IOException e) {
throw new RuntimeIOException(e);
throw new RuntimeIOException(String.format("Failed to read resource \"%1$s\" near %2$s", file, testCaseType), e);
}
}

Expand Down

0 comments on commit b35c909

Please sign in to comment.