auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testBasicSendAndPoll() throws IOException { initialize(); List<RequestInfo> requestInfoList = new ArrayList<RequestInfo>(); List<ResponseInfo> responseInfoList; int requestCount; requestInfoList.add(new RequestInfo(host1, port1, new MockSend(1))); requestInfoList.add(new RequestInfo(host1, port1, new MockSend(2))); requestCount = requestInfoList.size(); do { responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); for (ResponseInfo responseInfo : responseInfoList) { MockSend send = (MockSend) responseInfo.getRequest(); NetworkClientErrorCode error = responseInfo.getError(); ByteBuffer response = responseInfo.getResponse(); Assert.assertNull("Should not have encountered an error", error); Assert.assertNotNull("Should receive a valid response", response); int correlationIdInRequest = send.getCorrelationId(); int correlationIdInResponse = response.getInt(); Assert.assertEquals("Received response for the wrong request", correlationIdInRequest, correlationIdInResponse); requestCount--; } } while (requestCount > 0); Assert.assertEquals("Should receive only as many responses as there were requests", 0, requestCount); responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); Assert.assertEquals("No responses are expected at this time", 0, responseInfoList.size()); }

Target:
public void testBasicSendAndPoll() throws IOException { List<RequestInfo> requestInfoList = new ArrayList<RequestInfo>(); List<ResponseInfo> responseInfoList; requestInfoList.add(new RequestInfo(host1, port1, new MockSend(1))); requestInfoList.add(new RequestInfo(host1, port1, new MockSend(2))); int requestCount = requestInfoList.size(); int responseCount = 0; do { responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); for (ResponseInfo responseInfo : responseInfoList) { MockSend send = (MockSend) responseInfo.getRequest(); NetworkClientErrorCode error = responseInfo.getError(); ByteBuffer response = responseInfo.getResponse(); Assert.assertNull("Should not have encountered an error", error); Assert.assertNotNull("Should receive a valid response", response); int correlationIdInRequest = send.getCorrelationId(); int correlationIdInResponse = response.getInt(); Assert.assertEquals("Received response for the wrong request", correlationIdInRequest, correlationIdInResponse); responseCount++; } } while (requestCount > responseCount); Assert.assertEquals("Should receive only as many responses as there were requests", requestCount, responseCount); responseInfoList = networkClient.sendAndPoll(requestInfoList); requestInfoList.clear(); Assert.assertEquals("No responses are expected at this time", 0, responseInfoList.size()); }
Source:
public void runCommand(KDebug session, CompiledDefinition compiledDefinition) { int activeStateId = session.getActiveStateId(); DebuggerState prevState = session.getStates().get(activeStateId); DebuggerState steppedState = session.step(activeStateId, stepCount); int effectiveStepCount = steppedState.getStepNum() - prevState.getStepNum(); if (effectiveStepCount < stepCount) { System.out.println("Attempted " + stepCount + " step(s). " + "Took " + effectiveStepCount + " steps(s)."); System.out.println("KDebug may have encountered a final configuration."); return; } System.out.println(stepCount + " Step(s) Taken."); }

Target:
public void runCommand(KDebug session, CompiledDefinition compiledDefinition) { int activeStateId = session.getActiveStateId(); DebuggerState prevState = session.getStates().get(activeStateId); DebuggerState steppedState = session.step(activeStateId, stepCount); int effectiveStepCount = steppedState.getStepNum() - prevState.getStepNum(); if (effectiveStepCount < stepCount) { System.out.println("Attempted " + stepCount + " step(s). " + "Took " + effectiveStepCount + " steps(s)."); System.out.println("Final State Reached"); return; } System.out.println(stepCount + " Step(s) Taken."); }
Source:
public void retryGetMediaError() throws Exception { fakeService.setGetMediaException( Status.fromCode(Status.Code.INTERNAL) .withDescription("Custom error message.") .asException()); GoogleCloudStorageGrpcReadChannel readChannel = newReadChannel(); ByteBuffer buffer = ByteBuffer.allocate(10); IOException thrown = assertThrows(IOException.class, () -> readChannel.read(buffer)); assertThat(thrown.getCause()).hasMessageThat().contains("Retrying failed to complete"); }

Target:
public void retryGetMediaError() throws Exception { fakeService.setGetMediaException( Status.fromCode(Status.Code.INTERNAL) .withDescription("Custom error message.") .asException()); GoogleCloudStorageGrpcReadChannel readChannel = newReadChannel(); ByteBuffer buffer = ByteBuffer.allocate(10); IOException thrown = assertThrows(IOException.class, () -> readChannel.read(buffer)); assertThat(thrown).hasCauseThat().hasMessageThat().contains("Retrying failed to complete"); }
Source:
public TextAnnotation next() { ArrayList<String> lines; try { lines = LineIO.read(currentfile); } catch (FileNotFoundException e1) { error = e1; e1.printStackTrace(); return null; } try { TextAnnotation ta = parseLines(lines); return ta; } catch (AnnotatorException e) { error = e; System.err.println("Skipping "+this.currentfile+", message : "+e.getLocalizedMessage()); return null; } }

Target:
public TextAnnotation next() { ArrayList<String> lines; try { lines = LineIO.read(currentfile); } catch (FileNotFoundException e1) { error = e1; e1.printStackTrace(); return null; } try { TextAnnotation ta = parseLines(lines); return ta; } catch (AnnotatorException e) { error = e; this.badFiles.add(this.currentfile); return null; } }
Source:
public boolean hasNoGroupBy(){ if (groupByList == null) return true; if (groupByList.size() != 1 || !(groupByList.elementAt(0) instanceof GroupByColumn)) return false; GroupByColumn groupByColumn = (GroupByColumn)groupByList.elementAt(0); if ( !(groupByColumn.getColumnExpression() instanceof NumericConstantNode)) return false; return true; }

