7156b-8643.patch
new/src/com/goldencode/p2j/util/BlockManager.java 2024-06-26 07:22:23 +0000 | ||
---|---|---|
2 | 2 |
** Module : BlockManager.java |
3 | 3 |
** Abstract : common "scaffolding" for executing Progress-compatible code blocks |
4 | 4 |
** |
5 |
** Copyright (c) 2008-2023, Golden Code Development Corporation.
|
|
5 |
** Copyright (c) 2008-2024, Golden Code Development Corporation.
|
|
6 | 6 |
** |
7 | 7 |
** -#- -I- --Date-- --JPRM-- ----------------------------------Description----------------------------------- |
8 | 8 |
** 001 GES 20080509 @38517 Created initial version. Implements the core |
... | ... | |
283 | 283 |
** DDF 20240524 Revert re-throw change and avoid NPE when matching condition is null. |
284 | 284 |
** 083 CA 20240609 Once a structured exception is re-thrown, mark it as explicit, so it can be |
285 | 285 |
** re-thrown via top-level blocks. |
286 |
** 084 CA 20240625 Certain database-level ERROR conditions (like 132/buffer already exists with) |
|
287 |
** must be processed as if BLOCK-LEVEL ON ERROR UNDO, THROW is set (in other words, |
|
288 |
** it can get morphed into a strcutured exceptions). |
|
286 | 289 |
*/ |
287 | 290 | |
288 | 291 |
/* |
... | ... | |
8579 | 8582 |
* |
8580 | 8583 |
* @param wa |
8581 | 8584 |
* The {@link WorkArea} instance. |
8585 |
* @param forceBlockLevelUndoThrow |
|
8586 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
8587 |
* |
|
8588 |
* @return see above. |
|
8589 |
*/ |
|
8590 |
static boolean mustManageLegacyError(WorkArea wa, boolean forceBlockLevelUndoThrow) |
|
8591 |
{ |
|
8592 |
return wa.pm._thisProcedure() != null && |
|
8593 |
(forceBlockLevelUndoThrow || |
|
8594 |
(wa.tm.isRootNestingLevel() && AppServerManager.isRemote() && wa.pm.isRoutineLevelUndoThrow()) || |
|
8595 |
(wa.tm.isTopLevelBlock() && wa.pm.isRoutineLevelUndoThrow()) || |
|
8596 |
wa.pm.isBlockLevelUndoThrow()); |
|
8597 |
} |
|
8598 |
/** |
|
8599 |
* Check if the top-level block is ROUTINE-LEVEL UNDO, THROW or the current program is |
|
8600 |
* BLOCK-LEVEL UNDO, THROW. |
|
8601 |
* |
|
8602 |
* @param forceBlockLevelUndoThrow |
|
8603 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
8604 |
* |
|
8605 |
* @return see above. |
|
8606 |
*/ |
|
8607 |
static boolean mustManageLegacyError(boolean forceBlockLevelUndoThrow) |
|
8608 |
{ |
|
8609 |
return mustManageLegacyError(work.obtain(), forceBlockLevelUndoThrow); |
|
8610 |
} |
|
8611 |
|
|
8612 |
/** |
|
8613 |
* Check if the top-level block is ROUTINE-LEVEL UNDO, THROW or the current program is |
|
8614 |
* BLOCK-LEVEL UNDO, THROW. |
|
8615 |
* |
|
8616 |
* @param wa |
|
8617 |
* The {@link WorkArea} instance. |
|
8582 | 8618 |
* |
8583 | 8619 |
* @return see above. |
8584 | 8620 |
*/ |
... | ... | |
11580 | 11616 |
if (imple != null) |
11581 | 11617 |
{ |
11582 | 11618 |
canThrow = canThrow || (imple.action == Action.THROW); |
11583 |
noThrowOnError = (imple.action != Action.THROW); |
|
11619 |
noThrowOnError = !lex.isExplicit() && (imple.action != Action.THROW);
|
|
11584 | 11620 |
} |
11585 | 11621 |
} |
11586 | 11622 |
|
new/src/com/goldencode/p2j/util/ErrorManager.java 2024-06-26 07:48:50 +0000 | ||
---|---|---|
277 | 277 |
** 092 CA 20240609 An ERROR condition must be triggered in the caller (outside of the top-level |
278 | 278 |
** block) is current file has ROUTINE-/BLOCK-LEVEL statetements and this condition |
279 | 279 |
** can't be morphed in a structured exception in the current stacktrace. |
280 |
** 095 CA 20240625 Certain database-level ERROR conditions (like 132/buffer already exists with) |
|
281 |
** must be processed as if BLOCK-LEVEL ON ERROR UNDO, THROW is set (in other words, |
|
282 |
** it can get morphed into a strcutured exceptions). |
|
280 | 283 |
*/ |
281 | 284 | |
282 | 285 |
/* |
... | ... | |
1930 | 1933 |
boolean silent = isSilentError(); |
1931 | 1934 |
boolean manageLegacyError = da.mustThrowLegacyError(); |
1932 | 1935 |
boolean mustManageError = !manageLegacyError && da.mustManageLegacyError(); |
1936 |
boolean forceExplicitException = false; |
|
1937 |
|
|
1938 |
if (!manageLegacyError && nums[0] == 132 && !ProcedureManager.getProcedureHelper().isBlockLevelUndoThrow()) |
|
1939 |
{ |
|
1940 |
forceExplicitException = true; |
|
1941 |
manageLegacyError = da.mustThrowLegacyError(true); |
|
1942 |
mustManageError = !manageLegacyError && da.mustManageLegacyError(true); |
|
1943 |
} |
|
1933 | 1944 |
|
1934 | 1945 |
boolean throwError = false; |
1935 | 1946 |
|
... | ... | |
2010 | 2021 |
|
2011 | 2022 |
if (last && throwError) |
2012 | 2023 |
{ |
2024 |
work.get().forceExplicit = forceExplicitException; |
|
2013 | 2025 |
throw new DeferredLegacyErrorException(); |
2014 | 2026 |
} |
2015 | 2027 | |
... | ... | |
2919 | 2931 |
{ |
2920 | 2932 |
return BlockManager.mustManageLegacyError(); |
2921 | 2933 |
} |
2934 |
/** |
|
2935 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
|
2936 |
* |
|
2937 |
* @param forceBlockLevelUndoThrow |
|
2938 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
2939 |
* |
|
2940 |
* @return see above. |
|
2941 |
*/ |
|
2942 |
public static boolean mustManageLegacyError(boolean forceBlockLevelUndoThrow) |
|
2943 |
{ |
|
2944 |
return BlockManager.mustManageLegacyError(forceBlockLevelUndoThrow); |
|
2945 |
} |
|
2922 | 2946 |
|
2923 | 2947 |
/** |
2924 | 2948 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
... | ... | |
2927 | 2951 |
*/ |
2928 | 2952 |
public static boolean mustThrowLegacyError() |
2929 | 2953 |
{ |
2954 |
return mustThrowLegacyError(false); |
|
2955 |
} |
|
2956 |
|
|
2957 |
/** |
|
2958 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
|
2959 |
* |
|
2960 |
* @param forceBlockLevelUndoThrow |
|
2961 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
2962 |
* |
|
2963 |
* @return see above. |
|
2964 |
*/ |
|
2965 |
public static boolean mustThrowLegacyError(boolean forceBlockLevelUndoThrow) |
|
2966 |
{ |
|
2930 | 2967 |
return BlockManager.hasLegacyError(SysError.class, 0) || |
2931 |
(BlockManager.mustManageLegacyError() && |
|
2968 |
(BlockManager.mustManageLegacyError(forceBlockLevelUndoThrow) &&
|
|
2932 | 2969 |
(BlockManager.hasLegacyError(SysError.class, -1) || |
2933 | 2970 |
(TransactionManager.isRootNestingLevel() && AppServerManager.isRemote()))); |
2934 | 2971 |
} |
... | ... | |
2982 | 3019 |
object<? extends SysError> legacyError = wa.legacyError; |
2983 | 3020 |
wa.legacyError = null; |
2984 | 3021 |
|
2985 |
return new LegacyErrorException(legacyError); |
|
3022 |
LegacyErrorException lex = new LegacyErrorException(legacyError); |
|
3023 |
lex.setExplicit(wa.forceExplicit); |
|
3024 |
wa.forceExplicit = false; |
|
3025 |
return lex; |
|
2986 | 3026 |
} |
2987 | 3027 | |
2988 | 3028 |
/** |
... | ... | |
4722 | 4762 |
return false; |
4723 | 4763 |
} |
4724 | 4764 |
|
4765 |
@Override |
|
4766 |
public boolean mustManageLegacyError(boolean forceBlockLevelUndoThrow) |
|
4767 |
{ |
|
4768 |
return false; |
|
4769 |
} |
|
4770 |
|
|
4725 | 4771 |
/** |
4726 | 4772 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
4727 | 4773 |
* |
... | ... | |
4732 | 4778 |
return false; |
4733 | 4779 |
} |
4734 | 4780 |
|
4781 |
public boolean mustThrowLegacyError(boolean forceBlockLevelUndoThrow) |
|
4782 |
{ |
|
4783 |
return false; |
|
4784 |
} |
|
4735 | 4785 |
|
4736 | 4786 |
/** |
4737 | 4787 |
* Record the specified error message and number, to be later thrown as a |
... | ... | |
4830 | 4880 |
/** |
4831 | 4881 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
4832 | 4882 |
* |
4883 |
* @param forceBlockLevelUndoThrow |
|
4884 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
4885 |
* |
|
4886 |
* @return see above. |
|
4887 |
*/ |
|
4888 |
@Override |
|
4889 |
public boolean mustManageLegacyError(boolean forceBlockLevelUndoThrow) |
|
4890 |
{ |
|
4891 |
return ErrorManager.mustManageLegacyError(forceBlockLevelUndoThrow); |
|
4892 |
} |
|
4893 |
|
|
4894 |
/** |
|
4895 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
|
4896 |
* |
|
4833 | 4897 |
* @return see above. |
4834 | 4898 |
*/ |
4835 | 4899 |
@Override |
... | ... | |
4839 | 4903 |
} |
4840 | 4904 |
|
4841 | 4905 |
/** |
4906 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
|
4907 |
* |
|
4908 |
* @param forceBlockLevelUndoThrow |
|
4909 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
4910 |
* |
|
4911 |
* @return see above. |
|
4912 |
*/ |
|
4913 |
@Override |
|
4914 |
public boolean mustThrowLegacyError(boolean forceBlockLevelUndoThrow) |
|
4915 |
{ |
|
4916 |
return ErrorManager.mustThrowLegacyError(forceBlockLevelUndoThrow); |
|
4917 |
} |
|
4918 |
|
|
4919 |
/** |
|
4842 | 4920 |
* Record the specified error message and number, to be later thrown as a |
4843 | 4921 |
* {@link LegacyErrorException}. |
4844 | 4922 |
* |
... | ... | |
5020 | 5098 |
{ |
5021 | 5099 |
wa.silent = value; |
5022 | 5100 |
} |
5101 |
|
|
5102 |
/** |
|
5103 |
* Check if the top-level block is ROUTINE-LEVEL UNDO, THROW or the current program is |
|
5104 |
* BLOCK-LEVEL UNDO, THROW. |
|
5105 |
* |
|
5106 |
* @return see above. |
|
5107 |
*/ |
|
5108 |
@Override |
|
5109 |
public boolean mustManageLegacyError() |
|
5110 |
{ |
|
5111 |
return ErrorManager.mustManageLegacyError(); |
|
5112 |
} |
|
5113 | ||
5114 |
/** |
|
5115 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
|
5116 |
* |
|
5117 |
* @param forceBlockLevelUndoThrow |
|
5118 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
5119 |
* |
|
5120 |
* @return see above. |
|
5121 |
*/ |
|
5122 |
@Override |
|
5123 |
public boolean mustManageLegacyError(boolean forceBlockLevelUndoThrow) |
|
5124 |
{ |
|
5125 |
return ErrorManager.mustManageLegacyError(forceBlockLevelUndoThrow); |
|
5126 |
} |
|
5127 |
|
|
5128 |
/** |
|
5129 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
|
5130 |
* |
|
5131 |
* @return see above. |
|
5132 |
*/ |
|
5133 |
@Override |
|
5134 |
public boolean mustThrowLegacyError() |
|
5135 |
{ |
|
5136 |
return ErrorManager.mustThrowLegacyError(); |
|
5137 |
} |
|
5138 |
|
|
5139 |
/** |
|
5140 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
|
5141 |
* |
|
5142 |
* @param forceBlockLevelUndoThrow |
|
5143 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
5144 |
* |
|
5145 |
* @return see above. |
|
5146 |
*/ |
|
5147 |
@Override |
|
5148 |
public boolean mustThrowLegacyError(boolean forceBlockLevelUndoThrow) |
|
5149 |
{ |
|
5150 |
return ErrorManager.mustThrowLegacyError(forceBlockLevelUndoThrow); |
|
5151 |
} |
|
5023 | 5152 |
} |
5024 | 5153 |
|
5025 | 5154 |
/** |
new/src/com/goldencode/p2j/util/RemoteErrorData.java 2024-06-26 07:32:59 +0000 | ||
---|---|---|
2 | 2 |
** Module : RemoteErrorData.java |
3 | 3 |
** Public : provides remote access to ErrorManager data |
4 | 4 |
** |
5 |
** Copyright (c) 2005-2023, Golden Code Development Corporation.
|
|
5 |
** Copyright (c) 2005-2024, Golden Code Development Corporation.
|
|
6 | 6 |
** |
7 | 7 |
** -#- -I- --Date-- --JPRM-- ----------------------------------Description---------------------------------- |
8 | 8 |
** 001 NVS 20060303 @24884 Created initial version. |
... | ... | |
29 | 29 |
** be morphed into a legacy SysError exception, and not raise an ERROR condition. |
30 | 30 |
** 013 GBB 20230313 New method writeLog added. |
31 | 31 |
** 014 TT 20230614 Added the functionality for session:suppress-warnings-list. |
32 |
** 016 CA 20240625 Certain database-level ERROR conditions (like 132/buffer already exists with) |
|
33 |
** must be processed as if BLOCK-LEVEL ON ERROR UNDO, THROW is set (in other words, |
|
34 |
** it can get morphed into a strcutured exceptions). |
|
32 | 35 |
*/ |
33 | 36 | |
34 | 37 |
/* |
... | ... | |
189 | 192 |
* @return see above. |
190 | 193 |
*/ |
191 | 194 |
public boolean mustManageLegacyError(); |
195 |
/** |
|
196 |
* Check if the top-level block is ROUTINE-LEVEL UNDO, THROW or the current program is |
|
197 |
* BLOCK-LEVEL UNDO, THROW. |
|
198 |
* |
|
199 |
* @param forceBlockLevelUndoThrow |
|
200 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
201 |
* |
|
202 |
* @return see above. |
|
203 |
*/ |
|
204 |
public boolean mustManageLegacyError(boolean forceBlockLevelUndoThrow); |
|
192 | 205 |
|
193 | 206 |
/** |
194 | 207 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
... | ... | |
196 | 209 |
* @return see above. |
197 | 210 |
*/ |
198 | 211 |
public boolean mustThrowLegacyError(); |
212 |
/** |
|
213 |
* Check if the current ERROR condition must be raised as a legacy {@link SysError}. |
|
214 |
* |
|
215 |
* @param forceBlockLevelUndoThrow |
|
216 |
* Flag indicating that, when nothing else matches, a BLOCK-LEVEL UNDO, THROW exists by default. |
|
217 |
* |
|
218 |
* @return see above. |
|
219 |
*/ |
|
220 |
public boolean mustThrowLegacyError(boolean forceBlockLevelUndoThrow); |
|
199 | 221 | |
200 | 222 |
/** |
201 | 223 |
* Record the specified error message and number, to be later thrown as a |