auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public PrinterDto create(@RequestBody PrinterDto dto) throws Exception { Printer printer = Dtos.to(dto); return get(printerService.create(printer)); }

Target:
public PrinterDto create(@RequestBody PrinterDto dto) throws IOException { Printer printer = Dtos.to(dto); return get(printerService.create(printer)); }
Source:
private void validateCRUDCheckPresent(final AbstractApexNode<?> node, final Object data, final String crudMethod, final String typeCheck) { if (!typeToDMLOperationMapping.containsKey(typeCheck)) { if (!isProperESAPICheckForDML(typeCheck, crudMethod)) { if (!isWithSecurityEnforced(node)) { addViolation(data, node); } } } else { boolean properChecksHappened = false; List<String> dmlOperationsChecked = typeToDMLOperationMapping.get(typeCheck); for (String dmlOp : dmlOperationsChecked) { if (dmlOp.equalsIgnoreCase(crudMethod)) { properChecksHappened = true; break; } if (crudMethod.equals(ANY)) { properChecksHappened = true; break; } } if (!properChecksHappened) { addViolation(data, node); } } }

Target:
private void validateCRUDCheckPresent(final AbstractApexNode<?> node, final Object data, final String crudMethod, final String typeCheck) { boolean missingKey = !typeToDMLOperationMapping.containsKey(typeCheck); boolean isImproperDMLCheck = !isProperESAPICheckForDML(typeCheck, crudMethod); boolean noSecurityEnforced = !isWithSecurityEnforced(node); if (missingKey) { if (isImproperDMLCheck && noSecurityEnforced) { addViolation(data, node); } } else { boolean properChecksHappened = false; List<String> dmlOperationsChecked = typeToDMLOperationMapping.get(typeCheck); for (String dmlOp : dmlOperationsChecked) { if (dmlOp.equalsIgnoreCase(crudMethod)) { properChecksHappened = true; break; } if (crudMethod.equals(ANY)) { properChecksHappened = true; break; } } if (!properChecksHappened) { addViolation(data, node); } } }
Source:
public boolean modifyEvent(String key, Construct value, BindableEvent event) { if (event instanceof MCPlayerChatEvent) { MCPlayerChatEvent e = (MCPlayerChatEvent)event; if("message".equals(key)){ e.setMessage(value.nval()); } if("recipients".equals(key)){ if(value instanceof CArray){ List<MCPlayer> list = new ArrayList<MCPlayer>(); for(String index : ((CArray)value).stringKeySet()){ Construct v = ((CArray)value).get(index, Target.UNKNOWN); try{ list.add(Static.GetPlayer(v, Target.UNKNOWN)); } catch(ConfigRuntimeException ex){ } } e.setRecipients(list); } else { throw ConfigRuntimeException.BuildException("recipients must be an array", CRECastException.class, value.getTarget()); } } if("format".equals(key)){ String format = value.nval(); if(format == null) { throw new CRENullPointerException("The \"format\" key in " + modify_event.class.getSimpleName() + " for the " + this.getName() + " event may not be null.", Target.UNKNOWN); } else if(format.replaceAll("%%", "").replaceAll("\\%\\%|\\%[12]\\$s", "").contains("%")) { throw new CREFormatException("The \"format\" key in " + modify_event.class.getSimpleName() + " for the " + this.getName() + " event only accepts %1$s and %1$s as format specifiers. Use a \"%%\" to display a single \"%\".", Target.UNKNOWN); } try{ e.setFormat(format); } catch(UnknownFormatConversionException | IllegalFormatConversionException | FormatFlagsConversionMismatchException ex){ throw new CREFormatException(ex.getMessage(), Target.UNKNOWN); } } return true; } return false; }

Target:
public boolean modifyEvent(String key, Construct value, BindableEvent event) { if (event instanceof MCPlayerChatEvent) { MCPlayerChatEvent e = (MCPlayerChatEvent)event; if("message".equals(key)){ e.setMessage(value.nval()); } if("recipients".equals(key)){ if(value instanceof CArray){ List<MCPlayer> list = new ArrayList<MCPlayer>(); for(String index : ((CArray)value).stringKeySet()){ Construct v = ((CArray)value).get(index, Target.UNKNOWN); try{ list.add(Static.GetPlayer(v, Target.UNKNOWN)); } catch(ConfigRuntimeException ex){ } } e.setRecipients(list); } else { throw ConfigRuntimeException.BuildException("recipients must be an array", CRECastException.class, value.getTarget()); } } if("format".equals(key)){ String format = value.nval(); if(format == null) { throw new CRENullPointerException("The \"format\" key in " + new modify_event().getName() + " for the " + this.getName() + " event may not be null.", Target.UNKNOWN); } try{ e.setFormat(format); } catch(Exception ex){ if(format.replaceAll("%%", "").replaceAll("\\%\\%|\\%[12]\\$s", "").contains("%")) { throw new CREFormatException("The \"format\" key in " + modify_event.class.getSimpleName() + " for the " + this.getName() + " event only accepts %1$s and %2$s as format specifiers. Use a \"%%\" to display a single \"%\".", Target.UNKNOWN); } else { throw new CREFormatException("The \"format\" key in " + modify_event.class.getSimpleName() + " for the " + this.getName() + " event was set to an invalid value: " + format + ". The original exception message is: " + ex.getMessage(), Target.UNKNOWN); } } } return true; } return false; }
Source:
public boolean validateObject(PooledConnectionKey key, PooledObject<Connection> pooledConnectionObject) { boolean valid = false; try { pooledConnectionObject.getObject().start(); valid = true; } catch (JMSException e) { log.warn("Connection with username " + key + " is not valid anymore"); } return valid; }

Target:
public boolean validateObject(PooledConnectionKey key, PooledObject<Connection> pooledConnectionObject) { boolean valid = false; try { pooledConnectionObject.getObject().start(); valid = true; } catch (JMSException e) { log.warn("Connection with key " + key + " is not valid anymore"); } return valid; }
Source:
public URL loadJar(String jarPath) { File taskJarFile; try { taskJarFile = new File(jarPath); if (taskJarFile.exists() && !taskJarFile.isDirectory()) { return taskJarFile.toURI().toURL(); } LOG.error("Failed to find JAR " + jarPath + " for new task."); throw new IllegalStateException("No JAR for task"); } catch (MalformedURLException e) { LOG.error("Failed to open JAR " + jarPath + " for new task."); throw new IllegalStateException("Malformed JAR URL for task"); } }

