File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
main/java/org/gitlab4j/api/services
test/java/org/gitlab4j/api Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 11package org .gitlab4j .api .services ;
22
3+ import java .util .Map ;
4+
35import javax .xml .bind .annotation .XmlAccessType ;
46import javax .xml .bind .annotation .XmlAccessorType ;
57import javax .xml .bind .annotation .XmlRootElement ;
@@ -109,4 +111,28 @@ public JiraService withJiraIssueTransitionId(Integer jiraIssueTransitionId) {
109111 setJiraIssueTransitionId (jiraIssueTransitionId );
110112 return (this );
111113 }
114+
115+ @ Override
116+ public void setProperties (Map <String , Object > properties ) {
117+ fixJiraIssueTransitionId (properties );
118+ super .setProperties (properties );
119+ }
120+
121+ /**
122+ * Make sure jiraIssueTransitionId is an integer and not an empty string.
123+ * @param properties the Map holding the properties
124+ */
125+ private void fixJiraIssueTransitionId (Map <String , Object > properties ) {
126+
127+ if (properties != null ) {
128+ Object jiraIssueTransitionId = properties .get (JIRA_ISSUE_TRANSITION_ID_PROP );
129+ if (jiraIssueTransitionId instanceof String ) {
130+ if (((String )jiraIssueTransitionId ).trim ().isEmpty ()) {
131+ properties .put (JIRA_ISSUE_TRANSITION_ID_PROP , null );
132+ } else {
133+ properties .put (JIRA_ISSUE_TRANSITION_ID_PROP , Integer .valueOf ((String )jiraIssueTransitionId ));
134+ }
135+ }
136+ }
137+ }
112138}
Original file line number Diff line number Diff line change @@ -105,8 +105,14 @@ public void testProjectIdOrPath() throws GitLabApiException {
105105
106106 @ Test
107107 public void testGetJiraService () throws GitLabApiException {
108+
108109 JiraService jiraService = gitLabApi .getServicesApi ().getJiraService (testProject );
109110 assertNotNull (jiraService );
111+
112+ // Make sure the jira_issue_transition_id is retrievable.
113+ // This is testing that a class cast exception is not thrown.
114+ Integer jiraIssueTransitionId = jiraService .getJiraIssueTransitionId ();
115+ assertTrue (jiraIssueTransitionId == null || jiraIssueTransitionId != null );
110116 }
111117
112118 @ Test
You can’t perform that action at this time.
0 commit comments