auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setImage(@Nullable SystemImageDescription image) { myImageDescription = image; myHaxmAlert.setSystemImageDescription(image); ((CardLayout)myRootPanel.getLayout()).show(myRootPanel, NO_IMAGE_CONTENT); if (image != null) { ((CardLayout)myRootPanel.getLayout()).show(myRootPanel, MAIN_CONTENT); int apiLevel = image.getVersion().getApiLevel(); myApiLevelListener.setApiLevel(apiLevel); String codeName = getCodeName(myImageDescription); if (codeName != null) { myReleaseName.setText(codeName); } Icon icon = getIcon(codeName); if (icon != null) { myReleaseIcon.setIcon(icon); } myApiLevel.setText(image.getVersion().getApiString()); myAndroidVersion.setVisible(!image.getVersion().isPreview()); myAndroidVersion.setText(SdkVersionInfo.getVersionString(apiLevel)); String vendorName; IdDisplay tag = myImageDescription.getTag() == null ? SystemImage.DEFAULT_TAG : myImageDescription.getTag(); if (tag.getId().equals("android-wear") || tag.getId().equals("android-tv")) { vendorName = "Android"; } else { vendorName = myImageDescription.getVendor(); } myVendor.setText("<html>" + vendorName + "</html>"); myAbi.setText(myImageDescription.getAbiType()); } }

Target:
public void setImage(@Nullable SystemImageDescription image) { myImageDescription = image; myHaxmAlert.setSystemImageDescription(image); ((CardLayout)myRootPanel.getLayout()).show(myRootPanel, NO_IMAGE_CONTENT); if (image != null) { ((CardLayout)myRootPanel.getLayout()).show(myRootPanel, MAIN_CONTENT); int apiLevel = image.getVersion().getApiLevel(); myApiLevelListener.setApiLevel(apiLevel); String codeName = getCodeName(myImageDescription); if (codeName != null) { myReleaseName.setText(codeName); } Icon icon = getIcon(codeName); if (icon != null) { myReleaseIcon.setIcon(icon); } myApiLevel.setText(image.getVersion().getApiString()); myAndroidVersion.setVisible(!image.getVersion().isPreview()); myAndroidVersion.setText(SdkVersionInfo.getVersionString(apiLevel)); String vendorName; IdDisplay tag = myImageDescription.getTag(); if (tag.getId().equals("android-wear") || tag.getId().equals("android-tv")) { vendorName = "Android"; } else { vendorName = myImageDescription.getVendor(); } myVendor.setText("<html>" + vendorName + "</html>"); myAbi.setText(myImageDescription.getAbiType()); } }
Source:
public Feed getFeedForManuallyUploadedData(String feedName, boolean isGoldStandard) { initialiseProvenanceFeeds(); String provenanceName = isGoldStandard ? ProvenanceNames.MANUAL_GOLD_STANDARD : ProvenanceNames.MANUAL; Feed feed = getExistingFeed(provenanceName, feedName); if (feed == null) { feed = addNewFeed(provenanceName, feedName); } return feed; }

Target:
public Feed getFeedForManuallyUploadedData(String feedName, boolean isGoldStandard) { initialiseProvenanceFeedsMap(); String provenanceName = isGoldStandard ? ProvenanceNames.MANUAL_GOLD_STANDARD : ProvenanceNames.MANUAL; Feed feed = getExistingFeed(provenanceName, feedName); if (feed == null) { feed = addNewFeed(provenanceName, feedName); } return feed; }
Source:
V addIfNotExists(K key, String name) { List<V> list = getDataMap().get(key); if (list == null) { list = new ArrayList<>(); } for (V data : list) { if (getDataName(data).equals(name)) { return data; } } V addedData = newInstance(name); list.add(addedData); getDataMap().put(key, list); return addedData; }

Target:
V addIfNotExists(K key, String name) { List<V> list = getOrCreate(key); V data = find(key, name); if (data != null) { return data; } V addedData = newInstance(name); list.add(addedData); getDataMap().put(key, list); return addedData; }
Source:
static void registerTransformers_1_3_0(ResourceTransformationDescriptionBuilder parentBuilder) { ResourceTransformationDescriptionBuilder builder = parentBuilder.addChildResource(PATH_AUDIT); MappingProviderModuleDefinition.registerTransformers_1_3_0(builder); }

Target:
static void registerTransformers_1_3_0(ResourceTransformationDescriptionBuilder parentBuilder) { ResourceTransformationDescriptionBuilder builder = parentBuilder.addChildResource(SecurityExtension.PATH_AUDIT_CLASSIC); MappingProviderModuleDefinition.registerTransformers_1_3_0(builder); }
Source:
public void withoutInitialTokenShouldCallFresherOnlyOnceWhileRefreshingIsInProgress() throws InterruptedException, ExecutionException, IOException { longRunningRefresher.resetCallCount(); CommunicationTokenCredential userCredential = new CommunicationTokenCredential(longRunningRefresher); userCredential.getToken(); assertEquals(1, longRunningRefresher.numCalls()); for (int i = 0; i < 3; i++) { userCredential.getToken(); assertEquals(1, longRunningRefresher.numCalls(), "No additional calls made by getToken call"); } userCredential.close(); }

Target:
public void withoutInitialTokenShouldCallFresherOnlyOnceWhileRefreshingIsInProgress() throws InterruptedException, ExecutionException, IOException { longRunningRefresher.resetCallCount(); CommunicationTokenCredential tokenCredential = new CommunicationTokenCredential(longRunningRefresher); tokenCredential.getToken(); assertEquals(1, longRunningRefresher.numCalls()); for (int i = 0; i < 3; i++) { tokenCredential.getToken(); assertEquals(1, longRunningRefresher.numCalls(), "No additional calls made by getToken call"); } tokenCredential.close(); }
Source:
public void initGui() { acrossX = this.width * 6 / 8 - 2 * tileSize; acrossY = this.height * 6 / 8 - 2 * tileSize; leftX = this.width * 1 / 8; topY = this.height * 1 / 8; rightX = this.width * 7 / 8 - tileSize; bottomY = (topY + tileSize) + (acrossY); sliderTopY = topY + borderSize; sliderBotY = bottomY + borderSize - sliderHeight; maxLength = acrossX + 3 / 2 * borderSize - sliderWidth; textX = leftX + 24; textY = topY + 24; maxLines = (acrossY + borderSize) / 10; book = mc.player.inventory.getStackInSlot(itemSlot); if (book.hasTagCompound()) { System.out.println("Book has nbt"); NBTTagCompound nbtTagCompound = book.getTagCompound(); this.page = nbtTagCompound.getInteger("page"); this.sliderProgress = nbtTagCompound.getFloat("sliderProgress"); } else { System.out.println("Book doesn't have NBT"); this.page = 1; this.sliderProgress = 0.0F; } this.buttonList.clear(); this.nextPageBtn = this.addButton(new GuiButton(0, this.width / 2 + 100, this.height - 30, 20, 20, ">")); this.prevPageBtn = this.addButton(new GuiButton(1, this.width / 2 - 120, this.height - 30, 20, 20, "<")); this.slider = this.addButton(new GuiButton(2, rightX + borderSize - sliderHeight, sliderTopY + (int) ((sliderBotY - sliderTopY) * sliderProgress), sliderWidth, sliderHeight, "|||")); splitLines(); }

Target:
public void initGui() { acrossX = this.width * 6 / 8 - 2 * tileSize; acrossY = this.height * 6 / 8 - 2 * tileSize; leftX = this.width * 1 / 8; topY = this.height * 1 / 8; rightX = (leftX + tileSize) + (acrossX); bottomY = (topY + tileSize) + (acrossY); sliderTopY = topY + borderSize; sliderBotY = bottomY + borderSize - sliderHeight; maxLength = acrossX + 3 / 2 * borderSize - sliderWidth; textX = leftX + 24; textY = topY + 24; maxLines = (acrossY + borderSize) / 10; if (hand == EnumHand.MAIN_HAND) book = mc.player.getHeldItemMainhand(); else book = mc.player.getHeldItemOffhand(); if (book.hasTagCompound()) { NBTTagCompound nbtTagCompound = book.getTagCompound(); this.page = nbtTagCompound.getInteger("page"); this.sliderProgress = nbtTagCompound.getFloat("sliderProgress"); } else { this.page = 1; this.sliderProgress = 0.0F; } this.buttonList.clear(); this.nextPageBtn = this.addButton(new GuiButton(0, this.width / 2 + 100, this.height - 30, 20, 20, ">")); this.nextPageBtn.enabled = page != pageMax; this.prevPageBtn = this.addButton(new GuiButton(1, this.width / 2 - 120, this.height - 30, 20, 20, "<")); this.prevPageBtn.enabled = page != 1; this.slider = this.addButton(new GuiButton(2, rightX + borderSize - sliderHeight, sliderTopY + (int) ((sliderBotY - sliderTopY) * sliderProgress), sliderWidth, sliderHeight, "|||")); text = splitLines(StringUtils.translate("book.quickstart." + page), fontRenderer, maxLength); }
Source:
public Optional<World> getLoadedWorld() { return Optional.ofNullable((World) world); }

Target:
public Optional<World> getLoadedWorld() { return Optional.ofNullable((World) this.world); }
Source:
protected Map<String, Pair<String, String>> getExclusiveLocks() { if (!isInternalExecution()) { return Collections.singletonMap(getGeoRepSession().getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.GLUSTER_GEOREP, VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_LOCKED)); } return super.getExclusiveLocks(); }

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { if (!isInternalExecution()) { return Collections.singletonMap(getGeoRepSession().getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.GLUSTER_GEOREP, VdcBllMessages.ACTION_TYPE_FAILED_GEOREP_SESSION_LOCKED)); } return null; }
Source:
private Map<String, String> userMappingStrToMap(String userMappingStr) { userMappingStr = userMappingStr.trim(); if (userMappingStr.isEmpty()) { return Collections.emptyMap(); } Map<String, String> ret = new HashMap<>(); String[] mappings = userMappingStr.split(";"); Arrays.stream(mappings).forEach(mapping -> { String[] entry = mapping.split("="); String key = entry[0]; String val = entry[1]; ret.put(key, val); }); return ret; }

Target:
private Map<String, String> userMappingStrToMap(String userMappingStr) { Map<String, String> userMappingMap = new HashMap<>(); userMappingStr = userMappingStr.trim(); if (userMappingStr.isEmpty()) { LOGGER.info("Existing azure cloud mappings are empty"); } else { String[] mappings = userMappingStr.split(";"); Arrays.stream(mappings).forEach(mapping -> { String[] entry = mapping.split("="); if (entry.length == 2) { String key = entry[0]; String val = entry[1]; userMappingMap.put(key, val); } else { LOGGER.warn("Skipping malformed azure cloud mapping entry: {}", mapping); } }); } return userMappingMap; }
Source:
public void allHostNTProcedureCallback(ClientResponse clientResponse) { synchronized(m_allHostCallbackLock) { int hostId = Integer.parseInt(clientResponse.getAppStatusString()); if (m_outstandingAllHostProcedureHostIds == null) { return; } boolean removed = m_outstandingAllHostProcedureHostIds.remove(hostId); if (!removed) { tmLog.error(String.format( "ProcedureRunnerNT.allHostNTProcedureCallback for procedure %s received late or unexepected response from hostID %d.", m_procedureName, hostId)); return; } m_allHostResponses.put(hostId, clientResponse); if (m_outstandingAllHostProcedureHostIds.size() == 0) { m_outstandingAllHostProc.set(false); m_allHostFut.complete(m_allHostResponses); } } }

Target:
public void allHostNTProcedureCallback(ClientResponse clientResponse) { synchronized(m_allHostCallbackLock) { int hostId = Integer.parseInt(clientResponse.getAppStatusString()); assert (m_outstandingAllHostProcedureHostIds != null); boolean removed = m_outstandingAllHostProcedureHostIds.remove(hostId); if (!removed) { tmLog.error(String.format( "ProcedureRunnerNT.allHostNTProcedureCallback for procedure %s received late or unexepected response from hostID %d.", m_procedureName, hostId)); return; } m_allHostResponses.put(hostId, clientResponse); if (m_outstandingAllHostProcedureHostIds.size() == 0) { m_outstandingAllHostProc.set(false); m_allHostFut.complete(m_allHostResponses); } } }
Source:
public void initializeUI(final UIBuilder builder) throws Exception { UIContext uiContext = builder.getUIContext(); Project project = getSelectedProject(uiContext); JPAFacet<PersistenceCommonDescriptor> persistenceFacet = project.getFacet(JPAFacet.class); targets.setValueChoices(persistenceFacet.getAllEntities()); targets.setItemLabelConverter(new Converter<JavaClassSource, String>() { @Override public String convert(JavaClassSource source) { return source == null ? null : source.getQualifiedName(); } }); builder.add(targets); if (uiContext.getProvider().isGUI()) { useCustomTemplate.setDefaultValue(false); pageTemplate.setEnabled(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return useCustomTemplate.getValue(); } }); builder.add(useCustomTemplate).add(pageTemplate); } else { builder.add(pageTemplate); } generateEqualsAndHashCode.setEnabled(new Callable<Boolean>() { @Override public Boolean call() throws Exception { for (JavaClassSource klass : targets.getValue()) { if (!klass.hasMethodSignature("hashCode") || !klass.hasMethodSignature("equals", Object.class)) { return true; } } return false; } }); builder.add(generateEqualsAndHashCode); }

