You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ju...@apache.org on 2021/01/18 13:58:16 UTC

[netbeans] branch master updated: [NETBEANS-5234] PHP debugger - fix display of long strings

This is an automated email from the ASF dual-hosted git repository.

junichi11 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 752eb1b  [NETBEANS-5234] PHP debugger - fix display of long strings
     new 7983cc3  Merge pull request #2673 from KacerCZ/netbeans-5234-php-debugger-long-string
752eb1b is described below

commit 752eb1b46121832ed3e80d016a790c004d8d568c
Author: Tomas Prochazka <ka...@razdva.cz>
AuthorDate: Mon Jan 11 20:07:56 2021 +0100

    [NETBEANS-5234] PHP debugger - fix display of long strings
    
    https://issues.apache.org/jira/browse/NETBEANS-5234
    
    Fixed processing of `property_value` command response.
    Because response does not contain variable name, it has to be copied from command.
    For details see [Xdebug documentation](https://xdebug.org/docs/dbgp#property-get-property-set-property-value)
    
    Fixed `Property.setName()` because code for adding attribute did not work.
---
 .../src/org/netbeans/modules/php/dbgp/packets/Property.java   | 11 ++++++-----
 .../modules/php/dbgp/packets/PropertyValueResponse.java       | 10 +++++++---
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/php/php.dbgp/src/org/netbeans/modules/php/dbgp/packets/Property.java b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/packets/Property.java
index 34ac63c..967d41e 100644
--- a/php/php.dbgp/src/org/netbeans/modules/php/dbgp/packets/Property.java
+++ b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/packets/Property.java
@@ -32,6 +32,7 @@ import org.netbeans.modules.php.dbgp.SessionId;
 import org.netbeans.modules.php.dbgp.SessionManager;
 import org.netbeans.modules.php.dbgp.UnsufficientValueException;
 import org.openide.util.Exceptions;
+import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 /**
@@ -39,6 +40,7 @@ import org.w3c.dom.Node;
  *
  */
 public class Property extends BaseMessageChildElement {
+
     static final String PROPERTY = "property"; // NOI18N
     private static final String NUMCHILDREN = "numchildren"; // NOI18N
     static final String ENCODING = "encoding"; // NOI18N
@@ -64,12 +66,11 @@ public class Property extends BaseMessageChildElement {
     }
 
     public void setName(String value) {
-        Node node = getNode().getAttributes().getNamedItem(NAME);
-        if (node == null) {
-            node = getNode().getOwnerDocument().createAttribute(NAME);
-            getNode().appendChild(node);
+        Node node = getNode();
+        if (node instanceof Element) {
+            Element element = (Element) node;
+            element.setAttribute(NAME, value);
         }
-        node.setNodeValue(value);
     }
 
     public String getFullName() {
diff --git a/php/php.dbgp/src/org/netbeans/modules/php/dbgp/packets/PropertyValueResponse.java b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/packets/PropertyValueResponse.java
index a744224..ebb5cc8 100644
--- a/php/php.dbgp/src/org/netbeans/modules/php/dbgp/packets/PropertyValueResponse.java
+++ b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/packets/PropertyValueResponse.java
@@ -33,7 +33,7 @@ public class PropertyValueResponse extends DbgpResponse {
     }
 
     public Property getProperty() {
-        Node node = getChild(getNode(), Property.PROPERTY);
+        Node node = getNode();
         if (node != null) {
             return new Property(node);
         }
@@ -42,13 +42,17 @@ public class PropertyValueResponse extends DbgpResponse {
 
     @Override
     public void process(DebugSession session, DbgpCommand command) {
+        if (!(command instanceof PropertyValueCommand)) {
+            return;
+        }
         DebugSession currentSession = SessionManager.getInstance().getSession(session.getSessionId());
         if (currentSession == session) {
             // perform update local view only if response appears in current session
             Property property = getProperty();
             if (property != null) {
-                session.getBridge().getVariablesModel().updateProperty(
-                        getProperty());
+                // response does not contain variable name so it is taken from command
+                property.setName(((PropertyValueCommand) command).getName());
+                session.getBridge().getVariablesModel().updateProperty(property);
             }
         }
     }


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

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