public void reduce() { if (queue == null || queue.size() == 0) { MLogUtil.log().d(Db.class,"closing bracked without open bracked"); current = null; return; } queue.removeLast(); if (queue.size() == 0) current = null; else current = queue.getLast(); }
public static MProperties load(String fileName) { Properties p = new Properties(); try { File f = new File(fileName); if (f.exists() && f.isFile()) { FileInputStream is = new FileInputStream(f); p.load(is); } } catch (Throwable t) { MLogUtil.log().d(fileName, t); } MProperties out = new MProperties(p); return out; }
public void clear() { synchronized (connections) { for (TransactionConnection con : connections.values()) try { con.close(); } catch (Throwable e) { MLogUtil.log().w(e); } connections.clear(); } }
public static MProperties load(Reader is) { Properties p = new Properties(); try { p.load(is); } catch (Throwable t) { MLogUtil.log().d(t); } MProperties out = new MProperties(p); return out; }
public static int getStatus(TimerTask task) { if (task == null) return -1; try { Class<? extends TimerTask> clazz = task.getClass(); Field field = MSystem.getDeclaredField(clazz,"state"); if (field != null) { if (!field.isAccessible()) field.setAccessible(true); return field.getInt(task); } } catch (Throwable t) { MLogUtil.log().d(task,t); } return -1; }
public static synchronized void loadMimeTypes() { if (mhuMimeConfigCache == null) { try { mhuMimeConfigCache = new Properties(); MSystem.loadProperties(MFile.class, mhuMimeConfigCache, "mime-types.properties"); } catch (Exception e) { MLogUtil.log().t(e); } } }
public boolean rollback() { boolean success = true; synchronized (connections) { for (TransactionConnection con : connections.values()) try { con.rollback(); } catch (Throwable e) { success = false; MLogUtil.log().w(e); } } return success; }
public boolean commit() { boolean success = true; synchronized (connections) { for (TransactionConnection con : connections.values()) try { con.commit(); } catch (Throwable e) { success = false; MLogUtil.log().w(e); } } return success; }
@Override public int read() { try { return reader.readCharacter(true); } catch (IOException e) { MLogUtil.log().t(e); } return -1; }
@Override public void resetConnection() throws JMSException { synchronized (this) { if (con != null) try { con.close(); } catch (Throwable t) { MLogUtil.log().d(name,t); } con = null; } }
@Override public synchronized SecureRandom getSecureRandom() { try { // secureRandom = SecureRandom.getInstance("SHA1PRNG", "SUN"); if (secureRandom == null) secureRandom = new MySecureRandom(); } catch (Exception e) { MLogUtil.log().e(e); } return secureRandom; }
@Override public String readLine(LinkedList<String> history) { try { return reader.readLine(); } catch (IOException e) { MLogUtil.log().t(e); } return null; // return System.console().readLine(); }
private void findNext() { try { next = getNext(); } catch (Throwable t) { MLogUtil.log().d(t); next = null; } }
@SuppressWarnings("unchecked") public Converter<String, ?> generateConverter(Class<?> type) { try { if (converter != null) return (Converter<String, ?>) converter.newInstance(); converter = MhuTable.findDefaultConverter(this, type); if (converter != null) return (Converter<String, ?>) converter.newInstance(); } catch (Throwable t) { MLogUtil.log().d(t); } return new ObjectConverter(); }
/** * Release all locked object ids * This method will never throw an Throwable. */ public static void releaseLock() { try { TransactionPool.instance().releaseLock(); } catch (Throwable t) { try { MLogUtil.log().e(t); } catch (Throwable t2) { t.printStackTrace(); t2.printStackTrace(); } } }
/** * Close and remove all existing transaction connections. * This method will never throw an Throwable. */ public static void releaseEncapsulate() { try { TransactionPool.instance().releaseEncapsulate(); } catch (Throwable t) { try { MLogUtil.log().e(t); } catch (Throwable t2) { t.printStackTrace(); t2.printStackTrace(); } } }
public static String compileAndExecute(String template, IProperties attributes, String def) { try { return StringCompiler.compile(template).execute(attributes); } catch (MException e) { MLogUtil.log().t("MString.compileAndExecute",template,e); } return def; }
public PemBlockList(String string) { while(true) { try { int p = string.indexOf("-----BEGIN "); if (p < 0) break; PemBlockModel next = new PemBlockModel().parse(string); add(next); string = next.getRest(); } catch (ParseException e) { MLogUtil.log().t(e); break; } } }
public UiWizard getWizard() { Object obj = config.getProperty(WIZARD); if (obj == null) return null; if (obj instanceof UiWizard) return (UiWizard)obj; try { if (obj instanceof String) return getForm().getAdapterProvider().createWizard((String)obj); } catch (Exception e) { MLogUtil.log().d(e); } return null; // TODO }
private void login() { if (accessControl.signIn(username.getValue(), password.getValue())) { Subject subject = (Subject)UI.getCurrent().getSession().getAttribute(VaadinAccessControl.SUBJECT_ATTR); if (subject == null) MLogUtil.log().i("no subject"); else MLogUtil.log().i("Login",subject); // if (MSecurity.hasRole(subject,MAIN_USER_ROLE)) { loginListener.loginSuccessful(); return; // } else { // accessControl.signOut(); // } } showNotification(new Notification(MNls.find(this,"login.error.title=Login failed"), MNls.find(this,"login.error.text=Please check your username and password and try again."), Notification.Type.HUMANIZED_MESSAGE)); username.focus(); }