mirror of https://github.com/apache/jmeter.git
				
				
				
			Bug 59351 - Improve log/error/message for IncludeController
#resolve #202
Bugzilla Id: 59351
git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1747805 13f79535-47bb-0310-9956-ffa450edef68
Former-commit-id: 1bb389bdc0
			
			
This commit is contained in:
		
							parent
							
								
									aa0cf27122
								
							
						
					
					
						commit
						9c8ac81f5b
					
				|  | @ -121,8 +121,8 @@ public class IncludeController extends GenericController implements ReplaceableC | |||
|         final String includePath = getIncludePath(); | ||||
|         HashTree tree = null; | ||||
|         if (includePath != null && includePath.length() > 0) { | ||||
|             String fileName=prefix+includePath; | ||||
|             try { | ||||
|                 String fileName=prefix+includePath; | ||||
|                 File file = new File(fileName); | ||||
|                 final String absolutePath = file.getAbsolutePath(); | ||||
|                 log.info("loadIncludedElements -- try to load included module: "+absolutePath); | ||||
|  | @ -130,8 +130,10 @@ public class IncludeController extends GenericController implements ReplaceableC | |||
|                     log.info("loadIncludedElements -failed for: "+absolutePath); | ||||
|                     file = new File(FileServer.getFileServer().getBaseDir(), includePath); | ||||
|                     log.info("loadIncludedElements -Attempting to read it from: " + file.getAbsolutePath()); | ||||
|                     if(!file.exists()){ | ||||
|                         log.error("loadIncludedElements -failed for: " + file.getAbsolutePath()); | ||||
|                     if(!file.canRead() || !file.isFile()){ | ||||
|                         log.error("Include Controller \"" | ||||
|                                 + this.getName()+"\" can't load \""  | ||||
|                                 + fileName+"\" - see log for details"); | ||||
|                         throw new IOException("loadIncludedElements -failed for: " + absolutePath + | ||||
|                                 " and " + file.getAbsolutePath()); | ||||
|                     } | ||||
|  | @ -144,23 +146,22 @@ public class IncludeController extends GenericController implements ReplaceableC | |||
|                 return tree; | ||||
|             } catch (NoClassDefFoundError ex) // Allow for missing optional jars | ||||
|             { | ||||
|                 String msg = ex.getMessage(); | ||||
|                 if (msg == null) { | ||||
|                     msg = "Missing jar file - see log for details"; | ||||
|                 } | ||||
|                 log.warn("Missing jar file", ex); | ||||
|                 JMeterUtils.reportErrorToUser(msg); | ||||
|                 String msg = "Including file \""+ fileName  | ||||
|                             + "\" failed for Include Controller \""+ this.getName() | ||||
|                             +"\", missing jar file"; | ||||
|                 log.warn(msg, ex); | ||||
|                 JMeterUtils.reportErrorToUser(msg+" - see log for details"); | ||||
|             } catch (FileNotFoundException ex) { | ||||
|                 String msg = ex.getMessage(); | ||||
|                 JMeterUtils.reportErrorToUser(msg); | ||||
|                 log.warn(msg); | ||||
|                 String msg = "File \""+ fileName  | ||||
|                         + "\" not found for Include Controller \""+ this.getName()+"\""; | ||||
|                 JMeterUtils.reportErrorToUser(msg+" - see log for details"); | ||||
|                 log.warn(msg, ex); | ||||
|             } catch (Exception ex) { | ||||
|                 String msg = ex.getMessage(); | ||||
|                 if (msg == null) { | ||||
|                     msg = "Unexpected error - see log for details"; | ||||
|                 } | ||||
|                 JMeterUtils.reportErrorToUser(msg); | ||||
|                 log.warn("Unexpected error", ex); | ||||
|                 String msg = "Including file \"" + fileName  | ||||
|                             + "\" failed for Include Controller \"" + this.getName() | ||||
|                             +"\", unexpected error"; | ||||
|                 JMeterUtils.reportErrorToUser(msg+" - see log for details"); | ||||
|                 log.warn(msg, ex); | ||||
|             } | ||||
|         } | ||||
|         return tree; | ||||
|  |  | |||
|  | @ -88,6 +88,7 @@ Summary | |||
| 
 | ||||
| <h3>Controllers</h3> | ||||
| <ul> | ||||
|     <li><bug>59351</bug>Improve log/error/message for IncludeController. Partly contributed by Antonio Gomes Rodrigues (ra0077 at gmail.com)</li> | ||||
| </ul> | ||||
| 
 | ||||
| <h3>Listeners</h3> | ||||
|  | @ -162,6 +163,7 @@ Summary | |||
| </p> | ||||
| <ul> | ||||
| <li>Felix Draxler (felix.draxler at sap.com)</li> | ||||
| <li>Antonio Gomes Rodrigues (ra0077 at gmail.com)</li> | ||||
| </ul> | ||||
| <p>We also thank bug reporters who helped us improve JMeter. <br/> | ||||
| For this release we want to give special thanks to the following reporters for the clear reports and tests made after our fixes:</p> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue