svn commit: r1147758 - in /commons/sandbox/runtime/trunk/src/main/native/os/unix: inetsock.c localsock.c

2011-07-18 Thread mturk
Author: mturk
Date: Mon Jul 18 06:38:00 2011
New Revision: 1147758

URL: http://svn.apache.org/viewvc?rev=1147758view=rev
Log:
Fix local flags

Modified:
commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c?rev=1147758r1=1147757r2=1147758view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/inetsock.c Mon Jul 18 
06:38:00 2011
@@ -312,6 +312,7 @@ ACR_NET_EXPORT(jlong, SocketServerEndpoi
 {
 int sd;
 int ad;
+int rc = 0;
 acr_sockaddr_t  aa;
 socklen_t   aalen;
 acr_sd_t *fd  = J2P(fp, acr_sd_t *);
@@ -349,7 +350,7 @@ ACR_NET_EXPORT(jlong, SocketServerEndpoi
 }
 #if !HAVE_ACCEPT4
 {
-int rc = AcrCloseOnExec(sd, 1);
+rc = AcrCloseOnExec(sd, 1);
 if (rc != 0) {
 r_close(sd);
 ACR_THROW_NET_ERROR(rc);
@@ -369,7 +370,6 @@ ACR_NET_EXPORT(jlong, SocketServerEndpoi
 }
 #endif
 if (block == JNI_FALSE) {
-int rc = 0;
 #if O_NONBLOCK_INHERITED
 if (!ACR_HASFLAG(fd, ACR_SO_NONBLOCK))
 #endif

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c?rev=1147758r1=1147757r2=1147758view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/localsock.c Mon Jul 
18 06:38:00 2011
@@ -123,6 +123,7 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
 {
 int sd;
 int ad;
+int rc = 0;
 acr_sockaddr_t  aa;
 socklen_t   aalen;
 acr_sd_t *fd  = J2P(fp, acr_sd_t *);
@@ -155,7 +156,7 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
 }
 #if !HAVE_ACCEPT4
 {
-int rc = AcrCloseOnExec(sd, 1);
+rc = AcrCloseOnExec(sd, 1);
 if (rc != 0) {
 r_close(sd);
 ACR_THROW_NET_ERROR(rc);
@@ -164,7 +165,6 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
 }
 #endif
 if (block == JNI_FALSE) {
-int rc = 0;
 #if O_NONBLOCK_INHERITED
 if (!ACR_HASFLAG(fd, ACR_SO_NONBLOCK))
 #endif




svn commit: r1147778 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathUserException.java

2011-07-18 Thread luc
Author: luc
Date: Mon Jul 18 08:33:53 2011
New Revision: 1147778

URL: http://svn.apache.org/viewvc?rev=1147778view=rev
Log:
added forgotten delegating method from context

Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathUserException.java

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathUserException.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathUserException.java?rev=1147778r1=114r2=1147778view=diff
==
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathUserException.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathUserException.java
 Mon Jul 18 08:33:53 2011
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.math.exception;
 
+import java.util.Locale;
+
 import org.apache.commons.math.exception.util.Localizable;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.exception.util.ExceptionContext;
@@ -94,4 +96,15 @@ public class MathUserException extends R
 public String getLocalizedMessage() {
 return context.getLocalizedMessage();
 }
+
+/**
+ * Gets the message in a specified locale.
+ *
+ * @param locale Locale in which the message should be translated
+ * @return localized message
+ */
+public String getMessage(final Locale locale) {
+return context.getMessage(locale);
+}
+
 }




svn commit: r1147802 - in /commons/sandbox/runtime/trunk/src/main/native: Makefile.unx.in os/solaris/port.c os/unix/arch_defs.h

2011-07-18 Thread mturk
Author: mturk
Date: Mon Jul 18 09:52:13 2011
New Revision: 1147802

URL: http://svn.apache.org/viewvc?rev=1147802view=rev
Log:
Add Solaris port selector

Added:
commons/sandbox/runtime/trunk/src/main/native/os/solaris/port.c   (with 
props)
Modified:
commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in
commons/sandbox/runtime/trunk/src/main/native/os/unix/arch_defs.h

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in?rev=1147802r1=1147801r2=1147802view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in Mon Jul 18 
09:52:13 2011
@@ -90,6 +90,7 @@ LINUX_SOURCES=\
$(TOPDIR)/os/linux/misc.c \
$(TOPDIR)/os/linux/os.c
 SOLARIS_SOURCES=\
+   $(TOPDIR)/os/solaris/port.c \
$(TOPDIR)/os/solaris/os.c
 
 LIBSOURCES=\

Added: commons/sandbox/runtime/trunk/src/main/native/os/solaris/port.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/solaris/port.c?rev=1147802view=auto
==
--- commons/sandbox/runtime/trunk/src/main/native/os/solaris/port.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/os/solaris/port.c Mon Jul 18 
09:52:13 2011
@@ -0,0 +1,628 @@
+/* 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/clazz.h
+#include acr/memory.h
+#include acr/jniapi.h
+#include acr/port.h
+#include acr/time.h
+#include acr/iodefs.h
+#include acr/netapi.h
+#include acr/ring.h
+#include acr/misc.h
+#include arch_opts.h
+#include arch_sync.h
+#include poll.h
+#include port.h
+
+/* pollset operation states */
+#define PSS_DESTROY 1
+#define PSS_POLL2
+#define PSS_WAIT3
+#define PSS_WAKEUP  4
+/* Max events for a single run
+ * Choosen to reflect the 4k page size
+ * PSS_SIZE * sizeof(port_event_t) ~= 4096
+ */
+#define PSS_SIZE256
+
+typedef struct pfd_elem_t pfd_elem_t;
+struct pfd_elem_t {
+ACR_RING_ENTRY(pfd_elem_t) link;
+intfd;
+short  ievents;
+short  revents;
+jobjectobj;
+acr_time_t ttl;
+acr_time_t exp;
+};
+
+typedef struct acr_pollset_t {
+/* A ring containing all of the pfd_elem_t that are active
+ */
+ACR_RING_HEAD(pfd_eset_ring_t, pfd_elem_t) eset_ring;
+/* A ring of pfd_elem_t that have been used, and then deleted
+ */
+ACR_RING_HEAD(pfd_free_ring_t, pfd_elem_t) free_ring;
+/* A ring of pfd_elem_t where rings that have been deleted but
+ * might still be inside a _epoll()
+ */
+ACR_RING_HEAD(pfd_dead_ring_t, pfd_elem_t) dead_ring;
+port_event_t   *peset;
+int spfd;
+int used;
+volatile acr_atomic32_t state;
+int wpipe[2];
+pthread_mutex_t mutex;
+pthread_cond_t  wakeup;
+} acr_pollset_t;
+
+J_DECLARE_CLAZZ = {
+INVALID_FIELD_OFFSET,
+0,
+0,
+0,
+ACR_NET_CP UnixSelector
+};
+
+J_DECLARE_M_ID() = {
+0,
+addSelected,
+(L ACR_NET_CP SelectionKeyImpl;S)V
+};
+
+static short ieventt(int event)
+{
+short rv = 0;
+
+if (event  ACR_OP_INP)
+rv |= POLLIN;
+if (event  ACR_OP_OUT)
+rv |= POLLOUT;
+if (event  ACR_OP_PRI)
+rv |= POLLPRI;
+/* POLLERR, POLLHUP, and POLLNVAL aren't valid as requested events
+ */
+return rv;
+}
+
+static short reventt(short event)
+{
+short rv = 0;
+
+if (event  POLLIN)
+rv |= ACR_OP_INP;
+if (event  POLLOUT)
+rv |= ACR_OP_OUT;
+if (event  POLLPRI)
+rv |= ACR_OP_PRI;
+if (event  POLLERR)
+rv |= ACR_OP_ERROR;
+if (event  POLLHUP)
+rv |= ACR_OP_HANGUP;
+if (event  POLLNVAL)
+rv |= ACR_OP_NVAL;
+return rv;
+}
+
+ACR_NET_EXPORT(void, UnixSelector, init0)(JNI_STDARGS)
+{
+_clazzn.i = (jclass)(*env)-NewGlobalRef(env, obj);
+if (_clazzn.i == 0)
+  

svn commit: r1147809 - in /commons/proper/jexl/trunk/src: main/java/org/apache/commons/jexl2/introspection/ main/java/org/apache/commons/jexl2/parser/ test/java/org/apache/commons/jexl2/

2011-07-18 Thread henrib
Author: henrib
Date: Mon Jul 18 11:10:42 2011
New Revision: 1147809

URL: http://svn.apache.org/viewvc?rev=1147809view=rev
Log:
JEXL-116:
* Added sandbox and sandbox-uberspect + tests

Added:

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java
   (with props)

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/SandboxUberspectImpl.java
   (with props)

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/TokenMgrError.java
   (with props)

commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/SandboxTest.java
   (with props)

Added: 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java?rev=1147809view=auto
==
--- 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java
 (added)
+++ 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Sandbox.java
 Mon Jul 18 11:10:42 2011
@@ -0,0 +1,252 @@
+/*
+ * 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.
+ */
+package org.apache.commons.jexl2.introspection;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A sandbox describes permissions on a class by explicitly allowing or 
forbidding access to methods and properties
+ * through whitelists and blacklists.
+ * p
+ * A bwhitelist/b explicitly allows methods/properties for a class;
+ * ul
+ * li
+ * If a whitelist is empty and thus does not contain any names, all 
properties/methods are allowed for its class.
+ * /li
+ * li
+ * If it is not empty, the only allowed properties/methods are the ones 
contained.
+ * /li
+ * /ul
+ * /p
+ * p
+ * A bblacklist/b explicitly forbids methods/properties for a class;
+ * ul
+ * li
+ * If a blacklist is empty and thus does not contain any names, all 
properties/methods are forbidden for its class.
+ * /li
+ * li
+ * If it is not empty, the only forbidden properties/methods are the ones 
contained.
+ * /li
+ * /ul
+ * p
+ * Permissions are composed of three lists, read, write, execute, each being 
white or black; .
+ * ul
+ * libread/b controls readable properties /li
+ * libwrite/b controls writeable properties/li
+ * libexecute/b controls executable methods and constructor/li
+ * /ul
+ * /p
+ * 
+ * @since 2.1
+ */
+public class Sandbox {
+/**
+ * The map from class names to permissions.
+ */
+private final MapString, Permissions sandbox;
+
+/**
+ * Creates a new default sandbox.
+ */
+public Sandbox() {
+sandbox = new HashMapString, Permissions();
+}
+
+/**
+ * Creates a sandbox based on an existing permissions map.
+ * @param map the permissions map
+ */
+private Sandbox(MapString, Permissions map) {
+sandbox = map;
+}
+
+/**
+ * A base set of names.
+ */
+public abstract static class Names {
+/** The set of controlled names. */
+protected SetString names = null;
+
+/**
+ * Adds a name to this set.
+ * @param name the name to add
+ * @return  true if the name was really added, false if it was already 
present
+ */
+private boolean add(String name) {
+if (names == null) {
+names = new HashSetString();
+}
+return names.add(name);
+}
+
+/**
+ * Whether a given name is allowed or not.
+ * @param name the method/property name to check
+ * @return true if allowed, false if forbidden
+ */
+public abstract boolean allows(String name);
+}
+
+/**
+ * A white set of names.
+ */
+public static class WhiteSet extends Names {
+@Override
+public boolean allows(String name) {
+return names == null || names.contains(name);
+}
+}
+
+/**
+ * A black set of names.
+ */
+public static class BlackSet extends Names {
+@Override
+

svn commit: r1147811 - in /commons/proper/jexl/trunk: ./ src/main/java/org/apache/commons/jexl2/ src/main/java/org/apache/commons/jexl2/internal/ src/main/java/org/apache/commons/jexl2/parser/ src/sit

2011-07-18 Thread henrib
Author: henrib
Date: Mon Jul 18 11:12:35 2011
New Revision: 1147811

URL: http://svn.apache.org/viewvc?rev=1147811view=rev
Log:
Checkstyle, PMD, Javadoc, etc

Modified:
commons/proper/jexl/trunk/pom.xml

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlException.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlInfo.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlThreadedArithmetic.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/NamespaceResolver.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/ReadonlyContext.java
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Script.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/internal/Introspector.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/JexlNode.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/JexlParser.java

commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/StringParser.java
commons/proper/jexl/trunk/src/site/xdoc/reference/syntax.xml

commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/IssuesTest.java

commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ScriptCallableTest.java

Modified: commons/proper/jexl/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/pom.xml?rev=1147811r1=1147810r2=1147811view=diff
==
--- commons/proper/jexl/trunk/pom.xml (original)
+++ commons/proper/jexl/trunk/pom.xml Mon Jul 18 11:12:35 2011
@@ -254,10 +254,14 @@
 plugin
 groupIdorg.codehaus.mojo/groupId
 artifactIdcobertura-maven-plugin/artifactId
-version2.4/version
+version2.5.1/version
 configuration
 instrumentation
+ignores
+ignore**/generated-sources/**/*/ignore
+/ignores
 excludes
+exclude**/generated-sources/**/*/exclude
 
excludeorg/apache/commons/jexl2/parser/*.class/exclude
 
excludeorg/apache/commons/jexl2/**/*Test.class/exclude
 /excludes

Modified: 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java?rev=1147811r1=1147810r2=1147811view=diff
==
--- 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java 
(original)
+++ 
commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java 
Mon Jul 18 11:12:35 2011
@@ -18,9 +18,8 @@ package org.apache.commons.jexl2;
 
 
 /**
- * Little class to carry in info such as a url/file name, line and column for
- * information error reporting from the uberspector implementations.
- * @version $Id$
+ * Helper class to carry in info such as a url/file name, line and column for
+ * debugging information reporting.
  */
 public class DebugInfo implements JexlInfo {
 /** line number. */
@@ -63,6 +62,11 @@ public class DebugInfo implements JexlIn
 public String debugString() {
 return toString();
 }
+
+/** {@inheritDoc} */
+public DebugInfo debugInfo() {
+return this;
+}
 
 /**
  * Gets the file/script/url name.

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=1147811r1=1147810r2=1147811view=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
 Mon Jul 18 11:12:35 2011
@@ -127,7 +127,7 @@ public class Interpreter implements Pars
 public Interpreter(JexlEngine jexl, JexlContext aContext) {
 this(jexl, aContext, !jexl.isLenient(), jexl.isSilent());
 }
-
+
 /**
  * Creates an interpreter.
  * @param jexl the engine creating this interpreter
@@ -170,7 +170,7 @@ public class Interpreter implements Pars
 public boolean isStrict() {
 return this.strict;
 

svn commit: r1147814 - in /commons/sandbox/runtime/trunk/src/main/native: configure os/unix/posixapi.c

2011-07-18 Thread mturk
Author: mturk
Date: Mon Jul 18 11:29:55 2011
New Revision: 1147814

URL: http://svn.apache.org/viewvc?rev=1147814view=rev
Log:
Fix configure include and gcc checking

Modified:
commons/sandbox/runtime/trunk/src/main/native/configure
commons/sandbox/runtime/trunk/src/main/native/os/unix/posixapi.c

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=1147814r1=1147813r2=1147814view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Mon Jul 18 11:29:55 
2011
@@ -669,7 +669,7 @@ case $host-$cctype in
echo Error: Cannot determine $cc version
exit 1
 fi
-cc_ver_major=`echo $v | awk '{print $2;}'`
+cc_ver_minor=`echo $v | awk '{print $2;}'`
 if [ .$has_maintainer_mode != .yes ]; then
 varadds ccflags -fno-stack-protector
 else
@@ -677,7 +677,7 @@ case $host-$cctype in
 varadds asflags -g
 fi
 if [ ${cc_ver_major}${cc_ver_minor}0 -lt 410 ]; then
-echo Error: Detected $cc version
+echo Error: Detected $cc version: \`$v'
 echogcc = 4.1.0 required
 exit 1
 fi
@@ -915,8 +915,8 @@ have_include()
 do_printf 'Checking for %-32s' $1.h
 cat  $cccsrc.c  EOF
 #include stdlib.h
-#include $cccinc.h
-$3
+#include sys/types.h
+$2
 #include $1.h
 int main() {return 0;}
 EOF

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/posixapi.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/posixapi.c?rev=1147814r1=1147813r2=1147814view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/posixapi.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/posixapi.c Mon Jul 18 
11:29:55 2011
@@ -21,7 +21,7 @@
 
 #include sys/mman.h
 #if !defined(MAP_ANONYMOUS)
-# define MAP_ANONYMOUS  MAP_ANON
+# define MAP_ANONYMOUS MAP_ANON
 #endif
 
 ACR_UNX_EXPORT(jint, Posix, open)(JNI_STDARGS, jstring name,




svn commit: r1147818 - in /commons/sandbox/runtime/trunk/src/main/native: configure os/linux/epoll.c

2011-07-18 Thread mturk
Author: mturk
Date: Mon Jul 18 11:44:20 2011
New Revision: 1147818

URL: http://svn.apache.org/viewvc?rev=1147818view=rev
Log:
Allow additional includes in have_include test

Modified:
commons/sandbox/runtime/trunk/src/main/native/configure
commons/sandbox/runtime/trunk/src/main/native/os/linux/epoll.c

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=1147818r1=1147817r2=1147818view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Mon Jul 18 11:44:20 
2011
@@ -120,7 +120,7 @@ has_openssl_static=no
 openssl_home=$OPENSSL_HOME
 openssl_inc=
 openssl_lib=
-cccinc=stdio
+cccinc=unistd
 mmake=make
 makefiles=Makefile.in
 cc_ver_major=0
@@ -915,8 +915,11 @@ have_include()
 do_printf 'Checking for %-32s' $1.h
 cat  $cccsrc.c  EOF
 #include stdlib.h
-#include sys/types.h
-$2
+#include $cccinc.h
+EOF
+test .$2 != .  echo '#include '$2'.h'  $cccsrc.c
+test .$3 != .  echo '#include '$3'.h'  $cccsrc.c
+cat  $cccsrc.c  EOF
 #include $1.h
 int main() {return 0;}
 EOF
@@ -1350,7 +1353,7 @@ extern C {
 #define HAVE_LIMITS_H   `have_include limits`
 #define HAVE_NETDB_H`have_include netdb`
 #define HAVE_NETINET_IN_H   `have_include netinet/in`
-#define HAVE_NETINET_TCP_H  `have_include netinet/tcp`
+#define HAVE_NETINET_TCP_H  `have_include netinet/tcp netinet/in`
 #define HAVE_ARPA_INET_H`have_include arpa/inet`
 #define HAVE_RESOLV_H   `have_include resolv`
 #define HAVE_IFADDRS_H  `have_include ifaddrs`

Modified: commons/sandbox/runtime/trunk/src/main/native/os/linux/epoll.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/epoll.c?rev=1147818r1=1147817r2=1147818view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/linux/epoll.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/linux/epoll.c Mon Jul 18 
11:44:20 2011
@@ -51,13 +51,13 @@ struct pfd_elem_t {
 };
 
 typedef struct acr_pollset_t {
-/* A ring containing all of the pollfd_t that are active
+/* A ring containing all of the pfd_elem_t that are active
  */
 ACR_RING_HEAD(pfd_eset_ring_t, pfd_elem_t) eset_ring;
-/* A ring of pollfd_t that have been used, and then deleted
+/* A ring of pfd_elem_t that have been used, and then deleted
  */
 ACR_RING_HEAD(pfd_free_ring_t, pfd_elem_t) free_ring;
-/* A ring of pollfd_t where rings that have been deleted but
+/* A ring of pfd_elem_t where rings that have been deleted but
  * might still be inside a _epoll()
  */
 ACR_RING_HEAD(pfd_dead_ring_t, pfd_elem_t) dead_ring;




svn commit: r1147842 - /commons/proper/jexl/trunk/src/site/xdoc/changes.xml

2011-07-18 Thread henrib
Author: henrib
Date: Mon Jul 18 12:57:50 2011
New Revision: 1147842

URL: http://svn.apache.org/viewvc?rev=1147842view=rev
Log:
Updated changes.xml to reflect JEXL-116 fix

Modified:
commons/proper/jexl/trunk/src/site/xdoc/changes.xml

Modified: commons/proper/jexl/trunk/src/site/xdoc/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/site/xdoc/changes.xml?rev=1147842r1=1147841r2=1147842view=diff
==
--- commons/proper/jexl/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/jexl/trunk/src/site/xdoc/changes.xml Mon Jul 18 12:57:50 2011
@@ -26,6 +26,9 @@
   /properties
   body
 release version=2.1 date=unreleased
+action dev=henrib type=add issue=JEXL-116 due-to=Sarel Botha
+Add control over classes, methods, constructors and properties 
allowed in scripts
+/action
 action dev=henrib type=add issue=JEXL-115 due-to=Sarel Botha
 Add support for asynchronous script execution and cancellation
 /action




svn commit: r1147846 - in /commons/proper/jexl/trunk/jexl2-compat: pom.xml src/main/java/org/apache/commons/jexl/JexlOne.java

2011-07-18 Thread henrib
Author: henrib
Date: Mon Jul 18 13:07:58 2011
New Revision: 1147846

URL: http://svn.apache.org/viewvc?rev=1147846view=rev
Log:
Updated for JEXL-2.1 

Modified:
commons/proper/jexl/trunk/jexl2-compat/pom.xml

commons/proper/jexl/trunk/jexl2-compat/src/main/java/org/apache/commons/jexl/JexlOne.java

Modified: commons/proper/jexl/trunk/jexl2-compat/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/jexl2-compat/pom.xml?rev=1147846r1=1147845r2=1147846view=diff
==
--- commons/proper/jexl/trunk/jexl2-compat/pom.xml (original)
+++ commons/proper/jexl/trunk/jexl2-compat/pom.xml Mon Jul 18 13:07:58 2011
@@ -20,13 +20,13 @@
 parent
 groupIdorg.apache.commons/groupId
 artifactIdcommons-parent/artifactId
-version15/version
+version21/version
 /parent
 modelVersion4.0.0/modelVersion
 groupIdorg.apache.commons/groupId
 artifactIdcommons-jexl-compat/artifactId
 nameCommons JEXL (1.x compatibility)/name
-version2.0.1/version
+version2.1-SNAPSHOT/version
 inceptionYear2003/inceptionYear
 descriptionJexl is an implementation of the JSTL Expression Language 
with extensions./description
 urlhttp://commons.apache.org/jexl//url
@@ -80,7 +80,7 @@
 dependency
 groupIdorg.apache.commons/groupId
 artifactIdcommons-jexl/artifactId
-version2.0.1/version
+version2.1-SNAPSHOT/version
 /dependency
 /dependencies
 

Modified: 
commons/proper/jexl/trunk/jexl2-compat/src/main/java/org/apache/commons/jexl/JexlOne.java
URL: 
http://svn.apache.org/viewvc/commons/proper/jexl/trunk/jexl2-compat/src/main/java/org/apache/commons/jexl/JexlOne.java?rev=1147846r1=1147845r2=1147846view=diff
==
--- 
commons/proper/jexl/trunk/jexl2-compat/src/main/java/org/apache/commons/jexl/JexlOne.java
 (original)
+++ 
commons/proper/jexl/trunk/jexl2-compat/src/main/java/org/apache/commons/jexl/JexlOne.java
 Mon Jul 18 13:07:58 2011
@@ -111,7 +111,7 @@ public class JexlOne {
  * @param aContext the jexl context
  */
 public JexlOneInterpreter(JexlEngine jexl, JexlContext aContext) {
-super(jexl, ContextAdapter.adapt(aContext));
+super(jexl, ContextAdapter.adapt(aContext), false, false);
 }
 
 /**{@inheritDoc}*/




svn commit: r1147907 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java

2011-07-18 Thread ggregory
Author: ggregory
Date: Mon Jul 18 14:51:14 2011
New Revision: 1147907

URL: http://svn.apache.org/viewvc?rev=1147907view=rev
Log:
Tests https://issues.apache.org/jira/browse/IO-277 (@Ignore'd). Port to JUnit 4.

Modified:

commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java?rev=1147907r1=1147906r2=1147907view=diff
==
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
 Mon Jul 18 14:51:14 2011
@@ -16,13 +16,19 @@
  */
 package org.apache.commons.io.input;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.CharArrayReader;
 import java.io.IOException;
 import java.io.StringReader;
+import java.nio.charset.Charset;
 import java.util.Random;
 
-import junit.framework.TestCase;
+import org.junit.Ignore;
+import org.junit.Test;
 
-public class ReaderInputStreamTest extends TestCase {
+public class ReaderInputStreamTest {
 private static final String TEST_STRING = \u00e0 peine arriv\u00e9s nous 
entr\u00e2mes dans sa chambre;
 private static final String LARGE_TEST_STRING;
 
@@ -73,29 +79,61 @@ public class ReaderInputStreamTest exten
 }
 }
 
+@Test
 public void testUTF8WithSingleByteRead() throws IOException {
 testWithSingleByteRead(TEST_STRING, UTF-8);
 }
 
+@Test
 public void testLargeUTF8WithSingleByteRead() throws IOException {
 testWithSingleByteRead(LARGE_TEST_STRING, UTF-8);
 }
 
+@Test
 public void testUTF8WithBufferedRead() throws IOException {
 testWithBufferedRead(TEST_STRING, UTF-8);
 }
 
+@Test
 public void testLargeUTF8WithBufferedRead() throws IOException {
 testWithBufferedRead(LARGE_TEST_STRING, UTF-8);
 }
 
+@Test
 public void testUTF16WithSingleByteRead() throws IOException {
 testWithSingleByteRead(TEST_STRING, UTF-16);
 }
 
+@Test
 public void testReadZero() throws Exception {
 ReaderInputStream r = new ReaderInputStream(new StringReader(test));
 byte[] bytes = new byte[30];
 assertEquals(0, r.read(bytes, 0, 0));
 }
+
+/**
+ * Tests https://issues.apache.org/jira/browse/IO-277
+ * 
+ * @throws IOException
+ */
+@Test
+@Ignore
+public void testCharsetMismatchInfiniteLoop() throws IOException {
+// Input is UTF-8 bytes: 0xE0 0xB2 0xA0
+byte[] input = new byte[] { (byte) 0xE0, (byte) 0xB2, (byte) 0xA0 };
+char[] inputChars = new char[] { (char) 0xE0, (char) 0xB2, (char) 0xA0 
};
+System.out.println(Input:  + new String(input, 
Charset.forName(UTF-8)));
+
+// Charset charset = Charset.forName(UTF-8); // works
+Charset charset = Charset.forName(ASCII); // infinite loop
+
+ReaderInputStream stream = new ReaderInputStream(new 
CharArrayReader(inputChars), charset);
+try {
+while (stream.read() != -1) {
+}
+} finally {
+stream.close();
+}
+
+}
 }




svn commit: r1147916 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java

2011-07-18 Thread ggregory
Author: ggregory
Date: Mon Jul 18 15:01:52 2011
New Revision: 1147916

URL: http://svn.apache.org/viewvc?rev=1147916view=rev
Log:
Tests https://issues.apache.org/jira/browse/IO-277 (@Ignore'd). Port to JUnit 4.

Modified:

commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java?rev=1147916r1=1147915r2=1147916view=diff
==
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java
 Mon Jul 18 15:01:52 2011
@@ -26,10 +26,10 @@ import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.io.IOUtils;
-
 import junit.framework.TestCase;
 
+import org.apache.commons.io.IOUtils;
+
 /**
  * @author Alejandro Abdelnur
  */




svn commit: r1147948 - in /commons/sandbox/runtime/trunk/src/main/native: Makefile.unx.in os/darwin/kqueue.c os/unix/arch_defs.h

2011-07-18 Thread mturk
Author: mturk
Date: Mon Jul 18 16:15:05 2011
New Revision: 1147948

URL: http://svn.apache.org/viewvc?rev=1147948view=rev
Log:
Add mac/bsd kqueue selector. Needs some optimization and fixes

Added:
commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c   (with 
props)
Modified:
commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in
commons/sandbox/runtime/trunk/src/main/native/os/unix/arch_defs.h

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in?rev=1147948r1=1147947r2=1147948view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.unx.in Mon Jul 18 
16:15:05 2011
@@ -80,8 +80,10 @@ UNIX_SOURCES=\
$(TOPDIR)/os/unix/util.c
 
 BSDX_SOURCES=\
+   $(TOPDIR)/os/darwin/kqueue.c \
$(TOPDIR)/os/bsdx/os.c
 DARWIN_SOURCES=\
+   $(TOPDIR)/os/darwin/kqueue.c \
$(TOPDIR)/os/darwin/os.c
 HPUX_SOURCES=\
$(TOPDIR)/os/hpux/os.c

Added: commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c?rev=1147948view=auto
==
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c Mon Jul 18 
16:15:05 2011
@@ -0,0 +1,636 @@
+/* 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/clazz.h
+#include acr/memory.h
+#include acr/jniapi.h
+#include acr/port.h
+#include acr/time.h
+#include acr/iodefs.h
+#include acr/netapi.h
+#include acr/ring.h
+#include acr/misc.h
+#include arch_opts.h
+#include arch_sync.h
+#include poll.h
+#include sys/event.h
+
+/* pollset operation states */
+#define PSS_DESTROY 1
+#define PSS_POLL2
+#define PSS_WAIT3
+#define PSS_WAKEUP  4
+/* Max events for a single run
+ * Choosen to reflect the 4k page size
+ * PSS_SIZE * sizeof(struct kevent) ~= 4096
+ */
+#define PSS_SIZE256
+
+typedef struct pfd_elem_t pfd_elem_t;
+struct pfd_elem_t {
+ACR_RING_ENTRY(pfd_elem_t) link;
+intfd;
+short  efilter;
+short  revents;
+jobjectobj;
+acr_time_t ttl;
+acr_time_t exp;
+};
+
+typedef struct acr_pollset_t {
+/* A ring containing all of the pfd_elem_t that are active
+ */
+ACR_RING_HEAD(pfd_eset_ring_t, pfd_elem_t) eset_ring;
+/* A ring of pfd_elem_t that have been used, and then deleted
+ */
+ACR_RING_HEAD(pfd_free_ring_t, pfd_elem_t) free_ring;
+/* A ring of pfd_elem_t where rings that have been deleted but
+ * might still be inside a _epoll()
+ */
+ACR_RING_HEAD(pfd_dead_ring_t, pfd_elem_t) dead_ring;
+struct kevent   kev;
+struct kevent  *keset;
+int kqfd;
+int used;
+volatile acr_atomic32_t state;
+int wpipe[2];
+pthread_mutex_t mutex;
+pthread_cond_t  wakeup;
+} acr_pollset_t;
+
+J_DECLARE_CLAZZ = {
+INVALID_FIELD_OFFSET,
+0,
+0,
+0,
+ACR_NET_CP UnixSelector
+};
+
+J_DECLARE_M_ID() = {
+0,
+addSelected,
+(L ACR_NET_CP SelectionKeyImpl;S)V
+};
+
+static short iefilter(short event)
+{
+if (event  ACR_OP_INP)
+return EVFILT_READ;
+else
+return EVFILT_WRITE;
+}
+
+static short reventt(short event, short flag)
+{
+short rv = 0;
+
+if (event == EVFILT_READ)
+rv |= ACR_OP_INP;
+else if (event == EVFILT_WRITE)
+rv |= ACR_OP_OUT;
+if (flags  EV_EOF)
+rv |= ACR_OP_HANGUP;
+/*
+ * TODO: See if EV_ERROR + certain system errors in the returned data field
+ * should map to ACR_OP_NVAL.
+ */
+return rv;
+}
+
+ACR_NET_EXPORT(void, UnixSelector, init0)(JNI_STDARGS)
+{
+_clazzn.i = (jclass)(*env)-NewGlobalRef(env, obj);
+if (_clazzn.i == 0)
+   

svn commit: r1147950 - /commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c

2011-07-18 Thread mturk
Author: mturk
Date: Mon Jul 18 16:22:57 2011
New Revision: 1147950

URL: http://svn.apache.org/viewvc?rev=1147950view=rev
Log:
Axe copy/paste code

Modified:
commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c?rev=1147950r1=1147949r2=1147950view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/kqueue.c Mon Jul 18 
16:22:57 2011
@@ -93,7 +93,7 @@ static short iefilter(short event)
 return EVFILT_WRITE;
 }
 
-static short reventt(short event, short flag)
+static short reventt(short event, short flags)
 {
 short rv = 0;
 
@@ -432,59 +432,6 @@ ACR_NET_EXPORT(int, UnixSelector, destro
 return rc;
 }
 
-static int call_port_getn(int port, struct kevent list[],
-  unsigned int max, unsigned int *nget,
-  int timeout)
-{
-struct timespec tv, *tp = 0;
-int ret;
-int rv = 0;
-
-if (timeout = 0) {
-tp = tv;
-tp-tv_sec  = (long)(timeout / 1000);
-tp-tv_nsec = (long)(timeout % 1000) * 100;
-}
-
-list[0].portev_user = (void *)-1; /* so we can double check that an
-   * event was returned
-   */
-ret = port_getn(port, list, max, nget, tp);
-/* Note: 32-bit port_getn() on Solaris 10 x86 returns large negative 
- * values instead of 0 when returning immediately.
- */
-if (ret == -1) {
-rv = ACR_GET_NETOS_ERROR();
-switch(rv) {
-case EINTR:
-case ETIME:
-if (*nget  0  list[0].portev_user != (void *)-1) {
-/* This confusing API can return an event at the same time
- * that it reports EINTR or ETIME.  If that occurs, just
- * report the event.  With EINTR, nget can be  0 without
- * any event, so check that portev_user was filled in.
- *
- * (Maybe it will be simplified; see thread
- *   http://mail.opensolaris.org
- *   /pipermail/networking-discuss/2009-August/011979.html
- *  This code will still work afterwards.)
- */
-rv = 0;
-break;
-}
-if (rv == ETIME)
-rv = ACR_TIMEUP;
-/* fall-through */
-default:
-*nget = 0;
-break;
-}
-}
-else if (*nget == 0)
-rv = ACR_TIMEUP;
-return rv;
-}
-
 ACR_NET_EXPORT(void, UnixSelector, wait0)(JNI_STDARGS, jlong pollset,
   jobject sset,
   jint timeout, jboolean autocancel)




svn commit: r1147972 - /commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c

2011-07-18 Thread mturk
Author: mturk
Date: Mon Jul 18 17:07:25 2011
New Revision: 1147972

URL: http://svn.apache.org/viewvc?rev=1147972view=rev
Log:
Seems that haks don't work with all VMs

Modified:
commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c?rev=1147972r1=1147971r2=1147972view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c Mon Jul 18 
17:07:25 2011
@@ -335,10 +335,17 @@ ACR_JNI_EXPORT(jint, TestUnsafe, test0)(
 ACR_JNI_EXPORT(jobject, TestUnsafe, test1)(JNI_STDARGS, jobject o, jint off)
 {
 if (o != 0  off  0) {
+#if 0
+/* This doesn't work on all VM's
+ * Seems objects can be compresses so just use the JNI call.
+ */
 char *oa = *(char **)o;
 if (oa != 0) {
 return (jobject)(oa + (ptrdiff_t)off);
 }
+#else
+return CALL_METHOD2(Object, , _unsafe_instance, o, off);
+#endif
 }
 return 0;
 }




svn commit: r1147977 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java

2011-07-18 Thread ggregory
Author: ggregory
Date: Mon Jul 18 17:19:05 2011
New Revision: 1147977

URL: http://svn.apache.org/viewvc?rev=1147977view=rev
Log:
Implement sebb's suggestions. Thank you Sebb.

Modified:

commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java

Modified: 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java?rev=1147977r1=1147976r2=1147977view=diff
==
--- 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
 (original)
+++ 
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/ReaderInputStreamTest.java
 Mon Jul 18 17:19:05 2011
@@ -120,13 +120,9 @@ public class ReaderInputStreamTest {
 @Ignore
 public void testCharsetMismatchInfiniteLoop() throws IOException {
 // Input is UTF-8 bytes: 0xE0 0xB2 0xA0
-byte[] input = new byte[] { (byte) 0xE0, (byte) 0xB2, (byte) 0xA0 };
 char[] inputChars = new char[] { (char) 0xE0, (char) 0xB2, (char) 0xA0 
};
-System.out.println(Input:  + new String(input, 
Charset.forName(UTF-8)));
-
 // Charset charset = Charset.forName(UTF-8); // works
 Charset charset = Charset.forName(ASCII); // infinite loop
-
 ReaderInputStream stream = new ReaderInputStream(new 
CharArrayReader(inputChars), charset);
 try {
 while (stream.read() != -1) {
@@ -134,6 +130,5 @@ public class ReaderInputStreamTest {
 } finally {
 stream.close();
 }
-
 }
 }




svn commit: r1147979 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/Unsafe.java native/shared/unsafe.c test/org/apache/commons/runtime/TestUnsafe.java

2011-07-18 Thread mturk
Author: mturk
Date: Mon Jul 18 17:23:23 2011
New Revision: 1147979

URL: http://svn.apache.org/viewvc?rev=1147979view=rev
Log:
Allow ant test without --enable-test-private

Modified:

commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c

commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java

Modified: 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java?rev=1147979r1=1147978r2=1147979view=diff
==
--- 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
 (original)
+++ 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
 Mon Jul 18 17:23:23 2011
@@ -36,6 +36,7 @@ public final class Unsafe
 private static native int   getOffset0(Field f);
 private static native int   getOffset1(Field f);
 private static native int   getBase0(Field f);
+private static native ObjectgetObject0(Object o, int off);
 
 private static native int   peek0(long ptr);
 private static native long  peek1(long ptr);
@@ -115,6 +116,19 @@ public final class Unsafe
 return getOffset1(field);
 }
 
+/**
+ * Fetches a reference value from a given Java variable.
+ */
+public static Object getObject(Object o, int offset)
+throws UnsupportedOperationException, IllegalArgumentException
+{
+if (unsafe == null)
+throw new UnsupportedOperationException();
+if (o == null || offset  0)
+throw new IllegalArgumentException();
+return getObject0(o, offset);
+}
+
 private static native char[] getchr0(String str);
 /**
  *  Get the {@code str} private character array.

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c?rev=1147979r1=1147978r2=1147979view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c Mon Jul 18 
17:23:23 2011
@@ -200,6 +200,14 @@ ACR_JNI_EXPORT(jint, Unsafe, getBase0)(J
 return AcrUnsafeStaticFieldBase(env, field);
 }
 
+ACR_JNI_EXPORT(jobject, Unsafe, getObject0)(JNI_STDARGS, jobject o, jint off)
+{
+if (!CLAZZ_LOADED)
+return 0;
+else
+return CALL_METHOD2(Object, , _unsafe_instance, o, off);
+}
+
 ACR_JNI_EXPORT(jint,  Unsafe, peek0)(JNI_STDARGS, jlong ptr)
 {
 char *buf = J2P(ptr, char *);
@@ -332,22 +340,21 @@ ACR_JNI_EXPORT(jint, TestUnsafe, test0)(
 return 0;
 }
 
+#if 0
 ACR_JNI_EXPORT(jobject, TestUnsafe, test1)(JNI_STDARGS, jobject o, jint off)
 {
 if (o != 0  off  0) {
-#if 0
-/* This doesn't work on all VM's
- * Seems objects can be compresses so just use the JNI call.
+/* This doesn't seems to work on all VM's
+ * Objects can be compressed(?) so it can core the JVM.
+ * ... really Unsafe ;)
  */
 char *oa = *(char **)o;
 if (oa != 0) {
 return (jobject)(oa + (ptrdiff_t)off);
 }
-#else
-return CALL_METHOD2(Object, , _unsafe_instance, o, off);
-#endif
 }
 return 0;
 }
+#endif
 
 #endif

Modified: 
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java?rev=1147979r1=1147978r2=1147979view=diff
==
--- 
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java
 (original)
+++ 
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java
 Mon Jul 18 17:23:23 2011
@@ -44,7 +44,14 @@ public class TestUnsafe extends Assert
 throws Exception
 {
 int off = 
Unsafe.objectFieldOffset(TestUnsafe.class.getDeclaredField(i));
-assertEquals(test0(this, off), i);
+int val = 0;
+try {
+val = test0(this, off);
+} catch (UnsatisfiedLinkError e) {
+// Runtime was compiled without --enable-test-private
+val = i;
+}
+assertEquals(val, i);
 }
 
 @Test(groups = { private })
@@ -52,7 +59,7 @@ public class TestUnsafe extends Assert
 throws Exception
 {
 int off = 
Unsafe.objectFieldOffset(TestUnsafe.class.getDeclaredField(s));
-assertEquals((String)test1(this, off), hello world);
+

svn commit: r1147999 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/Unsafe.java native/shared/unsafe.c test/org/apache/commons/runtime/TestUnsafe.java

2011-07-18 Thread mturk
Author: mturk
Date: Mon Jul 18 18:36:29 2011
New Revision: 1147999

URL: http://svn.apache.org/viewvc?rev=1147999view=rev
Log:
Add more unsafe object put/get wrappers

Modified:

commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c

commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUnsafe.java

Modified: 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java?rev=1147999r1=1147998r2=1147999view=diff
==
--- 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
 (original)
+++ 
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Unsafe.java
 Mon Jul 18 18:36:29 2011
@@ -37,6 +37,9 @@ public final class Unsafe
 private static native int   getOffset1(Field f);
 private static native int   getBase0(Field f);
 private static native ObjectgetObject0(Object o, int off);
+private static native ObjectgetObject1(Object o, int off);
+private static native void  putObject0(Object o, int off, Object 
v);
+private static native void  putObject1(Object o, int off, Object 
v);
 
 private static native int   peek0(long ptr);
 private static native long  peek1(long ptr);
@@ -129,6 +132,59 @@ public final class Unsafe
 return getObject0(o, offset);
 }
 
+/**
+ * Fetches a reference value from a given Java variable with volatile
+ * load semantics.
+ */
+public static Object getObjectVolatile(Object o, int offset)
+throws UnsupportedOperationException, IllegalArgumentException
+{
+if (unsafe == null)
+throw new UnsupportedOperationException();
+if (o == null || offset  0)
+throw new IllegalArgumentException();
+return getObject0(o, offset);
+}
+
+/**
+ * Stores a reference value into a given Java variable.
+ * p
+ * Unless the reference {@code x} being stored is either null
+ * or matches the field type, the results are undefined.
+ * If the reference {@code o} is non-null, car marks or
+ * other store barriers for that object (if the VM requires them)
+ * are updated.
+ */
+public static void putObject(Object o, int offset, Object x)
+throws UnsupportedOperationException, IllegalArgumentException
+{
+if (unsafe == null)
+throw new UnsupportedOperationException();
+if (o == null || offset  0)
+throw new IllegalArgumentException();
+putObject0(o, offset, x);
+}
+
+/**
+ * Stores a reference value into a given Java variable
+ * with a volatile sementics.
+ * p
+ * Unless the reference {@code x} being stored is either null
+ * or matches the field type, the results are undefined.
+ * If the reference {@code o} is non-null, car marks or
+ * other store barriers for that object (if the VM requires them)
+ * are updated.
+ */
+public static void putObjectVolatile(Object o, int offset, Object x)
+throws UnsupportedOperationException, IllegalArgumentException
+{
+if (unsafe == null)
+throw new UnsupportedOperationException();
+if (o == null || offset  0)
+throw new IllegalArgumentException();
+putObject0(o, offset, x);
+}
+
 private static native char[] getchr0(String str);
 /**
  *  Get the {@code str} private character array.

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c?rev=1147999r1=1147998r2=1147999view=diff
==
--- commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/unsafe.c Mon Jul 18 
18:36:29 2011
@@ -43,29 +43,41 @@ J_DECLARE_M_ID() = {
 
 J_DECLARE_M_ID(0001) = {
 0,
+getObjectVolatile,
+(Ljava/lang/Object;J)Ljava/lang/Object;
+};
+
+J_DECLARE_M_ID(0002) = {
+0,
 putObject,
 (Ljava/lang/Object;JLjava/lang/Object;)V
 };
 
-J_DECLARE_M_ID(0002) = {
+J_DECLARE_M_ID(0003) = {
+0,
+putObjectVolatile,
+(Ljava/lang/Object;JLjava/lang/Object;)V
+};
+
+
+J_DECLARE_M_ID(0004) = {
 0,
 objectFieldOffset,
 (Ljava/lang/reflect/Field;)J
 };
 
-J_DECLARE_M_ID(0003) = {
+J_DECLARE_M_ID(0005) = {
 0,
 staticFieldBase,
 (Ljava/lang/reflect/Field;)Ljava/lang/Object;
 };
 
-J_DECLARE_M_ID(0004) = {
+J_DECLARE_M_ID(0006) = {
 0,
 staticFieldOffset,
 (Ljava/lang/reflect/Field;)J
 };
 
-
 

svn commit: r1148135 - /commons/proper/lang/tags/LANG_3_0/

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 03:28:54 2011
New Revision: 1148135

URL: http://svn.apache.org/viewvc?rev=1148135view=rev
Log:
RC4 is the one; releasing 3.0

Added:
commons/proper/lang/tags/LANG_3_0/
  - copied from r1148134, commons/proper/lang/tags/LANG_3_0_RC4/



svn commit: r1148137 - in /commons/proper/lang/trunk: default.properties pom.xml

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 03:38:19 2011
New Revision: 1148137

URL: http://svn.apache.org/viewvc?rev=1148137view=rev
Log:
Updating version number to 3.0.1-SNAPSHOT

Modified:
commons/proper/lang/trunk/default.properties
commons/proper/lang/trunk/pom.xml

Modified: commons/proper/lang/trunk/default.properties
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/default.properties?rev=1148137r1=1148136r2=1148137view=diff
==
--- commons/proper/lang/trunk/default.properties (original)
+++ commons/proper/lang/trunk/default.properties Tue Jul 19 03:38:19 2011
@@ -39,7 +39,7 @@ component.package = org.apache.commons.l
 component.title = Core Language Utilities
 
 # The current version number of this component
-component.version = 3.0
+component.version = 3.0.1-SNAPSHOT
 
 # The name that is used to create the jar file
 final.name = ${component.name}-${component.version}

Modified: commons/proper/lang/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1148137r1=1148136r2=1148137view=diff
==
--- commons/proper/lang/trunk/pom.xml (original)
+++ commons/proper/lang/trunk/pom.xml Tue Jul 19 03:38:19 2011
@@ -27,7 +27,7 @@
   modelVersion4.0.0/modelVersion
   groupIdorg.apache.commons/groupId
   artifactIdcommons-lang3/artifactId
-  version3.0/version
+  version3.0.1-SNAPSHOT/version
   nameCommons Lang/name
 
   inceptionYear2001/inceptionYear




svn commit: r1148139 - /commons/proper/lang/trunk/doap_lang.rdf

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 03:40:16 2011
New Revision: 1148139

URL: http://svn.apache.org/viewvc?rev=1148139view=rev
Log:
Adding 3.0 and 2.6 to the doap file

Modified:
commons/proper/lang/trunk/doap_lang.rdf

Modified: commons/proper/lang/trunk/doap_lang.rdf
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/doap_lang.rdf?rev=1148139r1=1148138r2=1148139view=diff
==
--- commons/proper/lang/trunk/doap_lang.rdf (original)
+++ commons/proper/lang/trunk/doap_lang.rdf Tue Jul 19 03:40:16 2011
@@ -40,6 +40,16 @@
 release
   Version
 namecommons-lang/name
+created2011-07-18/created
+revision3.0/revision
+  /Version
+  Version
+namecommons-lang/name
+created2011-01-17/created
+revision2.6/revision
+  /Version
+  Version
+namecommons-lang/name
 created2010-02-25/created
 revision2.5/revision
   /Version




svn commit: r1148140 - /commons/proper/lang/trunk/src/site/changes/changes.xml

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 03:41:22 2011
New Revision: 1148140

URL: http://svn.apache.org/viewvc?rev=1148140view=rev
Log:
Setting 3.0 release date

Modified:
commons/proper/lang/trunk/src/site/changes/changes.xml

Modified: commons/proper/lang/trunk/src/site/changes/changes.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/site/changes/changes.xml?rev=1148140r1=1148139r2=1148140view=diff
==
--- commons/proper/lang/trunk/src/site/changes/changes.xml (original)
+++ commons/proper/lang/trunk/src/site/changes/changes.xml Tue Jul 19 03:41:22 
2011
@@ -21,7 +21,7 @@
   /properties
   body
 
-  release version=3.0 date=Unreleased description=Backwards incompatible 
update of Commons Lang to Java 5  
+  release version=3.0 date=2011-07-18 description=Backwards incompatible 
update of Commons Lang to Java 5  
 action type=fix issue=LANG-720StringEscapeUtils.escapeXml(input) 
outputs wrong results when an input contains characters in Supplementary 
Planes./action
 action type=update issue=LANG-718build.xml Java 1.5+ 
updates./action
 action type=fix issue=LANG-716swapCase and *capitalize 
speedups./action




svn commit: r1148152 - in /commons/proper/lang/trunk: build.xml default.properties pom.xml

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 04:32:56 2011
New Revision: 1148152

URL: http://svn.apache.org/viewvc?rev=1148152view=rev
Log:
Applying Ville Skyttä's LANG-717 patch to force the encoding in Ant and Maven 
builds to ISO-8859-1; stopping reported ugly output if your system is running 
in UTF-8

Modified:
commons/proper/lang/trunk/build.xml
commons/proper/lang/trunk/default.properties
commons/proper/lang/trunk/pom.xml

Modified: commons/proper/lang/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/build.xml?rev=1148152r1=1148151r2=1148152view=diff
==
--- commons/proper/lang/trunk/build.xml (original)
+++ commons/proper/lang/trunk/build.xml Tue Jul 19 04:32:56 2011
@@ -59,7 +59,7 @@
 !-- == Compile Targets = 
--
 target name=compile depends=init description=Compile shareable 
components
 mkdir dir=${build.home}/classes/
-javac srcdir=${source.home} destdir=${build.home}/classes 
debug=${compile.debug} deprecation=${compile.deprecation} 
target=${compile.target} source=${compile.source} 
excludes=${compile.excludes} optimize=${compile.optimize} 
includeantruntime=false
+javac srcdir=${source.home} destdir=${build.home}/classes 
debug=${compile.debug} deprecation=${compile.deprecation} 
target=${compile.target} source=${compile.source} 
excludes=${compile.excludes} optimize=${compile.optimize} 
includeantruntime=false encoding=${compile.encoding}
 classpath refid=compile.classpath/
 /javac
 copy todir=${build.home}/classes filtering=on
@@ -69,7 +69,7 @@
 
 target name=compile.tests depends=compile description=Compile unit 
test cases
 mkdir dir=${build.home}/tests/
-javac srcdir=${test.home} destdir=${build.home}/tests 
debug=${compile.debug} deprecation=off target=${compile.target} 
source=${compile.source} optimize=${compile.optimize} 
includeantruntime=false
+javac srcdir=${test.home} destdir=${build.home}/tests 
debug=${compile.debug} deprecation=off target=${compile.target} 
source=${compile.source} optimize=${compile.optimize} 
includeantruntime=false encoding=${compile.encoding}
 classpath refid=test.classpath/
 /javac
 copy todir=${build.home}/tests filtering=on
@@ -120,6 +120,7 @@
  bottom=Copyright amp;copy; 2001-${current.year} - Apache 
Software Foundation 
  use=true 
  link=${jdk.javadoc} 
+ encoding=${compile.encoding}
  source=${compile.source}
 classpath refid=compile.classpath/
 /javadoc

Modified: commons/proper/lang/trunk/default.properties
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/default.properties?rev=1148152r1=1148151r2=1148152view=diff
==
--- commons/proper/lang/trunk/default.properties (original)
+++ commons/proper/lang/trunk/default.properties Tue Jul 19 04:32:56 2011
@@ -77,6 +77,9 @@ compile.target = 1.5
 # Valid values are 1.3, 1.4, 1.5. 
 compile.source = 1.5
 
+# Specifies the source encoding.
+compile.encoding = ISO-8859-1
+
 # Should all tests fail if one does?
 test.failonerror = true
 

Modified: commons/proper/lang/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/pom.xml?rev=1148152r1=1148151r2=1148152view=diff
==
--- commons/proper/lang/trunk/pom.xml (original)
+++ commons/proper/lang/trunk/pom.xml Tue Jul 19 04:32:56 2011
@@ -441,7 +441,7 @@
   /dependencies
 
   properties
-project.build.sourceEncodingUTF-8/project.build.sourceEncoding
+project.build.sourceEncodingISO-8859-1/project.build.sourceEncoding
 project.reporting.outputEncodingUTF-8/project.reporting.outputEncoding
 maven.compile.source1.5/maven.compile.source
 maven.compile.target1.5/maven.compile.target




svn commit: r1148162 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 04:58:03 2011
New Revision: 1148162

URL: http://svn.apache.org/viewvc?rev=1148162view=rev
Log:
Updating unit test for LANG-728 to work with Lang 3.0 way of using escapeXml 
with  0x7f characters

Modified:

commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java

Modified: 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java?rev=1148162r1=1148161r2=1148162view=diff
==
--- 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
 (original)
+++ 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
 Tue Jul 19 04:58:03 2011
@@ -31,6 +31,9 @@ import org.apache.commons.io.IOUtils;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import org.apache.commons.lang3.text.translate.CharSequenceTranslator;
+import org.apache.commons.lang3.text.translate.UnicodeEscaper;
+
 /**
  * Unit tests for {@link StringEscapeUtils}.
  *
@@ -333,15 +336,13 @@ public class StringEscapeUtilsTest {
  * @see a 
href=http://www.w3.org/International/questions/qa-escapes;Using character 
escapes in markup and CSS/a
  * @see a 
href=https://issues.apache.org/jira/browse/LANG-728;LANG-728/a
  */
-@Ignore
 @Test
 public void testEscapeXmlSupplementaryCharacters() {
-// Example from https://issues.apache.org/jira/browse/LANG-728
-assertEquals(Supplementary character must be represented using a 
single escape, #144308;,
-StringEscapeUtils.escapeXml(\uD84C\uDFB4));
-// Example from See 
http://www.w3.org/International/questions/qa-escapes
-assertEquals(Supplementary character must be represented using a 
single escape, #x233B4;,
-StringEscapeUtils.escapeXml(\uD84C;\uDFB4;));
+CharSequenceTranslator escapeXml = 
+StringEscapeUtils.ESCAPE_XML.with( UnicodeEscaper.between(0x7f, 
Integer.MAX_VALUE) );
+
+assertEquals(Supplementary character must be represented using a 
single escape, \u233B4,
+escapeXml.translate(\uD84C\uDFB4));
 }
 
 // Tests issue #38569




svn commit: r1148163 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 05:04:00 2011
New Revision: 1148163

URL: http://svn.apache.org/viewvc?rev=1148163view=rev
Log:
Dropping Ignore import

Modified:

commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java

Modified: 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java?rev=1148163r1=1148162r2=1148163view=diff
==
--- 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
 (original)
+++ 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
 Tue Jul 19 05:04:00 2011
@@ -28,7 +28,6 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.Modifier;
 
 import org.apache.commons.io.IOUtils;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import org.apache.commons.lang3.text.translate.CharSequenceTranslator;




svn commit: r1148164 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 05:08:14 2011
New Revision: 1148164

URL: http://svn.apache.org/viewvc?rev=1148164view=rev
Log:
Fixing javadoc - it was pointing to the wrong translator

Modified:

commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java

Modified: 
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java?rev=1148164r1=1148163r2=1148164view=diff
==
--- 
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
 (original)
+++ 
commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringEscapeUtils.java
 Tue Jul 19 05:08:14 2011
@@ -496,7 +496,7 @@ public class StringEscapeUtils {
  * pNote that unicode characters greater than 0x7f are as of 3.0, no 
longer 
  *escaped. If you still wish this functionality, you can achieve it 
  *via the following: 
- * {@code StringEscapeUtils.ESCAPE_XML.with( UnicodeEscaper.between(0x7f, 
Integer.MAX_VALUE) );}/p
+ * {@code StringEscapeUtils.ESCAPE_XML.with( 
NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );}/p
  *
  * @param input  the {@code String} to escape, may be null
  * @return a new escaped {@code String}, {@code null} if null string input




svn commit: r1148166 - /commons/proper/lang/trunk/src/site/xdoc/article3_0.xml

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 05:09:46 2011
New Revision: 1148166

URL: http://svn.apache.org/viewvc?rev=1148166view=rev
Log:
Fixing documentation; it was pointing to UnicodeEscaper and not 
NumericEntityEscaper. Also updated the API to not be Range based as we dropped 
that. 

Modified:
commons/proper/lang/trunk/src/site/xdoc/article3_0.xml

Modified: commons/proper/lang/trunk/src/site/xdoc/article3_0.xml
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/site/xdoc/article3_0.xml?rev=1148166r1=1148165r2=1148166view=diff
==
--- commons/proper/lang/trunk/src/site/xdoc/article3_0.xml (original)
+++ commons/proper/lang/trunk/src/site/xdoc/article3_0.xml Tue Jul 19 05:09:46 
2011
@@ -142,14 +142,14 @@ available in the a href=userguide.html
 /pre
 pHere we see that codeESCAPE_XML/code is a 
'codeCharSequenceTranslator/code', which in turn is made up of two lookup 
translators based on the basic XML escapes and another to escape apostrophes. 
This shows one way to combine translators. Another can be shown by looking at 
the example to achieve the old XML escaping functionality (escaping non-ASCII): 
/p
 pre
-  StringEscapeUtils.ESCAPE_XML.with( new 
UnicodeEscaper(Range.between(0x7f, Integer.MAX_VALUE) ) );
+  StringEscapeUtils.ESCAPE_XML.with( 
NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );
 /pre
 pThat takes the standard Commons Lang provided escape functionality, and 
adds on another translation layer. Another JIRA requested option was to also 
escape non-printable ASCII, this is now achievable with a modification of the 
above: /p
 pre
   StringEscapeUtils.ESCAPE_XML.with(
   new AggregateTranslator(
-  new UnicodeEscaper(Range.between(0, 31)),
-  new UnicodeEscaper(Range.between(0x80, Integer.MAX_VALUE))
+  NumericEntityEscaper.between(0, 31),
+  NumericEntityEscaper.between(0x80, Integer.MAX_VALUE)
   )
   )
 /pre




svn commit: r1148167 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 05:10:03 2011
New Revision: 1148167

URL: http://svn.apache.org/viewvc?rev=1148167view=rev
Log:
Fixing test to use the right escaper; numeric entities and not unicode. LANG-728

Modified:

commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java

Modified: 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java?rev=1148167r1=1148166r2=1148167view=diff
==
--- 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
 (original)
+++ 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
 Tue Jul 19 05:10:03 2011
@@ -31,7 +31,7 @@ import org.apache.commons.io.IOUtils;
 import org.junit.Test;
 
 import org.apache.commons.lang3.text.translate.CharSequenceTranslator;
-import org.apache.commons.lang3.text.translate.UnicodeEscaper;
+import org.apache.commons.lang3.text.translate.NumericEntityEscaper;
 
 /**
  * Unit tests for {@link StringEscapeUtils}.
@@ -338,9 +338,9 @@ public class StringEscapeUtilsTest {
 @Test
 public void testEscapeXmlSupplementaryCharacters() {
 CharSequenceTranslator escapeXml = 
-StringEscapeUtils.ESCAPE_XML.with( UnicodeEscaper.between(0x7f, 
Integer.MAX_VALUE) );
+StringEscapeUtils.ESCAPE_XML.with( 
NumericEntityEscaper.between(0x7f, Integer.MAX_VALUE) );
 
-assertEquals(Supplementary character must be represented using a 
single escape, \u233B4,
+assertEquals(Supplementary character must be represented using a 
single escape, #144308;,
 escapeXml.translate(\uD84C\uDFB4));
 }
 




svn commit: r1148172 - /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java

2011-07-18 Thread bayard
Author: bayard
Date: Tue Jul 19 05:17:03 2011
New Revision: 1148172

URL: http://svn.apache.org/viewvc?rev=1148172view=rev
Log:
Adding a unit test for LANG-729

Modified:

commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java

Modified: 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java?rev=1148172r1=1148171r2=1148172view=diff
==
--- 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
 (original)
+++ 
commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringEscapeUtilsTest.java
 Tue Jul 19 05:17:03 2011
@@ -32,6 +32,7 @@ import org.junit.Test;
 
 import org.apache.commons.lang3.text.translate.CharSequenceTranslator;
 import org.apache.commons.lang3.text.translate.NumericEntityEscaper;
+import org.apache.commons.lang3.text.translate.NumericEntityUnescaper;
 
 /**
  * Unit tests for {@link StringEscapeUtils}.
@@ -344,6 +345,17 @@ public class StringEscapeUtilsTest {
 escapeXml.translate(\uD84C\uDFB4));
 }
 
+/**
+ * Reverse of the above.
+ *
+ * @see a 
href=https://issues.apache.org/jira/browse/LANG-729;LANG-729/a
+ */
+@Test
+public void testUnescapeXmlSupplementaryCharacters() {
+assertEquals(Supplementary character must be represented using a 
single escape, \uD84C\uDFB4,
+StringEscapeUtils.unescapeXml(#144308;) );
+}
+
 // Tests issue #38569
 // http://issues.apache.org/bugzilla/show_bug.cgi?id=38569
 @Test