/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This class contains code of the global toolkit error handler, exposes static
* methods which allow to set and unset synthetic error handlers.
*/
public final class XErrorHandlerUtil {
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XErrorHandlerUtil");
/**
* The connection to X11 window server.
*/
private static long display;
/**
* Error handler at the moment of {@code XErrorHandlerUtil} initialization.
*/
private static long saved_error_handler;
/**
* XErrorEvent being handled.
*/
/**
* Current error handler or null if no error handler is set.
*/
/**
* Value of sun.awt.noisyerrorhandler system property.
*/
new GetBooleanAction("sun.awt.noisyerrorhandler"));
/**
* The flag indicating that {@code init} was called already.
*/
private static boolean initPassed;
/**
* Guarantees that no instance of this class can be created.
*/
private XErrorHandlerUtil() {}
/**
* Sets the toolkit global error handler, stores the connection to X11 server,
* which will be used during an error handling process. This method is called
* once from {@code awt_init_Display} function defined in {@code awt_GraphicsEnv.c}
* file immediately after the connection to X11 window server is opened.
* @param display the connection to X11 server which should be stored
*/
try {
if (!initPassed) {
initPassed = true;
}
} finally {
}
}
/**
* Sets a synthetic error handler. Must be called with the acquired AWT lock.
* @param handler the synthetic error handler to set
*/
saved_error = null;
}
/**
* Unsets a current synthetic error handler. Must be called with the acquired AWT lock.
*/
public static void RESTORE_XERROR_HANDLER() {
RESTORE_XERROR_HANDLER(true);
}
if (doXSync) {
// Wait until all requests are processed by the X server
// and only then uninstall the error handler.
XSync();
}
}
/**
* Should be called under LOCK.
*/
if (saved_error_handler != 0) {
// Default XErrorHandler may just terminate the process. Don't call it.
// return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
}
}
return 0;
}
/**
* Called from the native code when an error occurs.
*/
if (noisyAwtHandler) {
}
saved_error = event;
try {
if (current_error_handler != null) {
} else {
}
} catch (Throwable z) {
}
return 0;
}
private static void XSync() {
try {
} finally {
}
}
}