Target:
public boolean hasNoGroupBy(){ if (groupByList == null || groupByList.isEmpty()) return true; if (groupByList.size() != 1 || !(groupByList.elementAt(0) instanceof GroupByColumn)) return false; GroupByColumn groupByColumn = (GroupByColumn)groupByList.elementAt(0); if ( !(groupByColumn.getColumnExpression() instanceof NumericConstantNode)) return false; return true; }
Source:
protected void insertIntoEntryTable(List<BibEntry> entries) { try { StringBuilder insertEntryQuery = new StringBuilder() .append("INSERT ALL"); for (BibEntry entry : entries) { insertEntryQuery.append(" INTO ") .append(escape("ENTRY")) .append(" (") .append(escape("TYPE")) .append(") VALUES (?)"); } insertEntryQuery.append(" SELECT * FROM DUAL"); LOGGER.info(insertEntryQuery.toString()); try (PreparedStatement preparedEntryStatement = connection.prepareStatement(insertEntryQuery.toString(), new String[]{"SHARED_ID"})) { for (int i = 0; i < entries.size(); i++) { preparedEntryStatement.setString(i + 1, entries.get(i).getType().getName()); } preparedEntryStatement.executeUpdate(); try (ResultSet generatedKeys = preparedEntryStatement.getGeneratedKeys()) { for (BibEntry entry : entries) { generatedKeys.next(); entry.getSharedBibEntryData().setSharedID(generatedKeys.getInt(1)); } if (generatedKeys.next()) { LOGGER.error("Error: Some shared IDs left unassigned"); } } } } catch (SQLException e) { LOGGER.error("SQL Error: ", e); } }

Target:
protected void insertIntoEntryTable(List<BibEntry> entries) { try { for (BibEntry entry : entries) { String insertIntoEntryQuery = "INSERT INTO " + escape("ENTRY") + "(" + escape("TYPE") + ") VALUES(?)"; try (PreparedStatement preparedEntryStatement = connection.prepareStatement(insertIntoEntryQuery, new String[]{"SHARED_ID"})) { preparedEntryStatement.setString(1, entry.getType().getName()); preparedEntryStatement.executeUpdate(); try (ResultSet generatedKeys = preparedEntryStatement.getGeneratedKeys()) { if (generatedKeys.next()) { entry.getSharedBibEntryData().setSharedID(generatedKeys.getInt(1)); } } } } } catch (SQLException e) { LOGGER.error("SQL Error: ", e); } }
Source:
public void testQueryType() { Assert.assertTrue(query.getVdcQueryType() != VdcQueryType.Unknown); }

Target:
public void testQueryType() throws IllegalArgumentException, IllegalAccessException { assertNotSame(VdcQueryType.Unknown, TestHelperQueriesCommandType.getQueryTypeFieldValue(query)); }
Source:
private void fetchVmsStatus(Guid storageDomainId, List<StorageOvfExtraData> storageExtraData, Map<String, Object> diskDescriptionMap) { Map<String, String> vmsStatus = (Map<String, String>) diskDescriptionMap.get(OvfInfoFileConstants.VmStatus); if (vmsStatus == null) { log.error("VMs status could not be fetched from metadata json file for storage id '{}'.", storageDomainId); } else { Iterator vmsStatusIter = vmsStatus.keySet().iterator(); while (vmsStatusIter.hasNext()) { String vmId = (String) vmsStatusIter.next(); log.debug("VM '{}' fetched from metadata json file with status '{}' for storage domain id '{}.", vmId, vmsStatus.get(vmId), storageDomainId); storageExtraData.add(new StorageOvfExtraData(storageDomainId, VdcObjectType.VM, storageDomainId, vmsStatus.get(vmId))); } } }

Target:
private void fetchVmsStatus(Guid storageDomainId, List<StorageOvfExtraData> storageExtraData, Map<String, Object> diskDescriptionMap) { Map<String, String> vmsStatus = (Map<String, String>) diskDescriptionMap.get(OvfInfoFileConstants.VmStatus); if (vmsStatus == null) { log.error("VMs status could not be fetched from metadata json file for storage id '{}'.", storageDomainId); } else { for (Map.Entry<String, String> entry : vmsStatus.entrySet()) { log.debug("VM '{}' fetched from metadata json file with status '{}' for storage domain id '{}.", entry.getKey(), entry.getValue(), storageDomainId); storageExtraData.add(new StorageOvfExtraData(storageDomainId, VdcObjectType.VM, storageDomainId, vmsStatus.get(entry.getKey()))); } } }
Source:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"apple", "appleay"}, {"ear", "earay"}, {"igloo", "iglooay"}, {"object", "objectay"}, {"under", "underay"}, {"equal", "equalay"}, {"pig", "igpay"}, {"koala", "oalakay"}, {"xenon", "enonxay"}, {"qat", "atqay"}, {"chair", "airchay"}, {"queen", "eenquay"}, {"square", "aresquay"}, {"therapy", "erapythay"}, {"thrush", "ushthray"}, {"school", "oolschay"}, {"yttria", "yttriaay"}, {"xray", "xrayay"}, {"yellow", "ellowyay"}, {"rhythm", "hythmray"}, {"my", "ymay"}, {"quick fast run", "ickquay astfay unray"} }); }

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"apple", "appleay"}, {"ear", "earay"}, {"igloo", "iglooay"}, {"object", "objectay"}, {"under", "underay"}, {"equal", "equalay"}, {"pig", "igpay"}, {"koala", "oalakay"}, {"xenon", "enonxay"}, {"qat", "atqay"}, {"chair", "airchay"}, {"queen", "eenquay"}, {"square", "aresquay"}, {"therapy", "erapythay"}, {"thrush", "ushthray"}, {"school", "oolschay"}, {"yttria", "yttriaay"}, {"xray", "xrayay"}, {"yellow", "ellowyay"}, {"rhythm", "ythmrhay"}, {"my", "ymay"}, {"quick fast run", "ickquay astfay unray"} }); }
Source:
private boolean parseTimeRange() { try { long startTimeValue = TIMESTAMP_FORMAT.parseValue(fStartTimeRangeText.getText()); long endTimeValue = TIMESTAMP_FORMAT.parseValue(fEndTimeRangeText.getText()); fStartTimestamp = TmfTimestamp.fromNanos(startTimeValue); fEndTimestamp = TmfTimestamp.fromNanos(endTimeValue); return true; } catch (ParseException e) { return false; } }