Target:
public URL loadJar(String jarPath) { File taskJarFile = new File(jarPath); if (!taskJarFile.exists() || taskJarFile.isDirectory()) { LOG.error("Failed to find JAR " + jarPath + " for new task."); throw new IllegalArgumentException("No JAR for task"); } try { return taskJarFile.toURI().toURL(); } catch (MalformedURLException e) { LOG.error("Failed to open JAR " + jarPath + " for new task."); throw new IllegalArgumentException("Malformed JAR URL for task"); } }
Source:
public Result apply(JoinNode joinNode, Captures captures, Context context) { Expression filter = joinNode.getFilter().get(); return tryCreateSpatialJoin(context, joinNode, filter, joinNode.getId(), joinNode.getOutputSymbols(), metadata, splitManager, pageSourceManager, sqlParser); }

Target:
public Result apply(JoinNode joinNode, Captures captures, Context context) { Expression filter = joinNode.getFilter().get(); List<FunctionCall> spatialFunctions = extractSupportedSpatialFunctions(filter); for (FunctionCall spatialFunction : spatialFunctions) { Result result = tryCreateSpatialJoin(context, joinNode, filter, joinNode.getId(), joinNode.getOutputSymbols(), spatialFunction, Optional.empty(), metadata, splitManager, pageSourceManager, sqlParser); if (!result.isEmpty()) { return result; } } List<ComparisonExpression> spatialComparisons = extractSupportedSpatialComparisons(filter); for (ComparisonExpression spatialComparison : spatialComparisons) { Result result = tryCreateSpatialJoin(context, joinNode, filter, joinNode.getId(), joinNode.getOutputSymbols(), spatialComparison, metadata, splitManager, pageSourceManager, sqlParser); if (!result.isEmpty()) { return result; } } return Result.empty(); }
Source:
public void handleMessage(TrapLogDTO messageLog) { final Log eventLog = toLog(messageLog); eventForwarder.sendNowSync(eventLog); if (config.getNewSuspectOnTrap()) { eventLog.getEvents().getEventCollection().stream() .filter(e -> !e.hasNodeid()) .forEach(e -> { sendNewSuspectEvent(e.getInterface(), e.getDistPoller()); LOG.debug("Sent newSuspectEvent for interface {}", e.getInterface()); }); } }

Target:
public void handleMessage(TrapLogDTO messageLog) { try (Logging.MDCCloseable mdc = Logging.withPrefixCloseable(Trapd.LOG4J_CATEGORY)) { final Log eventLog = toLog(messageLog); eventForwarder.sendNowSync(eventLog); if (config.getNewSuspectOnTrap()) { eventLog.getEvents().getEventCollection().stream() .filter(e -> !e.hasNodeid()) .forEach(e -> { sendNewSuspectEvent(e.getInterface(), e.getDistPoller()); LOG.debug("Sent newSuspectEvent for interface {}", e.getInterface()); }); } } }
Source:
public IDBController construct(ConstructArgs args) { return new IDBController(argSelfIdbId, realControllerOperatorId, realControllerWorkerId, null, null, null, argState .construct(), sync); }

Target:
public IDBController construct(ConstructArgs args) { return new IDBController(argSelfIdbId, realControllerOperatorId, realControllerWorkerId, null, null, null, argState .construct(), Objects.firstNonNull(sync, Boolean.FALSE)); }
Source:
public static JSONArray getJmx(String beanQuery, String webAddress, URLConnectionFactory connectionFactory, String scheme) { JSONArray ret = null; BufferedReader reader = null; try { String host = webAddress; int port = -1; if (webAddress.indexOf(":") > 0) { String[] webAddressSplit = webAddress.split(":"); host = webAddressSplit[0]; port = Integer.parseInt(webAddressSplit[1]); } URL jmxURL = new URL(scheme, host, port, "/jmx?qry=" + beanQuery); LOG.debug("JMX URL: {}", jmxURL); URLConnection conn = connectionFactory.openConnection( jmxURL, UserGroupInformation.isSecurityEnabled()); conn.setConnectTimeout(5 * 1000); conn.setReadTimeout(5 * 1000); InputStream in = conn.getInputStream(); InputStreamReader isr = new InputStreamReader(in, "UTF-8"); reader = new BufferedReader(isr); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } String jmxOutput = sb.toString(); JSONObject json = new JSONObject(jmxOutput); ret = json.getJSONArray("beans"); } catch (IOException e) { LOG.error("Cannot read JMX bean from server {}: ", beanQuery, webAddress, e); } catch (Exception e) { LOG.error("Cannot parse JMX output for from server {}: ", beanQuery, webAddress, e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { LOG.error("Problem closing {}", webAddress, e); } } } return ret; }

Target:
public static JSONArray getJmx(String beanQuery, String webAddress, URLConnectionFactory connectionFactory, String scheme) { JSONArray ret = null; BufferedReader reader = null; try { String host = webAddress; int port = -1; if (webAddress.indexOf(":") > 0) { String[] webAddressSplit = webAddress.split(":"); host = webAddressSplit[0]; port = Integer.parseInt(webAddressSplit[1]); } URL jmxURL = new URL(scheme, host, port, "/jmx?qry=" + beanQuery); LOG.debug("JMX URL: {}", jmxURL); URLConnection conn = connectionFactory.openConnection( jmxURL, UserGroupInformation.isSecurityEnabled()); conn.setConnectTimeout(5 * 1000); conn.setReadTimeout(5 * 1000); InputStream in = conn.getInputStream(); InputStreamReader isr = new InputStreamReader(in, "UTF-8"); reader = new BufferedReader(isr); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } String jmxOutput = sb.toString(); JSONObject json = new JSONObject(jmxOutput); ret = json.getJSONArray("beans"); } catch (IOException e) { LOG.error("Cannot read JMX bean from server {}", beanQuery, webAddress, e); } catch (JSONException e) { LOG.error("Cannot parse JMX output for from server {}: {}", beanQuery, webAddress, e.getMessage()); } catch (Exception e) { LOG.error("Cannot parse JMX output for from server {}", beanQuery, webAddress, e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { LOG.error("Problem closing {}", webAddress, e); } } } return ret; }
Source:
protected void executeCommand() { this.macPoolDao = getDbFacade().getMacPoolDao(); MacPool macPool = getMacPool(); macPoolDao.save(macPool); MacPoolPerDC.getInstance().createPool(macPool); setSucceeded(true); getReturnValue().setActionReturnValue(macPool.getId()); }

