public String createKeyName(String key) { String newKey = baffleConfig.getMapping(key); if (newKey == null) { if (baffleConfig.isKeepKey(key)) { if (usedKey.containsKey(key)) { throw new BaffleRuntimeException("error keep key config :" + key); } else { usedKey.put(key, Boolean.TRUE); return key; } } else { newKey = factory.createName(RES_KEY_KEY); while (usedKey.containsKey(newKey)) { newKey = factory.createName(RES_KEY_KEY); } usedKey.put(newKey, Boolean.TRUE); return newKey; } } else { return newKey; } }
ObfuscateHelper(BaffleConfig config) throws BaffleException { baffleConfig = config; Map<String, String> map = baffleConfig.getAllMapping(); log.log(Level.CONFIG, "ObfuscateHelper:---map>>>" + map.size()); Set<Entry<String, String>> set = map.entrySet(); for (Entry<String, String> entry : set) { if (usedKey.containsKey(entry.getValue())) { throw new BaffleException( "duplicate map config : " + entry.getKey() + "--->" + entry.getValue()); } usedKey.put(entry.getValue(), Boolean.TRUE); } factory = new NameFactory(); }