Errors in LO 4.1 but not in LO 3.5

Hi,

I have an accounting system that runs fine under LO v3.5.6.2, but under LO
v4.1.5.3 it throws the error "Basic runtime error. Incorrect property
value". I've tracked it down to a macro that is attempting to read from a
Date object on the Form. The object is a
com.sun.star.comp.forms.OdateModel and has a field called "Current Value".
However this field is stored differently between the two LO versions -
*v3.5*
Current Value 20140221 Variant/Long
*v4.1*
Current Value com.sun.star.util.Date
  - Day 21 UShort
  - Month 2 UShort
  - Year 2014 Integer

My macro is expecting a single value, but under v4.1 it has three values,
so it's obvious why it is throwing the error.

In both cases I have used the Java version 1.6.0_29, so I cannot work out
why there is this difference in the way the OdateModel object is storing
its Current Value. I could test for the Current Value's Type each time and
extract the date with appropriate code. But this doesn't seem to be the
right way to go. And there could be other variances between the LO
versions that I haven't come across yet.

I am running an H2 Database on Windows 7 64 bit. Can anyone spot what I
might be doing wrong with my Java settings in LO v4.1?

Thanks,

Noel

There ​was a change in date objects:
<https://wiki.documentfoundation.org/ReleaseNotes/4.1> (look for "Changes
to UNO APIs")

​This looks like the culprit in your case. The best course of action is
likely to update your code to follow these changes (either a quick fix to
"reproduce" the old value, or more long-term fix in the code around it).​

Hi Cley,

I've now changed my code to accommodate the new date structure in LO v4.1
and it is working well.

I actually had two errors occurring simultaneously. The date one seemed
the easiest to fix, so I did it first. The other error was -

'The contents of a combo box or list field could not be determined.
Invalid value "2" for parameter "columnIndex" [90008-139] '

I have 5 combo boxes and one list field in my Form. The problem turned out
to be in the bound field in the list. I have a single column in the
associated query, and in LO v3.5 the bound field is 1, but in LO v4.1 it
needs to be 0. I hunted high and low through my macro code to try to find
where the problem was. Finally realised that it was in the Form
specifications for the list field! Hopefully this might save others some
time if they get the same error.

Thanks for your help,

Noel

Oh dear! So let me get this straight. Old macros might not work with newer versions of LO.

I realize that backward compatibility leads to "bloat" when carried to the extreme but shouldn't the older specification be deprecated but still supported through two major versions (e.g. version 3.x specification deprecated through version 5.x) or maybe for two years? And shouldn't there be a stand alone migration tool? And shouldn't a library of these tools be available online indefinitely?

​This is complicated, and usually things are done this way. However, at the
time this change happened, there where a lot of warnings about it, because
it changed the behavior of existing functions. You can't really mark
"deprecated" a function and replace it with another function using the same
name/interface. And having something like a DateTime2 interface to
"supersede" DateTime would only lead to more bloat, the exact thing we
don't want when facing this kind of changes.

To be fair, this is a relatively rare case, and is well documented. It is
still annoying when you hit that in your code, but sometime it can't be
avoided.