Here you can find the source of getResourceString(String key)
public static String getResourceString(String key)
//package com.java2s; /******************************************************************************* * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from www . j a v a2s. c om * IBM Corporation - initial API and implementation * Diamond Light Source - Custom modifications for Diamond's needs *******************************************************************************/ import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; public class Main { private static ResourceBundle resourceBundle = ResourceBundle.getBundle("file_viewer"); /** * Returns a string from the resource bundle. We don't want to crash because * of a missing String. Returns the key if not found. */ public static String getResourceString(String key) { try { return resourceBundle.getString(key); } catch (MissingResourceException e) { return key; } catch (NullPointerException e) { return "!" + key + "!"; } } /** * Returns a string from the resource bundle and binds it with the given * arguments. If the key is not found, return the key. */ public static String getResourceString(String key, Object[] args) { try { return MessageFormat.format(getResourceString(key), args); } catch (MissingResourceException e) { return key; } catch (NullPointerException e) { return "!" + key + "!"; } } }