Target:
private boolean parseTimeRange() { try { TIMESTAMP_FORMAT.setTimeZone(TmfTimestampFormat.getDefaulTimeFormat().getTimeZone()); long startTimeValue = TIMESTAMP_FORMAT.parseValue(fStartTimeRangeText.getText()); long endTimeValue = TIMESTAMP_FORMAT.parseValue(fEndTimeRangeText.getText()); if(startTimeValue < endTimeValue) { fStartTimestamp = TmfTimestamp.fromNanos(startTimeValue); fEndTimestamp = TmfTimestamp.fromNanos(endTimeValue); } else { fStartTimestamp = TmfTimestamp.fromNanos(endTimeValue); fEndTimestamp = TmfTimestamp.fromNanos(startTimeValue); } return true; } catch (ParseException e) { return false; } }
Source:
NotesMigration(@GerritServerConfig Config cfg) { write = cfg.getBoolean("notedb", null, "write", false); readPatchSetApprovals = cfg.getBoolean("notedb", "patchSetApprovals", "read", false); }

Target:
NotesMigration(@GerritServerConfig Config cfg) { write = cfg.getBoolean("notedb", null, "write", false); readPatchSetApprovals = cfg.getBoolean("notedb", "patchSetApprovals", "read", false); checkArgument(!readPatchSetApprovals, "notedb.readPatchSetApprovals not yet supported"); }
Source:
public ParquetMetadataConverter() { this.useSignedStringMinMax = false; }

Target:
public ParquetMetadataConverter() { this(false); }
Source:
public ContinueUrlBuilder appendForceSameDeviceBit(@NonNull boolean forceSameDevice) { String bit = forceSameDevice ? "1" : "0"; addQueryParam(FORCE_SAME_DEVICE_IDENTIFIER, String.valueOf(bit)); return this; }

Target:
public ContinueUrlBuilder appendForceSameDeviceBit(@NonNull boolean forceSameDevice) { String bit = forceSameDevice ? "1" : "0"; addQueryParam(FORCE_SAME_DEVICE_IDENTIFIER, bit); return this; }
Source:
private void populateRibbonViews(final View view) { setText(view, R.id.ribbon_title, AwardStringMap.get(award.getRibbon().getRibbonAward().getUniqueName())); setAlpha(view, R.id.award_ribbon_container, award.getRibbon().isTaken() ? 1f : 0.5f); setImage(view, R.id.award_ribbon, RibbonImagesMap.get(award.getRibbonCode())); setText(view, R.id.ribbon_requirement, AwardStringMap.get(award.getRibbon().getRibbonAward().getDescriptionId())); setText(view, R.id.ribbons_count, String.format("x%d", award.getRibbon().getTimesTaken())); }

Target:
private void populateRibbonViews(final View view) { setText(view, R.id.ribbon_title, AwardStringMap.get(award.getRibbon().getRibbonAward().getUniqueName())); setImage(view, R.id.award_ribbon, RibbonImagesMap.get(award.getRibbonCode())); setAlpha(view, R.id.award_ribbon, award.getRibbon().isTaken() ? 1f : 0.5f); setText(view, R.id.ribbon_requirement, AwardStringMap.get(award.getRibbon().getRibbonAward().getDescriptionId())); setText(view, R.id.ribbons_count, String.format("x%d", award.getRibbon().getTimesTaken())); }
Source:
public void setI18n(Map<String, String> i18n) { this.i18n = i18n; }

Target:
void setI18n(Map<String, String> i18n) { this.i18n = i18n; }
Source:
public void getStyledTextForADeploymentConfigWithLongNames(){ IDeploymentConfig config = givenAResource(IDeploymentConfig.class, ResourceKind.DEPLOYMENT_CONFIG); Map<String, String> selector = new HashMap<String, String>(); selector.put("name", "foo01234567890123456789012345678901234567890123456789"); selector.put("deployment", "bar01234567890123456789012345678901234567890123456789"); when(config.getReplicaSelector()).thenReturn(selector ); assertEquals(config.getName() + " selector: deployment=bar01234567890123456789012345678901234567890123456789,name=foo01234567890123456789012345678...", provider.getStyledText(config).getString()); }

Target:
public void getStyledTextForADeploymentConfigWithLongNames(){ provider.setLabelLimit(120); IDeploymentConfig config = givenAResource(IDeploymentConfig.class, ResourceKind.DEPLOYMENT_CONFIG); Map<String, String> selector = new HashMap<>(); selector.put("name", "foo01234567890123456789012345678901234567890123456789"); selector.put("deployment", "bar01234567890123456789012345678901234567890123456789"); when(config.getReplicaSelector()).thenReturn(selector ); assertEquals("someName selector: deployment=bar0123456789012345678901234567890...=foo01234567890123456789012345678901234567890123456789", provider.getStyledText(config).getString()); }
Source:
public void testSourceStatusWithNonConfiguredService()throws Exception{ Source NonConfiguredServiceSource = mock(Source.class); when(helper.getSources()).thenReturn(CollectionUtils.asList(NonConfiguredServiceSource)); assertThat(poller.sourceStatus(CONFIG_PID), is(false)); }

