Changeset 30172
- Timestamp:
- 2015-09-02T16:02:44+12:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/search4j/libsearch4j.cpp
r28699 r30172 240 240 241 241 if ( result == 0 ) { 242 if ( strcmp( output.substr( 0, 12 ).c_str() , "java version" ) == 0 || true ) { 243 era_ = atoi( output.substr(14,1).c_str() ); 244 major_ = atoi( output.substr(16,1).c_str() ); 245 minor_ = atoi( output.substr(18,1).c_str() ); 246 update_ = atoi( output.substr(20,2).c_str() ); 247 } else { 248 healthy_=false; 249 } 250 } else { 251 healthy_ = false; 242 // 22 is the length of sentinel string plus typical version value 243 int max_search_length = output.length() - 22; 244 int caret = 0; 245 bool found = false; 246 while (caret < max_search_length && !found) { 247 if ( strcmp( output.substr( caret, 12 ).c_str() , "java version" ) == 0 ) { 248 era_ = atoi( output.substr(caret + 14,1).c_str() ); 249 major_ = atoi( output.substr(caret + 16,1).c_str() ); 250 minor_ = atoi( output.substr(caret + 18,1).c_str() ); 251 update_ = atoi( output.substr(caret + 20,2).c_str() ); 252 found = true; 253 } 254 else { 255 caret++; 256 } 257 } 258 if (!found) { 259 healthy_ = false; 260 } 261 } 262 else { 263 healthy_ = false; 252 264 } 253 265 }
Note:
See TracChangeset
for help on using the changeset viewer.