Patrick Muls

Greenhorn
+ Follow
since Aug 08, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Patrick Muls

Manuel,

I've decompiled the classes concerned, and it seems to involve the GregorianCalendar:
public static final Numeric date_of_integer(Variable variable)
{
long l = variable.toLong();
GregorianCalendar gregoriancalendar = new GregorianCalendar(1600, 11, 31);
gregoriancalendar.add(5, (int)l);
return new Numeric(Utilities.format(gregoriancalendar.get(1), 4) + Utilities.format(gregoriancalendar.get(2) + 1, 2) + Utilities.format(gregoriancalendar.get(5), 2));
}

public static final Numeric day_of_integer(Variable variable)
{
long l = variable.toLong();
GregorianCalendar gregoriancalendar = new GregorianCalendar(1600, 11, 31);
gregoriancalendar.add(5, (int)l);
return new Numeric(Utilities.format(gregoriancalendar.get(1), 4) + Utilities.format(gregoriancalendar.get(6), 3));
}
public static final Numeric integer_of_date(Variable variable)
{
String s = variable.toNumericString();
if(s.length() < 8)
s = "00000000" + s;
if(s.length() > 8)
s = s.substring(s.length() - 8);
long l1 = 0L;
try
{
int j = Integer.parseInt(s.substring(0, 4));
int k = Integer.parseInt(s.substring(4, 6));
int l = Integer.parseInt(s.substring(6, 8));
GregorianCalendar gregoriancalendar = new GregorianCalendar(j, k - 1, l);
long l3 = gregoriancalendar.getTime().getTime() - d.getTime().getTime();
long l4 = 0x36ee80L;
long l2 = (l3 + l4) / (24L * l4);
return new Numeric(l2);
}
catch(Exception exception)
{
return new Numeric();
}
}

public static final Numeric integer_of_day(Variable variable)
{
String s = variable.toNumericString();
if(s.length() < 7)
s = "0000000" + s;
if(s.length() > 7)
s = s.substring(s.length() - 7);
try
{
int j = Integer.parseInt(s.substring(0, 4));
int k = Integer.parseInt(s.substring(4, 7));
j -= 1601;
return new Numeric(((j * 365 + j / 4) - j / 100) + j / 400 + k);
}
catch(Exception exception)
{
return new Numeric();
}
}
But I think I'll pass the problem on to PerCobol, and go for a less complicated solution to check a date is valid.

Thanks for your assistance.

Patrick

PS: my office phone is 02 547 58 59
19 years ago
Hi Manuel,

Yeah, it's been about 4 years now. Nice to see you've become a ranch hand.

As I mentioned above, we have a Cobol environment, but will chance it to Java in the not too far future. For now using the PerCobol toolkit from LegacyJ, all programs already run inside a JVM. I'll sketch the process and the results for you: Good Error
Input: DDMMYYYY 17091946 16091946
changed to YYYYMMDD 19460917 19460916 A
Cobol function INTEGER-OF-DATE -> 125903 125902
Cobol function DAY-OF-INTEGER -> 1945260 1945258 !!! 2 days difference)
Recalc date using
Cobol function INTEGER-OF-DAY -> 125903 125901
Cobol function DATE-OF-INTEGER -> 19450917 19450914 B
Test date A == date B -> OK Error

So it is the implementation of DAY-OF-INTEGER that causes the problem, but the only difference is the JVM version. I don't think it is in PerCobol as we use the same bytecode. But as there is no javacode itself available, I cannot get that to you. So I suppose I'll have to use another way to verify the date is correct, our add some correction when in JVM1.4. But how can I recognize what version I'm running in?

Patrick Muls
19 years ago
We just finished a big conversion project from VAX to WinXP. The application is written in Cobol, but using PerCobol it is compiled to javabyte code which is then run on a JVM. Here we're encountering some differences when running on different versions.

First there is a module that handles date conversions, such as from DDMMYYYY to julian date (YYYYDDD). To check validity of a date, this process is also done in reverse. From 17091945 onward, there are no problems, but dates before are being accepted in JDK 1.3 and 1.5, BUT rejected in JDK 1.4!!!
Another annoying difference occurs in the panels. When using JDK 1.3, upon reaching the end of an entry field, the cursor jumps to the next field. But in JDK 1.4 and 1.5 this no longer happens, and users have to use their mouse to go to the next field.

Anybody has an idea how this can be resolved?

Thanks for your suggestions.
Patrick Muls
19 years ago
Hello,

Is it posible and how is it done then, to install a Java SDK without having administration rights on a Windows XP machine?