Target:
public void initializeUI(final UIBuilder builder) throws Exception { UIContext uiContext = builder.getUIContext(); Project project = getSelectedProject(uiContext); JPAFacet<PersistenceCommonDescriptor> persistenceFacet = project.getFacet(JPAFacet.class); targets.setValueChoices(persistenceFacet.getAllEntities()); targets.setItemLabelConverter(new Converter<JavaClassSource, String>() { @Override public String convert(JavaClassSource source) { return source == null ? null : source.getQualifiedName(); } }); builder.add(targets); if (uiContext.getProvider().isGUI()) { useCustomTemplate.setDefaultValue(false); pageTemplate.setEnabled(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return useCustomTemplate.getValue(); } }); builder.add(useCustomTemplate).add(pageTemplate); } else { builder.add(pageTemplate); } generateEqualsAndHashCode.setEnabled(new Callable<Boolean>() { @Override public Boolean call() throws Exception { for (JavaClassSource javaSource : targets.getValue()) { if (!javaSource.hasMethodSignature("hashCode") || !javaSource.hasMethodSignature("equals", Object.class)) { return true; } } return false; } }); builder.add(generateEqualsAndHashCode); }
Source:
void logRenamedEntity() { if (this instanceof RenamedEntityInfoProvider) { RenamedEntityInfoProvider renameable = (RenamedEntityInfoProvider) this; String entityType = renameable.getEntityType(); String oldEntityName = renameable.getEntityOldName(); String newEntityName = renameable.getEntityNewName(); if (!StringUtils.equals(oldEntityName, newEntityName)) { AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("EntityType", entityType); logable.AddCustomValue("OldEntityName", oldEntityName); logable.AddCustomValue("NewEntityName", newEntityName); renameable.setEntityId(logable); auditLog(logable, AuditLogType.ENTITY_RENAMED); } } }

Target:
void logRenamedEntity() { if (this instanceof RenamedEntityInfoProvider) { RenamedEntityInfoProvider renameable = (RenamedEntityInfoProvider) this; String oldEntityName = renameable.getEntityOldName(); String newEntityName = renameable.getEntityNewName(); if (!StringUtils.equals(oldEntityName, newEntityName)) { AuditLogableBase logable = new AuditLogableBase(); String entityType = renameable.getEntityType(); logable.addCustomValue("EntityType", entityType); logable.addCustomValue("OldEntityName", oldEntityName); logable.addCustomValue("NewEntityName", newEntityName); renameable.setEntityId(logable); auditLog(logable, AuditLogType.ENTITY_RENAMED); } } }
Source:
public AmqpInboundChannelAdapter adapter() { AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(container()); adapter.setAutoStartup(false); adapter.setOutputChannel(channels.output()); DefaultAmqpHeaderMapper headerMapper = new DefaultAmqpHeaderMapper(); headerMapper.setRequestHeaderNames( StringUtils.commaDelimitedListToStringArray(this.properties.getMappedRequestHeaders())); adapter.setHeaderMapper(headerMapper); return adapter; }

Target:
public AmqpInboundChannelAdapter adapter() { AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(container()); adapter.setOutputChannel(channels.output()); DefaultAmqpHeaderMapper headerMapper = new DefaultAmqpHeaderMapper(); headerMapper.setRequestHeaderNames( StringUtils.commaDelimitedListToStringArray(this.properties.getMappedRequestHeaders())); adapter.setHeaderMapper(headerMapper); return adapter; }
Source:
@Override public void parseArguments(CommandArgIterator argIter) { force = false; if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); if (FORCE_COMMAND.equalsIgnoreCase(arg)) { force = true; argIter.nextArg(""); } } }

Target:
@Override public void parseArguments(CommandArgIterator argIter) { forceDeactivation = false; if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); if (FORCE_COMMAND.equalsIgnoreCase(arg)) { forceDeactivation = true; argIter.nextArg(""); } } }
Source:
public Publisher<CoreEvent> apply(Publisher<CoreEvent> publisher) { return from(publisher) .doOnNext(event -> { final DefaultFlowCallStack flowCallStack = (DefaultFlowCallStack) event.getFlowCallStack(); final ComponentIdentifier identifier = (ComponentIdentifier) getAnnotation(ANNOTATION_NAME); if (identifier.getNamespace() == null || "tns".equals(identifier.getNamespace())) { final String[] peekedWithNamespace = flowCallStack.peek().getFlowName().split("\\:"); String peekedNamespace = peekedWithNamespace[0]; flowCallStack.push(new FlowStackElement(peekedNamespace + ":" + identifier.getName(), null)); } else { flowCallStack.push(new FlowStackElement(identifier.getNamespace() + ":" + identifier.getName(), null)); } }) .transform(eventPub -> applyWithChildContext(from(eventPub).map(this::createEventWithParameters), nestedChain, ofNullable(getLocation()), errorHandler())) .doOnNext(event -> ((DefaultFlowCallStack) event.getFlowCallStack()).pop()) .map(eventResult -> processResult(getInternalParameter(ORIGINAL_EVENT_KEY, eventResult), eventResult)); }

Target:
public Publisher<CoreEvent> apply(Publisher<CoreEvent> publisher) { return from(publisher) .doOnNext(this::pushFlowStackEntry) .transform(eventPub -> applyWithChildContext(from(eventPub).map(this::createEventWithParameters), nestedChain, ofNullable(getLocation()), errorHandler())) .doOnNext(event -> ((DefaultFlowCallStack) event.getFlowCallStack()).pop()) .map(eventResult -> processResult(getInternalParameter(ORIGINAL_EVENT_KEY, eventResult), eventResult)); }
Source:
public void purgeCondition_shouldPurgeCondition() { int conditionId = 1; executeDataSet(CONDITION_XML); conditionService.purgeCondition(conditionService.getCondition(conditionId)); expectedException = ExpectedException.none(); Condition condition = conditionService.getCondition(conditionId); Assert.assertNull(condition); }

