xref: /AOO41X/main/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx (revision 36f55ffc0c229af2ff5a030b2f51d4c800cb77c9)
1*36f55ffcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*36f55ffcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*36f55ffcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*36f55ffcSAndrew Rist  * distributed with this work for additional information
6*36f55ffcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*36f55ffcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*36f55ffcSAndrew Rist  * "License"); you may not use this file except in compliance
9*36f55ffcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*36f55ffcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*36f55ffcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*36f55ffcSAndrew Rist  * software distributed under the License is distributed on an
15*36f55ffcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*36f55ffcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*36f55ffcSAndrew Rist  * specific language governing permissions and limitations
18*36f55ffcSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*36f55ffcSAndrew Rist  *************************************************************/
21*36f55ffcSAndrew Rist 
22*36f55ffcSAndrew 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 
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 }
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  */
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 
214cdf0e10cSrcweir SunVersion::PreRelease SunVersion::getPreRelease(const char *szRelease)
215cdf0e10cSrcweir {
216cdf0e10cSrcweir     if (szRelease == NULL)
217cdf0e10cSrcweir         return Rel_NONE;
218cdf0e10cSrcweir     if( ! strcmp(szRelease,"ea"))
219cdf0e10cSrcweir         return  Rel_EA;
220cdf0e10cSrcweir     else if( ! strcmp(szRelease,"ea1"))
221cdf0e10cSrcweir         return Rel_EA1;
222cdf0e10cSrcweir     else if( ! strcmp(szRelease,"ea2"))
223cdf0e10cSrcweir         return Rel_EA2;
224cdf0e10cSrcweir     else if( ! strcmp(szRelease,"ea3"))
225cdf0e10cSrcweir         return Rel_EA3;
226cdf0e10cSrcweir     else if ( ! strcmp(szRelease,"beta"))
227cdf0e10cSrcweir         return Rel_BETA;
228cdf0e10cSrcweir     else if ( ! strcmp(szRelease,"beta1"))
229cdf0e10cSrcweir         return Rel_BETA1;
230cdf0e10cSrcweir     else if ( ! strcmp(szRelease,"beta2"))
231cdf0e10cSrcweir         return Rel_BETA2;
232cdf0e10cSrcweir     else if ( ! strcmp(szRelease,"beta3"))
233cdf0e10cSrcweir         return Rel_BETA3;
234cdf0e10cSrcweir     else if (! strcmp(szRelease, "rc"))
235cdf0e10cSrcweir         return Rel_RC;
236cdf0e10cSrcweir     else if (! strcmp(szRelease, "rc1"))
237cdf0e10cSrcweir         return Rel_RC1;
238cdf0e10cSrcweir     else if (! strcmp(szRelease, "rc2"))
239cdf0e10cSrcweir         return Rel_RC2;
240cdf0e10cSrcweir     else if (! strcmp(szRelease, "rc3"))
241cdf0e10cSrcweir         return Rel_RC3;
242cdf0e10cSrcweir #if defined (FREEBSD)
243cdf0e10cSrcweir     else if (! strncmp(szRelease, "p", 1))
244cdf0e10cSrcweir         return Rel_FreeBSD;
245cdf0e10cSrcweir #endif
246cdf0e10cSrcweir     else
247cdf0e10cSrcweir         return Rel_NONE;
248cdf0e10cSrcweir }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir SunVersion::~SunVersion()
251cdf0e10cSrcweir {
252cdf0e10cSrcweir 
253cdf0e10cSrcweir }
254cdf0e10cSrcweir 
255cdf0e10cSrcweir /* Examples:
256cdf0e10cSrcweir    a) 1.0 < 1.1
257cdf0e10cSrcweir    b) 1.0 < 1.0.0
258cdf0e10cSrcweir    c)  1.0 < 1.0_00
259cdf0e10cSrcweir 
260cdf0e10cSrcweir    returns false if both values are equal
261cdf0e10cSrcweir */
262cdf0e10cSrcweir bool SunVersion::operator > (const SunVersion& ver) const
263cdf0e10cSrcweir {
264cdf0e10cSrcweir     if( &ver == this)
265cdf0e10cSrcweir         return false;
266cdf0e10cSrcweir 
267cdf0e10cSrcweir     //compare major.minor.maintainance
268cdf0e10cSrcweir     for( int i= 0; i < 4; i ++)
269cdf0e10cSrcweir     {
270cdf0e10cSrcweir         // 1.4 > 1.3
271cdf0e10cSrcweir         if(m_arVersionParts[i] > ver.m_arVersionParts[i])
272cdf0e10cSrcweir         {
273cdf0e10cSrcweir             return true;
274cdf0e10cSrcweir         }
275cdf0e10cSrcweir         else if (m_arVersionParts[i] < ver.m_arVersionParts[i])
276cdf0e10cSrcweir         {
277cdf0e10cSrcweir             return false;
278cdf0e10cSrcweir         }
279cdf0e10cSrcweir     }
280cdf0e10cSrcweir     //major.minor.maintainance_update are equal. test for a trailing char
281cdf0e10cSrcweir     if (m_nUpdateSpecial > ver.m_nUpdateSpecial)
282cdf0e10cSrcweir     {
283cdf0e10cSrcweir         return true;
284cdf0e10cSrcweir     }
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 	//Until here the versions are equal
287cdf0e10cSrcweir     //compare pre -release values
288cdf0e10cSrcweir 	if ((m_preRelease == Rel_NONE && ver.m_preRelease == Rel_NONE)
289cdf0e10cSrcweir 		||
290cdf0e10cSrcweir 		(m_preRelease != Rel_NONE && ver.m_preRelease == Rel_NONE))
291cdf0e10cSrcweir 		return false;
292cdf0e10cSrcweir 	else if (m_preRelease == Rel_NONE && ver.m_preRelease != Rel_NONE)
293cdf0e10cSrcweir 		return true;
294cdf0e10cSrcweir     else if (m_preRelease > ver.m_preRelease)
295cdf0e10cSrcweir         return true;
296cdf0e10cSrcweir 
297cdf0e10cSrcweir     return false;
298cdf0e10cSrcweir }
299cdf0e10cSrcweir 
300cdf0e10cSrcweir bool SunVersion::operator < (const SunVersion& ver) const
301cdf0e10cSrcweir {
302cdf0e10cSrcweir     return (! operator > (ver)) && (! operator == (ver));
303cdf0e10cSrcweir }
304cdf0e10cSrcweir 
305cdf0e10cSrcweir bool SunVersion::operator == (const SunVersion& ver) const
306cdf0e10cSrcweir {
307cdf0e10cSrcweir     bool bRet= true;
308cdf0e10cSrcweir     for(int i= 0; i < 4; i++)
309cdf0e10cSrcweir     {
310cdf0e10cSrcweir         if( m_arVersionParts[i] != ver.m_arVersionParts[i])
311cdf0e10cSrcweir         {
312cdf0e10cSrcweir             bRet= false;
313cdf0e10cSrcweir             break;
314cdf0e10cSrcweir         }
315cdf0e10cSrcweir     }
316cdf0e10cSrcweir     bRet = m_nUpdateSpecial == ver.m_nUpdateSpecial && bRet;
317cdf0e10cSrcweir     bRet = m_preRelease == ver.m_preRelease && bRet;
318cdf0e10cSrcweir     return bRet;
319cdf0e10cSrcweir }
320cdf0e10cSrcweir 
321cdf0e10cSrcweir SunVersion::operator bool()
322cdf0e10cSrcweir {
323cdf0e10cSrcweir     return m_bValid;
324cdf0e10cSrcweir }
325cdf0e10cSrcweir 
326cdf0e10cSrcweir #if OSL_DEBUG_LEVEL >= 2
327cdf0e10cSrcweir SelfTest::SelfTest()
328cdf0e10cSrcweir {
329cdf0e10cSrcweir     bool bRet = true;
330cdf0e10cSrcweir 
331cdf0e10cSrcweir     char const * versions[] = {"1.4.0", "1.4.1", "1.0.0", "10.0.0", "10.10.0",
332cdf0e10cSrcweir                          "10.2.2", "10.10.0", "10.10.10", "111.0.999",
333cdf0e10cSrcweir                          "1.4.1_01", "9.90.99_09", "1.4.1_99",
334cdf0e10cSrcweir                          "1.4.1_00a",
335cdf0e10cSrcweir                          "1.4.1-ea", "1.4.1-beta", "1.4.1-rc1",
336cdf0e10cSrcweir                          "1.5.0_01-ea", "1.5.0_01-rc2"};
337cdf0e10cSrcweir     char const * badVersions[] = {".4.0", "..1", "", "10.0", "10.10.0.", "10.10.0-", "10.10.0.",
338cdf0e10cSrcweir                             "10.2-2", "10_10.0", "10..10","10.10", "a.0.999",
339cdf0e10cSrcweir                             "1.4b.1_01", "9.90.-99_09", "1.4.1_99-",
340cdf0e10cSrcweir                             "1.4.1_00a2", "1.4.0_z01z", "1.4.1__99A",
341cdf0e10cSrcweir                             "1.4.1-1ea", "1.5.0_010", "1.5.0._01-", "1.5.0_01-eac"};
342cdf0e10cSrcweir     char const * orderedVer[] = { "1.3.1-ea", "1.3.1-beta", "1.3.1-rc1",
343cdf0e10cSrcweir                             "1.3.1", "1.3.1_00a", "1.3.1_01", "1.3.1_01a",
344cdf0e10cSrcweir                             "1.3.2", "1.4.0", "1.5.0_01-ea", "2.0.0"};
345cdf0e10cSrcweir 
346cdf0e10cSrcweir     int num = sizeof (versions) / sizeof(char*);
347cdf0e10cSrcweir     int numBad = sizeof (badVersions) / sizeof(char*);
348cdf0e10cSrcweir     int numOrdered = sizeof (orderedVer) / sizeof(char*);
349cdf0e10cSrcweir     //parsing test (positive)
350cdf0e10cSrcweir     for (int i = 0; i < num; i++)
351cdf0e10cSrcweir 	{
352cdf0e10cSrcweir         SunVersion ver(versions[i]);
353cdf0e10cSrcweir         if ( ! ver)
354cdf0e10cSrcweir         {
355cdf0e10cSrcweir             bRet = false;
356cdf0e10cSrcweir             break;
357cdf0e10cSrcweir         }
358cdf0e10cSrcweir 	}
359cdf0e10cSrcweir     OSL_ENSURE(bRet, "SunVersion selftest failed");
360cdf0e10cSrcweir 	//Parsing test (negative)
361cdf0e10cSrcweir     for ( int i = 0; i < numBad; i++)
362cdf0e10cSrcweir     {
363cdf0e10cSrcweir         SunVersion ver(badVersions[i]);
364cdf0e10cSrcweir         if (ver)
365cdf0e10cSrcweir         {
366cdf0e10cSrcweir             bRet = false;
367cdf0e10cSrcweir             break;
368cdf0e10cSrcweir         }
369cdf0e10cSrcweir     }
370cdf0e10cSrcweir     OSL_ENSURE(bRet, "SunVersion selftest failed");
371cdf0e10cSrcweir 
372cdf0e10cSrcweir     // Ordering test
373cdf0e10cSrcweir     bRet = true;
374cdf0e10cSrcweir     int j = 0;
375cdf0e10cSrcweir     for (int i = 0; i < numOrdered; i ++)
376cdf0e10cSrcweir     {
377cdf0e10cSrcweir         SunVersion curVer(orderedVer[i]);
378cdf0e10cSrcweir         if ( ! curVer)
379cdf0e10cSrcweir         {
380cdf0e10cSrcweir             bRet = false;
381cdf0e10cSrcweir             break;
382cdf0e10cSrcweir         }
383cdf0e10cSrcweir         for (j = 0; j < numOrdered; j++)
384cdf0e10cSrcweir         {
385cdf0e10cSrcweir             SunVersion compVer(orderedVer[j]);
386cdf0e10cSrcweir             if (i < j)
387cdf0e10cSrcweir             {
388cdf0e10cSrcweir                 if ( !(curVer < compVer))
389cdf0e10cSrcweir                 {
390cdf0e10cSrcweir                     bRet = false;
391cdf0e10cSrcweir                     break;
392cdf0e10cSrcweir                 }
393cdf0e10cSrcweir             }
394cdf0e10cSrcweir             else if ( i == j)
395cdf0e10cSrcweir             {
396cdf0e10cSrcweir                 if (! (curVer == compVer
397cdf0e10cSrcweir                        && ! (curVer > compVer)
398cdf0e10cSrcweir                        && ! (curVer < compVer)))
399cdf0e10cSrcweir                 {
400cdf0e10cSrcweir                     bRet = false;
401cdf0e10cSrcweir                     break;
402cdf0e10cSrcweir                 }
403cdf0e10cSrcweir             }
404cdf0e10cSrcweir             else if (i > j)
405cdf0e10cSrcweir             {
406cdf0e10cSrcweir                 if ( !(curVer > compVer))
407cdf0e10cSrcweir                 {
408cdf0e10cSrcweir                     bRet = false;
409cdf0e10cSrcweir                     break;
410cdf0e10cSrcweir                 }
411cdf0e10cSrcweir             }
412cdf0e10cSrcweir         }
413cdf0e10cSrcweir         if ( ! bRet)
414cdf0e10cSrcweir             break;
415cdf0e10cSrcweir     }
416cdf0e10cSrcweir     if (bRet)
417cdf0e10cSrcweir         JFW_TRACE2("[Java framework] sunjavaplugin: Testing class SunVersion succeeded.\n");
418cdf0e10cSrcweir     else
419cdf0e10cSrcweir         OSL_ENSURE(bRet, "[Java framework] sunjavaplugin: SunVersion self test failed.\n");
420cdf0e10cSrcweir }
421cdf0e10cSrcweir #endif
422cdf0e10cSrcweir 
423cdf0e10cSrcweir }
424