Project

General

Profile

4658.diff

Vladimir Tsichevski, 11/15/2022 02:51 PM

Download (41.5 KB)

View differences:

src/com/goldencode/p2j/oo/core/AssertionFailedError.java 2022-11-15 19:41:34 +0000
2 2
** Module   : AssertionFailedError.java
3 3
** Abstract : Implementation of the OpenEdge.Core.AssertionFailedError builtin class.
4 4
**
5
** Copyright (c) 2019-2021, Golden Code Development Corporation.
5
** Copyright (c) 2019-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- -------------------------------Description--------------------------------
8 8
** 001 CA  20190423 Created the first version, by converting the legacy skeleton .cls file and
......
12 12
** 003 CA  20191024 Added method support levels and updated the class support level.
13 13
** 004 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
14 14
**                  signature.
15
** 005 VVT 2022zzzz Serialization support added (see #4658). Missing Javadocs added.
15 16
*/
16 17

  
17 18
/*
......
69 70

  
70 71
package com.goldencode.p2j.oo.core;
71 72

  
73
import static com.goldencode.p2j.report.ReportConstants.*;
74
import static com.goldencode.p2j.util.BlockManager.*;
75
import static com.goldencode.p2j.util.TextOps.substitute;
76

  
77
import java.io.*;
78

  
72 79
import com.goldencode.p2j.util.*;
73
import com.goldencode.p2j.oo.lang.*;
74

  
75
import static com.goldencode.p2j.util.BlockManager.*;
76
import static com.goldencode.p2j.report.ReportConstants.*;
77
import static com.goldencode.p2j.util.InternalEntry.Type;
80
import com.goldencode.p2j.util.InternalEntry.*;
78 81

  
79 82
/**
80
 * Business logic (converted to Java from the 4GL source code
83
 * Business logic (initially converted to Java from the 4GL source code
81 84
 * in OpenEdge/Core/AssertionFailedError.cls).
82 85
 */
83 86
@LegacyResource(resource = "OpenEdge.Core.AssertionFailedError")
......
85 88
public class AssertionFailedError
86 89
extends com.goldencode.p2j.oo.lang.AppError
87 90
{
88
   private String _msg;
89
   
91
   /**
92
    * The actual value if was set in the object constructor, otherwise {@code null} 
93
    */
94
   private BaseDataType actual;
95

  
96
   /**
97
    * The expected value if was set in the object constructor, otherwise {@code null} 
98
    */
99
   private BaseDataType expected;
100
   
101
   /**
102
    * The failure message or {@code null} if no message was set.
103
    */
104
   private String msg;
105
   
106
   /**
107
    * Default constructor. Instances are created using this constructor,
108
    * then initialized in another call.
109
    */
110
   public AssertionFailedError()
111
   {
112
      // no-op
113
   }
114

  
115
   /**
116
    * The constructor accessible from Java.
117
    * 
118
    * @param expected 
119
    * @param actual 
120
    */
121
   public AssertionFailedError(final BaseDataType expected, final BaseDataType actual)
122
   {
123
      this.expected = expected;
124
      this.actual = actual;
125
   }
126
   
127
   /**
128
    * Initialize using the message describing the failure.
129
    * 
130
    * @param msgtxt
131
    *        the message
132
    */
133
   @LegacySignature(type = Type.CONSTRUCTOR, parameters = 
134
   {
135
      @LegacyParameter(name = "msgtxt", type = "CHARACTER", mode = "INPUT")
136
   })
137
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
138
   public void __core_AssertionFailedError_constructor__(final character msgtxt)
139
   {
140
      internalProcedure(this, "__core_AssertionFailedError_constructor__", new Block((Body) () -> 
141
      {
142
         __core_AssertionFailedError_constructor__(msgtxt, new integer(0));
143
      }));
144
   }
145

  
146
   /**
147
    * Initialize using the template for the message describing the failure,
148
    * the expected and actual values.
149
    * 
150
    * @param msgtxt
151
    *        the message
152
    * @param expected
153
    *        the expected value, must not be {@code null}
154
    * @param actual 
155
    *        the actual value, must not be {@code null}
156
    */
157
   @LegacySignature(type = Type.CONSTRUCTOR, parameters = 
158
   {
159
      @LegacyParameter(name = "msgtxt", type = "CHARACTER", mode = "INPUT"),
160
      @LegacyParameter(name = "expected", type = "CHARACTER", mode = "INPUT"),
161
      @LegacyParameter(name = "actual", type = "CHARACTER", mode = "INPUT")
162
   })
163
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
164
   public void __core_AssertionFailedError_constructor__(final character msgtxt,
165
            final character expected,
166
            final character actual)
167
   {
168
      internalProcedure(this, "__core_AssertionFailedError_constructor__", new Block((Body) () -> 
169
      {
170
         __core_AssertionFailedError_constructor__(msgtxt, new integer(0));
171
         
172
         this.expected = expected;
173
         this.actual = actual;
174
      }));
175
   }
176

  
177
   /**
178
    * Initialize using the message describing the failure and the message number.
179
    * 
180
    * @param msgtxt
181
    *        the message
182
    * @param msgnum
183
    *        the message number
184
    */
185
   @LegacySignature(type = Type.CONSTRUCTOR, parameters = 
186
   {
187
      @LegacyParameter(name = "msgtxt", type = "CHARACTER", mode = "INPUT"),
188
      @LegacyParameter(name = "msgnum", type = "INTEGER", mode = "INPUT")
189
   })
190
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
191
   public void __core_AssertionFailedError_constructor__(final character msgtxt, final integer msgnum)
192
   {
193
      internalProcedure(this, "__core_AssertionFailedError_constructor__", new Block((Body) () -> 
194
      {
195
         __lang_AppError_constructor__(msgtxt, msgnum);
196
         msg = msgtxt.getValue();
197
      }));
198
   }
199

  
200
   /**
201
    * Initialize the procedure
202
    */
90 203
   public void __core_AssertionFailedError_execute__()
91 204
   {
92 205
      externalProcedure(AssertionFailedError.this, new Block((Body) () -> 
93 206
      {
94
         {
95
         }
96
      }));
97
   }
98

  
99
   @LegacySignature(type = Type.CONSTRUCTOR, parameters = 
100
   {
101
      @LegacyParameter(name = "msgtxt", type = "CHARACTER", mode = "INPUT"),
102
      @LegacyParameter(name = "msgnum", type = "INTEGER", mode = "INPUT")
103
   })
104
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
105
   public void __core_AssertionFailedError_constructor__(final character _msgtxt, final integer _msgnum)
106
   {
107
      internalProcedure(this, "__core_AssertionFailedError_constructor__", new Block((Body) () -> 
108
      {
109
         __lang_AppError_constructor__(_msgtxt, _msgnum);
110
         _msg = _msgtxt.getValue();
111
      }));
112
   }
113

  
114
   @LegacySignature(type = Type.CONSTRUCTOR, parameters = 
115
   {
116
      @LegacyParameter(name = "msgtxt", type = "CHARACTER", mode = "INPUT")
117
   })
118
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
119
   public void __core_AssertionFailedError_constructor__(final character _msgtxt)
120
   {
121
      internalProcedure(this, "__core_AssertionFailedError_constructor__", new Block((Body) () -> 
122
      {
123
         __core_AssertionFailedError_constructor__(_msgtxt, new integer(0));
124
      }));
125
   }
126

  
207
         // no-op
208
      }));
