Skip to content

Commit c28028f

Browse files
author
Igor Polevoy
authored
Merge pull request #300 from DevFactory/release/general-code-quality-fix-1
Multiple code quality fix-1
2 parents e2e169d + 151cac2 commit c28028f

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

activeweb-testing/src/main/java/org/javalite/activeweb/RequestBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ private void submitRequest(String actionName, HttpMethod method) {
336336
checkParamAndMultipart();
337337

338338
//TODO: refactor this method, getting out of control
339-
if(contentType != null && contentType.equals(MULTIPART) && formItems.size() > 0){
339+
if(contentType != null && contentType.equals(MULTIPART) && !formItems.isEmpty()){
340340
request = new MockMultipartHttpServletRequestImpl();
341341
for (FormItem item : formItems) {
342342
((AWMockMultipartHttpServletRequest) request).addFormItem(item);

activeweb/src/main/java/org/javalite/activeweb/RequestDispatcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain
230230
}finally {
231231
Context.clear();
232232
List<String> connectionsRemaining = DB.getCurrrentConnectionNames();
233-
if(connectionsRemaining.size() != 0){
233+
if(!connectionsRemaining.isEmpty()){
234234
logger.warn("CONNECTION LEAK DETECTED ... and AVERTED!!! You left connections opened:"
235235
+ connectionsRemaining + ". ActiveWeb is closing all active connections for you...");
236236
DB.closeAllConnections();

activeweb/src/main/java/org/javalite/activeweb/RouteBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ protected boolean matches(String requestUri, HttpMethod httpMethod) throws Class
237237
String[] tailArr = Arrays.copyOfRange(requestUriSegments, segments.size() - 1, requestUriSegments.length);
238238
wildCardValue = Util.join(tailArr, "/");
239239
match = true;
240-
}else if(segments.size() == 0 && requestUri.equals("/")){
240+
}else if(segments.isEmpty() && requestUri.equals("/")){
241241
//this is matching root path: "/"
242242
actionName = "index";
243243
match = true;
@@ -272,7 +272,7 @@ private boolean wildSegmentsMatch(String[] requestUriSegments) throws ClassLoadE
272272
}
273273

274274
private boolean methodMatches(HttpMethod httpMethod) {
275-
return methods.size() == 0 && httpMethod.equals(HttpMethod.GET) || methods.contains(httpMethod);
275+
return methods.isEmpty() && httpMethod.equals(HttpMethod.GET) || methods.contains(httpMethod);
276276
}
277277

278278
private AppController reloadController() throws ClassLoadException {

activeweb/src/main/java/org/javalite/activeweb/Router.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ protected String findPackagePrefix(String uri) {
384384
resultIndex = i;
385385
}
386386
}
387-
return candidates.size() > 0 ? candidates.get(resultIndex) : null;
387+
return !candidates.isEmpty() ? candidates.get(resultIndex) : null;
388388
}
389389

390390
//todo: write a regexp one day

javalite-async/src/main/java/org/javalite/async/Async.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ In my case, below configuration (made on JBoss 7.1.1.Final) has helped:
175175
private void configurePaging() {
176176
AddressSettings addressSettings = new AddressSettings();
177177
addressSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE);
178-
addressSettings.setMaxSizeBytes(30 * 1024 * 1024);
179-
addressSettings.setPageSizeBytes(10 * 1024 * 1024);
178+
addressSettings.setMaxSizeBytes(30 * 1024 * 1024L);
179+
addressSettings.setPageSizeBytes(10 * 1024 * 1024L);
180180
addressSettings.setPageCacheMaxSize(20);
181181
config.getAddressesSettings().put("jms.queue.*", addressSettings);
182182
}

0 commit comments

Comments
 (0)