Target:
public void testSourceStatusWithNonConfiguredService() throws Exception { Source nonConfiguredServiceSource = mock(Source.class); when(helper.getSources()).thenReturn(CollectionUtils.asList(nonConfiguredServiceSource)); assertThat(poller.sourceStatus(CONFIG_PID), is(0)); }
Source:
public Response labelsPost(LabelDTO body) { Label label = null; try { APIAdmin apiAdmin = new APIAdminImpl(); String tenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); label = LabelMappingUtil.labelDTOToLabel(body); LabelDTO labelDTO = LabelMappingUtil. fromLabelToLabelDTO(apiAdmin.addLabel(tenantDomain, label)); URI location = new URI(RestApiConstants.RESOURCE_PATH_LABEL + "/" + labelDTO.getId()); return Response.created(location).entity(labelDTO).build(); } catch (APIManagementException | URISyntaxException e) { String errorMessage = "Error while adding new Label for API : " + body.getName() + "-" + e.getMessage() ; RestApiUtil.handleInternalServerError(errorMessage, log); } return null; }

Target:
public Response labelsPost(LabelDTO body) { Label label = null; try { APIAdmin apiAdmin = new APIAdminImpl(); String tenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); label = LabelMappingUtil.labelDTOToLabel(body); LabelDTO labelDTO = LabelMappingUtil. fromLabelToLabelDTO(apiAdmin.addLabel(tenantDomain, label)); URI location = new URI(RestApiConstants.RESOURCE_PATH_LABEL + "/" + labelDTO.getId()); return Response.created(location).entity(labelDTO).build(); } catch (APIManagementException | URISyntaxException e) { String errorMessage = "Error while adding new a label to API : " + body.getName() + "-" + e.getMessage() ; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }
Source:
public static void waitTillInstancesAreCreated(ColoHelper coloHelper, String entity, int bundleSeqNo, int totalMinutesToWait ) throws JAXBException, OozieClientException { int sleep = totalMinutesToWait * 60 / 20; String entityName = Util.readEntityName(entity); ENTITY_TYPE type = Util.getEntityType(entity); String bundleID = getSequenceBundleID(coloHelper,entityName,type, bundleSeqNo); String coordID = getDefaultCoordIDFromBundle(coloHelper, bundleID); for (int sleepCount = 0; sleepCount < sleep; sleepCount++) { CoordinatorJob coordInfo = coloHelper.getProcessHelper().getOozieClient() .getCoordJobInfo(coordID); if(coordInfo.getActions().size() > 0) break; System.out.println("Coord "+ coordInfo.getId() + " still dosent have " + "instance created on oozie: " + coloHelper.getProcessHelper() .getOozieClient().getOozieUrl()); try { Thread.sleep(20000); } catch (InterruptedException e) { logger.error(e.getMessage()); } } }

Target:
public static void waitTillInstancesAreCreated(ColoHelper coloHelper, String entity, int bundleSeqNo, int totalMinutesToWait ) throws JAXBException, OozieClientException { int sleep = totalMinutesToWait * 60 / 20; String entityName = Util.readEntityName(entity); ENTITY_TYPE type = Util.getEntityType(entity); String bundleID = getSequenceBundleID(coloHelper,entityName,type, bundleSeqNo); String coordID = getDefaultCoordIDFromBundle(coloHelper, bundleID); for (int sleepCount = 0; sleepCount < sleep; sleepCount++) { CoordinatorJob coordInfo = coloHelper.getProcessHelper().getOozieClient() .getCoordJobInfo(coordID); if(coordInfo.getActions().size() > 0) break; logger.info("Coord "+ coordInfo.getId() + " still dosent have " + "instance created on oozie: " + coloHelper.getProcessHelper() .getOozieClient().getOozieUrl()); try { Thread.sleep(20000); } catch (InterruptedException e) { logger.error(e.getMessage()); } } }
Source:
public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) { OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId); try { proxy.testConnection(); updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active); } catch (VdcBLLException e) { AuditLogableBase loggable = new AuditLogableBase(); loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage()); new AuditLogDirector().log(loggable, AuditLogType.CINDER_PROVIDER_ERROR); throw e; } }

Target:
public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) { OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId); if (proxy == null) { log.error("Couldn't create an OpenStackVolumeProviderProxy for storage domain ID: {}", storageDomainId); return; } try { proxy.testConnection(); updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active); } catch (VdcBLLException e) { AuditLogableBase loggable = new AuditLogableBase(); loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage()); new AuditLogDirector().log(loggable, AuditLogType.CINDER_PROVIDER_ERROR); throw e; } }
Source:
private Pair<File, File> validateFiles(File npmFolder) throws ExecutionFailedException { assert port == 0; File webpack = new File(npmFolder, WEBPACK_SERVER); File webpackConfig = new File(npmFolder, FrontendUtils.WEBPACK_CONFIG); if (!npmFolder.exists()) { getLogger().warn("No project folder'{}' exists", npmFolder); throw new ExecutionFailedException( "Couldn't start dev server because " + "the target execution folder doesn't exist."); } if (!webpack.exists()) { getLogger().warn("'{}' doesn't exist. Did you run `npm install`?", webpack); throw new ExecutionFailedException( "Couldn't start dev server because " + "'{}' doesn't exist. `npm install` has not been executed most likely."); } else if (!webpack.canExecute()) { getLogger().warn( "'{}' is not an executable. Did you run `npm install`?", webpack); throw new ExecutionFailedException( "Couldn't start dev server because " + "'{}' is not an executable. `npm install` has not been executed most likely."); } if (!webpackConfig.canRead()) { getLogger().warn( "Webpack configuration '{}' is not found or is not readable.", webpackConfig); throw new ExecutionFailedException( "Couldn't start dev server because " + "'{}' doesn't exist or is not readable."); } return new Pair<>(webpack, webpackConfig); }