Target:
public void purgeCondition_shouldPurgeCondition() { Integer conditionId = 1; Condition existingCondition = conditionService.getCondition(conditionId); Assert.assertNotNull(existingCondition); conditionService.purgeCondition(conditionService.getCondition(conditionId)); Condition purgedCondition = conditionService.getCondition(conditionId); Assert.assertNull(purgedCondition); }
Source:
public static Date convertEventTimestampToDate(String timestamp) throws ParseException { timestamp = timestamp.replaceAll("[^\\d-:]", " ").trim(); Date date = dateFormat.parse(timestamp); return date; }

Target:
public static Date convertEventTimestampToDate(String timestamp) throws ParseException { return dateFormat.parse(timestamp); }
Source:
private static void checkConfiguration() { if (!config.getBooleanProperty(CoreConfig.INGEST_MODE)) { log.error("Ingestion mode not enabled. Please check your configuration"); System.exit(StopReasons.INCORRECT_CONFIGURATION); } log.info("Configuration is good"); boolean useZookeeper = false; log.info("Using zookeeper? " + useZookeeper); }

Target:
private static void checkConfiguration() { if (!config.getBooleanProperty(CoreConfig.INGEST_MODE)) { log.error("Ingestion mode not enabled. Please check your configuration"); System.exit(StopReasons.INCORRECT_CONFIGURATION); } log.info("Configuration is good"); }
Source:
public byte[] getAPIData() { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(sourceAddress.getValue()); os.write(rssi); os.write(receiveOptions); if (receivedData != null) os.write(receivedData); } catch (IOException e) { e.printStackTrace(); } return os.toByteArray(); }

Target:
public byte[] getAPIData() { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(sourceAddress.getValue()); os.write(rssi); os.write(receiveOptions); if (receivedData != null) os.write(receivedData); } catch (IOException e) { } return os.toByteArray(); }
Source:
public List<Container> findAllContainers() throws DotDataException { DotConnect dc = new DotConnect(); String sql = "SELECT " + Inode.Type.CONTAINERS.getTableName() + ".* from " + Inode.Type.CONTAINERS.getTableName() + ", inode dot_containers_1_, container_version_info vv " + "where vv.working_inode= " + Inode.Type.CONTAINERS.getTableName() + ".inode and " + Inode.Type.CONTAINERS.getTableName() + ".inode = dot_containers_1_.inode and " + "dot_containers_1_.type='containers' order by " + Inode.Type.CONTAINERS.getTableName() + ".title"; dc.setSQL(sql); try { return ConvertToPOJOUtil.convertDotConnectMapToContainer(dc.loadResults()); } catch (ParseException e) { throw new DotDataException(e); } }

Target:
public List<Container> findAllContainers() throws DotDataException { DotConnect dc = new DotConnect(); StringBuilder sql = new StringBuilder(); String tableName = Type.CONTAINERS.getTableName(); sql.append("SELECT "); sql.append(tableName); sql.append(".* from "); sql.append(tableName); sql.append(", inode dot_containers_1_, container_version_info vv where vv.working_inode= "); sql.append(tableName); sql.append(".inode and "); sql.append(tableName); sql.append(".inode = dot_containers_1_.inode and dot_containers_1_.type='containers' order by "); sql.append(tableName); sql.append(".title"); dc.setSQL(sql.toString()); try { return ConvertToPOJOUtil.convertDotConnectMapToContainer(dc.loadResults()); } catch (ParseException e) { throw new DotDataException(e); } }
Source:
private void exposeInContainerIfNeeded(ServicePort servicePort) { Optional<ContainerPort> exposedOpt = container .getPorts() .stream() .filter( p -> p.getContainerPort().equals(servicePort.getPort()) && servicePort.getProtocol().equals(p.getProtocol())) .findAny(); if (!exposedOpt.isPresent()) { ContainerPort containerPort = new ContainerPortBuilder() .withContainerPort(servicePort.getPort()) .withProtocol(servicePort.getProtocol()) .build(); container.getPorts().add(containerPort); } }

Target:
private void exposeInContainerIfNeeded(ServicePort servicePort) { if (container .getPorts() .stream() .noneMatch( p -> p.getContainerPort().equals(servicePort.getPort()) && servicePort.getProtocol().equals(p.getProtocol()))) { ContainerPort containerPort = new ContainerPortBuilder() .withContainerPort(servicePort.getPort()) .withProtocol(servicePort.getProtocol()) .build(); container.getPorts().add(containerPort); } }
Source:
public int read(int offset, int[] positions, int positionCount) throws IOException { if (!rowGroupOpen) { openRowGroup(); } checkState(!valuesInUse, "BlockLease hasn't been closed yet"); if (outputRequired) { ensureValuesCapacity(positionCount, presentStream != null && nullsAllowed); } if (filter != null) { outputPositions = ensureCapacity(outputPositions, positionCount); } else { outputPositions = positions; } systemMemoryContext.setBytes(getRetainedSizeInBytes()); if (readOffset < offset) { skip(offset - readOffset); } prepareForNextRead(positionCount, positions); int streamPosition; if (dataStream == null && lengthVector == null && isNullVector != null) { streamPosition = readAllNulls(positions, positionCount); } else if (filter == null) { streamPosition = readNoFilter(positions, positionCount); } else { streamPosition = readWithFilter(positions, positionCount); } readOffset = offset + streamPosition; return outputPositionCount; }

