Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Debug.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -42,7 +42,7 @@ public static final boolean useLog4J = true; public static final String noModuleModule = "NoModule"; // set to null for previous behavior - + static DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM); public static final String SYS_DEBUG = System.getProperty("DEBUG"); @@ -61,14 +61,14 @@ public static final Level[] levelObjs = {Level.INFO, Level.DEBUG, Level.INFO, Level.INFO, Level.INFO, Level.WARN, Level.ERROR, Level.FATAL, NotifyLevel.NOTIFY}; protected static Map<String, Integer> levelStringMap = new HashMap<String, Integer>(); - + protected static PrintStream printStream = System.out; protected static PrintWriter printWriter = new PrintWriter(printStream); protected static boolean levelOnCache[] = new boolean[9]; protected static boolean packException = true; protected static final boolean useLevelOnCache = true; - + protected static Logger root = Logger.getRootLogger(); static { @@ -81,7 +81,7 @@ levelStringMap.put("fatal", Debug.FATAL); levelStringMap.put("always", Debug.ALWAYS); levelStringMap.put("notify", Debug.NOTIFY); - + // initialize Log4J if (!UtilProperties.propertyValueEqualsIgnoreCase("debug.properties", "disable.log4j.config", "true")) { org.apache.log4j.xml.DOMConfigurator.configure(UtilURL.fromResource("log4j.xml")); @@ -91,7 +91,7 @@ for (int i = 0; i < 9; i++) { levelOnCache[i] = (i == Debug.ALWAYS || UtilProperties.propertyValueEqualsIgnoreCase("debug.properties", levelProps[i], "true")); } - + if (SYS_DEBUG != null) { for (int x = 0; x < 8; x++) { levelOnCache[x] = true; @@ -101,13 +101,13 @@ while (en.hasMoreElements()) { Logger thisLogger = (Logger) en.nextElement(); thisLogger.setLevel(Level.DEBUG); - } + } } // configure exception packing packException = UtilProperties.propertyValueEqualsIgnoreCase("debug.properties", "pack.exception", "true"); } - + public static PrintStream getPrintStream() { return printStream; } @@ -134,7 +134,7 @@ if (levelName == null) return null; return levelStringMap.get(levelName.toLowerCase()); } - + /** Gets an int representing the level number from a String representing the level name; if level not found defaults to Debug.INFO */ public static int getLevelFromStringWithDefault(String levelName) { Integer levelInt = getLevelFromString(levelName); @@ -144,7 +144,7 @@ return levelInt; } } - + public static void log(int level, Throwable t, String msg, String module) { log(level, t, msg, module, "org.ofbiz.base.util.Debug"); } @@ -196,11 +196,11 @@ return (level == Debug.ALWAYS || UtilProperties.propertyValueEqualsIgnoreCase("debug", levelProps[level], "true")); } } - + // leaving these here public static void log(String msg) { log(Debug.ALWAYS, null, msg, noModuleModule); - } + } public static void log(Throwable t) { log(Debug.ALWAYS, t, null, noModuleModule); } @@ -209,7 +209,7 @@ log(Debug.ALWAYS, null, msg, module); } - + public static void log(Throwable t, String module) { log(Debug.ALWAYS, t, null, module); } @@ -221,11 +221,11 @@ public static boolean verboseOn() { return isOn(Debug.VERBOSE); } - + public static void logVerbose(String msg, String module) { log(Debug.VERBOSE, null, msg, module); } - + public static void logVerbose(Throwable t, String module) { log(Debug.VERBOSE, t, null, module); } @@ -237,7 +237,7 @@ public static boolean timingOn() { return isOn(Debug.TIMING); } - + public static void logTiming(String msg, String module) { log(Debug.TIMING, null, msg, module); } @@ -253,7 +253,7 @@ public static boolean infoOn() { return isOn(Debug.INFO); } - + public static void logInfo(String msg, String module) { log(Debug.INFO, null, msg, module); } @@ -339,7 +339,7 @@ } public static void logNotify(Throwable t, String msg, String module) { - log(Debug.NOTIFY, t, msg, module); + log(Debug.NOTIFY, t, msg, module); } public static void set(int level, boolean on) { @@ -372,7 +372,7 @@ } newAppender.setThreshold(Level.DEBUG); newAppender.activateOptions(); - newAppender.setName(name); + newAppender.setName(name); } return newAppender; Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/FileUtil.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -77,7 +77,7 @@ } } } - + /** * Writes a file from a string with a specified encoding. * @@ -100,7 +100,7 @@ throw e; } } - + public static void writeString(String encoding, String s, File outFile) throws IOException { try { FileUtils.writeStringToFile(outFile, s, encoding); @@ -109,7 +109,7 @@ throw e; } } - + public static Writer getBufferedWriter(String path, String name) throws IOException { String fileName = getPatchedFileName(path, name); if (UtilValidate.isEmpty(fileName)) { @@ -181,14 +181,14 @@ } } } - + return buf; } public static StringBuffer readTextFile(String fileName, boolean newline) throws FileNotFoundException, IOException { File file = new File(fileName); return readTextFile(file, newline); } - + public static String readString(String encoding, File inFile) throws IOException { String readString = ""; try { @@ -199,11 +199,11 @@ } return readString; } - + public static void searchFiles(List<File> fileList, File path, FilenameFilter filter, boolean includeSubfolders) throws IOException { // Get filtered files in the current path File[] files = path.listFiles(filter); - + // Process each filtered entry for (int i = 0; i < files.length; i++) { // recurse if the entry is a directory @@ -215,50 +215,50 @@ } } } - + public static List<File> findFiles(String fileExt, String basePath, String partialPath, String stringToFind) throws IOException { if (basePath == null) { basePath = System.getProperty("ofbiz.home"); } - + Set<String> stringsToFindInPath = FastSet.newInstance(); Set<String> stringsToFindInFile = FastSet.newInstance(); - + if (partialPath != null) { stringsToFindInPath.add(partialPath); } if (stringToFind != null) { stringsToFindInFile.add(stringToFind); } - + List<File> fileList = FastList.newInstance(); FileUtil.searchFiles(fileList, new File(basePath), new SearchTextFilesFilter(fileExt, stringsToFindInPath, stringsToFindInFile), true); - + return fileList; } - + public static List<File> findXmlFiles(String basePath, String partialPath, String rootElementName, String xsdOrDtdName) throws IOException { if (basePath == null) { basePath = System.getProperty("ofbiz.home"); } - + Set<String> stringsToFindInPath = FastSet.newInstance(); Set<String> stringsToFindInFile = FastSet.newInstance(); - + if (partialPath != null) stringsToFindInPath.add(partialPath); if (rootElementName != null) stringsToFindInFile.add("<" + rootElementName + " "); if (xsdOrDtdName != null) stringsToFindInFile.add(xsdOrDtdName); - + List<File> fileList = FastList.newInstance(); FileUtil.searchFiles(fileList, new File(basePath), new SearchTextFilesFilter("xml", stringsToFindInPath, stringsToFindInFile), true); return fileList; } - + public static class SearchTextFilesFilter implements FilenameFilter { String fileExtension; Set<String> stringsToFindInFile = FastSet.newInstance(); Set<String> stringsToFindInPath = FastSet.newInstance(); - + public SearchTextFilesFilter(String fileExtension, Set<String> stringsToFindInPath, Set<String> stringsToFindInFile) { this.fileExtension = fileExtension; if (stringsToFindInPath != null) { @@ -268,7 +268,7 @@ this.stringsToFindInFile.addAll(stringsToFindInFile); } } - + public boolean accept(File dir, String name) { File file = new File(dir, name); if (file.getName().startsWith(".")) { @@ -277,7 +277,7 @@ if (file.isDirectory()) { return true; } - + boolean hasAllPathStrings = true; String fullPath = dir.getPath().replace('\\', '/'); for (String pathString: stringsToFindInPath) { @@ -286,7 +286,7 @@ break; } } - + if (hasAllPathStrings && name.endsWith("." + fileExtension)) { StringBuffer xmlFileBuffer = null; try { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GeneralException.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GeneralException.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GeneralException.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GeneralException.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -79,7 +79,7 @@ * @param messages error message list. */ public GeneralException(String msg, List<String> messages) { - super(msg); + super(msg); this.messages = messages; } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GeneralRuntimeException.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GeneralRuntimeException.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GeneralRuntimeException.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GeneralRuntimeException.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/GroovyUtil.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -43,7 +43,7 @@ public static final String module = GroovyUtil.class.getName(); public static UtilCache<String, Class> parsedScripts = new UtilCache<String, Class>("script.GroovyLocationParsedCache", 0, 0, false); - + public static GroovyClassLoader groovyClassLoader = new GroovyClassLoader(); private static Binding getBinding(Map<String, Object> context) { @@ -69,7 +69,7 @@ if (scriptUrl == null) { throw new GeneralException("Script not found at location [" + location + "]"); } - + scriptClass = groovyClassLoader.parseClass(scriptUrl.openStream(), scriptUrl.getFile()); if (Debug.verboseOn()) Debug.logVerbose("Caching Groovy script at: " + location, module); parsedScripts.put(location, scriptClass); @@ -82,9 +82,9 @@ InvokerHelper.createScript(scriptClass, getBinding(context)).run(); if (Debug.timingOn()) Debug.logTiming("Ran parsed groovy script in [" + (System.currentTimeMillis() - startTimeParsed) + "]ms at: " + location, module); */ - + /* NOTE DEJ20080526: this approach uses a pre-parsed script but it is not thread safe - * + * * the groovy Script object contains both the parsed script AND the context, which is weird when trying to run a cached Script * there is no available clone() method on the Script object, so we can't clone and set the context/binding to get around thread-safe issues Script script = parsedScripts.get(location); @@ -93,19 +93,19 @@ if (scriptUrl == null) { throw new GeneralException("Script not found at location [" + location + "]"); } - + script = emptyGroovyShell.parse(scriptUrl.openStream(), scriptUrl.getFile()); if (Debug.verboseOn()) Debug.logVerbose("Caching Groovy script at: " + location, module); parsedScripts.put(location, script); } - + script.setBinding(getBinding(context)); return script.run(); */ /* NOTE DEJ20080527: this approach works but only caches script text, not the parsed script public static UtilCache<String, String> sourceScripts = new UtilCache<String, String>("script.GroovyLocationSourceCache", 0, 0, false); - + public static GroovyShell emptyGroovyShell = new GroovyShell(); String scriptString = sourceScripts.get(location); if (scriptString == null) { @@ -113,9 +113,9 @@ if (scriptUrl == null) { throw new GeneralException("Script not found at location [" + location + "]"); } - + scriptString = UtilURL.readUrlText(scriptUrl); - + if (Debug.verboseOn()) Debug.logVerbose("Caching Groovy script source at: " + location, module); sourceScripts.put(location, scriptString); } @@ -125,7 +125,7 @@ script.setBinding(getBinding(context)); Object scriptResult = script.run(); if (Debug.timingOn()) Debug.logTiming("Parsed and ran groovy script in [" + (System.currentTimeMillis() - startTime) + "]ms at: " + location, module); - + return scriptResult; */ } catch (MalformedURLException e) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClient.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -35,7 +35,7 @@ * */ public class HttpClient { - + public static final String module = HttpClient.class.getName(); private int hostVerification = SSLUtil.HOSTCERT_NORMAL_CHECK; @@ -55,7 +55,7 @@ private Map<String, Object> parameters = null; private Map<String, String> headers = null; - + private URL requestUrl = null; private URLConnection con = null; @@ -75,7 +75,7 @@ /** Creates a new HttpClient object. */ public HttpClient(String url, Map<String, Object> parameters) { this.url = url; - this.parameters = parameters; + this.parameters = parameters; } /** Creates a new HttpClient object. */ @@ -107,22 +107,22 @@ public void setTimeout(int timeout) { this.timeout = timeout; } - + /** Enables this request to follow redirect 3xx codes (default true) */ public void followRedirects(boolean followRedirects) { this.followRedirects = followRedirects; } - + /** Turns on or off line feeds in the request. (default is on) */ public void setLineFeed(boolean lineFeed) { this.lineFeed = lineFeed; } - + /** Set the raw stream for posts. */ public void setRawStream(String stream) { this.rawStream = stream; } - + /** Set the URL for this request. */ public void setUrl(URL url) { this.url = url.toExternalForm(); @@ -196,7 +196,7 @@ public void setClientCertificateAlias(String alias) { this.clientCertAlias = alias; } - + /** Returns the alias of the client certificate to be used for this SSL connection. */ public String getClientCertificateAlias() { return this.clientCertAlias; @@ -221,12 +221,12 @@ public boolean getAllowUntrusted() { return this.trustAny; } - + public void setBasicAuthInfo(String basicAuthUsername, String basicAuthPassword) { this.basicAuthUsername = basicAuthUsername; this.basicAuthPassword = basicAuthPassword; } - + /** Invoke HTTP request GET. */ public String get() throws HttpClientException { return sendHttpRequest("get"); @@ -241,7 +241,7 @@ public String post() throws HttpClientException { return sendHttpRequest("post"); } - + /** Invoke HTTP request POST and pass raw stream. */ public String post(String stream) throws HttpClientException { this.rawStream = stream; @@ -333,24 +333,24 @@ if (Debug.verboseOn() || debug) { try { Debug.log("ContentEncoding: " + con.getContentEncoding() + "; ContentType: " + - con.getContentType() + " or: " + URLConnection.guessContentTypeFromStream(in), module); + con.getContentType() + " or: " + URLConnection.guessContentTypeFromStream(in), module); } catch (IOException ioe) { Debug.logWarning(ioe, "Caught exception printing content debugging information", module); } } - + String charset = null; String contentType = con.getContentType(); - if (contentType == null) { - try { + if (contentType == null) { + try { contentType = URLConnection.guessContentTypeFromStream(in); } catch (IOException ioe) { Debug.logWarning(ioe, "Problems guessing content type from steam", module); } } - + if (Debug.verboseOn() || debug) Debug.log("Content-Type: " + contentType, module); - + if (contentType != null) { contentType = contentType.toUpperCase(); int charsetEqualsLoc = contentType.indexOf("=", contentType.indexOf("CHARSET")); @@ -360,11 +360,11 @@ } else if (charsetEqualsLoc >= 0) { charset = contentType.substring(charsetEqualsLoc + 1); } - + if (charset != null) charset = charset.trim(); if (Debug.verboseOn() || debug) Debug.log("Getting text from HttpClient with charset: " + charset, module); } - + BufferedReader post = new BufferedReader(charset == null ? new InputStreamReader(in) : new InputStreamReader(in, charset)); String line = new String(); @@ -389,9 +389,9 @@ private InputStream sendHttpRequestStream(String method, boolean overrideTrust) throws HttpClientException { // setup some SSL variables SSLUtil.loadJsseProperties(); - + String arguments = null; - InputStream in = null; + InputStream in = null; if (url == null) { throw new HttpClientException("Cannot process a null URL."); @@ -445,14 +445,14 @@ } con.setDoInput(true); } - + // if there is basicAuth info set the request property for it if (basicAuthUsername != null) { String basicAuthString = "Basic " + Base64.base64Encode(basicAuthUsername + ":" + (basicAuthPassword == null ? "" : basicAuthPassword)); con.setRequestProperty("Authorization", basicAuthString); if (Debug.verboseOn() || debug) Debug.log("Header - Authorization: " + basicAuthString, module); } - + if (UtilValidate.isNotEmpty(headers)) { for (Map.Entry<String, String> entry: headers.entrySet()) { String headerName = entry.getKey(); Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClientException.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClientException.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClientException.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpClientException.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/HttpRequestFileUpload.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -32,11 +32,11 @@ * */ public class JNDIContextFactory { - + public static final String module = JNDIContextFactory.class.getName(); static UtilCache<String, InitialContext> contexts = new UtilCache<String, InitialContext>("entity.JNDIContexts", 0, 0); - /** + /** * Return the initial context according to the entityengine.xml parameters that correspond to the given prefix * @return the JNDI initial context */ Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -94,7 +94,7 @@ if (password == null) { password = "changeit"; } - + KeyStore ks = KeyStore.getInstance("jks"); File keyFile = null; if (fileName != null) { @@ -111,7 +111,7 @@ } else { ks.load(null, "changeit".toCharArray()); } - return ks; + return ks; } public static X509Certificate readCertificate(byte[] certChain) throws CertificateException { @@ -130,19 +130,19 @@ public static Map<String, String> getX500Map(Principal x500) { Map<String, String> x500Map = FastMap.newInstance(); - + String name = x500.getName().replaceAll("\\\\,", "&com;"); String[] x500Opts = name.split("\\,"); for (String opt: x500Opts) { if (opt.indexOf("=") > -1) { - String[] nv = opt.split("\\=", 2); + String[] nv = opt.split("\\=", 2); x500Map.put(nv[0].replaceAll("&com;", ","), nv[1].replaceAll("&com;", ",")); } } return x500Map; } - + public static void importPKCS8CertChain(KeyStore ks, String alias, byte[] keyBytes, String keyPass, byte[] certChain) throws InvalidKeySpecException, NoSuchAlgorithmException, CertificateException, KeyStoreException { // load the private key KeyFactory kf = KeyFactory.getInstance("RSA"); @@ -178,7 +178,7 @@ } public static Certificate pemToCert(String certString) throws IOException, CertificateException { - return pemToCert(new StringReader(certString)); + return pemToCert(new StringReader(certString)); } public static Certificate pemToCert(File certFile) throws IOException, CertificateException { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Log4jLoggerWriter.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Log4jLoggerWriter.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Log4jLoggerWriter.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Log4jLoggerWriter.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MessageString.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -32,9 +32,9 @@ */ @SuppressWarnings("serial") public class MessageString implements Serializable { - + public static final String module = MessageString.class.getName(); - + protected String message; protected String fieldName; protected String toFieldName; @@ -43,7 +43,7 @@ protected String propertyResource; protected String propertyName; protected boolean isError = true; - + public static List<Object> getMessagesForField(String fieldName, boolean convertToStrings, List<Object> messageStringList) { if (fieldName == null) { return Collections.emptyList(); @@ -82,7 +82,7 @@ } return outList; } - + /** * @param message * @param fieldName @@ -129,7 +129,7 @@ this.sourceError = sourceError; this.isError = true; } - + /** * @return Returns the fieldName. */ @@ -159,7 +159,7 @@ return this.fieldName.equals(fieldName); } } - + /** * @return Returns the message. */ @@ -233,7 +233,7 @@ public void setPropertyResource(String propertyResource) { this.propertyResource = propertyResource; } - + /** * @return Returns the isError. */ Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/MultiTrustManager.java Sat Mar 21 22:46:22 2009 @@ -49,7 +49,7 @@ keystores = FastList.newInstance(); } - public void add(KeyStore ks) { + public void add(KeyStore ks) { if (ks != null) { keystores.add(ks); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/NotifyLevel.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/NotifyLevel.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/NotifyLevel.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/NotifyLevel.java Sat Mar 21 22:46:22 2009 @@ -15,7 +15,7 @@ public static final int NOTIFY_INT = FATAL_INT + 10000; public static final Level NOTIFY = new NotifyLevel(NOTIFY_INT, "NOTIFY", SyslogAppender.LOG_LOCAL0); public static final Level notify = new NotifyLevel(NOTIFY_INT, "notify", SyslogAppender.LOG_LOCAL0); - + public NotifyLevel(int level, String levelStr, int syslogEquivalent) { super(level, levelStr, syslogEquivalent); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectInputStream.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectInputStream.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectInputStream.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectInputStream.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -33,21 +33,21 @@ import javolution.util.FastSet; /** - * Utilities for analyzing and converting Object types in Java + * Utilities for analyzing and converting Object types in Java * Takes advantage of reflection */ public class ObjectType { - + public static final String module = ObjectType.class.getName(); public static final Object NULL = new NullObject(); - + protected static Map<String, Class<?>> classCache = FastMap.newInstance(); public static final String LANG_PACKAGE = "java.lang."; // We will test both the raw value and this + raw value public static final String SQL_PACKAGE = "java.sql."; // We will test both the raw value and this + raw value - /** + /** * Loads a class with the current thread's context classloader. * @param className The name of the class to load * @return The requested class @@ -62,7 +62,7 @@ return loadClass(className, null); } - /** + /** * Loads a class with the current thread's context classloader. * @param className The name of the class to load * @param loader The ClassLoader to use @@ -86,7 +86,7 @@ className = "[L" + arrayClass.getName().replace("[]", "") + ";"; } } - + // small block to speed things up by putting using preloaded classes for common objects, this turns out to help quite a bit... Class<?> theClass = CachedClassLoader.globalClassNameClassMap.get(className); @@ -115,7 +115,7 @@ return theClass; } - /** + /** * Returns an instance of the specified class. This uses the default * no-arg constructor to create the instance. * @param className Name of the class to instantiate @@ -133,7 +133,7 @@ return o; } - /** + /** * Tests if a class properly implements the specified interface. * @param objectClass Class to test * @param interfaceName Name of the interface to test against @@ -146,7 +146,7 @@ return interfaceOf(objectClass, interfaceClass); } - /** + /** * Tests if a class properly implements the specified interface. * @param objectClass Class to test * @param interfaceObject to test against @@ -194,7 +194,7 @@ return interfaceOf(obj, interfaceClass); } - /** + /** * Tests if an object properly implements the specified interface. * @param obj Object to test * @param interfaceObject to test against @@ -206,7 +206,7 @@ return interfaceOf(obj, interfaceClass); } - /** + /** * Tests if an object properly implements the specified interface. * @param obj Object to test * @param interfaceClass Class to test against @@ -218,7 +218,7 @@ return interfaceOf(objectClass, interfaceClass); } - /** + /** * Tests if a class properly implements the specified interface. * @param objectClass Class to test * @param interfaceClass Class to test against @@ -236,7 +236,7 @@ return false; } - /** + /** * Tests if a class is a class of or a sub-class of the parent. * @param objectClass Class to test * @param parentName Name of the parent class to test against @@ -249,7 +249,7 @@ return isOrSubOf(objectClass, parentClass); } - /** + /** * Tests if a class is a class of or a sub-class of the parent. * @param objectClass Class to test * @param parentObject Object to test against @@ -261,7 +261,7 @@ return isOrSubOf(objectClass, parentClass); } - /** + /** * Tests if an object is an instance of or a sub-class of the parent. * @param obj Object to test * @param parentName Name of the parent class to test against @@ -274,7 +274,7 @@ return isOrSubOf(obj, parentClass); } - /** + /** * Tests if an object is an instance of or a sub-class of the parent. * @param obj Object to test * @param parentObject Object to test against @@ -286,7 +286,7 @@ return isOrSubOf(obj, parentClass); } - /** + /** * Tests if an object is an instance of or a sub-class of the parent. * @param obj Object to test * @param parentClass Class to test against @@ -298,7 +298,7 @@ return isOrSubOf(objectClass, parentClass); } - /** + /** * Tests if a class is a class of or a sub-class of the parent. * @param objectClass Class to test * @param parentClass Class to test against @@ -313,7 +313,7 @@ return false; } - /** + /** * Tests if a class is a class of a sub-class of or properly implements an interface. * @param objectClass Class to test * @param typeObject Object to test against @@ -325,7 +325,7 @@ return instanceOf(objectClass, typeClass); } - /** + /** * Tests if a class is a class of a sub-class of or properly implements an interface. * @param objectClass Class to test * @param typeName name to test against @@ -335,7 +335,7 @@ return instanceOf(objectClass, typeName, null); } - /** + /** * Tests if an object is an instance of a sub-class of or properly implements an interface. * @param obj Object to test * @param typeObject Object to test against @@ -347,7 +347,7 @@ return instanceOf(obj, typeClass); } - /** + /** * Tests if an object is an instance of a sub-class of or properly implements an interface. * @param obj Object to test * @param typeName name to test against @@ -357,7 +357,7 @@ return instanceOf(obj, typeName, null); } - /** + /** * Tests if a class is a class of a sub-class of or properly implements an interface. * @param objectClass Class to test * @param typeName Object to test against @@ -373,7 +373,7 @@ return instanceOf(objectClass, infoClass); } - /** + /** * Tests if an object is an instance of a sub-class of or properly implements an interface. * @param obj Object to test * @param typeName Object to test against @@ -418,7 +418,7 @@ } } - /** + /** * Tests if an object is an instance of a sub-class of or properly implements an interface. * @param obj Object to test * @param typeClass Class to test against @@ -430,7 +430,7 @@ return instanceOf(objectClass, typeClass); } - /** + /** * Tests if a class is a class of a sub-class of or properly implements an interface. * @param objectClass Class to test * @param typeClass Class to test against @@ -448,7 +448,7 @@ return simpleTypeConvert(obj, type, format, null, locale, noTypeFail); } - /** + /** * Converts the passed object to the named simple type. Supported types * include: String, Boolean, Double, Float, Long, Integer, Date (java.sql.Date), * Time, Timestamp, TimeZone; @@ -492,7 +492,7 @@ for (int i = 0; i < len; i++) { newObj.add(Array.get(obj, i)); } - return newObj; + return newObj; } else if (obj instanceof java.lang.String) { fromType = "String"; String str = (String) obj; @@ -502,7 +502,7 @@ if (str.length() == 0) { return null; } - + if ("Boolean".equals(type) || "java.lang.Boolean".equals(type)) { str = StringUtil.removeSpaces(str); return str.equalsIgnoreCase("TRUE") ? Boolean.TRUE : Boolean.FALSE; @@ -511,14 +511,14 @@ if (loc != null) { return loc; } else { - throw new GeneralException("Could not convert " + str + " to " + type + ": "); + throw new GeneralException("Could not convert " + str + " to " + type + ": "); } } else if ("TimeZone".equals(type) || "java.util.TimeZone".equals(type)) { TimeZone tz = UtilDateTime.toTimeZone(str); if (tz != null) { return tz; } else { - throw new GeneralException("Could not convert " + str + " to " + type + ": "); + throw new GeneralException("Could not convert " + str + " to " + type + ": "); } } else if ("BigDecimal".equals(type) || "java.math.BigDecimal".equals(type)) { str = StringUtil.removeSpaces(str); @@ -901,7 +901,7 @@ Set<Boolean> tempSet = FastSet.newInstance(); tempSet.add(bol); return tempSet; - } else { + } else { throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); } } else if (obj instanceof java.util.Locale) { @@ -925,13 +925,13 @@ throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); } } else if (obj.getClass().getName().equals("org.ofbiz.entity.GenericValue")) { - fromType = "GenericValue"; + fromType = "GenericValue"; if ("GenericValue".equals(type) || "org.ofbiz.entity.GenericValue".equals(type)) { return obj; } else if ("Map".equals(type) || "java.util.Map".equals(type)) { - return obj; + return obj; } else if ("String".equals(type) || "java.lang.String".equals(type)) { - return obj.toString(); + return obj.toString(); } else if ("List".equals(type) || "java.util.List".equals(type)) { List<Object> tempList = FastList.newInstance(); tempList.add(obj); @@ -941,8 +941,8 @@ tempSet.add(obj); return tempSet; } else { - throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); - } + throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); + } } else if (obj instanceof java.util.Map) { fromType = "Map"; Map map = (Map) obj; @@ -959,7 +959,7 @@ tempSet.add(map); return tempSet; } else { - throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); + throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); } } else if (obj instanceof java.util.List) { fromType = "List"; @@ -969,7 +969,7 @@ } else if ("String".equals(type) || "java.lang.String".equals(type)) { return list.toString(); } else { - throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); + throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); } } else if (obj instanceof java.nio.Buffer) { fromType = "Buffer"; @@ -977,7 +977,7 @@ if ("java.nio.ByteBuffer".equals(type)) { return buffer; } else { - throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); + throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported"); } } else { // we can pretty much always do a conversion to a String, so do that here @@ -985,7 +985,7 @@ Debug.logWarning("No special conversion available for " + obj.getClass().getName() + " to String, returning object.toString().", module); return obj.toString(); } - + if (noTypeFail) { throw new GeneralException("Conversion from " + obj.getClass().getName() + " to " + type + " not currently supported"); } else { @@ -1026,7 +1026,7 @@ } else if ("contains".equals(operator) && value1 == null) { return Boolean.FALSE; } - + int result = 0; Object convertedValue2 = null; @@ -1098,9 +1098,9 @@ return Boolean.TRUE; if (convertedValue1 instanceof Map && ((Map) convertedValue1).size() == 0) return Boolean.TRUE; - return Boolean.FALSE; + return Boolean.FALSE; } else if ("is-not-empty".equals(operator)) { - if (convertedValue1 == null) + if (convertedValue1 == null) return Boolean.FALSE; if (convertedValue1 instanceof String && ((String) convertedValue1).length() == 0) return Boolean.FALSE; @@ -1108,9 +1108,9 @@ return Boolean.FALSE; if (convertedValue1 instanceof Map && ((Map) convertedValue1).size() == 0) return Boolean.FALSE; - return Boolean.TRUE; + return Boolean.TRUE; } - + if ("java.lang.String".equals(type) || "PlainString".equals(type)) { String str1 = (String) convertedValue1; String str2 = (String) convertedValue2; @@ -1206,10 +1206,10 @@ if (verboseOn) Debug.logVerbose("Returning true", module); return Boolean.TRUE; } - + public static boolean isEmpty(Object value) { if (value == null) return true; - + if (value instanceof String) { if (((String) value).length() == 0) { return true; @@ -1225,14 +1225,14 @@ } return false; } - + public static final class NullObject { public NullObject() { } - + public String toString() { return "ObjectType.NullObject"; } - + public boolean equals(Object other) { if (other instanceof NullObject) { // should do equality of object? don't think so, just same type Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -55,36 +55,36 @@ * */ public class OfbizBshBsfEngine extends BSFEngineImpl { - + public static final String module = OfbizBshBsfEngine.class.getName(); - + protected Interpreter interpreter; protected boolean installedApplyMethod; - + public static UtilCache<String, Interpreter.ParsedScript> parsedScripts = new UtilCache<String, Interpreter.ParsedScript>("script.BshBsfParsedCache", 0, 0, false); - + public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException { super.initialize(mgr, lang, declaredBeans); - + interpreter = BshUtil.getMasterInterpreter(null); - + // declare the bsf manager for callbacks, etc. try { interpreter.set("bsf", mgr); } catch (EvalError e) { throw new BSFException("bsh internal error: "+e.toString()); } - + for(int i=0; i<declaredBeans.size(); i++) { BSFDeclaredBean bean = (BSFDeclaredBean)declaredBeans.get(i); declareBean(bean); } } - + public void setDebug(boolean debug) { Interpreter.DEBUG=debug; } - + /** * Invoke method name on the specified bsh scripted object. * The object may be null to indicate the global namespace of the @@ -99,7 +99,7 @@ throw new BSFException("bsh internal error: "+e.toString()); } } - + if (object instanceof bsh.This) { try { return ((bsh.This)object).invokeMethod(name, args); @@ -115,8 +115,8 @@ ". Object: "+object +" is not a BeanShell scripted object."); } } - - + + /** * A helper BeanShell method that implements the anonymous method apply * proposed by BSF. Note that the script below could use the standard @@ -129,7 +129,7 @@ +"this.namespace.setVariable(_bsfNames[i], _bsfArgs[i]);" +"return this.interpreter.eval(_bsfText, this.namespace);" +"}"; - + /** * This is an implementation of the BSF apply() method. * It exectutes the funcBody text in an "anonymous" method call with @@ -138,21 +138,21 @@ public Object apply(String source, int lineNo, int columnNo, Object funcBody, Vector namesVec, Vector argsVec) throws BSFException { if (namesVec.size() != argsVec.size()) throw new BSFException("number of params/names mismatch"); if (!(funcBody instanceof String)) throw new BSFException("apply: function body must be a string"); - + String [] names = new String [ namesVec.size() ]; namesVec.copyInto(names); Object [] args = new String [ argsVec.size() ]; argsVec.copyInto(args); - + try { if (!installedApplyMethod) { interpreter.eval(bsfApplyMethod); installedApplyMethod = true; } - + bsh.This global = (bsh.This)interpreter.get("global"); return global.invokeMethod("_bsfApply", new Object [] { names, args, (String)funcBody }); - + } catch (InterpreterError e) { throw new BSFException("BeanShell interpreter internal error: " + e + sourceInfo(source,lineNo,columnNo)); } catch (TargetError e2) { @@ -161,15 +161,15 @@ throw new BSFException("BeanShell script error: " + e3 + sourceInfo(source,lineNo,columnNo)); } } - + public Object eval(String source, int lineNo, int columnNo, Object expr) throws BSFException { if (!(expr instanceof String)) throw new BSFException("BeanShell expression must be a string"); - + try { //return interpreter.eval(((String) expr)); - + Interpreter.ParsedScript script = null; - + if (source != null && source.length() > 0) { script = parsedScripts.get(source); if (script == null) { @@ -185,7 +185,7 @@ } else { script = interpreter.parseScript(source, new StringReader((String) expr)); } - + return interpreter.evalParsedScript(script); } catch (InterpreterError e) { throw new BSFException("BeanShell interpreter internal error: "+ e + sourceInfo(source,lineNo,columnNo)); @@ -197,13 +197,13 @@ throw new BSFException("BeanShell script error: " + e3 + sourceInfo(source,lineNo,columnNo)); } } - - + + public void exec(String source, int lineNo, int columnNo, Object script) throws BSFException { eval(source, lineNo, columnNo, script); } - - + + /* public void compileApply (String source, int lineNo, int columnNo, Object funcBody, Vector paramNames, Vector arguments, CodeBuffer cb) @@ -215,7 +215,7 @@ public void compileScript (String source, int lineNo, int columnNo, Object script, CodeBuffer cb) throws BSFException; */ - + public void declareBean(BSFDeclaredBean bean) throws BSFException { try { interpreter.set(bean.name, bean.bean); @@ -223,7 +223,7 @@ throw new BSFException("error declaring bean: " + bean.name + " : " + e.toString()); } } - + public void undeclareBean(BSFDeclaredBean bean) throws BSFException { try { interpreter.unset(bean.name); @@ -231,9 +231,9 @@ throw new BSFException("bsh internal error: " + e.toString()); } } - + public void terminate() { } - + private String sourceInfo(String source, int lineNo, int columnNo) { return "BSF info: " + source + " at line: " + lineNo +" column: " + columnNo; } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OutputStreamByteCount.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OutputStreamByteCount.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OutputStreamByteCount.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/OutputStreamByteCount.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -46,7 +46,7 @@ public void write(byte[] b, int off, int len) throws IOException { byteCount += len; } - + public long getByteCount() { return this.byteCount; } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/SSLUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/SSLUtil.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/SSLUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/SSLUtil.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -107,7 +107,7 @@ if (tm.getNumberOfKeyStores() < 1) { Debug.logWarning("System truststore not found!", module); } - + for (ComponentConfig.KeystoreInfo ksi: ComponentConfig.getAllKeystoreInfos()) { if (ksi.isTrustStore()) { KeyStore ks = ksi.getKeyStore(); @@ -141,7 +141,7 @@ } public static TrustManager[] getTrustManagers(KeyStore ks) throws GeneralSecurityException { - return new TrustManager[] { new MultiTrustManager(ks) }; + return new TrustManager[] { new MultiTrustManager(ks) }; } public static SSLSocketFactory getSSLSocketFactory(KeyStore ks, String password, String alias) throws IOException, GeneralSecurityException, GenericConfigException { @@ -194,10 +194,10 @@ } public static HostnameVerifier getHostnameVerifier(int level) { - switch (level) { + switch (level) { case HOSTCERT_MIN_CHECK: return new HostnameVerifier() { - public boolean verify(String hostname, SSLSession session) { + public boolean verify(String hostname, SSLSession session) { javax.security.cert.X509Certificate[] peerCerts; try { peerCerts = session.getPeerCertificateChain(); @@ -208,11 +208,11 @@ } for (javax.security.cert.X509Certificate peerCert: peerCerts) { Principal x500s = peerCert.getSubjectDN(); - Map subjectMap = KeyStoreUtil.getX500Map(x500s); + Map subjectMap = KeyStoreUtil.getX500Map(x500s); if (Debug.infoOn()) Debug.logInfo(peerCert.getSerialNumber().toString(16) + " :: " + subjectMap.get("CN"), module); - + try { peerCert.checkValidity(); } catch (Exception e) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringOutputStream.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringOutputStream.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringOutputStream.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringOutputStream.java Sat Mar 21 22:46:22 2009 @@ -36,7 +36,7 @@ } public void write(int b) throws IOException { - byte[] byteArr = new byte[] { (byte) b }; + byte[] byteArr = new byte[] { (byte) b }; buffer.append(new String(byteArr)); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/StringUtil.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -54,7 +54,7 @@ * */ public class StringUtil { - + public static final String module = StringUtil.class.getName(); /** OWASP ESAPI canonicalize strict flag; setting false so we only get warnings about double encoding, etc; can be set to true for exceptions and more security */ @@ -67,33 +67,33 @@ defaultWebEncoder = new DefaultEncoder(codecList); defaultWebValidator = new DefaultValidator(); } - + public static final SimpleEncoder htmlEncoder = new HtmlEncoder(); public static final SimpleEncoder xmlEncoder = new XmlEncoder(); - + public static interface SimpleEncoder { public String encode(String original); } - + public static class HtmlEncoder implements SimpleEncoder { public String encode(String original) { return StringUtil.defaultWebEncoder.encodeForHTML(original); } } - + public static class XmlEncoder implements SimpleEncoder { public String encode(String original) { return StringUtil.defaultWebEncoder.encodeForXML(original); } } - + // ================== Begin General Functions ================== - + public static String internString(String value) { return value != null ? value.intern() : null; } - /** + /** * Replaces all occurances of oldString in mainString with newString * @param mainString The original string * @param oldString The string to replace @@ -216,7 +216,7 @@ try { decodedMap.put(URLDecoder.decode(name, "UTF-8"), URLDecoder.decode(value, "UTF-8")); - } catch (UnsupportedEncodingException e1) { + } catch (UnsupportedEncodingException e1) { Debug.logError(e1, module); } } @@ -252,15 +252,15 @@ try { encodedName = URLEncoder.encode((String) key, "UTF-8"); } catch (UnsupportedEncodingException e) { - Debug.logError(e, module); + Debug.logError(e, module); } String encodedValue = null; try { encodedValue = URLEncoder.encode((String) value, "UTF-8"); } catch (UnsupportedEncodingException e) { - Debug.logError(e, module); + Debug.logError(e, module); } - + if (first) first = false; else @@ -334,7 +334,7 @@ throw new IllegalArgumentException("String is not from Set.toString()"); } - return newSet; + return newSet; } /** @@ -369,7 +369,7 @@ } return cppBuff.toString(); } - + /** Removes all spaces from a string */ public static String removeSpaces(String str) { return removeRegex(str,"[\\ ]"); @@ -397,7 +397,7 @@ throw new GeneralRuntimeException(e); } } - + private static char[] hexChar = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; public static int convertChar(char c) { if ( '0' <= c && c <= '9' ) { @@ -427,7 +427,7 @@ public static String removeNonNumeric(String str) { return removeRegex(str,"[\\D]"); } - + /** Removes all numbers from str */ public static String removeNumeric(String str) { return removeRegex(str,"[\\d]"); @@ -443,22 +443,22 @@ Matcher matcher = pattern.matcher(str); return matcher.replaceAll(""); } - + /** * Add the number to the string, keeping (padding to min of original length) - * + * * @return the new value */ public static String addToNumberString(String numberString, long addAmount) { if (numberString == null) return null; - + int origLength = numberString.length(); long number = Long.parseLong(numberString); return padNumberString(Long.toString(number + addAmount), origLength); } - + public static String padNumberString(String numberString, int targetMinLength) { - StringBuilder outStrBfr = new StringBuilder(numberString); + StringBuilder outStrBfr = new StringBuilder(numberString); while (targetMinLength > outStrBfr.length()) { outStrBfr.insert(0, '0'); } @@ -466,15 +466,15 @@ } /** - * Uses a black-list approach for necessary characters for HTML. + * Uses a black-list approach for necessary characters for HTML. * Does not allow various characters (after canonicalization), including "<", ">", "&" (if not followed by a space), and "%" (if not followed by a space). - * + * * @param value * @param errorMessageList */ public static String checkStringForHtmlStrictNone(String valueName, String value, List<String> errorMessageList) { if (UtilValidate.isEmpty(value)) return value; - + // canonicalize, strict (error on double-encoding) try { value = defaultWebEncoder.canonicalize(value, true); @@ -483,12 +483,12 @@ Debug.logError("Canonicalization (format consistency, character escaping that is mixed or double, etc) error for attribute named [" + valueName + "], String [" + value + "]: " + e.toString(), module); errorMessageList.add("In field [" + valueName + "] found character espacing (mixed or double) that is not allowed or other format consistency error: " + e.toString()); } - + // check for "<", ">" if (value.indexOf("<") >= 0 || value.indexOf(">") >= 0) { errorMessageList.add("In field [" + valueName + "] less-than (<) and greater-than (>) symbols are not allowed."); } - + /* NOTE DEJ 20090311: After playing with this more this doesn't seem to be necessary; the canonicalize will convert all such characters into actual text before this check is done, including other illegal chars like < which will canonicalize to < and then get caught // check for & followed a semicolon within 7 characters, no spaces in-between (and perhaps other things sometime?) int curAmpIndex = value.indexOf("&"); @@ -503,7 +503,7 @@ curAmpIndex = value.indexOf("&", curAmpIndex + 1); } */ - + /* NOTE DEJ 20090311: After playing with this more this doesn't seem to be necessary; the canonicalize will convert all such characters into actual text before this check is done, including other illegal chars like %3C which will canonicalize to < and then get caught // check for % followed by 2 hex characters int curPercIndex = value.indexOf("%"); @@ -516,16 +516,16 @@ curPercIndex = value.indexOf("%", curPercIndex + 1); } */ - + // TODO: anything else to check for that can be used to get HTML or JavaScript going without these characters? - + return value; } /** * Uses a white-list approach to check for safe HTML. * Based on the ESAPI validator configured in the antisamy-esapi.xml file. - * + * * @param value * @param errorMessageList * @return String with updated value if needed for safer HTML. @@ -536,7 +536,7 @@ errorMessageList.addAll(UtilGenerics.checkList(vel.errors(), String.class)); return value; } - + /** * Translates various HTML characters in a string so that the string can be displayed in a browser safely * <p> @@ -552,7 +552,7 @@ * <li>'>' (greater than) becomes '>' * <li>\n (Carriage Return) becomes '<br>gt;' * </ol> - * + * * @deprecated Use StringUtil.htmlEncoder instead. */ public static String htmlSpecialChars(String html, boolean doubleQuotes, boolean singleQuotes, boolean insertBR) { @@ -571,11 +571,11 @@ return html; } - + public static String htmlSpecialChars(String html) { return htmlSpecialChars(html, true, true, true); } - + public static String fromHtmlToSpecialChars(String html, boolean doubleQuotes, boolean singleQuotes, boolean insertBR) { html = StringUtil.replaceString(html, "&", "&"); html = StringUtil.replaceString(html, "<", "<"); @@ -639,7 +639,7 @@ } public static StringWrapper makeStringWrapper(String theString) { if (theString == null) return null; - if (theString.length() == 0) return StringWrapper.EMPTY_STRING_WRAPPER; + if (theString.length() == 0) return StringWrapper.EMPTY_STRING_WRAPPER; return new StringWrapper(theString); } @@ -648,17 +648,17 @@ * to avoid the general HTML auto-encoding that is now done through the Screen Widget. */ public static class StringWrapper { - public static final StringWrapper EMPTY_STRING_WRAPPER = new StringWrapper(""); - + public static final StringWrapper EMPTY_STRING_WRAPPER = new StringWrapper(""); + protected String theString; protected StringWrapper() { } public StringWrapper(String theString) { this.theString = theString; } - + /** - * Fairly simple method used for the plus (+) base concatenation in Groovy. - * + * Fairly simple method used for the plus (+) base concatenation in Groovy. + * * @param value * @return */ @@ -675,8 +675,8 @@ } /** - * A simple Map wrapper class that will do HTML encoding. To be used for passing a Map to something that will expand Strings with it as a context, etc. - * To reduce memory allocation impact this object is recyclable and minimal in that it only keeps a reference to the original Map. + * A simple Map wrapper class that will do HTML encoding. To be used for passing a Map to something that will expand Strings with it as a context, etc. + * To reduce memory allocation impact this object is recyclable and minimal in that it only keeps a reference to the original Map. */ public static class HtmlEncodingMapWrapper<K> implements Map<K, Object>, Reusable { protected static final ObjectFactory<HtmlEncodingMapWrapper<?>> mapStackFactory = new ObjectFactory<HtmlEncodingMapWrapper<?>>() { @@ -686,7 +686,7 @@ }; public static <K> HtmlEncodingMapWrapper<K> getHtmlEncodingMapWrapper(Map<K, Object> mapToWrap, SimpleEncoder encoder) { if (mapToWrap == null) return null; - + HtmlEncodingMapWrapper<K> mapWrapper = (HtmlEncodingMapWrapper<K>) UtilGenerics.<K, Object>checkMap(mapStackFactory.object()); mapWrapper.setup(mapToWrap, encoder); return mapWrapper; @@ -695,7 +695,7 @@ protected Map<K, Object> internalMap = null; protected SimpleEncoder encoder = null; protected HtmlEncodingMapWrapper() { } - + public void setup(Map<K, Object> mapToWrap, SimpleEncoder encoder) { this.internalMap = mapToWrap; this.encoder = encoder; @@ -704,7 +704,7 @@ this.internalMap = null; this.encoder = null; } - + public int size() { return this.internalMap.size(); } public boolean isEmpty() { return this.internalMap.isEmpty(); } public boolean containsKey(Object key) { return this.internalMap.containsKey(key); } @@ -713,7 +713,7 @@ Object theObject = this.internalMap.get(key); if (theObject instanceof String) { if (this.encoder != null) { - return encoder.encode((String) theObject); + return encoder.encode((String) theObject); } else { return StringUtil.defaultWebEncoder.encodeForHTML((String) theObject); } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/TimeDuration.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -148,16 +148,16 @@ calStart = (Calendar) cal2.clone(); calEnd = (Calendar) cal1.clone(); } - + // this will be used to speed up time comparisons long targetMillis = calEnd.getTimeInMillis(); long deltaMillis = targetMillis - calStart.getTimeInMillis(); - + // shortcut for equal dates if (deltaMillis == 0) { return; } - + // compute elapsed years long yearMillis = 86400000 * calStart.getMinimum(Calendar.DAY_OF_YEAR); float units = deltaMillis / yearMillis; @@ -189,13 +189,13 @@ units = deltaMillis / 1000; this.seconds = advanceCalendar(calStart, calEnd, (int) units, Calendar.SECOND); deltaMillis = targetMillis - calStart.getTimeInMillis(); - + this.millis = (int) deltaMillis; if (isNegative) { makeNegative(); } } - + protected int advanceCalendar(Calendar start, Calendar end, int units, int type) { if (units >= 1) { start.add(type, units); @@ -223,7 +223,7 @@ * returned object are based on a Gregorian calendar. <b>Note:</b> this * method should not be used to calculate elapsed time - use the elapsed * time constructor instead.</p> - * + * * @param millis A millisecond value * @return A <code>TimeDuration</code> instance */ @@ -264,8 +264,8 @@ /** Returns a <code>long</code> value derived from a <code>TimeDuration</code> * instance. This method is intended to be used in tandem with the - * <code>fromLong</code> method. - * + * <code>fromLong</code> method. + * * @param duration * @return the number number of milliseconds in the duration */ Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/URLConnector.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/URLConnector.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/URLConnector.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/URLConnector.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -31,10 +31,10 @@ /** * URLConnector.java - * + * */ public class URLConnector { - + public static final String module = URLConnector.class.getName(); private URLConnection connection = null; @@ -51,11 +51,11 @@ this.trustAnyCert = trustAnyCert; this.hostCertLevel = hostCertLevel; } - - protected synchronized URLConnection openConnection(int timeout) throws IOException { + + protected synchronized URLConnection openConnection(int timeout) throws IOException { Thread t = new Thread(new URLConnectorThread()); t.start(); - + try { this.wait(timeout); } catch (InterruptedException e) { @@ -79,15 +79,15 @@ public static URLConnection openConnection(URL url) throws IOException { return openConnection(url, 30000); } - + public static URLConnection openConnection(URL url, int timeout) throws IOException { return openConnection(url, timeout, null, SSLUtil.HOSTCERT_NORMAL_CHECK); } - + public static URLConnection openConnection(URL url, String clientCertAlias) throws IOException { return openConnection(url, 30000, clientCertAlias, SSLUtil.HOSTCERT_NORMAL_CHECK); } - + public static URLConnection openConnection(URL url, int timeout, String clientCertAlias, int hostCertLevel) throws IOException { URLConnector uc = new URLConnector(url, clientCertAlias, hostCertLevel, false); return uc.openConnection(timeout); @@ -117,7 +117,7 @@ URLConnection con = null; try { con = url.openConnection(); - + if ("HTTPS".equalsIgnoreCase(url.getProtocol())) { HttpsURLConnection scon = (HttpsURLConnection) con; try { @@ -146,7 +146,7 @@ } } } - + // closes the HttpURLConnection does nothing to others private static void close(URLConnection con) { if (con instanceof HttpURLConnection) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java?rev=757046&r1=757045&r2=757046&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java Sat Mar 21 22:46:22 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -178,7 +178,7 @@ /** * Returns currentTimeMillis as String - * + * * @return String(currentTimeMillis) */ public static String nowAsString() { @@ -254,7 +254,7 @@ return getYearStart(stamp, daysLater, monthsLater, yearsLater, TimeZone.getDefault(), Locale.getDefault()); } public static java.sql.Timestamp getYearStart(java.sql.Timestamp stamp, Number daysLater, Number monthsLater, Number yearsLater) { - return getYearStart(stamp, (daysLater == null ? 0 : daysLater.intValue()), + return getYearStart(stamp, (daysLater == null ? 0 : daysLater.intValue()), (monthsLater == null ? 0 : monthsLater.intValue()), (yearsLater == null ? 0 : yearsLater.intValue())); } @@ -297,7 +297,7 @@ public static java.sql.Timestamp getWeekEnd(java.sql.Timestamp stamp) { return getWeekEnd(stamp, TimeZone.getDefault(), Locale.getDefault()); } - + public static java.util.Calendar toCalendar(java.sql.Timestamp stamp) { Calendar cal = Calendar.getInstance(); if (stamp != null) { @@ -619,7 +619,7 @@ calendar.setTime(date); return dateFormat.format(date); } - + /** * Makes a date String in the format MM/DD/YYYY from a Date * @@ -703,7 +703,7 @@ return df.format(timestamp); } - + /** * Makes a Timestamp for the beginning of the month * @@ -741,23 +741,23 @@ Calendar tempCal = toCalendar(stamp, TimeZone.getDefault(), Locale.getDefault()); return tempCal.get(Calendar.DAY_OF_WEEK); } - + public static int weekNumber(Timestamp input, int startOfWeek) { Calendar calendar = Calendar.getInstance(); calendar.setFirstDayOfWeek(startOfWeek); - + if (startOfWeek == Calendar.MONDAY) { calendar.setMinimalDaysInFirstWeek(4); - } else if (startOfWeek == Calendar.SUNDAY) { + } else if (startOfWeek == Calendar.SUNDAY) { calendar.setMinimalDaysInFirstWeek(3); } - + calendar.setTime(new java.util.Date(input.getTime())); return calendar.get(Calendar.WEEK_OF_YEAR); } - + // ----- New methods that take a timezone and locale -- // - + /** * Returns a Calendar object initialized to the specified date/time, time zone, * and locale. @@ -855,7 +855,7 @@ retStamp.setNanos(999999999); return retStamp; } - + public static Timestamp getMonthStart(Timestamp stamp, TimeZone timeZone, Locale locale) { return getMonthStart(stamp, 0, 0, timeZone, locale); } @@ -893,7 +893,7 @@ } public static Timestamp getYearStart(Timestamp stamp, Number daysLater, Number monthsLater, Number yearsLater, TimeZone timeZone, Locale locale) { - return getYearStart(stamp, (daysLater == null ? 0 : daysLater.intValue()), + return getYearStart(stamp, (daysLater == null ? 0 : daysLater.intValue()), (monthsLater == null ? 0 : monthsLater.intValue()), (yearsLater == null ? 0 : yearsLater.intValue()), timeZone, locale); } @@ -938,7 +938,7 @@ /** * Returns a List of month name Strings - suitable for calendar headings. - * + * * @param locale * @return List of month name Strings */ @@ -953,10 +953,10 @@ } return resultList; } - + /** * Returns an initialized DateFormat object. - * + * * @param dateFormat * optional format string * @param tz @@ -1077,7 +1077,7 @@ public static TimeZone getDefaultTimeZone() { return TimeZone.getDefault(); } - + /** Returns a TimeZone object based upon a time zone ID. Method defaults to * server's time zone if tzID is null or empty. * @see java.util.TimeZone @@ -1095,7 +1095,7 @@ */ public static TimeZone toTimeZone(int gmtOffset) { if (gmtOffset > 12 || gmtOffset < -14) { - throw new IllegalArgumentException("Invalid GMT offset"); + throw new IllegalArgumentException("Invalid GMT offset"); } String tzId = gmtOffset > 0 ? "Etc/GMT+" : "Etc/GMT"; return TimeZone.getTimeZone(tzId + gmtOffset); |
Free forum by Nabble | Edit this page |