Project

General

Profile

5701d-r14520.diff

Galya B, 03/28/2023 11:41 AM

Download (5.24 KB)

View differences:

src/com/goldencode/p2j/main/ClientCore.java 2023-03-28 15:33:39 +0000
64 64
**                  Passing arg to spawner for path to stderr log file for background processes.
65 65
** 032 GBB 20230127 Fixing pid in outputToFile name by replacing it in Java code.
66 66
** 033 GBB 20230316 Set IS_OUTPUT_REDIRECTED flag to true on System.out redirect.
67
** 034 GBB 20230316 IS_OUTPUT_REDIRECTED flag imported from its new location in FileChecker.
67 68
*/
68 69
/*
69 70
** This program is free software: you can redistribute it and/or modify
......
130 131
import com.goldencode.p2j.directory.*;
131 132
import com.goldencode.p2j.security.SecurityManager;
132 133
import com.goldencode.p2j.ui.client.*;
133
import com.goldencode.p2j.ui.client.chui.driver.batch.*;
134 134
import com.goldencode.p2j.ui.client.driver.*;
135 135
import com.goldencode.p2j.ui.chui.ThinClient;
136 136
import com.goldencode.p2j.util.*;
......
460 460
      {
461 461
         outputToFile = outputToFile.replace("%pid%", String.valueOf(getPid()));
462 462
         System.setOut(new PrintStream(new FileOutputStream(outputToFile), true));
463
         BatchHelper.IS_OUTPUT_REDIRECTED.set(true);
463
         FileChecker.IS_OUTPUT_REDIRECTED.set(true);
464 464
      }
465 465
      catch (Throwable t)
466 466
      {
src/com/goldencode/p2j/ui/client/chui/driver/batch/BatchHelper.java 2023-03-28 15:30:01 +0000
2 2
** Module   : BatchHelper.java
3 3
** Abstract : The class provides I/O stubs and error handling for batch mode processing. 
4 4
**
5
** Copyright (c) 2013-2017, Golden Code Development Corporation.
5
** Copyright (c) 2013-2023, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- ---------------------------------Description----------------------------------
8 8
** 001 EVL 20131104 Created initial version.
......
11 11
** 003 GES 20150506 Made this into a simple static helper class.  There is no instance data.
12 12
** 004 IAS 20160829 outputOperation() fix.
13 13
** 005 GBB 20230316 Add IS_OUTPUT_REDIRECTED flag to validate System.out redirect in outputOperation.
14
** 006 GBB 20230328 Move IS_OUTPUT_REDIRECTED flag to FileChecker.
14 15
*/
15 16
/*
16 17
** This program is free software: you can redistribute it and/or modify
......
71 72
import com.goldencode.p2j.util.*;
72 73
import com.goldencode.util.*;
73 74

  
74
import java.util.concurrent.atomic.*;
75

  
76 75
/**
77 76
 * The BatchHelper class provides special handling for input output operation for active batch
78 77
 * mode.
......
80 79
public class BatchHelper 
81 80
{
82 81
   /**
83
    * A flag used to show if System.out has been redirected programmatically.
84
    */
85
   public static final AtomicBoolean IS_OUTPUT_REDIRECTED = new AtomicBoolean(false);
86
   
87
   /**
88 82
    * Default empty constructor.
89 83
    */
90 84
   private BatchHelper()
......
109 103
   public static void outputOperation()
110 104
   throws UnstoppableExitException
111 105
   {
112
      if (!IS_OUTPUT_REDIRECTED.get() && !FileChecker.isConsoleRedirected() &&
106
      if (!FileChecker.isConsoleRedirected() &&
113 107
          (!PlatformHelper.isUnderWindowsFamily() || !OutputManager.isBatchInBackground()))
114 108
      {
115 109
         ErrorManager.displayError(516,
......
117 111
         throw new UnstoppableExitException("");
118 112
      }
119 113
   } 
120
}
114
}
src/com/goldencode/p2j/util/FileChecker.java 2023-03-28 15:32:22 +0000
3 3
** Abstract : Java implementation of for detecting the file type attribute 
4 4
*             list of OS-DIR
5 5
**
6
** Copyright (c) 2013-2022, Golden Code Development Corporation.
6
** Copyright (c) 2013-2023, Golden Code Development Corporation.
7 7
**
8 8
** -#- -I- --Date-- ----------------Description-----------------
9 9
** 001 CS  20130103 Created initial version for Implement OS-DIR support as
......
18 18
**                  file by command line option.
19 19
** 005 EVL 20160224 Javadoc fixes to make compatible with Oracle Java 8 for Solaris 10.
20 20
** 006 TJD 20220504 Java 11 compatibility minor changes
21
** 007 GBB 20230328 Moving flag IS_OUTPUT_REDIRECTED from BatchedHelper to use it in
22
**                  isConsoleRedirected().
21 23
*/
22 24
/*
23 25
** This program is free software: you can redistribute it and/or modify
......
73 75
*/
74 76
package com.goldencode.p2j.util;
75 77

  
76
import java.io.File;
77

  
78
import com.goldencode.util.*;
78
import java.util.concurrent.atomic.*;
79 79

  
80 80
/**
81 81
 * Utility class that uses JNI call to get the bitfield representing the 
......
113 113
 */
114 114
public class FileChecker
115 115
{
116
   /**
117
    * A flag used to show if System.out has been redirected programmatically.
118
    */
119
   public static final AtomicBoolean IS_OUTPUT_REDIRECTED = new AtomicBoolean(false);
120
   
116 121
   /** Status code for error */
117 122
   private static final int ERROR_TYPE =-1;
118 123

  
......
291 296
         consoleRedirected = Boolean.valueOf(isStdoutRedirected());
292 297
      }
293 298
      
294
      return consoleRedirected.booleanValue();
299
      return consoleRedirected.booleanValue() || IS_OUTPUT_REDIRECTED.get();
295 300
   }
296 301
}