Package com.snmp4j.smi
Class SmiError
java.lang.Object
com.snmp4j.smi.SmiError
- All Implemented Interfaces:
SmiErrorInfo
The
SmiError
class represents a syntax or semantic error in a SMI specification file.
The error is located at the provided row and column and the defective text is available as well.
In addition, error number and message are provided.- Author:
- Frank Fock
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Gets the column where the defective text was found in the text file.The text in the MIB specification that failed to parse.int
Gets the ending column where the defective text ends in the text file.int
Gets the bottom row of the defective text in the text file.int
Gets the error code of the error.String[]
Returns the expected text alternatives identified by the SMI compiler.Gets the error message for the error.Gets the MIB module name (if available) of the MIB module that contains the error.int
Gets the byte position in the input stream where the defective text starts.int
getRow()
Gets the row where the defective text was found in the text file.Gets the error message for the error in a short form, without error number and location information.toString()
-
Constructor Details
-
SmiError
public SmiError(String moduleName, int row, int column, int endRow, int endColumn, int position, int errorNumber, String message, String shortMessage, String defectiveText, String[] expectedText)Creates aSmiError
from error location and description information.- Parameters:
moduleName
- the module name of the parse MIB module.row
- the starting row in the file where the error was detected.column
- the starting column in the file where the error was detected.endRow
- the end row in the file where the error was detected.endColumn
- the end column in the file where the error was detected.position
- the character position the file where the error was detected.errorNumber
- the error number.message
- the error message.shortMessage
- a short form ofmessage
.defectiveText
- the text with the error.expectedText
- the expected text (variants).
-
-
Method Details
-
getColumn
public int getColumn()Gets the column where the defective text was found in the text file.- Specified by:
getColumn
in interfaceSmiErrorInfo
- Returns:
- the one-based starting column of the error.
-
getEndColumn
public int getEndColumn()Gets the ending column where the defective text ends in the text file.- Specified by:
getEndColumn
in interfaceSmiErrorInfo
- Returns:
- the one-based ending column of the error.
- Since:
- 1.4
-
getErrorNumber
public int getErrorNumber()Gets the error code of the error. See http://www.agentpp.com/mibdesigner3.x/MIBDesigner.pdf for a explanation of the error codes. If you doubt that an error is correctly reported, please first read section 6 "MIB Design" of that PDF document before contacting support.- Specified by:
getErrorNumber
in interfaceSmiErrorInfo
- Returns:
- an error code, numerically identifying the type of error.
-
getMessage
Gets the error message for the error.- Specified by:
getMessage
in interfaceSmiErrorInfo
- Returns:
- a human readable error message describing the error in English.
-
getShortMessage
Gets the error message for the error in a short form, without error number and location information.- Specified by:
getShortMessage
in interfaceSmiErrorInfo
- Returns:
- a human readable error message describing the error in English.
-
getDefectiveText
The text in the MIB specification that failed to parse.- Specified by:
getDefectiveText
in interfaceSmiErrorInfo
- Returns:
- a text fragment which is located in the MIB specification at column
getColumn()
and rowgetRow()
.
-
getRow
public int getRow()Gets the row where the defective text was found in the text file.- Specified by:
getRow
in interfaceSmiErrorInfo
- Returns:
- the one-based starting row of the error.
-
getEndRow
public int getEndRow()Gets the bottom row of the defective text in the text file.- Specified by:
getEndRow
in interfaceSmiErrorInfo
- Returns:
- the one-based ending row of the error.
- Since:
- 1.4
-
getPosition
public int getPosition()Gets the byte position in the input stream where the defective text starts.- Specified by:
getPosition
in interfaceSmiErrorInfo
- Returns:
- the zero-based byte position of the defective text in the SMI specification.
- Since:
- 1.4
-
getModuleName
Gets the MIB module name (if available) of the MIB module that contains the error.- Specified by:
getModuleName
in interfaceSmiErrorInfo
- Returns:
- a MIB module name or
null
if the MIB module name was not determinable.
-
getExpectedText
Returns the expected text alternatives identified by the SMI compiler.- Specified by:
getExpectedText
in interfaceSmiErrorInfo
- Returns:
null
if no text was expected/could be identified as expected. Otherwise, a list of expected text is returned where each element provides one alternative.- Since:
- 1.4
-
toString
-