Target:
private Pair<File, File> validateFiles(File npmFolder) throws ExecutionFailedException { assert port == 0; File webpack = new File(npmFolder, WEBPACK_SERVER); File webpackConfig = new File(npmFolder, FrontendUtils.WEBPACK_CONFIG); if (!npmFolder.exists()) { getLogger().warn("No project folder '{}' exists", npmFolder); throw new ExecutionFailedException( "Couldn't start dev server because " + "the target execution folder doesn't exist."); } if (!webpack.exists()) { getLogger().warn("'{}' doesn't exist. Did you run `npm install`?", webpack); throw new ExecutionFailedException(String.format( "Couldn't start dev server because " + "'%s' doesn't exist. `npm install` has not been executed most likely.", webpack)); } else if (!webpack.canExecute()) { getLogger().warn( "'{}' is not an executable. Did you run `npm install`?", webpack); throw new ExecutionFailedException(String.format( "Couldn't start dev server because " + "'%s' is not an executable. `npm install` has not been executed most likely.", webpack)); } if (!webpackConfig.canRead()) { getLogger().warn( "Webpack configuration '{}' is not found or is not readable.", webpackConfig); throw new ExecutionFailedException(String.format( "Couldn't start dev server because " + "'%s' doesn't exist or is not readable.", webpackConfig)); } return new Pair<>(webpack, webpackConfig); }
Source:
public PermissionBlueprint populate(ModelTranslator modelTranslator, PermissionBlueprintDTO source, PermissionBlueprint destination) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (destination == null) { throw new IllegalArgumentException("destination is null"); } destination.setId(source.getId()); destination.setType(source.getType() == null ? null : PermissionFactory.PermissionType.valueOf(source.getType())); destination.setAccess(source.getAccess() == null ? null : Access.valueOf(source.getAccess())); if (modelTranslator != null) { destination.setOwner(modelTranslator.translate(source.getOwner(), Owner.class)); } else { destination.setOwner(null); } return destination; }

Target:
public PermissionBlueprint populate(ModelTranslator modelTranslator, PermissionBlueprintDTO source, PermissionBlueprint destination) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (destination == null) { throw new IllegalArgumentException("destination is null"); } destination.setCreated(source.getCreated() != null ? new Date(source.getCreated().toInstant().toEpochMilli()) : null); destination.setUpdated(source.getUpdated() != null ? new Date(source.getUpdated().toInstant().toEpochMilli()) : null); destination.setId(source.getId()); destination.setType(source.getType() == null ? null : PermissionFactory.PermissionType.valueOf(source.getType())); destination.setAccess(source.getAccess() == null ? null : Access.valueOf(source.getAccess())); if (modelTranslator != null) { destination.setOwner(modelTranslator.translate(source.getOwner(), Owner.class)); } else { destination.setOwner(null); } return destination; }
Source:
public void testShowNoCustomItemsMessageWhenThereIsNoCustomItem() { view.setupListItems(new ArrayList<>()); verify(listItemsNo.classList).remove(HIDDEN_CSS_CLASS); }

Target:
public void testShowNoCustomItemsMessageWhenThereIsNoCustomItem() { view.setupListItems(new ArrayList<>()); verify(listItemsNo.classList).remove(HIDDEN_CSS_CLASS); verify(listItems.classList).add(HIDDEN_CSS_CLASS); }
Source:
private void scheduleSessionFlushes() { sessionExecutorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { Thread nonDeamonThread = new Thread(new Runnable() { @Override public void run() { sessionTracker.flushSessions(new Date()); } }); nonDeamonThread.setDaemon(false); nonDeamonThread.start(); } }, SESSION_TRACKING_PERIOD_MS, SESSION_TRACKING_PERIOD_MS, TimeUnit.MILLISECONDS); }

Target:
private void scheduleSessionFlushes() { sessionExecutorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { sessionFlusherService.submit(new Runnable() { @Override public void run() { sessionTracker.flushSessions(new Date()); } }); } }, SESSION_TRACKING_PERIOD_MS, SESSION_TRACKING_PERIOD_MS, TimeUnit.MILLISECONDS); }
Source:
public void update(CruiseConfig preprocessedConfig) throws Exception { EnvironmentsConfig environments = preprocessedConfig.getEnvironments(); EnvironmentConfig oldEnvironmentConfig = preprocessedConfig.getEnvironments().find(new CaseInsensitiveString(oldEnvironmentName)); int index = environments.indexOf(oldEnvironmentConfig); environments.remove(index); environments.add(index, newEnvironmentConfig); }

Target:
public void update(CruiseConfig preprocessedConfig) throws Exception { EnvironmentsConfig environments = preprocessedConfig.getEnvironments(); EnvironmentConfig oldEnvironmentConfig = preprocessedConfig.getEnvironments().find(oldEnvironmentName); environments.replace(oldEnvironmentConfig, newEnvironmentConfig); }
Source:
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody @Valid Loan loan) { Loan oldLoan = loanDao.findOne(id); if (oldLoan == null) { throw new NotFoundException("Loan not found"); } loan.setId(id); loanDao.saveAndFlush(loan); return new ResponseEntity<>("Loan updated", HttpStatus.NO_CONTENT); }

Target:
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody @Valid Loan loan) { Loan oldLoan = loanDao.findOne(id); if (oldLoan == null) { throw new NotFoundException("Loan not found"); } AppUser appUser = userUtil.extractLoggedAppUserFromDatabase(); if(appUser.getUserId() != oldLoan.getUser().getUserId()){ throw new BadRequestException("Bad request"); } if(loan.getCounterparty().getId() == 0){ counterpartyDao.saveAndFlush(loan.getCounterparty()); } loan.setUser(appUser); loan.setId(id); loanDao.saveAndFlush(loan); return new ResponseEntity<>("Loan updated", HttpStatus.NO_CONTENT); }
Source:
private void loadTrace() { synchronized (fEntryListMap) { fEntryList = fEntryListMap.get(fTrace); if (fEntryList == null) { fStartTime = Long.MAX_VALUE; fEndTime = Long.MIN_VALUE; refresh(); synchronized (fBuildThreadMap) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) { trace = checkNotNull(trace); BuildThread buildThread = new BuildThread(trace, fTrace); fBuildThreadMap.put(trace, buildThread); buildThread.start(); } } } else { fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); refresh(); } } }

