Re: Binary to Base64 Conversion

2017-05-16 Thread Keith Suderman

> On May 15, 2017, at 7:56 PM, RJ  wrote:
> 
> the first problem is encoding. its coming in an encoded format that 
> decodeBase64 cannot understand.

What does your vendor mean by "binary on top of base64"?  I suspect they are 
sending a byte[] that you are reading into a String object rather than treating 
it as a byte array.

> 
> Whats the equivalent of the following in groovy script?
> 
> env.put("java.naming.ldap.attributes.binary","APPUID");

If that is Java code then the "Groovy script" is exactly the same.  However, 
I'm starting to suspect an XY problem here... what are you really trying to 
accomplish?

Cheers,
Keith

> 
> Thanks Guys
> 
> On Sun, May 14, 2017 at 12:25 PM, RJ  > wrote:
> the first problem is encoding. its coming in an encoded format that 
> decodeBase64 cannot understand.
> 
> Whats the equivalent of the following in groovy script?
> 
> env.put("java.naming.ldap.attributes.binary","APPUID");
> 
> Thanks Guys
> 
> On Sun, May 14, 2017 at 6:59 AM, Jeff Cave  > wrote:
> I don't think this is not a Groovy problem, so much as a general programming 
> problem.
> 
> The first thing I would point out is that in your example APPUID is not 
> base64encoded, there is nothing to base64decode.
> 
> https://en.wikipedia.org/wiki/Base64 
> 
> I notice that in your example, APPUID is 16 characters. Is APPUID a UUID 
> (basically a 16-byte integer)?
> 
> If so, 
> You may be looking to create an object of type `java.util.UUID`. 
> You could also possibly use `java.math.BigInteger`
> Converting the binary array to a String in hex notation may also be 
> meaningful.
> It all depends on what your final intention is.
> 
> Jeff Cave
> 
> 
> On 14 May 2017 at 05:27, RJ mailto:ssogu...@gmail.com>> 
> wrote:
> getBytes() disrupts the base64 format:
> 
>  [B.decodeBase64() is applicable for argument types: () values: []
> Possible solutions: encodeBase64(), encodeBase64(boolean)>
> org.codehaus.groovy.runtime.In 
> vokerInvocationException: 
> groovy.lang.MissingMethodException: No signature of method: [B.decodeBase64() 
> is applicable for argument types: () values: []
> Possible solutions: encodeBase64(), encodeBase64(boolean)
> 
> Thanks
> 
> 
> On Sat, May 13, 2017 at 12:55 AM, Nelson, Erick  > wrote:
> can appuid be read as bytes ( byte[] ) ??
> if So , then try then decodeBase64(byte[]) method maybe?
> 
> Erick Nelson
> Senior Developer
> HD Supply, FM
> Cell 858-740-6523 
> Home 760-930-0461 
> 
> CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and 
> may contain information that is confidential, proprietary or exempt from 
> disclosure, and subject to terms at: http://www.hdsupply.com/email 
> .
> 
> From: RJ mailto:ssogu...@gmail.com>>
> Reply-To: "users@groovy.apache.org " 
> mailto:users@groovy.apache.org>>
> Date: Friday, May 12, 2017 at 8:17 PM
> To: "users@groovy.apache.org " 
> mailto:users@groovy.apache.org>>
> Subject: Re: Binary to Base64 Conversion
> 
> Erick,
> 
> Thanks for the response.
> 
> The binary value from the webservice is 
> 
> APPUID=.�&Y���A�Tzg�<�^,
> 
> The vendor tells me its binary on top of base64. If I try decodeBase64() on 
> this, it throws: bad character in base64 value
> I guess I need to convert it first from binary to base64 format, and then 
> decodeBase64().
> 
> 
> I don't find binary to base64 decoding in the link.
> 
> On Fri, May 12, 2017 at 10:07 PM, Nelson, Erick  > wrote:
> Apache Commons codec
> 
> https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Base64.html
>  
> 
> 
> Erick Nelson
> Senior Developer
> HD Supply, FM
> Cell 858-740-6523 
> Home 760-930-0461 
> 
> CONFIDENTIALITY NOTICE: This message is for intended addressee(s) only and 
> may contain information that is confidential, proprietary or exempt from 
> disclosure, and subject to terms at: http://www.hdsupply.com/email 
> .
> 
> From: RJ mailto:ssogu...@gmail.com>>
> Reply-To: "users@groovy.apache.org " 
> mailto:users@groovy.apache.org>>
> Date: Friday, May 12, 2017 at 7:05 PM
> To: "users@groovy.apache.org " 
> mailto:users@groovy.apache.org>>
> Subject: Binary to Base64 Conversion
> 
> I have to deal with a binary value of base64 ID in a groovy script. So, first 
> I need to covert binary data to base64 format and then d

Re: Version Hell

2017-05-16 Thread russellr
Thanks for your reply.

It turns out my original problem was actually a bug in my angular code (a
race condition), so the tests were actually picking up that problem.

I'm back to using the original versions for now.

However, I would like to upgrade the versions, if possible, in any case.

Version 2.4.7 still produces the StackOverflowError.

Here's a longer stack trace from version 2.4.7 (the complete one goes on for
1000's of lines, so I think it must be an infinite recursion process that's
going on):

 java.lang.StackOverflowError
at
org.codehaus.groovy.runtime.MetaClassHelper.getClassWithNullAndWrapper(MetaClassHelper.java:870)
at
org.codehaus.groovy.runtime.MetaClassHelper.sameClasses(MetaClassHelper.java:862)
at
groovy.lang.MetaClassImpl.getNormalMethodWithCaching(MetaClassImpl.java:1369)
at
groovy.lang.MetaClassImpl.getMethodWithCaching(MetaClassImpl.java:1292)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1062)
at
groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1125)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)
at
org.codehaus.groovy.runtime.metaclass.OwnedMetaClass.invokeMethod(OwnedMetaClass.java:100)
at geb.Browser.invokeMethod(Browser.groovy)
at
org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:48)
at
org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:58)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at geb.Browser.getPage(Browser.groovy:90)
at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at
org.codehaus.groovy.runtime.metaclass.MixinInstanceMetaMethod.invoke(MixinInstanceMetaMethod.java:56)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1215)
at
groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1125)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)
at
org.codehaus.groovy.runtime.metaclass.OwnedMetaClass.invokeMethod(OwnedMetaClass.java:100)
at geb.Browser.invokeMethod(Browser.groovy)
at
org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:48)
at
org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:58)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:158)
at geb.Browser.methodMissing(Browser.groovy:209)
at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at
org.codehaus.groovy.runtime.metaclass.MixinInstanceMetaMethod.invoke(MixinInstanceMetaMethod.java:56)
at
groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:941)
at
groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1217)
at
groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1125)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:812)
at
org.codehaus.groovy.runtime.metaclass.OwnedMetaClass.invokeMethod(OwnedMetaClass.java:100)
at geb.Browser.invokeMethod(Browser.groovy)
at
org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:48)
at
org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:58)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at geb.Browser.createPage(Browser.groovy:854)
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at
org.codehaus.groovy.runtime.metaclass.MixinInstanceMetaMethod.invoke(MixinInstanceMetaMethod.java:56)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.jav

Re: Version Hell

2017-05-16 Thread Jochen Theodorou

On 16.05.2017 04:55, russellr wrote:
[...]

Here are the relevant versions that *used* to work:
1.1.5
2.12.2
2.1.6
0.9.2
2.38.0

If I upgrade Geb to 1.1.1, I get:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError:
org/codehaus/groovy/runtime/typehandling/ShortTypeHandling


yes, this came later in, with bytecode directly referencing the class.


If I *then* upgrade Groovy to 2.4.11 or later I get:

java.lang.StackOverflowError
at java.lang.ThreadLocal.get(ThreadLocal.java:143)
at
java.util.concurrent.locks.ReentrantReadWriteLock$Sync.tryReleaseShared(ReentrantReadWriteLock.java:426)
at
java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1340)
at
java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.unlock(ReentrantReadWriteLock.java:883)
at
groovy.lang.ExpandoMetaClass.checkInitalised(ExpandoMetaClass.java:837)

The StackOverflowError appears to be triggered by a simple "Given":
Given(~'I am on the reference page for (.+)') { String path ->
}


how about the suggested Groovy 2.4.7? To make something out of the 
Stackoverflow error, I would need a bit more fodder.


bye Jochen