You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "SirIntellegence (via GitHub)" <gi...@apache.org> on 2023/01/30 17:25:48 UTC

[GitHub] [netbeans] SirIntellegence commented on a diff in pull request #5299: [NETBEANS-4123] Initial implementation of handling large strings

SirIntellegence commented on code in PR #5299:
URL: https://github.com/apache/netbeans/pull/5299#discussion_r1090928561


##########
java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/ShortenedStrings.java:
##########
@@ -171,14 +212,43 @@ static String getStringWithLengthControl(StringReference sr) throws InternalExce
             } else {
                 assert sa != null;
                 int l = AbstractObjectVariable.MAX_STRING_LENGTH;
+                if (isCompressedImpl && isUTF16){
+                    l *= 2;
+                }
                 List<Value> values = ArrayReferenceWrapper.getValues(sa, 0, l);
                 char[] characters = new char[l + 3];
-                for (int i = 0; i < l; i++) {
-                    Value v = values.get(i);
-                    if (!(v instanceof CharValue)) {
-                        return "<Unreadable>";
+                if (isCompressedImpl) {
+                    //java compressed string
+                    if (!isUTF16) {
+                        //we can just cast to char
+                        for (int i = 0; i < l; i++) {
+                            Value v = values.get(i);
+                            if (!(v instanceof ByteValue)) {
+                                return ERROR_RESULT;
+                            }
+                            char c = (char)((ByteValue) v).byteValue();
+                            //remove the extended sign
+                            c &= 0xFF;
+                            characters[i] = c;
+                        }
+                    }
+                    else {
+                        //life is pain
+                        //We can't just inline code for this since... native
+                        //jazz and big/little endian stuff... so...
+                        //see StringUTF16.java
+                        //implement later!
+                        return "<Not Implemented>";

Review Comment:
   Should we try to check the high and low byte shifts to determine which one it is or not worry about it?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists