Skip to content

Better Log for Issue #218 #223

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 2 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ If you check the **Manually link or raise issues** check box, this plugin will a
Only after configuring the fields above, if you want you can override the **Summary** and **Description** values by clicking the **Advanced** button.
If you want, here you can configure all available fields for that specific issue type. Due to Jenkins interface development limitations, you have to search for the desired field from the four available types of fields, after clicking the Add Field Configuration.

The advanced configuration is currently just available for JIRA server versions up to **8.4** as the Rest API changed, see issue [#218](https://github.com/jenkinsci/JiraTestResultReporter-plugin/issues/218) .

**Important: Do not leave empty values for fields, if you didn't find the desired field in the current chosen option, delete it before trying the next one.**

Finally, I cannot say that this is recommended ( although it is (smile) ), **read the help tag for the Validate Fields** and if the warning there is not a problem for you click the button.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.atlassian.jira.rest.client.api.GetCreateIssueMetadataOptions;
import com.atlassian.jira.rest.client.api.IssueRestClient;
import com.atlassian.jira.rest.client.api.RestClientException;
import com.atlassian.jira.rest.client.api.domain.CimFieldInfo;
import com.atlassian.jira.rest.client.api.domain.CimIssueType;
import com.atlassian.jira.rest.client.api.domain.CimProject;
Expand Down Expand Up @@ -182,6 +183,13 @@
Collections.singletonList(projectKey),
null))
.claim();
} catch (RestClientException e) {
// likely issue https://github.com/jenkinsci/JiraTestResultReporter-plugin/issues/218
// support for jira newer than 8.4 is not impl yet
JiraUtils.log("ERROR: RestClientException for getCacheEntry projectKey:" + projectKey
+ " issueType:" + issueType);
JiraUtils.logError("ERROR: RestClientException error", e);
return null;

Check warning on line 192 in src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/MetadataCache.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 186-192 are not covered by tests
} catch (Exception e) {
JiraUtils.logError("ERROR: Unknown error", e);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,25 +152,27 @@
.getFieldInfoMap()
.get(fieldKey)
.getAllowedValues();
for (Object o : values) {
if (o instanceof CustomFieldOption) {
CustomFieldOption option = (CustomFieldOption) o;
listBox.add(option.getValue(), option.getId().toString());
} else if (o instanceof IdentifiableEntity && o instanceof NamedEntity) {
listBox.add(
((NamedEntity) o).getName(),
((IdentifiableEntity<Long>) o).getId().toString());
// work-around for Components and Fix Versions
// even though they have ids, for some reason they don't implement IdentifiableEntity
// so I'm invoking the getter for the id using reflection
} else if (o instanceof NamedEntity) {
try {
Method m = o.getClass().getMethod("getId");
Object id = (Long) m.invoke(o);
if (id != null) {
listBox.add(((NamedEntity) o).getName(), id.toString());
if (values != null) {

Check warning on line 155 in src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/config/SelectableArrayFields.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 155 is not covered by tests
for (Object o : values) {
if (o instanceof CustomFieldOption) {
CustomFieldOption option = (CustomFieldOption) o;
listBox.add(option.getValue(), option.getId().toString());
} else if (o instanceof IdentifiableEntity && o instanceof NamedEntity) {
listBox.add(
((NamedEntity) o).getName(),
((IdentifiableEntity<Long>) o).getId().toString());
// work-around for Components and Fix Versions
// even though they have ids, for some reason they don't implement IdentifiableEntity
// so I'm invoking the getter for the id using reflection
} else if (o instanceof NamedEntity) {
try {
Method m = o.getClass().getMethod("getId");
Object id = (Long) m.invoke(o);
if (id != null) {
listBox.add(((NamedEntity) o).getName(), id.toString());
}
} catch (Exception e) {
}
} catch (Exception e) {
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,16 @@
.getFieldInfoMap()
.get(fieldKey)
.getAllowedValues();
for (Object o : values) {
if (o instanceof CustomFieldOption) {
CustomFieldOption option = (CustomFieldOption) o;
listBox.add(option.getValue(), option.getId().toString());
} else if (o instanceof IdentifiableEntity && o instanceof NamedEntity) {
listBox.add(
((NamedEntity) o).getName(),
((IdentifiableEntity<Long>) o).getId().toString());
if (values != null) {

Check warning on line 142 in src/main/java/org/jenkinsci/plugins/JiraTestResultReporter/config/SelectableFields.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 142 is not covered by tests
for (Object o : values) {
if (o instanceof CustomFieldOption) {
CustomFieldOption option = (CustomFieldOption) o;
listBox.add(option.getValue(), option.getId().toString());
} else if (o instanceof IdentifiableEntity && o instanceof NamedEntity) {
listBox.add(
((NamedEntity) o).getName(),
((IdentifiableEntity<Long>) o).getId().toString());
}
}
}
return listBox;
Expand Down
Loading