Skip to content

Commit 9e729c7

Browse files
committed
Fixed several javadoc issues.
1 parent 3b67cb6 commit 9e729c7

File tree

12 files changed

+255
-210
lines changed

12 files changed

+255
-210
lines changed

jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java

Lines changed: 163 additions & 88 deletions
Large diffs are not rendered by default.

jenkins-client/src/main/java/com/offbytwo/jenkins/client/JenkinsHttpClient.java

Lines changed: 54 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
import net.sf.json.JSONObject;
5353

5454
public class JenkinsHttpClient {
55-
private final Logger LOGGER = LoggerFactory.getLogger( getClass() );
55+
private final Logger LOGGER = LoggerFactory.getLogger(getClass());
5656

5757
private URI uri;
5858
private CloseableHttpClient client;
@@ -62,16 +62,14 @@ public class JenkinsHttpClient {
6262

6363
private ObjectMapper mapper;
6464
private String context;
65-
65+
6666
private String jenkinsVersion;
6767

6868
/**
6969
* Create an unauthenticated Jenkins HTTP client
7070
*
71-
* @param uri
72-
* Location of the jenkins server (ex. http://localhost:8080)
73-
* @param client
74-
* Configured CloseableHttpClient to be used
71+
* @param uri Location of the jenkins server (ex. http://localhost:8080)
72+
* @param client Configured CloseableHttpClient to be used
7573
*/
7674
public JenkinsHttpClient(URI uri, CloseableHttpClient client) {
7775
this.context = uri.getPath();
@@ -90,10 +88,8 @@ public JenkinsHttpClient(URI uri, CloseableHttpClient client) {
9088
/**
9189
* Create an unauthenticated Jenkins HTTP client
9290
*
93-
* @param uri
94-
* Location of the jenkins server (ex. http://localhost:8080)
95-
* @param builder
96-
* Configured HttpClientBuilder to be used
91+
* @param uri Location of the jenkins server (ex. http://localhost:8080)
92+
* @param builder Configured HttpClientBuilder to be used
9793
*/
9894
public JenkinsHttpClient(URI uri, HttpClientBuilder builder) {
9995
this(uri, builder.build());
@@ -102,8 +98,7 @@ public JenkinsHttpClient(URI uri, HttpClientBuilder builder) {
10298
/**
10399
* Create an unauthenticated Jenkins HTTP client
104100
*
105-
* @param uri
106-
* Location of the jenkins server (ex. http://localhost:8080)
101+
* @param uri Location of the jenkins server (ex. http://localhost:8080)
107102
*/
108103
public JenkinsHttpClient(URI uri) {
109104
this(uri, HttpClientBuilder.create());
@@ -112,12 +107,9 @@ public JenkinsHttpClient(URI uri) {
112107
/**
113108
* Create an authenticated Jenkins HTTP client
114109
*
115-
* @param uri
116-
* Location of the jenkins server (ex. http://localhost:8080)
117-
* @param username
118-
* Username to use when connecting
119-
* @param password
120-
* Password or auth token to use when connecting
110+
* @param uri Location of the jenkins server (ex. http://localhost:8080)
111+
* @param username Username to use when connecting
112+
* @param password Password or auth token to use when connecting
121113
*/
122114
public JenkinsHttpClient(URI uri, String username, String password) {
123115
this(uri, addAuthentication(HttpClientBuilder.create(), uri, username, password));
@@ -130,19 +122,15 @@ public JenkinsHttpClient(URI uri, String username, String password) {
130122
/**
131123
* Perform a GET request and parse the response to the given class
132124
*
133-
* @param path
134-
* path to request, can be relative or absolute
135-
* @param cls
136-
* class of the response
137-
* @param <T>
138-
* type of the response
125+
* @param path path to request, can be relative or absolute
126+
* @param cls class of the response
127+
* @param <T> type of the response
139128
* @return an instance of the supplied class
140-
* @throws IOException,
141-
* HttpResponseException
129+
* @throws IOException in case of an error.
142130
*/
143131
public <T extends BaseModel> T get(String path, Class<T> cls) throws IOException {
144132
HttpGet getMethod = new HttpGet(api(path));
145-
133+
146134
HttpResponse response = client.execute(getMethod, localContext);
147135
getJenkinsVersionFromHeader(response);
148136
try {
@@ -158,17 +146,16 @@ public <T extends BaseModel> T get(String path, Class<T> cls) throws IOException
158146
* Perform a GET request and parse the response and return a simple string
159147
* of the content
160148
*
161-
* @param path
162-
* path to request, can be relative or absolute
149+
* @param path path to request, can be relative or absolute
163150
* @return the entity text
164-
* @throws IOException,
165-
* HttpResponseException
151+
* @throws IOException in case of an error.
166152
*/
167153
public String get(String path) throws IOException {
168154
HttpGet getMethod = new HttpGet(api(path));
169155
HttpResponse response = client.execute(getMethod, localContext);
170156
getJenkinsVersionFromHeader(response);
171-
LOGGER.debug("get({}), version={}, responseCode={}", path, this.jenkinsVersion, response.getStatusLine().getStatusCode());
157+
LOGGER.debug("get({}), version={}, responseCode={}", path, this.jenkinsVersion,
158+
response.getStatusLine().getStatusCode());
172159
try {
173160
httpResponseValidator.validateResponse(response);
174161
return IOUtils.toString(response.getEntity().getContent());
@@ -183,12 +170,9 @@ public String get(String path) throws IOException {
183170
* Perform a GET request and parse the response to the given class, logging
184171
* any IOException that is thrown rather than propagating it.
185172
*
186-
* @param path
187-
* path to request, can be relative or absolute
188-
* @param cls
189-
* class of the response
190-
* @param <T>
191-
* type of the response
173+
* @param path path to request, can be relative or absolute
174+
* @param cls class of the response
175+
* @param <T> type of the response
192176
* @return an instance of the supplied class
193177
*/
194178
public <T extends BaseModel> T getQuietly(String path, Class<T> cls) {
@@ -198,19 +182,17 @@ public <T extends BaseModel> T getQuietly(String path, Class<T> cls) {
198182
return value;
199183
} catch (IOException e) {
200184
LOGGER.debug("getQuietly({}, {})", path, cls.getName(), e);
201-
//TODO: Is returing null a good idea?
185+
// TODO: Is returing null a good idea?
202186
return null;
203187
}
204188
}
205189

206190
/**
207191
* Perform a GET request and return the response as InputStream
208192
*
209-
* @param path
210-
* path to request, can be relative or absolute
193+
* @param path path to request, can be relative or absolute
211194
* @return the response stream
212-
* @throws IOException,
213-
* HttpResponseException
195+
* @throws IOException in case of an error.
214196
*/
215197
public InputStream getFile(URI path) throws IOException {
216198
HttpGet getMethod = new HttpGet(path);
@@ -227,19 +209,14 @@ public <R extends BaseModel, D> R post(String path, D data, Class<R> cls) throws
227209
/**
228210
* Perform a POST request and parse the response to the given class
229211
*
230-
* @param path
231-
* path to request, can be relative or absolute
232-
* @param data
233-
* data to post
234-
* @param cls
235-
* class of the response
236-
* @param <R>
237-
* type of the response
238-
* @param <D>
239-
* type of the data
212+
* @param path path to request, can be relative or absolute
213+
* @param data data to post
214+
* @param cls class of the response
215+
* @param <R> type of the response
216+
* @param <D> type of the data
217+
* @param crumbFlag true / false.
240218
* @return an instance of the supplied class
241-
* @throws IOException,
242-
* HttpResponseException
219+
* @throws IOException in case of an error.
243220
*/
244221
public <R extends BaseModel, D> R post(String path, D data, Class<R> cls, boolean crumbFlag) throws IOException {
245222
HttpPost request = new HttpPost(api(path));
@@ -293,12 +270,10 @@ public <R extends BaseModel, D> R post(String path, D data, Class<R> cls, boolea
293270
* call required. It is unclear if any other jenkins APIs operate in this
294271
* fashion.
295272
*
296-
* @param path
297-
* path to request, can be relative or absolute
298-
* @param data
299-
* data to post
300-
* @throws IOException,
301-
* HttpResponseException
273+
* @param path path to request, can be relative or absolute
274+
* @param data data to post
275+
* @param crumbFlag true / false.
276+
* @throws IOException in case of an error.
302277
*/
303278
public void post_form(String path, Map<String, String> data, boolean crumbFlag) throws IOException {
304279
HttpPost request;
@@ -341,13 +316,10 @@ public void post_form(String path, Map<String, String> data, boolean crumbFlag)
341316
* Perform a POST request of XML (instead of using json mapper) and return a
342317
* string rendering of the response entity.
343318
*
344-
* @param path
345-
* path to request, can be relative or absolute
346-
* @param xml_data
347-
* data data to post
319+
* @param path path to request, can be relative or absolute
320+
* @param xml_data data data to post
348321
* @return A string containing the xml response (if present)
349-
* @throws IOException,
350-
* HttpResponseException
322+
* @throws IOException in case of an error.
351323
*/
352324
public String post_xml(String path, String xml_data) throws IOException {
353325
return post_xml(path, xml_data, true);
@@ -379,11 +351,11 @@ public String post_xml(String path, String xml_data, boolean crumbFlag) throws I
379351
/**
380352
* Post a text entity to the given URL using the default content type
381353
*
382-
* @param path
383-
* @param textData
384-
* @param crumbFlag
354+
* @param path The path.
355+
* @param textData data.
356+
* @param crumbFlag true/false.
385357
* @return resulting response
386-
* @throws IOException
358+
* @throws IOException in case of an error.
387359
*/
388360
public String post_text(String path, String textData, boolean crumbFlag) throws IOException {
389361
return post_text(path, textData, ContentType.DEFAULT_TEXT, crumbFlag);
@@ -392,11 +364,12 @@ public String post_text(String path, String textData, boolean crumbFlag) throws
392364
/**
393365
* Post a text entity to the given URL with the given content type
394366
*
395-
* @param path
396-
* @param textData
397-
* @param crumbFlag
367+
* @param path The path.
368+
* @param textData The data.
369+
* @param contentType {@link ContentType}
370+
* @param crumbFlag true or false.
398371
* @return resulting response
399-
* @throws IOException
372+
* @throws IOException in case of an error.
400373
*/
401374
public String post_text(String path, String textData, ContentType contentType, boolean crumbFlag)
402375
throws IOException {
@@ -425,10 +398,8 @@ public String post_text(String path, String textData, ContentType contentType, b
425398
/**
426399
* Perform POST request that takes no parameters and returns no response
427400
*
428-
* @param path
429-
* path to request
430-
* @throws IOException,
431-
* HttpResponseException
401+
* @param path path to request
402+
* @throws IOException in case of an error.
432403
*/
433404
public void post(String path) throws IOException {
434405
post(path, null, null, false);
@@ -458,7 +429,7 @@ private URI api(String path) {
458429
String[] components = path.split("\\?", 2);
459430
path = urlJoin(components[0], "api/json") + "?" + components[1];
460431
}
461-
return uri.resolve("/").resolve(path.replace(" ","%20"));
432+
return uri.resolve("/").resolve(path.replace(" ", "%20"));
462433
}
463434

464435
private URI noapi(String path) {
@@ -495,7 +466,7 @@ private void getJenkinsVersionFromHeader(HttpResponse response) {
495466
Header[] headers = response.getHeaders("X-Jenkins");
496467
if (headers.length == 1) {
497468
this.jenkinsVersion = headers[0].getValue();
498-
}
469+
}
499470
}
500471

501472
private void releaseConnection(HttpRequestBase httpRequestBase) {
@@ -517,10 +488,10 @@ protected static HttpClientBuilder addAuthentication(HttpClientBuilder builder,
517488
}
518489

519490
protected HttpContext getLocalContext() {
520-
return localContext;
491+
return localContext;
521492
}
522493

523494
protected void setLocalContext(HttpContext localContext) {
524-
this.localContext = localContext;
495+
this.localContext = localContext;
525496
}
526497
}

jenkins-client/src/main/java/com/offbytwo/jenkins/helper/ComparableVersion.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
/**
3232
* This code is copied from Maven Core with slight modifications. Generic implementation of version comparison.
33-
* <p>
3433
* Features:
3534
* <ul>
3635
* <li>mixing of '<code>-</code>' (hyphen) and '<code>.</code>' (dot) separators,</li>
@@ -52,7 +51,6 @@
5251
* Unknown qualifiers are considered after known qualifiers, with lexical order (always case insensitive),</li>
5352
* <li>a hyphen usually precedes a qualifier, and is always less important than something preceded with a dot.</li>
5453
* </ul>
55-
* </p>
5654
*
5755
* @see <a href="https://cwiki.apache.org/confluence/display/MAVENOLD/Versioning">"Versioning" on Maven Wiki</a>
5856
* @author <a href="mailto:[email protected]">Kenney Westerhof</a>

jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildChangeSet.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ public class BuildChangeSet {
2222
private String kind;
2323

2424
/**
25-
*
26-
*/
25+
* @param items {@link BuildChangeSet}
26+
*/
2727
public void setItems(List<BuildChangeSetItem> items) {
2828
this.items = items;
2929
}
3030

3131
/**
32-
* @return the items
32+
* @return list of {@link BuildChangeSet}
3333
*/
3434
public List<BuildChangeSetItem> getItems() {
3535
return items;
@@ -43,8 +43,8 @@ public String getKind() {
4343
}
4444

4545
/**
46-
*
47-
*/
46+
* @param kind the kind of (usually svn, git).
47+
*/
4848
public void setKind(String kind) {
4949
this.kind = kind;
5050
}

jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildWithDetails.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ public String getConsoleOutputText() throws IOException {
362362
* The console output with HTML.
363363
*
364364
* @return The console output as HTML.
365-
* @throws IOException
365+
* @throws IOException in case of an error.
366366
*/
367367
public String getConsoleOutputHtml() throws IOException {
368368
return client.get(getUrl() + "/logText/progressiveHtml");

jenkins-client/src/main/java/com/offbytwo/jenkins/model/ComputerWithDetails.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Boolean getLaunchSupported() {
6363
* (node) name.
6464
*
6565
* @return {@link LoadStatistics}
66-
* @throws IOException
66+
* @throws IOException in case of an error.
6767
*/
6868
public LoadStatistics getLoadStatistics() throws IOException {
6969
// TODO: Think about the following handling, cause that has also being

jenkins-client/src/main/java/com/offbytwo/jenkins/model/Crumb.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.offbytwo.jenkins.model;
22

33
/**
4-
* @author Adrien Lecharpentier <[email protected]>
4+
* @author Adrien Lecharpentier
5+
* <a href="mailto:[email protected]">adrien.
6+
57
*/
68
public class Crumb extends BaseModel {
79

jenkins-client/src/main/java/com/offbytwo/jenkins/model/Executor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
/**
44
* This class is based on informations which can be extracted from an running
5-
* Jenkins instance like this: {@link http://jenkins-server/computer/api/schema}
5+
* Jenkins instance via
6+
* <a href="http://jenkins-server/computer/api/schema">http://jenkins-server/
7+
* computer/api/schema</a>.
68
*
79
* @author Karl Heinz Marbaise
810
*

0 commit comments

Comments
 (0)