electionAlg = Integer.parseInt(value); if (electionAlg != 1 && electionAlg != 2 && electionAlg != 3) { throw new ConfigException("Invalid electionAlg value. Only 1, 2, 3 are supported."); } else throw new ConfigException("Unrecognised peertype: " + value); setStandaloneEnabled(false); } else { throw new ConfigException("Invalid option " + value + " for standalone mode. Choose 'true' or 'false.'"); setReconfigEnabled(false); } else { throw new ConfigException("Invalid option " + value + " for reconfigEnabled flag. Choose 'true' or 'false.'"); sslQuorumReloadCertFiles = Boolean.parseBoolean(value); } else if ((key.startsWith("server.") || key.startsWith("group") || key.startsWith("weight")) && zkProp.containsKey("dynamicConfigFile")) { throw new ConfigException("parameter: " + key + " must be in a separate dynamic config file"); } else if (key.equals(QuorumAuth.QUORUM_SASL_AUTH_ENABLED)) { quorumEnableSasl = Boolean.parseBoolean(value);
} else throw new ConfigException("Unrecognised peertype: " + value); type = LearnerType.PARTICIPANT; } else { throw new ConfigException("Unrecognised peertype: " + value); long sid = Long.parseLong(s); if(serverGroup.containsKey(sid)) throw new ConfigException("Server " + sid + "is in multiple groups"); else serverGroup.put(sid, gid); throw new ConfigException("Every server must be in exactly one group");
} else throw new ConfigException("Unrecognised peertype: " + value); electionAddr,type)); } else { throw new ConfigException("Unrecognised peertype: " + value); long sid = Long.parseLong(s); if(serverGroup.containsKey(sid)) throw new ConfigException("Server " + sid + "is in multiple groups"); else serverGroup.put(sid, gid); throw new ConfigException("Every server must be in exactly one group");
throw new ConfigException("Error processing " + filename, e); } catch (IllegalArgumentException e) { throw new ConfigException("Error processing " + filename, e);
/** * Parse a ZooKeeper configuration file * @param path the patch of the configuration file * @throws ConfigException error processing configuration */ public void parse(String path) throws ConfigException { File configFile = new File(path); LOG.info("Reading configuration from: " + configFile); try { if (!configFile.exists()) { throw new IllegalArgumentException(configFile.toString() + " file is missing"); } Properties cfg = new Properties(); FileInputStream in = new FileInputStream(configFile); try { cfg.load(in); } finally { in.close(); } parseProperties(cfg); } catch (IOException e) { throw new ConfigException("Error processing " + path, e); } catch (IllegalArgumentException e) { throw new ConfigException("Error processing " + path, e); } }
/** * Parse a ZooKeeper configuration file * @param path the patch of the configuration file * @throws ConfigException error processing configuration */ public void parse(String path) throws ConfigException { File configFile = new File(path); LOG.info("Reading configuration from: " + configFile); try { if (!configFile.exists()) { throw new IllegalArgumentException(configFile.toString() + " file is missing"); } Properties cfg = new Properties(); FileInputStream in = new FileInputStream(configFile); try { cfg.load(in); } finally { in.close(); } parseProperties(cfg); } catch (IOException e) { throw new ConfigException("Error processing " + path, e); } catch (IllegalArgumentException e) { throw new ConfigException("Error processing " + path, e); } }
private static String[] splitWithLeadingHostname(String s) throws ConfigException { /* Does it start with an IPv6 literal? */ if (s.startsWith("[")) { int i = s.indexOf("]:"); if (i < 0) { throw new ConfigException(s + " starts with '[' but has no matching ']:'"); } String[] sa = s.substring(i + 2).split(":"); String[] nsa = new String[sa.length + 1]; nsa[0] = s.substring(1, i); System.arraycopy(sa, 0, nsa, 1, sa.length); return nsa; } else { return s.split(":"); } }
public static ZooServer runZookeeperServer(String zooConfFile) { zkSystemProps(); ServerConfig config = new ServerConfig(); try { config.parse(zooConfFile); } catch (ConfigException e) { FmtLog.error(LOG, "Error in Zookeeper configuration file '%s': %s", zooConfFile, e.getMessage()); throw new IllegalArgumentException(e); } ZooServer zksm = new ZooServer(config); zksm.setupFromConfig(); return zksm; }
} else throw new ConfigException("Unrecognised peertype: " + value); type = LearnerType.PARTICIPANT; } else { throw new ConfigException("Unrecognised peertype: " + value); long sid = Long.parseLong(s); if(serverGroup.containsKey(sid)) throw new ConfigException("Server " + sid + "is in multiple groups"); else serverGroup.put(sid, gid); throw new ConfigException("Every server must be in exactly one group");
throw new ConfigException("Error processing " + path, e); } catch (IllegalArgumentException e) { throw new ConfigException("Error processing " + path, e); dynamicCfg.load(inConfig); if (dynamicCfg.getProperty("version") != null) { throw new ConfigException("dynamic file shouldn't have version inside"); throw new ConfigException("Error processing " + dynamicConfigFileStr, e); } catch (IllegalArgumentException e) { throw new ConfigException("Error processing " + dynamicConfigFileStr, e);
throw new ConfigException("Error processing " + filename, e); } catch (IllegalArgumentException e) { throw new ConfigException("Error processing " + filename, e);
/** * Parse a ZooKeeper configuration file * @param path the patch of the configuration file * @throws ConfigException error processing configuration */ public void parse(String path) throws ConfigException { File configFile = new File(path); LOG.info("Reading configuration from: " + configFile); try { if (!configFile.exists()) { throw new IllegalArgumentException(configFile.toString() + " file is missing"); } Properties cfg = new Properties(); FileInputStream in = new FileInputStream(configFile); try { cfg.load(in); } finally { in.close(); } parseProperties(cfg); } catch (IOException e) { throw new ConfigException("Error processing " + path, e); } catch (IllegalArgumentException e) { throw new ConfigException("Error processing " + path, e); } }
} else if (!configBackwardCompatibilityMode && !key.startsWith("server.") && !key.equals("version")){ LOG.info(dynamicConfigProp.toString()); throw new ConfigException("Unrecognised parameter: " + key);
long sid = Long.parseLong(s); if(serverGroup.containsKey(sid)) throw new ConfigException("Server " + sid + "is in multiple groups"); else serverGroup.put(sid, gid); if (qs.type == LearnerType.PARTICIPANT){ if (!serverGroup.containsKey(id)) throw new ConfigException("Server " + id + "is not in a group"); if (!serverWeight.containsKey(id)) serverWeight.put(id, (long) 1);
if ((serverClientParts.length > 2) || (serverParts.length < 3) || (serverParts.length > 4)) { throw new ConfigException(addressStr + wrongFormat); throw new ConfigException(addressStr + wrongFormat); throw new ConfigException("Address unresolved: " + hostname + ":" + clientParts[clientParts.length - 1]); Integer.parseInt(serverParts[1])); } catch (NumberFormatException e) { throw new ConfigException("Address unresolved: " + serverParts[0] + ":" + serverParts[1]); Integer.parseInt(serverParts[2])); } catch (NumberFormatException e) { throw new ConfigException("Address unresolved: " + serverParts[0] + ":" + serverParts[2]); throw new ConfigException( "Client and election port must be different! Please update the configuration file on server." + sid);
private static String[] splitWithLeadingHostname(String s) throws ConfigException { /* Does it start with an IPv6 literal? */ if (s.startsWith("[")) { int i = s.indexOf("]:"); if (i < 0) { throw new ConfigException(s + " starts with '[' but has no matching ']:'"); } String[] sa = s.substring(i + 2).split(":"); String[] nsa = new String[sa.length + 1]; nsa[0] = s.substring(1, i); System.arraycopy(sa, 0, nsa, 1, sa.length); return nsa; } else { return s.split(":"); } }
qs = new QuorumPeer.QuorumServer(-1, value); } catch (ConfigException e) { e.printStackTrace(); continue;
int i = s.indexOf("]"); if (i < 0) { throw new ConfigException(s + " starts with '[' but has no matching ']:'"); throw new ConfigException(s + " doesn't have a port after colon");
throw new ConfigException("Error processing " + filename, e); } catch (IllegalArgumentException e) { throw new ConfigException("Error processing " + filename, e);