Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
7abd37b4
Commit
7abd37b4
authored
Sep 17, 2017
by
Greg Messner
Browse files
Fixed compile warning.
parent
a7e93a10
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/RepositoryFileApi.java
View file @
7abd37b4
...
...
@@ -87,9 +87,13 @@ public class RepositoryFileApi extends AbstractApi {
*/
public
RepositoryFile
createFile
(
RepositoryFile
file
,
Integer
projectId
,
String
branchName
,
String
commitMessage
)
throws
GitLabApiException
{
Form
formData
=
file2form
(
file
,
branchName
,
commitMessage
);
Response
response
=
isApiVersion
(
ApiVersion
.
V3
)
?
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"repository"
,
"files"
)
:
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"repository"
,
"files"
,
urlEncode
(
file
.
getFilePath
()));
Response
response
;
if
(
isApiVersion
(
ApiVersion
.
V3
))
{
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"repository"
,
"files"
);
}
else
{
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"repository"
,
"files"
,
urlEncode
(
file
.
getFilePath
()));
}
return
(
response
.
readEntity
(
RepositoryFile
.
class
));
}
...
...
@@ -113,9 +117,13 @@ public class RepositoryFileApi extends AbstractApi {
*/
public
RepositoryFile
updateFile
(
RepositoryFile
file
,
Integer
projectId
,
String
branchName
,
String
commitMessage
)
throws
GitLabApiException
{
Form
formData
=
file2form
(
file
,
branchName
,
commitMessage
);
Response
response
=
isApiVersion
(
ApiVersion
.
V3
)
?
put
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"files"
)
:
put
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"files"
,
urlEncode
(
file
.
getFilePath
()));
Response
response
;
if
(
isApiVersion
(
ApiVersion
.
V3
))
{
response
=
put
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"files"
);
}
else
{
response
=
put
(
Response
.
Status
.
CREATED
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"files"
,
urlEncode
(
file
.
getFilePath
()));
}
return
(
response
.
readEntity
(
RepositoryFile
.
class
));
}
...
...
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