Target:
public int read(int offset, int[] positions, int positionCount) throws IOException { if (!rowGroupOpen) { openRowGroup(); } checkState(!valuesInUse, "BlockLease hasn't been closed yet"); if (filter != null) { outputPositions = ensureCapacity(outputPositions, positionCount); } else { outputPositions = positions; outputPositionsReadOnly = true; } systemMemoryContext.setBytes(getRetainedSizeInBytes()); if (readOffset < offset) { skip(offset - readOffset); } prepareForNextRead(positionCount, positions); int streamPosition; if (lengthStream == null) { streamPosition = readAllNulls(positions, positionCount); } else if (filter == null) { streamPosition = readNoFilter(positions, positionCount); } else { streamPosition = readWithFilter(positions, positionCount); } readOffset = offset + streamPosition; return outputPositionCount; }
Source:
public PinotQueryGeneratorContext withAggregation( LinkedHashMap<VariableReferenceExpression, Selection> newSelections, LinkedHashSet<VariableReferenceExpression> groupByColumns, int aggregations, Set<VariableReferenceExpression> hiddenColumnSet) { Iterator<Selection> selectionIterator = newSelections.values().iterator(); boolean passed = false; while (selectionIterator.hasNext()) { if (selectionIterator.next().getDefinition().startsWith(DISTINCT_COUNT_FUNCTION_NAME.toUpperCase(Locale.ENGLISH))) { hiddenColumnSet = Collections.emptySet(); passed = true; } } if (!passed) { checkSupported(!hasAggregation(), "Pinot doesn't support aggregation on top of the aggregated data"); } checkSupported(!hasLimit(), "Pinot doesn't support aggregation on top of the limit"); checkSupported(aggregations > 0, "Invalid number of aggregations"); return new PinotQueryGeneratorContext(newSelections, from, filter, aggregations, groupByColumns, topNColumnOrderingMap, limit, variablesInAggregation, hiddenColumnSet); }

Target:
public PinotQueryGeneratorContext withAggregation( LinkedHashMap<VariableReferenceExpression, Selection> newSelections, LinkedHashSet<VariableReferenceExpression> groupByColumns, int aggregations, Set<VariableReferenceExpression> hiddenColumnSet) { AtomicBoolean pushDownDistinctCount = new AtomicBoolean(false); newSelections.values().forEach(selection -> { if (selection.getDefinition().startsWith(PINOT_DISTINCT_COUNT_FUNCTION_NAME.toUpperCase(Locale.ENGLISH))) { pushDownDistinctCount.set(true); } }); if (pushDownDistinctCount.get()) { hiddenColumnSet = ImmutableSet.of(); } else { checkSupported(!hasAggregation(), "Pinot doesn't support aggregation on top of the aggregated data"); } checkSupported(!hasLimit(), "Pinot doesn't support aggregation on top of the limit"); checkSupported(aggregations > 0, "Invalid number of aggregations"); return new PinotQueryGeneratorContext(newSelections, from, filter, aggregations, groupByColumns, topNColumnOrderingMap, limit, variablesInAggregation, hiddenColumnSet); }
Source:
protected void executeCommand() { AuditLog auditLog = getAuditLog(); auditLogDao.remove(getParameters().getAuditLogId()); setAuditLogDetails(auditLog); auditLog.setUserId(Guid.Empty); AuditLogableBase logableToClear = Injector.injectMembers(new AuditLogableBase(auditLog)); EventFloodRegulator eventFloodRegulator = new EventFloodRegulator(logableToClear, auditLog.getLogType()); eventFloodRegulator.evict(); setSucceeded(true); }

Target:
protected void executeCommand() { AuditLog auditLog = getAuditLog(); auditLogDao.remove(getParameters().getAuditLogId()); setAuditLogDetails(auditLog); auditLog.setUserId(Guid.Empty); AuditLogable logableToClear = createAuditLogableImpl(auditLog); EventFloodRegulator eventFloodRegulator = new EventFloodRegulator(logableToClear, auditLog.getLogType()); eventFloodRegulator.evict(); setSucceeded(true); }
Source:
private Throwable getRootCauseException(Throwable re) { if (re.getCause() == null) return re; Throwable cause = re.getCause(); if (cause instanceof RuntimeException) return getRootCauseException(cause); else return re; }

Target:
private Throwable getRootCauseException(Throwable re) { Throwable cause = re.getCause(); if (cause instanceof RuntimeException) return getRootCauseException(cause); else return re; }
Source:
public void should_fail_when_two_elements_satisfy_the_given_restrictions() { Consumer<String> restrictions = name -> assertThat(name).startsWith("L"); Throwable assertionError = catchThrowable(() -> iterables.assertNoneSatisfy(someInfo(), actual, restrictions)); verify(failures).failure(info, noElementsShouldSatisfy(actual, list("Luke", "Leia"))); assertThat(assertionError).isNotNull(); }

Target:
public void should_fail_when_two_elements_satisfy_the_given_restrictions() { Consumer<String> restrictions = name -> assertThat(name).startsWith("L"); Throwable assertionError = expectAssertionError(() -> iterables.assertNoneSatisfy(someInfo(), actual, restrictions)); verify(failures).failure(info, noElementsShouldSatisfy(actual, list("Luke", "Leia"))); assertThat(assertionError).isNotNull(); }
Source:
Mono<Void> sendCloudEvents(Iterable<CloudEvent> events, Context context) { this.addCloudEventTracePlaceHolder(events); return Flux.fromIterable(events) .map(CloudEvent::toImpl) .collectList() .flatMap(list -> this.impl.publishCloudEventEventsAsync(this.hostname, list, context.addData(AZ_TRACING_NAMESPACE_KEY, Constants.EVENT_GRID_TRACING_NAMESPACE_VALUE))); }

Target:
Mono<Void> sendCloudEvents(Iterable<CloudEvent> events, Context context) { final Context finalContext = context != null ? context : Context.NONE; this.addCloudEventTracePlaceHolder(events); return Flux.fromIterable(events) .map(CloudEvent::toImpl) .collectList() .flatMap(list -> this.impl.publishCloudEventEventsAsync(this.hostname, list, finalContext.addData(AZ_TRACING_NAMESPACE_KEY, Constants.EVENT_GRID_TRACING_NAMESPACE_VALUE))); }
Source:
protected final void fireStateChangeEvent(final ITeamStateChangeEvent event) { Object[] allListeners = listeners.getListeners(); for (Object allListener : allListeners) { final ITeamStateChangeListener listener = (ITeamStateChangeListener) allListener; SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { listener.teamStateChanged(event); } @Override public void handleException(Throwable exception) { } }); } }

