136f55ffcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
336f55ffcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
436f55ffcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
536f55ffcSAndrew Rist  * distributed with this work for additional information
636f55ffcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
736f55ffcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
836f55ffcSAndrew Rist  * "License"); you may not use this file except in compliance
936f55ffcSAndrew Rist  * with the License.  You may obtain a copy of the License at
1036f55ffcSAndrew Rist  *
1136f55ffcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1236f55ffcSAndrew Rist  *
1336f55ffcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1436f55ffcSAndrew Rist  * software distributed under the License is distributed on an
1536f55ffcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1636f55ffcSAndrew Rist  * KIND, either express or implied.  See the License for the
1736f55ffcSAndrew Rist  * specific language governing permissions and limitations
1836f55ffcSAndrew Rist  * under the License.
1936f55ffcSAndrew Rist  *
2036f55ffcSAndrew Rist  *************************************************************/
2136f55ffcSAndrew Rist 
2236f55ffcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_jvmfwk.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sunversion.hxx"
28cdf0e10cSrcweir #include "osl/thread.h"
29cdf0e10cSrcweir #include "osl/process.h"
30cdf0e10cSrcweir #include "osl/security.hxx"
31cdf0e10cSrcweir #include <string.h>
32cdf0e10cSrcweir #include <ctype.h>
33cdf0e10cSrcweir #include "diagnostics.h"
34cdf0e10cSrcweir using namespace rtl;
35cdf0e10cSrcweir using namespace osl;
36cdf0e10cSrcweir namespace jfw_plugin  { //stoc_javadetect
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir //extern OUString ::Impl::usPathDelim();
40cdf0e10cSrcweir #define OUSTR( x )  ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( x ))
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #if OSL_DEBUG_LEVEL >= 2
43cdf0e10cSrcweir class SelfTest
44cdf0e10cSrcweir {
45cdf0e10cSrcweir public:
46cdf0e10cSrcweir     SelfTest();
47cdf0e10cSrcweir } test;
48cdf0e10cSrcweir #endif
49cdf0e10cSrcweir 
SunVersion(const rtl::OUString & usVer)50cdf0e10cSrcweir SunVersion::SunVersion(const rtl::OUString &usVer):
51cdf0e10cSrcweir     m_nUpdateSpecial(0), m_preRelease(Rel_NONE),
52cdf0e10cSrcweir     usVersion(usVer)
53cdf0e10cSrcweir {
54cdf0e10cSrcweir     memset(m_arVersionParts, 0, sizeof(m_arVersionParts));
55cdf0e10cSrcweir     rtl::OString sVersion= rtl::OUStringToOString(usVer, osl_getThreadTextEncoding());
56cdf0e10cSrcweir     m_bValid = init(sVersion.getStr());
57cdf0e10cSrcweir }
SunVersion(const char * szVer)58cdf0e10cSrcweir SunVersion::SunVersion(const char * szVer):
59cdf0e10cSrcweir     m_nUpdateSpecial(0), m_preRelease(Rel_NONE)
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     memset(m_arVersionParts, 0, sizeof(m_arVersionParts));
62cdf0e10cSrcweir     m_bValid = init(szVer);
63cdf0e10cSrcweir     usVersion= rtl::OUString(szVer,strlen(szVer),osl_getThreadTextEncoding());
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 
67cdf0e10cSrcweir /**Format major.minor.maintainance_update
68cdf0e10cSrcweir  */
init(const char * szVersion)69cdf0e10cSrcweir bool SunVersion::init(const char *szVersion)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir     if ( ! szVersion || strlen(szVersion) == 0)
72cdf0e10cSrcweir         return false;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     //first get the major,minor,maintainance
75cdf0e10cSrcweir     const char * pLast = szVersion;
76cdf0e10cSrcweir     const char * pCur = szVersion;
77cdf0e10cSrcweir 	//pEnd point to the position after the last character
78cdf0e10cSrcweir     const char * pEnd = szVersion + strlen(szVersion);
79cdf0e10cSrcweir     // 0 = major, 1 = minor, 2 = maintainance, 3 = update
80cdf0e10cSrcweir     int nPart = 0;
81cdf0e10cSrcweir     // position within part beginning with 0
82cdf0e10cSrcweir     int nPartPos = 0;
83cdf0e10cSrcweir     char buf[128];
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     //char must me a number 0 - 999 and no leading
86cdf0e10cSrcweir     while (1)
87cdf0e10cSrcweir     {
88cdf0e10cSrcweir         if (pCur < pEnd && isdigit(*pCur))
89cdf0e10cSrcweir         {
90cdf0e10cSrcweir             if (pCur < pEnd)
91cdf0e10cSrcweir                 pCur ++;
92cdf0e10cSrcweir             nPartPos ++;
93cdf0e10cSrcweir         }
94cdf0e10cSrcweir         //if  correct separator then form integer
95cdf0e10cSrcweir         else if (
96cdf0e10cSrcweir             ! (nPartPos == 0) // prevents: ".4.1", "..1", part must start with digit
97cdf0e10cSrcweir             && (
98cdf0e10cSrcweir                 //seperators after maintainance (1.4.1_01, 1.4.1-beta, or1.4.1
99cdf0e10cSrcweir                 ((pCur == pEnd || *pCur == '_' || *pCur == '-') && (nPart == 2 ))
100cdf0e10cSrcweir                 ||
101cdf0e10cSrcweir                 //separators between major-minor and minor-maintainance
102cdf0e10cSrcweir                 (nPart < 2 && *pCur == '.') )
103cdf0e10cSrcweir             && (
104cdf0e10cSrcweir                 //prevent 1.4.0. 1.4.0-
105cdf0e10cSrcweir                 pCur + 1 == pEnd ? isdigit(*(pCur)) : 1) )
106cdf0e10cSrcweir         {
107cdf0e10cSrcweir             int len = pCur - pLast;
108cdf0e10cSrcweir             if (len >= 127)
109cdf0e10cSrcweir                 return false;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir             strncpy(buf, pLast, len);
112cdf0e10cSrcweir             buf[len] = 0;
113cdf0e10cSrcweir             pCur ++;
114cdf0e10cSrcweir             pLast = pCur;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir             m_arVersionParts[nPart] = atoi(buf);
117cdf0e10cSrcweir             nPart ++;
118cdf0e10cSrcweir             nPartPos = 0;
119cdf0e10cSrcweir             if (nPart == 3)
120cdf0e10cSrcweir                 break;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir             //check next character
123cdf0e10cSrcweir             if (! ( (pCur < pEnd)
124cdf0e10cSrcweir                     && ( (nPart < 3) && isdigit(*pCur)))) //(*pCur >= 48 && *pCur <=57))))
125cdf0e10cSrcweir                 return false;
126cdf0e10cSrcweir         }
127cdf0e10cSrcweir         else
128cdf0e10cSrcweir         {
129cdf0e10cSrcweir             return false;
130cdf0e10cSrcweir         }
131cdf0e10cSrcweir     }
132cdf0e10cSrcweir     if (pCur >= pEnd)
133cdf0e10cSrcweir         return true;
134cdf0e10cSrcweir     //We have now 1.4.1. This can be followed by _01, -beta, etc.
135cdf0e10cSrcweir     // _01 (update) According to docu must not be followed by any other
136cdf0e10cSrcweir     //characters, but on Solaris 9 we have a 1.4.1_01a!!
137cdf0e10cSrcweir     if (* (pCur - 1) == '_')
138cdf0e10cSrcweir     {// _01, _02
139cdf0e10cSrcweir         // update is the last part _01, _01a, part 0 is the digits parts and 1 the trailing alpha
140cdf0e10cSrcweir         while (1)
141cdf0e10cSrcweir         {
142cdf0e10cSrcweir             if (pCur <= pEnd)
143cdf0e10cSrcweir             {
144cdf0e10cSrcweir                 if ( ! isdigit(*pCur))
145cdf0e10cSrcweir                 {
146cdf0e10cSrcweir                     //1.4.1_01-, 1.4.1_01a, the numerical part may only be 2 chars.
147cdf0e10cSrcweir                     int len = pCur - pLast;
148cdf0e10cSrcweir                     if (len > 2)
149cdf0e10cSrcweir                         return false;
150cdf0e10cSrcweir                     //we've got the update: 01, 02 etc
151cdf0e10cSrcweir                     strncpy(buf, pLast, len);
152cdf0e10cSrcweir                     buf[len] = 0;
153cdf0e10cSrcweir                     m_arVersionParts[nPart] = atoi(buf);
154cdf0e10cSrcweir                     if (pCur == pEnd)
155cdf0e10cSrcweir                     {
156cdf0e10cSrcweir                         break;
157cdf0e10cSrcweir                     }
158cdf0e10cSrcweir                     if (*pCur == 'a' && (pCur + 1) == pEnd)
159cdf0e10cSrcweir                     {
160cdf0e10cSrcweir                         //check if it s followed by a simple "a" (not specified)
161cdf0e10cSrcweir                         m_nUpdateSpecial = *pCur;
162cdf0e10cSrcweir                         break;
163cdf0e10cSrcweir                     }
164cdf0e10cSrcweir                     else if (*pCur == '-' && pCur < pEnd)
165cdf0e10cSrcweir                     {
166cdf0e10cSrcweir                         //check 1.5.0_01-ea
167cdf0e10cSrcweir                         PreRelease pr = getPreRelease(++pCur);
168cdf0e10cSrcweir                         if (pr == Rel_NONE)
169cdf0e10cSrcweir                             return false;
170cdf0e10cSrcweir                         //just ignore -ea because its no official release
171cdf0e10cSrcweir                         break;
172cdf0e10cSrcweir                     }
173cdf0e10cSrcweir                     else
174cdf0e10cSrcweir                     {
175cdf0e10cSrcweir                         return false;
176cdf0e10cSrcweir                     }
177cdf0e10cSrcweir                 }
178cdf0e10cSrcweir                 if (pCur < pEnd)
179cdf0e10cSrcweir                     pCur ++;
180cdf0e10cSrcweir                 else
181cdf0e10cSrcweir                     break;
182cdf0e10cSrcweir             }
183cdf0e10cSrcweir         }
184cdf0e10cSrcweir     }
185cdf0e10cSrcweir     // 1.4.1-ea
186cdf0e10cSrcweir     else if (*(pCur - 1) == '-')
187cdf0e10cSrcweir     {
188cdf0e10cSrcweir         m_preRelease = getPreRelease(pCur);
189cdf0e10cSrcweir         if (m_preRelease == Rel_NONE)
190cdf0e10cSrcweir             return false;
191cdf0e10cSrcweir #if defined(FREEBSD)
192cdf0e10cSrcweir       if (m_preRelease == Rel_FreeBSD)
193cdf0e10cSrcweir       {
194cdf0e10cSrcweir           pCur++; //elemnate `p'
195cdf0e10cSrcweir           if (pCur < pEnd && isdigit(*pCur))
196cdf0e10cSrcweir               pCur ++;
197cdf0e10cSrcweir           int len = pCur - pLast -1; //elemenate `p'
198cdf0e10cSrcweir           if (len >= 127)
199cdf0e10cSrcweir               return false;
200cdf0e10cSrcweir           strncpy(buf, (pLast+1), len); //elemenate `p'
201cdf0e10cSrcweir           buf[len] = 0;
202cdf0e10cSrcweir           m_nUpdateSpecial = atoi(buf)+100; //hack for FBSD #i56953#
203cdf0e10cSrcweir           return true;
204cdf0e10cSrcweir       }
205cdf0e10cSrcweir #endif
206cdf0e10cSrcweir     }
207cdf0e10cSrcweir     else
208cdf0e10cSrcweir     {
209cdf0e10cSrcweir         return false;
210cdf0e10cSrcweir     }
211cdf0e10cSrcweir     return true;
212cdf0e10cSrcweir }
213cdf0e10cSrcweir 
getPreRelease(const char * szRelease)214cdf0e10cSrcweir SunVersion::PreRelease SunVersion::getPreRelease(const char *szRelease)
215cdf0e10cSrcweir {
216cdf0e10cSrcweir     if (szRelease == NULL)
217cdf0e10cSrcweir         return Rel_NONE;
218*0fff73caSYuri Dario #ifdef OS2
219*0fff73caSYuri Dario 	// all prerelases codes are threated the same way (-ga1, -ga2, ...)
220*0fff73caSYuri Dario         return Rel_OS2;
221*0fff73caSYuri Dario #endif
222cdf0e10cSrcweir     if( ! strcmp(szRelease,"ea"))
223cdf0e10cSrcweir         return  Rel_EA;
224cdf0e10cSrcweir     else if( ! strcmp(szRelease,"ea1"))
225cdf0e10cSrcweir         return Rel_EA1;
226cdf0e10cSrcweir     else if( ! strcmp(szRelease,"ea2"))
227cdf0e10cSrcweir         return Rel_EA2;
228cdf0e10cSrcweir     else if( ! strcmp(szRelease,"ea3"))
229cdf0e10cSrcweir         return Rel_EA3;
230cdf0e10cSrcweir     else if ( ! strcmp(szRelease,"beta"))
231cdf0e10cSrcweir         return Rel_BETA;
232cdf0e10cSrcweir     else if ( ! strcmp(szRelease,"beta1"))
233cdf0e10cSrcweir         return Rel_BETA1;
234cdf0e10cSrcweir     else if ( ! strcmp(szRelease,"beta2"))
235cdf0e10cSrcweir         return Rel_BETA2;
236cdf0e10cSrcweir     else if ( ! strcmp(szRelease,"beta3"))
237cdf0e10cSrcweir         return Rel_BETA3;
238cdf0e10cSrcweir     else if (! strcmp(szRelease, "rc"))
239cdf0e10cSrcweir         return Rel_RC;
240cdf0e10cSrcweir     else if (! strcmp(szRelease, "rc1"))
241cdf0e10cSrcweir         return Rel_RC1;
242cdf0e10cSrcweir     else if (! strcmp(szRelease, "rc2"))
243cdf0e10cSrcweir         return Rel_RC2;
244cdf0e10cSrcweir     else if (! strcmp(szRelease, "rc3"))
245cdf0e10cSrcweir         return Rel_RC3;
246cdf0e10cSrcweir #if defined (FREEBSD)
247cdf0e10cSrcweir     else if (! strncmp(szRelease, "p", 1))
248cdf0e10cSrcweir         return Rel_FreeBSD;
249cdf0e10cSrcweir #endif
250cdf0e10cSrcweir     else
251cdf0e10cSrcweir         return Rel_NONE;
252cdf0e10cSrcweir }
253cdf0e10cSrcweir 
~SunVersion()254cdf0e10cSrcweir SunVersion::~SunVersion()
255cdf0e10cSrcweir {
256cdf0e10cSrcweir 
257cdf0e10cSrcweir }
258cdf0e10cSrcweir 
259cdf0e10cSrcweir /* Examples:
260cdf0e10cSrcweir    a) 1.0 < 1.1
261cdf0e10cSrcweir    b) 1.0 < 1.0.0
262cdf0e10cSrcweir    c)  1.0 < 1.0_00
263cdf0e10cSrcweir 
264cdf0e10cSrcweir    returns false if both values are equal
265cdf0e10cSrcweir */
operator >(const SunVersion & ver) const266cdf0e10cSrcweir bool SunVersion::operator > (const SunVersion& ver) const
267cdf0e10cSrcweir {
268cdf0e10cSrcweir     if( &ver == this)
269cdf0e10cSrcweir         return false;
270cdf0e10cSrcweir 
271cdf0e10cSrcweir     //compare major.minor.maintainance
272cdf0e10cSrcweir     for( int i= 0; i < 4; i ++)
273cdf0e10cSrcweir     {
274cdf0e10cSrcweir         // 1.4 > 1.3
275cdf0e10cSrcweir         if(m_arVersionParts[i] > ver.m_arVersionParts[i])
276cdf0e10cSrcweir         {
277cdf0e10cSrcweir             return true;
278cdf0e10cSrcweir         }
279cdf0e10cSrcweir         else if (m_arVersionParts[i] < ver.m_arVersionParts[i])
280cdf0e10cSrcweir         {
281cdf0e10cSrcweir             return false;
282cdf0e10cSrcweir         }
283cdf0e10cSrcweir     }
284cdf0e10cSrcweir     //major.minor.maintainance_update are equal. test for a trailing char
285cdf0e10cSrcweir     if (m_nUpdateSpecial > ver.m_nUpdateSpecial)
286cdf0e10cSrcweir     {
287cdf0e10cSrcweir         return true;
288cdf0e10cSrcweir     }
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	//Until here the versions are equal
291cdf0e10cSrcweir     //compare pre -release values
292cdf0e10cSrcweir 	if ((m_preRelease == Rel_NONE && ver.m_preRelease == Rel_NONE)
293cdf0e10cSrcweir 		||
294cdf0e10cSrcweir 		(m_preRelease != Rel_NONE && ver.m_preRelease == Rel_NONE))
295cdf0e10cSrcweir 		return false;
296cdf0e10cSrcweir 	else if (m_preRelease == Rel_NONE && ver.m_preRelease != Rel_NONE)
297cdf0e10cSrcweir 		return true;
298cdf0e10cSrcweir     else if (m_preRelease > ver.m_preRelease)
299cdf0e10cSrcweir         return true;
300cdf0e10cSrcweir 
301cdf0e10cSrcweir     return false;
302cdf0e10cSrcweir }
303cdf0e10cSrcweir 
operator <(const SunVersion & ver) const304cdf0e10cSrcweir bool SunVersion::operator < (const SunVersion& ver) const
305cdf0e10cSrcweir {
306cdf0e10cSrcweir     return (! operator > (ver)) && (! operator == (ver));
307cdf0e10cSrcweir }
308cdf0e10cSrcweir 
operator ==(const SunVersion & ver) const309cdf0e10cSrcweir bool SunVersion::operator == (const SunVersion& ver) const
310cdf0e10cSrcweir {
311cdf0e10cSrcweir     bool bRet= true;
312cdf0e10cSrcweir     for(int i= 0; i < 4; i++)
313cdf0e10cSrcweir     {
314cdf0e10cSrcweir         if( m_arVersionParts[i] != ver.m_arVersionParts[i])
315cdf0e10cSrcweir         {
316cdf0e10cSrcweir             bRet= false;
317cdf0e10cSrcweir             break;
318cdf0e10cSrcweir         }
319cdf0e10cSrcweir     }
320cdf0e10cSrcweir     bRet = m_nUpdateSpecial == ver.m_nUpdateSpecial && bRet;
321cdf0e10cSrcweir     bRet = m_preRelease == ver.m_preRelease && bRet;
322cdf0e10cSrcweir     return bRet;
323cdf0e10cSrcweir }
324cdf0e10cSrcweir 
325cdf0e10cSrcweir SunVersion::operator bool()
326cdf0e10cSrcweir {
327cdf0e10cSrcweir     return m_bValid;
328cdf0e10cSrcweir }
329cdf0e10cSrcweir 
330cdf0e10cSrcweir #if OSL_DEBUG_LEVEL >= 2
SelfTest()331cdf0e10cSrcweir SelfTest::SelfTest()
332cdf0e10cSrcweir {
333cdf0e10cSrcweir     bool bRet = true;
334cdf0e10cSrcweir 
335cdf0e10cSrcweir     char const * versions[] = {"1.4.0", "1.4.1", "1.0.0", "10.0.0", "10.10.0",
336cdf0e10cSrcweir                          "10.2.2", "10.10.0", "10.10.10", "111.0.999",
337cdf0e10cSrcweir                          "1.4.1_01", "9.90.99_09", "1.4.1_99",
338cdf0e10cSrcweir                          "1.4.1_00a",
339cdf0e10cSrcweir                          "1.4.1-ea", "1.4.1-beta", "1.4.1-rc1",
340cdf0e10cSrcweir                          "1.5.0_01-ea", "1.5.0_01-rc2"};
341cdf0e10cSrcweir     char const * badVersions[] = {".4.0", "..1", "", "10.0", "10.10.0.", "10.10.0-", "10.10.0.",
342cdf0e10cSrcweir                             "10.2-2", "10_10.0", "10..10","10.10", "a.0.999",
343cdf0e10cSrcweir                             "1.4b.1_01", "9.90.-99_09", "1.4.1_99-",
344cdf0e10cSrcweir                             "1.4.1_00a2", "1.4.0_z01z", "1.4.1__99A",
345cdf0e10cSrcweir                             "1.4.1-1ea", "1.5.0_010", "1.5.0._01-", "1.5.0_01-eac"};
346cdf0e10cSrcweir     char const * orderedVer[] = { "1.3.1-ea", "1.3.1-beta", "1.3.1-rc1",
347cdf0e10cSrcweir                             "1.3.1", "1.3.1_00a", "1.3.1_01", "1.3.1_01a",
348cdf0e10cSrcweir                             "1.3.2", "1.4.0", "1.5.0_01-ea", "2.0.0"};
349cdf0e10cSrcweir 
350cdf0e10cSrcweir     int num = sizeof (versions) / sizeof(char*);
351cdf0e10cSrcweir     int numBad = sizeof (badVersions) / sizeof(char*);
352cdf0e10cSrcweir     int numOrdered = sizeof (orderedVer) / sizeof(char*);
353cdf0e10cSrcweir     //parsing test (positive)
354cdf0e10cSrcweir     for (int i = 0; i < num; i++)
355cdf0e10cSrcweir 	{
356cdf0e10cSrcweir         SunVersion ver(versions[i]);
357cdf0e10cSrcweir         if ( ! ver)
358cdf0e10cSrcweir         {
359cdf0e10cSrcweir             bRet = false;
360cdf0e10cSrcweir             break;
361cdf0e10cSrcweir         }
362cdf0e10cSrcweir 	}
363cdf0e10cSrcweir     OSL_ENSURE(bRet, "SunVersion selftest failed");
364cdf0e10cSrcweir 	//Parsing test (negative)
365cdf0e10cSrcweir     for ( int i = 0; i < numBad; i++)
366cdf0e10cSrcweir     {
367cdf0e10cSrcweir         SunVersion ver(badVersions[i]);
368cdf0e10cSrcweir         if (ver)
369cdf0e10cSrcweir         {
370cdf0e10cSrcweir             bRet = false;
371cdf0e10cSrcweir             break;
372cdf0e10cSrcweir         }
373cdf0e10cSrcweir     }
374cdf0e10cSrcweir     OSL_ENSURE(bRet, "SunVersion selftest failed");
375cdf0e10cSrcweir 
376cdf0e10cSrcweir     // Ordering test
377cdf0e10cSrcweir     bRet = true;
378cdf0e10cSrcweir     int j = 0;
379cdf0e10cSrcweir     for (int i = 0; i < numOrdered; i ++)
380cdf0e10cSrcweir     {
381cdf0e10cSrcweir         SunVersion curVer(orderedVer[i]);
382cdf0e10cSrcweir         if ( ! curVer)
383cdf0e10cSrcweir         {
384cdf0e10cSrcweir             bRet = false;
385cdf0e10cSrcweir             break;
386cdf0e10cSrcweir         }
387cdf0e10cSrcweir         for (j = 0; j < numOrdered; j++)
388cdf0e10cSrcweir         {
389cdf0e10cSrcweir             SunVersion compVer(orderedVer[j]);
390cdf0e10cSrcweir             if (i < j)
391cdf0e10cSrcweir             {
392cdf0e10cSrcweir                 if ( !(curVer < compVer))
393cdf0e10cSrcweir                 {
394cdf0e10cSrcweir                     bRet = false;
395cdf0e10cSrcweir                     break;
396cdf0e10cSrcweir                 }
397cdf0e10cSrcweir             }
398cdf0e10cSrcweir             else if ( i == j)
399cdf0e10cSrcweir             {
400cdf0e10cSrcweir                 if (! (curVer == compVer
401cdf0e10cSrcweir                        && ! (curVer > compVer)
402cdf0e10cSrcweir                        && ! (curVer < compVer)))
403cdf0e10cSrcweir                 {
404cdf0e10cSrcweir                     bRet = false;
405cdf0e10cSrcweir                     break;
406cdf0e10cSrcweir                 }
407cdf0e10cSrcweir             }
408cdf0e10cSrcweir             else if (i > j)
409cdf0e10cSrcweir             {
410cdf0e10cSrcweir                 if ( !(curVer > compVer))
411cdf0e10cSrcweir                 {
412cdf0e10cSrcweir                     bRet = false;
413cdf0e10cSrcweir                     break;
414cdf0e10cSrcweir                 }
415cdf0e10cSrcweir             }
416cdf0e10cSrcweir         }
417cdf0e10cSrcweir         if ( ! bRet)
418cdf0e10cSrcweir             break;
419cdf0e10cSrcweir     }
420cdf0e10cSrcweir     if (bRet)
421cdf0e10cSrcweir         JFW_TRACE2("[Java framework] sunjavaplugin: Testing class SunVersion succeeded.\n");
422cdf0e10cSrcweir     else
423cdf0e10cSrcweir         OSL_ENSURE(bRet, "[Java framework] sunjavaplugin: SunVersion self test failed.\n");
424cdf0e10cSrcweir }
425cdf0e10cSrcweir #endif
426cdf0e10cSrcweir 
427cdf0e10cSrcweir }
428