public Value error(int code, Location location, String loc, String msg)
{
int mask = 1 << code;
if (log.isLoggable(Level.FINEST)) {
QuercusException e = new QuercusException(loc + msg);
log.log(Level.FINEST, e.toString(), e);
}
if ((_errorMask & mask) != 0) {
if (log.isLoggable(Level.FINE))
log.fine(this + " " + loc + msg);
}
if (code >= 0 && code < _errorHandlers.length
&& _errorHandlers[code] != null) {
Callback handler = _errorHandlers[code];
try {
_errorHandlers[code] = null;
Value fileNameV = NullValue.NULL;
if (location == null)
location = getLocation();
String fileName = location.getFileName();
if (fileName != null)
fileNameV = createString(fileName, null);
Value lineV = NullValue.NULL;
int line = location.getLineNumber();
if (line > 0)
lineV = LongValue.create(line);
Value context = NullValue.NULL;
handler.call(this, LongValue.create(mask), createStringOld(msg),
fileNameV, lineV, context);
return NullValue.NULL;
}
catch (RuntimeException e) {
throw e;
}
catch (Throwable e) {
throw new RuntimeException(e);
}
finally {
_errorHandlers[code] = handler;
}
}
if ((_errorMask & mask) != 0) {
try {
String fullMsg = (getLocationPrefix(location, loc)
+ getCodeName(mask) + msg);
if (getIniBoolean("track_errors"))
setGlobalValue("php_errormsg", createStringOld(fullMsg));
if ("stderr".equals(getIniString("display_errors")))
System.err.println(fullMsg);
else if (getIniBoolean("display_errors"))
getOut().println(fullMsg);
if (getIniBoolean("log_errors"))
log.info(fullMsg);
}
catch (IOException e) {
log.log(Level.FINE, e.toString(), e);
}
}
if ((mask & (E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR)) != 0)
{