Closed
Bug 47416
Opened 24 years ago
Closed 24 years ago
Error message doesn't include the name of the faulty file
Categories
(Core :: XML, defect, P3)
Core
XML
Tracking
()
VERIFIED
FIXED
mozilla0.9.1
People
(Reporter: rbs, Assigned: rbs)
References
(Blocks 1 open bug)
Details
(Whiteboard: havefix)
When at startup, one of the XUL files has an error in it (e.g., typo,
or invalid entity), it is very difficult to track down the problem
in optimized builds that don't have a debug console. Using
the -console option doesn't help in this case because the name of
the file is not reported in the console of optimized builds.
The popup window only shows:
XML Parsing Error
Line Number #, Column #
It will be helpful to also include the name of the faulty file to
help pinpoint the source of the problem:
XML Parsing Error
File: ...
Line Number #, Column #
Comment 1•24 years ago
|
||
Marking helpwanted and setting nsbeta3-. I'd love it if somebody could put a
patch together. I will try to if I get time, but only after higher priority
beta3+ bugs get fixed.
Had a first look to see if I could do something useful regarding this one. I saw
how the error is created in nsExpatTokenizer::PushXMLErrorTokens() using the
following struct defined in nsPaserError.h
struct _nsParserError {
PRInt32 code;
PRInt32 lineNumber;
PRInt32 colNumber;
nsString description;
nsString sourceLine;
} nsParserError;
So, it looks like adding "nsString sourceFileName;" could do the trick.
The existing fields in the struct are filled with readily available functions.
Is there a readily available funtion to also get the filename (absURL?).
OS: Windows NT → All
Hardware: PC → All
Comment 3•24 years ago
|
||
http://lxr.mozilla.org/mozilla/source/htmlparser/src/nsWellFormedDTD.cpp#737
shows that the file name does get printed out. Roger, are you still seeing
error messages which do not contain the file name?
I'm futuring this bug to get it off my radar. Please reset the target milestone
to "---" to bring this bug to my attention. Thanks.
Target Milestone: --- → Future
Yep, I still see the problem. In fact, things are OK in debug builds where the
printf that you showed are executed. It is in optimized builds that the problem
happens because the printf are not in effect, and the filename isn't added to
the nsParserError from which the error is reported in the content window.
Note to QA folks: To reproduce the problem, in an optimized build make a typo in
one of the critical XUL files (or better, ask someone else to do it so that it
is hidden). Then, it is very difficult to find the typo because the content
window only indicates that there is a problem at line# and col#, without telling
in which file; and there are tones of XUL files around...
Target Milestone: Future → ---
Updated•24 years ago
|
Target Milestone: --- → mozilla0.9.1
Moving to 0.9.2, but might still be fixed before 0.9.1 deadline. Should be
simple fix.
Target Milestone: mozilla0.9.1 → mozilla0.9.2
Have the fix. Should be good enough although strings are hardcoded and not
localized. Need your r/sr (should be a no brainer).
Index: nsExpatTokenizer.cpp
===================================================================
RCS file: /cvsroot/mozilla/htmlparser/src/nsExpatTokenizer.cpp,v
retrieving revision 1.82
diff -u -r1.82 nsExpatTokenizer.cpp
--- nsExpatTokenizer.cpp 2001/04/18 05:58:51 1.82
+++ nsExpatTokenizer.cpp 2001/05/15 12:00:41
@@ -303,6 +303,8 @@
if (aError) {
aErrorString.Append(aError->description);
+ aErrorString.AppendWithConversion("\nLocation: ");
+ aErrorString.Append(aError->sourceURL);
aErrorString.AppendWithConversion("\nLine Number ");
aErrorString.AppendInt(aError->lineNumber, 10);
aErrorString.AppendWithConversion(", Column ");
@@ -402,6 +404,7 @@
// Adjust the column number so that it is one based rather than zero based.
error->colNumber = XML_GetCurrentColumnNumber(mExpatParser) + 1;
error->description.AssignWithConversion(XML_ErrorString(error->code));
+ error->sourceURL = mState->scanner->GetFilename();
if (!aIsFinal) {
PRInt32 byteIndexRelativeToFile = 0;
byteIndexRelativeToFile = XML_GetCurrentByteIndex(mExpatParser);
Index: nsParserError.h
===================================================================
RCS file: /cvsroot/mozilla/htmlparser/src/nsParserError.h,v
retrieving revision 1.3
diff -u -r1.3 nsParserError.h
--- nsParserError.h 1999/11/06 03:22:24 1.3
+++ nsParserError.h 2001/05/15 12:00:41
@@ -41,6 +41,7 @@
PRInt32 colNumber;
nsString description;
nsString sourceLine;
+ nsString sourceURL;
} nsParserError;
#endif
Assignee: nisheeth → rbs
Status: ASSIGNED → NEW
Keywords: helpwanted,
nsbeta3
Whiteboard: [nsbeta3-] → havefix
Target Milestone: mozilla0.9.2 → mozilla0.9.1
r=heikki
Is there a bug on making XML parser messages localizable?
Comment 10•24 years ago
|
||
sr=jst
Assignee | ||
Comment 11•24 years ago
|
||
Checked-in. Resolving as FIXED.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•