Target:
protected final void fireStateChangeEvent(final ITeamStateChangeEvent event) { Object[] allListeners = listeners.getListeners(); for (Object l : allListeners) { final ITeamStateChangeListener listener = (ITeamStateChangeListener)l; SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { listener.teamStateChanged(event); } @Override public void handleException(Throwable exception) { } }); } }
Source:
public void removeGroupUnion(PerunSession sess, Group resultGroup, Group operandGroup) throws InternalErrorException, GroupNotExistsException, PrivilegeException, GroupOperationsException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, resultGroup); getGroupsManagerBl().checkGroupExists(sess, operandGroup); if (!getGroupsManagerBl().isOneWayRelationBetweenGroups(resultGroup, operandGroup)) { throw new InternalErrorException("Relation does not exist between result group " + resultGroup + " and operand group" + operandGroup + "."); } if ( (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, resultGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, resultGroup)) || (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, operandGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, operandGroup)) ) { throw new PrivilegeException(sess, "removeGroupUnion"); } getGroupsManagerBl().removeGroupUnion(sess, resultGroup, operandGroup, false); }

Target:
public void removeGroupUnion(PerunSession sess, Group resultGroup, Group operandGroup) throws InternalErrorException, GroupNotExistsException, PrivilegeException, GroupOperationsException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, resultGroup); getGroupsManagerBl().checkGroupExists(sess, operandGroup); if ( (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, resultGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, resultGroup)) || (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, operandGroup) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, operandGroup)) ) { throw new PrivilegeException(sess, "removeGroupUnion"); } getGroupsManagerBl().removeGroupUnion(sess, resultGroup, operandGroup, false); }
Source:
public void end(Xid xid, int flags) throws XAException { System.out.println("[" + Thread.currentThread().getName() + "] DummyXAResource (" + serverId + ") XA_END [" + xid + "] Flags=" + flags); }

Target:
public void end(Xid xid, int flags) throws XAException { }
Source:
public void initializeObjects(List<EntityInfo> entityInfos, LinkedHashMap<EntityInfoLoadKey, Object> idToObjectMap, ObjectInitializationContext objectInitializationContext) { boolean traceEnabled = log.isTraceEnabled(); final int maxResults = entityInfos.size(); if ( maxResults == 0 ) { if ( traceEnabled ) { log.tracef( "No object to initialize", (Integer) maxResults ); } return; } for ( EntityInfo entityInfo : entityInfos ) { Object o = ObjectLoaderHelper.load( entityInfo, objectInitializationContext.getSession() ); if ( o != null ) { EntityInfoLoadKey key = new EntityInfoLoadKey( entityInfo.getClazz(), entityInfo.getId() ); idToObjectMap.put( key, o ); } } if ( traceEnabled ) { log.tracef( "Initialized %d objects by lookup method.", (Integer) maxResults ); } }

Target:
public void initializeObjects(List<EntityInfo> entityInfos, LinkedHashMap<EntityInfoLoadKey, Object> idToObjectMap, ObjectInitializationContext objectInitializationContext) { boolean traceEnabled = log.isTraceEnabled(); final int maxResults = entityInfos.size(); if ( maxResults == 0 ) { if ( traceEnabled ) { log.tracef( "No object to initialize" ); } return; } for ( EntityInfo entityInfo : entityInfos ) { Object o = ObjectLoaderHelper.load( entityInfo, objectInitializationContext.getSession() ); if ( o != null ) { EntityInfoLoadKey key = new EntityInfoLoadKey( entityInfo.getClazz(), entityInfo.getId() ); idToObjectMap.put( key, o ); } } if ( traceEnabled ) { log.tracef( "Initialized %d objects by lookup method.", (Integer) maxResults ); } }
Source:
public boolean equals(Object o) { if (!(o instanceof ImportConfiguration)) { return false; } ImportConfiguration other = (ImportConfiguration) o; return m_moduleProps.equals(other.m_moduleProps) && m_formatterBuilder.equals(other.m_formatterBuilder); }

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (!(o instanceof ImportConfiguration)) { return false; } ImportConfiguration other = (ImportConfiguration) o; return m_moduleProps.equals(other.m_moduleProps) && m_formatterBuilder.equals(other.m_formatterBuilder); }
Source:
public void validatePluginNames(List<? extends PluginBase> plugins) throws InternalInfrastructureException { for (PluginBase plugin : plugins) { final String formattedPluginName = plugin.getName().toLowerCase(); if (!namePattern.matcher(formattedPluginName).matches()) { throw new InternalInfrastructureException( format( "Plugin named `%s` contains unacceptable symbols and cannot be used as part of container naming.", formattedPluginName)); } } }

Target:
public void validatePluginNames(List<? extends PluginBase> plugins) throws ValidationException { for (PluginBase plugin : plugins) { if (plugin.getName() != null) { final String formattedPluginName = plugin.getName().toLowerCase(); checkValid( formattedPluginName, "Plugin name `%s` contains unacceptable symbols and cannot be used as part of container naming."); } for (CheContainer container : plugin.getContainers()) { if (container.getName() != null) { final String formattedContainerName = container.getName().toLowerCase(); checkValid( formattedContainerName, "Container name `%s` contains unacceptable symbols and cannot be used as part of container naming."); } } } }
Source:
public void setVisible(boolean visible) { _visible = visible; }

Target:
public void setVisible(boolean visible) { System.out.println("warning: TextEditor::setVisible(boolean) not implemented (" + visible + ")"); visible = visible; }
Source:
void saveScript() throws IOException { try ( BufferedWriter bw = Files.newBufferedWriter(file.toPath(), ExtensionScript.DEFAULT_CHARSET)) { bw.append(getContents()); } this.lastModified = file.lastModified(); }

Target:
void saveScript() throws IOException { this.charset = ExtensionScript.DEFAULT_CHARSET; try ( BufferedWriter bw = Files.newBufferedWriter(file.toPath(), charset)) { bw.append(getContents()); } this.lastModified = file.lastModified(); }
Source:
private int buildMatrix(ProgressMonitor pm) throws IOException { matrix = new long[srcs.size() * dsts.size()]; long[] srcSizes = new long[srcs.size()]; long[] dstSizes = new long[dsts.size()]; Arrays.fill(srcSizes, -1); Arrays.fill(dstSizes, -1); int mNext = 0; for (int srcIdx = 0; srcIdx < srcs.size(); srcIdx++) { DiffEntry srcEnt = srcs.get(srcIdx); if (!isFile(srcEnt.oldMode)) { pm.update(dsts.size()); continue; } SimilarityIndex s = hash(srcEnt.oldId.toObjectId()); for (int dstIdx = 0; dstIdx < dsts.size(); dstIdx++) { DiffEntry dstEnt = dsts.get(dstIdx); if (!isFile(dstEnt.newMode)) { pm.update(1); continue; } if (!RenameDetector.sameType(srcEnt.oldMode, dstEnt.newMode)) { pm.update(1); continue; } long srcSize = srcSizes[srcIdx]; if (srcSize < 0) { srcSize = size(srcEnt.oldId.toObjectId()); srcSizes[srcIdx] = srcSize; } long dstSize = dstSizes[dstIdx]; if (dstSize < 0) { dstSize = size(dstEnt.newId.toObjectId()); dstSizes[dstIdx] = dstSize; } long max = Math.max(srcSize, dstSize); long min = Math.min(srcSize, dstSize); if ((max * renameScore) / 100 > min) { pm.update(1); continue; } SimilarityIndex d = hash(dstEnt.newId.toObjectId()); int score = s.score(d); if (score < renameScore) { pm.update(1); continue; } matrix[mNext++] = encode(score, srcIdx, dstIdx); pm.update(1); } } Arrays.sort(matrix, 0, mNext); return mNext; }

