Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#5928 closed defect (invalid)

replacing null or non-informative error messages

Reported by: mgainty@… Owned by: Martin
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Tim Hatch)

/jsutil/fileUtil.js

Original code with no information which causes the error
fileUtil.readFile = function(/*String*/path, /*String?*/encoding){
	//summary: reads a file and returns a string
	encoding = encoding || "utf-8";
	var file = new java.io.File(path);
	var lineSeparator = fileUtil.getLineSeparator();
	
	java.lang.System.out.println("path="+path);
	
	var input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding));
	try {
		var stringBuffer = new java.lang.StringBuffer();
		var line = "";
		while((line = input.readLine()) !== null){
			stringBuffer.append(line);
			stringBuffer.append(lineSeparator);
		}
		//Make sure we return a JavaScript string and not a Java string.
		return new String(stringBuffer.toString()); //String
	} 
	finally {
		input.close();
	}
}

/*******change which contains information on what file is being referenced *******/
fileUtil.readFile = function(/*String*/path, /*String?*/encoding){
	//summary: reads a file and returns a string
	encoding = encoding || "utf-8";
	var file = new java.io.File(path);
	var lineSeparator = fileUtil.getLineSeparator();
	
	java.lang.System.out.println("path="+path);
	
	var input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding));
	try {
		var stringBuffer = new java.lang.StringBuffer();
		var line = "";
		while((line = input.readLine()) !== null){
			stringBuffer.append(line);
			stringBuffer.append(lineSeparator);
		}
		//Make sure we return a JavaScript string and not a Java string.
		return new String(stringBuffer.toString()); //String
	} 
	catch(excp) 
	{
	        System.out.println("Exception caught message ="+excp.getMessage());
		input.close();
	}
}

..in a normal sense if the developer downloads everything they should never see this. but in case one file is missing the JS function aborts out saying file is missing but no indication on what file is missing

26 Aug 2007 MG

Attachments (0)

Change History (1)

comment:1 by Tim Hatch, 17 years ago

Description: modified (diff)
Resolution: invalid
Status: newclosed

I think you reported this issue to the wrong Trac. This is the bugtracker for Trac itself, and you likely want to report this in some project's specific Trac instance. We don't use Java here.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Martin.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Martin to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.