// $Header$
/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package org.apache.jmeter.samplers;

import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * Packages information regarding the target of a sample event, such as the
 * result from that event and the thread group it ran in.
 * 
 * @version $Revision$
 */
public class SampleEvent implements Serializable {
	public static String HOSTNMAME;

	static {
		try {
			HOSTNMAME = InetAddress.getLocalHost().getHostName();
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}
	}

	SampleResult result;

	String threadGroup;

	String hostname;

	public SampleEvent() {
	}

	public SampleEvent(SampleResult result, String threadGroup) {
		this.result = result;
		this.threadGroup = threadGroup;
		this.hostname = HOSTNMAME;
	}

	public SampleResult getResult() {
		return result;
	}

	public String getThreadGroup() {
		return threadGroup;
	}

	public String getHostname() {
		return hostname;
	}
}

@@ -1,16 +1,4 @@
-// $Header$%0A
 /*%0A 
@@ -21,9 +21,9 @@
 -200
-4
+5
  The
@@ -750,16 +750,97 @@
 ption;%0A%0A
+import org.apache.jorphan.logging.LoggingManager;%0Aimport org.apache.log.Logger;%0A%0A
 /**%0A * P
@@ -1051,17 +1051,95 @@
 zable %7B%0A
-%09
+    private static final Logger log = LoggingManager.getLoggerForClass();%0A%0A    
 public s
@@ -1144,16 +1144,22 @@
  static 
+final 
 String H
@@ -1158,25 +1158,24 @@
 String HOSTN
-M
 AME;%0A%0A%09stati
@@ -1178,16 +1178,40 @@
 tatic %7B%0A
+        String hn=null;%0A
 %09%09try %7B%0A
@@ -1213,25 +1213,18 @@
 ry %7B%0A%09%09%09
-HOSTNMAME
+hn
  = InetA
@@ -1301,35 +1301,91 @@
 ) %7B%0A
-%09%09%09e.printStackTrace();%0A%09%09%7D
+            log.error(%22Cannot obtain local host name %22+e);%0A%09%09%7D%0A        HOSTNAME=hn;
 %0A%09%7D%0A
@@ -1621,17 +1621,16 @@
  = HOSTN
-M
 AME;%0A%09%7D%0A

Fix typo and mutable string problem