209
   }
210

  
211
   /**
212
    * Get the actual value, if set. Otherwise return {@code null}.
213
    * 
214
    * @return see above
215
    */
216
   public BaseDataType getActual()
217
   {
218
      return actual;
219
   }
220

  
221
   /**
222
    * Get the expected value, if set. Otherwise return {@code null}.
223
    * 
224
    * @return see above
225
    */
226
   public BaseDataType getExpected()
227
   {
228
      return expected;
229
   }
230

  
231
   /**
232
    * Get failure message. If the failure message was explicitly set in the constructor, then return this message.
233
    * Otherwise construct the message using the expected and actual values.
234
    * 
235
    * @return see above
236
    */
127 237
   @LegacySignature(returns = "CHARACTER", type = Type.METHOD, name = "GetMessage")
128 238
   @LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_FULL)
129
   public character getMessage()
239
   public character getMessageChar()
130 240
   {
131 241
      return function(this, "GetMessage", character.class, new Block((Body) () -> 
132 242
      {
133
         returnNormal(new character(_msg));
243
         returnNormal(msg == null
244
                  ? substitute("Expected: &1 but was: &2", expected, actual)
245
                  : new character(msg)); 
134 246
      }));
135 247
   }
248

  
249
   /**
250
    * Get the message string.
251
    * 
252
    * @return see above
253
    */
254
   public String getMessage()
255
   {
256
      return msg;
257
   }
258

  
259
   /**
260
    * The object implements the writeExternal method to save its contents
261
    * by calling the methods of DataOutput for its primitive values or
262
    * calling the writeObject method of ObjectOutput for objects, strings,
263
    * and arrays.
264
    *
265
    * @serialData Overriding methods should use this tag to describe
266
    *             the data layout of this Externalizable object.
267
    *             List the sequence of element types and, if possible,
268
    *             relate the element to a public/protected field and/or
269
    *             method of this Externalizable class.
270
    *
271
    * @param out the stream to write the object to
272
    * @exception IOException Includes any I/O exceptions that may occur
273
    */
274
   @Override
275
   public void writeExternal(ObjectOutput out) throws IOException
276
   {
277
      super.writeExternal(out);
278
      
279
      out.writeObject(actual);
280
      out.writeObject(expected);
281
      out.writeObject(msg);      
282
   }
283

  
284
   /**
285
    * The object implements the readExternal method to restore its
286
    * contents by calling the methods of DataInput for primitive
287
    * types and readObject for objects, strings and arrays.  The
288
    * readExternal method must read the values in the same sequence
289
    * and with the same types as were written by writeExternal.
290
    *
291
    * @param in the stream to read data from in order to restore the object
292
    * @exception IOException if I/O errors occur
293
    * @exception ClassNotFoundException If the class for an object being
294
    *              restored cannot be found.
295
    */
296
   @Override
297
   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