Target:
private void loadTrace() { synchronized (fEntryListMap) { fEntryList = fEntryListMap.get(fTrace); if (fEntryList == null) { fStartTime = SWT.DEFAULT; fEndTime = SWT.DEFAULT; refresh(); synchronized (fBuildThreadMap) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) { trace = checkNotNull(trace); BuildThread buildThread = new BuildThread(trace, fTrace); fBuildThreadMap.put(trace, buildThread); buildThread.start(); } } } else { fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); refresh(); } } }
Source:
void shouldReturnEmptyDisplayNameString() { final Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); String actualDisplayName = statistics.getDisplayName(""); assertThat(actualDisplayName).isEmpty(); }

Target:
void shouldReturnEmptyDisplayNameString() { Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); String actualDisplayName = statistics.getDisplayName(""); assertThat(actualDisplayName).isEmpty(); }
Source:
public Properties getJdbcProperties() throws Exception { String user = userPassword.userId.getStringValue(); String password = userPassword.password.getStringValue(); String loginTimeout = String.valueOf(this.loginTimeout.getValue()); Properties properties = new Properties(); if (user != null) { properties.put("user", user); } if (AuthenticationType.BASIC == authenticationType.getValue()) { if (password != null) { properties.put("password", password); } } else { if (keyAlias.getValue() != null) { properties.put("privateKey", getPrivateKey()); } } if (loginTimeout != null) { properties.put("loginTimeout", String.valueOf(this.loginTimeout.getValue())); } return properties; }

Target:
public Properties getJdbcProperties() throws IOException { String user = userPassword.userId.getStringValue(); String password = userPassword.password.getStringValue(); String loginTimeout = String.valueOf(this.loginTimeout.getValue()); Properties properties = new Properties(); if (user != null) { properties.put("user", user); } if (AuthenticationType.BASIC == authenticationType.getValue()) { ofNullable(password).ifPresent(p -> properties.put("password", p)); } else if (keyAlias.getValue() != null) { properties.put("privateKey", getPrivateKey()); } if (loginTimeout != null) { properties.put("loginTimeout", loginTimeout); } return properties; }
Source:
public String toString() { return String.format("{map[%s] : key field = %s, value field = %s}", mapName, keyName, valueName); }

Target:
public String toString() { return "KeyValueMap{" + "mapName='" + mapName + '\'' + ", keyColumn='" + keyColumn + '\'' + ", valueColumn='" + valueColumn + '\'' + '}'; }
Source:
public void run() { if (!running) { return; } try { TaskQueue queue = new TaskQueue(); queue.thenRun(1, () -> setPistonState(pistons[0], true)); queue.thenRun(3, () -> setPistonState(pistons[0], false)); queue.thenRun(1, () -> setPistonState(pistons[1], true)); queue.thenRun(3, () -> setPistonState(pistons[1], false)); queue.thenRun(() -> { Block furnace = chest.getRelative(BlockFace.DOWN); furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, Material.STONE); for (int y = height; y > 0; y--) { Block b = start.getWorld().getBlockAt(x, y, z); if (!SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(owner), b, ProtectableAction.BREAK_BLOCK)) { stop("machines.INDUSTRIAL_MINER.no-permission"); return; } if (miner.canMine(b.getType()) && push(miner.getOutcome(b.getType()))) { furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, b.getType()); furnace.getWorld().playSound(furnace.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.2F, 1F); b.setType(Material.AIR); fuel--; ores++; Slimefun.runSync(this, 4); return; } } nextColumn(); }); queue.execute(SlimefunPlugin.instance); } catch (Exception e) { Slimefun.getLogger().log(Level.SEVERE, "An Error occured while running an Industrial Miner", e); stop(); } }

Target:
public void run() { if (!running) { return; } TaskQueue queue = new TaskQueue(); queue.thenRun(1, () -> setPistonState(pistons[0], true)); queue.thenRun(3, () -> setPistonState(pistons[0], false)); queue.thenRun(1, () -> setPistonState(pistons[1], true)); queue.thenRun(3, () -> setPistonState(pistons[1], false)); queue.thenRun(() -> { try { Block furnace = chest.getRelative(BlockFace.DOWN); furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, Material.STONE); for (int y = height; y > 0; y--) { Block b = start.getWorld().getBlockAt(x, y, z); if (!SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(owner), b, ProtectableAction.BREAK_BLOCK)) { stop("machines.INDUSTRIAL_MINER.no-permission"); return; } if (miner.canMine(b.getType()) && push(miner.getOutcome(b.getType()))) { furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, b.getType()); furnace.getWorld().playSound(furnace.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.2F, 1F); b.setType(Material.AIR); fuel--; ores++; Slimefun.runSync(this, 4); return; } } nextColumn(); } catch (Exception e) { Slimefun.getLogger().log(Level.SEVERE, e, () -> "An Error occured while running an Industrial Miner at " + new BlockPosition(chest)); stop(); } }); queue.execute(SlimefunPlugin.instance); }
Source:
protected abstract ActionResult execute() throws EntityDoesNotExistException; public String getLogMessage() { UserType currUser = gateKeeper.getCurrentUser(); String url = HttpRequestHelper.getRequestedUrl(request); Map<String, String[]> params = HttpRequestHelper.getParameterMap(request); return new LogMessageGenerator().generatePageActionLogMessage(url, params, currUser, account, student, statusToAdmin); }

