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
0abb1d21
Commit
0abb1d21
authored
Feb 03, 2018
by
Greg Messner
Browse files
Changed processing of whitespace on content properties (#136).
parent
f5a54d5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/GitLabApiForm.java
View file @
0abb1d21
...
...
@@ -48,8 +48,8 @@ public class GitLabApiForm extends Form {
return
(
this
);
}
String
stringValue
=
value
.
toString
()
.
trim
()
;
if
(
required
&&
stringValue
.
length
()
==
0
)
{
String
stringValue
=
value
.
toString
();
if
(
required
&&
stringValue
.
trim
().
length
()
==
0
)
{
throw
new
IllegalArgumentException
(
name
+
" cannot be empty or null"
);
}
...
...
src/main/java/org/gitlab4j/api/RepositoryFileApi.java
View file @
0abb1d21
...
...
@@ -86,7 +86,7 @@ public class RepositoryFileApi extends AbstractApi {
* @throws GitLabApiException if any exception occurs
*/
public
RepositoryFile
createFile
(
RepositoryFile
file
,
Integer
projectId
,
String
branchName
,
String
commitMessage
)
throws
GitLabApiException
{
Form
formData
=
file2f
orm
(
file
,
branchName
,
commitMessage
);
Form
formData
=
createF
orm
(
file
,
branchName
,
commitMessage
);
Response
response
;
if
(
isApiVersion
(
ApiVersion
.
V3
))
{
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"repository"
,
"files"
);
...
...
@@ -116,7 +116,7 @@ public class RepositoryFileApi extends AbstractApi {
* @throws GitLabApiException if any exception occurs
*/
public
RepositoryFile
updateFile
(
RepositoryFile
file
,
Integer
projectId
,
String
branchName
,
String
commitMessage
)
throws
GitLabApiException
{
Form
formData
=
file2f
orm
(
file
,
branchName
,
commitMessage
);
Form
formData
=
createF
orm
(
file
,
branchName
,
commitMessage
);
Response
response
;
if
(
isApiVersion
(
ApiVersion
.
V3
))
{
response
=
put
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"files"
);
...
...
@@ -215,7 +215,7 @@ public class RepositoryFileApi extends AbstractApi {
return
(
response
.
readEntity
(
InputStream
.
class
));
}
private
Form
file2f
orm
(
RepositoryFile
file
,
String
branchName
,
String
commitMessage
)
{
private
Form
createF
orm
(
RepositoryFile
file
,
String
branchName
,
String
commitMessage
)
{
Form
form
=
new
Form
();
if
(
isApiVersion
(
ApiVersion
.
V3
))
{
...
...
@@ -228,6 +228,6 @@ public class RepositoryFileApi extends AbstractApi {
addFormParam
(
form
,
"encoding"
,
file
.
getEncoding
(),
false
);
addFormParam
(
form
,
"content"
,
file
.
getContent
(),
true
);
addFormParam
(
form
,
"commit_message"
,
commitMessage
,
true
);
return
form
;
return
(
form
)
;
}
}
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