Target:
protected void executeCommand() { MacPool macPool = getMacPool(); macPool.setId(Guid.newGuid()); getMacPoolDAO().save(macPool); MacPoolPerDc.getInstance().createPool(macPool); setSucceeded(true); getReturnValue().setActionReturnValue(macPool.getId()); }
Source:
public void close() throws FileDataSourceException { if (assetInputStream != null) { try { assetInputStream.close(); } catch (IOException e) { throw new FileDataSourceException(e); } finally { assetInputStream = null; if (opened) { opened = false; if (listener != null) { listener.onTransferEnd(); } } } } }

Target:
public void close() throws AssetDataSourceException { if (assetInputStream != null) { try { assetInputStream.close(); } catch (IOException e) { throw new AssetDataSourceException(e); } finally { assetInputStream = null; if (opened) { opened = false; if (listener != null) { listener.onTransferEnd(); } } } } }
Source:
private boolean isTransitionValid(State source, State target) { switch (target) { case INITIALIZING: return source == UNINITIALIZED || source == READY; case READY: return source == INITIALIZING || source == COMMITTING_TRANSACTION || source == ABORTING_TRANSACTION; case IN_TRANSACTION: return source == READY; case COMMITTING_TRANSACTION: return source == IN_TRANSACTION; case ABORTING_TRANSACTION: return source == IN_TRANSACTION || source == ABORTABLE_ERROR; case ABORTABLE_ERROR: return source == IN_TRANSACTION || source == COMMITTING_TRANSACTION || source == ABORTABLE_ERROR; case FATAL_ERROR: default: return true; } }

Target:
private boolean isTransitionValid(State source, State target) { switch (target) { case UNINITIALIZED: return source == READY; case INITIALIZING: return source == UNINITIALIZED; case READY: return source == INITIALIZING || source == COMMITTING_TRANSACTION || source == ABORTING_TRANSACTION; case IN_TRANSACTION: return source == READY; case COMMITTING_TRANSACTION: return source == IN_TRANSACTION; case ABORTING_TRANSACTION: return source == IN_TRANSACTION || source == ABORTABLE_ERROR; case ABORTABLE_ERROR: return source == IN_TRANSACTION || source == COMMITTING_TRANSACTION || source == ABORTABLE_ERROR; case FATAL_ERROR: default: return true; } }
Source:
int hash(Throwable error, Deque<String> hexHashes) { int hash = 0; if (error.getCause() != null && error.getCause() != error) { hash = hash(error.getCause(), hexHashes); } hash = 31 * hash + error.getClass().getName().hashCode(); for (StackTraceElement element : error.getStackTrace()) { if (accept(element)) { hash = 31 * hash + hash(element); } } hexHashes.push(String.format("%08x", hash)); return hash; }

Target:
int hash(Throwable error, Deque<String> hexHashes) { int hash = 0; if (error.getCause() != null && error.getCause() != error) { hash = hash(error.getCause(), hexHashes); } hash = 31 * hash + error.getClass().getName().hashCode(); for (StackTraceElement element : error.getStackTrace()) { if (filter.accept(element)) { hash = 31 * hash + hash(element); } } if(hexHashes != null) { hexHashes.push(toHex(hash)); } return hash; }
Source:
public void testGetNoStoreEntryCacheLoadingException() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); when(this.cacheLoaderWriter.load("key")).thenThrow(new Exception()); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter); try { ehcache.get("key"); fail(); } catch (CachePassThroughException e) { assertThat(e.getCause(), instanceOf(CacheLoadingException.class)); } verify(this.store).computeIfAbsent(eq("key"), getAnyFunction()); verify(this.cacheLoaderWriter).load(eq("key")); verifyZeroInteractions(this.spiedResilienceStrategy); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.CacheLoadingOutcome.FAILURE)); }

Target:
public void testGetNoStoreEntryCacheLoadingException() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); when(this.cacheLoaderWriter.load("key")).thenThrow(new Exception()); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheLoaderWriter); try { ehcache.get("key"); fail(); } catch (CacheLoadingException e) { } verify(this.store).computeIfAbsent(eq("key"), getAnyFunction()); verify(this.cacheLoaderWriter).load(eq("key")); verifyZeroInteractions(this.spiedResilienceStrategy); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.CacheLoadingOutcome.FAILURE)); }
Source:
public CommandContextConfiguration(String controller, String username, char[] password, String clientBindAddress, boolean disableLocalAuth, boolean initConsole, int connectionTimeout, InputStream consoleInput, OutputStream consoleOutput) { this.controller = controller; this.username = username; this.password = password; this.clientBindAddress = clientBindAddress; this.consoleInput = consoleInput; this.consoleOutput = consoleOutput; this.initConsole = initConsole; this.disableLocalAuth = disableLocalAuth || username != null; this.connectionTimeout = connectionTimeout; }

Target:
private CommandContextConfiguration(String controller, String username, char[] password, String clientBindAddress, boolean disableLocalAuth, boolean initConsole, int connectionTimeout, InputStream consoleInput, OutputStream consoleOutput) { this.controller = controller; this.username = username; this.password = password; this.clientBindAddress = clientBindAddress; this.consoleInput = consoleInput; this.consoleOutput = consoleOutput; this.initConsole = initConsole; this.disableLocalAuth = disableLocalAuth || username != null; this.connectionTimeout = connectionTimeout; }
Source:
public boolean isServerDisabled() { return isServerDisabled; }

Target:
public boolean isServerDisabled() { return serverDisabled; }
Source:
public boolean containsAll(Collection<?> c) { try (final Handle handle = rdbi.open()) { for (final Object obj : c) { final ValueType valueToFind = (ValueType) obj; final String valueToFindStr = serializationHelper.encode(valueToFind); boolean found = false; for (int i = 0; i < size(); i++) { String valueAtIndex = handle.jedis().lindex(key, i); if (valueToFindStr.equals(valueAtIndex)) { found = true; break; } } if (!found) { return false; } } } return true; }

