svn commit: r1165549 - in /commons/sandbox/runtime/trunk/src/main: native/ native/os/win32/ test/org/apache/commons/runtime/
Author: mturk Date: Tue Sep 6 07:59:45 2011 New Revision: 1165549 URL: http://svn.apache.org/viewvc?rev=1165549&view=rev Log: Implement windows user and group classes Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c (with props) commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c (with props) commons/sandbox/runtime/trunk/src/main/native/os/win32/user.c (with props) Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_opts.h commons/sandbox/runtime/trunk/src/main/native/os/win32/security.c commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUser.java Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=1165549&r1=1165548&r2=1165549&view=diff == --- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original) +++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Tue Sep 6 07:59:45 2011 @@ -81,6 +81,7 @@ WIN32_SOURCES=\ $(TOPDIR)\os\win32\dso.c \ $(TOPDIR)\os\win32\exec.c \ $(TOPDIR)\os\win32\execmem.c \ + $(TOPDIR)\os\win32\group.c \ $(TOPDIR)\os\win32\inetsock.c \ $(TOPDIR)\os\win32\init.c \ $(TOPDIR)\os\win32\ipcsock.c \ @@ -98,12 +99,14 @@ WIN32_SOURCES=\ $(TOPDIR)\os\win32\security.c \ $(TOPDIR)\os\win32\selectset.c \ $(TOPDIR)\os\win32\semaphore.c \ + $(TOPDIR)\os\win32\sendfd.c \ $(TOPDIR)\os\win32\sendfile.c \ $(TOPDIR)\os\win32\service.c \ $(TOPDIR)\os\win32\shmem.c \ $(TOPDIR)\os\win32\sockopts.c \ $(TOPDIR)\os\win32\sockstream.c \ $(TOPDIR)\os\win32\time.c \ + $(TOPDIR)\os\win32\user.c \ $(TOPDIR)\os\win32\util.c \ $(TOPDIR)\os\win32\winapi.c \ $(TOPDIR)\os\win32\wpipe.c Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_opts.h URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_opts.h?rev=1165549&r1=1165548&r2=1165549&view=diff == --- commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_opts.h (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_opts.h Tue Sep 6 07:59:45 2011 @@ -300,5 +300,11 @@ intsymlink_w(const wchar_t * ssize_treadlink_w(const wchar_t *lnkname, wchar_t *buf, size_t len); PSECURITY_ATTRIBUTES GetSaWithNullDacl(JNI_STDENV, jboolean inherit); +PSID GetSidFromAccountName(LPCWSTR name, PSID_NAME_USE sidtype); +SID_NAME_USE GetAccountNameFromSid(LPWSTR buf, size_t blen, PSID psid); +SID_NAME_USE GetAccountSidType(PSID psid); +DWORD GetUserHomePath(LPWSTR buf, DWORD blen, PSID sid); +HANDLE GetCurrentAccessToken(JNI_STDENV); +LPVOID GetTokenInformationEx(JNI_STDENV, HANDLE h, TOKEN_INFORMATION_CLASS ic); #endif /* _ACR_ARCH_OPTS_H_ */ Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c?rev=1165549&view=auto == --- commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/group.c Tue Sep 6 07:59:45 2011 @@ -0,0 +1,386 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file 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 KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "acr/string.h" +#include "acr/clazz.h" +#include "acr/jniapi.h" +#include "acr/port.h" +#include "acr/misc.h" +#include "acr/users.h" +#include "arch_opts.h" + +#include +#include + +J_DECLARE_CLAZZ = { +INVALID_FIELD_OFFSET, +0, +0, +0, +ACR_CLASS_PATH "Group" +}; + +J_DECLARE_M_ID() = { +0, +"", +"(J[B)V" +}; + +J_DECLARE_F_ID() = { +INVALID_FIELD_OFFSET, +INVALID_FIELD_OFFSET, +0, +"Name", +"Ljava/lang/String;" +}; + +J_DECLARE_F_ID(0001) = { +INVALID_FIELD_OFFSET, +INVALID_FIELD
svn commit: r1165590 - in /commons/sandbox/runtime/trunk/src/main: native/os/win32/sendfd.c test/org/apache/commons/runtime/TestSendSocket.java
Author: mturk Date: Tue Sep 6 10:15:45 2011 New Revision: 1165590 URL: http://svn.apache.org/viewvc?rev=1165590&view=rev Log: Implement windows send sockets Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSendSocket.java Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c?rev=1165590&r1=1165589&r2=1165590&view=diff == --- commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c Tue Sep 6 10:15:45 2011 @@ -33,3 +33,154 @@ ACR_NET_EXPORT(jstring, Utils, sendSocke return AcrNewJavaStringA(env, buf); } +HANDLE send_pipe(LPCWSTR name, LPDWORD rpid) +{ +DWORD rc = 0; +HANDLE ph; + +ph = CreateNamedPipeW(name, + PIPE_ACCESS_DUPLEX, + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, + ISIZEOF(WSAPROTOCOL_INFO), + ISIZEOF(WSAPROTOCOL_INFO), + 0, + 0); +if (ph == INVALID_HANDLE_VALUE) +return 0; +if (!ConnectNamedPipe(ph, 0)) +rc = GetLastError(); +if (rc == 0 || rc == ERROR_PIPE_CONNECTED) { +DWORD nr; +WSAPROTOCOL_INFO id; +if (ReadFile(ph, &id, sizeof(WSAPROTOCOL_INFO), &nr, 0)) { +*rpid = id.dwProviderReserved; +return ph; +} +} +CloseHandle(ph); +return 0; +} + +HANDLE recv_pipe(LPCWSTR name) +{ +DWORD rc = 0; +HANDLE ph; +DWORD wr; +WSAPROTOCOL_INFO id; +ph = CreateFileW(name, + GENERIC_READ | GENERIC_WRITE, + 0, + 0, + OPEN_EXISTING, + 0, + 0); +if (ph == INVALID_HANDLE_VALUE) +return 0; +if (!ConnectNamedPipe(ph, 0)) +rc = GetLastError(); +id.dwProviderReserved = GetCurrentProcessId(); +if (WriteFile(ph, &id, sizeof(WSAPROTOCOL_INFO), &wr, 0)) +return ph; +CloseHandle(ph); +return 0; +} + +ACR_NET_EXPORT(jint, Utils, sendfd0)(JNI_STDARGS, jstring name, + jlongArray fda, + jint off, jint len) +{ +intrc = 0; +jlong *fds = 0; +inti; + +if (len > MAX_SEND_FDS) +return ACR_EOVERFLOW; +WITH_WSTR(name) { +HANDLE pipe; +DWORD cpid; +WSAPROTOCOL_INFO pi; + +pipe = send_pipe(J2S(name), &cpid); +if (pipe == 0) { +rc = ACR_GET_OS_ERROR(); +goto cleanup; +} +fds = (*env)->GetLongArrayElements(env, fda, 0); +if (fds == 0) { +rc = ACR_EINVAL; +goto cleanup; +} +for (i = 0; i < len; i++) { +acr_sd_t *sp = J2P(fds[i + off], acr_sd_t *); +if (sp != 0) { +memset(&pi, 0, sizeof(WSAPROTOCOL_INFO)); +rc = WSADuplicateSocket(sp->s, cpid, &pi); +if (rc == 0) { +DWORD wr; +WriteFile(pipe, &pi, sizeof(WSAPROTOCOL_INFO), &wr, 0); +} +else { +/* Duplicate failed */ +break; +} +} +} +(*env)->ReleaseLongArrayElements(env, fda, fds, JNI_ABORT); +cleanup: +SAFE_CLOSE_HANDLE(pipe); +} DONE_WITH_STR(name); +return rc; +} + +ACR_NET_EXPORT(jlongArray, Utils, recvfd0)(JNI_STDARGS, jstring name) +{ +int rc = 0; +jlongArray fds = 0; +jlong sda[MAX_SEND_FDS]; + +WITH_WSTR(name) { +HANDLE pipe; +if ((pipe = recv_pipe(J2S(name))) == 0) { +rc = ACR_GET_OS_ERROR(); +} +else { +int nfd; + +for (nfd = 0; nfd < MAX_SEND_FDS; nfd++) { +WSAPROTOCOL_INFO pi; +DWORD rd; +SOCKET sd; +acr_sd_t *sp; + +if (!ReadFile(pipe, &pi, sizeof(WSAPROTOCOL_INFO), &rd, 0)) +break; +sd = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, &pi, 0, 0); +if (sd == INVALID_SOCKET) { +rc = WSAGetLastError(); +break; +} +sp = ACR_TALLOC(acr_sd_t); +if (sp == 0) { +rc = ACR_ENOMEM; +break; +} +sp->type= ACR_DT_SOCKET; +sp->refs= 1; +sp->s = sd; +sp->timeout =
svn commit: r1165610 - in /commons/sandbox/runtime/trunk/src/main: native/os/win32/sendfd.c test/org/apache/commons/runtime/TestSendSocket.java
Author: mturk Date: Tue Sep 6 11:29:40 2011 New Revision: 1165610 URL: http://svn.apache.org/viewvc?rev=1165610&view=rev Log: Sync parent and child tests Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSendSocket.java Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c?rev=1165610&r1=1165609&r2=1165610&view=diff == --- commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c Tue Sep 6 11:29:40 2011 @@ -68,6 +68,7 @@ HANDLE recv_pipe(LPCWSTR name) HANDLE ph; DWORD wr; WSAPROTOCOL_INFO id; + ph = CreateFileW(name, GENERIC_READ | GENERIC_WRITE, 0, @@ -77,8 +78,6 @@ HANDLE recv_pipe(LPCWSTR name) 0); if (ph == INVALID_HANDLE_VALUE) return 0; -if (!ConnectNamedPipe(ph, 0)) -rc = GetLastError(); id.dwProviderReserved = GetCurrentProcessId(); if (WriteFile(ph, &id, sizeof(WSAPROTOCOL_INFO), &wr, 0)) return ph; Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSendSocket.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSendSocket.java?rev=1165610&r1=1165609&r2=1165610&view=diff == --- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSendSocket.java (original) +++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSendSocket.java Tue Sep 6 11:29:40 2011 @@ -20,34 +20,56 @@ import java.io.IOException; import java.io.File; import org.testng.annotations.*; import org.testng.Assert; +import org.apache.commons.runtime.Semaphore; public class TestSendSocket extends Assert { +private static final String semname = "acrSemop23"; + @Test(groups = { "sendsd.parent" }) public void sendSocket() throws Exception { +Semaphore s = Semaphore.create(semname, 0); +assertNotNull(s); SocketServerEndpoint ss = new SocketServerEndpoint(); InetSocketAddresssa = new InetSocketAddress("127.0.0.1", 0); ss.bind(sa); long fds[] = new long[1]; fds[0] = ss.descriptor().fd(); Utils.sendSockets(Utils.sendSocketName(0), fds, 0, 1); +s.acquire(); System.out.println("[parent] Done."); System.out.flush(); +s.close(); } @Test(groups = { "sendsd.child" }) public void recvSocket() throws Exception { + System.out.println("[child] Geting sockets"); System.out.flush(); +Semaphore s = null; +int step = 125; +while (step <= 2000) { +try { +s = Semaphore.open(semname); +break; +} catch (Exception x) { + +} +Thread.sleep(step); +step *= 2; +} +assertNotNull(s); long[] fds = Utils.recvSockets(Utils.sendSocketName(0)); assertEquals(fds.length, 1); System.out.println("[child] Done."); System.out.flush(); +s.release(); } }
svn commit: r1165622 - in /commons/sandbox/runtime/trunk/src/main/native: include/acr/string.h os/win32/sendfd.c
Author: mturk Date: Tue Sep 6 12:02:20 2011 New Revision: 1165622 URL: http://svn.apache.org/viewvc?rev=1165622&view=rev Log: Add string exit cleanup macro Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr/string.h commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr/string.h URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr/string.h?rev=1165622&r1=1165621&r2=1165622&view=diff == --- commons/sandbox/runtime/trunk/src/main/native/include/acr/string.h (original) +++ commons/sandbox/runtime/trunk/src/main/native/include/acr/string.h Tue Sep 6 12:02:20 2011 @@ -86,6 +86,8 @@ if (_s##V != 0 && _s##V != _b##V) AcrFree(_s##V); \ } while(0) +#define BREAK_WITH_STR(V) goto _e##V + /* NOTE: Usable only where sizeof(wchar_t) == sizeof(jchar) * So far this is only true for Windows. */ Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c?rev=1165622&r1=1165621&r2=1165622&view=diff == --- commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/sendfd.c Tue Sep 6 12:02:20 2011 @@ -103,12 +103,13 @@ ACR_NET_EXPORT(jint, Utils, sendfd0)(JNI pipe = send_pipe(J2S(name), &cpid); if (pipe == 0) { rc = ACR_GET_OS_ERROR(); -goto cleanup; +BREAK_WITH_STR(name); } fds = (*env)->GetLongArrayElements(env, fda, 0); if (fds == 0) { rc = ACR_EINVAL; -goto cleanup; +CloseHandle(pipe); +BREAK_WITH_STR(name); } for (i = 0; i < len; i++) { acr_sd_t *sp = J2P(fds[i + off], acr_sd_t *); @@ -126,8 +127,7 @@ ACR_NET_EXPORT(jint, Utils, sendfd0)(JNI } } (*env)->ReleaseLongArrayElements(env, fda, fds, JNI_ABORT); -cleanup: -SAFE_CLOSE_HANDLE(pipe); +CloseHandle(pipe); } DONE_WITH_STR(name); return rc; } @@ -139,45 +139,43 @@ ACR_NET_EXPORT(jlongArray, Utils, recvfd jlong sda[MAX_SEND_FDS]; WITH_WSTR(name) { -HANDLE pipe; -if ((pipe = recv_pipe(J2S(name))) == 0) { +int nfd; +HANDLE pipe = recv_pipe(J2S(name)); +if (pipe == 0) { rc = ACR_GET_OS_ERROR(); +BREAK_WITH_STR(name); } -else { -int nfd; - -for (nfd = 0; nfd < MAX_SEND_FDS; nfd++) { -WSAPROTOCOL_INFO pi; -DWORD rd; -SOCKET sd; -acr_sd_t *sp; +for (nfd = 0; nfd < MAX_SEND_FDS; nfd++) { +WSAPROTOCOL_INFO pi; +DWORD rd; +SOCKET sd; +acr_sd_t *sp; -if (!ReadFile(pipe, &pi, sizeof(WSAPROTOCOL_INFO), &rd, 0)) -break; -sd = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, &pi, 0, 0); -if (sd == INVALID_SOCKET) { -rc = WSAGetLastError(); -break; -} -sp = ACR_TALLOC(acr_sd_t); -if (sp == 0) { -rc = ACR_ENOMEM; -break; -} -sp->type= ACR_DT_SOCKET; -sp->refs= 1; -sp->s = sd; -sp->timeout = -1; -sda[nfd]= P2J(sp); +if (!ReadFile(pipe, &pi, sizeof(WSAPROTOCOL_INFO), &rd, 0)) +break; +sd = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, &pi, 0, 0); +if (sd == INVALID_SOCKET) { +rc = WSAGetLastError(); +break; +} +/* Make it non inheritable */ +SetHandleInformation((HANDLE)sd, HANDLE_FLAG_INHERIT, 0); +sp = ACR_TALLOC(acr_sd_t); +if (sp == 0) { +rc = ACR_ENOMEM; +break; } -if (rc != 0 || nfd == 0) -goto cleanup; -fds = (*env)->NewLongArray(env, nfd); -if (fds != 0) +sp->type= ACR_DT_SOCKET; +sp->refs= 1; +sp->s = sd; +sp->timeout = -1; +sda[nfd]= P2J(sp); +} +if (rc == 0 && nfd > 0) { +if ((fds = (*env)->NewLongArray(env, nfd)) != 0) (*env)->SetLongArrayRegion(env, fds, 0, nfd, sda); -cleanup: -CloseHandle(pipe); } +CloseHandle(pipe); } DONE_WITH_STR(name);
svn commit: r1165644 - /commons/proper/lang/trunk/pom.xml
Author: ggregory Date: Tue Sep 6 12:46:17 2011 New Revision: 1165644 URL: http://svn.apache.org/viewvc?rev=1165644&view=rev Log: Recast security manager test as an integration test (commented out.) Modified: commons/proper/lang/trunk/pom.xml Modified: commons/proper/lang/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1165644&r1=1165643&r2=1165644&view=diff == --- commons/proper/lang/trunk/pom.xml (original) +++ commons/proper/lang/trunk/pom.xml Tue Sep 6 12:46:17 2011 @@ -486,15 +486,19 @@ + -->
svn commit: r1165645 - /commons/proper/lang/trunk/src/test/resources/java.policy
Author: ggregory Date: Tue Sep 6 12:46:39 2011 New Revision: 1165645 URL: http://svn.apache.org/viewvc?rev=1165645&view=rev Log: Changes for [parent] 22-SNAPSHOT. Modified: commons/proper/lang/trunk/src/test/resources/java.policy Modified: commons/proper/lang/trunk/src/test/resources/java.policy URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/resources/java.policy?rev=1165645&r1=1165644&r2=1165645&view=diff == --- commons/proper/lang/trunk/src/test/resources/java.policy (original) +++ commons/proper/lang/trunk/src/test/resources/java.policy Tue Sep 6 12:46:39 2011 @@ -194,6 +194,7 @@ grant { //at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69) permission java.io.FilePermission "${user.home}/.m2/repository/org/apache/maven/surefire/surefire-junit4/2.8.1/surefire-junit4-2.8.1.jar", "read"; + permission java.io.FilePermission "${user.home}/.m2/repository/org/apache/maven/surefire/surefire-junit4/2.9/surefire-junit4-2.9.jar", "read"; //java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\ggregory\.m2\repository\org\apache\maven\surefire\surefire-api\2.8.1\surefire-api-2.8.1.jar read) @@ -212,6 +213,7 @@ grant { //at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69) permission java.io.FilePermission "${user.home}/.m2/repository/org/apache/maven/surefire/surefire-api/2.8.1/surefire-api-2.8.1.jar", "read"; + permission java.io.FilePermission "${user.home}/.m2/repository/org/apache/maven/surefire/surefire-api/2.9/surefire-api-2.9.jar", "read"; //java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)
svn commit: r1165649 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java
Author: henrib Date: Tue Sep 6 12:58:17 2011 New Revision: 1165649 URL: http://svn.apache.org/viewvc?rev=1165649&view=rev Log: Fixed a bug in operator 'in/match' where 'contains' method was not detected correctly Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java?rev=1165649&r1=1165648&r2=1165649&view=diff == --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java Tue Sep 6 12:58:17 2011 @@ -1171,14 +1171,14 @@ public class Interpreter implements Pars } // try a contains method (duck type set) try { -Object[] argv = {right}; -JexlMethod vm = uberspect.getMethod(left, "contains", argv, node); +Object[] argv = {left}; +JexlMethod vm = uberspect.getMethod(right, "contains", argv, node); if (vm != null) { -return arithmetic.toBoolean(vm.invoke(left, argv)) ? Boolean.FALSE : Boolean.TRUE; +return arithmetic.toBoolean(vm.invoke(right, argv)) ? Boolean.FALSE : Boolean.TRUE; } else if (arithmetic.narrowArguments(argv)) { -vm = uberspect.getMethod(left, "contains", argv, node); +vm = uberspect.getMethod(right, "contains", argv, node); if (vm != null) { -return arithmetic.toBoolean(vm.invoke(left, argv)) ? Boolean.FALSE : Boolean.TRUE; +return arithmetic.toBoolean(vm.invoke(right, argv)) ? Boolean.FALSE : Boolean.TRUE; } } } catch (InvocationTargetException e) {
svn commit: r1165652 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
Author: henrib Date: Tue Sep 6 13:01:14 2011 New Revision: 1165652 URL: http://svn.apache.org/viewvc?rev=1165652&view=rev Log: Simplified arithmetic implementation using a general compare; Added some checks wrt / 0 (% 0); Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java?rev=1165652&r1=1165651&r2=1165652&view=diff == --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java Tue Sep 6 13:01:14 2011 @@ -404,6 +404,9 @@ public class JexlArithmetic { if (left instanceof BigDecimal || right instanceof BigDecimal) { BigDecimal l = toBigDecimal(left); BigDecimal r = toBigDecimal(right); +if (BigDecimal.ZERO.equals(r)) { +throw new ArithmeticException("/"); +} BigDecimal result = l.divide(r, getMathContext()); return narrowBigDecimal(left, right, result); } @@ -411,6 +414,9 @@ public class JexlArithmetic { // otherwise treat as integers BigInteger l = toBigInteger(left); BigInteger r = toBigInteger(right); +if (BigInteger.ZERO.equals(r)) { +throw new ArithmeticException("/"); +} BigInteger result = l.divide(r); return narrowBigInteger(left, right, result); } @@ -441,6 +447,9 @@ public class JexlArithmetic { if (left instanceof BigDecimal || right instanceof BigDecimal) { BigDecimal l = toBigDecimal(left); BigDecimal r = toBigDecimal(right); +if (BigDecimal.ZERO.equals(r)) { +throw new ArithmeticException("%"); +} BigDecimal remainder = l.remainder(r, getMathContext()); return narrowBigDecimal(left, right, remainder); } @@ -449,6 +458,9 @@ public class JexlArithmetic { BigInteger l = toBigInteger(left); BigInteger r = toBigInteger(right); BigInteger result = l.mod(r); +if (BigInteger.ZERO.equals(r)) { +throw new ArithmeticException("%"); +} return narrowBigInteger(left, right, result); } @@ -524,32 +536,34 @@ public class JexlArithmetic { * @return the negated value */ public Object negate(Object val) { -if (val instanceof Byte) { -byte valueAsByte = ((Byte) val).byteValue(); -return Byte.valueOf((byte) -valueAsByte); -} else if (val instanceof Short) { -short valueAsShort = ((Short) val).shortValue(); -return Short.valueOf((short) -valueAsShort); -} else if (val instanceof Integer) { +if (val instanceof Integer) { int valueAsInt = ((Integer) val).intValue(); return Integer.valueOf(-valueAsInt); -} else if (val instanceof Long) { -long valueAsLong = -((Long) val).longValue(); -return Long.valueOf(valueAsLong); -} else if (val instanceof Float) { -float valueAsFloat = ((Float) val).floatValue(); -return new Float(-valueAsFloat); } else if (val instanceof Double) { double valueAsDouble = ((Double) val).doubleValue(); return new Double(-valueAsDouble); +} else if (val instanceof Long) { +long valueAsLong = -((Long) val).longValue(); +return Long.valueOf(valueAsLong); } else if (val instanceof BigDecimal) { BigDecimal valueAsBigD = (BigDecimal) val; return valueAsBigD.negate(); } else if (val instanceof BigInteger) { BigInteger valueAsBigI = (BigInteger) val; return valueAsBigI.negate(); +} else if (val instanceof Float) { +float valueAsFloat = ((Float) val).floatValue(); +return new Float(-valueAsFloat); +} else if (val instanceof Short) { +short valueAsShort = ((Short) val).shortValue(); +return Short.valueOf((short) -valueAsShort); +} else if (val instanceof Byte) { +byte valueAsByte = ((Byte) val).byteValue(); +return Byte.valueOf((byte) -valueAsByte); +} else if (val instanceof Boolean) { +return ((Boolean) val).booleanValue()? Boolean.FALSE : Boolean.TRUE; } -throw new IllegalArgumentException(val.toString() + ": negate can only be applied to a number"); +throw new ArithmeticException("Object negation:(" + val + ")"); } /** @@ -577,6 +591,60 @@ public class JexlArithmetic { } /** + * Performs
svn commit: r1165654 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java
Author: henrib Date: Tue Sep 6 13:02:31 2011 New Revision: 1165654 URL: http://svn.apache.org/viewvc?rev=1165654&view=rev Log: Fixed issue where class loader change was not properly cleaning the constructor map Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java?rev=1165654&r1=1165653&r2=1165654&view=diff == --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java Tue Sep 6 13:02:31 2011 @@ -180,7 +180,7 @@ public class IntrospectorBase { Iterator>> entries = constructorsMap.entrySet().iterator(); while(entries.hasNext()) { Map.Entry> entry = entries.next(); -Class clazz = entry.getValue().getClass(); +Class clazz = entry.getValue().getDeclaringClass(); if (isLoadedBy(previous, clazz)) { entries.remove(); // the method name is the name of the class
svn commit: r1165656 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java
Author: erans Date: Tue Sep 6 13:05:55 2011 New Revision: 1165656 URL: http://svn.apache.org/viewvc?rev=1165656&view=rev Log: MATH-621 Bug (in an unexplored code path); fixing by comparison with original code. Added exception to track unexplored path. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java?rev=1165656&r1=1165655&r2=1165656&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BOBYQAOptimizer.java Tue Sep 6 13:05:55 2011 @@ -538,7 +538,7 @@ public class BOBYQAOptimizer bdtest = -work1.getEntry(j); } if (bdtest < bdtol) { -curv = hq.getEntry((j + j * j) / 2 - 1); +curv = hq.getEntry((j + j * j) / 2); for (int k = 0; k < npt; k++) { // Computing 2nd power final double d1 = xpt.getEntry(k, j); @@ -548,6 +548,7 @@ public class BOBYQAOptimizer if (bdtest < bdtol) { state = 650; break; } +throw new PathIsExploredException(); // XXX } } state = 680; break;
svn commit: r1165701 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
Author: sebb Date: Tue Sep 6 15:16:47 2011 New Revision: 1165701 URL: http://svn.apache.org/viewvc?rev=1165701&view=rev Log: LANG-744 StringUtils throws java.security.AccessControlException on Google App Engine Change static code to catch and save Exception; only report failure if no method is available Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java?rev=1165701&r1=1165700&r2=1165701&view=diff == --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java Tue Sep 6 15:16:47 2011 @@ -630,13 +630,14 @@ public class StringUtils { } try { String result = null; -if (java6Available) { +if (java6NormalizeMethod != null) { result = removeAccentsJava6(input); -} else if (sunAvailable) { +} else if (sunDecomposeMethod != null) { result = removeAccentsSUN(input); } else { throw new UnsupportedOperationException( -"The stripAccents(CharSequence) method requires at least Java 1.6 or a Sun JVM"); +"The stripAccents(CharSequence) method requires at least Java 1.6 or a Sun JVM", +new UnsupportedOperationException(java6Exception)); } // Note that none of the above methods correctly remove ligatures... return result; @@ -667,8 +668,8 @@ public class StringUtils { String decomposed = java.text.Normalizer.normalize(CharSequence, Normalizer.Form.NFD); return java6Pattern.matcher(decomposed).replaceAll("");//$NON-NLS-1$ */ -if (!java6Available || java6NormalizerFormNFD == null) { -throw new IllegalStateException("java.text.Normalizer is not available"); +if (java6NormalizeMethod == null || java6NormalizerFormNFD == null) { +throw new IllegalStateException("java.text.Normalizer is not available", java6Exception); } String result; result = (String) java6NormalizeMethod.invoke(null, new Object[] {text, java6NormalizerFormNFD}); @@ -691,8 +692,8 @@ public class StringUtils { String decomposed = sun.text.Normalizer.decompose(text, false, 0); return sunPattern.matcher(decomposed).replaceAll("");//$NON-NLS-1$ */ -if (! sunAvailable) { -throw new IllegalStateException("sun.text.Normalizer is not available"); +if (sunDecomposeMethod == null) { +throw new IllegalStateException("sun.text.Normalizer is not available", sunException); } String result; result = (String) sunDecomposeMethod.invoke(null, new Object[] {text, Boolean.FALSE, Integer.valueOf(0)}); @@ -701,55 +702,52 @@ public class StringUtils { } // SUN internal, Java 1.3 -> Java 5 -private static boolean sunAvailable = false; -private static Method sunDecomposeMethod = null; +private static final Throwable sunException; +private static final Method sunDecomposeMethod; private static final Pattern sunPattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");//$NON-NLS-1$ // Java 6+ -private static boolean java6Available = false; -private static Method java6NormalizeMethod = null; -private static Object java6NormalizerFormNFD = null; +private static final Throwable java6Exception; +private static final Method java6NormalizeMethod; +private static final Object java6NormalizerFormNFD; private static final Pattern java6Pattern = sunPattern; static { +// Set up defaults for final static fields +Object _java6NormalizerFormNFD = null; +Method _java6NormalizeMethod = null; +Method _sunDecomposeMethod = null; +Throwable _java6Exception = null; +Throwable _sunException = null; try { // java.text.Normalizer.normalize(CharSequence, Normalizer.Form.NFD); // Be careful not to get Java 1.3 java.text.Normalizer! Class normalizerFormClass = Thread.currentThread().getContextClassLoader() .loadClass("java.text.Normalizer$Form");//$NON-NLS-1$ -java6NormalizerFormNFD = normalizerFormClass.getField("NFD").get(null);//$NON-NLS-1$ +_java6NormalizerFormNFD = normalizerFormClass.getField("NFD").get(null);//$NON-NLS-1$ Class normalizerClass = Thread.currentThread().getContextClassLoader() .loadClass("java.text.Normalizer");//$NON-NLS-1$ -java6Normalize
svn commit: r1165755 - in /commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl: CatalogBase.java ChainBase.java
Author: simonetripodi Date: Tue Sep 6 16:27:41 2011 New Revision: 1165755 URL: http://svn.apache.org/viewvc?rev=1165755&view=rev Log: fixed wrong version number, 3.0 not planned yet Modified: commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/CatalogBase.java commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/ChainBase.java Modified: commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/CatalogBase.java URL: http://svn.apache.org/viewvc/commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/CatalogBase.java?rev=1165755&r1=1165754&r2=1165755&view=diff == --- commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/CatalogBase.java (original) +++ commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/CatalogBase.java Tue Sep 6 16:27:41 2011 @@ -108,7 +108,7 @@ public class CatalogBase implements Cata * Returns the map of named {@link Command}s, keyed by name. * * @return The map of named {@link Command}s, keyed by name. - * @since 3.0 + * @since 2.0 */ public Map> getCommands() { return unmodifiableMap(commands); Modified: commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/ChainBase.java URL: http://svn.apache.org/viewvc/commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/ChainBase.java?rev=1165755&r1=1165754&r2=1165755&view=diff == --- commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/ChainBase.java (original) +++ commons/proper/chain/branches/version-2.0-work/src/main/java/org/apache/commons/chain/impl/ChainBase.java Tue Sep 6 16:27:41 2011 @@ -234,7 +234,7 @@ public class ChainBaseexecute() method, * false otherwise. - * @since 3.0 + * @since 2.0 */ public boolean isFrozen() { return frozen;
svn commit: r1165764 - /commons/proper/ognl/trunk/src/site/site.xml
Author: mcucchiara Date: Tue Sep 6 17:14:39 2011 New Revision: 1165764 URL: http://svn.apache.org/viewvc?rev=1165764&view=rev Log: Fix the project name Modified: commons/proper/ognl/trunk/src/site/site.xml Modified: commons/proper/ognl/trunk/src/site/site.xml URL: http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/site/site.xml?rev=1165764&r1=1165763&r2=1165764&view=diff == --- commons/proper/ognl/trunk/src/site/site.xml (original) +++ commons/proper/ognl/trunk/src/site/site.xml Tue Sep 6 17:14:39 2011 @@ -24,7 +24,7 @@ - + http://www.apache.org/dist/commons/ognl/RELEASE-NOTES.txt"; />
svn commit: r1165788 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/ native/os/linux/ native/os/solaris/ native/os/unix/ native/shared/ test/org/apache/commons/runtime/
Author: mturk Date: Tue Sep 6 19:07:02 2011 New Revision: 1165788 URL: http://svn.apache.org/viewvc?rev=1165788&view=rev Log: Add Vm.arguments method Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Vm.java commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c commons/sandbox/runtime/trunk/src/main/native/os/unix/arch_opts.h commons/sandbox/runtime/trunk/src/main/native/os/unix/util.c commons/sandbox/runtime/trunk/src/main/native/shared/string.c commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Vm.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Vm.java?rev=1165788&r1=1165787&r2=1165788&view=diff == --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Vm.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Vm.java Tue Sep 6 19:07:02 2011 @@ -41,7 +41,9 @@ public final class Vm public static native int getParentPid(); private static final File exec; -private static native String exe0(); +private static native String exe0(); +private static native String[] arg0() +throws SystemException; static { exec = new File(exe0()); @@ -54,4 +56,14 @@ public final class Vm { return exec; } + +/** + * Returns full path to the current JVM executable. + */ +public static final String[] arguments() +throws SystemException +{ +return arg0(); +} + } Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c?rev=1165788&r1=1165787&r2=1165788&view=diff == --- commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/linux/os.c Tue Sep 6 19:07:02 2011 @@ -16,6 +16,8 @@ #include "acr/jniapi.h" #include "acr/string.h" +#include "arch_opts.h" + #include static int_sys_done = -1; @@ -96,3 +98,19 @@ ACR_JNI_EXPORT(jstring, Vm, exe0)(JNI_ST return CSTR_TO_JSTRING(buf); } } + +ACR_JNI_EXPORT(jobjectArray, Vm, arg0)(JNI_STDARGS) +{ +jobjectArray args = 0; +char *cmda; +size_t clen; + +cmda = AcrFreadAll("/proc/self/cmdline", &clen); +if (cmda == 0) { +ACR_THROW_SYS_ERRNO(); +return 0; +} +args = AcrMszStrToStringArrayA(env, cmda); +AcrFree(cmda); +return args; +} Modified: commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c?rev=1165788&r1=1165787&r2=1165788&view=diff == --- commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c Tue Sep 6 19:07:02 2011 @@ -16,6 +16,7 @@ #include "acr/jniapi.h" #include "acr/string.h" +#include #include #include @@ -105,3 +106,78 @@ ACR_JNI_EXPORT(jstring, Vm, exe0)(JNI_ST return CSTR_TO_JSTRING(buf); } } + +/* + * Read the psinfo_t structure from /proc//psinfo + */ +static int selfpsinfo(psinfo_t *psinfo) +{ +int fd; +int rc; + +if ((fd = open("/proc/self/psinfo", O_RDONLY)) == -1) +return errno; +if (r_read(fd, psinfo, sizeof(psinfo_t)) != sizeof(psinfo_t)) { +r_close(fd); +return ACR_EBADF; +} +r_close(fd); +return 0; +} + +ACR_JNI_EXPORT(jobjectArray, Vm, arg0)(JNI_STDARGS) +{ +jobjectArray args = 0; +psinfo_t pi; +int n, fd, rc; +char **sa; + +if ((rc = selfpsinfo(-1, &pi)) != 0) { +ACR_THROW_SYS_ERROR(rc); +return 0; +} +if (pi.pr_argc == 0) { +/* No arguments ? */ +return 0; +} +if ((fd = open("/proc/self/as", O_RDONLY)) == -1) { +ACR_THROW_SYS_ERRNO(); +return 0; +} +sa = ACR_MALLOC(char *, pi.pr_argc + 1); +if (sa == 0) +goto failed; +if (lseek(fd, pi.pr_argv, SEEK_SET) == -1) { +rc = ACR_GET_OS_ERROR(); +goto failed; +} +if (read(fd, sa, sizeof(char *) * (pi.pr_argc + 1)) < 0) { +rc = ACR_GET_OS_ERROR(); +goto failed; +} +args = AcrNewCoreObjectArray(env, ACR_CC_STRING, pi.pr_argc); +if (args == 0) +goto failed; +for (n = 0; n < pi.pr_argc; n++) { +jstring s; +char pname[8192] = ""; +if (lseek(fd, (off_t) sa[n], SEEK_SET) != -1) { +if (read(fd, pname, sizeof
svn commit: r1165790 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/ main/java/org/apache/commons/math/exception/util/ main/java/org/apache/commons/math/ode/ main/resources/MET
Author: luc Date: Tue Sep 6 19:16:05 2011 New Revision: 1165790 URL: http://svn.apache.org/viewvc?rev=1165790&view=rev Log: Removed last use of MaxEvaluationsExceededException. This exception was now used only in ODE. It has been replaced by MaxCountExceededException, triggered by an Incrementor instance just as what is done in root solvers. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/MaxEvaluationsExceededException.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsMoultonIntegratorTest.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java?rev=1165790&r1=1165789&r2=1165790&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java Tue Sep 6 19:16:05 2011 @@ -149,7 +149,6 @@ public enum LocalizedFormats implements MAP_MODIFIED_WHILE_ITERATING("map has been modified while iterating"), EVALUATIONS("evaluations"), /* keep */ MAX_COUNT_EXCEEDED("maximal count ({0}) exceeded"), /* keep */ -MAX_EVALUATIONS_EXCEEDED("maximal number of evaluations ({0}) exceeded"), MAX_ITERATIONS_EXCEEDED("maximal number of iterations ({0}) exceeded"), MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION("minimal step size ({1,number,0.00E00}) reached, integration needs {0,number,0.00E00}"), MISMATCHED_LOESS_ABSCISSA_ORDINATE_ARRAYS("Loess expects the abscissa and ordinate arrays to be of the same size, but got {0} abscissae and {1} ordinatae"), Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java?rev=1165790&r1=1165789&r2=1165790&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/AbstractIntegrator.java Tue Sep 6 19:16:05 2011 @@ -26,12 +26,11 @@ import java.util.List; import java.util.SortedSet; import java.util.TreeSet; -import org.apache.commons.math.MaxEvaluationsExceededException; import org.apache.commons.math.analysis.solvers.BracketingNthOrderBrentSolver; import org.apache.commons.math.analysis.solvers.UnivariateRealSolver; import org.apache.commons.math.exception.DimensionMismatchException; import org.apache.commons.math.exception.MathIllegalStateException; -import org.apache.commons.math.exception.MathUserException; +import org.apache.commons.math.exception.MaxCountExceededException; import org.apache.commons.math.exception.NumberIsTooSmallException; import org.apache.commons.math.exception.util.LocalizedFormats; import org.apache.commons.math.ode.events.EventHandler; @@ -39,6 +38,7 @@ import org.apache.commons.math.ode.event import org.apache.commons.math.ode.sampling.AbstractStepInterpolator; import org.apache.commons.math.ode.sampling.StepHandler; import org.apache.commons.math.util.FastMath; +import org.apache.commons.math.util.Incrementor; import org.apache.commons.math.util.MathUtils; /** @@ -72,11 +72,8 @@ public abstract class AbstractIntegrator /** Name of the method. */ private final String name; -/** Maximal number of evaluations allowed. */ -private int maxEvaluations; - -/** Number of evaluations already performed. */ -private int evaluations; +/** Counter for number of evaluations. */ +private Incrementor evaluations; /** Differential equations to integrate. */ private transient FirstOrderDifferentialEquations equations; @@ -91,6 +88,7 @@ public abstract class AbstractIntegrator stepSize = Double.NaN; eventsStates = new ArrayList(); statesInitialized = false; +evaluations = new Incrementor(); setMaxEvaluations(-1); resetEvaluations(); } @@ -167,23 +165,23 @@ public abstract class AbstractIntegrator /** {@inheritDoc} */ public void setMaxEvaluations(int maxEvaluations) { -this.maxEvaluations = (maxEvaluat
svn commit: r1165800 - /commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c
Author: mturk Date: Tue Sep 6 19:37:22 2011 New Revision: 1165800 URL: http://svn.apache.org/viewvc?rev=1165800&view=rev Log: Fix solaris Vm.arguments Modified: commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c Modified: commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c?rev=1165800&r1=1165799&r2=1165800&view=diff == --- commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c Tue Sep 6 19:37:22 2011 @@ -15,7 +15,9 @@ */ #include "acr/jniapi.h" +#include "acr/clazz.h" #include "acr/string.h" +#include "arch_opts.h" #include #include #include @@ -129,10 +131,10 @@ ACR_JNI_EXPORT(jobjectArray, Vm, arg0)(J { jobjectArray args = 0; psinfo_t pi; -int n, fd, rc; +int rc; char **sa; -if ((rc = selfpsinfo(-1, &pi)) != 0) { +if ((rc = selfpsinfo(&pi)) != 0) { ACR_THROW_SYS_ERROR(rc); return 0; } @@ -140,44 +142,17 @@ ACR_JNI_EXPORT(jobjectArray, Vm, arg0)(J /* No arguments ? */ return 0; } -if ((fd = open("/proc/self/as", O_RDONLY)) == -1) { -ACR_THROW_SYS_ERRNO(); -return 0; -} -sa = ACR_MALLOC(char *, pi.pr_argc + 1); -if (sa == 0) -goto failed; -if (lseek(fd, pi.pr_argv, SEEK_SET) == -1) { -rc = ACR_GET_OS_ERROR(); -goto failed; -} -if (read(fd, sa, sizeof(char *) * (pi.pr_argc + 1)) < 0) { -rc = ACR_GET_OS_ERROR(); -goto failed; -} +sa = (char **)pi.pr_argv; args = AcrNewCoreObjectArray(env, ACR_CC_STRING, pi.pr_argc); -if (args == 0) -goto failed; -for (n = 0; n < pi.pr_argc; n++) { -jstring s; -char pname[8192] = ""; -if (lseek(fd, (off_t) sa[n], SEEK_SET) != -1) { -if (read(fd, pname, sizeof(pname)) == -1) -pname[0] = '\0'; -} -s = AcrNewJavaStringA(pname); -if (s != 0) { +if (args != 0) { +int n; +for (n = 0; n < pi.pr_argc; n++) { +jstring s = AcrNewJavaStringA(env, sa[n]); +if (s == 0) +break; (*env)->SetObjectArrayElement(env, args, n, s); (*env)->DeleteLocalRef(env, s); } } -close(fd); -AcrFree(args); return args; -failed: -close(fd); -AcrFree(sa); -if (rc != 0) -ACR_THROW_SYS_ERROR(rc); -return 0; }
svn commit: r1165808 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform: FastCosineTransformer.java FastFourierTransformer.java FastHadamardTransformer.java FastSineTransf
Author: luc Date: Tue Sep 6 19:59:47 2011 New Revision: 1165808 URL: http://svn.apache.org/viewvc?rev=1165808&view=rev Log: removed MathUserException from transform package Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=1165808&r1=1165807&r2=1165808&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java Tue Sep 6 19:59:47 2011 @@ -16,7 +16,6 @@ */ package org.apache.commons.math.transform; -import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.MathRuntimeException; import org.apache.commons.math.analysis.UnivariateRealFunction; import org.apache.commons.math.complex.Complex; @@ -76,13 +75,11 @@ public class FastCosineTransformer imple * @param max the upper bound for the interval * @param n the number of sample points * @return the real transformed array - * @throws MathUserException if function cannot be evaluated - * at some point * @throws IllegalArgumentException if any parameters are invalid */ public double[] transform(UnivariateRealFunction f, double min, double max, int n) -throws MathUserException, IllegalArgumentException { +throws IllegalArgumentException { double data[] = FastFourierTransformer.sample(f, min, max, n); return fct(data); } @@ -117,13 +114,11 @@ public class FastCosineTransformer imple * @param max the upper bound for the interval * @param n the number of sample points * @return the real transformed array - * @throws MathUserException if function cannot be evaluated - * at some point * @throws IllegalArgumentException if any parameters are invalid */ public double[] transform2(UnivariateRealFunction f, double min, double max, int n) -throws MathUserException, IllegalArgumentException { +throws IllegalArgumentException { double data[] = FastFourierTransformer.sample(f, min, max, n); double scaling_coefficient = FastMath.sqrt(2.0 / (n-1)); @@ -159,12 +154,11 @@ public class FastCosineTransformer imple * @param max the upper bound for the interval * @param n the number of sample points * @return the real inversely transformed array - * @throws MathUserException if function cannot be evaluated at some point * @throws IllegalArgumentException if any parameters are invalid */ public double[] inversetransform(UnivariateRealFunction f, double min, double max, int n) -throws MathUserException, IllegalArgumentException { +throws IllegalArgumentException { double data[] = FastFourierTransformer.sample(f, min, max, n); double scaling_coefficient = 2.0 / (n - 1); @@ -198,12 +192,11 @@ public class FastCosineTransformer imple * @param max the upper bound for the interval * @param n the number of sample points * @return the real inversely transformed array - * @throws MathUserException if function cannot be evaluated at some point * @throws IllegalArgumentException if any parameters are invalid */ public double[] inversetransform2(UnivariateRealFunction f, double min, double max, int n) -throws MathUserException, IllegalArgumentException { +throws IllegalArgumentException { return transform2(f, min, max, n); } Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java?rev=1165808&r1=1165807&r2=1165808&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java (original) +++ commons/proper/math/trunk/src/
svn commit: r1165809 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/ test/java/org/apache/commons/math/analysis/ test/java/org/apache/commons/math/analysis/integration
Author: luc Date: Tue Sep 6 20:00:37 2011 New Revision: 1165809 URL: http://svn.apache.org/viewvc?rev=1165809&view=rev Log: removed MathUserException from analysis package Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/TrivariateRealFunction.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateMatrixFunction.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateRealFunction.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/SumSincFunction.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java?rev=1165809&r1=1165808&r2=1165809&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java Tue Sep 6 20:00:37 2011 @@ -17,8 +17,6 @@ package org.apache.commons.math.analysis; -import org.apache.commons.math.exception.MathUserException; - /** * An interface representing a bivariate real function. * @@ -32,9 +30,7 @@ public interface BivariateRealFunction { * @param x Abscissa for which the function value should be computed. * @param y Ordinate for which the function value should be computed. * @return the value. - * @throws MathUserException if the function evaluation fails. */ -double value(double x, double y) -throws MathUserException; +double value(double x, double y); } Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java?rev=1165809&r1=1165808&r2=1165809&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java Tue Sep 6 20:00:37 2011 @@ -17,9 +17,6 @@ package org.apache.commons.math.analysis; -import org.apache.commons.math.exception.MathUserException; - - /** * An interface representing a multivariate matrix function. * @version $Id$ @@ -31,10 +28,9 @@ public interface MultivariateMatrixFunct * Compute the value for the function at the given point. * @param point point at which the function must be evaluated * @return function value for the given point - * @exception MathUserException if the function evaluation fails * @exception IllegalArgumentException if points dimension is wrong */ double[][] value(double[] point) -throws MathUserException, IllegalArgumentException; +throws IllegalArgumentException; } Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java?rev=1165809&r1=1165808&r2=1165809&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java Tue Sep 6 20:00:37 2011 @@ -30,8 +30,6 @@ public interface MultivariateRealFunctio * * @param point Point at which the function must be evaluated. * @return the function value for the given point. - * @throws org.apache.commons.math.exception.MathUserException if - * the function evaluation fails. * @throws org.apache.commons.math.exception.Dimension
svn commit: r1165810 - in /commons/proper/math/trunk/src/site/xdoc/userguide: analysis.xml index.xml
Author: luc Date: Tue Sep 6 20:01:07 2011 New Revision: 1165810 URL: http://svn.apache.org/viewvc?rev=1165810&view=rev Log: added documentation about error handling in user functions in the userguide Modified: commons/proper/math/trunk/src/site/xdoc/userguide/analysis.xml commons/proper/math/trunk/src/site/xdoc/userguide/index.xml Modified: commons/proper/math/trunk/src/site/xdoc/userguide/analysis.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/userguide/analysis.xml?rev=1165810&r1=1165809&r2=1165810&view=diff == --- commons/proper/math/trunk/src/site/xdoc/userguide/analysis.xml (original) +++ commons/proper/math/trunk/src/site/xdoc/userguide/analysis.xml Tue Sep 6 20:01:07 2011 @@ -44,7 +44,54 @@ Possible future additions may include numerical differentiation. - + + + For user-defined functions, when the method encounters an error + during evaluation, users must use their own unchecked exceptions. + The following example shows the recommended way to do that, using root + solving as the example (the same construct should be used for ODE + integrators or for optimizations). + +private static class LocalException extends RuntimeException { + + // the x value that caused the problem + private final double x; + + public LocalException(double x) { + this.x = x; + } + + public double getX() { + return x; + } + + } + + private static class MyFunction implements UnivariateRealFunction { + public double value(double x) { + double y = hugeFormula(x); + if (somethingBadHappens) { + throw new LocalException(x); + } + return y; + } + } + + public void compute() { + try { + solver.solve(maxEval, new MyFunction(a, b, c), min, max); + } catch (LocalException le) { + // retrieve the x value + } + } + + +As shown in this example the exception is really something local to user code +and there is a guarantee Apache Commons Math will not mess with it. +The user is safe. + + + UnivariateRealSolver, @@ -327,7 +374,7 @@ double c = UnivariateRealSolverUtils.for - + A UnivariateRealInterpolator is used to find a univariate real-valued @@ -445,7 +492,7 @@ System.out println("f(" + interpolationX tricubic interpolating function. - + A UnivariateRealIntegrator provides the means to numerically integrate @@ -463,7 +510,7 @@ System.out println("f(" + interpolationX - + The org.apache.commons.math.analysis.polynomials package provides real Modified: commons/proper/math/trunk/src/site/xdoc/userguide/index.xml URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/userguide/index.xml?rev=1165810&r1=1165809&r2=1165810&view=diff == --- commons/proper/math/trunk/src/site/xdoc/userguide/index.xml (original) +++ commons/proper/math/trunk/src/site/xdoc/userguide/index.xml Tue Sep 6 20:01:07 2011 @@ -70,10 +70,11 @@ 4. Numerical Analysis 4.1 Overview -4.2 Root-finding -4.3 Interpolation -4.4 Integration -4.5 Polynomials +4.2 Error handling +4.3 Root-finding +4.4 Interpolation +4.5 Integration +4.6 Polynomials 5. Special Functions
svn commit: r1165821 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/UnivariateDfpFunction.java
Author: luc Date: Tue Sep 6 20:18:42 2011 New Revision: 1165821 URL: http://svn.apache.org/viewvc?rev=1165821&view=rev Log: removed MathUserException from DFP package Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/UnivariateDfpFunction.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/UnivariateDfpFunction.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/UnivariateDfpFunction.java?rev=1165821&r1=1165820&r2=1165821&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/UnivariateDfpFunction.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/UnivariateDfpFunction.java Tue Sep 6 20:18:42 2011 @@ -16,8 +16,6 @@ */ package org.apache.commons.math.dfp; -import org.apache.commons.math.exception.MathUserException; - /** * An interface representing a univariate {@link Dfp} function. * @@ -36,16 +34,7 @@ public interface UnivariateDfpFunction { * majority of cases where Commons-Math throws IllegalArgumentException, * it is the result of argument checking of actual parameters immediately * passed to a method. - * @throws MathUserException when the method may encounter errors during evaluation. - * This should be thrown only in circumstances where, at the level of the - * activated function, IllegalArgumentException is not appropriate and it - * should indicate that while formal preconditions of the method have not - * been violated, an irrecoverable error has occurred evaluating a - * function at some (usually lower) level of the call stack. - * Convergence failures, runtime exceptions (even IllegalArgumentException) - * in user code or lower level methods can cause (and should be wrapped in) - * a MathUserException. */ -Dfp value(Dfp x) throws MathUserException; +Dfp value(Dfp x); }
svn commit: r1165822 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/linear/ test/java/org/apache/commons/math/linear/
Author: luc Date: Tue Sep 6 20:19:37 2011 New Revision: 1165822 URL: http://svn.apache.org/viewvc?rev=1165822&view=rev Log: removed MathUserException from linear package Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixChangingVisitor.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVector.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/QRDecompositionImplTest.java commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/QRSolverTest.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java?rev=1165822&r1=1165821&r2=1165822&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java Tue Sep 6 20:19:37 2011 @@ -481,8 +481,6 @@ public interface FieldMatrix * @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int) @@ -505,8 +503,6 @@ public interface FieldMatrix * @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int) @@ -533,8 +529,6 @@ public interface FieldMatrix * @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) @@ -615,8 +605,6 @@ public interface FieldMatrix * @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) @@ -643,8 +631,6 @@ public interface FieldMatrixThe fastest walking order depends on the exact matrix class. It may be * different from traditional row or column orders. * @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) @@ -723,8 +705,6 @@ public interface FieldMatrixThe fastest walking order depends on the exact matrix class. It may be * different from traditional row or column orders. * @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) @@ -750,8 +730,6 @@ public interface FieldMatrixhttp://svn.apache.org/viewvc/c
svn commit: r1165830 - in /commons/proper/email/trunk/src: changes/ java/org/apache/commons/mail/ site/xdoc/ test/org/apache/commons/mail/ test/org/apache/commons/mail/settings/
Author: sgoeschl Date: Tue Sep 6 20:34:43 2011 New Revision: 1165830 URL: http://svn.apache.org/viewvc?rev=1165830&view=rev Log: [EMAIL-105][EMAIL-106] Clarified the meaning of setTLS() which actually sends a "STARTTLS" command from the client to the SMTP server. Please note that some "protected" variables were renamed which could break existing code. Modified: commons/proper/email/trunk/src/changes/changes.xml commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java commons/proper/email/trunk/src/java/org/apache/commons/mail/EmailConstants.java commons/proper/email/trunk/src/site/xdoc/userguide.xml commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailLiveTest.java commons/proper/email/trunk/src/test/org/apache/commons/mail/settings/EmailConfiguration.java Modified: commons/proper/email/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/changes/changes.xml?rev=1165830&r1=1165829&r2=1165830&view=diff == --- commons/proper/email/trunk/src/changes/changes.xml (original) +++ commons/proper/email/trunk/src/changes/changes.xml Tue Sep 6 20:34:43 2011 @@ -23,6 +23,14 @@ + + STARTTLS can be used even without authenticator. + + +Clarified the meaning of setTLS() which actually sends a "STARTTLS" command from the +client to the SMTP server. Please note that some "protected" variables were renamed +which could break existing code. + Fixed HtmlEmail embed toLowerCase bug with Turkish locale. Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java?rev=1165830&r1=1165829&r2=1165830&view=diff == --- commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java (original) +++ commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java Tue Sep 6 20:34:43 2011 @@ -157,11 +157,14 @@ public abstract class Email implements E /** the password to log into the pop3 server */ protected String popPassword; -/** does server require TLS encryption for authentication */ -protected boolean tls; +/** does client want STARTTLS encryption */ +protected boolean startTlsEnabled; + +/** does client require STARTTLS encryption */ +protected boolean startTlsRequired; -/** does the current transport use SSL encryption? */ -protected boolean ssl; +/** does the current transport use SSL/TLS encryption upon connection? */ +protected boolean sslOnConnect; /** socket I/O timeout value in milliseconds */ protected int socketTimeout = SOCKET_TIMEOUT_MS; @@ -196,7 +199,7 @@ public abstract class Email implements E * @param password password for the SMTP server * @return An Email. * @see DefaultAuthenticator - * @see #setAuthenticator + * @see #setAuthenticator(Authenticator) * @since 1.0 */ public Email setAuthentication(String userName, String password) @@ -336,16 +339,42 @@ public abstract class Email implements E } /** - * Set or disable the TLS encryption + * Set or disable the STARTTLS encryption. Please see EMAIL-105 + * for the reasons of deprecation. * - * @param withTLS true if TLS needed, false otherwise + * @deprecated since 1.3 + * @param startTlsEnabled true if STARTTLS requested, false otherwise * @return An Email. * @since 1.1 */ -public Email setTLS(boolean withTLS) +public Email setTLS(boolean startTlsEnabled) +{ +return setStartTLSEnabled(startTlsEnabled); +} + +/** + * Set or disable the STARTTLS encryption. + * + * @param startTlsEnabled true if STARTTLS requested, false otherwise + * @return An Email. + */ +public Email setStartTLSEnabled(boolean startTlsEnabled) { checkSessionAlreadyInitialized(); -this.tls = withTLS; +this.startTlsEnabled = startTlsEnabled; +return this; +} + +/** + * Set or disable the STARTTLS encryption. + * + * @param startTlsRequired true if STARTTLS requested, false otherwise + * @return An Email. + */ +public Email setStartTLSRequired(boolean startTlsRequired) +{ +checkSessionAlreadyInitialized(); +this.startTlsRequired = startTlsRequired; return this; } @@ -481,14 +510,25 @@ public abstract class Email implements E properties.setProperty(MAIL_HOST, this.hostName); properties.setProperty(MAIL_DEBUG, String.valueOf(this.debug)); +properties.setProperty(MAIL_TRANSPORT_STARTTLS_ENABLE, startTlsEnabled ? "true" : "false"); +pr
svn commit: r1165846 [1/2] - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java
Author: sebb Date: Tue Sep 6 21:06:58 2011 New Revision: 1165846 URL: http://svn.apache.org/viewvc?rev=1165846&view=rev Log: MATH 650 FastMath has static code which slows the first access to FastMath First pass - convert runtime init to preset initialisers Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java
svn commit: r1165861 - in /commons/proper/email/trunk: ./ src/changes/ src/resources/ src/resources/META-INF/ src/test/org/apache/commons/mail/
Author: sgoeschl Date: Tue Sep 6 21:26:21 2011 New Revision: 1165861 URL: http://svn.apache.org/viewvc?rev=1165861&view=rev Log: [EMAIL-107] Added mime.types to META-INF - thanks to Claus Polanka, Michael Jakl and the first Austrian Hackergarden. Added: commons/proper/email/trunk/src/resources/ commons/proper/email/trunk/src/resources/META-INF/ commons/proper/email/trunk/src/resources/META-INF/mime.types Modified: commons/proper/email/trunk/pom.xml commons/proper/email/trunk/src/changes/changes.xml commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java Modified: commons/proper/email/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/pom.xml?rev=1165861&r1=1165860&r2=1165861&view=diff == --- commons/proper/email/trunk/pom.xml (original) +++ commons/proper/email/trunk/pom.xml Tue Sep 6 21:26:21 2011 @@ -258,6 +258,11 @@ src/java + + +src/resources + + src/test Modified: commons/proper/email/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/changes/changes.xml?rev=1165861&r1=1165860&r2=1165861&view=diff == --- commons/proper/email/trunk/src/changes/changes.xml (original) +++ commons/proper/email/trunk/src/changes/changes.xml Tue Sep 6 21:26:21 2011 @@ -23,6 +23,10 @@ + + Added mime.types to META-INF - the definition is actually found in activation.jar + but did not work. + STARTTLS can be used even without authenticator. Added: commons/proper/email/trunk/src/resources/META-INF/mime.types URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/resources/META-INF/mime.types?rev=1165861&view=auto == --- commons/proper/email/trunk/src/resources/META-INF/mime.types (added) +++ commons/proper/email/trunk/src/resources/META-INF/mime.types Tue Sep 6 21:26:21 2011 @@ -0,0 +1 @@ +image/png png PNG Modified: commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java?rev=1165861&r1=1165860&r2=1165861&view=diff == --- commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java (original) +++ commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java Tue Sep 6 21:26:21 2011 @@ -16,6 +16,7 @@ */ package org.apache.commons.mail; +import java.io.File; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; @@ -27,14 +28,12 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; - import javax.mail.Authenticator; import javax.mail.Session; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.mail.internet.ParseException; - import org.apache.commons.mail.mocks.MockEmailConcrete; /** @@ -355,9 +354,9 @@ public class EmailTest extends BaseEmail "joe@apache.org", "joe@apache.org")); arrExpected.add( -new InternetAddress( -"someone_h...@work-address.com.au", -"someone_h...@work-address.com.au")); +new InternetAddress( +"someone_h...@work-address.com.au", +"someone_h...@work-address.com.au")); for (int i = 0; i < testEmails.length; i++) { @@ -1320,18 +1319,18 @@ public class EmailTest extends BaseEmail testInetEmailValid.add(new InternetAddress("m...@home.com", "Name1")); testInetEmailValid.add( -new InternetAddress( -"joe@apache.org", -"joe@apache.org")); +new InternetAddress( +"joe@apache.org", +"joe@apache.org")); testInetEmailValid.add( -new InternetAddress( -"someone_h...@work-address.com.au", -"someone_h...@work-address.com.au")); +new InternetAddress( +"someone_h...@work-address.com.au", +"someone_h...@work-address.com.au")); this.email.setBcc(testInetEmailValid); assertEquals( -testInetEmailValid.size(), -this.email.getBccAddresses().size()); +testInetEmailVal
svn commit: r1165862 - in /commons/proper/email/trunk/src/test/images: contentTypeTest.gif contentTypeTest.jpg contentTypeTest.png
Author: sgoeschl Date: Tue Sep 6 21:26:52 2011 New Revision: 1165862 URL: http://svn.apache.org/viewvc?rev=1165862&view=rev Log: [EMAIL-107] Added mime.types to META-INF - thanks to Claus Polanka, Michael Jakl and the first Austrian Hackergarden. Added: commons/proper/email/trunk/src/test/images/contentTypeTest.gif (with props) commons/proper/email/trunk/src/test/images/contentTypeTest.jpg (with props) commons/proper/email/trunk/src/test/images/contentTypeTest.png (with props) Added: commons/proper/email/trunk/src/test/images/contentTypeTest.gif URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/images/contentTypeTest.gif?rev=1165862&view=auto == Binary file - no diff available. Propchange: commons/proper/email/trunk/src/test/images/contentTypeTest.gif -- svn:mime-type = application/octet-stream Added: commons/proper/email/trunk/src/test/images/contentTypeTest.jpg URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/images/contentTypeTest.jpg?rev=1165862&view=auto == Binary file - no diff available. Propchange: commons/proper/email/trunk/src/test/images/contentTypeTest.jpg -- svn:mime-type = application/octet-stream Added: commons/proper/email/trunk/src/test/images/contentTypeTest.png URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/images/contentTypeTest.png?rev=1165862&view=auto == Binary file - no diff available. Propchange: commons/proper/email/trunk/src/test/images/contentTypeTest.png -- svn:mime-type = application/octet-stream
svn commit: r1165903 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java
Author: sebb Date: Tue Sep 6 22:17:21 2011 New Revision: 1165903 URL: http://svn.apache.org/viewvc?rev=1165903&view=rev Log: Document some magic numbers; trailing spaces; other doc tweaks Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java?rev=1165903&r1=1165902&r2=1165903&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java Tue Sep 6 22:17:21 2011 @@ -3091,10 +3091,12 @@ public class FastMath { Double.NaN, }; -private static final int EXP_FRAC_TABLE_LEN = 1025; +private static final int TWO_POWER_10 = 1024; +private static final int EXP_FRAC_TABLE_LEN = TWO_POWER_10 + 1; // 0, 1/1024, ... 1024/1024 /** Exponential over the range of 0 - 1 in increments of 2^-10 * exp(x/1024) = expFracTableA[x] + expFracTableB[x]. + * 1024 = 2^10 */ private static final double EXP_FRAC_TABLE_A[] = { @@ -5181,11 +5183,11 @@ public class FastMath { +2.0922789888E13d, +3.55687428096E14d, +6.402373705728E15d, -+1.21645100408832E17d, ++1.21645100408832E17d, }; -private static final int LN_MANT_LEN = 1024; +private static final int LN_MANT_LEN = 1024; // MAGIC NUMBER /** Extended precision logarithm table over the range 1 - 2 in increments of 2^-10. */ private static final double LN_MANT[][] = { @@ -6265,7 +6267,7 @@ public class FastMath { {-0.16624879837036133, -2.6033824355191673E-8} }; -private static final int SINE_TABLE_LEN = 14; +private static final int SINE_TABLE_LEN = 14; // MAGIC NUMBER /** Sine table (high bits). */ private static final double SINE_TABLE_A[] = @@ -6472,7 +6474,7 @@ public class FastMath { // Populate expFracTable for (i = 0; i < EXP_FRAC_TABLE_A.length; i++) { -slowexp(i/1024.0, tmp); +slowexp(i/1024.0, tmp); // TWO_POWER_10 EXP_FRAC_TABLE_A[i] = tmp[0]; EXP_FRAC_TABLE_B[i] = tmp[1]; } @@ -6500,7 +6502,7 @@ public class FastMath { printarray("COSINE_TABLE_A", SINE_TABLE_LEN, COSINE_TABLE_A); printarray("COSINE_TABLE_B", SINE_TABLE_LEN, COSINE_TABLE_B); printarray("TANGENT_TABLE_A", SINE_TABLE_LEN, TANGENT_TABLE_A); -printarray("TANGENT_TABLE_B", SINE_TABLE_LEN, TANGENT_TABLE_B); +printarray("TANGENT_TABLE_B", SINE_TABLE_LEN, TANGENT_TABLE_B); } private static void printarray(String string, int expectedLen, double[][] array2d) { @@ -6578,6 +6580,11 @@ public class FastMath { return x; } + // cosh[z] = (exp(z) + exp(-z))/2 + + // for numbers with magnitude 20 or so, + // exp(-z) can be ignored in comparison with exp(z) + if (x > 20.0) { return exp(x)/2.0; } @@ -6633,6 +6640,11 @@ public class FastMath { return x; } + // sinh[z] = (exp(z) - exp(-z) / 2 + + // for values of z larger than about 20, + // exp(-z) can be ignored in comparison with exp(z) + if (x > 20.0) { return exp(x)/2.0; } @@ -6744,6 +6756,12 @@ public class FastMath { return x; } + // tanh[z] = sinh[z] / cosh[z] + // = (exp(z) - exp(-z)) / (exp(z) + exp(-z)) + // = (exp(2x) - 1) / (exp(2x) + 1) + + // for magnitude > 20, sinh[z] == cosh[z] in double precision + if (x > 20.0) { return 1.0; } @@ -7283,7 +7301,7 @@ public class FastMath { split(x, xs); ys[0] = ys[1] = 0.0; -for (int i = 19; i >= 0; i--) { +for (int i = FACT_LEN-1; i >= 0; i--) { splitMult(xs, ys, as); ys[0] = as[0]; ys[1] = as[1]; @@ -7329,7 +7347,7 @@ public class FastMath { final double c = a[0] + a[1]; final double d = -(c - a[0] - a[1]); -if (c < 8e298 && c > -8e298) { +if (c < 8e298 && c > -8e298) { // MAGIC NUMBER double z = c * HEX_4000; a[0] = (c + z) - z; a[1] = c - a[0] + d;
svn commit: r1165929 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java
Author: sebb Date: Tue Sep 6 23:33:54 2011 New Revision: 1165929 URL: http://svn.apache.org/viewvc?rev=1165929&view=rev Log: More docn of algorithms and magic numbers Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java?rev=1165929&r1=1165928&r2=1165929&view=diff == --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java Tue Sep 6 23:33:54 2011 @@ -5161,7 +5161,7 @@ public class FastMath { private static final int FACT_LEN = 20; -/** Factorial table, for Taylor series expansions. */ +/** Factorial table, for Taylor series expansions. 0!, 1!, 2!, ... 19! */ private static final double FACT[] = new double[] { +1.0d, @@ -6267,7 +6267,8 @@ public class FastMath { {-0.16624879837036133, -2.6033824355191673E-8} }; -private static final int SINE_TABLE_LEN = 14; // MAGIC NUMBER +/** Sine, Cosine, Tangent tables are for 0, 1/8, 2/8, ... 13/8 = PI/2 approx. */ +private static final int SINE_TABLE_LEN = 14; /** Sine table (high bits). */ private static final double SINE_TABLE_A[] = @@ -8069,9 +8070,11 @@ public class FastMath { } /** - * For x between 0 and pi/4 compute sine. + * For x between 0 and pi/4 compute sine using Taylor expansion: + * sin(x) = x - x^3/3! + x^5/5! - x^7/7! ... * @param x number from which sine is requested * @param result placeholder where to put the result in extended precision + * (may be null) * @return sin(x) */ private static double slowSin(final double x, final double result[]) { @@ -8082,18 +8085,18 @@ public class FastMath { split(x, xs); ys[0] = ys[1] = 0.0; -for (int i = 19; i >= 0; i--) { +for (int i = FACT_LEN-1; i >= 0; i--) { splitMult(xs, ys, as); ys[0] = as[0]; ys[1] = as[1]; -if ( (i & 1) == 0) { +if ( (i & 1) == 0) { // Ignore even numbers continue; } split(FACT[i], as); splitReciprocal(as, facts); -if ( (i & 2) != 0 ) { +if ( (i & 2) != 0 ) { // alternate terms are negative facts[0] = -facts[0]; facts[1] = -facts[1]; } @@ -8111,9 +8114,11 @@ public class FastMath { } /** - * For x between 0 and pi/4 compute cosine + * For x between 0 and pi/4 compute cosine using Talor series + * cos(x) = 1 - x^2/2! + x^4/4! ... * @param x number from which cosine is requested * @param result placeholder where to put the result in extended precision + * (may be null) * @return cos(x) */ private static double slowCos(final double x, final double result[]) { @@ -8125,18 +8130,18 @@ public class FastMath { split(x, xs); ys[0] = ys[1] = 0.0; -for (int i = 19; i >= 0; i--) { +for (int i = FACT_LEN-1; i >= 0; i--) { splitMult(xs, ys, as); ys[0] = as[0]; ys[1] = as[1]; -if ( (i & 1) != 0) { +if ( (i & 1) != 0) { // skip odd entries continue; } split(FACT[i], as); splitReciprocal(as, facts); -if ( (i & 2) != 0 ) { +if ( (i & 2) != 0 ) { // alternate terms are negative facts[0] = -facts[0]; facts[1] = -facts[1]; } @@ -8172,7 +8177,7 @@ public class FastMath { } /* Use angle addition formula to complete table to 13/8, just beyond pi/2 */ -for (int i = 7; i < 14; i++) { +for (int i = 7; i < SINE_TABLE_LEN; i++) { double xs[] = new double[2]; double ys[] = new double[2]; double as[] = new double[2]; @@ -8228,7 +8233,7 @@ public class FastMath { } /* Compute tangent = sine/cosine */ -for (int i = 0; i < 14; i++) { +for (int i = 0; i < SINE_TABLE_LEN; i++) { double xs[] = new double[2]; double ys[] = new double[2]; double as[] = new double[2];
svn commit: r1165967 - in /commons/proper/io/trunk: checkstyle.xml pom.xml
Author: ggregory Date: Wed Sep 7 02:42:18 2011 New Revision: 1165967 URL: http://svn.apache.org/viewvc?rev=1165967&view=rev Log: Update plugins: cobertura-maven-plugin 2.5.1 from 2.4 maven-checkstyle-plugin 2.7 from 2.6 findbugs-maven-plugin 2.3.2 from 2.3.1 Modified: commons/proper/io/trunk/checkstyle.xml commons/proper/io/trunk/pom.xml Modified: commons/proper/io/trunk/checkstyle.xml URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/checkstyle.xml?rev=1165967&r1=1165966&r2=1165967&view=diff == --- commons/proper/io/trunk/checkstyle.xml (original) +++ commons/proper/io/trunk/checkstyle.xml Wed Sep 7 02:42:18 2011 @@ -31,6 +31,7 @@ limitations under the License. + Modified: commons/proper/io/trunk/pom.xml URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/pom.xml?rev=1165967&r1=1165966&r2=1165967&view=diff == --- commons/proper/io/trunk/pom.xml (original) +++ commons/proper/io/trunk/pom.xml Wed Sep 7 02:42:18 2011 @@ -258,12 +258,12 @@ org.codehaus.mojo cobertura-maven-plugin -2.4 +2.5.1 org.apache.maven.plugins maven-checkstyle-plugin -2.6 +2.7 ${basedir}/checkstyle.xml false @@ -281,7 +281,7 @@ org.codehaus.mojo findbugs-maven-plugin -2.3.1 +2.3.2 Normal Default
svn commit: r1165968 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java
Author: ggregory Date: Wed Sep 7 02:45:19 2011 New Revision: 1165968 URL: http://svn.apache.org/viewvc?rev=1165968&view=rev Log: Test bullet-proofing (FindBugs) Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java?rev=1165968&r1=1165967&r2=1165968&view=diff == --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileSystemUtilsTestCase.java Wed Sep 7 02:45:19 2011 @@ -25,6 +25,8 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.util.Locale; +import junit.framework.Assert; + import org.apache.commons.io.testtools.FileBasedTestCase; /** @@ -69,6 +71,7 @@ public class FileSystemUtilsTestCase ext try { r = new BufferedReader(new InputStreamReader(proc.getInputStream())); String line = r.readLine(); +Assert.assertNotNull("Unexpected null line", line); if (line.indexOf("512") >= 0) { kilobyteBlock = false; }
svn commit: r1165970 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
Author: ggregory Date: Wed Sep 7 02:47:43 2011 New Revision: 1165970 URL: http://svn.apache.org/viewvc?rev=1165970&view=rev Log: Remove assert because the iterator always deals Strings. Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java?rev=1165970&r1=1165969&r2=1165970&view=diff == --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java Wed Sep 7 02:47:43 2011 @@ -174,7 +174,6 @@ public class LineIteratorTestCase extend try { int count = 0; while (iterator.hasNext()) { -assertTrue(iterator.next() instanceof String); count++; } assertEquals(3, count);
svn commit: r1165983 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
Author: ggregory Date: Wed Sep 7 03:03:06 2011 New Revision: 1165983 URL: http://svn.apache.org/viewvc?rev=1165983&view=rev Log: Iterator always deals Strings (FindBugs). Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java?rev=1165983&r1=1165982&r2=1165983&view=diff == --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java Wed Sep 7 03:03:06 2011 @@ -174,6 +174,7 @@ public class LineIteratorTestCase extend try { int count = 0; while (iterator.hasNext()) { +assertNotNull(iterator.next()); count++; } assertEquals(3, count);
svn commit: r1165984 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java
Author: ggregory Date: Wed Sep 7 03:03:42 2011 New Revision: 1165984 URL: http://svn.apache.org/viewvc?rev=1165984&view=rev Log: Iterator always deals Strings (FindBugs). Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java?rev=1165984&r1=1165983&r2=1165984&view=diff == --- commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java (original) +++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java Wed Sep 7 03:03:42 2011 @@ -291,7 +291,7 @@ public class LineIteratorTestCase extend LineIterator iterator = FileUtils.lineIterator(testFile, encoding); try { // get -assertTrue("Line expected", iterator.next() instanceof String); +assertNotNull("Line expected", iterator.next()); assertTrue("More expected", iterator.hasNext()); // close