Patrick Muls
19 years ago
Recently I was having some problems with my banking software, the payment applet got stuck and didn't forward any transfert (it's that some nice software?) Anyhow when I contacted their helpdesk, they had me change my IE's VM from the Sun version to Microsoft's. Then everything worked fine (and my money is gone). How come there can be such an incompatibility between those 2? I thought Sun was the standard, and MS even no longer provided a VM?
20 years ago
Java is already installed as I'm writing most of my new stuff in Java. And WebObject also generates Java. And even our old Cobol apps have been rendered to java using PerCobol. But to have J2EE I understand I have to run a seperate J2EE server software (Apache, JBoss, WebLogic, ...) next to IIS and link to it from the latter.
I'm planning on using J2EE to write new web applications, but my company is currently using a Windows IIS server with WebObjects applications. Can J2EE be run on this IIS server?
I have built an applet using PerCobol and want to use it inside of an existing WebObjects (WO) application. WO geneates an HTML page in the application. When I open this page in my browser, the applet appears fine (web page). But when I start the complete WO application, the same page says the applet is not initialized and loading the applet fails :roll: (Application). The applet is presented to the page in the form of a jar-file, which resides in the same directory. Anybody has any suggestions?
Thanks,
Patrick Muls
20 years ago
I' m responsable for our Internat application that was developed in WebObjects from Apple. It has been running for almost 2 years now, nut since a couple of weeks a certain problem is sticking up its ugly head.
One, and only one, of our users (the first one who also did the testing, so he knows it well) gets an OutOfMemoryError when he tries to execute it for the first time. He gets to the point where he confirms his changes to db, they are indeed written to the tables, and while waiting for the confirmation panel, he receives:
<WOApplication 'DTS-Membre'>: Exception occurred while handling request:
com.webobjects.foundation.NSForwardException [java.lang.OutOfMemoryError] null
Afterward anybody logging on gets the error:
Exception occurred while handling request:
java.lang.IllegalStateException: _obtainOpenChannel -- com.webobjects.eoaccess.EODatabaseContext com.webobjects.eoaccess.EODatabaseContext@24e743: no database channel is available.
So the solution is to restart the application, though it is apparently still runing alright on our IIS server. Then that person also can continue with the application just like anybody else.
Trying with another logid, or on our test-machine, that person doesn't have this problem, so it isn't his way of handling it either.
Can anybody suggest how I can find where the application goes awry? I'm running out of ideas.
Thanks a lot
I've to provide a file for another company's application. That requires that the file consists of records of 80 positions long, and restricts the acceptable character values to those between hexa-values 20 and 5D. In my first test I used \n characters to divide my file into records. But their application rejects those \n characters. So I'm looking for another way to define an 80-position file, without using the \n. I remember that on mainframes one could give a file descriptor saying that the record length was such and the blocksize was so. Is this also possible in any of the java IO classes? I looked at the FileDescriptor class, but that doen't seem to describe anything
21 years ago
First thanks to all of you who voiced an answer to my question. Some of you asked for the code. It is part of a large webapplication written by my predecessor now almost 2 years ago, which resulted in the server getting blocked. The only message I got in the log was simply saying there was a NPE, but no trace or anything was available to find it. I didn't even know which user suffered the problem. So I spent several days trying to find it. It turned out to be in an IF statement where about a dozen strings are tested to determine they either all or none of them are filled in. The test was conform to Layne Land's suggestion,
if ((s1 != null && s1.equals(""))
|| (s2 != null && s2.equals("")
etc)
But somewhere in this set, he wrote
|| (sx != null && sy.equals("")
|| (sy != null && sy.equals("")
where in 99.9% of the cases sx and sy are always boh present or not. But in some records sx exists and sy not, and there the NPE was thrown.
So in the future if I have to write such a test, I'll certainly will use Neil's suggestion to put the literal first.
Thanks again to you all.
21 years ago
The aString.equals(bString) method throws a NullPointerException when aString is null. While that is probably the best solution using other objects, I wonder why it is not intercepted for a String object as it is obvious that the intented result is false.
21 years ago
Sorry, I meant variable ORACLE, not PROJ
We got around to solving this problem. It turns out that the environment variable PROJ doesn't seem to play any role in allocating the driver zipfile to the application. Putting the classes12.zip file in the EXT-directory of the JDK however did solve the problem.
I'm using a JDBC connection to access an Oracle db. Using JDK 1.3 it functions OK with the following run-command:
set JDK=C:\jdk1.3.1\jre
set PROJ=C:\Distro
set ORACLE=%PROJ%\classes12.zip
set path=.;%JDK%\bin;
set classpath=.;%PROJ%;%ORACLE%;%JDK%\jre\lib\rt.jar;
set classpath
java -version
java -Duser.language=nl -Duser.region=BE -jar NAL.jar
pause
However using the same command to use JDK1.4, I get an SQLSTATE='080004' saying it is not possible to connect to this driver. The commandfile, program-jar, and DB however are the same:
set JDK=C:\Program Files\Java\j2re1.4.1_01
set PROJ=C:\Distro
set ORACLE=%PROJ%\classes12.zip
set path=.;%JDK%\bin;
set classpath=.;%PROJ%;%ORACLE%;%JDK%\jre\lib\rt.jar;
set classpath
java -version
java -Duser.language=nl -Duser.region=BE -jar NAL.jar
pause
Has anybdy any suggestions to explain, and resolve, this strange behavior?
Patrick Muls
Datassur, Belgium