Target:
public boolean containsAll(Collection<?> c) { List<ValueType> currentList = peekAll(); return currentList.containsAll(c); }
Source:
public void setEnvironment(Map<String, String> env) { env.put("GPHOME_LOADERS", gploadHome); if (usePasswordFile) { env.put("PGPASSFILE", passwordInfo); } else { env.put("PGPASSWORD", passwordInfo); } }

Target:
public void setEnvironment(Map<String, String> env) { File unixPath = new File(gploadHome + File.separator + "greenplum_loaders_path.sh"); if (unixPath.exists()) { env.put("GPHOME_LOADERS", gploadHome); } else { unixPath = new File(gploadHome + File.separator + "greenplum_path.sh"); if (unixPath.exists()) { env.put("GPHOME", gploadHome); } else { throw new IllegalArgumentException("The provided --gploadHome '" + gploadHome + "' does not point to a valid installation"); } } unixPath = null; if (usePasswordFile) { env.put("PGPASSFILE", passwordInfo); } else { env.put("PGPASSWORD", passwordInfo); } }
Source:
private void downloadZip(HttpURLConnection urlConnection, File updateFile) { try (InputStream inputStream = urlConnection.getInputStream(); FileOutputStream outputStream = new FileOutputStream(updateFile)) { byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; long totalBytesRead = 0; int percentCompleted = 0; long fileSize = urlConnection.getContentLength(); while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); totalBytesRead += bytesRead; percentCompleted = (int) (totalBytesRead * 100 / fileSize); publish(percentCompleted); } } catch (IOException ex) { ex.printStackTrace(); cancel(true); } }

Target:
private void downloadZip(HttpURLConnection urlConnection, File updateFile) { try (InputStream inputStream = urlConnection.getInputStream(); FileOutputStream outputStream = new FileOutputStream(updateFile)) { byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; long totalBytesRead = 0; int percentCompleted = 0; long fileSize = urlConnection.getContentLength(); while ((bytesRead = inputStream.read(buffer)) != -1) { outputStream.write(buffer, 0, bytesRead); totalBytesRead += bytesRead; percentCompleted = (int) (totalBytesRead * 100 / fileSize); publish(percentCompleted); } } catch (IOException ex) { GPLogger.log(ex); cancel(true); } }
Source:
protected MySQLStorageEngine getMySQLStorageEngine() { String storageEngine = Environment.getProperties().getProperty( Environment.STORAGE_ENGINE ); if(storageEngine == null) { storageEngine = System.getProperty( Environment.STORAGE_ENGINE ); } if(storageEngine == null) { return InnoDBStorageEngine.INSTANCE; } if( "innodb".equals( storageEngine.toLowerCase() ) ) { return MyISAMStorageEngine.INSTANCE; } else if( "myisam".equals( storageEngine.toLowerCase() ) ) { return MyISAMStorageEngine.INSTANCE; } else { throw new UnsupportedOperationException( "The " + storageEngine + " storage engine is not supported!" ); } }

Target:
protected MySQLStorageEngine getMySQLStorageEngine() { String storageEngine = Environment.getProperties().getProperty( Environment.STORAGE_ENGINE ); if(storageEngine == null) { storageEngine = System.getProperty( Environment.STORAGE_ENGINE ); } if(storageEngine == null) { return getDefaultMySQLStorageEngine(); } if( "innodb".equals( storageEngine.toLowerCase() ) ) { return InnoDBStorageEngine.INSTANCE; } else if( "myisam".equals( storageEngine.toLowerCase() ) ) { return MyISAMStorageEngine.INSTANCE; } else { throw new UnsupportedOperationException( "The " + storageEngine + " storage engine is not supported!" ); } }
Source:
public static LabelType withDefaultValues(String name) { checkName(name); List<LabelValue> values = new ArrayList<LabelValue>(2); values.add(new LabelValue((short) 0, "Rejected")); values.add(new LabelValue((short) 1, "Approved")); LabelType type = new LabelType(name, values); return type; }

Target:
public static LabelType withDefaultValues(String name) { checkName(name); List<LabelValue> values = new ArrayList<LabelValue>(2); values.add(new LabelValue((short) 0, "Rejected")); values.add(new LabelValue((short) 1, "Approved")); return new LabelType(name, values); }
Source:
public void onClick(AjaxRequestTarget target) { getModelObject().getRecord().save(); setResponsePage(new ODocumentPage(getModelObject()).setModeObject(DisplayMode.VIEW)); }

Target:
public void onClick(AjaxRequestTarget target) { getModelObject().getRecord().save(); super.onClick(); }
Source:
private void parseHttpMethodAndPath(String httpMethod, String value, boolean hasBody) { if (this.httpMethod != null) { throw methodError("Only one HTTP method is allowed. Found: %s and %s.", this.httpMethod, httpMethod); } if (null == httpMethod) return; this.httpMethod = httpMethod; this.hasBody = hasBody; if (value.isEmpty()) { return; } int question = value.indexOf('?'); if (question != -1 && question < value.length() - 1) { String queryParams = value.substring(question + 1); Matcher queryParamMatcher = PARAM_URL_REGEX.matcher(queryParams); if (queryParamMatcher.find()) { throw methodError("URL query string \"%s\" must not have replace block. " + "For dynamic query parameters use @Query.", queryParams); } } this.relativeUrl = value; this.relativeUrlParamNames = parsePathParameters(value); }

Target:
private void parseHttpMethodAndPath(String httpMethod, String value, boolean hasBody) { if (this.httpMethod != null) { throw methodError("Only one HTTP method is allowed. Found: %s and %s.", this.httpMethod, httpMethod); } this.httpMethod = httpMethod; this.hasBody = hasBody; if (value.isEmpty()) { return; } int question = value.indexOf('?'); if (question != -1 && question < value.length() - 1) { String queryParams = value.substring(question + 1); Matcher queryParamMatcher = PARAM_URL_REGEX.matcher(queryParams); if (queryParamMatcher.find()) { throw methodError("URL query string \"%s\" must not have replace block. " + "For dynamic query parameters use @Query.", queryParams); } } this.relativeUrl = value; this.relativeUrlParamNames = parsePathParameters(value); }
Source:
private void verifyMembershipEvent(final Message<?> msg, final int membershipEvent) { assertNotNull(msg); assertNotNull(msg.getPayload()); assertTrue(msg.getPayload() instanceof MembershipEvent); assertEquals(((MembershipEvent) msg.getPayload()).getEventType(), membershipEvent); assertNotNull(((MembershipEvent) msg.getPayload()).getMember()); }