Target:
private int buildMatrix(ProgressMonitor pm) throws IOException { matrix = new long[srcs.size() * dsts.size()]; long[] srcSizes = new long[srcs.size()]; long[] dstSizes = new long[dsts.size()]; Arrays.fill(srcSizes, -1); Arrays.fill(dstSizes, -1); int mNext = 0; for (int srcIdx = 0; srcIdx < srcs.size(); srcIdx++) { DiffEntry srcEnt = srcs.get(srcIdx); if (!isFile(srcEnt.oldMode)) { pm.update(dsts.size()); continue; } SimilarityIndex s = hash(srcEnt.oldId.toObjectId()); for (int dstIdx = 0; dstIdx < dsts.size(); dstIdx++) { DiffEntry dstEnt = dsts.get(dstIdx); if (!isFile(dstEnt.newMode)) { pm.update(1); continue; } if (!RenameDetector.sameType(srcEnt.oldMode, dstEnt.newMode)) { pm.update(1); continue; } long srcSize = srcSizes[srcIdx]; if (srcSize < 0) { srcSize = size(srcEnt.oldId.toObjectId()); srcSizes[srcIdx] = srcSize; } long dstSize = dstSizes[dstIdx]; if (dstSize < 0) { dstSize = size(dstEnt.newId.toObjectId()); dstSizes[dstIdx] = dstSize; } long max = Math.max(srcSize, dstSize); long min = Math.min(srcSize, dstSize); if (min * 100 / max < renameScore) { pm.update(1); continue; } SimilarityIndex d = hash(dstEnt.newId.toObjectId()); int score = s.score(d); if (score < renameScore) { pm.update(1); continue; } matrix[mNext++] = encode(score, srcIdx, dstIdx); pm.update(1); } } Arrays.sort(matrix, 0, mNext); return mNext; }
Source:
public float getPrice() { return pickupService ? type.getPrice() + 5 : type.getPrice(); }

Target:
public float getPrice() { float finalPrice = type.getPrice(); finalPrice += pickupService ? TicketOptions.PICKUPSERVICE.getPrice() : 0; finalPrice += chMember ? TicketOptions.CHMEMBER.getPrice() : 0; return finalPrice; }
Source:
public Field(String field) { if (field.startsWith(User.SCHEMA)) { fieldName = field.substring(User.SCHEMA.length() + 1).toLowerCase(Locale.ENGLISH); } else { fieldName = field.toLowerCase(Locale.ENGLISH); } queryField = UserQueryField.fromString(fieldName); if (queryField == null) { int lastIndexOfPeriod = field.lastIndexOf('.'); int lastIndexOfColon = field.lastIndexOf(':'); if (lastIndexOfPeriod > lastIndexOfColon) { splitString(field, lastIndexOfPeriod); LOG.warn( String.format("Period (.) used as field separator in %s. " + "This is not SCIM conform and deprecated!", field)); } else if (lastIndexOfColon > lastIndexOfPeriod) { splitString(field, lastIndexOfColon); } else { throw new IllegalArgumentException(String.format("Unable to parse field or extension from %s", field)); } } else { urn = User.SCHEMA; } }

Target:
public Field(String field) { if (field.toLowerCase().startsWith(User.SCHEMA.toLowerCase())) { if (field.charAt(User.SCHEMA.length()) == '.') { throw new IllegalArgumentException(String.format("Period (.) is not a valid field separator: %s", field)); } name = field.substring(User.SCHEMA.length() + 1).toLowerCase(Locale.ENGLISH); } else { name = field.toLowerCase(Locale.ENGLISH); } queryField = UserQueryField.fromString(name); urn = User.SCHEMA; if (queryField == null) { int lastIndexOfPeriod = field.lastIndexOf('.'); int lastIndexOfColon = field.lastIndexOf(':'); if (lastIndexOfPeriod > lastIndexOfColon) { urn = field.substring(0, lastIndexOfPeriod); name = field.substring(lastIndexOfPeriod + 1); logger.warn( String.format("Period (.) used as field separator in %s. This is not SCIM conform and deprecated!", field)); } else if (lastIndexOfColon > lastIndexOfPeriod) { urn = field.substring(0, lastIndexOfColon); name = field.substring(lastIndexOfColon + 1); } else { throw new IllegalArgumentException(String.format("Unable to parse field or extension from %s", field)); } } }
Source:
private static DoubleSummaryStats processContentTimestamps(List<Long> contentTimestamps) { requireNonNull(contentTimestamps, "contentTimestamps is null"); if (contentTimestamps.size() == 0) { return null; } DoubleSummaryStatistics statistics = new DoubleSummaryStatistics(); if (contentTimestamps.size() == 1) { statistics.accept(0); return new DoubleSummaryStats(statistics); } long previousTimestamp = contentTimestamps.get(0); for (int i = 1; i < contentTimestamps.size(); i++) { long timestamp = contentTimestamps.get(i); statistics.accept(NANOSECONDS.toMillis(timestamp - previousTimestamp)); previousTimestamp = timestamp; } return new DoubleSummaryStats(statistics); }