Target:
protected abstract ActionResult execute() throws EntityDoesNotExistException; public String getLogMessage() { UserType currUser = gateKeeper.getCurrentUser(); return new LogMessageGenerator().generatePageActionLogMessage(requestUrl, requestParameters, currUser, account, student, statusToAdmin); }
Source:
private Map<String, Set<String>> getPolicy(ShareableMetacardImpl shareableMetacard) { return Stream.of( getSharingSecurityTag(), getOwnerPermission(shareableMetacard), getGroupPermission(shareableMetacard), getIndividualPermission(shareableMetacard)) .map(Map::entrySet) .flatMap(Collection::stream) .filter(entry -> !entry.getValue().isEmpty()) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, Sets::union)); }

Target:
private Map<String, Set<String>> getPolicy(ShareableMetacardImpl shareableMetacard) { return Stream.of( getShareablePermissions(), getOwnerPermission(shareableMetacard), getGroupPermission(shareableMetacard), getIndividualPermission(shareableMetacard)) .map(Map::entrySet) .flatMap(Collection::stream) .filter(entry -> !entry.getValue().isEmpty()) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, Sets::union)); }
Source:
public void encode(ActiveMQBuffer buffer) { buffer.writeLong(queueID); buffer.writeLong(pageID); buffer.writeLong(persistentSize); }

Target:
public void encode(ActiveMQBuffer buffer) { buffer.writeLong(queueID); buffer.writeLong(pageID); }
Source:
public void testPreHandle_zero() throws Exception { testTarget.setApplicationContext(new StaticApplicationContext()); testTarget.afterPropertiesSet(); boolean expectedReturnValue = testTarget.preHandle(mockRequest, mockResponse, null); assertThat(mockRequest.getAttributeNames().hasMoreElements(), is(false)); assertThat(expectedReturnValue, is(true)); }

Target:
public void testPreHandle_zero() throws Exception { testTarget.setApplicationContext(new StaticApplicationContext()); testTarget.afterPropertiesSet(); boolean actualReturnValue = testTarget.preHandle(mockRequest, mockResponse, null); assertThat(mockRequest.getAttributeNames().hasMoreElements(), is(false)); assertThat(actualReturnValue, is(true)); }
Source:
public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider, Item[] items, int topIndex, int nameSpace, GC gc) { int bottomIndex = Integer.min(topIndex + countPerPage() + 1, items.length); for (int i = topIndex; i < bottomIndex; i++) { Item item = items[i]; drawItem(item, bounds, timeProvider, i, nameSpace, gc); } TraceCompassLogUtils.traceCounter(LOGGER, Level.FINER, fDrawItemsCountLabel, bottomIndex - topIndex); for (DeferredEntry entry : fPostDrawEntries) { entry.draw(fTimeGraphProvider, gc); } for (DeferredLine line : fLines) { line.draw(gc); } for(DeferredSegment seg: fPoints) { seg.draw(gc); } Color prev = gc.getForeground(); gc.setForeground(fBlack); int prevAA = gc.getAntialias(); gc.setAntialias(SWT.OFF); int prevLineWidth = gc.getLineWidth(); gc.setLineWidth(1); for (DeferredSegment seg : fPoints) { seg.draw(gc); } gc.setLineWidth(prevLineWidth); gc.setAntialias(prevAA); for (Rectangle rectangle : fSelectedRectangles) { int arc = Math.min(rectangle.height + 1, rectangle.width) / 2; gc.drawRoundRectangle(rectangle.x - 1, rectangle.y - 1, rectangle.width, rectangle.height + 1, arc, arc); } gc.setForeground(prev); }

Target:
public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider, Item[] items, int topIndex, int nameSpace, GC gc) { int bottomIndex = Integer.min(topIndex + countPerPage() + 1, items.length); for (int i = topIndex; i < bottomIndex; i++) { Item item = items[i]; drawItem(item, bounds, timeProvider, i, nameSpace, gc); } TraceCompassLogUtils.traceCounter(LOGGER, Level.FINER, fDrawItemsCountLabel, bottomIndex - topIndex); for (DeferredEntry entry : fPostDrawEntries) { entry.draw(fTimeGraphProvider, gc); } for (DeferredLine line : fLines) { line.draw(gc); } Color prev = gc.getForeground(); gc.setForeground(fBlack); int prevAA = gc.getAntialias(); gc.setAntialias(SWT.OFF); int prevLineWidth = gc.getLineWidth(); gc.setLineWidth(1); for (DeferredSegment seg : fPoints) { seg.draw(gc); } gc.setLineWidth(prevLineWidth); gc.setAntialias(prevAA); for (Rectangle rectangle : fSelectedRectangles) { int arc = Math.min(rectangle.height + 1, rectangle.width) / 2; gc.drawRoundRectangle(rectangle.x - 1, rectangle.y - 1, rectangle.width, rectangle.height + 1, arc, arc); } gc.setForeground(prev); }
Source:
public LdapFindUserByUidCommand(LdapContext ldapContext, String ldapSearchBase, String uid) { super(HystrixCommand.Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(GROUPKEY)). andCommandKey(HystrixCommandKey.Factory.asKey(GROUPKEY + ":" + LdapFindUserByUidCommand.class.getSimpleName()))); if(Strings.isNullOrEmpty(uid)) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "uid")); } else if(Strings.isNullOrEmpty(ldapSearchBase)) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "ldapSearchBase")); } else if(ldapContext == null) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "ldapContext")); } this.cacheKey = new LDAPCacheKey(uid, ldapContext, ldapSearchBase, "(uid=" + uid + ")"); }