Target:
private void verifyMembershipEvent(final Message<?> msg, final int membershipEvent) { assertNotNull(msg); assertNotNull(msg.getPayload()); assertTrue(msg.getPayload() instanceof MembershipEvent); assertEquals(membershipEvent, ((MembershipEvent) msg.getPayload()).getEventType()); assertNotNull(((MembershipEvent) msg.getPayload()).getMember()); }
Source:
public void testNestedInvalidateAndApplyCompletes() throws Exception { final AtomicBoolean hasRun = new AtomicBoolean(); final SideEffect innerSideEffect = SideEffect.createPaused(() -> { }).resume(); SideEffect.createPaused(() -> { assertFalse(hasRun.get()); hasRun.set(true); innerSideEffect.markDirty(); innerSideEffect.runIfDirty(); }).resume(); runAsync(); assertTrue(hasRun.get()); }

Target:
public void testNestedInvalidateAndApplyCompletes() throws Exception { AtomicBoolean hasRun = new AtomicBoolean(); SideEffect innerSideEffect = SideEffect.createPaused(() -> { }); innerSideEffect.resume(); SideEffect.createPaused(() -> { assertFalse(hasRun.get()); hasRun.set(true); innerSideEffect.markDirty(); innerSideEffect.runIfDirty(); }).resume(); runAsync(); assertTrue(hasRun.get()); }
Source:
public void handleQueryResponse(long sendHsId, long requestId, long lastSeq) { if (m_currentRequestId == requestId && m_mastershipAccepted.get()) { m_es.execute(new Runnable() { @Override public void run() { m_queryResponses.put(sendHsId, new QueryResponse(lastSeq)); Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get(); if (p.getSecond().stream().allMatch(hsid -> m_queryResponses.containsKey(hsid))) { Entry<Long, QueryResponse> bestCandidate = null; try { bestCandidate = m_queryResponses.entrySet().stream() .filter(s -> s.getValue().canCoverGap()) .sorted() .findFirst() .get(); } catch (NoSuchElementException e) { setStatus(StreamStatus.BLOCKED); RealVoltDB voltdb = (RealVoltDB)VoltDB.instance(); if (voltdb.isClusterComplete()) { Pair<Long, Long> gap = m_gapTracker.getFirstGap(); exportLog.warn(ExportDataSource.this.toString() + " is blocked because stream hits a gap from sequence number " + gap.getFirst() + " to " + gap.getSecond()); } } if (bestCandidate != null) { m_newLeaderHostId = CoreUtils.getHostIdFromHSId(bestCandidate.getKey()); exportLog.info("Stream master is going to switch to host " + m_newLeaderHostId + " to jump the gap."); mastershipCheckpoint(m_lastReleasedSeqNo); } } } }); } }

Target:
public void handleQueryResponse(long sendHsId, long requestId, long lastSeq) { if (m_currentRequestId == requestId && m_mastershipAccepted.get()) { m_es.execute(new Runnable() { @Override public void run() { m_queryResponses.put(sendHsId, new QueryResponse(lastSeq)); Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get(); if (p.getSecond().stream().allMatch(hsid -> m_queryResponses.containsKey(hsid))) { List<Entry<Long, QueryResponse>> candidates = m_queryResponses.entrySet().stream() .filter(s -> s.getValue().canCoverGap()) .collect(Collectors.toList()); Entry<Long, QueryResponse> bestCandidate = null; for (Entry<Long, QueryResponse> candidate : candidates) { if (bestCandidate == null) { bestCandidate = candidate; } else if (candidate.getValue().lastSeq > bestCandidate.getValue().lastSeq) { bestCandidate = candidate; } } if (bestCandidate == null) { setStatus(StreamStatus.BLOCKED); RealVoltDB voltdb = (RealVoltDB)VoltDB.instance(); if (voltdb.isClusterComplete()) { if (DISABLE_AUTO_GAP_RELEASE) { Pair<Long, Long> gap = m_gapTracker.getFirstGap(); exportLog.warn(ExportDataSource.this.toString() + " is blocked because stream hits a gap from sequence number " + gap.getFirst() + " to " + gap.getSecond()); } else { Pair<Long, Long> gap = m_gapTracker.getFirstGap(); exportLog.warn(ExportDataSource.this.toString() + " is blocked because stream hits a gap from sequence number " + gap.getFirst() + " to " + gap.getSecond()); } } } else { m_newLeaderHostId = CoreUtils.getHostIdFromHSId(bestCandidate.getKey()); exportLog.info("Stream master is going to switch to host " + m_newLeaderHostId + " to jump the gap."); mastershipCheckpoint(m_lastReleasedSeqNo); } } } }); } }
Source:
public CloudObjectLocation(@JsonProperty("bucket") String bucket, @JsonProperty("path") String path) { this.bucket = Preconditions.checkNotNull(StringUtils.maybeRemoveTrailingSlash(bucket)); this.path = Preconditions.checkNotNull(StringUtils.maybeRemoveLeadingSlash(path)); Preconditions.checkArgument(this.bucket.equals(StringUtils.urlEncode(this.bucket))); }

Target:
public CloudObjectLocation(@JsonProperty("bucket") String bucket, @JsonProperty("path") String path) { this.bucket = Preconditions.checkNotNull(StringUtils.maybeRemoveTrailingSlash(bucket)); this.path = Preconditions.checkNotNull(StringUtils.maybeRemoveLeadingSlash(path)); Preconditions.checkArgument( this.bucket.equals(StringUtils.urlEncode(this.bucket)), "bucket must follow DNS-compliant naming conventions" ); }
Source:
public PageImage fromCursor(Cursor c) { Site site = new Site(c.getString(c.getColumnIndex(COL_TITLE))); PageTitle title = new PageTitle(null, c.getString(c.getColumnIndex(COL_TITLE)), site); String imageName = c.getString(c.getColumnIndex(COL_IMAGE_NAME)); return new PageImage(title, imageName); }

