I'm frustrated at the moment with a NetRexx problem I have not seen before, but I'm sure is easy to fix. This is a segment of a trace of what happens to be an njPipes stage. The class is running under options binary
49 gets an object that is at least able to be presented as a string: "the left". But 50 then can not cast it to a type Rexx. Can't cast String to Rexx ???? It should be automatic, shouldn't it? Incidentally, line 49 originally was lineP = Rexx peekto() that was not liked, so I split it into two lines, which as you see did no good. Any help in pointing to a solution would be gratefully accepted.
Thank you. _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
There's an oddity in Java that I now have completely
forgotten the details of, but there's a security issue with casting String to
any other type because Strings must be assumed to be immutable. But
I agree, that probably means that Strings can be cast automatically to Rexx (but
the reverse is or was probably not possible). But this may all
have been fixed in Java since 1996 ... :-).
Mike
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
May I still repeat -- for the records --- You, Mike F. Cowlishaw, are simply a GENIUS ... Hope You are doing well, and You are still HEALTHY (despite the COVID-19 Virus at least). And, also, I do hope YOU can still FLY with your private FLYING machine ... It's so GREAT to SEE what You all did on Your SpeleoTrove ... Best wishes to You, personally, Thomas Schneider, Vienna, Austria. ================================================================== Am 04.05.2020 um 20:31 schrieb Mike
Cowlishaw:
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
In reply to this post by Jeff Hennick-3
Hi Jeff
I am not overly knowledgeable with Java but I wonder if peekto() could use StringBuffer instead which is mutable. Probably not a trivial change to rewrite stage.nrx and all the methods thereunder. Cheers Colin On 2020-05-04 11:09, Jeff Hennick
wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by Jeff Hennick-3
Jeff,
if you do a Rexx(linePa) ? The constructor should work. René.
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by ColinK
The Problem (as I do SEE it) ... ... is OBVIOUSLY the change of the concept STRINGS to StringBuffer in later JAVA deployments ... THUS, (as I do imagine, only ...) The original IMPLEMENTATION of REXX does FAIL ... MAYBE ... Thomas Schneider, Viienna; Austria (FULL STOP) . ========================================================================= Am 04.05.2020 um 22:15 schrieb ColinK:
Hi Jeff _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
In reply to this post by ColinK
I have found part of the problem. The test pipe, which I had
copied from the IBM manual, preceded this OVERLAY stage with a
CHOP stage. Apparently our chop is not putting out type Rexx. By
using a LITERAL stage as the source, overlay works. A likely
workaround would be to add a REXX stage to do the conversion. I
have not yet tried that as I'm not interested in a workaround. But the question remains, Why the java.lang.String
cannot be cast to netrexx.lang.Rexx error? Why is this stage giving the error? It is the same structure as all the other stages: a loop of peekto(), process, and readto(). None of the others object to Rexx peekto(). I have tried commenting out the options binary, with no change. This is from http://netrexx.org/files/nrl3.pdf Page 59
This is telling me that the above error message should never show up. So I am still in a frustrated mood. I'm going to start stripping it down to get a minimum test case
to post. On 5/4/2020 4:15 PM, ColinK wrote:
Hi Jeff _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by rvjansen
Thanks, but the same result. 47 *=* linePa= Rexx (peekto())
java.lang.ClassCastException: java.lang.String cannot be cast to netrexx.lang.Rexx
at overlay_new.run(overlay_new.java:48)
at org.netrexx.njpipes.pipes.ThreadPool.run(ThreadPool.java:76)
at java.lang.Thread.run(Unknown Source)
Exiting due to uncaught Exception java.lang.String cannot be cast to netrexx.lang.Rexx
On 5/4/2020 4:41 PM, René Jansen wrote:
Jeff, _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by ThSITC
The error states java.lang.String cannot be cast to netrexx.lang.Rexx
not anything about StringBuffer,
although that might be behind the curtain.
On 5/4/2020 4:59 PM, Thomas Schneider
wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
In reply to this post by Jeff Hennick-3
Hi Jeff
Purely out of curiosity what if you changed line 49 to: lineP = rexx peekto() and commented out line 50. Do you still get the same error message? I would expect so but I have seen many a strange thing in my former career. :-) On the surface I cannot see a reason for the exception. Thanks Colin On 2020-05-04 14:50, Jeff Hennick
wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Thanks. Good thought. But, ... Actually that was the original. I tried separating them to see what happened. The peek() works fine, and tracing shows a "string of characters" just fine. When trying to convert it to type Rexx -- so some built-in methods can b used -- is when this error occurs. I have stripped it way down and the error disappeared. This
morning I'll add back stuff until I get the error. (It does not
go fast.) On 5/5/2020 12:00 AM, ColinK wrote:
Hi Jeff _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
mostly you can cast: (Rexx my_string).rexxmethod() - so if this is a corner case I would like to know.
René.
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Thank you, but I'm not clear on what you mean. If my_string is the Java String, then the prefix conversion to Rexx will fail. When I use this [line 47 is linePa = (peekto()) ]: 48 +++ lc = (linePA).rexxmethod()
+++ ^^^^^^^^^^
+++ Error: The method 'rexxmethod()' cannot be found in class 'java.lang.Object' or a superclass
On 5/5/2020 8:55 AM, René Jansen wrote:
mostly you can cast: (Rexx my_string).rexxmethod() - so if this is a corner case I would like to know. _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Jeff,
with rexxmethod I meant any builtin method on the Rexx object, like left(), space() etc. I see now that your object is of type Object and not String. Please try with e.g. (Rexx linePA.toString).left(2) (as as example method) René.
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Here it is pared down to its most basic. The pipe, again, comes from the IBM Pipeline manual. The error does not occur if the feed is directly from a LITERAL stage, only from the CHOP stage. (I'll look at that next, but this String to Rexx error should not ever occur.)
On 5/5/2020 10:35 AM, René Jansen
wrote:
Jeff, _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Jeff, pipe (ctb) literal the left/the right | c: chop before / | o1: rexx bad | console ? c: | spec 2-* 1.50 right | o1: Note the rexx before the bad. We probably forgot to treat the chop stage to only return Rexx. René.
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
René, Yes, thanks. That does work. I will take a look at CHOP and its output type. But NetRexx should never object to converting a Java String (not
Object) to a Rexx, should it? It should convert it quietly and
automatically, and to not give any way to do it "manually,"
either? On 5/5/2020 2:27 PM, René Jansen wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
yes, it can convert a String. For an Object, it is different; but always try the .toString method on an Object, it might do what you want.
Remember we did convert a lot of these stages to provide output as type Rexx - because no-one used it for Java and it was much too complicated to use from NetRexx, with a ‘rexx’ interspersed here and there (but not where one would expect it) - so it could not credibly look like CMS Pipelines - which I think it does now a lot more. René.
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
It does look (for me) as IF the original IMPLEMENTATION of Rexx 'Strings' still has to be REVISED, a bit only ... ... as FAR as I can see, Java did introduce String-BUFFERS and Char-Sequences since the time NetRexx has been INVENTED by MFC ... Thus, (maybe, only, I am always looking FORWARD, at least I TRY to do so, with my Alzheimer proceeding, sorry to say so ... --) WE shall have to REVIEW class REXX of NetRexx a bit ??? As I do see it, there might be a couple of HOLES been OPENED by new JAVA-Concepts introduced the past Years ?? Only a SUGGESTION, not really KNOWLEDGE, as I'm concnetrating on OTHER Languages, as COBOL and PL/I (maybe later C#) with my own work ! Kindly, Thomas. ============================================================================================================= Am 05.05.2020 um 22:55 schrieb René
Jansen:
yes, it can convert a String. For an Object, it is different; but always try the .toString method on an Object, it might do what you want. _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
Thomas Schneider, Vienna, Austria (Europe) :-)
www.thsitc.com www.db-123.com |
In reply to this post by rvjansen
This concern is still with us, and it has become weirder. First, René, putting in the toString made the problem go away, and I was able to continue working. Thank you. When I went back to the previous stage, CHOP, it certainly appears that its output is type Rexx. Its output is either the variable outl or rest, both of which come from parse line outl =(p) rest . Why the overlay stage thinks it is an object that needs to be converted to string and then to Rexx still puzzles me. But it worked. Now today I'm getting a new weirdness. I have these lines
as it is above I get the wrong result later on. If I remove the "--" from either the trace OR ANY of the says, I get the right result. The trace results does not need to be right before the line in question, it can be way earlier. The trace off can be way later. When traced, it is right. What is different if it is being traced? And how can a say, several lines later, change its behavior? Any insight to keep me from going mad would be gratefully
appreciated. Or a suggested work around. Remember, in every
other stage it is a simple line = peekto() that works. Thanks. On 5/5/2020 4:55 PM, René Jansen wrote:
yes, it can convert a String. For an Object, it is different; but always try the .toString method on an Object, it might do what you want. _______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/ |
Free forum by Nabble | Edit this page |