svn commit: r1165505 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java

2011-09-06 Thread celestin
Author: celestin
Date: Tue Sep  6 06:17:38 2011
New Revision: 1165505

URL: http://svn.apache.org/viewvc?rev=1165505view=rev
Log:
Removed double[] solve(double[]) from EigenDecompositionImpl.Solver

Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java?rev=1165505r1=1165504r2=1165505view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
 Tue Sep  6 06:17:38 2011
@@ -279,43 +279,6 @@ public class EigenDecompositionImpl impl
  * @throws DimensionMismatchException if the matrices dimensions do 
not match.
  * @throws SingularMatrixException if the decomposed matrix is 
singular.
  */
-public double[] solve(final double[] b) {
-
-if (!isNonSingular()) {
-throw new SingularMatrixException();
-}
-
-final int m = realEigenvalues.length;
-if (b.length != m) {
-throw new DimensionMismatchException(b.length, m);
-}
-
-final double[] bp = new double[m];
-final ArrayRealVector bVector = new ArrayRealVector(b, false);
-for (int i = 0; i  m; ++i) {
-final ArrayRealVector v = eigenvectors[i];
-final double[] vData = v.getDataRef();
-final double s = v.dotProduct(bVector) / realEigenvalues[i];
-for (int j = 0; j  m; ++j) {
-bp[j] += s * vData[j];
-}
-}
-
-return bp;
-
-}
-
-/**
- * Solve the linear equation A times; X = B for symmetric matrices A.
- * p
- * This method only find exact linear solutions, i.e. solutions for
- * which ||A times; X - B|| is exactly 0.
- * /p
- * @param b Right-hand side of the equation A times; X = B
- * @return a Vector X that minimizes the two norm of A times; X - B
- * @throws DimensionMismatchException if the matrices dimensions do 
not match.
- * @throws SingularMatrixException if the decomposed matrix is 
singular.
- */
 public RealVector solve(final RealVector b) {
 if (!isNonSingular()) {
 throw new SingularMatrixException();




svn commit: r1165507 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/linear/QRDecompositionImpl.java test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java

2011-09-06 Thread celestin
Author: celestin
Date: Tue Sep  6 06:23:06 2011
New Revision: 1165507

URL: http://svn.apache.org/viewvc?rev=1165507view=rev
Log:
Removed double[] solve(double[]) from QRDecompositionImpl.Solver
Had to implement toArray() in ArrayRealVectorTest to make QRSolverTest pass.

Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java

commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java?rev=1165507r1=1165506r2=1165507view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java
 Tue Sep  6 06:23:06 2011
@@ -275,18 +275,18 @@ public class QRDecompositionImpl impleme
 }
 
 /** {@inheritDoc} */
-public double[] solve(double[] b) {
+public RealVector solve(RealVector b) {
 final int n = qrt.length;
 final int m = qrt[0].length;
-if (b.length != m) {
-throw new DimensionMismatchException(b.length, m);
+if (b.getDimension() != m) {
+throw new DimensionMismatchException(b.getDimension(), m);
 }
 if (!isNonSingular()) {
 throw new SingularMatrixException();
 }
 
 final double[] x = new double[n];
-final double[] y = b.clone();
+final double[] y = b.toArray();
 
 // apply Householder transforms to solve Q.y = b
 for (int minor = 0; minor  FastMath.min(m, n); minor++) {
@@ -306,7 +306,7 @@ public class QRDecompositionImpl impleme
 // solve triangular system R.x = y
 for (int row = rDiag.length - 1; row = 0; --row) {
 y[row] /= rDiag[row];
-final double yRow   = y[row];
+final double yRow = y[row];
 final double[] qrtRow = qrt[row];
 x[row] = yRow;
 for (int i = 0; i  row; i++) {
@@ -314,27 +314,7 @@ public class QRDecompositionImpl impleme
 }
 }
 
-return x;
-}
-
-/** {@inheritDoc} */
-public RealVector solve(RealVector b) {
-try {
-return solve((ArrayRealVector) b);
-} catch (ClassCastException cce) {
-return new ArrayRealVector(solve(b.getData()), false);
-}
-}
-
-/** Solve the linear equation A times; X = B.
- * pThe A matrix is implicit here. It is /p
- * @param b right-hand side of the equation A times; X = B
- * @return a vector X that minimizes the two norm of A times; X - B
- * @throws DimensionMismatchException if the matrices dimensions do 
not match.
- * @throws SingularMatrixException if the decomposed matrix is 
singular.
- */
-public ArrayRealVector solve(ArrayRealVector b) {
-return new ArrayRealVector(solve(b.getDataRef()), false);
+return new ArrayRealVector(x, false);
 }
 
 /** {@inheritDoc} */

Modified: 
commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java?rev=1165507r1=1165506r2=1165507view=diff
==
--- 
commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java
 (original)
+++ 
commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java
 Tue Sep  6 06:23:06 2011
@@ -333,7 +333,7 @@ public class ArrayRealVectorTest {
 }
 
 public double[] toArray() {
-throw unsupported();
+return data.clone();
 }
 
 public boolean isNaN() {




svn commit: r1165508 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java

2011-09-06 Thread celestin
Author: celestin
Date: Tue Sep  6 06:24:11 2011
New Revision: 1165508

URL: http://svn.apache.org/viewvc?rev=1165508view=rev
Log:
Removed double[] solve(double[]) from SingularValueDecompositionImpl.Solver

Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java?rev=1165508r1=1165507r2=1165508view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
 Tue Sep  6 06:24:11 2011
@@ -616,21 +616,6 @@ public class SingularValueDecompositionI
  * @throws org.apache.commons.math.exception.DimensionMismatchException
  * if the matrices dimensions do not match.
  */
-public double[] solve(final double[] b) {
-return pseudoInverse.operate(b);
-}
-
-/**
- * Solve the linear equation A times; X = B in least square sense.
- * p
- * The mtimes;n matrix A may not be square, the solution X is such 
that
- * ||A times; X - B|| is minimal.
- * /p
- * @param b Right-hand side of the equation A times; X = B
- * @return a vector X that minimizes the two norm of A times; X - B
- * @throws org.apache.commons.math.exception.DimensionMismatchException
- * if the matrices dimensions do not match.
- */
 public RealVector solve(final RealVector b) {
 return pseudoInverse.operate(b);
 }




svn commit: r1165510 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java

2011-09-06 Thread celestin
Author: celestin
Date: Tue Sep  6 06:38:43 2011
New Revision: 1165510

URL: http://svn.apache.org/viewvc?rev=1165510view=rev
Log:
Fixed a Checkstyle complaint.

Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java?rev=1165510r1=1165509r2=1165510view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java
 Tue Sep  6 06:38:43 2011
@@ -312,7 +312,7 @@ public class ArrayRealVector extends Rea
 /** {@inheritDoc} */
 @Override
 public ArrayRealVector subtract(RealVector v) {
-if (v instanceof ArrayRealVector) { 
+if (v instanceof ArrayRealVector) {
 final double[] vData = ((ArrayRealVector) v).data;
 final int dim = vData.length;
 checkVectorDimensions(dim);




svn commit: r1165549 - in /commons/sandbox/runtime/trunk/src/main: native/ native/os/win32/ test/org/apache/commons/runtime/

2011-09-06 Thread mturk
Author: mturk
Date: Tue Sep  6 07:59:45 2011
New Revision: 1165549

URL: http://svn.apache.org/viewvc?rev=1165549view=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=1165549r1=1165548r2=1165549view=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=1165549r1=1165548r2=1165549view=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=1165549view=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 lm.h
+#include sddl.h
+
+J_DECLARE_CLAZZ = {
+INVALID_FIELD_OFFSET,
+0,
+0,
+0,
+ACR_CLASS_PATH Group
+};
+
+J_DECLARE_M_ID() = {
+0,
+init,
+(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_OFFSET,
+0,
+

svn commit: r1165590 - in /commons/sandbox/runtime/trunk/src/main: native/os/win32/sendfd.c test/org/apache/commons/runtime/TestSendSocket.java

2011-09-06 Thread mturk
Author: mturk
Date: Tue Sep  6 10:15:45 2011
New Revision: 1165590

URL: http://svn.apache.org/viewvc?rev=1165590view=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=1165590r1=1165589r2=1165590view=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 = -1;
+

svn commit: r1165610 - in /commons/sandbox/runtime/trunk/src/main: native/os/win32/sendfd.c test/org/apache/commons/runtime/TestSendSocket.java

2011-09-06 Thread mturk
Author: mturk
Date: Tue Sep  6 11:29:40 2011
New Revision: 1165610

URL: http://svn.apache.org/viewvc?rev=1165610view=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=1165610r1=1165609r2=1165610view=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=1165610r1=1165609r2=1165610view=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

2011-09-06 Thread mturk
Author: mturk
Date: Tue Sep  6 12:02:20 2011
New Revision: 1165622

URL: http://svn.apache.org/viewvc?rev=1165622view=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=1165622r1=1165621r2=1165622view=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=1165622r1=1165621r2=1165622view=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);
 if (rc != 0)
 

svn commit: r1165644 - /commons/proper/lang/trunk/pom.xml

2011-09-06 Thread ggregory
Author: ggregory
Date: Tue Sep  6 12:46:17 2011
New Revision: 1165644

URL: http://svn.apache.org/viewvc?rev=1165644view=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=1165644r1=1165643r2=1165644view=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 @@
   /execution
   !-- 
   execution
-idsecurity-manager/id
+idsecurity-manager-test/id
+phaseintegration-test/phase
+goals
+  goaltest/goal
+/goals
 configuration
   includes
 include**/*Test.java/include
-  /includes  
+  /includes
   argLine-Djava.security.manager 
-Djava.security.policy=${basedir}/src/test/resources/java.policy/argLine
 /configuration
   /execution
-  --
+   --
 /executions
   /plugin
   plugin




svn commit: r1165649 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java

2011-09-06 Thread henrib
Author: henrib
Date: Tue Sep  6 12:58:17 2011
New Revision: 1165649

URL: http://svn.apache.org/viewvc?rev=1165649view=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=1165649r1=1165648r2=1165649view=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

2011-09-06 Thread henrib
Author: henrib
Date: Tue Sep  6 13:01:14 2011
New Revision: 1165652

URL: http://svn.apache.org/viewvc?rev=1165652view=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=1165652r1=1165651r2=1165652view=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 a comparison.
+   

svn commit: r1165654 - /commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/introspection/IntrospectorBase.java

2011-09-06 Thread henrib
Author: henrib
Date: Tue Sep  6 13:02:31 2011
New Revision: 1165654

URL: http://svn.apache.org/viewvc?rev=1165654view=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=1165654r1=1165653r2=1165654view=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 {
 IteratorMap.EntryMethodKey, Constructor? entries = 
constructorsMap.entrySet().iterator();
 while(entries.hasNext()) {
 Map.EntryMethodKey, Constructor? 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

2011-09-06 Thread erans
Author: erans
Date: Tue Sep  6 13:05:55 2011
New Revision: 1165656

URL: http://svn.apache.org/viewvc?rev=1165656view=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=1165656r1=1165655r2=1165656view=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

2011-09-06 Thread sebb
Author: sebb
Date: Tue Sep  6 15:16:47 2011
New Revision: 1165701

URL: http://svn.apache.org/viewvc?rev=1165701view=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=1165701r1=1165700r2=1165701view=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$
-java6NormalizeMethod = 

svn commit: r1165764 - /commons/proper/ognl/trunk/src/site/site.xml

2011-09-06 Thread mcucchiara
Author: mcucchiara
Date: Tue Sep  6 17:14:39 2011
New Revision: 1165764

URL: http://svn.apache.org/viewvc?rev=1165764view=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=1165764r1=1165763r2=1165764view=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 @@
   /bannerRight
 
   body
-menu name=Discovery
+menu name=OGNL
   item name=Overviewhref=/index.html /
   !--item name=Download
href=http://commons.apache.org/ognl/download_ognl.cgi; /--
   item name=Release Notes (4.0-incubating)  
href=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/

2011-09-06 Thread mturk
Author: mturk
Date: Tue Sep  6 19:07:02 2011
New Revision: 1165788

URL: http://svn.apache.org/viewvc?rev=1165788view=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=1165788r1=1165787r2=1165788view=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=1165788r1=1165787r2=1165788view=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 sys/utsname.h
 
 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=1165788r1=1165787r2=1165788view=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 procfs.h
 #include sys/utsname.h
 #include sys/systeminfo.h
 
@@ -105,3 +106,78 @@ ACR_JNI_EXPORT(jstring, Vm, exe0)(JNI_ST
 return CSTR_TO_JSTRING(buf);
 }
 }
+
+/*
+ * Read the psinfo_t structure from /proc/pid/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 

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

2011-09-06 Thread luc
Author: luc
Date: Tue Sep  6 19:16:05 2011
New Revision: 1165790

URL: http://svn.apache.org/viewvc?rev=1165790view=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=1165790r1=1165789r2=1165790view=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=1165790r1=1165789r2=1165790view=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 ArrayListEventState();
 statesInitialized = false;
+evaluations = new Incrementor();
 setMaxEvaluations(-1);
 resetEvaluations();
 }
@@ -167,23 +165,23 @@ public abstract class AbstractIntegrator
 
 /** {@inheritDoc} */
 public void setMaxEvaluations(int maxEvaluations) {
-this.maxEvaluations = (maxEvaluations  0) ? 

svn commit: r1165800 - /commons/sandbox/runtime/trunk/src/main/native/os/solaris/os.c

2011-09-06 Thread mturk
Author: mturk
Date: Tue Sep  6 19:37:22 2011
New Revision: 1165800

URL: http://svn.apache.org/viewvc?rev=1165800view=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=1165800r1=1165799r2=1165800view=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 procfs.h
 #include sys/utsname.h
 #include sys/systeminfo.h
@@ -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

2011-09-06 Thread luc
Author: luc
Date: Tue Sep  6 19:59:47 2011
New Revision: 1165808

URL: http://svn.apache.org/viewvc?rev=1165808view=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=1165808r1=1165807r2=1165808view=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=1165808r1=1165807r2=1165808view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
 (original)
+++ 

svn commit: r1165810 - in /commons/proper/math/trunk/src/site/xdoc/userguide: analysis.xml index.xml

2011-09-06 Thread luc
Author: luc
Date: Tue Sep  6 20:01:07 2011
New Revision: 1165810

URL: http://svn.apache.org/viewvc?rev=1165810view=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=1165810r1=1165809r2=1165810view=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.
 /p
   /subsection
-  subsection name=4.2 Root-finding href=rootfinding
+  subsection name=4.2 Error handling href=errorhandling
+p
+  For user-defined functions, when the method encounters an error
+  during evaluation, users must use their emown/em 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).
+/p
+sourceprivate 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
+   }
+ }
+ /source
+  p
+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.
+  /p
+  /subsection
+  subsection name=4.3 Root-finding href=rootfinding
 p
   a 
href=../apidocs/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.html
   UnivariateRealSolver/a, a 
href=../apidocs/org/apache/commons/math/analysis/solvers/DifferentiableUnivariateRealSolver.html
@@ -327,7 +374,7 @@ double c = UnivariateRealSolverUtils.for
   /table
 /p
   /subsection
-  subsection name=4.3 Interpolation href=interpolation
+  subsection name=4.4 Interpolation href=interpolation
 p
   A a 
href=../apidocs/org/apache/commons/math/analysis/interpolation/UnivariateRealInterpolator.html
   UnivariateRealInterpolator/a is used to find a univariate 
real-valued
@@ -445,7 +492,7 @@ System.out println(f( + interpolationX
   tricubic interpolating function/a.
 /p
   /subsection
-  subsection name=4.4 Integration href=integration
+  subsection name=4.5 Integration href=integration
 p
   A a 
href=../apidocs/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.html
   UnivariateRealIntegrator/a provides the means to numerically 
integrate
@@ -463,7 +510,7 @@ System.out println(f( + interpolationX
   /ul  
 /p
   /subsection
-  subsection name=4.5 Polynomials href=polynomials
+  subsection name=4.6 Polynomials href=polynomials
 p
   The a 
href=../apidocs/org/apache/commons/math/analysis/polynomials/package-summary.html
   org.apache.commons.math.analysis.polynomials/a 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=1165810r1=1165809r2=1165810view=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 @@
 lia href=analysis.html4. Numerical Analysis/a
 ul
 lia href=analysis.html#a4.1_Overview4.1 Overview/a/li
-lia href=analysis.html#a4.2_Root-finding4.2 
Root-finding/a/li
-lia href=analysis.html#a4.3_Interpolation4.3 
Interpolation/a/li
-lia href=analysis.html#a4.4_Integration4.4 
Integration/a/li
-lia href=analysis.html#a4.5_Polynomials4.5 
Polynomials/a/li
+lia href=analysis.html#a4.2_Error-handling4.2 Error 

svn commit: r1165821 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/dfp/UnivariateDfpFunction.java

2011-09-06 Thread luc
Author: luc
Date: Tue Sep  6 20:18:42 2011
New Revision: 1165821

URL: http://svn.apache.org/viewvc?rev=1165821view=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=1165821r1=1165820r2=1165821view=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/

2011-09-06 Thread luc
Author: luc
Date: Tue Sep  6 20:19:37 2011
New Revision: 1165822

URL: http://svn.apache.org/viewvc?rev=1165822view=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=1165822r1=1165821r2=1165822view=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 FieldMatrixT extends F
  * of a row from left to right before going to the leftmost element
  * of the next row./p
  * @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 FieldMatrixT extends F
  * of a row from left to right before going to the leftmost element
  * of the next row./p
  * @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 FieldMatrixT extends F
  * @param endRow Final row index (inclusive)
  * @param startColumn Initial column index
  * @param endColumn Final column index
- * @throws org.apache.commons.math.exception.MathUserException if the 
visitor
- * cannot process an entry.
  * @throws org.apache.commons.math.exception.OutOfRangeException
  * if the indices are not valid.
  * @see #walkInRowOrder(FieldMatrixChangingVisitor)
@@ -564,8 +558,6 @@ public interface FieldMatrixT extends F
  * @param endRow Final row index (inclusive)
  * @param startColumn Initial column index
  * @param endColumn Final column index
- * @throws org.apache.commons.math.exception.MathUserException if the 
visitor
- * cannot process an entry.
  * @throws org.apache.commons.math.exception.OutOfRangeException
  * if the indices are not valid.
  * @see #walkInRowOrder(FieldMatrixChangingVisitor)
@@ -591,8 +583,6 @@ public interface FieldMatrixT extends F
  * of a column from top to bottom before going to the topmost element
  * of the next column./p
  * @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 FieldMatrixT extends F
  * of a column from top to bottom before going to the topmost element
  * of the next column./p
  * @param visitor visitor used to process all matrix entries
- * @throws org.apache.commons.math.exception.MathUserException if the 

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/

2011-09-06 Thread sgoeschl
Author: sgoeschl
Date: Tue Sep  6 20:34:43 2011
New Revision: 1165830

URL: http://svn.apache.org/viewvc?rev=1165830view=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=1165830r1=1165829r2=1165830view=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 @@
 
   body
 release version=1.3 date=as in SVN
+   action dev=sgoeschl type=fix issue=EMAIL-106 date=2011-09-06 
due-to=Bruno Harbulot
+  STARTTLS can be used even without authenticator.
+  /action
+  action dev=sgoeschl type=fix issue=EMAIL-105 date=2011-09-06 
due-to=Bruno Harbulot
+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.
+  /action
   action dev=sgoeschl type=fix issue=EMAIL-102 date=2010-12-16 
due-to=Okan Özeren
 Fixed HtmlEmail embed toLowerCase bug with Turkish locale.
   /action

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=1165830r1=1165829r2=1165830view=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 

svn commit: r1165846 [1/2] - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java

2011-09-06 Thread sebb
Author: sebb
Date: Tue Sep  6 21:06:58 2011
New Revision: 1165846

URL: http://svn.apache.org/viewvc?rev=1165846view=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: r1165862 - in /commons/proper/email/trunk/src/test/images: contentTypeTest.gif contentTypeTest.jpg contentTypeTest.png

2011-09-06 Thread sgoeschl
Author: sgoeschl
Date: Tue Sep  6 21:26:52 2011
New Revision: 1165862

URL: http://svn.apache.org/viewvc?rev=1165862view=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=1165862view=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=1165862view=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=1165862view=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

2011-09-06 Thread sebb
Author: sebb
Date: Tue Sep  6 22:17:21 2011
New Revision: 1165903

URL: http://svn.apache.org/viewvc?rev=1165903view=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=1165903r1=1165902r2=1165903view=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

2011-09-06 Thread sebb
Author: sebb
Date: Tue Sep  6 23:33:54 2011
New Revision: 1165929

URL: http://svn.apache.org/viewvc?rev=1165929view=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=1165929r1=1165928r2=1165929view=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

2011-09-06 Thread ggregory
Author: ggregory
Date: Wed Sep  7 02:42:18 2011
New Revision: 1165967

URL: http://svn.apache.org/viewvc?rev=1165967view=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=1165967r1=1165966r2=1165967view=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.
 property name=fileExtensions value=java,xml/
   /module
   module name=TreeWalker
+property name=cacheFile value=target/cachefile/
 module name=AvoidStarImport/
 module name=RedundantImport/
 module name=UnusedImports/

Modified: commons/proper/io/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/pom.xml?rev=1165967r1=1165966r2=1165967view=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 @@
   plugin
 groupIdorg.codehaus.mojo/groupId
 artifactIdcobertura-maven-plugin/artifactId
-version2.4/version
+version2.5.1/version
   /plugin
   plugin
 groupIdorg.apache.maven.plugins/groupId
 artifactIdmaven-checkstyle-plugin/artifactId
-version2.6/version
+version2.7/version
 configuration
   configLocation${basedir}/checkstyle.xml/configLocation
   enableRulesSummaryfalse/enableRulesSummary
@@ -281,7 +281,7 @@
   plugin
 groupIdorg.codehaus.mojo/groupId
 artifactIdfindbugs-maven-plugin/artifactId
-version2.3.1/version
+version2.3.2/version
 configuration
   thresholdNormal/threshold
   effortDefault/effort




svn commit: r1165970 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/LineIteratorTestCase.java

2011-09-06 Thread ggregory
Author: ggregory
Date: Wed Sep  7 02:47:43 2011
New Revision: 1165970

URL: http://svn.apache.org/viewvc?rev=1165970view=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=1165970r1=1165969r2=1165970view=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

2011-09-06 Thread ggregory
Author: ggregory
Date: Wed Sep  7 03:03:06 2011
New Revision: 1165983

URL: http://svn.apache.org/viewvc?rev=1165983view=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=1165983r1=1165982r2=1165983view=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

2011-09-06 Thread ggregory
Author: ggregory
Date: Wed Sep  7 03:03:42 2011
New Revision: 1165984

URL: http://svn.apache.org/viewvc?rev=1165984view=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=1165984r1=1165983r2=1165984view=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