Author: mturk Date: Mon Apr 18 22:13:39 2011 New Revision: 1094793 URL: http://svn.apache.org/viewvc?rev=1094793&view=rev Log: Add shortcut to Status.describe(Status.errno())
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Status.java commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java commons/sandbox/runtime/trunk/src/main/native/shared/error.c Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Status.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Status.java?rev=1094793&r1=1094792&r2=1094793&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Status.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Status.java Mon Apr 18 22:13:39 2011 @@ -478,5 +478,10 @@ public class Status * last-error code. */ public static native int errno(); + + /** Return the calling thread's last-error message. + * + */ + public static native String msg(); } Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java?rev=1094793&r1=1094792&r2=1094793&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Security.java Mon Apr 18 22:13:39 2011 @@ -100,7 +100,7 @@ final class Security long sh = ConvertStringSecurityDescriptorToSecurityDescriptor(desc, SDDL_REVISION_1); if (sh == 0L) { // Throw SystemException - throw new SystemException(Status.describe(Status.errno())); + throw new SystemException(Status.msg()); } sd = new Long(sh); sdcache.put(desc, sd); Modified: commons/sandbox/runtime/trunk/src/main/native/shared/error.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/error.c?rev=1094793&r1=1094792&r2=1094793&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/shared/error.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/shared/error.c Mon Apr 18 22:13:39 2011 @@ -922,3 +922,11 @@ ACR_JNI_EXPORT(jint, Status, errno)(JNI_ { return AcrGetThreadError(); } + +ACR_JNI_EXPORT(jstring, Status, err)(JNI_STDARGS) +{ + char buf[ACR_MBUFF_SIZ] = ""; + + _cr_strerror_r(AcrGetThreadError(), buf, ACR_MBUFF_SIZ); + return AcrNewJavaStringA(env, buf); +}