Project

General

Profile

Bug #5473

go-pending value is not maintained properly

Added by Roger Borrello almost 3 years ago. Updated almost 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:

History

#1 Updated by Roger Borrello almost 3 years ago

This is a helpful patch to add logging of the changes to isGoPending in ThinClient.java

--- /home/rfb/projects/fwd/p2jdev/src/com/goldencode/p2j/ui/chui/ThinClient.java
+++ /home/rfb/projects/fwd/p2jdev/ThinClient.java
@@ -2696,6 +2696,7 @@
 **     RFB 20210617          In promptFor we should take into account whether or not we are in an editingBlock 
 **                           before changing focus. Added an additional reset method so all access to isGoPending
 **                           is encapsulated. Ref #4794.
+**     RFB 20210607          Added logging related to go_pending usage. Ref #4794.
 */

 /*
@@ -2800,6 +2801,7 @@
 {
    /** Logger. */
    private static final Logger LOG = LogHelper.getLogger(ThinClient.class.getName());
+   private static final Logger GOP_LOG = LogHelper.getLogger("com.goldencode.p2j.ui.chui.ThinClient.GoPending");

    /** Default pause before hide message text. */
    private static final String PBH_DEFAULT_TEXT = "Press space bar to continue.";
@@ -15296,6 +15298,7 @@
       }

       stopInputStatus();
+      //subGoPending(); // This doesn't work, although it is closer for nested use cases
       resetGoPending();
       inEditingBlock   = false;
       hadReset         = false;
@@ -15830,7 +15833,14 @@
    @Override
    public boolean isGoPending()
    {
-      return isGoPending > 0;
+      boolean res = (isGoPending > 0);
+      if (GOP_LOG.isLoggable(Level.INFO))
+      {
+         String txt = LogHelper.generate(String.format("ThinClient.isGoPending: %s (%d)", res ? "TRUE" : "FALSE", isGoPending));
+         GOP_LOG.logp(Level.INFO, "ThinClient", "isGoPending", txt);
+         Thread.currentThread().dumpStack();
+      }
+      return res;
    }

    /**
@@ -15839,6 +15849,13 @@
     */
    private void addGoPending()
    {
+      if (GOP_LOG.isLoggable(Level.INFO))
+      {
+         int post = isGoPending+1;
+         String txt = LogHelper.generate(String.format("ThinClient.addGoPending: %d -> %d", isGoPending, post));
+         GOP_LOG.logp(Level.INFO, "ThinClient", "addGoPending", txt);
+         Thread.currentThread().dumpStack();
+      }
       isGoPending++;
    }

@@ -15848,7 +15865,14 @@
     */
    private void subGoPending()
    {
-      isGoPending--;
+      if (GOP_LOG.isLoggable(Level.INFO))
+      {
+         int post = (isGoPending > 0) ? isGoPending-1 : 0;
+         String txt = LogHelper.generate(String.format("ThinClient.subGoPending: %d -> %d", isGoPending, post));
+         GOP_LOG.logp(Level.INFO, "ThinClient", "subGoPending", txt);
+         Thread.currentThread().dumpStack();
+      }
+      isGoPending = (isGoPending > 0) ? isGoPending-1 : 0;
    }

    /**
@@ -15857,6 +15881,12 @@
     */
    private void resetGoPending()
    {
+      if (GOP_LOG.isLoggable(Level.INFO))
+      {
+         String txt = LogHelper.generate(String.format("ThinClient.resetGoPending: %d -> %d", isGoPending, 0));
+         GOP_LOG.logp(Level.INFO, "ThinClient", "resetGoPending", txt);
+         Thread.currentThread().dumpStack();
+      }
       isGoPending = 0;
    }

@@ -15868,6 +15898,12 @@
     */
    private void resetGoPending(int val)
    {
+      if (GOP_LOG.isLoggable(Level.INFO))
+      {
+         String txt = LogHelper.generate(String.format("ThinClient.resetGoPending(%d): %d", val, 0));
+         GOP_LOG.logp(Level.INFO, "ThinClient", "resetGoPending", txt);
+         Thread.currentThread().dumpStack();
+      }
       isGoPending = val;
    }

Add this logging to the directory:

    <node class="container" name="server">
      <node class="container" name="default">
        <node class="container" name="logging">
          <node class="container" name="loggers">
            <node class="string" name="com.goldencode.p2j.ui.chui.ThinClient.GoPending">
              <node-attribute name="value" value="INFO"/>
            </node>

Also available in: Atom PDF