Wednesday, May 18, 2011

Arthimetic operation on software version. Strict no

 Remember   , had to do the entire development activity afresh

                     // Before proceeding with the double precision comparison we
                        // need to make a check to consider the following scenario.
                        // In montblanc release,  remote controller version was 8.9
                        // and local controller version was 8.9
                        // In morpheous local controller version was upgraded to 8.10
                        //     Versionally speaking 8.10 > 8.9
                        //     Mathematically speaking 8.10 < 8.9
                        // This cause an error "rtmt plugin not compatible. reinstall error"
                        // thrown, which not legitimate from customer prespect.
                        // Hence an additionally check is needed, which is as follows
                        // Step 1 :  split values in version string
                        // Step 2 :  compare integer and mantissa values seperately
                        // Step 3 :  than go ahead with double precision value comparison.
                        String[] strlocalControllerVer = getMajorVersionStr(gLocalControllerVerStr).split("\\.");
                        String[] strrequiredControllerVer = getMajorVersionStr(gRequiredControllerVerStr).split("\\.");
                        if ( (Integer.parseInt(strlocalControllerVer[0]) == Integer.parseInt(strrequiredControllerVer[0]))
                             && (Integer.parseInt(strlocalControllerVer[1]) >= Integer.parseInt(strrequiredControllerVer[1])) )
                        {
                            return V_COMPATIBLE;
                        }

                        // continue with earlier logic.
                        double localControllerVer = Double.parseDouble(getMajorVersionStr(gLocalControllerVerStr));
                        double requiredControllerVer = Double.parseDouble(getMajorVersionStr(gRequiredControllerVerStr));

            if(localControllerVer >= requiredControllerVer)
            {
                return V_COMPATIBLE;
            }

Good solution. But did had drawbacks since version numbering did not follow any standard conventions.
:(

Now this logic also worked partially
Cases it did not work
when remote controller version turned to be 8.55

Followers