Target:
private static DoubleSummaryStats processContentTimestamps(List<Long> contentTimestamps) { requireNonNull(contentTimestamps, "contentTimestamps is null"); if (contentTimestamps.size() == 0 || contentTimestamps.size() == 1) { return null; } DoubleSummaryStatistics statistics = new DoubleSummaryStatistics(); long previousTimestamp = contentTimestamps.get(0); for (int i = 1; i < contentTimestamps.size(); i++) { long timestamp = contentTimestamps.get(i); statistics.accept(NANOSECONDS.toMillis(timestamp - previousTimestamp)); previousTimestamp = timestamp; } return new DoubleSummaryStats(statistics); }
Source:
public boolean commit() throws LoginException { LOG.debug("hadoop login commit"); if (!subject.getPrincipals(User.class).isEmpty()) { LOG.debug("Using existing subject: {}", subject.getPrincipals()); return true; } Principal user = getCanonicalUser(KerberosPrincipal.class); if (user != null) { LOG.debug("Using kerberos user: {}", user); } if (!isSecurityEnabled() && (user == null)) { String envUser = System.getenv(HADOOP_USER_NAME); if (envUser == null) { envUser = System.getProperty(HADOOP_USER_NAME); } user = envUser == null ? null : new User(envUser); } if (user == null) { user = getCanonicalUser(OS_PRINCIPAL_CLASS); LOG.debug("Using local user: {}", user); } if (user != null) { LOG.debug("Using user: \"{}\" with name: {}", user, user.getName()); User userEntry = null; try { AuthenticationMethod authMethod = (user instanceof KerberosPrincipal) ? AuthenticationMethod.KERBEROS : AuthenticationMethod.SIMPLE; userEntry = new User(user.getName(), authMethod, null); } catch (Exception e) { throw (LoginException)(new LoginException(e.toString()).initCause(e)); } LOG.debug("User entry: \"{}\"", userEntry); subject.getPrincipals().add(userEntry); return true; } LOG.error("Failed to find user name in " + subject); throw new LoginException("Failed to find user in name"); }

Target:
public boolean commit() throws LoginException { LOG.debug("hadoop login commit"); if (!subject.getPrincipals(User.class).isEmpty()) { LOG.debug("Using existing subject: {}", subject.getPrincipals()); return true; } Principal user = getCanonicalUser(KerberosPrincipal.class); if (user != null) { LOG.debug("Using kerberos user: {}", user); } if (!isSecurityEnabled() && (user == null)) { String envUser = System.getenv(HADOOP_USER_NAME); if (envUser == null) { envUser = System.getProperty(HADOOP_USER_NAME); } user = envUser == null ? null : new User(envUser); } if (user == null) { user = getCanonicalUser(OS_PRINCIPAL_CLASS); LOG.debug("Using local user: {}", user); } if (user != null) { LOG.debug("Using user: \"{}\" with name: {}", user, user.getName()); User userEntry = null; try { AuthenticationMethod authMethod = (user instanceof KerberosPrincipal) ? AuthenticationMethod.KERBEROS : AuthenticationMethod.SIMPLE; userEntry = new User(user.getName(), authMethod, null); } catch (Exception e) { throw (LoginException)(new LoginException(e.toString()).initCause(e)); } LOG.debug("User entry: \"{}\"", userEntry); subject.getPrincipals().add(userEntry); return true; } throw new LoginException("Failed to find user in name " + subject); }
Source:
public void lockInterruptibly() throws InterruptedException { boolean locked = false; if (this.delegate.isHeldByCurrentThread()) { locked = true; } this.delegate.lockInterruptibly(); if (locked) { return; } while (!locked) { try { locked = doLock(); } catch (Exception e) { this.delegate.unlock(); throw e; } } }

Target:
public void lockInterruptibly() throws InterruptedException { boolean locked = false; if (this.delegate.isHeldByCurrentThread()) { locked = true; } this.delegate.lockInterruptibly(); if (locked) { return; } while (!locked) { try { locked = doLock(); } catch (TransactionTimedOutException e) { throw new InterruptedException("Transaction timed out"); } catch (DuplicateKeyException e) { throw new InterruptedException("Duplicate key"); } catch (RuntimeException e) { this.delegate.unlock(); throw e; } if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } } }
Source:
public void send(Send request) throws IOException { if (!connected) { throw new ClosedChannelException(); } while (!request.isSendComplete()) { request.writeTo(writeChannel); } request.release(); }

Target:
public void send(Send request) throws IOException { try { if (!connected) { throw new ClosedChannelException(); } while (!request.isSendComplete()) { request.writeTo(writeChannel); } } finally { request.release(); } }
Source:
public boolean syntaxErrorInProperties(Map<String, String> properties) { boolean error = false; if (properties != null && !properties.isEmpty()) { for (Map.Entry<String, String> e : properties.entrySet()) { String key = e.getKey(); if (key == null || !key.matches(KEY_REGEX)) { error = true; break; } if (!Optional.ofNullable(e.getValue()).orElse("").matches(VALUE_REGEX)) { error = true; break; } } } return error; }

Target:
public boolean syntaxErrorInProperties(Map<String, String> properties) { boolean error = false; if (properties != null && !properties.isEmpty()) { for (Map.Entry<String, String> e : properties.entrySet()) { String key = e.getKey(); if (key == null || !key.matches(KEY_REGEX)) { error = true; break; } if (!Objects.toString(e.getValue(), "").matches(VALUE_REGEX)) { error = true; break; } } } return error; }
Source:
private Configuration getServiceConfiguration() { final Configuration groupCommServiceConf = groupCommDriver.getServiceConfiguration(); final Configuration outputServiceConf = outputService.getServiceConfiguration(); final Configuration metricTrackerServiceConf = MetricsCollectionService.getServiceConfiguration(); final Configuration emServiceConf = emConf.getServiceConfigurationWithoutNameResolver(); final Configuration traceConf = traceParameters.getConfiguration(); final Configuration metricsMessageServiceConf = MetricsMessageSender.getServiceConfiguration(); return Configurations.merge( userParameters.getServiceConf(), groupCommServiceConf, emServiceConf, metricTrackerServiceConf, outputServiceConf, traceConf, metricsMessageServiceConf); }

Target:
private Configuration getServiceConfiguration() { final Configuration groupCommServiceConf = groupCommDriver.getServiceConfiguration(); final Configuration outputServiceConf = outputService.getServiceConfiguration(); final Configuration metricCollectionServiceConf = MetricsCollectionService.getServiceConfiguration(); final Configuration emServiceConf = emConf.getServiceConfigurationWithoutNameResolver(); final Configuration traceConf = traceParameters.getConfiguration(); final Configuration metricsMessageServiceConf = MetricsMessageSender.getServiceConfiguration(); return Configurations.merge( userParameters.getServiceConf(), groupCommServiceConf, emServiceConf, metricCollectionServiceConf, outputServiceConf, traceConf, metricsMessageServiceConf); }