private void checkFileReadable(File f) { if (!f.exists()) { throw new FatalRuntimeException("File " + f + " does not exist"); } if (!f.isFile()) { throw new FatalRuntimeException(f + " is not a file"); } if (!f.canRead()) { throw new FatalRuntimeException(f + " is not readable"); } }
private void checkFilePermissionsX00(File f) { Maybe<String> permission = FileUtil.getFilePermissions(f); if (permission.isAbsent()) { LOG.debug("Could not determine permissions of file; assuming ok: "+f); } else { if (!permission.get().subSequence(4, 10).equals("------")) { throw new FatalRuntimeException("Invalid permissions for file " + f + "; expected ?00 but was " + permission.get()); } } }
throw new FatalRuntimeException("Error starting applications: "+Exceptions.collapseText(t), t);
private void startPersistenceWithoutHA() { RebindManager rebindManager = managementContext.getRebindManager(); if (Strings.isNonBlank(persistenceLocation)) LOG.info("Management node (no HA) rebinding to entities at "+persistenceLocation+" in "+persistenceDir); else LOG.info("Management node (no HA) rebinding to entities on file system in "+persistenceDir); ClassLoader classLoader = managementContext.getCatalogClassLoader(); try { rebindManager.rebind(classLoader, null, ManagementNodeState.MASTER); } catch (Exception e) { Exceptions.propagateIfFatal(e); LOG.debug("Error rebinding to persisted state (rethrowing): "+e, e); throw new FatalRuntimeException("Error rebinding to persisted state: "+ Exceptions.collapseText(e), e); } rebindManager.startPersistence(); }
public void handleException(Throwable throwable, Object details) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException) throwable); if (throwable instanceof RuntimeInterruptedException) throw (RuntimeInterruptedException) throwable; if (details instanceof CatalogItem) { if (((CatalogItem<?,?>)details).getCatalogItemId() != null) { details = ((CatalogItem<?,?>)details).getCatalogItemId(); } } PropagatedRuntimeException wrap = new PropagatedRuntimeException("Error loading catalog item "+details, throwable); log.warn(Exceptions.collapseText(wrap)); log.debug("Trace for: "+wrap, wrap); ((ManagementContextInternal)getManagementContext()).errors().add(wrap); if (isStartingUp && failOnStartupErrors) { throw new FatalRuntimeException("Unable to load catalog item "+details, wrap); } }
Exceptions.propagateIfFatal(e); LOG.debug("Error copying persisted state (rethrowing): " + e, e); throw new FatalRuntimeException("Error copying persisted state: " + Exceptions.collapseText(e), e);
Exceptions.propagateIfFatal(e); LOG.debug("Error initializing persistence subsystem (rethrowing): "+e, e); throw new FatalRuntimeException("Error initializing persistence subsystem: "+ Exceptions.collapseText(e), e);