From 6dfc3c19e756dba7d0563d4fc8e920a72cc8bef9 Mon Sep 17 00:00:00 2001 From: Suraj Khurana Date: Mon, 31 Aug 2020 20:01:25 +0530 Subject: [PATCH] Improved: Corrected some extra spaces and naming conventions related checkstyle issues. (OFBIZ-11921) Also fixed some access modifiers for some private class members. Thanks Jacques Le Roux for review. --- .../multisite/MultiSiteRequestWrapper.java | 6 +- .../apache/ofbiz/ebaystore/EbayAccount.java | 2 +- .../apache/ofbiz/ebaystore/EbayFeedback.java | 2 +- .../org/apache/ofbiz/ebaystore/EbayStore.java | 2 +- .../ebaystore/EbayStoreInventoryServices.java | 4 +- .../ofbiz/example/ExampleWebSockets.java | 22 +++++-- .../apache/ofbiz/htmlreport/HtmlReport.java | 66 +++++++++++-------- 7 files changed, 65 insertions(+), 39 deletions(-) diff --git a/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java b/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java index 149ad9211..4c5ee39ef 100644 --- a/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java +++ b/cmssite/src/main/java/org/apache/ofbiz/cmssite/multisite/MultiSiteRequestWrapper.java @@ -116,9 +116,9 @@ public class MultiSiteRequestWrapper implements HttpServletRequest { } } return pathInfo.substring(nextPathSegmentStart); - } else { - return pathInfo; - } + } else { + return pathInfo; + } } @Override diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java index 0210cc918..cfe3a5eaa 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayAccount.java @@ -79,7 +79,7 @@ public class EbayAccount { street1 = regAddress.getStreet1(); street2 = regAddress.getStreet2(); } - if (firstName == null && lastName == null && name !=null) { + if (firstName == null && lastName == null && name != null) { String nameArray[] = name.split(" "); firstName = nameArray[0]; lastName = nameArray[1]; diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java index c6f4ca3ba..83b5353b1 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayFeedback.java @@ -240,7 +240,7 @@ public class EbayFeedback { entry.put("userID", transection.getItem().getSeller().getUserID()); entry.put("role", "seller"); } - if (transection.getShippingDetails()!=null) { + if (transection.getShippingDetails() != null) { entry.put("shippingCost", transection.getShippingDetails().getDefaultShippingCost().getValue()); entry.put("shippingCurrency", transection.getShippingDetails().getDefaultShippingCost().getCurrencyID().name()); } diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java index 23123be48..25f5cd2b2 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStore.java @@ -1260,7 +1260,7 @@ public class EbayStore { storeTheme.setThemeID(Integer.parseInt((String) context.get("storeAdvancedTheme"))); } else if ("Basic".equals(context.get("themeType"))) { storeColorScheme = new StoreColorSchemeType(); - if (context.get("storeBasicTheme")!=null) { + if (context.get("storeBasicTheme") != null) { String storeBasicTheme = (String) context.get("storeBasicTheme"); String storeThemeId = null; String storeColorSchemeId = null; diff --git a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java index 86609650d..4f6696e29 100644 --- a/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java +++ b/ebaystore/src/main/java/org/apache/ofbiz/ebaystore/EbayStoreInventoryServices.java @@ -154,7 +154,7 @@ public class EbayStoreInventoryServices { sellingManagerProductDetailsType.setProductName((EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne()).getString("internalName")); //Must keep productId in SKU NUMBER because ebay allow productId field only long value. sellingManagerProductDetailsType.setCustomLabel(productId); - if (ebayProductStoreInventory!=null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue()); + if (ebayProductStoreInventory != null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue()); productReq.setSellingManagerProductDetails(sellingManagerProductDetailsType); productResp = (AddSellingManagerProductResponseType) productCall.execute(productReq); @@ -206,7 +206,7 @@ public class EbayStoreInventoryServices { sellingManagerProductDetailsType.setProductName((EntityQuery.use(delegator).from("Product").where("productId", productId).queryOne()).getString("internalName")); //Must keep productId in SKU NUMBER because ebay allow productId field only long value. sellingManagerProductDetailsType.setCustomLabel(productId); - if (ebayProductStoreInventory!=null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue()); + if (ebayProductStoreInventory != null) sellingManagerProductDetailsType.setQuantityAvailable(ebayProductStoreInventory.getBigDecimal("availableToPromiseListing").intValue()); req.setSellingManagerProductDetails(sellingManagerProductDetailsType); resp = (ReviseSellingManagerProductResponseType) call.execute(req); diff --git a/example/src/main/java/org/apache/ofbiz/example/ExampleWebSockets.java b/example/src/main/java/org/apache/ofbiz/example/ExampleWebSockets.java index c0afba464..61b36b637 100644 --- a/example/src/main/java/org/apache/ofbiz/example/ExampleWebSockets.java +++ b/example/src/main/java/org/apache/ofbiz/example/ExampleWebSockets.java @@ -37,8 +37,14 @@ public class ExampleWebSockets { private static final String MODULE = ExampleWebSockets.class.getName(); private static Set clients = Collections.synchronizedSet(new HashSet()); - + + /** + * On message. + * @param session the session + * @param msg the msg + * @param last the last + */ @OnMessage public void onMessage(Session session, String msg, boolean last) { try { @@ -60,19 +66,27 @@ public class ExampleWebSockets { } } + /** + * On open. + * @param session the session + */ @OnOpen - public void onOpen (Session session) { + public void onOpen(Session session) { // Add session to the connected sessions clients set clients.add(session); } + /** + * On close. + * @param session the session + */ @OnClose - public void onClose (Session session) { + public void onClose(Session session) { // Remove session from the connected sessions clients set clients.remove(session); } - public static Set getClients () { + public static Set getClients() { return clients; } } diff --git a/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java b/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java index 73e5cfa8e..c513fea3b 100644 --- a/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java +++ b/pricat/src/main/java/org/apache/ofbiz/htmlreport/HtmlReport.java @@ -66,25 +66,25 @@ public class HtmlReport extends AbstractReport { protected static final String LINEBREAK_TRADITIONAL = "
\n"; /** The list of report objects e.g. String, Exception ... */ - protected List content; + private List content; /** The list of report objects e.g. String, Exception ... */ - protected List logContent; + private List logContent; /** * Counter to remember what is already shown, * indicates the next index of the content list that has to be reported. */ - protected int indexNext; + private int indexNext; /** Flag to indicate if an exception should be displayed long or short. */ - protected boolean showExceptionStackTrace; + private boolean showExceptionStackTrace; /** If set to true nothing is kept in memory. */ - protected boolean isTransient; + private boolean isTransient; /** Boolean flag indicating whether this report should generate HTML or JavaScript output. */ - protected boolean writeHtml; + private boolean writeHtml; /** Helper variable to deliver the html end part. */ public static final int HTML_END = 1; @@ -93,19 +93,19 @@ public class HtmlReport extends AbstractReport { public static final int HTML_START = 0; /** The thread to display in this report. */ - protected String paramThread; + private String paramThread; /** The next thread to display after this report. */ - protected String paramThreadHasNext; + private String paramThreadHasNext; - protected String paramAction; + private String paramAction; - protected String paramTitle; + private String paramTitle; - protected String paramResource; + private String paramResource; /** Flag for refreching workplace .*/ - protected String paramRefreshWorkplace; + private String paramRefreshWorkplace; /** Constant for the "OK" button in the build button methods. */ public static final int BUTTON_OK = 0; @@ -152,21 +152,21 @@ public class HtmlReport extends AbstractReport { /** Request parameter value for the action: set. */ public static final String DIALOG_SET = "set"; /** The RESOURCE list parameter value. */ - protected String paramResourcelist; + private String paramResourcelist; /** The list of RESOURCE names for the multi operation. */ - protected List resourceList; + private List resourceList; /** The key name which contains the localized message for the continue checkbox. */ - protected String paramReportContinueKey; + private String paramReportContinueKey; public static final String DIALOG_URI = "dialoguri"; public static final String FORM_URI = "formuri"; private static final String RESOURCE = "PricatUiLabels"; /** Log file. */ - protected File logFile; + private File logFile; /** Log file name. */ - protected String logFileName; + private String logFileName; /** Log file output stream. */ - protected FileOutputStream logFileOutputStream; - protected long sequenceNum = -1; + private FileOutputStream logFileOutputStream; + private long sequenceNum = -1; /** * Constructs a new report using the provided locale for the output language.

@@ -210,7 +210,8 @@ public class HtmlReport extends AbstractReport { } return wp; } - public static HtmlReport getInstance(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, String logFileName) { + public static HtmlReport getInstance(HttpServletRequest request, HttpServletResponse response, boolean writeHtml, boolean isTransient, + String logFileName) { HtmlReport wp = (HtmlReport) request.getSession().getAttribute(SESSION_REPORT_CLASS); if (wp == null || UtilValidate.isEmpty(wp.getLogFileName()) || !wp.getLogFileName().equals(logFileName)) { wp = new HtmlReport(request, response, writeHtml, isTransient); @@ -218,14 +219,29 @@ public class HtmlReport extends AbstractReport { } return wp; } + + /** + * Gets param action. + * @param request the request + * @return the param action + */ public String getParamAction(HttpServletRequest request) { paramAction = request.getParameter("action"); return paramAction != null ? paramAction : "reportbegin"; } + + /** + * Sets param action. + * @param action the action + */ public void setParamAction(String action) { paramAction = action; } + /** + * Sets param thread. + * @param name the name + */ public void setParamThread(String name) { paramThread = name; } @@ -776,9 +792,7 @@ public class HtmlReport extends AbstractReport { result.append("\n"); } @@ -875,8 +889,7 @@ public class HtmlReport extends AbstractReport { * @return the button row */ public String dialogButtonsOkCancel(HttpServletRequest request, String okAttrs, String cancelAttrs) { - if (Boolean.valueOf(getParamThreadHasNext(request)) - && ReportStringUtil.isNotEmpty(getParamReportContinueKey())) { + if (Boolean.valueOf(getParamThreadHasNext(request)) && ReportStringUtil.isNotEmpty(getParamReportContinueKey())) { return dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[] { okAttrs, cancelAttrs}); @@ -898,8 +911,7 @@ public class HtmlReport extends AbstractReport { } else { downloadAttrs += " "; } - if (Boolean.valueOf(getParamThreadHasNext(request)) - && ReportStringUtil.isNotEmpty(getParamReportContinueKey())) { + if (Boolean.valueOf(getParamThreadHasNext(request)) && ReportStringUtil.isNotEmpty(getParamReportContinueKey())) { return dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL, BUTTON_DOWNLOAD}, new String[] { okAttrs, cancelAttrs,