Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
55518136
Commit
55518136
authored
6 years ago
by
Greg Messner
Browse files
Options
Download
Email Patches
Plain Diff
Mods to fix cast class exception related to jira_issue_transition_id (#253).
parent
beab02f7
main
5.0.x
5.0.x.jdk17
6.x
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/gitlab4j/api/services/JiraService.java
+26
-0
src/main/java/org/gitlab4j/api/services/JiraService.java
src/test/java/org/gitlab4j/api/TestServicesApi.java
+6
-0
src/test/java/org/gitlab4j/api/TestServicesApi.java
with
32 additions
and
0 deletions
+32
-0
src/main/java/org/gitlab4j/api/services/JiraService.java
+
26
-
0
View file @
55518136
package
org.gitlab4j.api.services
;
import
java.util.Map
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlRootElement
;
...
...
@@ -109,4 +111,28 @@ public class JiraService extends NotificationService {
setJiraIssueTransitionId
(
jiraIssueTransitionId
);
return
(
this
);
}
@Override
public
void
setProperties
(
Map
<
String
,
Object
>
properties
)
{
fixJiraIssueTransitionId
(
properties
);
super
.
setProperties
(
properties
);
}
/**
* Make sure jiraIssueTransitionId is an integer and not an empty string.
* @param properties the Map holding the properties
*/
private
void
fixJiraIssueTransitionId
(
Map
<
String
,
Object
>
properties
)
{
if
(
properties
!=
null
)
{
Object
jiraIssueTransitionId
=
properties
.
get
(
JIRA_ISSUE_TRANSITION_ID_PROP
);
if
(
jiraIssueTransitionId
instanceof
String
)
{
if
(((
String
)
jiraIssueTransitionId
).
trim
().
isEmpty
())
{
properties
.
put
(
JIRA_ISSUE_TRANSITION_ID_PROP
,
null
);
}
else
{
properties
.
put
(
JIRA_ISSUE_TRANSITION_ID_PROP
,
Integer
.
valueOf
((
String
)
jiraIssueTransitionId
));
}
}
}
}
}
This diff is collapsed.
Click to expand it.
src/test/java/org/gitlab4j/api/TestServicesApi.java
+
6
-
0
View file @
55518136
...
...
@@ -105,8 +105,14 @@ public class TestServicesApi {
@Test
public
void
testGetJiraService
()
throws
GitLabApiException
{
JiraService
jiraService
=
gitLabApi
.
getServicesApi
().
getJiraService
(
testProject
);
assertNotNull
(
jiraService
);
// Make sure the jira_issue_transition_id is retrievable.
// This is testing that a class cast exception is not thrown.
Integer
jiraIssueTransitionId
=
jiraService
.
getJiraIssueTransitionId
();
assertTrue
(
jiraIssueTransitionId
==
null
||
jiraIssueTransitionId
!=
null
);
}
@Test
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets