This is an automated email from the ASF dual-hosted git repository.
surajk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 8b1e0db Improved: Corrected all checkstyle formatting issues: 'typecast' is not followed by whitespace in framework component. (OFBIZ-11887) 8b1e0db is described below commit 8b1e0dbd8539a3fb325221e013d3a6d1824b8210 Author: Suraj Khurana <[hidden email]> AuthorDate: Sat Jul 18 12:26:42 2020 +0530 Improved: Corrected all checkstyle formatting issues: 'typecast' is not followed by whitespace in framework component. (OFBIZ-11887) --- .../ofbiz/base/config/MainResourceHandler.java | 4 +- .../base/container/NamingServiceContainer.java | 4 +- .../main/java/org/apache/ofbiz/base/lang/JSON.java | 2 +- .../org/apache/ofbiz/base/util/GroovyUtil.java | 2 +- .../ofbiz/base/util/RMIExtendedSocketFactory.java | 28 +-- .../java/org/apache/ofbiz/base/util/SSLUtil.java | 2 +- .../org/apache/ofbiz/base/util/TimeDuration.java | 6 +- .../org/apache/ofbiz/base/util/UtilFormatOut.java | 4 +- .../java/org/apache/ofbiz/base/util/UtilHttp.java | 4 +- .../java/org/apache/ofbiz/base/util/UtilMisc.java | 6 +- .../org/apache/ofbiz/base/util/UtilNumber.java | 192 ++++++++++----------- .../org/apache/ofbiz/base/util/UtilProperties.java | 12 +- .../org/apache/ofbiz/base/util/UtilValidate.java | 39 ++--- .../java/org/apache/ofbiz/base/util/UtilXml.java | 14 +- .../base/util/string/FlexibleStringExpander.java | 2 +- .../org/apache/ofbiz/base/util/string/UelUtil.java | 2 +- .../ofbiz/base/util/template/XslTransform.java | 2 +- .../catalina/container/CatalinaContainer.java | 10 +- .../org/apache/ofbiz/common/CommonServices.java | 4 +- .../java/org/apache/ofbiz/common/FindServices.java | 4 +- .../apache/ofbiz/common/email/EmailServices.java | 4 +- .../apache/ofbiz/common/image/ImageTransform.java | 6 +- .../apache/ofbiz/common/login/LoginServices.java | 18 +- .../org/apache/ofbiz/entity/GenericDelegator.java | 2 +- .../org/apache/ofbiz/entity/GenericEntity.java | 4 +- .../entity/condition/EntityConditionBuilder.java | 8 +- .../entity/condition/EntityConditionList.java | 2 +- .../ofbiz/entity/condition/EntityFunction.java | 6 +- .../entity/connection/DebugManagedDataSource.java | 4 +- .../ofbiz/entity/finder/EntityFinderUtil.java | 6 +- .../org/apache/ofbiz/entity/jdbc/SQLProcessor.java | 3 +- .../org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java | 2 +- .../org/apache/ofbiz/entity/model/ModelEntity.java | 6 +- .../org/apache/ofbiz/entity/model/ModelReader.java | 4 +- .../org/apache/ofbiz/entity/model/ModelUtil.java | 4 +- .../apache/ofbiz/entity/test/EntityTestSuite.java | 80 ++++----- .../apache/ofbiz/entity/util/EntityDataAssert.java | 4 +- .../org/apache/ofbiz/entity/util/EntityUtil.java | 4 +- .../org/apache/ofbiz/entity/util/SequenceUtil.java | 2 +- .../permission/EntityPermissionChecker.java | 50 +++--- .../synchronization/EntitySyncContext.java | 4 +- .../synchronization/EntitySyncServices.java | 6 +- .../ofbiz/minilang/method/conditional/Compare.java | 9 +- .../org/apache/ofbiz/security/SecurityUtil.java | 2 +- .../org/apache/ofbiz/service/ModelPermGroup.java | 2 +- .../org/apache/ofbiz/service/ModelPermission.java | 40 +++-- .../apache/ofbiz/service/ServiceDispatcher.java | 10 +- .../org/apache/ofbiz/service/ServiceXaWrapper.java | 2 +- .../ofbiz/service/calendar/RecurrenceRule.java | 3 +- .../service/calendar/TemporalExpressions.java | 2 +- .../ofbiz/service/engine/EntityAutoEngine.java | 6 +- .../apache/ofbiz/service/engine/GroovyEngine.java | 2 +- .../org/apache/ofbiz/service/job/JobManager.java | 3 +- .../ofbiz/service/mail/JavaMailContainer.java | 2 +- .../ofbiz/service/mail/MimeMessageWrapper.java | 8 +- .../ofbiz/service/rmi/RmiServiceContainer.java | 2 +- .../org/apache/ofbiz/testtools/ModelTestSuite.java | 6 +- .../apache/ofbiz/testtools/TestRunContainer.java | 2 +- .../apache/ofbiz/webapp/control/ContextFilter.java | 2 +- .../ofbiz/webapp/control/RequestHandler.java | 10 +- .../org/apache/ofbiz/webapp/event/CoreEvents.java | 2 +- .../ofbiz/webapp/event/GroovyEventHandler.java | 8 +- .../ofbiz/webapp/event/ScriptEventHandler.java | 6 +- .../webapp/event/ServiceMultiEventHandler.java | 10 +- .../ofbiz/webapp/ftl/OfbizContentTransform.java | 2 +- .../ofbiz/webapp/ftl/OfbizNumberTransform.java | 7 +- .../ofbiz/webapp/ftl/SetContextFieldTransform.java | 2 +- .../webapp/ftl/SetRequestAttributeMethod.java | 2 +- .../org/apache/ofbiz/webtools/UtilCacheEvents.java | 2 +- .../apache/ofbiz/webtools/WebToolsServices.java | 2 +- .../artifactinfo/ControllerViewArtifactInfo.java | 4 +- .../artifactinfo/FormWidgetArtifactInfo.java | 4 +- .../artifactinfo/ScreenWidgetArtifactInfo.java | 4 +- .../java/org/apache/ofbiz/widget/WidgetWorker.java | 2 +- .../ofbiz/widget/cache/WidgetContextCacheKey.java | 12 +- .../org/apache/ofbiz/widget/model/FieldInfo.java | 2 +- .../ofbiz/widget/model/IterateSectionWidget.java | 6 +- .../apache/ofbiz/widget/model/ModelFormField.java | 9 +- .../org/apache/ofbiz/widget/model/ModelTheme.java | 4 +- .../apache/ofbiz/widget/model/ScreenFactory.java | 2 +- .../ofbiz/widget/portal/PortalPageWorker.java | 4 +- .../ofbiz/widget/renderer/MenuWrapTransform.java | 22 +-- .../ofbiz/widget/renderer/fo/FoFormRenderer.java | 4 +- .../widget/renderer/html/HtmlMenuRenderer.java | 4 +- .../renderer/html/HtmlMenuRendererImage.java | 2 +- .../widget/renderer/html/HtmlMenuWrapper.java | 24 +-- .../widget/renderer/html/HtmlMenuWrapperImage.java | 2 +- .../widget/renderer/macro/MacroScreenRenderer.java | 2 +- 88 files changed, 412 insertions(+), 429 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/config/MainResourceHandler.java b/framework/base/src/main/java/org/apache/ofbiz/base/config/MainResourceHandler.java index d9c91f7..d3e6836 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/config/MainResourceHandler.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/config/MainResourceHandler.java @@ -103,9 +103,7 @@ public final class MainResourceHandler implements ResourceHandler { } MainResourceHandler other = (MainResourceHandler) obj; - return this.loaderName.equals(other.loaderName) && - this.xmlFilename.equals(other.xmlFilename) && - this.location.equals(other.location); + return this.loaderName.equals(other.loaderName) && this.xmlFilename.equals(other.xmlFilename) && this.location.equals(other.location); } @Override diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java b/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java index 6967a31..866559a 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/container/NamingServiceContainer.java @@ -75,8 +75,8 @@ public class NamingServiceContainer implements Container { } try { - rmiSocketFactory = new RMIExtendedSocketFactory( namingHost ); - } catch ( UnknownHostException uhEx ) { + rmiSocketFactory = new RMIExtendedSocketFactory(namingHost); + } catch (UnknownHostException uhEx) { throw new ContainerException("Invalid host defined in container [naming-container] configuration; not a valid IP address", uhEx); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java b/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java index b41f283..d9f7010 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java @@ -101,7 +101,7 @@ public final class JSON { return true; } if (obj instanceof JSON) { - return jsonString.equals(((JSON)obj).jsonString); + return jsonString.equals(((JSON) obj).jsonString); } return false; } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java index bf7d520..8f9542b 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java @@ -115,7 +115,7 @@ public final class GroovyUtil { vars.putAll(context); if (UtilValidate.isNotEmpty(expression)) { //analyse expression to find variables by split non alpha, ignoring "_" to allow my_variable usage - String [] variables = expression.split("[\\P{Alpha}&&[^_]]+"); + String[] variables = expression.split("[\\P{Alpha}&&[^_]]+"); for (String variable: variables) { if (!vars.containsKey(variable)) { vars.put(variable, null); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/RMIExtendedSocketFactory.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/RMIExtendedSocketFactory.java index 2cfdb8c..44d0fca 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/RMIExtendedSocketFactory.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/RMIExtendedSocketFactory.java @@ -49,7 +49,7 @@ public class RMIExtendedSocketFactory extends RMISocketFactory { * * @param inetAddress The <code>InetAddress</code> of the network interface. */ - public RMIExtendedSocketFactory( InetAddress inetAddress ) { + public RMIExtendedSocketFactory(InetAddress inetAddress) { this.hostInetAddress = inetAddress; } @@ -60,26 +60,26 @@ public class RMIExtendedSocketFactory extends RMISocketFactory { * @param hostIpAddress The IP address of the interface to bind the server sockets to. * @throws UnknownHostException If an invalid IP address is provided. */ - public RMIExtendedSocketFactory( String hostIpAddress ) throws UnknownHostException { + public RMIExtendedSocketFactory(String hostIpAddress) throws UnknownHostException { // check if host length is at least equal to "0.0.0.0" - if ( hostIpAddress != null && hostIpAddress.length() >= 7 ) { - String[] octets = hostIpAddress.split( "\\." ); + if (hostIpAddress != null && hostIpAddress.length() >= 7) { + String[] octets = hostIpAddress.split("\\."); if (octets.length != 4) { - throw new UnknownHostException( "Invalid IP address: " + hostIpAddress ); + throw new UnknownHostException("Invalid IP address: " + hostIpAddress); } byte[] ipAddr = new byte[4]; - for ( int i = 0; i < octets.length; i++ ) { + for (int i = 0; i < octets.length; i++) { try { - ipAddr[i] = ( byte ) Integer.parseInt( octets[i] ); - } catch ( NumberFormatException nfEx ) { - throw new UnknownHostException( "Invalid IP address: " + hostIpAddress ); + ipAddr[i] = (byte) Integer.parseInt(octets[i]); + } catch (NumberFormatException nfEx) { + throw new UnknownHostException("Invalid IP address: " + hostIpAddress); } } - hostInetAddress = InetAddress.getByAddress( ipAddr ); + hostInetAddress = InetAddress.getByAddress(ipAddr); } @@ -87,16 +87,16 @@ public class RMIExtendedSocketFactory extends RMISocketFactory { @Override public ServerSocket createServerSocket(int port) throws IOException { - if ( hostInetAddress != null ) { - return new ServerSocket( port, 0, hostInetAddress ); + if (hostInetAddress != null) { + return new ServerSocket(port, 0, hostInetAddress); } - return new ServerSocket( port ); + return new ServerSocket(port); } @Override public Socket createSocket(String host, int port) throws IOException { - return new Socket( host, port ); + return new Socket(host, port); } } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java index 22a8953..8fe4cf8 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java @@ -184,7 +184,7 @@ public final class SSLUtil { if (alias != null) { for (int i = 0; i < keyManagers.length; i++) { if (keyManagers[i] instanceof X509KeyManager) { - keyManagers[i] = new AliasKeyManager((X509KeyManager)keyManagers[i], alias); + keyManagers[i] = new AliasKeyManager((X509KeyManager) keyManagers[i], alias); } } } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java index 2e67310..b4f9960 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/TimeDuration.java @@ -245,9 +245,9 @@ public class TimeDuration implements Serializable, Comparable<TimeDuration> { * @return <code>true</code> if this duration is zero */ public boolean isZero() { - return this.milliseconds == 0 && this.seconds == 0 && - this.minutes == 0 && this.hours == 0 && this.days == 0 && - this.months == 0 && this.years == 0; + return this.milliseconds == 0 && this.seconds == 0 + && this.minutes == 0 && this.hours == 0 && this.days == 0 + && this.months == 0 && this.years == 0; } /** Returns the milliseconds in this time duration. */ diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java index 5e46a86..8b12610 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java @@ -157,8 +157,8 @@ public final class UtilFormatOut { public static String formatDecimalNumber(double number, String pattern, Locale locale) { com.ibm.icu.text.NumberFormat nf = com.ibm.icu.text.NumberFormat.getNumberInstance(locale); String nbParsing = ""; - ((com.ibm.icu.text.DecimalFormat)nf).applyPattern( pattern ); - ((com.ibm.icu.text.DecimalFormat)nf).toPattern(); + ((com.ibm.icu.text.DecimalFormat) nf).applyPattern(pattern); + ((com.ibm.icu.text.DecimalFormat) nf).toPattern(); nbParsing = nf.format(number); return nbParsing; } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java index f1de55a..ad354b8 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java @@ -1578,7 +1578,7 @@ public final class UtilHttp { paramMapStore.remove(paramMapId); for (Map.Entry<String, Object> paramEntry : paramMap.entrySet()) { if (request.getAttribute(paramEntry.getKey()) != null) { - Debug.logWarning("Skipped loading parameter [" + paramEntry.getKey() + "] because it would have overwritten a request attribute" , MODULE); + Debug.logWarning("Skipped loading parameter [" + paramEntry.getKey() + "] because it would have overwritten a request attribute", MODULE); continue; } request.setAttribute(paramEntry.getKey(), paramEntry.getValue()); @@ -1593,7 +1593,7 @@ public final class UtilHttp { * @return String */ public static String getNextUniqueId(HttpServletRequest request) { - Integer uniqueIdNumber= (Integer)request.getAttribute("UNIQUE_ID"); + Integer uniqueIdNumber= (Integer) request.getAttribute("UNIQUE_ID"); if (uniqueIdNumber == null) { uniqueIdNumber = 1; } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java index 5b7f770..946fece 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java @@ -464,7 +464,7 @@ public final class UtilMisc { return (Integer) obj; } if (obj instanceof Number) { - return ((Number)obj).intValue(); + return ((Number) obj).intValue(); } Integer result = null; try { @@ -623,7 +623,7 @@ public final class UtilMisc { Thread.sleep(timeout); } - public static void copyFile(File sourceLocation , File targetLocation) throws IOException { + public static void copyFile(File sourceLocation, File targetLocation) throws IOException { if (sourceLocation.isDirectory()) { throw new IOException("File is a directory, not a file, cannot copy"); } @@ -641,7 +641,7 @@ public final class UtilMisc { } public static int getViewLastIndex(int listSize, int viewSize) { - return (int)Math.ceil(listSize / (float) viewSize) - 1; + return (int) Math.ceil(listSize / (float) viewSize) - 1; } public static Map<String, String> splitPhoneNumber(String phoneNumber, Delegator delegator) { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java index 5b3b167..dce19f9 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java @@ -47,34 +47,34 @@ public final class UtilNumber { * %dollars-and-cents formats in dollars and cents (23.40 comes out as * "twenty-three dollars and forty cents") */ - "%dollars-and-cents:\n" - + " x.0: << [and >%%cents>];\n" - + " 0.x: >%%cents>;\n" - + " 0: zero dollars; one dollar; =%%main= dollars;\n" - + "%%main:\n" - + " zero; one; two; three; four; five; six; seven; eight; nine;\n" - + " ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen;\n" - + " seventeen; eighteen; nineteen;\n" - + " 20: twenty[->>];\n" - + " 30: thirty[->>];\n" - + " 40: forty[->>];\n" - + " 50: fifty[->>];\n" - + " 60: sixty[->>];\n" - + " 70: seventy[->>];\n" - + " 80: eighty[->>];\n" - + " 90: ninety[->>];\n" - + " 100: << hundred[ >>];\n" - + " 1000: << thousand[ >>];\n" - + " 1,000,000: << million[ >>];\n" - + " 1,000,000,000: << billion[ >>];\n" - + " 1,000,000,000,000: << trillion[ >>];\n" - + " 1,000,000,000,000,000: =#,##0=;\n" - + "%%cents:\n" - + " 100: <%%main< cent[s];\n" - + "%dollars-and-hundredths:\n" - + " x.0: <%%main< and >%%hundredths>/100;\n" // this used to end in 'dollars' but that should be added later - + "%%hundredths:\n" - + " 100: <00<;\n"; + "%dollars-and-cents:\n" + + " x.0: << [and >%%cents>];\n" + + " 0.x: >%%cents>;\n" + + " 0: zero dollars; one dollar; =%%main= dollars;\n" + + "%%main:\n" + + " zero; one; two; three; four; five; six; seven; eight; nine;\n" + + " ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen;\n" + + " seventeen; eighteen; nineteen;\n" + + " 20: twenty[->>];\n" + + " 30: thirty[->>];\n" + + " 40: forty[->>];\n" + + " 50: fifty[->>];\n" + + " 60: sixty[->>];\n" + + " 70: seventy[->>];\n" + + " 80: eighty[->>];\n" + + " 90: ninety[->>];\n" + + " 100: << hundred[ >>];\n" + + " 1000: << thousand[ >>];\n" + + " 1,000,000: << million[ >>];\n" + + " 1,000,000,000: << billion[ >>];\n" + + " 1,000,000,000,000: << trillion[ >>];\n" + + " 1,000,000,000,000,000: =#,##0=;\n" + + "%%cents:\n" + + " 100: <%%main< cent[s];\n" + + "%dollars-and-hundredths:\n" + + " x.0: <%%main< and >%%hundredths>/100;\n" // this used to end in 'dollars' but that should be added later + + "%%hundredths:\n" + + " 100: <00<;\n"; // ICU4J rule sets for the th_TH locale. To add more rules, expand this string. // For reference, see the RbnfSampleRuleSets.java file distributed with ICU4J @@ -86,34 +86,34 @@ public final class UtilNumber { * %bahts-and-stangs formats in bahts and stangs (23.40 comes out as * "twenty-three bahts and forty stangs") */ - "%bahts-and-stangs:\n" - + " x.0: << [and >%%stangs>];\n" - + " 0.x: >%%stangs>;\n" - + " 0: zero bahts; one baht; =%%main= bahts;\n" - + "%%main:\n" - + " zero; one; two; three; four; five; six; seven; eight; nine;\n" - + " ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen;\n" - + " seventeen; eighteen; nineteen;\n" - + " 20: twenty[->>];\n" - + " 30: thirty[->>];\n" - + " 40: forty[->>];\n" - + " 50: fifty[->>];\n" - + " 60: sixty[->>];\n" - + " 70: seventy[->>];\n" - + " 80: eighty[->>];\n" - + " 90: ninety[->>];\n" - + " 100: << hundred[ >>];\n" - + " 1000: << thousand[ >>];\n" - + " 1,000,000: << million[ >>];\n" - + " 1,000,000,000: << billion[ >>];\n" - + " 1,000,000,000,000: << trillion[ >>];\n" - + " 1,000,000,000,000,000: =#,##0=;\n" - + "%%stangs:\n" - + " 100: <%%main< stang[s];\n" - + "%bahts-and-hundredths:\n" - + " x.0: <%%main< and >%%hundredths>/100;\n" // this used to end in 'bahts' but that should be added later - + "%%hundredths:\n" - + " 100: <00<;\n"; + "%bahts-and-stangs:\n" + + " x.0: << [and >%%stangs>];\n" + + " 0.x: >%%stangs>;\n" + + " 0: zero bahts; one baht; =%%main= bahts;\n" + + "%%main:\n" + + " zero; one; two; three; four; five; six; seven; eight; nine;\n" + + " ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen;\n" + + " seventeen; eighteen; nineteen;\n" + + " 20: twenty[->>];\n" + + " 30: thirty[->>];\n" + + " 40: forty[->>];\n" + + " 50: fifty[->>];\n" + + " 60: sixty[->>];\n" + + " 70: seventy[->>];\n" + + " 80: eighty[->>];\n" + + " 90: ninety[->>];\n" + + " 100: << hundred[ >>];\n" + + " 1000: << thousand[ >>];\n" + + " 1,000,000: << million[ >>];\n" + + " 1,000,000,000: << billion[ >>];\n" + + " 1,000,000,000,000: << trillion[ >>];\n" + + " 1,000,000,000,000,000: =#,##0=;\n" + + "%%stangs:\n" + + " 100: <%%main< stang[s];\n" + + "%bahts-and-hundredths:\n" + + " x.0: <%%main< and >%%hundredths>/100;\n" // this used to end in 'bahts' but that should be added later + + "%%hundredths:\n" + + " 100: <00<;\n"; // ICU4J rule sets for the en_IN locale. To add more rules, expand this string. // For reference, see the RbnfSampleRuleSets.java file distributed with ICU4J @@ -125,46 +125,46 @@ public final class UtilNumber { * %default formats in rupees and paise (23.40 comes out as * "twenty three point four") */ - "%simplified:\n" - + " x.0: << [rupees and >%%paise>];\n" - + " 0.x: >%%paise>;\n" - + " zero; one; two; three; four; five; six; seven; eight; nine;\n" - + " ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen;\n" - + " seventeen; eighteen; nineteen;\n" - + " 20: twenty[ >>];\n" - + " 30: thirty[ >>];\n" - + " 40: forty[ >>];\n" - + " 50: fifty[ >>];\n" - + " 60: sixty[ >>];\n" - + " 70: seventy[ >>];\n" - + " 80: eighty[ >>];\n" - + " 90: ninety[ >>];\n" - + " 100: << hundred[ >%%and>];\n" - + " 1000: << thousand[ >%%and>];\n" - + " 1,00,000: << lakh[>%%commas>];\n" - + " 1,00,00,000: << crore[>%%commas>];\n" - + " 1,00,00,00,000: =#,##0=;\n" - + "%default:\n" - + " -x: minus >>;\n" - + " x.x: << point >>;\n" - + " =%simplified=;\n" - + " 100: << hundred[ >%%and>];\n" - + " 1000: << thousand[ >%%and>];\n" - + " 1,00,000: << lakh[>%%commas>];\n" - + " 1,00,00,000: << crore[>%%commas>];\n" - + " 10,00,00,000: =#,##0=;\n" - + "%%paise:\n" - + " 100: <%simplified< paise;\n" - + "%%and:\n" - + " and =%default=;\n" - + " 100: =%default=;\n" - + "%%commas:\n" - + " ' and =%default=;\n" - + " 100: , =%default=;\n" - + " 1000: , <%default< thousand, >%default>;\n" - + " 1,00,000: , =%default=;" - + "%%lenient-parse:\n" - + " & ' ' , ',' ;\n"; + "%simplified:\n" + + " x.0: << [rupees and >%%paise>];\n" + + " 0.x: >%%paise>;\n" + + " zero; one; two; three; four; five; six; seven; eight; nine;\n" + + " ten; eleven; twelve; thirteen; fourteen; fifteen; sixteen;\n" + + " seventeen; eighteen; nineteen;\n" + + " 20: twenty[ >>];\n" + + " 30: thirty[ >>];\n" + + " 40: forty[ >>];\n" + + " 50: fifty[ >>];\n" + + " 60: sixty[ >>];\n" + + " 70: seventy[ >>];\n" + + " 80: eighty[ >>];\n" + + " 90: ninety[ >>];\n" + + " 100: << hundred[ >%%and>];\n" + + " 1000: << thousand[ >%%and>];\n" + + " 1,00,000: << lakh[>%%commas>];\n" + + " 1,00,00,000: << crore[>%%commas>];\n" + + " 1,00,00,00,000: =#,##0=;\n" + + "%default:\n" + + " -x: minus >>;\n" + + " x.x: << point >>;\n" + + " =%simplified=;\n" + + " 100: << hundred[ >%%and>];\n" + + " 1000: << thousand[ >%%and>];\n" + + " 1,00,000: << lakh[>%%commas>];\n" + + " 1,00,00,000: << crore[>%%commas>];\n" + + " 10,00,00,000: =#,##0=;\n" + + "%%paise:\n" + + " 100: <%simplified< paise;\n" + + "%%and:\n" + + " and =%default=;\n" + + " 100: =%default=;\n" + + "%%commas:\n" + + " ' and =%default=;\n" + + " 100: , =%default=;\n" + + " 1000: , <%default< thousand, >%default>;\n" + + " 1,00,000: , =%default=;" + + "%%lenient-parse:\n" + + " & ' ' , ',' ;\n"; // hash map to store ICU4J rule sets keyed to Locale private static HashMap<Locale, String> rbnfRuleSets; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java index 1cb6244..a7d9574 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java @@ -144,7 +144,7 @@ public final class UtilProperties implements Serializable { return defaultNumber; } try { - return (Number)(ObjectType.simpleTypeOrObjectConvert(str, type, null, null)); + return (Number) (ObjectType.simpleTypeOrObjectConvert(str, type, null, null)); } catch (GeneralException e) { Debug.logWarning("Error converting String \"" + str + "\" to " + type + "; using defaultNumber " + defaultNumber + ".", MODULE); } @@ -179,7 +179,7 @@ public final class UtilProperties implements Serializable { * @return An Integer-Object of the property; or if not found the defaultNumber */ public static Integer getPropertyAsInteger(String resource, String name, int defaultNumber) { - return (Integer)getPropertyNumber(resource, name, defaultNumber, "Integer"); + return (Integer) getPropertyNumber(resource, name, defaultNumber, "Integer"); } /** @@ -191,7 +191,7 @@ public final class UtilProperties implements Serializable { * @return A Long-Object of the property; or if not found the defaultNumber */ public static Long getPropertyAsLong(String resource, String name, long defaultNumber) { - return (Long)getPropertyNumber(resource, name, defaultNumber, "Long"); + return (Long) getPropertyNumber(resource, name, defaultNumber, "Long"); } /** @@ -203,7 +203,7 @@ public final class UtilProperties implements Serializable { * @return A Long-Object of the property; or if not found the defaultNumber */ public static Float getPropertyAsFloat(String resource, String name, float defaultNumber) { - return (Float)getPropertyNumber(resource, name, defaultNumber, "Float"); + return (Float) getPropertyNumber(resource, name, defaultNumber, "Float"); } /** @@ -215,7 +215,7 @@ public final class UtilProperties implements Serializable { * @return A Double-Object of the property; or if not found the defaultNumber */ public static Double getPropertyAsDouble(String resource, String name, double defaultNumber) { - return (Double)getPropertyNumber(resource, name, defaultNumber, "Double"); + return (Double) getPropertyNumber(resource, name, defaultNumber, "Double"); } /** @@ -954,7 +954,7 @@ public final class UtilProperties implements Serializable { // Support old way of specifying xml:lang value. // Old way: en_AU, new way: en-AU Element value = UtilXml.firstChildElement(property, "value", "xml:lang", correctedLocaleString); - if ( value == null ) { + if ( value == null) { value = UtilXml.firstChildElement(property, "value", "xml:lang", localeString); } if (value != null) { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java index ad5262c..f9cf1e5 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java @@ -1096,15 +1096,15 @@ public final class UtilValidate { String first4digs = cc.substring(0, 4); String first6digs = cc.substring(0, 6); - if (((cc.length() == 16) || (cc.length() == 18) || (cc.length() == 19)) && - ("4903".equals(first4digs) || - "4905".equals(first4digs) || - "4911".equals(first4digs) || - "4936".equals(first4digs) || - "564182".equals(first6digs) || - "633110".equals(first6digs) || - "6333".equals(first4digs) || - "6759".equals(first4digs))) { + if (((cc.length() == 16) || (cc.length() == 18) || (cc.length() == 19)) + && ("4903".equals(first4digs) + || "4905".equals(first4digs) + || "4911".equals(first4digs) + || "4936".equals(first4digs) + || "564182".equals(first6digs) + || "633110".equals(first6digs) + || "6333".equals(first4digs) + || "6759".equals(first4digs))) { return isCreditCard(cc); } return false; @@ -1132,19 +1132,17 @@ public final class UtilValidate { String first6digs = cc.substring(0, 6); String first4digs = cc.substring(0, 4); - if ((cc.length() == 16) && - ("417500".equals(first6digs) || - "4917".equals(first4digs) || - "4913".equals(first4digs) || - "4508".equals(first4digs) || - "4844".equals(first4digs) || - "4027".equals(first4digs))) { + if ((cc.length() == 16) && ("417500".equals(first6digs) + || "4917".equals(first4digs) + || "4913".equals(first4digs) + || "4508".equals(first4digs) + || "4844".equals(first4digs) + || "4027".equals(first4digs))) { return isCreditCard(cc); } return false; } - /** Checks to see if the cc number is a valid number for any accepted credit card * @param ccPassed - a string representing a credit card number * @return true, if the credit card number is any valid credit card number for any of the accepted card types, false otherwise @@ -1153,10 +1151,9 @@ public final class UtilValidate { if (isEmpty(ccPassed)) { return defaultEmptyOK; } - String cc = stripCharsInBag(ccPassed, creditCardDelimiters); - return isCreditCard(cc) && (isMasterCard(cc) || isVisa(cc) || isAmericanExpress(cc) || isDinersClub(cc) || - isDiscover(cc) || isEnRoute(cc) || isJCB(cc) || isSolo(cc)|| isSwitch (cc)|| isVisaElectron(cc)); + return isCreditCard(cc) && (isMasterCard(cc) || isVisa(cc) || isAmericanExpress(cc) || isDinersClub(cc) + || isDiscover(cc) || isEnRoute(cc) || isJCB(cc) || isSolo(cc) || isSwitch(cc) || isVisaElectron(cc)); } /** Checks to see if the cc number is a valid number for any accepted credit card, and return the name of that type @@ -1197,7 +1194,7 @@ public final class UtilValidate { if (isSolo(cc)) { return "CCT_SOLO"; } - if (isSwitch (cc)) { + if (isSwitch(cc)) { return "CCT_SWITCH"; } if (isVisaElectron(cc)) { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java index bbd3cb1..68b6251 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java @@ -444,7 +444,7 @@ public final class UtilXml { } document = builder.parse(is); - double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; + double totalSeconds = (System.currentTimeMillis() - startTime) / 1000.0; if (Debug.verboseOn()) { Debug.logVerbose("XML Read " + totalSeconds + "s: " + docDescription, MODULE); } @@ -569,7 +569,7 @@ public final class UtilXml { parser.parse(inputSource); document = parser.getDocument(); - double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; + double totalSeconds = (System.currentTimeMillis() - startTime) / 1000.0; if (Debug.verboseOn()) { Debug.logVerbose("XML Read " + totalSeconds + "s: " + docDescription, MODULE); } @@ -688,8 +688,7 @@ public final class UtilXml { if (node != null) { do { String nodeName = UtilXml.getNodeNameIgnorePrefix(node); - if (node.getNodeType() == Node.ELEMENT_NODE && (childElementName == null || - childElementName.equals(nodeName))) { + if (node.getNodeType() == Node.ELEMENT_NODE && (childElementName == null || childElementName.equals(nodeName))) { Element childElement = (Element) node; elements.add(childElement); } @@ -831,8 +830,7 @@ public final class UtilXml { if (nodeName == null) { nodeName = UtilXml.getNodeNameIgnorePrefix(node); } - if (node.getNodeType() == Node.ELEMENT_NODE && (childElementName == null || - childElementName.equals(nodeName))) { + if (node.getNodeType() == Node.ELEMENT_NODE && (childElementName == null || childElementName.equals(nodeName))) { Element childElement = (Element) node; return childElement; } @@ -852,8 +850,8 @@ public final class UtilXml { if (node != null) { do { - if (node.getNodeType() == Node.ELEMENT_NODE && (childElementName == null || - childElementName.equals(node.getLocalName() != null ? node.getLocalName() : node.getNodeName()))) { + if (node.getNodeType() == Node.ELEMENT_NODE && (childElementName == null + || childElementName.equals(node.getLocalName() != null ? node.getLocalName() : node.getNodeName()))) { Element childElement = (Element) node; String value = childElement.getAttribute(attrName); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java index b453074..afd7758 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java @@ -653,7 +653,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty { @Override protected Object get(Map<String, ? extends Object> context, TimeZone timeZone, Locale locale) { try { - Map <String, Object> contextCopy = new HashMap<>(context); + Map<String, Object> contextCopy = new HashMap<>(context); Object obj = ScriptUtil.evaluate(this.language, this.script, this.parsedScript, contextCopy); if (obj != null) { return obj; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java index 8bc83db..960d519 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java @@ -111,7 +111,7 @@ public final class UelUtil { */ public static void removeValue(Map<String, Object> context, String expression) { if (Debug.verboseOn()) { - Debug.logVerbose("UelUtil.removeValue invoked, expression = " + expression , MODULE); + Debug.logVerbose("UelUtil.removeValue invoked, expression = " + expression, MODULE); } ELContext elContext = new BasicContext(context); ValueExpression ve = exprFactory.createValueExpression(elContext, expression, Object.class); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/template/XslTransform.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/template/XslTransform.java index 21be661..e754718 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/template/XslTransform.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/template/XslTransform.java @@ -139,7 +139,7 @@ public final class XslTransform { transformer.transform(inputSource, outputResult); Node nd = outputResult.getNode(); - outputDocument = (Document)nd; + outputDocument = (Document) nd; } return outputDocument; diff --git a/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java b/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java index c05cc9e..1cad7ec 100644 --- a/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java +++ b/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java @@ -115,12 +115,12 @@ public class CatalinaContainer implements Container { ofBizRealm.setCredentialHandler(new SimpleCredentialHandler()); } host.setRealm(ofBizRealm); - ((StandardHost)host).addValve(new SingleSignOn()); + ((StandardHost) host).addValve(new SingleSignOn()); } // clustering, valves and connectors setup Configuration.Property clusterProps = prepareTomcatClustering(host, engineConfig); - prepareTomcatEngineValves(engineConfig).forEach(valve -> ((StandardEngine)engine).addValve(valve)); + prepareTomcatEngineValves(engineConfig).forEach(valve -> ((StandardEngine) engine).addValve(valve)); prepareTomcatConnectors(configuration).forEach(connector -> tomcat.getService().addConnector(connector)); loadWebapps(tomcat, configuration, clusterProps); @@ -227,7 +227,7 @@ public class CatalinaContainer implements Container { host.setDeployOnStartup(false); host.setBackgroundProcessorDelay(5); host.setAutoDeploy(false); - ((StandardHost)host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP), + ((StandardHost) host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP), "work" + File.separator + host.getName()).getAbsolutePath()); return host; @@ -310,7 +310,7 @@ public class CatalinaContainer implements Container { throws ContainerException { ReplicationTransmitter trans = new ReplicationTransmitter(); try { - MultiPointSender mps = (MultiPointSender)Class.forName(ContainerConfig.getPropertyValue(clusterProp, + MultiPointSender mps = (MultiPointSender) Class.forName(ContainerConfig.getPropertyValue(clusterProp, "replication-mode", "org.apache.catalina.tribes.transport.bio.PooledMultiSender")).getDeclaredConstructor().newInstance(); trans.setTransport(mps); } catch (Exception exc) { @@ -348,7 +348,7 @@ public class CatalinaContainer implements Container { private static ClusterManager prepareClusterManager(Configuration.Property clusterProp) throws ContainerException { String mgrClassName = ContainerConfig.getPropertyValue(clusterProp, "manager-class", "org.apache.catalina.ha.session.DeltaManager"); try { - return (ClusterManager)Class.forName(mgrClassName).getDeclaredConstructor().newInstance(); + return (ClusterManager) Class.forName(mgrClassName).getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new ContainerException("Cluster configuration requires a valid manager-class property", e); } diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java index a27c82f..6b8c9e5 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java @@ -112,7 +112,7 @@ public class CommonServices { Map<String, Object> response = ServiceUtil.returnSuccess(); List<GenericValue> testingNodes = new LinkedList<>(); - for (int i = 0; i < 3; i ++) { + for (int i = 0; i < 3; i++) { GenericValue testingNode = delegator.makeValue("TestingNode"); testingNode.put("testingNodeId", "TESTING_NODE" + i); testingNode.put("description", "Testing Node " + i); @@ -128,7 +128,7 @@ public class CommonServices { if (duration == null) { duration = 30000l; } - Debug.logInfo("-----SERVICE BLOCKING----- : " + duration/1000d +" seconds", MODULE); + Debug.logInfo("-----SERVICE BLOCKING----- : " + duration / 1000d + " seconds", MODULE); try { Thread.sleep(duration); } catch (InterruptedException e) { diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java index 62b3d24..a04c619 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java @@ -198,7 +198,7 @@ public class FindServices { origList = new LinkedList<>(); origValueMap.put(fieldNameRoot, origList); } - Object [] origValues = {fieldNameRaw, fieldValue}; + Object[] origValues = {fieldNameRaw, fieldValue}; origList.add(origValues); } return normalizedFields; @@ -374,7 +374,7 @@ public class FindServices { } } Object fieldObject = fieldValue; - if ((fieldOp != EntityOperator.IN && fieldOp != EntityOperator.NOT_IN ) || !(fieldValue instanceof Collection<?>)) { + if ((fieldOp != EntityOperator.IN && fieldOp != EntityOperator.NOT_IN) || !(fieldValue instanceof Collection<?>)) { fieldObject = modelField.getModelEntity().convertFieldValue(modelField, fieldValue, delegator, context); } if (ignoreCase && fieldObject instanceof String) { diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java index 803448c..3ccbbb9 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java @@ -283,11 +283,11 @@ public class EmailServices { MimeBodyPart mbp = new MimeBodyPart(); if (bodyPartContent instanceof String) { - Debug.logInfo("part of type: " + bodyPart.get("type") + " and size: " + bodyPart.get("content").toString().length() , MODULE); + Debug.logInfo("part of type: " + bodyPart.get("type") + " and size: " + bodyPart.get("content").toString().length(), MODULE); mbp.setText((String) bodyPartContent, "UTF-8", ((String) bodyPart.get("type")).substring(5)); } else if (bodyPartContent instanceof byte[]) { ByteArrayDataSource bads = new ByteArrayDataSource((byte[]) bodyPartContent, (String) bodyPart.get("type")); - Debug.logInfo("part of type: " + bodyPart.get("type") + " and size: " + ((byte[]) bodyPartContent).length , MODULE); + Debug.logInfo("part of type: " + bodyPart.get("type") + " and size: " + ((byte[]) bodyPartContent).length, MODULE); mbp.setDataHandler(new DataHandler(bads)); } else if (bodyPartContent instanceof DataHandler) { mbp.setDataHandler((DataHandler) bodyPartContent); diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/image/ImageTransform.java b/framework/common/src/main/java/org/apache/ofbiz/common/image/ImageTransform.java index fe7f2f7..d079378 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/image/ImageTransform.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/image/ImageTransform.java @@ -283,8 +283,8 @@ public class ImageTransform { public static BufferedImage toBufferedImage(Image image, int bufImgType) { /** Check if the image isn't already a BufferedImage instance */ - if ( image instanceof BufferedImage ) { - return( (BufferedImage)image ); + if (image instanceof BufferedImage) { + return ((BufferedImage) image); } /** Full image loading */ image = new ImageIcon(image).getImage(); @@ -299,6 +299,6 @@ public class ImageTransform { g.drawImage(image, 0, 0, null); g.dispose(); - return( bufferedImage ); + return (bufferedImage); } } diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java index 2ec11c3..ea41d7a 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java @@ -200,14 +200,11 @@ public class LoginServices { if ((UtilValidate.isEmpty(userLogin.getString("enabled")) || "Y".equals(userLogin.getString("enabled")) || (reEnableTime != null && reEnableTime.before(UtilDateTime.nowTimestamp())) || (isSystem)) && UtilValidate.isEmpty(userLogin.getString("disabledBy"))) { - String successfulLogin; - if (!isSystem) { userLogin.set("enabled", "Y"); userLogin.set("disabledBy", null); } - // attempt to authenticate with Authenticator class(es) boolean authFatalError = false; boolean externalAuth = false; @@ -233,7 +230,7 @@ public class LoginServices { // if the password.accept.encrypted.and.plain property in security is set to true allow plain or encrypted passwords // if this is a system account don't bother checking the passwords // if externalAuth passed; this is run as well - if ((!authFatalError && externalAuth) || (useTomcatSSO && TomcatSSOLogin(request, username, password)) + if ((!authFatalError && externalAuth) || (useTomcatSSO && tomcatSSOLogin(request, username, password)) || (jwtToken != null && jwtTokenValid) || (password != null && checkPassword(userLogin.getString("currentPassword"), useEncryption, password))) { Debug.logVerbose("[LoginServices.userLogin] : Password Matched or Token Validated", MODULE); @@ -275,7 +272,6 @@ public class LoginServices { repeat = true; continue; } - Debug.logInfo("[LoginServices.userLogin] : Password Incorrect", MODULE); // password invalid... if (password != null) { @@ -283,7 +279,6 @@ public class LoginServices { } else if (jwtToken != null) { errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.token_incorrect", locale); } - // increment failed login count Long currentFailedLogins = userLogin.getLong("successiveFailedLogins"); @@ -402,18 +397,17 @@ public class LoginServices { repeat = true; continue; } - - Map<String, Object> messageMap = UtilMisc.<String, Object> toMap("username", username); + Map<String, Object> messageMap = UtilMisc.<String, Object>toMap("username", username); errMsg = UtilProperties.getMessage(RESOURCE, "loginservices.account_for_user_login_id_disabled", messageMap, locale); if (disabledDateTime != null) { - messageMap = UtilMisc.<String, Object> toMap("disabledDateTime", disabledDateTime); + messageMap = UtilMisc.<String, Object>toMap("disabledDateTime", disabledDateTime); errMsg += " " + UtilProperties.getMessage(RESOURCE, "loginservices.since_datetime", messageMap, locale); } else { errMsg += "."; } if (loginDisableMinutes > 0 && reEnableTime != null) { - messageMap = UtilMisc.<String, Object> toMap("reEnableTime", reEnableTime); + messageMap = UtilMisc.<String, Object>toMap("reEnableTime", reEnableTime); errMsg += " " + UtilProperties.getMessage(RESOURCE, "loginservices.will_be_reenabled", messageMap, locale); } else { errMsg += " " + UtilProperties.getMessage(RESOURCE, "loginservices.not_scheduled_to_be_reenabled", locale); @@ -1056,7 +1050,7 @@ public class LoginServices { return result; } - public static void checkNewPassword(GenericValue userLogin, String currentPassword, String newPassword, String newPasswordVerify, + public static void checkNewPassword(GenericValue userLogin, String currentPassword, String newPassword, String newPasswordVerify, String passwordHint, List<String> errorMessageList, boolean ignoreCurrentPassword, Locale locale) { Delegator delegator = userLogin.getDelegator(); boolean useEncryption = "true".equals(EntityUtilProperties.getPropertyValue("security", "password.encrypt", delegator)); @@ -1184,7 +1178,7 @@ public class LoginServices { return passwordMatches; } - private static boolean TomcatSSOLogin(HttpServletRequest request, String userName, String currentPassword) { + private static boolean tomcatSSOLogin(HttpServletRequest request, String userName, String currentPassword) { try { request.login(userName, currentPassword); } catch (ServletException e) { diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java index 18571b3..64ef3bb 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java @@ -1091,7 +1091,7 @@ public class GenericDelegator implements Delegator { : Collections.emptyList(); int rowsAffected = 0; - if (! removedEntities.isEmpty()) { + if (!removedEntities.isEmpty()) { for (GenericValue entity : removedEntities) { rowsAffected += removeValue(entity); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java index 5233c9b..fc0069e 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java @@ -1192,9 +1192,9 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>, String type = modelField.getType(); if (type != null && "blob".equals(type)) { Object obj = get(name); - boolean b1 = obj instanceof byte []; + boolean b1 = obj instanceof byte[]; if (b1) { - byte [] binData = (byte [])obj; + byte[] binData = (byte[]) obj; String strData = new String(Base64.getMimeEncoder().encode(binData), StandardCharsets.UTF_8); cdataMap.put(name, strData); } else { diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionBuilder.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionBuilder.java index 60e65d7..bd907d3 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionBuilder.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionBuilder.java @@ -91,7 +91,7 @@ public class EntityConditionBuilder extends BuilderSupport { @Override protected Object createNode(Object methodName) { - String operatorName = ((String)methodName).toLowerCase(Locale.getDefault()); + String operatorName = ((String) methodName).toLowerCase(Locale.getDefault()); EntityJoinOperator operator = EntityOperator.lookupJoin(operatorName); List<EntityCondition> condList = new LinkedList<>(); return new ConditionHolder(EntityCondition.makeCondition(condList, operator)); @@ -107,7 +107,7 @@ public class EntityConditionBuilder extends BuilderSupport { @Override protected Object createNode(Object methodName, @SuppressWarnings("rawtypes") Map mapArg) { Map<String, Object> fieldValueMap = UtilGenerics.cast(mapArg); - String operatorName = ((String)methodName).toLowerCase(Locale.getDefault()); + String operatorName = ((String) methodName).toLowerCase(Locale.getDefault()); EntityComparisonOperator<String, Object> operator = EntityOperator.lookupComparison(operatorName); List<EntityCondition> conditionList = new LinkedList<>(); for (Map.Entry<String, Object> entry : fieldValueMap.entrySet()) { @@ -134,9 +134,9 @@ public class EntityConditionBuilder extends BuilderSupport { tempList.add(iterator.next()); } if (child instanceof EntityCondition) { - tempList.add((EntityCondition)child); + tempList.add((EntityCondition) child); } else if (child instanceof ConditionHolder) { - tempList.add(((ConditionHolder)child).condition); + tempList.add(((ConditionHolder) child).condition); } else { tempList.addAll(UtilGenerics.cast(child)); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java index ea20157..4ad3f36 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityConditionList.java @@ -57,7 +57,7 @@ public final class EntityConditionList<T extends EntityCondition> extends Entity */ @SuppressWarnings("unchecked") public Iterator<T> getConditionIterator() { - return (Iterator<T>)conditions.iterator(); + return (Iterator<T>) conditions.iterator(); } @Override diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFunction.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFunction.java index 45c13b4..35d9e30 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFunction.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/condition/EntityFunction.java @@ -176,9 +176,9 @@ public abstract class EntityFunction<T extends Comparable<?>> extends EntityCond return false; } EntityFunction<?> otherFunc = UtilGenerics.cast(obj); - return (this.function == otherFunc.function && - (this.nested != null ? nested.equals(otherFunc.nested) : otherFunc.nested == null) && - (this.value != null ? value.equals(otherFunc.value) : otherFunc.value == null)); + return (this.function == otherFunc.function + && (this.nested != null ? nested.equals(otherFunc.nested) : otherFunc.nested == null) + && (this.value != null ? value.equals(otherFunc.value) : otherFunc.value == null)); } @Override diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java index 3cba0f7..751e3fa 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java @@ -42,7 +42,7 @@ public class DebugManagedDataSource<C extends Connection> extends ManagedDataSou public Connection getConnection() throws SQLException { if (Debug.verboseOn()) { if (super.getPool() instanceof GenericObjectPool) { - GenericObjectPool<?> objectPool = (GenericObjectPool<?>)super.getPool(); + GenericObjectPool<?> objectPool = (GenericObjectPool<?>) super.getPool(); Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + objectPool.getNumActive() + "/" + objectPool.getNumIdle() + "/" + (objectPool.getNumActive() + objectPool.getNumIdle()) + "; min idle/max idle/max total: " + objectPool.getMinIdle() + "/" + objectPool.getMaxIdle() + "/" + objectPool.getMaxTotal(), MODULE); } else { if (Debug.verboseOn()) Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + super.getPool().getNumActive() + "/" + super.getPool().getNumIdle() + "/" + (super.getPool().getNumActive() + super.getPool().getNumIdle()), MODULE); @@ -57,7 +57,7 @@ public class DebugManagedDataSource<C extends Connection> extends ManagedDataSou dataSourceInfo.put("poolNumIdle", super.getPool().getNumIdle()); dataSourceInfo.put("poolNumTotal", (super.getPool().getNumIdle() + super.getPool().getNumActive())); if (super.getPool() instanceof GenericObjectPool) { - GenericObjectPool<?> objectPool = (GenericObjectPool<?>)super.getPool(); + GenericObjectPool<?> objectPool = (GenericObjectPool<?>) super.getPool(); dataSourceInfo.put("poolMaxActive", objectPool.getMaxTotal()); dataSourceInfo.put("poolMaxIdle", objectPool.getMaxIdle()); dataSourceInfo.put("poolMaxWait", objectPool.getMaxWaitMillis()); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java index de28b94..16b0ae7 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/finder/EntityFinderUtil.java @@ -209,13 +209,13 @@ public final class EntityFinderUtil { if ((operator.equals(EntityOperator.IN) || operator.equals(EntityOperator.BETWEEN) || operator.equals(EntityOperator.NOT_IN)) && value instanceof String) { String delim = null; - if (((String)value).indexOf('|') >= 0) { + if (((String) value).indexOf('|') >= 0) { delim = "|"; - } else if (((String)value).indexOf(',') >= 0) { + } else if (((String) value).indexOf(',') >= 0) { delim = ","; } if (delim != null) { - value = StringUtil.split((String)value, delim); + value = StringUtil.split((String) value, delim); } } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java index 4047672..6e89626 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java @@ -867,8 +867,7 @@ public class SQLProcessor implements AutoCloseable { // see if there is a lock wait timeout error, if so try to get and print more info about it // the string for Derby is "A lock could not be obtained within the time requested" // the string for MySQL is "Lock wait timeout exceeded; try restarting transaction" - if (eMsg.indexOf("A lock could not be obtained within the time requested") >= 0 || - eMsg.indexOf("Lock wait timeout exceeded") >= 0) { + if (eMsg.indexOf("A lock could not be obtained within the time requested") >= 0 || eMsg.indexOf("Lock wait timeout exceeded") >= 0) { Debug.logWarning(sqle, "Lock wait timeout error found in thread [" + Thread.currentThread().getId() + "]: (" + eMsg + ") when executing the SQL [" + _sql + "]", MODULE); TransactionUtil.printAllThreadsTransactionBeginStacks(); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java index 670b6a9..2db3215 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java @@ -462,7 +462,7 @@ public final class SqlJdbcUtil { } sql.append(makeFromClause(modelEntity, modelFieldTypeReader, datasourceInfo)); String viewWhereClause = makeViewWhereClause(modelEntity, datasourceInfo.getJoinStyle()); - ModelViewEntity modelViewEntity = (ModelViewEntity)modelEntity; + ModelViewEntity modelViewEntity = (ModelViewEntity) modelEntity; List<EntityCondition> whereConditions = new LinkedList<>(); List<EntityCondition> havingConditions = new LinkedList<>(); List<String> orderByList = new LinkedList<>(); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java index 4fb0fca..832bc05 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelEntity.java @@ -689,7 +689,7 @@ public class ModelEntity implements Comparable<ModelEntity>, Serializable { */ public List<String> getAutomaticFieldNames() { List<String> nameList = new LinkedList<>(); - if (! this.noAutoStamp) { + if (!this.noAutoStamp) { nameList.add(STAMP_FIELD); nameList.add(STAMP_TX_FIELD); nameList.add(CREATE_STAMP_FIELD); @@ -1439,8 +1439,8 @@ public class ModelEntity implements Comparable<ModelEntity>, Serializable { Element root = document.createElement("entity"); root.setAttribute("entity-name", this.getEntityName()); - if (!this.getEntityName().equals(ModelUtil.dbNameToClassName(this.getPlainTableName())) || - !ModelUtil.javaNameToDbName(this.getEntityName()).equals(this.getPlainTableName())) { + if (!this.getEntityName().equals(ModelUtil.dbNameToClassName(this.getPlainTableName())) + || !ModelUtil.javaNameToDbName(this.getEntityName()).equals(this.getPlainTableName())) { root.setAttribute("table-name", this.getPlainTableName()); } root.setAttribute("package-name", packageName); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelReader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelReader.java index 8886d6f..e9db70e 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelReader.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelReader.java @@ -408,8 +408,8 @@ public class ModelReader implements Serializable { // don't warn if the target title+entity = current title+entity if (Debug.infoOn() && !(title + curModelEntity.getEntityName()).equals(modelRelation.getTitle() + modelRelation.getRelEntityName())) { - // String errorMsg = "Relation already exists to entity [] with title [" - // + targetTitle + "], from entity []"; + // String errorMsg = "Relation already exists to entity[] with title [" + // + targetTitle + "], from entity[]"; String message = "Entity [" + relatedEnt.getPackageName() + ":" + relatedEnt.getEntityName() + "] already has identical relationship to entity [" + curModelEntity.getEntityName() + "] title [" + title + "]; would auto-create: type [" + newRel.getType() + "] and fields [" + newRel.keyMapString(",", "") + "]"; diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelUtil.java index 77b69d7..2d84a7d 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelUtil.java @@ -279,8 +279,8 @@ public final class ModelUtil { return "very-long"; } else if ("TEXT".equalsIgnoreCase(sqlTypeName)) { return "very-long"; - } else if ("INT".equalsIgnoreCase(sqlTypeName) || "SMALLINT".equalsIgnoreCase(sqlTypeName) || - "DECIMAL".equalsIgnoreCase(sqlTypeName) || "NUMERIC".equalsIgnoreCase(sqlTypeName)) { + } else if ("INT".equalsIgnoreCase(sqlTypeName) || "SMALLINT".equalsIgnoreCase(sqlTypeName) + || "DECIMAL".equalsIgnoreCase(sqlTypeName) || "NUMERIC".equalsIgnoreCase(sqlTypeName)) { if (length > 18 || precision > 6) return "invalid-" + sqlTypeName + ":" + length + ":" + precision; if (precision == 0) return "numeric"; if (precision == 2) return "currency-amount"; diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java index fb710e7..d6450b6 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java @@ -765,7 +765,7 @@ public class EntityTestSuite extends EntityTestCase { item = iterator.next(); i++; } - assertEquals("Test if EntitlyListIterator iterates exactly " + TEST_COUNT + " times: " , TEST_COUNT, i); + assertEquals("Test if EntitlyListIterator iterates exactly " + TEST_COUNT + " times: ", TEST_COUNT, i); iterator.close(); } catch (GenericEntityException e) { TransactionUtil.rollback(beganTransaction, "GenericEntityException occurred while iterating with EntityListIterator", e); @@ -1040,14 +1040,14 @@ public class EntityTestSuite extends EntityTestCase { */ public void testEntitySaxReaderCreation() throws Exception { String xmlContentLoad = - "<entity-engine-xml>" + - "<TestingType testingTypeId=\"JUNIT-TEST\" description=\"junit test\"/>" + - "<create>" + - " <TestingType testingTypeId=\"JUNIT-TEST2\" description=\"junit test\"/>" + - " <Testing testingId=\"T1\" testingTypeId=\"JUNIT-TEST\" testingName=\"First test\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" + - "</create>" + - "<Testing testingId=\"T2\" testingTypeId=\"JUNIT-TEST2\" testingName=\"Second test\" testingSize=\"20\" testingDate=\"2010-02-01 00:00:00\"/>" + - "</entity-engine-xml>"; + "<entity-engine-xml>" + + "<TestingType testingTypeId=\"JUNIT-TEST\" description=\"junit test\"/>" + + "<create>" + + " <TestingType testingTypeId=\"JUNIT-TEST2\" description=\"junit test\"/>" + + " <Testing testingId=\"T1\" testingTypeId=\"JUNIT-TEST\" testingName=\"First test\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" + + "</create>" + + "<Testing testingId=\"T2\" testingTypeId=\"JUNIT-TEST2\" testingName=\"Second test\" testingSize=\"20\" testingDate=\"2010-02-01 00:00:00\"/>" + + "</entity-engine-xml>"; EntitySaxReader reader = new EntitySaxReader(delegator); long numberLoaded = reader.parse(xmlContentLoad); assertEquals("Create Entity loaded ", 4, numberLoaded); @@ -1068,16 +1068,16 @@ public class EntityTestSuite extends EntityTestCase { public void testEntitySaxReaderCreateSkip() throws Exception { String xmlContentLoad = - "<entity-engine-xml>" + - "<TestingType testingTypeId=\"reader-create-skip\" description=\"reader create skip\"/>" + - "<Testing testingId=\"reader-create-skip\" testingTypeId=\"reader-create-skip\" testingName=\"reader create skip\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" + - "</entity-engine-xml>"; + "<entity-engine-xml>" + + "<TestingType testingTypeId=\"reader-create-skip\" description=\"reader create skip\"/>" + + "<Testing testingId=\"reader-create-skip\" testingTypeId=\"reader-create-skip\" testingName=\"reader create skip\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" + + "</entity-engine-xml>"; EntitySaxReader reader = new EntitySaxReader(delegator); long numberLoaded = reader.parse(xmlContentLoad); xmlContentLoad = - "<create>" + - " <Testing testingId=\"reader-create-skip\" testingName=\"reader create skip updated\" testingSize=\"20\" testingDate=\"2012-02-02 02:02:02\"/>" + - "</create>"; + "<create>" + + " <Testing testingId=\"reader-create-skip\" testingName=\"reader create skip updated\" testingSize=\"20\" testingDate=\"2012-02-02 02:02:02\"/>" + + "</create>"; reader = new EntitySaxReader(delegator); numberLoaded += reader.parse(xmlContentLoad); assertEquals("Create Skip Entity loaded ", 3, numberLoaded); @@ -1091,15 +1091,15 @@ public class EntityTestSuite extends EntityTestCase { public void testEntitySaxReaderUpdate() throws Exception { String xmlContentLoad = - "<entity-engine-xml>" + - "<TestingType testingTypeId=\"create-update\" description=\"create update\"/>" + - "<TestingType testingTypeId=\"create-updated\" description=\"create update updated\"/>" + - "<Testing testingId=\"create-update-T3\" testingTypeId=\"create-update\" testingName=\"Test 3\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" + - "<create-update>" + - " <Testing testingId=\"create-update-T1\" testingTypeId=\"create-update\" testingName=\"First test update\" testingSize=\"20\" testingDate=\"2010-01-01 00:00:00\"/>" + - " <Testing testingId=\"create-update-T3\" testingTypeId=\"create-updated\" testingName=\"Third test\" testingSize=\"30\" testingDate=\"2010-03-01 00:00:00\"/>" + - "</create-update>" + - "</entity-engine-xml>"; + "<entity-engine-xml>" + + "<TestingType testingTypeId=\"create-update\" description=\"create update\"/>" + + "<TestingType testingTypeId=\"create-updated\" description=\"create update updated\"/>" + + "<Testing testingId=\"create-update-T3\" testingTypeId=\"create-update\" testingName=\"Test 3\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" + + "<create-update>" + + " <Testing testingId=\"create-update-T1\" testingTypeId=\"create-update\" testingName=\"First test update\" testingSize=\"20\" testingDate=\"2010-01-01 00:00:00\"/>" + + " <Testing testingId=\"create-update-T3\" testingTypeId=\"create-updated\" testingName=\"Third test\" testingSize=\"30\" testingDate=\"2010-03-01 00:00:00\"/>" + + "</create-update>" + + "</entity-engine-xml>"; EntitySaxReader reader = new EntitySaxReader(delegator); long numberLoaded = reader.parse(xmlContentLoad); assertEquals("Update Entity loaded ", 5, numberLoaded); @@ -1120,14 +1120,14 @@ public class EntityTestSuite extends EntityTestCase { public void testEntitySaxReaderReplace() throws Exception { String xmlContentLoad = - "<entity-engine-xml>" + - "<TestingType testingTypeId=\"create-replace\" description=\"reader create skip\"/>" + - "<Testing testingTypeId=\"create-replace\" testingId=\"create-replace-T1\" testingName=\"First test\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" + - "<create-replace>" + - " <Testing testingTypeId=\"create-replace\" testingId=\"create-replace-T1\" testingName=\"First test replace\" />" + - "</create-replace>" + - "<Testing testingTypeId=\"create-replace\" testingId=\"create-replace-T2\" testingName=\"Second test update\" testingSize=\"20\" testingDate=\"2010-02-01 00:00:00\"/>" + - "</entity-engine-xml>"; + "<entity-engine-xml>" + + "<TestingType testingTypeId=\"create-replace\" description=\"reader create skip\"/>" + + "<Testing testingTypeId=\"create-replace\" testingId=\"create-replace-T1\" testingName=\"First test\" testingSize=\"10\" testingDate=\"2010-01-01 00:00:00\"/>" + + "<create-replace>" + + " <Testing testingTypeId=\"create-replace\" testingId=\"create-replace-T1\" testingName=\"First test replace\" />" + + "</create-replace>" + + "<Testing testingTypeId=\"create-replace\" testingId=\"create-replace-T2\" testingName=\"Second test update\" testingSize=\"20\" testingDate=\"2010-02-01 00:00:00\"/>" + + "</entity-engine-xml>"; EntitySaxReader reader = new EntitySaxReader(delegator); long numberLoaded = reader.parse(xmlContentLoad); assertEquals("Replace Entity loaded ", 4, numberLoaded); @@ -1148,13 +1148,13 @@ public class EntityTestSuite extends EntityTestCase { public void testEntitySaxReaderDelete() throws Exception { String xmlContentLoad = - "<delete>" + - " <Testing testingId=\"T1\"/>" + - " <Testing testingId=\"T2\"/>" + - " <Testing testingId=\"T3\"/>" + - " <TestingType testingTypeId=\"JUNIT-TEST\"/>" + - " <TestingType testingTypeId=\"JUNIT-TEST2\"/>" + - "</delete>"; + "<delete>" + + " <Testing testingId=\"T1\"/>" + + " <Testing testingId=\"T2\"/>" + + " <Testing testingId=\"T3\"/>" + + " <TestingType testingTypeId=\"JUNIT-TEST\"/>" + + " <TestingType testingTypeId=\"JUNIT-TEST2\"/>" + + "</delete>"; EntitySaxReader reader = new EntitySaxReader(delegator); long numberLoaded = reader.parse(xmlContentLoad); assertEquals("Delete Entity loaded ", 5, numberLoaded); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataAssert.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataAssert.java index 06f8b0e..a558772 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataAssert.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataAssert.java @@ -94,8 +94,8 @@ public class EntityDataAssert { ModelEntity modelEntity = checkValue.getModelEntity(); for (String nonpkFieldName: modelEntity.getNoPkFieldNames()) { // skip the fields the entity engine maintains - if (ModelEntity.CREATE_STAMP_FIELD.equals(nonpkFieldName) || ModelEntity.CREATE_STAMP_TX_FIELD.equals(nonpkFieldName) || - ModelEntity.STAMP_FIELD.equals(nonpkFieldName) || ModelEntity.STAMP_TX_FIELD.equals(nonpkFieldName)) { + if (ModelEntity.CREATE_STAMP_FIELD.equals(nonpkFieldName) || ModelEntity.CREATE_STAMP_TX_FIELD.equals(nonpkFieldName) + || ModelEntity.STAMP_FIELD.equals(nonpkFieldName) || ModelEntity.STAMP_TX_FIELD.equals(nonpkFieldName)) { continue; } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java index 438cd08..ba9fa85 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java @@ -74,8 +74,8 @@ public final class EntityUtil { i++; V value = args[i]; if (value != null) { - if (! (value instanceof Comparable<?>)) throw new IllegalArgumentException("Value(" + i + "), with value(" + args[i] + ") does not implement Comparable."); - if (! (value instanceof Serializable)) throw new IllegalArgumentException("Value(" + i + "), with value(" + args[i] + ") does not implement Serializable."); + if (!(value instanceof Comparable<?>)) throw new IllegalArgumentException("Value(" + i + "), with value(" + args[i] + ") does not implement Comparable."); + if (!(value instanceof Serializable)) throw new IllegalArgumentException("Value(" + i + "), with value(" + args[i] + ") does not implement Serializable."); } fields.put(key, value); i++; diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/SequenceUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/SequenceUtil.java index 9c5b0af..7f69dab 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/SequenceUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/SequenceUtil.java @@ -128,7 +128,7 @@ public class SequenceUtil { private Long getNextSeqId(long staggerMax) { long stagger = 1; if (staggerMax > 1) { - stagger = (long)Math.ceil(Math.random() * staggerMax); + stagger = (long) Math.ceil(Math.random() * staggerMax); if (stagger == 0) stagger = 1; } synchronized (this) { diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/permission/EntityPermissionChecker.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/permission/EntityPermissionChecker.java index 1263eca..be17799 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/permission/EntityPermissionChecker.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/permission/EntityPermissionChecker.java @@ -119,11 +119,11 @@ public class EntityPermissionChecker { Delegator delegator = null; if (request != null) { HttpSession session = request.getSession(); - userLogin = (GenericValue)session.getAttribute("userLogin"); + userLogin = (GenericValue) session.getAttribute("userLogin"); if (userLogin != null) { partyId = userLogin.getString("partyId"); } - delegator = (Delegator)request.getAttribute("delegator"); + delegator = (Delegator) request.getAttribute("delegator"); } if (auxiliaryValueGetter != null) auxiliaryValueGetter.clearList(); @@ -143,7 +143,7 @@ public class EntityPermissionChecker { return passed; } - public static Map<String, Object> checkPermission(GenericValue content, String statusId, GenericValue userLogin, List<String> passedPurposes, List<String> targetOperations, List<String> passedRoles, Delegator delegator , Security security, String entityAction) { + public static Map<String, Object> checkPermission(GenericValue content, String statusId, GenericValue userLogin, List<String> passedPurposes, List<String> targetOperations, List<String> passedRoles, Delegator delegator, Security security, String entityAction) { String privilegeEnumId = null; return checkPermission(content, statusId, userLogin, passedPurposes, targetOperations, passedRoles, delegator, security, entityAction, privilegeEnumId, null); } @@ -151,7 +151,7 @@ public class EntityPermissionChecker { public static Map<String, Object> checkPermission(GenericValue content, String statusId, GenericValue userLogin, List<String> passedPurposes, List<String> targetOperations, List<String> passedRoles, - Delegator delegator , + Delegator delegator, Security security, String entityAction, String privilegeEnumId, String quickCheckContentId) { List<String> statusList = null; @@ -164,7 +164,7 @@ public class EntityPermissionChecker { public static Map<String, Object> checkPermission(GenericValue content, List<String> statusList, GenericValue userLogin, List<String> passedPurposes, List<String> targetOperations, List<String> passedRoles, - Delegator delegator , + Delegator delegator, Security security, String entityAction, String privilegeEnumId) { return checkPermission(content, statusList, userLogin, passedPurposes, targetOperations, passedRoles, delegator, security, entityAction, privilegeEnumId, null); @@ -173,7 +173,7 @@ public class EntityPermissionChecker { public static Map<String, Object> checkPermission(GenericValue content, List<String> statusList, GenericValue userLogin, List<String> passedPurposes, List<String> targetOperations, List<String> passedRoles, - Delegator delegator , + Delegator delegator, Security security, String entityAction, String privilegeEnumId, String quickCheckContentId) { @@ -470,7 +470,7 @@ public class EntityPermissionChecker { iter = entityIdList.iterator(); while (iter.hasNext()) { String entityId = (String)iter.next(); - GenericValue entity = (GenericValue)entities.get(entityId); + GenericValue entity = (GenericValue) entities.get(entityId); purposeList = (List)purposes.get(entityId); roleList = getUserRoles(entity, userLogin, delegator); @@ -590,17 +590,17 @@ public class EntityPermissionChecker { public static GenericValue getNextEntity(Delegator delegator, String entityName, String pkFieldName, Object obj, Map<String, GenericValue> entities) throws GenericEntityException { GenericValue entity = null; if (obj instanceof String) { - String entityId = (String)obj; + String entityId = (String) obj; if (entities != null) entity = entities.get(entityId); if (entity == null) entity = EntityQuery.use(delegator).from(entityName).where(pkFieldName, entityId).cache(true).queryOne(); } else if (obj instanceof GenericValue) { - entity = (GenericValue)obj; + entity = (GenericValue) obj; } return entity; } - public static boolean checkHasRoleOperations(String partyId, PermissionConditionGetter permissionConditionGetter , Delegator delegator) { + public static boolean checkHasRoleOperations(String partyId, PermissionConditionGetter permissionConditionGetter, Delegator delegator) { List<String> targetOperations = permissionConditionGetter.getOperationList(); return checkHasRoleOperations(partyId, targetOperations, delegator); } @@ -662,16 +662,16 @@ public class EntityPermissionChecker { // } String lcEntityName = entityName.toLowerCase(); for (GenericValue targetOp: targetOperations) { - String testRoleTypeId = (String)targetOp.get("roleTypeId"); + String testRoleTypeId = (String) targetOp.get("roleTypeId"); String testContentPurposeTypeId = null; if (hasPurposeOp) - testContentPurposeTypeId = (String)targetOp.get(lcEntityName + "PurposeTypeId"); + testContentPurposeTypeId = (String) targetOp.get(lcEntityName + "PurposeTypeId"); String testStatusId = null; if (hasStatusOp) - testStatusId = (String)targetOp.get("statusId"); + testStatusId = (String) targetOp.get("statusId"); //String testPrivilegeEnumId = null; //if (hasPrivilegeOp) - //testPrivilegeEnumId = (String)targetOp.get("privilegeEnumId"); + //testPrivilegeEnumId = (String) targetOp.get("privilegeEnumId"); //int testPrivilegeSeq = 0; boolean purposesCond = (!hasPurposeOp || (purposes != null && purposes.contains(testContentPurposeTypeId)) || testContentPurposeTypeId.equals("_NA_")); @@ -794,8 +794,8 @@ public class EntityPermissionChecker { roles.remove("OWNER"); // always test with the owner of the current content if (entity.get("createdByUserLogin") != null && userLogin != null) { - String userLoginId = (String)userLogin.get("userLoginId"); - String userLoginIdCB = (String)entity.get("createdByUserLogin"); + String userLoginId = (String) userLogin.get("userLoginId"); + String userLoginIdCB = (String) entity.get("createdByUserLogin"); //if (Debug.infoOn()) Debug.logInfo("userLoginId:" + userLoginId + ": userLoginIdCB:" + userLoginIdCB + ":", null); if (userLoginIdCB.equals(userLoginId)) { roles.add("OWNER"); @@ -803,14 +803,14 @@ public class EntityPermissionChecker { } } - String partyId = (String)userLogin.get("partyId"); + String partyId = (String) userLogin.get("partyId"); List<GenericValue> relatedRoles = null; List<GenericValue> tmpRelatedRoles = entity.getRelated(entityName + "Role", null, null, true); relatedRoles = EntityUtil.filterByDate(tmpRelatedRoles); if (relatedRoles != null) { for (GenericValue contentRole: relatedRoles) { - String roleTypeId = (String)contentRole.get("roleTypeId"); - String targPartyId = (String)contentRole.get("partyId"); + String roleTypeId = (String) contentRole.get("roleTypeId"); + String targPartyId = (String) contentRole.get("partyId"); if (targPartyId.equals(partyId)) { if (!roles.contains(roleTypeId)) roles.add(roleTypeId); @@ -821,7 +821,7 @@ public class EntityPermissionChecker { String partyTypeId = null; try { party = contentRole.getRelatedOne("Party", false); - partyTypeId = (String)party.get("partyTypeId"); + partyTypeId = (String) party.get("partyTypeId"); if (partyTypeId != null && partyTypeId.equals("PARTY_GROUP")) { Map<String, Object> map = new HashMap<>(); @@ -848,8 +848,8 @@ public class EntityPermissionChecker { */ public static boolean isGroupMember(Map<String, ?> partyRelationshipValues, Delegator delegator) { boolean isMember = false; - String partyIdFrom = (String)partyRelationshipValues.get("partyIdFrom"); - String partyIdTo = (String)partyRelationshipValues.get("partyIdTo"); + String partyIdFrom = (String) partyRelationshipValues.get("partyIdFrom"); + String partyIdTo = (String) partyRelationshipValues.get("partyIdTo"); //String roleTypeIdFrom = "PERMISSION_GROUP_MBR"; //String roleTypeIdTo = "PERMISSION_GROUP"; //Timestamp fromDate = UtilDateTime.nowTimestamp(); @@ -1078,7 +1078,7 @@ public class EntityPermissionChecker { if (UtilValidate.isEmpty(contentOperationId)) { contentOperationId = ""; } - wid = (Integer)widths.get("operationFieldName"); + wid = (Integer) widths.get("operationFieldName"); buf.append(contentOperationId); for (int i=0; i < (wid.intValue() - contentOperationId.length()); i++) buf.append("^"); buf.append(" "); @@ -1108,7 +1108,7 @@ public class EntityPermissionChecker { } buf.append(statusId); /* - wid = (Integer)widths.get("statusFieldName"); + wid = (Integer) widths.get("statusFieldName"); for (int i=0; i < (wid.intValue() - statusId.length()); i++) buf.append(" "); */ buf.append(" "); @@ -1297,7 +1297,7 @@ public class EntityPermissionChecker { return false; } if (entity.get("createdByUserLogin") != null) { - String userLoginIdCB = (String)entity.get("createdByUserLogin"); + String userLoginIdCB = (String) entity.get("createdByUserLogin"); try { GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginIdCB).cache().queryOne(); if (userLogin != null) { diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java index aba721d..2a72d60 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java @@ -213,8 +213,8 @@ public class EntitySyncContext { * @return boolean representing if the EntitySync should be considered running */ public boolean isEntitySyncRunning() { - boolean isInRunning = ("ESR_RUNNING".equals(this.entitySync.getString("runStatusId")) || - "ESR_PENDING".equals(this.entitySync.getString("runStatusId"))); + boolean isInRunning = ("ESR_RUNNING".equals(this.entitySync.getString("runStatusId")) + || "ESR_PENDING".equals(this.entitySync.getString("runStatusId"))); if (!isInRunning) { return false; diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java index 923be16..ba44ecd 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java @@ -316,9 +316,9 @@ public class EntitySyncServices { // store data returned, get results (just call storeEntitySyncData locally, get the numbers back and boom shakalaka) // anything to store locally? - if (startDate != null && (UtilValidate.isNotEmpty(result.get("valuesToCreate")) || - UtilValidate.isNotEmpty(result.get("valuesToStore")) || - UtilValidate.isNotEmpty(result.get("keysToRemove")))) { + if (startDate != null && (UtilValidate.isNotEmpty(result.get("valuesToCreate")) + || UtilValidate.isNotEmpty(result.get("valuesToStore")) + || UtilValidate.isNotEmpty(result.get("keysToRemove")))) { // yep, we got more data gotMoreData = true; diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/Compare.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/Compare.java index 5fb06d6..0cfd0b6 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/Compare.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/Compare.java @@ -117,8 +117,7 @@ public abstract class Compare { if (convertedRvalue == null) { return false; } - if (convertedLvalue instanceof Comparable && - convertedRvalue instanceof Comparable) { + if (convertedLvalue instanceof Comparable && convertedRvalue instanceof Comparable) { Comparable<Object> comparable = UtilGenerics.cast(convertedLvalue); return comparable.compareTo(convertedRvalue) == 0; } @@ -192,8 +191,7 @@ public abstract class Compare { Object convertedLvalue = MiniLangUtil.convertType(lValue, type, locale, timeZone, format); Object convertedRvalue = MiniLangUtil.convertType(rValue, type, locale, timeZone, format); assertValuesNotNull(convertedLvalue, convertedRvalue); - if (convertedLvalue instanceof Comparable && - convertedRvalue instanceof Comparable) { + if (convertedLvalue instanceof Comparable && convertedRvalue instanceof Comparable) { Comparable<Object> comparable = UtilGenerics.cast(convertedLvalue); return comparable.compareTo(convertedRvalue) < 0; } @@ -229,8 +227,7 @@ public abstract class Compare { if (convertedRvalue == null) { return true; } - if (convertedLvalue instanceof Comparable && - convertedRvalue instanceof Comparable) { + if (convertedLvalue instanceof Comparable && convertedRvalue instanceof Comparable) { Comparable<Object> comparable = UtilGenerics.cast(convertedLvalue); return comparable.compareTo(convertedRvalue) != 0; } diff --git a/framework/security/src/main/java/org/apache/ofbiz/security/SecurityUtil.java b/framework/security/src/main/java/org/apache/ofbiz/security/SecurityUtil.java index 165347f..f0c4bcd 100644 --- a/framework/security/src/main/java/org/apache/ofbiz/security/SecurityUtil.java +++ b/framework/security/src/main/java/org/apache/ofbiz/security/SecurityUtil.java @@ -158,7 +158,7 @@ public final class SecurityUtil { GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne(); Map<String, Object> claims = JWTManager.validateToken(delegator, jwtToken, userLogin.getString("userLoginId") + userLogin.getString("currentPassword")); - return (! ServiceUtil.isError(claims)) && userLoginId.equals(claims.get("userLoginId")); + return (!ServiceUtil.isError(claims)) && userLoginId.equals(claims.get("userLoginId")); } catch (GenericEntityException e) { Debug.logWarning("failed to validate a jwToken for user " + userLoginId, MODULE); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/ModelPermGroup.java b/framework/service/src/main/java/org/apache/ofbiz/service/ModelPermGroup.java index 1937ac2..911dc1d 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/ModelPermGroup.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/ModelPermGroup.java @@ -54,7 +54,7 @@ public class ModelPermGroup implements Serializable { } } } - if (! foundOne) { + if (!foundOne) { return ServiceUtil.returnError(permissionErrors); } } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/ModelPermission.java b/framework/service/src/main/java/org/apache/ofbiz/service/ModelPermission.java index c049f74..c0765f5 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/ModelPermission.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/ModelPermission.java @@ -77,21 +77,23 @@ public class ModelPermission implements Serializable { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ServicePermissionErrorUserLoginMissing", locale)); } boolean hasPermission = false; - if (Debug.verboseOn()) Debug.logVerbose(" Permission : Analyse " + this.toString(), MODULE); + if (Debug.verboseOn()) { + Debug.logVerbose(" Permission : Analyse " + this.toString(), MODULE); + } switch (permissionType) { - case PERMISSION: - hasPermission = evalSimplePermission(security, userLogin); - break; - case ENTITY_PERMISSION: - hasPermission = evalEntityPermission(security, userLogin); - break; - case PERMISSION_SERVICE: - return evalPermissionService(serviceModel, dctx, context); - default: - Debug.logWarning("Invalid permission type [" + permissionType + "] for permission named : " + nameOrRole + " on service : " + serviceModel.name, MODULE); - return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ServicePermissionErrorInvalidPermissionType", locale)); + case PERMISSION: + hasPermission = evalSimplePermission(security, userLogin); + break; + case ENTITY_PERMISSION: + hasPermission = evalEntityPermission(security, userLogin); + break; + case PERMISSION_SERVICE: + return evalPermissionService(serviceModel, dctx, context); + default: + Debug.logWarning("Invalid permission type [" + permissionType + "] for permission named : " + nameOrRole + " on service : " + serviceModel.name, MODULE); + return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ServicePermissionErrorInvalidPermissionType", locale)); } - if (! hasPermission) { + if (!hasPermission) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ServicePermissionErrorRefused", locale)); } return ServiceUtil.returnSuccess(); @@ -154,10 +156,14 @@ public class ModelPermission implements Serializable { Debug.logError(failMessage + e.getMessage(), MODULE); return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "ServicePermissionErrorDefinitionProblem", locale)); } - if (Debug.verboseOn()) Debug.logVerbose("Service permission result : hasPermission " + resp.get("hasPermission") + ", failMessage " + failMessage , MODULE); - if (permissionReturnErrorOnFailure && - (UtilValidate.isNotEmpty(failMessage) || ! ((Boolean) resp.get("hasPermission")).booleanValue())) { - if (UtilValidate.isEmpty(failMessage)) failMessage = UtilProperties.getMessage(RESOURCE, "ServicePermissionErrorRefused", locale); + if (Debug.verboseOn()) { + Debug.logVerbose("Service permission result : hasPermission " + resp.get("hasPermission") + ", failMessage " + failMessage, MODULE); + } + if (permissionReturnErrorOnFailure + && (UtilValidate.isNotEmpty(failMessage) || !((Boolean) resp.get("hasPermission")).booleanValue())) { + if (UtilValidate.isEmpty(failMessage)) { + failMessage = UtilProperties.getMessage(RESOURCE, "ServicePermissionErrorRefused", locale); + } return ServiceUtil.returnError(failMessage); } return resp; diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java b/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java index c1c7196..d7e2602 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/ServiceDispatcher.java @@ -104,7 +104,7 @@ public final class ServiceDispatcher { try { int rn = delegator.removeByAnd("ServiceSemaphore", "lockedByInstanceId", JobManager.instanceId); if (rn > 0) { - Debug.logInfo("[ServiceDispatcher.init] : Clean up " + rn + " service semaphors." , MODULE); + Debug.logInfo("[ServiceDispatcher.init] : Clean up " + rn + " service semaphors.", MODULE); } } catch (GenericEntityException e) { Debug.logError(e, MODULE); @@ -480,8 +480,8 @@ public final class ServiceDispatcher { // look for lock wait timeout error, retry in a different way by running after the parent transaction finishes, ie attach to parent tx // - Derby 10.2.2.0 lock wait timeout string: "A lock could not be obtained within the time requested" // - MySQL ? lock wait timeout string: "Lock wait timeout exceeded; try restarting transaction" - if (errMsg.indexOf("A lock could not be obtained within the time requested") >= 0 || - errMsg.indexOf("Lock wait timeout exceeded") >= 0) { + if (errMsg.indexOf("A lock could not be obtained within the time requested") >= 0 + || errMsg.indexOf("Lock wait timeout exceeded") >= 0) { // TODO: add to run after parent tx } } @@ -549,7 +549,7 @@ public final class ServiceDispatcher { } else if (t instanceof GenericServiceException) { throw (GenericServiceException) t; } else { - throw new GenericServiceException("Service [" + modelService.name + "] Failed" + modelService.debugInfo() , t); + throw new GenericServiceException("Service [" + modelService.name + "] Failed" + modelService.debugInfo(), t); } } finally { // if there was an error, rollback transaction, otherwise commit @@ -771,7 +771,7 @@ public final class ServiceDispatcher { } else if (t instanceof GenericServiceException) { throw (GenericServiceException) t; } else { - throw new GenericServiceException("Service [" + service.name + "] Failed" + service.debugInfo() , t); + throw new GenericServiceException("Service [" + service.name + "] Failed" + service.debugInfo(), t); } } finally { // always try to commit the transaction since we don't know in this case if its was an error or not diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/ServiceXaWrapper.java b/framework/service/src/main/java/org/apache/ofbiz/service/ServiceXaWrapper.java index e0c84c2..50ac7e7 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/ServiceXaWrapper.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/ServiceXaWrapper.java @@ -246,7 +246,7 @@ public class ServiceXaWrapper extends GenericXaResource { Debug.logError(e, MODULE); throw e; } - if (Debug.verboseOn()) Debug.logVerbose("ServiceXaWrapper#prepare() : " + rtn + " / " + (rtn == XA_OK) , MODULE); + if (Debug.verboseOn()) Debug.logVerbose("ServiceXaWrapper#prepare() : " + rtn + " / " + (rtn == XA_OK), MODULE); return rtn; } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java b/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java index 76dc24d..3bf8a06 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java @@ -730,8 +730,7 @@ public class RecurrenceRule { } String numberStr = numberBuf.toString(); - if (numberStr.length() > 0 && (numberStr.length() > 1 || - (numberStr.charAt(0) != '+' && numberStr.charAt(0) != '-'))) { + if (numberStr.length() > 0 && (numberStr.length() > 1 || (numberStr.charAt(0) != '+' && numberStr.charAt(0) != '-'))) { try { number = Integer.parseInt(numberStr); } catch (NumberFormatException nfe) { diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/calendar/TemporalExpressions.java b/framework/service/src/main/java/org/apache/ofbiz/service/calendar/TemporalExpressions.java index 1094783..758c54f 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/calendar/TemporalExpressions.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/calendar/TemporalExpressions.java @@ -802,7 +802,7 @@ public class TemporalExpressions implements Serializable { } long units = deltaMillis / divisor; units -= units % this.freqCount; - skip.add(this.freqType, (int)units); + skip.add(this.freqType, (int) units); while (skip.after(cal)) { skip.add(this.freqType, -this.freqCount); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java b/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java index 40d7644..ac2e7db 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/engine/EntityAutoEngine.java @@ -278,7 +278,7 @@ public final class EntityAutoEngine extends GenericAsyncEngine { newEntity.setPKFields(parameters, true); String pkFieldName = pkFieldNameOutOnly.get(0); //if it's a fromDate, don't update it now, it's will be done next step - if (! "fromDate".equals(pkFieldName)) { + if (!"fromDate".equals(pkFieldName)) { String pkValue = dctx.getDelegator().getNextSeqId(modelEntity.getEntityName()); newEntity.set(pkFieldName, pkValue); } @@ -465,7 +465,7 @@ public final class EntityAutoEngine extends GenericAsyncEngine { } } - if (modelEntity.getField("changeByUserLoginId") != null ) { + if (modelEntity.getField("changeByUserLoginId") != null) { if (modelEntity.getEntityName().endsWith("Status")) { //Oh update on EntityStatus concept detected ... not possible, return invalid request throw new GenericServiceException("You call a updating operation on entity that track the activity, sorry I can't do that, please amazing developer check your service definition;)"); @@ -499,7 +499,7 @@ public final class EntityAutoEngine extends GenericAsyncEngine { throw new GenericServiceException("In Service [" + modelService.name + "] which uses the entity-auto engine with the delete invoke option not all pk fields have the mode IN"); } - if (modelEntity.getField("changeByUserLoginId") != null ) { + if (modelEntity.getField("changeByUserLoginId") != null) { if (modelEntity.getEntityName().endsWith("Status")) { //Oh update on EntityStatus concept detected ... not possible, return invalid request throw new GenericServiceException("You call a deleting operation on entity that track the activity, sorry I can't do that, please amazing developer check your service definition;)"); diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyEngine.java b/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyEngine.java index 628b535..2b0124a 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyEngine.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/engine/GroovyEngine.java @@ -95,7 +95,7 @@ public final class GroovyEngine extends GenericAsyncEngine { gContext.put("delegator", dispatcher.getDelegator()); try { ScriptContext scriptContext = ScriptUtil.createScriptContext(gContext, protectedKeys); - ScriptHelper scriptHelper = (ScriptHelper)scriptContext.getAttribute(ScriptUtil.SCRIPT_HELPER_KEY); + ScriptHelper scriptHelper = (ScriptHelper) scriptContext.getAttribute(ScriptUtil.SCRIPT_HELPER_KEY); if (scriptHelper != null) { gContext.put(ScriptUtil.SCRIPT_HELPER_KEY, scriptHelper); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java b/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java index 0988f29..afd4dba 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/job/JobManager.java @@ -150,8 +150,7 @@ public final class JobManager { EntityCondition.makeConditionDate("fromDate", "thruDate"), EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("instanceId", instanceId), - EntityCondition.makeCondition("instanceId", "_NA_")) - , EntityJoinOperator.OR) + EntityCondition.makeCondition("instanceId", "_NA_")), EntityJoinOperator.OR) ), EntityJoinOperator.AND); return delegator.findCountByCondition("JobManagerLock", condition, null, null) == 0; } catch (GenericEntityException e) { diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java b/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java index b803fb2..91792bf 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/mail/JavaMailContainer.java @@ -350,7 +350,7 @@ public class JavaMailContainer implements Container { } else { this.processMessage(message, session); if (Debug.verboseOn()) { - Debug.logVerbose("Message from " + UtilMisc.toListArray(message.getFrom()) + " with subject [" + message.getSubject() + "] has been processed." , MODULE); + Debug.logVerbose("Message from " + UtilMisc.toListArray(message.getFrom()) + " with subject [" + message.getSubject() + "] has been processed.", MODULE); } message.setFlag(Flags.Flag.SEEN, true); if (Debug.verboseOn()) { diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java b/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java index 04895dc..6b56abd 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/mail/MimeMessageWrapper.java @@ -247,14 +247,14 @@ public class MimeMessageWrapper implements java.io.Serializable { if (subPartCount > 0) { for (int si = 0; si < subPartCount; si++) { String sidx = idx + "." + Integer.toString(si); - if (getPartDisposition(sidx) != null && (getPartDisposition(sidx).equalsIgnoreCase(Part.ATTACHMENT) || - getPartDisposition(sidx).equalsIgnoreCase(Part.INLINE))) { + if (getPartDisposition(sidx) != null && (getPartDisposition(sidx).equalsIgnoreCase(Part.ATTACHMENT) + || getPartDisposition(sidx).equalsIgnoreCase(Part.INLINE))) { attachments.add(sidx); } } } else { - if (getPartDisposition(idx) != null && (getPartDisposition(idx).equalsIgnoreCase(Part.ATTACHMENT) || - getPartDisposition(idx).equalsIgnoreCase(Part.INLINE))) { + if (getPartDisposition(idx) != null && (getPartDisposition(idx).equalsIgnoreCase(Part.ATTACHMENT) + || getPartDisposition(idx).equalsIgnoreCase(Part.INLINE))) { attachments.add(idx); } } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java index 5a65ae0..a24963e 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/RmiServiceContainer.java @@ -148,7 +148,7 @@ public class RmiServiceContainer implements Container { try { Naming.rebind("//" + host + ":" + port + "/" + name, remote); } catch (RemoteException e) { - throw new ContainerException("Unable to bind RMIDispatcher to RMI on " + "//host[" + host + "]:port[" + port + "]/name[" + name + "] - with remote=" + remote , e); + throw new ContainerException("Unable to bind RMIDispatcher to RMI on " + "//host[" + host + "]:port[" + port + "]/name[" + name + "] - with remote=" + remote, e); } catch (java.net.MalformedURLException e) { throw new ContainerException("Invalid URL for binding", e); } diff --git a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java index 568049b..00253d4 100644 --- a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java +++ b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/ModelTestSuite.java @@ -130,7 +130,7 @@ public class ModelTestSuite { Class<?> cl; cl = Class.forName(className); Constructor<?> con = cl.getConstructor(String.class, Element.class); - this.testList.add((Test)con.newInstance(caseName, testElement)); + this.testList.add((Test) con.newInstance(caseName, testElement)); } catch (Exception e) { Debug.logError(e, MODULE); } @@ -174,9 +174,9 @@ public class ModelTestSuite { prepareTest(subTests.nextElement()); } } else if (test instanceof EntityTestCase) { - ((EntityTestCase)test).setDelegator(delegator); + ((EntityTestCase) test).setDelegator(delegator); if (test instanceof OFBizTestCase) { - ((OFBizTestCase)test).setDispatcher(dispatcher); + ((OFBizTestCase) test).setDispatcher(dispatcher); } } } diff --git a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java index 00e619b..6b5511b 100644 --- a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java +++ b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java @@ -217,7 +217,7 @@ public class TestRunContainer implements Container { private String getTestName(Test test) { if (test instanceof TestCase) { - return ((TestCase)test).getName(); + return ((TestCase) test).getName(); } else { return test.getClass().getName(); } diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ContextFilter.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ContextFilter.java index 01daf10..da1f2f7 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ContextFilter.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ContextFilter.java @@ -142,7 +142,7 @@ public class ContextFilter implements Filter { GenericValue tenant = EntityQuery.use(baseDelegator).from("Tenant").where("tenantId", tenantId).queryOne(); String initialPath = tenant.getString("initialPath"); if (UtilValidate.isNotEmpty(initialPath) && !"/".equals(initialPath)) { - ((HttpServletResponse)response).sendRedirect(initialPath); + ((HttpServletResponse) response).sendRedirect(initialPath); return; } } diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java index bd97f29..517599a 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java @@ -573,9 +573,9 @@ public class RequestHandler { if (UtilValidate.isNotEmpty(preRequestMap)) { for (Map.Entry<String, Object> entry: preRequestMap.entrySet()) { String key = entry.getKey(); - if ("_ERROR_MESSAGE_LIST_".equals(key) || "_ERROR_MESSAGE_MAP_".equals(key) || "_ERROR_MESSAGE_".equals(key) || - "_WARNING_MESSAGE_LIST_".equals(key) || "_WARNING_MESSAGE_".equals(key) || - "_EVENT_MESSAGE_LIST_".equals(key) || "_EVENT_MESSAGE_".equals(key)) { + if ("_ERROR_MESSAGE_LIST_".equals(key) || "_ERROR_MESSAGE_MAP_".equals(key) || "_ERROR_MESSAGE_".equals(key) + || "_WARNING_MESSAGE_LIST_".equals(key) || "_WARNING_MESSAGE_".equals(key) + || "_EVENT_MESSAGE_LIST_".equals(key) || "_EVENT_MESSAGE_".equals(key)) { request.setAttribute(key, entry.getValue()); } } @@ -1044,8 +1044,8 @@ public class RequestHandler { * @return return the query string */ public String makeQueryString(HttpServletRequest request, ConfigXMLReader.RequestResponse requestResponse) { - if (requestResponse == null || - (requestResponse.redirectParameterMap.size() == 0 && requestResponse.redirectParameterValueMap.size() == 0)) { + if (requestResponse == null + || (requestResponse.redirectParameterMap.size() == 0 && requestResponse.redirectParameterValueMap.size() == 0)) { Map<String, Object> urlParams = UtilHttp.getUrlOnlyParameterMap(request); String queryString = UtilHttp.urlEncodeArgs(urlParams, false); if (UtilValidate.isEmpty(queryString)) { diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java index 6d5a038..63914d0 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java @@ -368,7 +368,7 @@ public class CoreEvents { if (entry.getValue() != null && "on".equalsIgnoreCase(request.getParameter(key)) && !"_CLEAR_PREVIOUS_PARAMS_".equals(key)) { String[] servicePath = key.split("\\|\\|"); String partialKey = servicePath[servicePath.length-1]; - savedFields.put(partialKey, getObjectFromServicePath(key , syncServiceResult)); + savedFields.put(partialKey, getObjectFromServicePath(key, syncServiceResult)); } } if (null!=session.getAttribute("_SAVED_SYNC_RESULT_")) { diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java index dffc38b..e557a73 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java @@ -95,7 +95,7 @@ public class GroovyEventHandler implements EventHandler { Object result = null; try { ScriptContext scriptContext = ScriptUtil.createScriptContext(context, protectedKeys); - ScriptHelper scriptHelper = (ScriptHelper)scriptContext.getAttribute(ScriptUtil.SCRIPT_HELPER_KEY); + ScriptHelper scriptHelper = (ScriptHelper) scriptContext.getAttribute(ScriptUtil.SCRIPT_HELPER_KEY); if (scriptHelper != null) { context.put(ScriptUtil.SCRIPT_HELPER_KEY, scriptHelper); } @@ -116,15 +116,15 @@ public class GroovyEventHandler implements EventHandler { // check the result if (result instanceof Map) { Map<String, Object> resultMap = UtilGenerics.cast(result); - String successMessage = (String)resultMap.get("_event_message_"); + String successMessage = (String) resultMap.get("_event_message_"); if (successMessage != null) { request.setAttribute("_EVENT_MESSAGE_", successMessage); } - String errorMessage = (String)resultMap.get("_error_message_"); + String errorMessage = (String) resultMap.get("_error_message_"); if (errorMessage != null) { request.setAttribute("_ERROR_MESSAGE_", errorMessage); } - return (String)resultMap.get("_response_code_"); + return (String) resultMap.get("_response_code_"); } if (result != null && !(result instanceof String)) { throw new EventHandlerException("Event did not return a String result, it returned a " + result.getClass().getName()); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ScriptEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ScriptEventHandler.java index 14f6197..a7fc252 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ScriptEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ScriptEventHandler.java @@ -111,15 +111,15 @@ public final class ScriptEventHandler implements EventHandler { } if (result instanceof Map) { Map<String, Object> resultMap = UtilGenerics.cast(result); - String successMessage = (String)resultMap.get("_event_message_"); + String successMessage = (String) resultMap.get("_event_message_"); if (successMessage != null) { request.setAttribute("_EVENT_MESSAGE_", successMessage); } - String errorMessage = (String)resultMap.get("_error_message_"); + String errorMessage = (String) resultMap.get("_error_message_"); if (errorMessage != null) { request.setAttribute("_ERROR_MESSAGE_", errorMessage); } - return (String)resultMap.get("_response_code_"); + return (String) resultMap.get("_response_code_"); } if (result != null && !(result instanceof String)) { throw new EventHandlerException("Event did not return a String result, it returned a " + result.getClass().getName()); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java index 2072061..5aa880d 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java @@ -182,7 +182,7 @@ public class ServiceMultiEventHandler implements EventHandler { boolean rowSelected = false; if (UtilValidate.isNotEmpty(request.getAttribute(UtilHttp.getRowSubmitPrefix() + i))) { rowSelected = request.getAttribute(UtilHttp.getRowSubmitPrefix() + i) == null ? false : - "Y".equalsIgnoreCase((String)request.getAttribute(UtilHttp.getRowSubmitPrefix() + i)); + "Y".equalsIgnoreCase((String) request.getAttribute(UtilHttp.getRowSubmitPrefix() + i)); } else { rowSelected = request.getParameter(UtilHttp.getRowSubmitPrefix() + i) == null ? false : "Y".equalsIgnoreCase(request.getParameter(UtilHttp.getRowSubmitPrefix() + i)); @@ -332,7 +332,7 @@ public class ServiceMultiEventHandler implements EventHandler { // get the success messages if (UtilValidate.isNotEmpty(result.get(ModelService.SUCCESS_MESSAGE))) { - String newSuccessMessage = (String)result.get(ModelService.SUCCESS_MESSAGE); + String newSuccessMessage = (String) result.get(ModelService.SUCCESS_MESSAGE); if (!successMessages.contains(newSuccessMessage)) { successMessages.add(newSuccessMessage); } @@ -353,9 +353,9 @@ public class ServiceMultiEventHandler implements EventHandler { String resultKey = rme.getKey(); Object resultValue = rme.getValue(); - if (resultKey != null && !ModelService.RESPONSE_MESSAGE.equals(resultKey) && !ModelService.ERROR_MESSAGE.equals(resultKey) && - !ModelService.ERROR_MESSAGE_LIST.equals(resultKey) && !ModelService.ERROR_MESSAGE_MAP.equals(resultKey) && - !ModelService.SUCCESS_MESSAGE.equals(resultKey) && !ModelService.SUCCESS_MESSAGE_LIST.equals(resultKey)) { + if (resultKey != null && !ModelService.RESPONSE_MESSAGE.equals(resultKey) && !ModelService.ERROR_MESSAGE.equals(resultKey) + && !ModelService.ERROR_MESSAGE_LIST.equals(resultKey) && !ModelService.ERROR_MESSAGE_MAP.equals(resultKey) + && !ModelService.SUCCESS_MESSAGE.equals(resultKey) && !ModelService.SUCCESS_MESSAGE_LIST.equals(resultKey)) { //set the result to request w/ and w/o a suffix to handle both cases: to have the result in each iteration and to prevent its overriding request.setAttribute(resultKey + curSuffix, resultValue); request.setAttribute(resultKey, resultValue); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizContentTransform.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizContentTransform.java index 72aafef..a0b52cd 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizContentTransform.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizContentTransform.java @@ -81,7 +81,7 @@ public class OfbizContentTransform implements TemplateTransformModel { public void close() throws IOException { try { Environment env = Environment.getCurrentEnvironment(); - BeanModel req = (BeanModel)env.getVariable("request"); + BeanModel req = (BeanModel) env.getVariable("request"); HttpServletRequest request = req == null ? null : (HttpServletRequest) req.getWrappedObject(); String requestUrl = buf.toString(); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizNumberTransform.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizNumberTransform.java index 9fc9605..0d16e69 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizNumberTransform.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizNumberTransform.java @@ -46,7 +46,7 @@ public class OfbizNumberTransform implements TemplateTransformModel { String format = null; private static String getArg(Map<String, Object> args, String key) { - String result = ""; + String result = ""; Object o = args.get(key); if (o != null) { if (Debug.verboseOn()) Debug.logVerbose("Arg Object : " + o.getClass().getName(), MODULE); @@ -58,11 +58,12 @@ public class OfbizNumberTransform implements TemplateTransformModel { Debug.logError(e, "Template Exception", MODULE); } } else { - result = o.toString(); + result = o.toString(); } } return result; } + private static Double getNumber(Map<String, Object> args, String key) { if (args.containsKey(key)) { Object o = args.get(key); @@ -113,7 +114,7 @@ public class OfbizNumberTransform implements TemplateTransformModel { @Override public void close() throws IOException { try { - if (Debug.verboseOn()) Debug.logVerbose("parms: " + number + " " + format + " " + locale, MODULE); + if (Debug.verboseOn()) Debug.logVerbose("params: " + number + " " + format + " " + locale, MODULE); Locale localeObj = null; Delegator delegator = null; // Load the locale from the session diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/SetContextFieldTransform.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/SetContextFieldTransform.java index 57fc2d5..916a1e0 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/SetContextFieldTransform.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/SetContextFieldTransform.java @@ -48,7 +48,7 @@ public class SetContextFieldTransform implements TemplateMethodModelEx { throw new TemplateModelException("Second argument not an instance of BeanModel nor TemplateNumberModel nor TemplateScalarModel"); Environment env = Environment.getCurrentEnvironment(); - BeanModel req = (BeanModel)env.getVariable("context"); + BeanModel req = (BeanModel) env.getVariable("context"); Map<String, Object> context = UtilGenerics.cast(req.getWrappedObject()); String name = ((TemplateScalarModel) args.get(0)).getAsString(); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/SetRequestAttributeMethod.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/SetRequestAttributeMethod.java index 60d923e..64830aa 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/SetRequestAttributeMethod.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/SetRequestAttributeMethod.java @@ -47,7 +47,7 @@ public class SetRequestAttributeMethod implements TemplateMethodModelEx { throw new TemplateModelException("Second argument not an instance of BeanModel nor TemplateNumberModel nor TemplateScalarModel"); Environment env = Environment.getCurrentEnvironment(); - BeanModel req = (BeanModel)env.getVariable("request"); + BeanModel req = (BeanModel) env.getVariable("request"); HttpServletRequest request = (HttpServletRequest) req.getWrappedObject(); String name = ((TemplateScalarModel) args.get(0)).getAsString(); diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java index 1048e87..8edd45b 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/UtilCacheEvents.java @@ -198,7 +198,7 @@ public final class UtilCacheEvents { int rowCount = UtilHttp.getMultiFormRowCount(ctx); for (int i = 0; i < rowCount; i++) { String suffix = UtilHttp.getMultiRowDelimiter() + i; - isSelected = (ctx.containsKey("_rowSubmit" + suffix) && "Y".equalsIgnoreCase((String)ctx.get("_rowSubmit" + suffix))); + isSelected = (ctx.containsKey("_rowSubmit" + suffix) && "Y".equalsIgnoreCase((String) ctx.get("_rowSubmit" + suffix))); if (!isSelected) { continue; } diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java index a1366b0..82d6273 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java @@ -193,7 +193,7 @@ public class WebToolsServices { if (ServiceUtil.isError(outputMap)) { return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "WebtoolsErrorParsingFile", UtilMisc.toMap("errorString", ServiceUtil.getErrorMessage(outputMap)), locale)); } else { - Long numberRead = (Long)outputMap.get("rowProcessed"); + Long numberRead = (Long) outputMap.get("rowProcessed"); messages.add(UtilProperties.getMessage(RESOURCE, "EntityImportRowProcessed", UtilMisc.toMap("numberRead", numberRead.toString()), locale)); } } catch (GenericServiceException gsex) { diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java index bd2bb22..c36e1c4 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java @@ -57,8 +57,8 @@ public class ControllerViewArtifactInfo extends ArtifactInfoBase { throw new GeneralException("Controller view with name [" + viewUri + "] is not defined in controller file [" + controllerXmlUrl + "]."); } // populate screenCalledByThisView and reverse in aif.allViewInfosReferringToScreen - if ("screen".equals(this.viewInfoMap.type) || "screenfop".equals(this.viewInfoMap.type) || - "screentext".equals(this.viewInfoMap.type) || "screenxml".equals(this.viewInfoMap.type)) { + if ("screen".equals(this.viewInfoMap.type) || "screenfop".equals(this.viewInfoMap.type) + || "screentext".equals(this.viewInfoMap.type) || "screenxml".equals(this.viewInfoMap.type)) { String fullScreenName = this.viewInfoMap.page; if (UtilValidate.isNotEmpty(fullScreenName)) { int poundIndex = fullScreenName.indexOf('#'); diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java index e45157c..e23cecb 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java @@ -207,8 +207,8 @@ public class FormWidgetArtifactInfo extends ArtifactInfoBase { @Override public boolean equals(Object obj) { if (obj instanceof FormWidgetArtifactInfo) { - return (this.modelForm.getName().equals(((FormWidgetArtifactInfo) obj).modelForm.getName()) && - this.modelForm.getFormLocation().equals(((FormWidgetArtifactInfo) obj).modelForm.getFormLocation())); + return (this.modelForm.getName().equals(((FormWidgetArtifactInfo) obj).modelForm.getName()) + && this.modelForm.getFormLocation().equals(((FormWidgetArtifactInfo) obj).modelForm.getFormLocation())); } else { return false; } diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java index 9719163..2c0dc98 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java @@ -184,8 +184,8 @@ public class ScreenWidgetArtifactInfo extends ArtifactInfoBase { @Override public boolean equals(Object obj) { if (obj instanceof ScreenWidgetArtifactInfo) { - return (this.modelScreen.getName().equals(((ScreenWidgetArtifactInfo) obj).modelScreen.getName()) && - this.modelScreen.getSourceLocation().equals(((ScreenWidgetArtifactInfo) obj).modelScreen.getSourceLocation())); + return (this.modelScreen.getName().equals(((ScreenWidgetArtifactInfo) obj).modelScreen.getName()) + && this.modelScreen.getSourceLocation().equals(((ScreenWidgetArtifactInfo) obj).modelScreen.getSourceLocation())); } else { return false; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java index 2251052..876690c 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/WidgetWorker.java @@ -375,7 +375,7 @@ public final class WidgetWorker { if (UtilValidate.isNotEmpty(NO_PAGINATOR)) { globalCtx.remove("NO_PAGINATOR"); } else { - Integer paginateNumberInt= (Integer)globalCtx.get("PAGINATOR_NUMBER"); + Integer paginateNumberInt= (Integer) globalCtx.get("PAGINATOR_NUMBER"); if (paginateNumberInt == null) { paginateNumberInt = 0; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/cache/WidgetContextCacheKey.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/cache/WidgetContextCacheKey.java index 4d81a36..a9bd5c1 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/cache/WidgetContextCacheKey.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/cache/WidgetContextCacheKey.java @@ -94,7 +94,7 @@ public final class WidgetContextCacheKey { public boolean equals(Object obj) { WidgetContextCacheKey key = null; if (obj instanceof WidgetContextCacheKey) { - key = (WidgetContextCacheKey)obj; + key = (WidgetContextCacheKey) obj; } if (key == null || key.context == null) { return this.context == null; @@ -149,10 +149,8 @@ public final class WidgetContextCacheKey { Map<String, Object> printableMap = new HashMap<>(); for (Map.Entry<String, ? extends Object> entry : map.entrySet()) { String fieldName = entry.getKey(); - if (!fieldNamesToSkip.contains(fieldName) && - !fieldName.startsWith("javax.servlet") && - !fieldName.startsWith("org.apache") && - !fieldName.startsWith("_CLIENT_")) { + if (!fieldNamesToSkip.contains(fieldName) && !fieldName.startsWith("javax.servlet") + && !fieldName.startsWith("org.apache") && !fieldName.startsWith("_CLIENT_")) { printableMap.put(fieldName, entry.getValue()); } } @@ -167,9 +165,7 @@ public final class WidgetContextCacheKey { if (fieldNamesToSkip.contains(fieldName)) { continue; } - if (fieldName.startsWith("javax.servlet") || - fieldName.startsWith("org.apache") || - fieldName.startsWith("_CLIENT_")) { + if (fieldName.startsWith("javax.servlet") || fieldName.startsWith("org.apache") || fieldName.startsWith("_CLIENT_")) { continue; } Object field1 = map1.get(fieldName); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/FieldInfo.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/FieldInfo.java index 0284688..17074b9 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/FieldInfo.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/FieldInfo.java @@ -125,7 +125,7 @@ public abstract class FieldInfo { } public static boolean isInputFieldType(Integer fieldType) { - return ! nonInputFieldTypeList.contains(fieldType); + return !nonInputFieldTypeList.contains(fieldType); } private final int fieldType; diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java index baaef77..6dbbbdd 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/IterateSectionWidget.java @@ -131,11 +131,11 @@ public class IterateSectionWidget extends ModelScreenWidget { List<?> theList = null; if (obj instanceof Map<?, ?>) { Set<Map.Entry<String, Object>> entrySet = UtilGenerics.<Map<String, Object>>cast(obj).entrySet(); - Object [] a = entrySet.toArray(); + Object[] a = entrySet.toArray(); theList = Arrays.asList(a); isEntrySet = true; } else if (obj instanceof List<?>) { - theList = (List<?>)obj; + theList = (List<?>) obj; } else { Debug.logError("Object not list or map type", MODULE); return; @@ -206,7 +206,7 @@ public class IterateSectionWidget extends ModelScreenWidget { Integer lastPageNumber = null; Map<String, Object> globalCtx = UtilGenerics.cast(context.get("globalContext")); if (globalCtx != null) { - lastPageNumber = (Integer)globalCtx.get("PAGINATOR_NUMBER"); + lastPageNumber = (Integer) globalCtx.get("PAGINATOR_NUMBER"); globalCtx.put("PAGINATOR_NUMBER", startPageNumber); } renderNextPrev(writer, context, listSize, actualPageSize); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java index 858e346..1509140 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java @@ -1180,7 +1180,7 @@ public class ModelFormField { if (UtilValidate.isNotEmpty(parameters)) { String fieldName = this.getModelFormField().getName(); if (parameters.containsKey(fieldName.concat("_fld0_value"))) { - defaultOption = (String)parameters.get(fieldName.concat("_fld0_op")); + defaultOption = (String) parameters.get(fieldName.concat("_fld0_op")); } } return defaultOption; @@ -1197,7 +1197,7 @@ public class ModelFormField { if (UtilValidate.isNotEmpty(parameters)) { String fieldName = this.getModelFormField().getName(); if ( parameters.containsKey(fieldName.concat("_fld1_value"))) { - defaultOption = (String)parameters.get(fieldName.concat("_fld1_op")); + defaultOption = (String) parameters.get(fieldName.concat("_fld1_op")); } } return defaultOption; @@ -1677,14 +1677,13 @@ public class ModelFormField { // create default date/time value from timestamp string retVal = retVal.substring(0, 16); } - } else if ("number".equals(this.type) || - (this.type != null && this.type.endsWith("-number"))) { + } else if ("number".equals(this.type) || (this.type != null && this.type.endsWith("-number"))) { Locale locale = (Locale) context.get("locale"); if (locale == null) { locale = Locale.getDefault(); } String formatVal; - if (! this.format.isEmpty()) { + if (!this.format.isEmpty()) { formatVal = this.format.expandString(context); } else { formatVal = this.type.endsWith("-number")? diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java index 7e770b2..9ede11e 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java @@ -115,7 +115,7 @@ public class ModelTheme implements Serializable { // resolve all decicate properties from origin and sucharge by the present dedicate properties if (originTheme.themePropertiesMap != null) { for (String key : originTheme.themePropertiesMap.keySet()) { - initThemePropertiesMap.put(key, SerializationUtils.clone((Serializable)originTheme.themePropertiesMap.get(key))); + initThemePropertiesMap.put(key, SerializationUtils.clone((Serializable) originTheme.themePropertiesMap.get(key))); } } @@ -336,7 +336,7 @@ public class ModelTheme implements Serializable { } } public Object getProperty(String propertyName) { - if (! themePropertiesMap.containsKey(propertyName) + if (!themePropertiesMap.containsKey(propertyName) || themePropertiesMap.get(propertyName) == null) { return ""; } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ScreenFactory.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ScreenFactory.java index ef83286..960f71e 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ScreenFactory.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ScreenFactory.java @@ -121,7 +121,7 @@ public class ScreenFactory { Document screenFileDoc = UtilXml.readXmlDocument(screenFileUrl, true, true); modelScreenMap = readScreenDocument(screenFileDoc, resourceName); screenLocationCache.put(resourceName, modelScreenMap); - double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; + double totalSeconds = (System.currentTimeMillis() - startTime) / 1000.0; Debug.logInfo("Got " + modelScreenMap.size() + " screens in " + totalSeconds + "s from: " + screenFileUrl.toExternalForm(), MODULE); } } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java index dced116..7f822d8 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java @@ -122,7 +122,7 @@ public class PortalPageWorker { EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId)), EntityOperator.OR)), EntityOperator.AND); - List <GenericValue> portalPages = EntityQuery.use(delegator).from("PortalPage").where(cond).queryList(); + List<GenericValue> portalPages = EntityQuery.use(delegator).from("PortalPage").where(cond).queryList(); if (UtilValidate.isNotEmpty(portalPages)) { portalPage = EntityUtil.getFirst(portalPages); } @@ -131,7 +131,7 @@ public class PortalPageWorker { EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPageId), EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId)), EntityOperator.AND); - List <GenericValue> privateDerivedPortalPages = EntityQuery.use(delegator).from("PortalPage").where(cond).queryList(); + List<GenericValue> privateDerivedPortalPages = EntityQuery.use(delegator).from("PortalPage").where(cond).queryList(); if (UtilValidate.isNotEmpty(privateDerivedPortalPages)) { portalPage = EntityUtil.getFirst(privateDerivedPortalPages); } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuWrapTransform.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuWrapTransform.java index 3308b19..8cca67e 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuWrapTransform.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/MenuWrapTransform.java @@ -69,8 +69,8 @@ import freemarker.template.TransformControl; public class MenuWrapTransform implements TemplateTransformModel { private static final String MODULE = MenuWrapTransform.class.getName(); - public static final String [] upSaveKeyNames = {"globalNodeTrail"}; - public static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "renderOnStart", "renderOnClose", "menuDefFile", "menuName", "associatedContentId", "wrapperClassName"}; + public static final String[] upSaveKeyNames = {"globalNodeTrail"}; + public static final String[] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "renderOnStart", "renderOnClose", "menuDefFile", "menuName", "associatedContentId", "wrapperClassName"}; @Override @@ -93,8 +93,8 @@ public class MenuWrapTransform implements TemplateTransformModel { Map<String, Object> checkedArgs = UtilGenerics.cast(args); FreeMarkerWorker.overrideWithArgs(templateCtx, checkedArgs); List<Map<String, ? extends Object>> trail = UtilGenerics.cast(templateCtx.get("globalNodeTrail")); - String contentAssocPredicateId = (String)templateCtx.get("contentAssocPredicateId"); - String strNullThruDatesOnly = (String)templateCtx.get("nullThruDatesOnly"); + String contentAssocPredicateId = (String) templateCtx.get("contentAssocPredicateId"); + String strNullThruDatesOnly = (String) templateCtx.get("nullThruDatesOnly"); Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && "true".equalsIgnoreCase(strNullThruDatesOnly)) ? Boolean.TRUE :Boolean.FALSE; GenericValue val = null; try { @@ -116,7 +116,7 @@ public class MenuWrapTransform implements TemplateTransformModel { } String subContentIdSub = (String) view.get("contentId"); // This order is taken so that the dataResourceType can be overridden in the transform arguments. - String subDataResourceTypeId = (String)templateCtx.get("subDataResourceTypeId"); + String subDataResourceTypeId = (String) templateCtx.get("subDataResourceTypeId"); if (UtilValidate.isEmpty(subDataResourceTypeId)) { try { subDataResourceTypeId = (String) view.get("drDataResourceTypeId"); @@ -148,7 +148,7 @@ public class MenuWrapTransform implements TemplateTransformModel { @Override public int onStart() throws TemplateModelException, IOException { - String renderOnStart = (String)templateCtx.get("renderOnStart"); + String renderOnStart = (String) templateCtx.get("renderOnStart"); if (renderOnStart != null && "true".equalsIgnoreCase(renderOnStart)) { renderMenu(); } @@ -170,7 +170,7 @@ public class MenuWrapTransform implements TemplateTransformModel { FreeMarkerWorker.reloadValues(templateCtx, savedValues, env); String wrappedContent = buf.toString(); out.write(wrappedContent); - String renderOnClose = (String)templateCtx.get("renderOnClose"); + String renderOnClose = (String) templateCtx.get("renderOnClose"); if (renderOnClose == null || !"false".equalsIgnoreCase(renderOnClose)) { renderMenu(); } @@ -179,16 +179,16 @@ public class MenuWrapTransform implements TemplateTransformModel { public void renderMenu() throws IOException { - String menuDefFile = (String)templateCtx.get("menuDefFile"); - String menuName = (String)templateCtx.get("menuName"); - String menuWrapperClassName = (String)templateCtx.get("menuWrapperClassName"); + String menuDefFile = (String) templateCtx.get("menuDefFile"); + String menuName = (String) templateCtx.get("menuName"); + String menuWrapperClassName = (String) templateCtx.get("menuWrapperClassName"); HtmlMenuWrapper menuWrapper = HtmlMenuWrapper.getMenuWrapper(request, response, session, menuDefFile, menuName, menuWrapperClassName); if (menuWrapper == null) { throw new IOException("HtmlMenuWrapper with def file:" + menuDefFile + " menuName:" + menuName + " and HtmlMenuWrapper class:" + menuWrapperClassName + " could not be instantiated."); } - String associatedContentId = (String)templateCtx.get("associatedContentId"); + String associatedContentId = (String) templateCtx.get("associatedContentId"); menuWrapper.putInContext("defaultAssociatedContentId", associatedContentId); menuWrapper.putInContext("currentValue", view); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/fo/FoFormRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/fo/FoFormRenderer.java index 6cf2837..4cf5959 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/fo/FoFormRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/fo/FoFormRenderer.java @@ -145,8 +145,8 @@ public class FoFormRenderer extends HtmlWidgetRenderer implements FormStringRend boolean optionSelected = false; for (ModelFormField.OptionValue optionValue : allOptionValues) { String noCurrentSelectedKey = dropDownField.getNoCurrentSelectedKey(context); - if ((UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey()) && "selected".equals(dropDownField.getCurrent())) || - (UtilValidate.isEmpty(currentValue) && noCurrentSelectedKey != null && noCurrentSelectedKey.equals(optionValue.getKey()))) { + if ((UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey()) && "selected".equals(dropDownField.getCurrent())) + || (UtilValidate.isEmpty(currentValue) && noCurrentSelectedKey != null && noCurrentSelectedKey.equals(optionValue.getKey()))) { makeBlockString(writer, modelFormField.getWidgetStyle(), optionValue.getDescription()); optionSelected = true; break; diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRenderer.java index 09b9e14..05fea5c 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRenderer.java @@ -264,7 +264,7 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe appendWhitespace(writer); renderEndingBoundaryComment(writer, "Menu Widget", modelMenu); - GenericValue userLogin = (GenericValue)request.getSession().getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); if (userLogin != null) { String userLoginId = userLogin.getString("userLoginId"); setUserLoginIdAtPermGrant(userLoginId); @@ -312,7 +312,7 @@ public class HtmlMenuRenderer extends HtmlWidgetRenderer implements MenuStringRe public boolean userLoginIdHasChanged() { boolean hasChanged = false; - GenericValue userLogin = (GenericValue)request.getSession().getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); userLoginIdAtPermGrant = getUserLoginIdAtPermGrant(); String userLoginId = null; if (userLogin != null) { diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRendererImage.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRendererImage.java index 1c92f82..172b666 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRendererImage.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuRendererImage.java @@ -50,7 +50,7 @@ public class HtmlMenuRendererImage extends HtmlMenuRenderer { StringBuilder imgStr = new StringBuilder("<img src=\""); String contentId = menuItem.getAssociatedContentId(context); - Delegator delegator = (Delegator)request.getAttribute("delegator"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); GenericValue webSitePublishPoint = null; try { if (WidgetContentWorker.getContentWorker() != null) { diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java index a90384b..d0926b6 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapper.java @@ -78,7 +78,7 @@ public class HtmlMenuWrapper { context.put("parameters", parameterMap); HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); context.put("userLogin", userLogin); //make sure the locale is in the context @@ -102,20 +102,20 @@ public class HtmlMenuWrapper { } public String renderMenuString() throws IOException { - HttpServletRequest req = ((HtmlMenuRenderer)renderer).request; + HttpServletRequest req = ((HtmlMenuRenderer) renderer).request; if (req.getServletContext() == null) { if (Debug.infoOn()) { - Debug.logInfo("in renderMenuString, ctx is null(0)" , ""); + Debug.logInfo("in renderMenuString, ctx is null(0)", ""); } } Writer writer = new StringWriter(); modelMenu.renderMenuString(writer, context, renderer); - HttpServletRequest req2 = ((HtmlMenuRenderer)renderer).request; + HttpServletRequest req2 = ((HtmlMenuRenderer) renderer).request; if (req2.getServletContext() == null) { if (Debug.infoOn()) { - Debug.logInfo("in renderMenuString, ctx is null(2)" , ""); + Debug.logInfo("in renderMenuString, ctx is null(2)", ""); } } @@ -188,20 +188,20 @@ public class HtmlMenuWrapper { public void setRequest(HttpServletRequest request) { this.request = request; - ((HtmlMenuRenderer)renderer).setRequest(request); + ((HtmlMenuRenderer) renderer).setRequest(request); } public void setResponse(HttpServletResponse response) { this.response = response; - ((HtmlMenuRenderer)renderer).setResponse(response); + ((HtmlMenuRenderer) renderer).setResponse(response); } public HttpServletRequest getRequest() { - return ((HtmlMenuRenderer)renderer).request; + return ((HtmlMenuRenderer) renderer).request; } public HttpServletResponse getResponse() { - return ((HtmlMenuRenderer)renderer).response; + return ((HtmlMenuRenderer) renderer).response; } public static HtmlMenuWrapper getMenuWrapper(HttpServletRequest request, HttpServletResponse response, HttpSession session, String menuDefFile, String menuName, String menuWrapperClassName) { @@ -210,13 +210,13 @@ public class HtmlMenuWrapper { String menuSig = menuDefFile + "__" + menuName; if (session != null) { - menuWrapper = (HtmlMenuWrapper)session.getAttribute(menuSig); + menuWrapper = (HtmlMenuWrapper) session.getAttribute(menuSig); } if (menuWrapper == null) { try { Class<?> cls = Class.forName("org.apache.ofbiz.widget.html." + menuWrapperClassName); - menuWrapper = (HtmlMenuWrapper)cls.getDeclaredConstructor().newInstance(); + menuWrapper = (HtmlMenuWrapper) cls.getDeclaredConstructor().newInstance(); menuWrapper.init(menuDefFile, menuName, request, response); } catch (InstantiationException | IllegalAccessException | IOException | SAXException | ParserConfigurationException e) { throw new RuntimeException(e.getMessage()); @@ -229,7 +229,7 @@ public class HtmlMenuWrapper { Map<String, Object> parameterMap = UtilHttp.getParameterMap(request); menuWrapper.setParameters(parameterMap); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); menuWrapper.putInContext("userLogin", userLogin); } diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapperImage.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapperImage.java index 67c43c3..5c23881 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapperImage.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/html/HtmlMenuWrapperImage.java @@ -59,7 +59,7 @@ public class HtmlMenuWrapperImage extends HtmlMenuWrapper { super.init(resourceName, menuName, request, response); Map<String, Object> dummyMap = new HashMap<>(); - Delegator delegator = (Delegator)request.getAttribute("delegator"); + Delegator delegator = (Delegator) request.getAttribute("delegator"); try { for (ModelMenuItem menuItem : modelMenu.getMenuItemList()) { String contentId = menuItem.getAssociatedContentId(dummyMap); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java index 3133796..9c5f616 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java @@ -404,7 +404,7 @@ public class MacroScreenRenderer implements ScreenStringRenderer { // make a new map for content rendering; so our current map does not get clobbered Map<String, Object> contentContext = new HashMap<>(); contentContext.putAll(context); - String dataResourceId = (String)contentContext.get("dataResourceId"); + String dataResourceId = (String) contentContext.get("dataResourceId"); if (Debug.verboseOn()) { Debug.logVerbose("expandedContentId:" + expandedContentId, MODULE); } |
Free forum by Nabble | Edit this page |