Target:
public LdapFindUserByUidCommand(LdapContext ldapContext, String ldapSearchBase, String uid) { super(HystrixCommand.Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(GROUPKEY)). andCommandKey(HystrixCommandKey.Factory.asKey(GROUPKEY + ":" + LdapFindUserByUidCommand.class.getSimpleName()))); if (Strings.isNullOrEmpty(uid)) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "uid")); } else if (Strings.isNullOrEmpty(ldapSearchBase)) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "ldapSearchBase")); } else if (ldapContext == null) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "ldapContext")); } this.cacheKey = new LDAPCacheKey(uid, ldapContext, ldapSearchBase, "(uid=" + uid + ")", SearchControls.SUBTREE_SCOPE); }
Source:
protected void executeCommand() { GlusterVolumeSnapshotSchedule fetchedSchedule = getGlusterVolumeSnapshotScheduleDao().getByVolumeId(volumeId); String jobId = fetchedSchedule.getJobId(); SchedulerUtil scheduler = SchedulerUtilQuartzDBImpl.getInstance(); scheduler.deleteJob(jobId); String cronExpression = GlusterUtil.getInstance().getCronExpression(schedule); String newJobId = scheduler.scheduleACronJob(GlusterSnapshotScheduleJob.class, "onTimer", new Class[] { Guid.class, Guid.class, String.class, String.class, Boolean.class }, new Object[] { upServer.getId(), volumeId, schedule.getSnapshotNamePrefix(), schedule.getSnapshotDescription(), force }, cronExpression); schedule.setJobId(newJobId); getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, schedule); }

Target:
protected void executeCommand() { GlusterVolumeSnapshotSchedule fetchedSchedule = getGlusterVolumeSnapshotScheduleDao().getByVolumeId(volumeId); String jobId = fetchedSchedule.getJobId(); SchedulerUtil scheduler = DBSchedulerUtilQuartzImpl.getInstance(); scheduler.deleteJob(jobId); String cronExpression = GlusterUtil.getInstance().getCronExpression(schedule); String newJobId = scheduler.scheduleACronJob(new GlusterSnapshotScheduleJob(), "onTimer", new Class[] { String.class, String.class, String.class, String.class, Boolean.class }, new Object[] { upServer.getId().toString(), volumeId.toString(), schedule.getSnapshotNamePrefix(), schedule.getSnapshotDescription(), force }, cronExpression); if (newJobId != null) { setSucceeded(true); schedule.setJobId(newJobId); getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, schedule); } }
Source:
public void putPreferences(IEclipsePreferences preferences, ColorThemeSetting setting) { String value = setting.getColor().asHex() + " | " + defaultBackground.getHexColor() + " | " + setting.isBoldEnabled() + " | " + setting.isItalicEnabled() + " | " + setting.isStrikethroughEnabled() + " | " + setting.isUnderlineEnabled(); preferences.put(pluginKey, value); }

Target:
public void putPreferences(IEclipsePreferences preferences, ColorThemeSetting setting) { String value = setting.getColor().asHex() + " | " + defaultBackground.getHexColorOrNull() + " | " + setting.isBoldEnabled() + " | " + setting.isItalicEnabled() + " | " + setting.isStrikethroughEnabled() + " | " + setting.isUnderlineEnabled(); preferences.put(pluginKey, value); }
Source:
private void bind() { bindingContext = new DataBindingContext(); this.scriptGeneratorTable.addPropertyChangeListener("actions", e -> DISPLAY.asyncExec(() -> { this.table.setRows(this.scriptGeneratorTable.getActions()); })); }

Target:
private void bind() { this.scriptGeneratorTable.addPropertyChangeListener("actions", e -> DISPLAY.asyncExec(() -> { this.table.setRows(this.scriptGeneratorTable.getActions()); })); }
Source:
private void checkObjectAccessible(Node node, QualifiedObjectName objectName) { if (!isCatalogAccessible(objectName.getCatalogName())) { throw new SemanticException(MISSING_SCHEMA, node, "Catalog '%s' does not exist", objectName.getCatalogName()); } if (!isSchemaAccessible(objectName.asCatalogSchemaName())) { throw new SemanticException(MISSING_SCHEMA, node, "Schema '%s' does not exist", objectName.getSchemaName()); } if (!isViewAccessible(objectName) && !isTableAccessible(objectName)) { throw new SemanticException(MISSING_TABLE, node, "Table '%s' does not exist", objectName); } }

Target:
private void checkObjectAccessible(Node node, QualifiedObjectName objectName) { if (!isCatalogAccessible(objectName.getCatalogName())) { throw new SemanticException(MISSING_SCHEMA, node, "Catalog '%s' does not exist", objectName.getCatalogName()); } if (!isSchemaAccessible(objectName.getCatalogSchemaName())) { throw new SemanticException(MISSING_SCHEMA, node, "Schema '%s' does not exist", objectName.getSchemaName()); } if (!isRelationAccessible(objectName)) { throw new SemanticException(MISSING_TABLE, node, "Table '%s' does not exist", objectName); } }
Source:
public void methodNameTest() throws Exception { Description description = Description.createTestDescription("some-class-name", methodName); assertNotNull("Method name should be not null", description.getMethodName()); assertEquals(description.getMethodName(), methodName); }

Target:
public void methodNameTest() throws Exception { Description description = Description.createTestDescription("some-class-name", methodName); assertNotNull("Method name should be not null", description.getMethodName()); assertEquals(methodName, description.getMethodName()); }
Source:
public static String writeSingleClientConfigAvro(Properties props) { String avroConfig = new String(); Boolean firstProp = true; for(String key: props.stringPropertyNames()) { if(firstProp) { firstProp = false; } else { avroConfig = avroConfig + ",\n"; } avroConfig = avroConfig + "\t\t\"" + key + "\": \"" + props.getProperty(key) + "\""; } if(avroConfig.isEmpty()) { return "{}"; } else { return "{\n" + avroConfig + "\n\t}"; } }

Target:
public static String writeSingleClientConfigAvro(Properties props) { String avroConfig = ""; Boolean firstProp = true; for(String key: props.stringPropertyNames()) { if(firstProp) { firstProp = false; } else { avroConfig = avroConfig + ",\n"; } avroConfig = avroConfig + "\t\t\"" + key + "\": \"" + props.getProperty(key) + "\""; } if(avroConfig.isEmpty()) { return "{}"; } else { return "{\n" + avroConfig + "\n\t}"; } }