298
   {
299
      super.readExternal(in);
300
      
301
      actual = (BaseDataType) in.readObject();
302
      expected = (BaseDataType) in.readObject();
303
      msg = (String) in.readObject();
304
   }
136 305
}
src/com/goldencode/p2j/oo/core/system/ApplicationError.java 2022-11-15 19:42:34 +0000
12 12
**                  Do not use TypeFactory.object for internal usages, use ObjectVar if the reference must 
13 13
**                  be tracked.
14 14
**                  All TypeFactory.object variable definitions must be done outside of the top-level block.
15
 */
15
**     VVT 2022zzzz Serialization support added (see #4658).
16
*/
16 17

  
17 18
/*
18 19
 ** This program is free software: you can redistribute it and/or modify
......
77 78
import static com.goldencode.p2j.util.BlockManager.*;
78 79
import static com.goldencode.p2j.util.InternalEntry.Type;
79 80

  
81
import java.io.*;
80 82
import java.util.HashMap;
81 83
import java.util.Map;
82 84

  
83
import com.goldencode.p2j.oo.lang.LegacyClass;
84
import com.goldencode.p2j.oo.lang._BaseObject_;
85
import com.goldencode.p2j.oo.lang.*;
85 86
import com.goldencode.p2j.security.ContextLocal;
86 87

  
87 88
/**
......
95 96
   // this could be a plain static object maybe, not sure if context local works
96 97
   private static ContextLocal<Map<Class, String[]>> errorDefinitions = new ContextLocal<Map<Class, String[]>>()
97 98
   {
99
      @Override
98 100
      protected Map<Class, String[]> initialValue()
99 101
      {
100 102
         return new HashMap<Class, String[]>();
......
253 255
      }));
254 256
   }
255 257

  
258
   /**
259
    * The object implements the writeExternal method to save its contents
260
    * by calling the methods of DataOutput for its primitive values or
261
    * calling the writeObject method of ObjectOutput for objects, strings,
262
    * and arrays.
263
    *
264
    * @serialData Overriding methods should use this tag to describe
265
    *             the data layout of this Externalizable object.
266
    *             List the sequence of element types and, if possible,
267
    *             relate the element to a public/protected field and/or
268
    *             method of this Externalizable class.
269
    *
270
    * @param out the stream to write the object to
271
    * @exception IOException Includes any I/O exceptions that may occur
272
    */
273
   @Override
274
   public void writeExternal(final ObjectOutput out) throws IOException
275
   {
276
      super.writeExternal(out);
277
      
278
      out.writeObject(innerError);
279
   }
280

  
281
   /**
282
    * The object implements the readExternal method to restore its
283
    * contents by calling the methods of DataInput for primitive
284
    * types and readObject for objects, strings and arrays.  The
285
    * readExternal method must read the values in the same sequence
286
    * and with the same types as were written by writeExternal.
287
    *
288
    * @param in the stream to read data from in order to restore the object
289
    * @exception IOException if I/O errors occur
290
    * @exception ClassNotFoundException If the class for an object being
291
    *              restored cannot be found.
292
    */
293
   @Override
294
   public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
295
   {
296
      super.readExternal(in);
297
      
298
      innerError = (object<? extends LegacyError>) in.readObject();
299
   }
300

  
256 301
   protected String[] getErrorDefinition()
257 302
   {
258 303
      Map<Class, String[]> defs = errorDefinitions.get();
src/com/goldencode/p2j/oo/dataadmin/error/DataAdminError.java 2022-11-15 19:43:42 +0000
2 2
** Module   : DataAdminError.java
3 3
** Abstract : Implementation of the builtin class.
4 4
**
5
** Copyright (c) 2019-2021, Golden Code Development Corporation.
5
** Copyright (c) 2019-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- -------------------------------Description--------------------------------
8 8
** 001 CA  20190526 First version, stubs taken by converting the skeleton using FWD.
......
10 10
** 002 CA  20191024 Added method support levels and updated the class support level.
11 11
** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
12 12
**                  signature.
13
** 004 VVT 2022zzzz Serialization support added (see #4658).
13 14
*/
14 15

  
15 16
/*
......
74 75
import static com.goldencode.p2j.report.ReportConstants.*;
75 76
import static com.goldencode.p2j.util.InternalEntry.Type;
76 77

  
78
import java.io.*;
79

  
77 80
/**
78 81
 * Business logic (converted to Java from the 4GL source code
79 82
 * in OpenEdge/DataAdmin/Error/DataAdminError.cls).
......
91 94
   {
92 95
      externalProcedure(DataAdminError.this, new Block((Body) () -> 
93 96
      {
94
         {
95
         }
97
         // no-op
96 98
      }));
97 99
   }
98 100

  
......
187 189
         __lang_AppError_constructor__();
188 190
      }));
189 191
   }
192
   
193
   /**
194
    * The object implements the writeExternal method to save its contents
195
    * by calling the methods of DataOutput for its primitive values or
196
    * calling the writeObject method of ObjectOutput for objects, strings,
197
    * and arrays.
198
    *
199
    * @serialData Overriding methods should use this tag to describe
200
    *             the data layout of this Externalizable object.
201
    *             List the sequence of element types and, if possible,
202
    *             relate the element to a public/protected field and/or
203
    *             method of this Externalizable class.
204
    *
205
    * @param out the stream to write the object to
206
    * @exception IOException Includes any I/O exceptions that may occur
207
    */
208
   @Override
209
   public void writeExternal(ObjectOutput out) throws IOException
210
   {
211
      super.writeExternal(out);
212
      
213
      out.writeObject(httperrorNum);
214
      out.writeObject(innerError);
215
   }
216

  
217
   /**
218
    * The object implements the readExternal method to restore its
219
    * contents by calling the methods of DataInput for primitive
220
    * types and readObject for objects, strings and arrays.  The
221
    * readExternal method must read the values in the same sequence
222
    * and with the same types as were written by writeExternal.
223
    *
224
    * @param in the stream to read data from in order to restore the object
225
    * @exception IOException if I/O errors occur
226
    * @exception ClassNotFoundException If the class for an object being
227
    *              restored cannot be found.
228
    */
229
   @Override
230
   public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
231
   {
232
      super.readExternal(in);
233
      
234
      httperrorNum = (integer) in.readObject();
235
      innerError = (object<? extends LegacyError>) in.readObject();
236
   }
237

  
190 238
}
src/com/goldencode/p2j/oo/json/JsonParserError.java 2022-11-15 19:44:16 +0000
2 2
** Module   : JsonParserError.java
3 3
** Abstract : Implementation of the Progress.Json.JsonParserError builtin class.
4 4
**
5
** Copyright (c) 2019-2021, Golden Code Development Corporation.
5
** Copyright (c) 2019-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- -------------------------------Description--------------------------------
8 8
** 001 GES 20190307 First version.
......
13 13
** 006 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
14 14
**                  signature.
15 15
**     VVT 20210917 Javadoc fixed. 
16
** 007 VVT 2022zzzz Serialization support added (see #4658).
16 17
*/
17 18

  
18 19
/*
......
76 77
import static com.goldencode.p2j.report.ReportConstants.*;
77 78
import static com.goldencode.p2j.util.InternalEntry.Type;
78 79

  
80
import java.io.*;
81

  
79 82
/**
80 83
 * The replacement for the built-in Progress.Json.JsonParserError.
81 84
 */
......
95 98
   {
96 99
      externalProcedure(JsonParserError.this, new Block((Body) () -> 
97 100
      {
98
         {
99
         }
101
         // no-op
100 102
      }));
101 103
   }
102 104

  
......
204 206
   {
205 207
      return ObjectOps.newInstance(JsonParserError.class, "II", msg, num);
206 208
   }
209
   
210
   /**
211
    * The object implements the writeExternal method to save its contents
212
    * by calling the methods of DataOutput for its primitive values or
213
    * calling the writeObject method of ObjectOutput for objects, strings,
214
    * and arrays.
215
    *
216
    * @serialData Overriding methods should use this tag to describe
217
    *             the data layout of this Externalizable object.
218
    *             List the sequence of element types and, if possible,
219
    *             relate the element to a public/protected field and/or
220
    *             method of this Externalizable class.
221
    *
222
    * @param out the stream to write the object to
223
    * @exception IOException Includes any I/O exceptions that may occur
224
    */
225
   @Override
226
   public void writeExternal(ObjectOutput out) throws IOException
227
   {
228
      super.writeExternal(out);
229
      
230
      out.writeObject(offset);      
231
   }
232

  
233
   /**
234
    * The object implements the readExternal method to restore its
235
    * contents by calling the methods of DataInput for primitive
236
    * types and readObject for objects, strings and arrays.  The
237
    * readExternal method must read the values in the same sequence
238
    * and with the same types as were written by writeExternal.
239
    *
240
    * @param in the stream to read data from in order to restore the object
241
    * @exception IOException if I/O errors occur
242
    * @exception ClassNotFoundException If the class for an object being
243
    *              restored cannot be found.
244
    */
245
   @Override
246
   public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
247
   {
248
      super.readExternal(in);
249
      
250
      offset = (integer) in.readObject();
251
   }
252

  
207 253
}
src/com/goldencode/p2j/oo/lang/AppError.java 2022-11-15 19:44:53 +0000
16 16
 ** 008 ME  20200409 Add new static factory methods to create AppError.
17 17
 ** 009 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
18 18
 **                  signature.
19
**     VVT  20220830 Missing Javadoc added; missing @Override annotations added.
19
 ** 010 VVT 20220830 Missing Javadoc added; missing @Override annotations added.
20
 **     VVT 2022zzzz Serialization support added (see #4658).
20 21
 */
21 22

  
22 23
/*
......
77 78
import static com.goldencode.p2j.report.ReportConstants.*;
78 79
import static com.goldencode.p2j.util.BlockManager.*;
79 80

  
81
import java.io.*;
82

  
80 83
import com.goldencode.p2j.util.*;
81 84
import com.goldencode.p2j.util.InternalEntry.*;
82 85

  
......
294 297
   {
295 298
      super.addMessage(msg,  num);
296 299
   }
300

  
301
   /**
302
    * The object implements the writeExternal method to save its contents
303
    * by calling the methods of DataOutput for its primitive values or
304
    * calling the writeObject method of ObjectOutput for objects, strings,
305
    * and arrays.
306
    *
307
    * @serialData Overriding methods should use this tag to describe
308
    *             the data layout of this Externalizable object.
309
    *             List the sequence of element types and, if possible,
310
    *             relate the element to a public/protected field and/or
311
    *             method of this Externalizable class.
312
    *
313
    * @param out the stream to write the object to
314
    * @exception IOException Includes any I/O exceptions that may occur
315
    */
316
   @Override
317
   public void writeExternal(final ObjectOutput out) throws IOException
318
   {
319
      super.writeExternal(out);
320
      
321
      out.writeObject(returnValue);
322
      out.writeBoolean(fromReturn);
323
   }
324

  
325
   /**
326
    * The object implements the readExternal method to restore its
327
    * contents by calling the methods of DataInput for primitive
328
    * types and readObject for objects, strings and arrays.  The
329
    * readExternal method must read the values in the same sequence
330
    * and with the same types as were written by writeExternal.
331
    *
332
    * @param in the stream to read data from in order to restore the object
333
    * @exception IOException if I/O errors occur
334
    * @exception ClassNotFoundException If the class for an object being
335
    *              restored cannot be found.
336
    */
337
   @Override
338
   public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
339
   {
340
      super.readExternal(in);
341
      
342
      returnValue = (character) in.readObject();
343
      fromReturn = in.readBoolean();
344
   }
297 345
}
src/com/goldencode/p2j/oo/lang/LegacyEnum.java 2022-11-15 19:45:35 +0000
18 18
** 005 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
19 19
**                  signature.
20 20
**     TJD 20220504 Java 11 compatibility minor changes
21
**     VVT 2022zzzz Serialization support added (see #4658).
21 22
*/
22 23

  
23 24
/*
......
78 79
import static com.goldencode.p2j.report.ReportConstants.*;
79 80
import static com.goldencode.p2j.util.InternalEntry.Type;
80 81

  
82
import java.io.*;
81 83
import java.util.*;
82 84
import java.util.stream.*;
83 85
import java.util.function.*;
......
91 93
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL | RT_LVL_FULL)
92 94
public class LegacyEnum
93 95
extends BaseObject
94
implements Comparable<LegacyEnum>
96
implements Comparable<LegacyEnum>, Externalizable
95 97
{
96 98
   /** Maps enum classes to their control record. */
97 99
   private static final Map<Class<?>, EnumControlRecord> registry = new IdentityHashMap<>();
......
101 103
                                         "of method \"ToObject\"";
102 104
   
103 105
   /** The case-preserved legacy name for the enum. */
104
   protected final String name;
106
   protected String name;
105 107

  
106 108
   /** The 64-bit enum value. */
107
   protected final long value;
109
   protected long value;
108 110
   
109 111
   /** Override for the symbol name in cases where it is different from the enum name. */
110 112
   private String symname = null;
......
723 725
   }
724 726
   
725 727
   /**
728
    * The object implements the writeExternal method to save its contents
729
    * by calling the methods of DataOutput for its primitive values or
730
    * calling the writeObject method of ObjectOutput for objects, strings,
731
    * and arrays.
732
    *
733
    * @serialData Overriding methods should use this tag to describe
734
    *             the data layout of this Externalizable object.
735
    *             List the sequence of element types and, if possible,
736
    *             relate the element to a public/protected field and/or
737
    *             method of this Externalizable class.
738
    *
739
    * @param out the stream to write the object to
740
    * @exception IOException Includes any I/O exceptions that may occur
741
    */
742
   @Override
743
   public void writeExternal(final ObjectOutput out) throws IOException
744
   {
745
      out.writeUTF(name);
746
      out.writeLong(value);
747
      out.writeUTF(symname);
748
   }
749

  
750
   /**
751
    * The object implements the readExternal method to restore its
752
    * contents by calling the methods of DataInput for primitive
753
    * types and readObject for objects, strings and arrays.  The
754
    * readExternal method must read the values in the same sequence
755
    * and with the same types as were written by writeExternal.
756
    *
757
    * @param in the stream to read data from in order to restore the object
758
    * @exception IOException if I/O errors occur
759
    * @exception ClassNotFoundException If the class for an object being
760
    *              restored cannot be found.
761
    */
762
   @Override
763
   public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
764
   {
765
      name = in.readUTF();
766
      value = in.readLong();
767
      symname = in.readUTF();      
768
   }
769

  
770
   /**
726 771
    * Return the enum instance of the given type which is associated with the provided value.
727 772
    *
728 773
    * @param    <T>
......
1657 1702
         this.valueSort       = valueSort;
1658 1703
      }
1659 1704
   }
1705

  
1660 1706
}
src/com/goldencode/p2j/oo/lang/ProError.java 2022-11-15 19:46:07 +0000
17 17
** 009 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
18 18
**                  signature.
19 19
**     CA  20220208 Implemented the callstack property.
20
**     VVT 2022zzzz Serialization support added (see #4658).
20 21
*/
21 22

  
22 23
/*
......
74 75

  
75 76
package com.goldencode.p2j.oo.lang;
76 77

  
78
import static com.goldencode.p2j.report.ReportConstants.*;
77 79
import static com.goldencode.p2j.util.BlockManager.*;
78
import static com.goldencode.p2j.report.ReportConstants.*;
79 80

  
81
import java.io.*;
80 82
import java.util.*;
81 83

  
82 84
import com.goldencode.p2j.*;
83 85
import com.goldencode.p2j.util.*;
84
import com.goldencode.p2j.util.InternalEntry.Type;
86
import com.goldencode.p2j.util.InternalEntry.*;
85 87

  
86 88
/**
87 89
 * Implementation of the Progress.Lang.ProError builtin class.
......
90 92
@LegacyResourceSupport(supportLvl = CVT_LVL_FULL|RT_LVL_BASIC)
91 93
public class ProError
92 94
extends BaseObject
93
implements LegacyError
95
implements LegacyError, Externalizable
94 96
{
95 97
   /** The severity property. */
96
   protected final integer severity = new integer(0);
98
   protected integer severity = new integer(0);
97 99
   
98 100
   /** The recorded errors. */
99
   protected final List<NumberedException> errors = new ArrayList<>();
101
   protected List<NumberedException> errors = new ArrayList<>();
100 102
   
101 103
   /** The call stack at the time the error was thrown. */
102 104
   private String callStack = null;
......
138 140
   {
139 141
      externalProcedure(this, new Block((Body) () -> 
140 142
      {
143
         // no-op
141 144
      }));
142 145
   }
143 146

  
......
307 310
    *           
308 311
    * @return   The error message for the specified error.
309 312
    */
313
   @Override
310 314
   @LegacySignature(returns = "CHARACTER", type = Type.METHOD, name = "GetMessage", parameters = 
311 315
   {
312 316
      @LegacyParameter(name = "idx", type = "INTEGER", mode = "INPUT")
......
330 334
    *           
331 335
    * @return   The error message number for the specified error.
332 336
    */
337
   @Override
333 338
   @LegacySignature(returns = "INTEGER", type = Type.METHOD, name = "GetMessageNum", parameters = 
334 339
   {
335 340
      @LegacyParameter(name = "idx",  type = "INTEGER", mode = "INPUT"),
......
361 366
   }
362 367
   
363 368
   /**
369
    * The object implements the writeExternal method to save its contents
370
    * by calling the methods of DataOutput for its primitive values or
371
    * calling the writeObject method of ObjectOutput for objects, strings,
372
    * and arrays.
373
    *
374
    * @serialData Overriding methods should use this tag to describe
375
    *             the data layout of this Externalizable object.
376
    *             List the sequence of element types and, if possible,
377
    *             relate the element to a public/protected field and/or
378
    *             method of this Externalizable class.
379
    *
380
    * @param out the stream to write the object to
381
    * @exception IOException Includes any I/O exceptions that may occur
382
    */
383
   @Override
384
   public void writeExternal(final ObjectOutput out) throws IOException
385
   {
386
      out.writeObject(severity);
387
      out.writeObject(errors);
388
      out.writeObject(callStack);      
389
   }
390

  
391
   /**
392
    * The object implements the readExternal method to restore its
393
    * contents by calling the methods of DataInput for primitive
394
    * types and readObject for objects, strings and arrays.  The
395
    * readExternal method must read the values in the same sequence
396
    * and with the same types as were written by writeExternal.
397
    *
398
    * @param in the stream to read data from in order to restore the object
399
    * @exception IOException if I/O errors occur
400
    * @exception ClassNotFoundException If the class for an object being
401
    *              restored cannot be found.
402
    */
403
   @Override
404
   public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
405
   {
406
      severity = (integer) in.readObject();
407
      errors   = (List<NumberedException>) in.readObject();
408
      callStack = (String) in.readObject();
409
   }
410
   /**
364 411
    * Check if the specified index is valid for {@link #errors}.
365 412
    * 
366 413
    * @param    idx
......
383 430
      
384 431
      return true;
385 432
   }
433

  
386 434
}
src/com/goldencode/p2j/oo/lang/SoapFaultError.java 2022-11-15 19:46:36 +0000
2 2
** Module   : SoapFaultError.java
3 3
** Abstract : Implementation of the builtin class.
4 4
**
5
** Copyright (c) 2019-2021, Golden Code Development Corporation.
5
** Copyright (c) 2019-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- -------------------------------Description--------------------------------
8 8
** 001 CA  20190526 First version, stubs taken by converting the skeleton using FWD.
......
10 10
** 002 CA  20191024 Added method support levels and updated the class support level.
11 11
** 003 CA  20210221 Fixed 'qualified', 'extent' and 'returns' annotations at the legacy
12 12
**                  signature.
13
** 004 VVT 2022zzzz Serialization support added (see #4658).
13 14
*/
14 15

  
15 16
/*
......
67 68

  
68 69
package com.goldencode.p2j.oo.lang;
69 70

  
71
import static com.goldencode.p2j.report.ReportConstants.*;
72
import static com.goldencode.p2j.util.BlockManager.*;
73

  
74
import java.io.*;
75

  
70 76
import com.goldencode.p2j.util.*;
71
import com.goldencode.p2j.oo.lang.*;
72

  
73
import static com.goldencode.p2j.util.BlockManager.*;
74
import static com.goldencode.p2j.report.ReportConstants.*;
75
import static com.goldencode.p2j.util.InternalEntry.Type;
77
import com.goldencode.p2j.util.InternalEntry.*;
76 78

  
77 79
/**
78 80
 * Business logic (converted to Java from the 4GL source code
......
89 91
   {
90 92
      externalProcedure(SoapFaultError.this, new Block((Body) () -> 
91 93
      {
92
         {
93
         }
94
         // no-op
94 95
      }));
95 96
   }
96 97

  
......
113 114
         returnNormal(soapFault);
114 115
      }));
115 116
   }
117
   
118
   /**
119
    * The object implements the writeExternal method to save its contents
120
    * by calling the methods of DataOutput for its primitive values or
121
    * calling the writeObject method of ObjectOutput for objects, strings,
122
    * and arrays.
123
    *
124
    * @serialData Overriding methods should use this tag to describe
125
    *             the data layout of this Externalizable object.
126
    *             List the sequence of element types and, if possible,
127
    *             relate the element to a public/protected field and/or
128
    *             method of this Externalizable class.
129
    *
130
    * @param out the stream to write the object to
131
    * @exception IOException Includes any I/O exceptions that may occur
132
    */
133
   @Override
134
   public void writeExternal(final ObjectOutput out) throws IOException
135
   {
136
      super.writeExternal(out);
137
      
138
      out.writeObject(soapFault);      
139
   }
140

  
141
   /**
142
    * The object implements the readExternal method to restore its
143
    * contents by calling the methods of DataInput for primitive
144
    * types and readObject for objects, strings and arrays.  The
145
    * readExternal method must read the values in the same sequence
146
    * and with the same types as were written by writeExternal.
147
    *
148
    * @param in the stream to read data from in order to restore the object
149
    * @exception IOException if I/O errors occur
150
    * @exception ClassNotFoundException If the class for an object being
151
    *              restored cannot be found.
152
    */
153
   @Override
154
   public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
155
   {
156
      super.readExternal(in);
157
      
158
      soapFault = (handle) in.readObject();
159
   }
160

  
116 161
}
src/com/goldencode/p2j/oo/net/http/HttpRequestError.java 2022-11-15 19:47:06 +0000
2 2
** Module   : HttpRequestError.java
3 3
** Abstract : Implementation of the builtin class.
4 4
**
5
** Copyright (c) 2020, Golden Code Development Corporation.
5
** Copyright (c) 2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- -------------------------------Description--------------------------------
8 8
** 001 MP  20200603 First version, stubs taken by converting the skeleton using FWD.
9 9
** 002 ME  20201214 Implement as of OE12.2.
10
** 
10
** 003 VVT 2022zzzz Serialization support added (see #4658).
11 11
*/
12 12

  
13 13
/*
......
91 91
      {
92 92
         onBlockLevel(Condition.ERROR, Action.THROW);
93 93
         {
94
            // no-op
94 95
         }
95 96
      }));
96 97
   }
src/com/goldencode/p2j/oo/web/SendExceptionError.java 2022-11-15 19:47:36 +0000
2 2
** Module   : SendExceptionError.java
3 3
** Abstract : Implementation of the builtin class.
4 4
**
5
** Copyright (c) 2019-2021, Golden Code Development Corporation.
5
** Copyright (c) 2019-2022, Golden Code Development Corporation.
6 6
**
7 7
** -#- -I- --Date-- -------------------------------Description--------------------------------
8 8
** 001 ME  20210910 First version, stubs taken by converting the skeleton using FWD.
9
** 002 VVT 2022zzzz Serialization support added (see #4658).
9 10
*/
10 11

  
11 12
/*
......
68 69
import static com.goldencode.p2j.util.BlockManager.*;
69 70
import static com.goldencode.p2j.util.InternalEntry.Type;
70 71

  
72
import java.io.*;
73

  
71 74
import com.goldencode.p2j.oo.core.Assert;
72
import com.goldencode.p2j.oo.net.http.StatusCodeHelper;
75
import com.goldencode.p2j.oo.net.http.*;
73 76

  
74 77
/**
75 78
 * Business logic (converted to Java from the 4GL source code
......
94 97
      }, 
95 98
      (Body) () -> 
96 99
      {
97
         {
98
         }
100
         // no-op
99 101
      }));
100 102
   }
101 103

  
......
230 232
         __web_SendExceptionError_constructor__(p1, StatusCodeHelper.getMessage(p1), p2);
231 233
      }));
232 234
   }
235

  
236
   @Override
237
   public void writeExternal(final ObjectOutput out) throws IOException
238
   {
239
      super.writeExternal(out);
240
      
241
      out.writeObject(statusCode);
242
      out.writeObject(statusMessage);
243
   }
244

  
245
   @Override
246
   public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
247
   {
248
      super.readExternal(in);
249
      
250
      statusCode = (object<? extends StatusCodeEnum>) in.readObject();
251
      statusMessage = (character) in.readObject();
252
   }
233 253
}
src/com/goldencode/p2j/util/object.java 2022-11-15 19:50:52 +0000
32 32
**                  initialized at the method's execution, and not at the caller's arguments.
33 33
**     CA  20220304 Fixed 'invalid handle' error message text.
34 34
**     AL2 20220319 Added value proxy check in assign.
35
**     VVT 2022zzzz Serialization support added (see #4658).
35 36
*/
36 37

  
37 38
/*
......
199 200
    * 
200 201
    * @return   type
201 202
    */
203
   @Override
202 204
   public Type getType()
203 205
   {
204 206
      return Type.OBJECT;
......
296 298
    *
297 299
    * @return  The hash code for this object instance.
298 300
    */
301
   @Override
299 302
   public int hashCode()
300 303
   {
301 304
      int result = 17;
......
355 358
    * @param    value
356 359
    *           The instance from which to copy state.
357 360
    */
361
   @Override
358 362
   public void assign(BaseDataType value)
359 363
   {
360 364
      if (value != null)
......
426 430
    * @param    old
427 431
    *           The backup instance from which to copy data.
428 432
    */
433
   @Override
429 434
   public void assign(Undoable old)
430 435
   {
431 436
      if (old instanceof BaseDataType)
......
444 449
    * @return   <code>true</code> if this instance is set to the
445 450
    *           <code>unknown value</code>.
446 451
    */
452
   @Override
447 453
   public boolean isUnknown()
448 454
   {
449 455
      return !ObjectOps.isValid(ref);
......
488 494
    * <p>
489 495
    * <b>Warning: the data stored in this instance will be invalid after calling this method.</b>
490 496
    */
497
   @Override
491 498
   public void setUnknown()
492 499
   {
493 500
      ref = null;
......
500 507
    *
501 508
    * @return   A clone of this instance.
502 509
    */
510
   @Override
503 511
   public BaseDataType duplicate()
504 512
   {
505 513
      return new object<>(this);
......
510 518
    *
511 519
    * @return   An instance that represents the <code>unknown value</code>.
512 520
    */
521
   @Override
513 522
   public BaseDataType instantiateUnknown()   
514 523
   {
515 524
      return new object<>();
......
525 534
    *
526 535
    * @return   The formatted string.
527 536
    */
537
   @Override
528 538
   public String toString(String fmt)
529 539
   {
530 540
      return toStringMessage();
......
538 548
    *
539 549
    * @return   The 'message' formatted string.
540 550
    */
551
   @Override
541 552
   public String toStringMessage()
542 553
   {
543 554
      return isUnknown() ? "?" : ref.toLegacyString().toStringMessage();
......
550 561
    *
551 562
    * @return   The 'export' formatted string.
552 563
    */
564
   @Override
553 565
   public String toStringExport()
554 566
   {
555 567
      return toStringMessage();
......
560 572
    *
561 573
    * @return   The default format string.
562 574
    */
575
   @Override
563 576
   public String defaultFormatString()
564 577
   {
565 578
      // objects can't be formatted
......
567 580
   }
568 581
   
569 582
   /**
570
    * Replacement for the default object reading method. The latest state is read from the input 
571
    * source.
572
    * 
573
    * @param    in
574
    *           The input source from which fields will be restored.
575
    *
576
    * @throws   NotSerializableException
577
    *           Always, as legacy objects can't be serialized.
583
    * The object implements the writeExternal method to save its contents
584
    * by calling the methods of DataOutput for its primitive values or
585
    * calling the writeObject method of ObjectOutput for objects, strings,
586
    * and arrays.
587
    *
588
    * @serialData Overriding methods should use this tag to describe
589
    *             the data layout of this Externalizable object.
590
    *             List the sequence of element types and, if possible,
591
    *             relate the element to a public/protected field and/or
592
    *             method of this Externalizable class.
593
    *
594
    * @param out the stream to write the object to
595
    * @exception IOException Includes any I/O exceptions that may occur
578 596
    */
579
   public void readExternal(ObjectInput in)
580
   throws IOException, ClassNotFoundException
597
   @Override
598
   public void writeExternal(final ObjectOutput out) throws IOException
581 599
   {
582
      // there is no need to serialize this object
583
      throw new NotSerializableException("Legacy objects can't be serialized!");
600
      out.writeObject(type);
601
      out.writeObject(ref);      
584 602
   }
585 603

  
586 604
   /**
587
    * Replacement for the default object writing method. The latest state is written to the output
588
    * destination.
589
    * 
590
    * @param    out
591
    *           The output destination to which fields will be saved.
605
    * The object implements the readExternal method to restore its
606
    * contents by calling the methods of DataInput for primitive
607
    * types and readObject for objects, strings and arrays.  The
608
    * readExternal method must read the values in the same sequence
609
    * and with the same types as were written by writeExternal.
592 610
    *
593
    * @throws   NotSerializableException
594
    *           Always, as legacy objects can't be serialized.
611
    * @param in the stream to read data from in order to restore the object
612
    * @exception IOException if I/O errors occur
613
    * @exception ClassNotFoundException If the class for an object being
614
    *              restored cannot be found.
595 615
    */
596
   public void writeExternal(ObjectOutput out)
597
   throws IOException
616
   @Override
617
   public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException
598 618
   {
599
      // there is no need to serialize this object
600
      throw new NotSerializableException("Legacy objects can't be serialized!");
619
      type = (Class<T>) in.readObject();
620
      ref = (T) in.readObject();
601 621
   }
602 622

  
603 623
   /**