javacommons/javaenv/src.s60/javaenvinfo.cpp
changeset 78 71ad690e91f5
parent 57 59b3b4473dc8
--- a/javacommons/javaenv/src.s60/javaenvinfo.cpp	Fri Sep 17 16:44:34 2010 +0300
+++ b/javacommons/javaenv/src.s60/javaenvinfo.cpp	Mon Oct 04 11:29:25 2010 +0300
@@ -26,7 +26,7 @@
 namespace Java
 {
 
-TInt ParseVersionL(TLex& aVersionText,TBool aLastVersionNumber);
+TInt ParseVersionL(TLex& aVersionText, TBool aLastVersionNumber, TUint aVersionNumMaxValue);
 
 // User-agent header substring
 _LIT(KUserAgentJavaString, "Configuration/CLDC-1.1 Profile/MIDP-2.1");
@@ -40,12 +40,10 @@
 // Length of temporary buffer for string manipulation
 const TUint KBufferSize = 32;
 
-// The min and max values for each version number
-// const TUint KMajorVersionMinValue = 1;
+// The max values for each field of version number (from TVersion)
 const TUint KMajorVersionMaxValue = 127;
-// const TUint KMinorVersionMaxValue = 9;
-// const TUint KBuildVersionMinValue = 1;
-// const TUint KBuildVersionMaxValue = 32767;
+const TUint KMinorVersionMaxValue = 99;
+const TUint KBuildVersionMaxValue = 32767;
 
 
 // ======== MEMBER FUNCTIONS ========
@@ -161,9 +159,9 @@
     // parse the version numbers (major, minor, build) from the string
     // leave if  error occurs in string or in its format (e.g.: missing dot char, wrong value)
     TLex versionText(buffer16->Des());
-    TUint32 majorVersion = ParseVersionL(versionText,EFalse);
-    TUint32 minorVersion = ParseVersionL(versionText,EFalse);
-    TUint32 buildVersion = ParseVersionL(versionText,ETrue);
+    TUint32 majorVersion = ParseVersionL(versionText,EFalse, KMajorVersionMaxValue);
+    TUint32 minorVersion = ParseVersionL(versionText,EFalse, KMinorVersionMaxValue);
+    TUint32 buildVersion = ParseVersionL(versionText,ETrue, KBuildVersionMaxValue);
 
     TVersion version(majorVersion, minorVersion, buildVersion);
 
@@ -178,7 +176,7 @@
 //
 //
 //
-TInt ParseVersionL(TLex& aVersionText,TBool aLastVersionNumber)
+TInt ParseVersionL(TLex& aVersionText, TBool aLastVersionNumber, TUint aVersionNumMaxValue)
 {
     JELOG2(EUtils);
 
@@ -192,9 +190,9 @@
     TUint32 version(0);
     if (partialVersionText.BoundedVal(version,
                                       EDecimal,
-                                      Java::KMajorVersionMaxValue) != KErrNone)
+                                      aVersionNumMaxValue) != KErrNone)
     {
-        LOG(EUtils,EInfo, " GetJavaVersionL: format of value is corrupted (major version)");
+        LOG(EUtils,EInfo, " GetJavaVersionL: format of value is corrupted");
         User::Leave(KErrCorrupt);
     }
     // check format
@@ -207,7 +205,7 @@
         }
         else
         {
-            LOG(EUtils,EInfo, " GetJavaVersionL: format of value is corrupted");
+            LOG(EUtils,EInfo, " GetJavaVersionL: format of value is corrupted2");
             User::Leave(KErrCorrupt);
         }
     }