Skip to content

963: Bug during composer json generation #972

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

Merged
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,15 @@ private Pair<String, String> getDependencyData(
composerJsonFile.getText()
);
final JSONObject jsonObject = (JSONObject) obj;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsonObject can be null as well.

final String versionJsonElement = jsonObject.get("version").toString();
final String versionJsonElement = jsonObject.get("version") == null
? "*" : jsonObject.get("version").toString();
final String nameJsonElement = jsonObject.get("name").toString();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsonObject.get("name") can be null as well.


if (versionJsonElement != null) {
version = versionJsonElement;
final int minorVersionSeparator = version.lastIndexOf('.');
version = new StringBuilder(version)
.replace(minorVersionSeparator + 1, version.length(),"*")
.toString();
}
version = versionJsonElement;
final int minorVersionSeparator = version.lastIndexOf('.');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not do this if there is no version specified.

version = new StringBuilder(version)
.replace(minorVersionSeparator + 1, version.length(),"*")
.toString();

if (nameJsonElement != null) {
moduleName = nameJsonElement;
Expand Down