Target:
public PageImage fromCursor(Cursor c) { Site site = new Site(c.getString(c.getColumnIndex(COL_SITE))); PageTitle title = new PageTitle(null, c.getString(c.getColumnIndex(COL_TITLE)), site); String imageName = c.getString(c.getColumnIndex(COL_IMAGE_NAME)); return new PageImage(title, imageName); }
Source:
public Map<Map.Entry<Long, Long>, Map.Entry<Long, Long>> apply(Set<Map.Entry<Long, Long>> request) { if (offHeapTimestampCache.cacheDescriptor.get().currentSize().get() >= offHeapTimestampCache.maxSize) { offHeapTimestampCache.clear(); } CacheDescriptor cacheDescriptor = offHeapTimestampCache.cacheDescriptor.get(); try { Map<Long, Long> response = offHeapTimestampCache.persistentTimestampStore.multiGet( cacheDescriptor.storeNamespace(), request.stream().map(Map.Entry::getKey).collect(Collectors.toList())); Set<Map.Entry<Long, Long>> toWrite = Sets.difference(request, response.entrySet()); offHeapTimestampCache.persistentTimestampStore.multiPut( cacheDescriptor.storeNamespace(), toWrite); cacheDescriptor.currentSize().addAndGet(toWrite.size()); } catch (SafeIllegalArgumentException exception) { log.warn("Clear called concurrently, writing failed"); } finally { offHeapTimestampCache.concurrentHashMap.clear(); } return KeyedStream.of(request.stream()).collectToMap(); }

Target:
public Map<Map.Entry<Long, Long>, Map.Entry<Long, Long>> apply(Set<Map.Entry<Long, Long>> request) { if (offHeapTimestampCache.cacheDescriptor.get().currentSize().get() >= offHeapTimestampCache.maxSize) { offHeapTimestampCache.clear(); } CacheDescriptor cacheDescriptor = offHeapTimestampCache.cacheDescriptor.get(); try { Map<Long, Long> response = offHeapTimestampCache.persistentTimestampStore.multiGet( cacheDescriptor.storeNamespace(), request.stream().map(Map.Entry::getKey).collect(Collectors.toList())); Map<Long, Long> toWrite = ImmutableMap.copyOf(Sets.difference(request, response.entrySet())); offHeapTimestampCache.persistentTimestampStore.multiPut( cacheDescriptor.storeNamespace(), toWrite); cacheDescriptor.currentSize().addAndGet(toWrite.size()); } catch (SafeIllegalArgumentException exception) { log.warn("Clear called concurrently, writing failed", exception); } finally { offHeapTimestampCache.inflightRequests.clear(); } return KeyedStream.of(request.stream()).collectToMap(); }
Source:
public final void canBeRendered() throws Exception { MatcherAssert.assertThat( new MkMarkdown().render( Json.createObjectBuilder() .add("text", "Hello, **world**!") .build() ), Matchers.equalTo("{\"text\":\"Hello, **world**!\"}") ); }

Target:
public final void canBeRendered() throws Exception { final String text = "Hello, **world**!"; MatcherAssert.assertThat( new MkMarkdown().render( Json.createObjectBuilder() .add("text", text) .build() ), Matchers.equalTo(text) ); }
Source:
public static void renderTokens(CAS aCas, GetDocumentResponse aResponse, AnnotatorState aState) { int winBegin = aState.getWindowBeginOffset(); int winEnd = aState.getWindowEndOffset(); Type tokenType = CasUtil.getType(aCas, Token.class); List<AnnotationFS> tokens = selectCovered(aCas, tokenType, winBegin, winEnd); for (AnnotationFS fs : tokens) { if (fs.getBegin() == fs.getEnd()) { continue; } split(aResponse.getSentenceOffsets(), fs.getCoveredText(), fs.getBegin() - winBegin, fs.getEnd() - winBegin) .forEach(range -> { aResponse.addToken(range.getBegin(), range.getEnd()); if (DEBUG) { aResponse.addEntity(new Entity(new VID(fs), "Token", new Offsets(range.getBegin(), range.getEnd()), fs.getCoveredText(), "#d9d9d9", "[" + fs.getBegin() + "-" + fs.getEnd() + "]", null)); } }); } }

Target:
public static void renderTokens(CAS aCas, GetDocumentResponse aResponse, AnnotatorState aState) { int winBegin = aState.getWindowBeginOffset(); int winEnd = aState.getWindowEndOffset(); Type tokenType = CasUtil.getType(aCas, Token.class); List<AnnotationFS> tokens = selectCovered(aCas, tokenType, winBegin, winEnd); for (AnnotationFS fs : tokens) { if (fs.getBegin() == fs.getEnd()) { continue; } split(aResponse.getSentenceOffsets(), fs.getCoveredText(), fs.getBegin() - winBegin, fs.getEnd() - winBegin).forEach(range -> { aResponse.addToken(range.getBegin(), range.getEnd()); if (DEBUG) { aResponse.addEntity(new Entity(new VID(fs), "Token", new Offsets(range.getBegin(), range.getEnd()), fs.getCoveredText(), "#d9d9d9", "[" + fs.getBegin() + "-" + fs.getEnd() + "]", false)); } }); } }
Source:
public void testAlwaysBlock() throws Exception { final AtomicLong runsStarted = new AtomicLong(0); final List<Thread> taskThreads = Collections.synchronizedList(new ArrayList<>()); final DurableScheduledService service = new DurableScheduledService("testAlwaysBlocks", RUN_FREQUENCY, RUN_TIMEOUT, RUN_TIMEOUT) { @Override protected void startUp() { LOG.info(Thread.currentThread().getName() + " startUp"); } @Override protected void runOneIteration() throws Exception { LOG.info(Thread.currentThread().getName() + " runOneIteration"); runsStarted.incrementAndGet(); synchronized (taskThreads) { if (!taskThreads.contains(Thread.currentThread())) { taskThreads.add(Thread.currentThread()); } } while (true) { Thread.sleep(RUN_FREQUENCY.toMillis()); } } @Override protected void shutDown() { LOG.info(Thread.currentThread().getName() + " shutDown"); } }; service.startAsync().awaitRunning(); long numRuns = 10 * ((RUN_TIMEOUT.toMillis() / RUN_FREQUENCY.toMillis()) + 1); Duration runDuration = RESTART_TIMEOUT.multipliedBy(numRuns); Instant expiration = Instant.now().plus(runDuration); while (runsStarted.get() < numRuns && Instant.now().isBefore(expiration)) { Thread.sleep(RUN_FREQUENCY.toMillis()); } service.stopAsync().awaitTerminated(); Assert.assertTrue(numRuns <= runsStarted.get()); Assert.assertTrue(runsStarted.get() - numRuns <= 1); Assert.assertTrue(taskThreads.stream().noneMatch(Thread::isAlive)); Assert.assertEquals(taskThreads.size(), runsStarted.get()); }

