Index: /other-projects/trunk/search4j/libsearch4j.cpp
===================================================================
--- /other-projects/trunk/search4j/libsearch4j.cpp	(revision 20708)
+++ /other-projects/trunk/search4j/libsearch4j.cpp	(revision 20709)
@@ -139,11 +139,19 @@
 //Jvm class methods
 
-Jvm::Jvm() {
-	healthy = false;
-}
+Jvm::Jvm() 
+  : era_(1), major_(0), minor_(0), update_(0),
+    javaHome_(), 
+    isJdk_(false), healthy_(false)
+{}
+
+Jvm::~Jvm() 
+{
+  // javaHome automatically destructed
+}
+ 
 
 void Jvm::setJavaHome( string jh ) {
-	healthy = true;
-	javaHome = jh;
+	healthy_ = true;
+	javaHome_ = jh;
 	setVersionFromExeOuput();
 	setIsJdkFromJavacPresence();
@@ -151,10 +159,10 @@
 
 string Jvm::getJavaHome() {
-	return javaHome;
+	return javaHome_;
 }
 
 string Jvm::getExecutable() {
 	string exec = "";
-	exec.append( javaHome );
+	exec.append( javaHome_ );
 	
 	#ifdef WINDOWS
@@ -172,5 +180,5 @@
 string Jvm::getWinExecutable() {
 	string exec = "";
-	exec.append( javaHome );
+	exec.append( javaHome_ );
 	exec.append( "\\bin\\javaw.exe" );
 	return exec;
@@ -181,17 +189,17 @@
 string Jvm::getVersion() {
 	stringstream ss;
-	ss << era << "." << major << "." << minor << "_" << update;
+	ss << era_ << "." << major_ << "." << minor_ << "_" << update_;
 	return ss.str();
 }
 
 bool Jvm::check() {
-	return healthy;
+	return healthy_;
 }
 
 bool Jvm::setVersionFromString( string version ) {
-	era = atoi( version.substr(0,1).c_str() );
-	major = atoi( version.substr(2,1).c_str() );
-	minor = atoi( version.substr(4,1).c_str() );
-	update = atoi( version.substr(6,2).c_str() );
+	era_ = atoi( version.substr(0,1).c_str() );
+	major_ = atoi( version.substr(2,1).c_str() );
+	minor_ = atoi( version.substr(4,1).c_str() );
+	update_ = atoi( version.substr(6,2).c_str() );
 	return true;
 }
@@ -199,25 +207,25 @@
 int Jvm::compare( Jvm otherJvm ) {
 	//era
-	if ( era > otherJvm.getEra() )
+	if ( era_ > otherJvm.getEra() )
 		return 1;
-	else if ( era < otherJvm.getEra() )
+	else if ( era_ < otherJvm.getEra() )
 		return -1;
 	
 	//major
-	if ( major > otherJvm.getMajor() )
+	if ( major_ > otherJvm.getMajor() )
 		return 1;
-	else if ( major < otherJvm.getMajor() )
+	else if ( major_ < otherJvm.getMajor() )
 		return -1;
 		
 	//minor
-	if ( minor > otherJvm.getMinor() )
+	if ( minor_ > otherJvm.getMinor() )
 		return 1;
-	else if ( minor < otherJvm.getMinor() )
+	else if ( minor_ < otherJvm.getMinor() )
 		return -1;
 
 	//update
-	if ( update > otherJvm.getUpdate() )
+	if ( update_ > otherJvm.getUpdate() )
 		return 1;
-	else if ( update < otherJvm.getUpdate() )
+	else if ( update_ < otherJvm.getUpdate() )
 		return -1;
 
@@ -227,11 +235,11 @@
 }
 
-int Jvm::getEra() { return era; }
-int Jvm::getMajor() { return major; }
-int Jvm::getMinor() { return minor; }
-int Jvm::getUpdate() { return update; }
-
-bool Jvm::getIsJdk() { return isJdk; }
-bool Jvm::getIsJre() { return !isJdk; }
+int Jvm::getEra() { return era_; }
+int Jvm::getMajor() { return major_; }
+int Jvm::getMinor() { return minor_; }
+int Jvm::getUpdate() { return update_; }
+
+bool Jvm::getIsJdk() { return isJdk_; }
+bool Jvm::getIsJre() { return !isJdk_; }
 
 void Jvm::setVersionFromExeOuput() {
@@ -248,18 +256,18 @@
 	if ( result == 0 ) {
 		if ( strcmp( output.substr( 0, 12 ).c_str() , "java version" ) == 0 || true ) {
-			era = atoi( output.substr(14,1).c_str() );
-			major = atoi( output.substr(16,1).c_str() );
-			minor = atoi( output.substr(18,1).c_str() );
-			update = atoi( output.substr(20,2).c_str() );
+			era_ = atoi( output.substr(14,1).c_str() );
+			major_ = atoi( output.substr(16,1).c_str() );
+			minor_ = atoi( output.substr(18,1).c_str() );
+			update_ = atoi( output.substr(20,2).c_str() );
 		} else {
-			healthy=false;
+			healthy_=false;
 		}
 	} else {
-		healthy = false;
+		healthy_ = false;
 	}
 }
 void Jvm::setIsJdkFromJavacPresence() {
 	string javacFile = "";
-	javacFile.append( javaHome );
+	javacFile.append( javaHome_ );
 
 	#ifdef WINDOWS
@@ -270,5 +278,5 @@
 	#endif
 	struct stat stFileInfo;
-	isJdk = ( stat(javacFile.c_str(),&stFileInfo) == 0 );
+	isJdk_ = ( stat(javacFile.c_str(),&stFileInfo) == 0 );
 }
 
@@ -309,9 +317,9 @@
 * return a Jvm object which represents the jvm on disk
 */
-bool find( Jvm &jvm, bool use_minimum, Jvm minimum, bool jreOnly, bool jdkOnly, string phint, string hint, bool verbose ) {
+bool find( Jvm &jvm, bool use_minimum, const Jvm& minimum, bool jreOnly, bool jdkOnly, string phint, string hint, bool verbose ) {
 	
 	if ( verbose ) cout << "Searching for a JVM" << endl;
 	
-	char *javaHome = "";
+	char *javaHomeEnv = "";
 	bool jvmFound = false;
 	
@@ -344,8 +352,8 @@
 		//try JAVA_HOME
 		if ( verbose ) cout << " - trying JAVA_HOME: ";
-		javaHome = getenv( "JAVA_HOME" );
-		if ( javaHome != NULL ) {
-			if ( verbose ) cout << "(" << javaHome << ") ";
-			jvm.setJavaHome( javaHome );
+		javaHomeEnv = getenv( "JAVA_HOME" );
+		if ( javaHomeEnv != NULL ) {
+			if ( verbose ) cout << "(" << javaHomeEnv << ") ";
+			jvm.setJavaHome( javaHomeEnv );
 			if ( jvm.check() ) {
 				if ( use_minimum ) {
@@ -369,8 +377,8 @@
 		//try JRE_HOME
 		if ( verbose ) cout << " - trying JRE_HOME: ";
-		javaHome = getenv( "JRE_HOME" );
-		if ( javaHome != NULL ) {
-			if ( verbose ) cout << "(" << javaHome << ") ";
-			jvm.setJavaHome( javaHome );
+		javaHomeEnv = getenv( "JRE_HOME" );
+		if ( javaHomeEnv != NULL ) {
+			if ( verbose ) cout << "(" << javaHomeEnv << ") ";
+			jvm.setJavaHome( javaHomeEnv );
 			if ( jvm.check() ) {
 				if ( use_minimum ) {
Index: /other-projects/trunk/search4j/libsearch4j.h
===================================================================
--- /other-projects/trunk/search4j/libsearch4j.h	(revision 20708)
+++ /other-projects/trunk/search4j/libsearch4j.h	(revision 20709)
@@ -23,15 +23,17 @@
 
 	// version string. era.major.minor_update. eg: 1.4.2_02
-	int era;
-	int major;
-	int minor;
-	int update;
+	int era_;
+	int major_;
+	int minor_;
+	int update_;
 
-	string javaHome;
-	bool isJdk;
-	bool healthy;
+	string javaHome_;
+	bool isJdk_;
+	bool healthy_;
 
 	public:
 	Jvm();
+	~Jvm();
+
 	void setJavaHome( string jh );
 	string getJavaHome();
@@ -60,3 +62,3 @@
 
 
-bool find( Jvm &jvm, bool use_minimum, Jvm minimum, bool jreOnly, bool jdeOnly, string phint, string hint, bool verbose );
+bool find( Jvm &jvm, bool use_minimum, const Jvm& minimum, bool jreOnly, bool jdeOnly, string phint, string hint, bool verbose );