Target:
public void testAlwaysBlock() throws Exception { final AtomicLong runsStarted = new AtomicLong(0); final List<Thread> taskThreads = Collections.synchronizedList(new ArrayList<>()); final DurableScheduledService service = new DurableScheduledService("testAlwaysBlocks", RUN_FREQUENCY, RUN_TIMEOUT, RUN_TIMEOUT) { @Override protected void startUp() { LOG.info(Thread.currentThread().getName() + " startUp"); } @Override protected void runOneIteration() throws Exception { LOG.info(Thread.currentThread().getName() + " runOneIteration"); runsStarted.incrementAndGet(); synchronized (taskThreads) { if (!taskThreads.contains(Thread.currentThread())) { taskThreads.add(Thread.currentThread()); } } while (true) { Thread.sleep(RUN_FREQUENCY.toMillis()); } } @Override protected void shutDown() { LOG.info(Thread.currentThread().getName() + " shutDown"); } }; service.startAsync().awaitRunning(); long numRuns = 2 * ((RUN_TIMEOUT.toMillis() / RUN_FREQUENCY.toMillis()) + 1); Duration runDuration = RESTART_TIMEOUT.multipliedBy(numRuns); Instant expiration = Instant.now().plus(runDuration); while (runsStarted.get() < numRuns && Instant.now().isBefore(expiration)) { Thread.sleep(RUN_FREQUENCY.toMillis()); } service.stopAsync().awaitTerminated(); Assert.assertTrue(numRuns <= runsStarted.get()); Assert.assertTrue(taskThreads.stream().noneMatch(Thread::isAlive)); Assert.assertEquals(taskThreads.size(), runsStarted.get()); }
Source:
public Type getMinecartType() { return null; }

Target:
public Type getMinecartType() { return Type.CHEST; }
Source:
private void appendMethodWrapper( StringBuilder code, Class<?> subjectType, Class<?> targetType, Method method) { int modifiers = method.getModifiers(); Object o = method.getDeclaringClass(); boolean shouldWrap = !method.getDeclaringClass().equals(Subject.class) && !method.getDeclaringClass().equals(Object.class) && !(isFinal(modifiers) || isPrivate(modifiers) || isStatic(modifiers)); if (shouldWrap) { code.append(String.format( WRAPPER_METHOD_TEMPLATE, stringVisibility(modifiers), method.getReturnType().getCanonicalName(), method.getName(), methodSignature( method.getParameterTypes(), method.getParameterAnnotations()).toString(), targetType.getCanonicalName(), subjectType.getCanonicalName(), methodParameterList(method.getParameterTypes().length) )); } }

Target:
private void appendMethodWrapper( StringBuilder code, Class<?> subjectType, Class<?> targetType, Method method) { int modifiers = method.getModifiers(); boolean shouldWrap = !method.getDeclaringClass().equals(Subject.class) && !method.getDeclaringClass().equals(Object.class) && !(isFinal(modifiers) || isPrivate(modifiers) || isStatic(modifiers)); if (shouldWrap) { code.append(String.format( WRAPPER_METHOD_TEMPLATE, stringVisibility(modifiers), method.getReturnType().getCanonicalName(), method.getName(), methodSignature( method.getParameterTypes(), method.getParameterAnnotations()).toString(), targetType.getCanonicalName(), subjectType.getCanonicalName(), methodParameterList(method.getParameterTypes().length) )); } }
Source:
public int hashCode() { int result = origin != null ? origin.hashCode() : 0; result = 31 * result + (test != null ? test.hashCode() : 0); return result; }

Target:
public int hashCode() { int result = origin != null ? origin.hashCode() : 0; result = 31 * result + (test != null ? test.hashCode() : 0); result = 31 * result + (metricName != null ? metricName.hashCode() : 0); return result; }
Source:
public String toString() { StringBuilder sb = new StringBuilder("ColumnMetadata{"); sb.append("name='").append(name).append('\''); sb.append(", type=").append(type); if (comment != null) { sb.append(", comment='").append(comment).append('\''); } if (hidden) { sb.append(", hidden"); } sb.append('}'); return sb.toString(); }

Target:
public String toString() { return toStringHelper(this) .add("name", name) .add("type", type) .add("comment", comment) .add("isHidden", isHidden) .toString(); }
Source:
public void edit(final ImportTemplatesModel model) { templatesTable.edit( model.getExternalTemplatesModels(), model.getImportedTemplatesModels(), model.getAddImportCommand(), model.getCancelImportCommand()); driver.edit(model); model.getProblemDescription().getEntityChangedEvent().addListener((ev, object, args) -> updateErrorAndWarning(model)); updateErrorAndWarning(model); updatePanelsVisibility(model); model.getImportSources().getSelectedItemChangedEvent().addListener((ev, sender, args) -> updatePanelsVisibility(model)); loadVmsFromExportDomainButton.addClickHandler(event -> model.loadTemplatesFromExportDomain()); loadOvaButton.addClickHandler(event -> model.loadVmFromOva()); }

Target:
public void edit(final ImportTemplatesModel model) { driver.edit(model); templatesTable.edit( model.getExternalTemplatesModels(), model.getImportedTemplatesModels(), model.getAddImportCommand(), model.getCancelImportCommand()); model.getProblemDescription().getEntityChangedEvent().addListener((ev, object, args) -> updateErrorAndWarning(model)); updateErrorAndWarning(model); updatePanelsVisibility(model); model.getImportSources().getSelectedItemChangedEvent().addListener((ev, sender, args) -> updatePanelsVisibility(model)); loadVmsFromExportDomainButton.addClickHandler(event -> model.loadTemplatesFromExportDomain()); loadOvaButton.addClickHandler(event -> model.loadVmFromOva()); }
Source:
public static CompletableFuture<Process> onExit(@NotNull Process process) { return CompletableFuture.supplyAsync(() -> { try { Thread.sleep(15000); process.waitFor(); if (process.exitValue() != 0) { throw new IOException(toString(process.getErrorStream())); } return process; } catch (Throwable e) { throw new CompletionException(e); } }); }

Target:
public static CompletableFuture<Process> onExit(@NotNull Process process) { return CompletableFuture.supplyAsync(() -> { try { process.waitFor(); if (process.exitValue() != 0) { throw new IOException(toString(process.getErrorStream())); } return process; } catch (Throwable e) { throw new CompletionException(e); } }); }
Source:
private static boolean isFormatChange(AttributeChange input) { for (EAttribute attribute : NotationPackage.Literals.FONT_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } return false; }

Target:
private static boolean isFormatChange(AttributeChange input) { for (EAttribute attribute : NotationPackage.Literals.FONT_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } for (EAttribute attribute : NotationPackage.Literals.FILL_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } for (EAttribute attribute : NotationPackage.Literals.LINE_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } return false; }
Source:
public RestRule appToRest(Rule app, User user) { RestRule restRule = toRest.apply(app); if(restRule == null){ try{ APILocator.getRulesAPI().disableRule(app, user); } catch (DotDataException|DotSecurityException e){ Logger.error(this, "Error trying to disable Rule: " + app.getId(), e); } } return restRule; }

Target:
public RestRule appToRest(Rule app, User user) { try{ Map<String, RestConditionGroup> groups = new HashMap<>(); Map<String, Boolean> ruleActions = new HashMap<>(); for (ConditionGroup conditionGroup : app.getGroups()) { groups.put(conditionGroup.getId(), groupTransform.appToRest(conditionGroup)); } for (RuleAction ruleAction : app.getRuleActions()) { ruleActions.put(ruleAction.getId(), true); } return new RestRule.Builder() .key(app.getId()) .name(app.getName()) .fireOn(app.getFireOn().toString()) .shortCircuit(app.isShortCircuit()) .priority(app.getPriority()) .enabled(app.isEnabled()) .conditionGroups(groups) .ruleActions(ruleActions) .build(); } catch (Exception e) { try{ APILocator.getRulesAPI().disableRule(app, user); } catch (DotDataException|DotSecurityException dse){ Logger.error(this, "Error trying to disable Rule: " + app.getId(), dse); } throw new InternalServerException(e, "Could not create ReST Rule from Server, Rule id '%s'", app.getId()); } }
Source:
public void query() { StubMappingScope scope = indexManager.createScope(); SearchQuery<DocumentReference> genericQuery = scope.query() .predicate( f -> f.matchAll() ) .toQuery(); ElasticsearchSearchQuery<DocumentReference> query = genericQuery.extension( ElasticsearchExtension.get() ); ElasticsearchSearchResult<DocumentReference> result = query.fetchAll(); assertThat( result ).fromQuery( query ) .hasDocRefHitsAnyOrder( INDEX_NAME, FIRST_ID, SECOND_ID, THIRD_ID, FOURTH_ID, FIFTH_ID, EMPTY_ID ) .hasTotalHitCount( 6 ); Assertions.assertThat( result.getResponseBody() ) .isNotNull() .extracting( body -> body.get( "_shards" ) ).isInstanceOf( JsonObject.class ); SubTest.expectException( () -> query.extension( (SearchQuery<DocumentReference> original, LoadingContext<?, ?> loadingContext) -> Optional.empty() ) ) .assertThrown() .isInstanceOf( SearchException.class ); }

Target:
public void query() { StubMappingScope scope = indexManager.createScope(); SearchQuery<DocumentReference> genericQuery = scope.query() .predicate( f -> f.matchAll() ) .toQuery(); ElasticsearchSearchQuery<DocumentReference> query = genericQuery.extension( ElasticsearchExtension.get() ); ElasticsearchSearchResult<DocumentReference> result = query.fetchAll(); assertThat( result ).fromQuery( query ) .hasDocRefHitsAnyOrder( INDEX_NAME, FIRST_ID, SECOND_ID, THIRD_ID, FOURTH_ID, FIFTH_ID, EMPTY_ID ) .hasTotalHitCount( 6 ); SubTest.expectException( () -> query.extension( (SearchQuery<DocumentReference> original, LoadingContext<?, ?> loadingContext) -> Optional.empty() ) ) .assertThrown() .isInstanceOf( SearchException.class ); }
Source:
public AdminBlobStorageServiceFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, ClusterMap clusterMap) throws InstantiationException { if (verifiableProperties != null && metricRegistry != null && clusterMap != null) { adminConfig = new AdminConfig(verifiableProperties); adminMetrics = new AdminMetrics(metricRegistry); this.clusterMap = clusterMap; } else { logger .error("While trying to instantiate AdminBlobStorageServiceFactory: Some of the arguments received are null"); throw new InstantiationException("One of the received arguments is null"); } }

Target:
public AdminBlobStorageServiceFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, ClusterMap clusterMap) { if (verifiableProperties != null && metricRegistry != null && clusterMap != null) { adminConfig = new AdminConfig(verifiableProperties); adminMetrics = new AdminMetrics(metricRegistry); this.clusterMap = clusterMap; } else { StringBuilder errorMessage = new StringBuilder("Null arg(s) received during instantiation of AdminBlobStorageServiceFactory -"); if (verifiableProperties == null) { errorMessage.append(" [VerifiableProperties] "); } if (metricRegistry == null) { errorMessage.append(" [MetricRegistry] "); } if (clusterMap == null) { errorMessage.append(" [ClusterMap] "); } throw new IllegalArgumentException(errorMessage.toString()); } logger.trace("Instantiated AdminBlobStorageServiceFactory"); }