auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeQueryCommand() { SSHClient client = null; try { client = connect(getParameters().getServerName()); validateFingerprint(client); String glusterServers = executeCommand(client); if (StringUtils.isNotEmpty(glusterServers)) { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder; docBuilder = docBuilderFactory.newDocumentBuilder(); InputSource is = new InputSource(new StringReader(glusterServers)); Document doc = docBuilder.parse(is); doc.getDocumentElement().normalize(); NodeList listOfPeers = doc.getElementsByTagName(PEER); extractServers(listOfPeers); getQueryReturnValue().setReturnValue(getServerFingerPrintMap()); } else { String errMsg = "Could not get the peer list form the host: " + getParameters().getServerName(); log.error(errMsg); throw new RuntimeException(errMsg); } } catch (ParserConfigurationException e1) { log.errorFormat("There is problem in parsing xml." + e1.getMessage()); throw new RuntimeException(e1); } catch (SAXException e2) { log.errorFormat("Error in parsing xml." + e2.getMessage()); throw new RuntimeException(e2); } catch (IOException e3) { log.errorFormat("There is problem in reading the file." + e3.getMessage()); throw new RuntimeException(e3); } finally { if(client != null) { client.disconnect(); } } }

Target:
protected void executeQueryCommand() { SSHClient client = null; try { client = connect(getParameters().getServerName()); validateFingerprint(client); String glusterServers = authenticateAndExecuteCommand(client); if (StringUtils.isNotEmpty(glusterServers)) { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); InputSource is = new InputSource(new StringReader(glusterServers)); Document doc = docBuilder.parse(is); doc.getDocumentElement().normalize(); getQueryReturnValue().setReturnValue(getGlusterFingerprints(doc.getElementsByTagName(PEER))); } else { String errMsg = "Could not get the peer list form the host: " + getParameters().getServerName(); log.error(errMsg); throw new RuntimeException(errMsg); } } catch (ParserConfigurationException e1) { log.errorFormat("There is problem in parsing xml." + e1.getMessage()); throw new RuntimeException(e1); } catch (SAXException e2) { log.errorFormat("Error in parsing xml." + e2.getMessage()); throw new RuntimeException(e2); } catch (IOException e3) { log.errorFormat("There is problem in reading the file." + e3.getMessage()); throw new RuntimeException(e3); } finally { if(client != null) { client.disconnect(); } } }
Source:
private void openRealms() { if (openInProgress) { return; } else { openInProgress = true; managementRealmOpenTask = Realm.getInstanceAsync(managementRealmConfig, new Realm.Callback() { @Override public void onSuccess(Realm realm) { managementRealm = realm; checkIfRealmsAreOpened(); } @Override public void onError(Throwable exception) { synchronized (errorLock) { managementRealmError = new ObjectServerError(ErrorCode.UNKNOWN, exception); } checkIfRealmsAreOpened(); } }); permissionRealmOpenTask = Realm.getInstanceAsync(permissionRealmConfig, new Realm.Callback() { @Override public void onSuccess(Realm realm) { permissionRealm = realm; checkIfRealmsAreOpened(); } @Override public void onError(Throwable exception) { synchronized (errorLock) { permissionRealmError = new ObjectServerError(ErrorCode.UNKNOWN, exception); } checkIfRealmsAreOpened(); } }); } }

Target:
private void openRealms() { if (!openInProgress) { openInProgress = true; managementRealmOpenTask = Realm.getInstanceAsync(managementRealmConfig, new Realm.Callback() { @Override public void onSuccess(Realm realm) { managementRealm = realm; checkIfRealmsAreOpenedAndRunDelayedTasks(); } @Override public void onError(Throwable exception) { synchronized (errorLock) { managementRealmError = new ObjectServerError(ErrorCode.UNKNOWN, exception); checkIfRealmsAreOpenedAndRunDelayedTasks(); } } }); permissionRealmOpenTask = Realm.getInstanceAsync(permissionRealmConfig, new Realm.Callback() { @Override public void onSuccess(Realm realm) { permissionRealm = realm; checkIfRealmsAreOpenedAndRunDelayedTasks(); } @Override public void onError(Throwable exception) { synchronized (errorLock) { permissionRealmError = new ObjectServerError(ErrorCode.UNKNOWN, exception); checkIfRealmsAreOpenedAndRunDelayedTasks(); } } }); } }
Source:
private void validateDirectPrerequisite( Attribute attribute, ConfiguredTargetAndData prerequisite) { if (RuleContextConstraintSemantics.checkForIncompatibility(prerequisite.getConfiguredTarget()) .isIncompatible) { return; } validateDirectPrerequisiteType(prerequisite, attribute); validateDirectPrerequisiteFileTypes(prerequisite, attribute); if (attribute.performPrereqValidatorCheck()) { prerequisiteValidator.validate(this, prerequisite, attribute); } }

Target:
private void validateDirectPrerequisite( Attribute attribute, ConfiguredTargetAndData prerequisite) { if (RuleContextConstraintSemantics.checkForIncompatibility(prerequisite.getConfiguredTarget()) .isIncompatible()) { return; } validateDirectPrerequisiteType(prerequisite, attribute); validateDirectPrerequisiteFileTypes(prerequisite, attribute); if (attribute.performPrereqValidatorCheck()) { prerequisiteValidator.validate(this, prerequisite, attribute); } }
Source:
public Map<String, String> getEnv(IProject project) throws CoreException { String scheme = mapping.getSchemeFromNature(project); if (scheme!=null) { IRemoteEnvProxyManager manager = getRemoteManager(scheme); return manager.getEnv(project); } URI projectURI = project.getLocationURI(); return getEnv(projectURI); }

Target:
public Map<String, String> getEnv(IProject project) throws CoreException { String scheme = mapping.getSchemeFromNature(project); if (scheme!=null) { IRemoteProxyManager manager = getRemoteManager(scheme); IRemoteEnvProxyManager envManager; if (manager instanceof IRemoteEnvProxyManager) { envManager = (IRemoteEnvProxyManager) manager; return envManager.getEnv(project); } } URI projectURI = project.getLocationURI(); return getEnv(projectURI); }
Source:
public static boolean isIUPAC(final byte base) { return bases[base] != 0; }

Target:
public static boolean isIUPAC(final byte base) { return bases[base] != NON_IUPAC_CODE; }
Source:
public boolean accept(final Object element) { if (element instanceof ILabelProviderContextElementWrapper) { final Object object = ((ILabelProviderContextElementWrapper) element).getObject(); if (object instanceof ITreeItemAxis) { ITreeItemAxis curr = (ITreeItemAxis) object; Object el = curr.getElement(); if (el instanceof TreeFillingConfiguration) { final IAxis axis = ((TreeFillingConfiguration) el).getAxisUsedAsAxisProvider(); return axis instanceof EOperation || axis instanceof EOperationAxis; } } } return false; }

Target:
public boolean accept(final Object element) { boolean result = false; if (element instanceof ILabelProviderContextElementWrapper) { final Object object = ((ILabelProviderContextElementWrapper) element).getObject(); if (object instanceof ITreeItemAxis) { ITreeItemAxis curr = (ITreeItemAxis) object; Object el = curr.getElement(); if (el instanceof TreeFillingConfiguration) { final IAxis axis = ((TreeFillingConfiguration) el).getAxisUsedAsAxisProvider(); result = axis instanceof EOperation || axis instanceof EOperationAxis; } } } return result; }
Source:
public static ExecutionConfigAccessor fromProgramOptions(final ProgramOptions options, final List<URL> jobJars) { checkNotNull(options); checkNotNull(jobJars); final Configuration configuration = new Configuration(); if (options.getParallelism() != ExecutionConfig.PARALLELISM_DEFAULT) { configuration.setInteger(CoreOptions.DEFAULT_PARALLELISM, options.getParallelism()); } configuration.setBoolean(DeploymentOptions.ATTACHED, !options.getDetachedMode()); configuration.setBoolean(DeploymentOptions.SHUTDOWN_IF_ATTACHED, options.isShutdownOnAttachedExit()); ConfigUtils.encodeCollectionToConfig(configuration, PipelineOptions.CLASSPATHS, options.getClasspaths(), URL::toString); ConfigUtils.encodeCollectionToConfig(configuration, PipelineOptions.JARS, jobJars, URL::toString); SavepointRestoreSettings.toConfiguration(options.getSavepointRestoreSettings(), configuration); if (options instanceof PythonProgramOptions) { configuration.addAll(((PythonProgramOptions) options).getPythonConfiguration()); } return new ExecutionConfigAccessor(configuration); }

Target:
public static ExecutionConfigAccessor fromProgramOptions(final ProgramOptions options, final List<URL> jobJars) { checkNotNull(options); checkNotNull(jobJars); final Configuration configuration = new Configuration(); options.applyToConfiguration(configuration); ConfigUtils.encodeCollectionToConfig(configuration, PipelineOptions.JARS, jobJars, URL::toString); return new ExecutionConfigAccessor(configuration); }
Source:
public void testAddBindingsToScriptHandlerContainsVariables() throws InvalidScriptException, NodeException, NoSuchFieldException, IllegalAccessException { ScriptHandler scriptHandler = new ScriptHandler(); Map<String, Serializable> variables = new HashMap<>(); variables.put(testVariable1Key, testVariable1Value); VariablesMap variablesMap = new VariablesMap(); variablesMap.setInheritedMap(variables); validateThatScriptHandlerBindingsContain(scriptHandler, createTaskContext(null), variablesMap, new ConcurrentHashMap<>(), new HashMap<String, String>(), new HashMap<String, String>(), SchedulerConstants.VARIABLES_BINDING_NAME, variablesMap); }

Target:
public void testAddBindingsToScriptHandlerContainsVariables() throws InvalidScriptException, NodeException, NoSuchFieldException, IllegalAccessException { ScriptHandler scriptHandler = new ScriptHandler(); Map<String, Serializable> variables = new HashMap<>(); variables.put(testVariable1Key, testVariable1Value); VariablesMap variablesMap = new VariablesMap(); variablesMap.setInheritedMap(variables); validateThatScriptHandlerBindingsContain(scriptHandler, createTaskContext(null), variablesMap, new HashMap<>(), new HashMap<String, String>(), new HashMap<String, String>(), SchedulerConstants.VARIABLES_BINDING_NAME, variablesMap); }
Source:
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { List<SqlNode> sqlIdentifiers = call.getOperandList(); for (SqlNode node : sqlIdentifiers) { if (!(node instanceof SqlIdentifier)) { throw SqlUtil.newContextException(node.getParserPosition(), RESOURCE.aliasMustBeSimpleIdentifier()); } SqlIdentifier identifier = (SqlIdentifier) node; if (scope.resolveColumn(identifier.getSimple(), node) == null) { throw SqlUtil.newContextException(node.getParserPosition(), RESOURCE.unknownIdentifier(identifier.getSimple())); } } return validator.getTypeFactory().createSqlType(SqlTypeName.COLUMN_LIST); }

Target:
@Override public RelDataType deriveType( SqlValidator validator, SqlValidatorScope scope, SqlCall call) { return validator.getTypeFactory().createSqlType(SqlTypeName.COLUMN_LIST); }
Source:
public void listRevisionsWithPaginationAndRepeatIterator() { final int numberExpected = 50; List<ConfigurationSetting> settings = new ArrayList<>(numberExpected); for (int value = 0; value < numberExpected; value++) { settings.add(new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix)); } List<Mono<Response<ConfigurationSetting>>> results = new ArrayList<>(); for (ConfigurationSetting setting : settings) { results.add(client.setSettingWithResponse(setting)); } SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); Flux.merge(results).blockLast(); List<ConfigurationSetting> configurationSettingList1 = new ArrayList<>(); List<ConfigurationSetting> configurationSettingList2 = new ArrayList<>(); PagedFlux<ConfigurationSetting> configurationSettingPagedFlux = client.listSettingRevisions(filter); configurationSettingPagedFlux.toIterable().forEach(configurationSetting -> configurationSettingList1.add(configurationSetting)); assertEquals(numberExpected, configurationSettingList1.size()); configurationSettingPagedFlux.toIterable().forEach(configurationSetting -> configurationSettingList2.add(configurationSetting)); assertEquals(numberExpected, configurationSettingList2.size()); }

Target:
public void listRevisionsWithPaginationAndRepeatIterator() { final int numberExpected = 50; List<ConfigurationSetting> settings = new ArrayList<>(numberExpected); List<Mono<Response<ConfigurationSetting>>> results = new ArrayList<>(); for (int value = 0; value < numberExpected; value++) { ConfigurationSetting setting = new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix); settings.add(setting); results.add(client.setSettingWithResponse(setting)); } SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); Flux.merge(results).blockLast(); List<ConfigurationSetting> configurationSettingList1 = new ArrayList<>(); List<ConfigurationSetting> configurationSettingList2 = new ArrayList<>(); PagedFlux<ConfigurationSetting> configurationSettingPagedFlux = client.listSettingRevisions(filter); configurationSettingPagedFlux.toIterable().forEach(configurationSetting -> configurationSettingList1.add(configurationSetting)); assertEquals(numberExpected, configurationSettingList1.size()); configurationSettingPagedFlux.toIterable().forEach(configurationSetting -> configurationSettingList2.add(configurationSetting)); assertEquals(numberExpected, configurationSettingList2.size()); }
Source:
public void openFile(final SBlock fail, final BlockDispatchNode dispatchHandler) { long[] storage = new long[bufferSize]; buffer = new SMutableArray(storage, Classes.arrayClass); try { this.access = AccessModes.valueOf(mode.getString()); } catch (Exception e) { dispatchHandler.executeDispatch(new Object[] {fail, "invalid access mode"}); } try { raf = new RandomAccessFile(f, access.getMode()); } catch (FileNotFoundException e) { dispatchHandler.executeDispatch(new Object[] {fail, e.toString()}); } open = true; }

Target:
public Object openFile(final SBlock fail, final BlockDispatchNode dispatchHandler) { long[] storage = new long[bufferSize]; buffer = new SMutableArray(storage, Classes.arrayClass); try { raf = new RandomAccessFile(f, accessMode.mode); } catch (FileNotFoundException e) { return dispatchHandler.executeDispatch(new Object[] {fail, FILE_NOT_FOUND}); } return this; }
Source:
public SuccessResponse toggleQueryRateLimiting( @ApiParam(value = "Broker instance name", required = true, example = "Broker_my.broker.com_30000") @PathParam("instanceName") String brokerInstanceName, @ApiParam(value = "ENABLE|DISABLE", allowableValues = "ENABLE, DISABLE", required = true) @QueryParam("state") String state) { if (brokerInstanceName == null || !brokerInstanceName.startsWith("Broker_")) { LOGGER.info("{} isn't a valid broker instance name", brokerInstanceName); throw new ControllerApplicationException(LOGGER, String.format("'%s' is not a valid broker instance name.", brokerInstanceName), Response.Status.BAD_REQUEST); } validateQueryQuotaStateChange(state); List<String> liveInstances = _pinotHelixResourceManager.getOnlineInstanceList(); if (!liveInstances.contains(brokerInstanceName)) { LOGGER.info("Broker instance: not found from live instances", brokerInstanceName); throw new ControllerApplicationException(LOGGER, String.format("Instance '%s' not found.", brokerInstanceName), Response.Status.NOT_FOUND); } _pinotHelixResourceManager.toggleQueryQuotaStateForBroker(brokerInstanceName, state); String msg = String.format("Set query rate limiting to: %s for all tables in broker: %s", state, brokerInstanceName); LOGGER.info(msg); return new SuccessResponse(msg); }

Target:
public SuccessResponse toggleQueryRateLimiting( @ApiParam(value = "Broker instance name", required = true, example = "Broker_my.broker.com_30000") @PathParam("instanceName") String brokerInstanceName, @ApiParam(value = "ENABLE|DISABLE", allowableValues = "ENABLE, DISABLE", required = true) @QueryParam("state") String state) { if (brokerInstanceName == null || !brokerInstanceName.startsWith("Broker_")) { throw new ControllerApplicationException(LOGGER, String.format("'%s' is not a valid broker instance name.", brokerInstanceName), Response.Status.BAD_REQUEST); } validateQueryQuotaStateChange(state); List<String> liveInstances = _pinotHelixResourceManager.getOnlineInstanceList(); if (!liveInstances.contains(brokerInstanceName)) { throw new ControllerApplicationException(LOGGER, String.format("Instance '%s' not found.", brokerInstanceName), Response.Status.NOT_FOUND); } _pinotHelixResourceManager.toggleQueryQuotaStateForBroker(brokerInstanceName, state); String msg = String.format("Set query rate limiting to: %s for all tables in broker: %s", state, brokerInstanceName); LOGGER.info(msg); return new SuccessResponse(msg); }
Source:
private PhysicalOperation planGlobalAggregation(int operatorId, AggregationNode node, PhysicalOperation source) { int outputChannel = 0; ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder(); List<AccumulatorFactory> accumulatorFactories = new ArrayList<>(); for (Map.Entry<Symbol, Aggregation> entry : node.getAssignments().entrySet()) { Symbol symbol = entry.getKey(); Aggregation aggregation = entry.getValue(); accumulatorFactories.add(buildAccumulatorFactory(source, aggregation.getSignature(), aggregation.getCall(), aggregation.getMask().orElse(null))); outputMappings.put(symbol, outputChannel); outputChannel++; } OperatorFactory operatorFactory = new AggregationOperatorFactory(operatorId, node.getId(), node.getStep(), accumulatorFactories); return new PhysicalOperation(operatorFactory, outputMappings.build(), source); }

Target:
private PhysicalOperation planGlobalAggregation(int operatorId, AggregationNode node, PhysicalOperation source) { int outputChannel = 0; ImmutableMap.Builder<Symbol, Integer> outputMappings = ImmutableMap.builder(); List<AccumulatorFactory> accumulatorFactories = new ArrayList<>(); for (Map.Entry<Symbol, Aggregation> entry : node.getAggregations().entrySet()) { Symbol symbol = entry.getKey(); Aggregation aggregation = entry.getValue(); accumulatorFactories.add(buildAccumulatorFactory(source, aggregation.getSignature(), aggregation.getCall(), aggregation.getMask())); outputMappings.put(symbol, outputChannel); outputChannel++; } OperatorFactory operatorFactory = new AggregationOperatorFactory(operatorId, node.getId(), node.getStep(), accumulatorFactories); return new PhysicalOperation(operatorFactory, outputMappings.build(), source); }
Source:
protected List<EmailWrapper> prepareMailToBeSent() { FeedbackSessionAttributes feedbackObject = FeedbackSessionsLogic.inst() .getFeedbackSession(feedbackSessionName, courseId); log.info("Fetching feedback session object for feedback session name : " + feedbackSessionName + " and course : " + courseId); if (feedbackObject == null) { log.severe("Feedback session object for feedback session name : " + feedbackSessionName + " for course : " + courseId + " could not be fetched"); return null; } return new EmailGenerator().generateFeedbackSessionClosedEmails(feedbackObject); }

Target:
protected List<EmailWrapper> prepareMailToBeSent() { FeedbackSessionAttributes feedbackSession = FeedbackSessionsLogic.inst() .getFeedbackSession(feedbackSessionName, courseId); if (feedbackSession == null) { log.severe("Feedback session object for feedback session name : " + feedbackSessionName + " for course : " + courseId + " could not be fetched"); return null; } return new EmailGenerator().generateFeedbackSessionClosedEmails(feedbackSession); }
Source:
private void doBucketProbing() throws IOException { int bucketProbe = this.getConf() .getInt(S3A_BUCKET_PROBE, S3A_BUCKET_PROBE_DEFAULT); Preconditions.checkArgument(bucketProbe >= 0 && bucketProbe <= 2, "Value of " + S3A_BUCKET_PROBE + " should be between 0 to 2"); switch (bucketProbe) { case 0: break; case 1: verifyBucketExists(); break; case 2: verifyBucketExistsV2(); break; default: break; } }

Target:
private void doBucketProbing() throws IOException { int bucketProbe = getConf() .getInt(S3A_BUCKET_PROBE, S3A_BUCKET_PROBE_DEFAULT); Preconditions.checkArgument(bucketProbe >= 0, "Value of " + S3A_BUCKET_PROBE + " should be >= 0"); switch (bucketProbe) { case 0: LOG.debug("skipping check for bucket existence"); break; case 1: verifyBucketExists(); break; case 2: verifyBucketExistsV2(); break; default: LOG.warn("Unknown bucket probe option {}: {}; falling back to check #2", S3A_BUCKET_PROBE, bucketProbe); verifyBucketExistsV2(); break; } }
Source:
private boolean isNotCyclicEdge(final Edge edge) { final String sourceId = edge.getSourceNode() != null ? edge.getSourceNode().getUUID() : null; final String targetId = edge.getTargetNode() != null ? edge.getTargetNode().getUUID() : null; return !Objects.equals(sourceId, targetId); }

Target:
private static boolean isNotCyclicEdge(final Edge edge) { final String sourceId = edge.getSourceNode() != null ? edge.getSourceNode().getUUID() : null; final String targetId = edge.getTargetNode() != null ? edge.getTargetNode().getUUID() : null; return !Objects.equals(sourceId, targetId); }
Source:
public void downweighChannelBroadcastIsNotFirst() throws Exception { Broadcast downweighedBroadcast1 = new Broadcast(Id.valueOf(333L), DateTime.now().plusHours(1), DateTime.now().plusHours(2)); Broadcast normalBroadcast1 = new Broadcast(Id.valueOf(111L), DateTime.now().plusHours(1), DateTime.now().plusHours(2)); Broadcast normalBroadcast2 = new Broadcast(Id.valueOf(222L), DateTime.now().plusHours(1), DateTime.now().plusHours(2)); Collection<ResolvedBroadcast> resolvedBroadcasts = ImmutableSet.of( ResolvedBroadcast.create(downweighedBroadcast1, ResolvedChannel.builder(getMockChannel(333L)).build()), ResolvedBroadcast.create(normalBroadcast1, ResolvedChannel.builder(getMockChannel(111L)).build()), ResolvedBroadcast.create(normalBroadcast2, ResolvedChannel.builder(getMockChannel(222L)).build()) ); assertThat(resolvedBroadcasts.iterator().next().getBroadcast(), is(downweighedBroadcast1)); Set<ResolvedBroadcast> sortedBroadcasts = broadcastAggregator.sortByDownweighChannelIds( ImmutableList.of(Id.valueOf(333L)), resolvedBroadcasts ); assertFalse(sortedBroadcasts.iterator().next().getBroadcast().equals(downweighedBroadcast1)); assertTrue(sortedBroadcasts.stream() .map(ResolvedBroadcast::getBroadcast) .anyMatch(broadcast -> broadcast.equals(downweighedBroadcast1)) ); }

Target:
public void downweighChannelBroadcastIsNotFirst() throws Exception { Broadcast downweighedBroadcast1 = getFutureBroadcast(333L,1, 2); Broadcast normalBroadcast1 = getFutureBroadcast(111L,1,2); Broadcast normalBroadcast2 = getFutureBroadcast(222L,1,2); Collection<ResolvedBroadcast> resolvedBroadcasts = ImmutableSet.of( ResolvedBroadcast.create(downweighedBroadcast1, ResolvedChannel.builder(getMockChannel(333L)).build()), ResolvedBroadcast.create(normalBroadcast1, ResolvedChannel.builder(getMockChannel(111L)).build()), ResolvedBroadcast.create(normalBroadcast2, ResolvedChannel.builder(getMockChannel(222L)).build()) ); assertThat(resolvedBroadcasts.iterator().next().getBroadcast(), is(downweighedBroadcast1)); Set<ResolvedBroadcast> sortedBroadcasts = broadcastAggregator.sortByDownweighChannelIds( ImmutableList.of(Id.valueOf(333L)), resolvedBroadcasts ); assertFalse(sortedBroadcasts.iterator().next().getBroadcast().equals(downweighedBroadcast1)); assertTrue(sortedBroadcasts.stream() .map(ResolvedBroadcast::getBroadcast) .anyMatch(broadcast -> broadcast.equals(downweighedBroadcast1)) ); }
Source:
public void testVcfToAdpc() throws IOException { final File output = File.createTempFile("testIlluminaAdpcFileWriter.", ".adpc.bin"); output.deleteOnExit(); VcfToAdpc vcfToAdpc = new VcfToAdpc(); vcfToAdpc.VCF = TEST_VCF; vcfToAdpc.OUTPUT = output; Assert.assertEquals(vcfToAdpc.instanceMain(new String[0]), 0); IOUtil.assertFilesEqual(TEST_EXPECTED_ADPC_BIN_FILE, output); }

Target:
public void testVcfToAdpc() throws IOException { final File output = File.createTempFile("testIlluminaAdpcFileWriter.", ".adpc.bin"); output.deleteOnExit(); final VcfToAdpc vcfToAdpc = new VcfToAdpc(); vcfToAdpc.VCF = TEST_VCF; vcfToAdpc.OUTPUT = output; Assert.assertEquals(vcfToAdpc.instanceMain(new String[0]), 0); IOUtil.assertFilesEqual(TEST_EXPECTED_ADPC_BIN_FILE, output); }
Source:
public void test_update_returning_clause() { printStatement("update foo set foo='a' returning id"); printStatement("update foo set foo='a' where x=false returning id"); printStatement("update foo set foo='a' returning id AS foo"); printStatement("update foo set foo='a' returning id + 1 AS foo, id -1 as bar"); printStatement("update foo set foo='a' returning id + 1 AS foo, id -1 as bar"); printStatement("update foo set foo='a' returning \"column['nested']\" AS bar"); printStatement("update foo set foo='a' returning foo.bar - 1 AS foo"); }

Target:
public void test_update_returning_clause() { printStatement("update foo set foo='a' returning id"); printStatement("update foo set foo='a' where x=false returning id"); printStatement("update foo set foo='a' returning id AS foo"); printStatement("update foo set foo='a' returning id + 1 AS foo, id -1 as bar"); printStatement("update foo set foo='a' returning \"column['nested']\" AS bar"); printStatement("update foo set foo='a' returning foo.bar - 1 AS foo"); printStatement("update foo set foo='a' returning *"); printStatement("update foo set foo='a' returning foo.*"); }
Source:
public void testCamera() { PackageManager packageManager = mContext.getPackageManager(); if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)) { Intent intent = new Intent(); intent.setAction(android.provider.MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); assertCanBeHandled(intent); } }

Target:
public void testCamera() { PackageManager packageManager = mContext.getPackageManager(); if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA) || packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)){ Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); assertCanBeHandled(intent); intent.setAction(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); assertCanBeHandled(intent); intent.setAction(android.provider.MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); assertCanBeHandled(intent); intent.setAction(android.provider.MediaStore.INTENT_ACTION_VIDEO_CAMERA); assertCanBeHandled(intent); } }
Source:
public void onEntry(LogReplicationState from) { try { if (from != this) { snapshotSender.reset(); fsm.getAckReader().markSnapshotSyncInfoOngoing(forcedSnapshotSync, transitionEventId); snapshotSyncTimerSample = MeterRegistryProvider.getInstance().map(Timer::start); } Runnable snapShotSendTask = () -> snapshotSender.transmit(transitionEventId); if (senderTimer.isPresent()) { snapShotSendTask = senderTimer.get().wrap(snapShotSendTask); } transmitFuture = fsm.getLogReplicationFSMWorkers().submit(snapShotSendTask); } catch (Throwable t) { log.error("Error on entry of InSnapshotSyncState.", t); } }

Target:
public void onEntry(LogReplicationState from) { try { if (from != this) { snapshotSender.reset(); fsm.getAckReader().markSnapshotSyncInfoOngoing(forcedSnapshotSync, transitionEventId); snapshotSyncTimerSample = MeterRegistryProvider.getInstance().map(Timer::start); } transmitFuture = fsm.getLogReplicationFSMWorkers() .submit(() -> snapshotSender.transmit(transitionEventId)); } catch (Throwable t) { log.error("Error on entry of InSnapshotSyncState.", t); } }
Source:
public int setNcmTethering(boolean enable) { Log.i(TAG, "setNcmTethering(" + enable + ")"); UsbManager usbManager = (UsbManager) mContext.getSystemService(Context.USB_SERVICE); if (usbManager == null) { mLog.e("setNcmTethering: failed to get UsbManager!"); return TETHER_ERROR_SERVICE_UNAVAIL; } synchronized (mPublicSync) { usbManager.setCurrentFunction(enable ? STRING_NCM : null, false); } return TETHER_ERROR_NO_ERROR; }

Target:
private int setNcmTethering(boolean enable) { if (VDBG) Log.d(TAG, "setNcmTethering(" + enable + ")"); UsbManager usbManager = (UsbManager) mContext.getSystemService(Context.USB_SERVICE); synchronized (mPublicSync) { usbManager.setCurrentFunctions(enable ? UsbManager.FUNCTION_NCM : UsbManager.FUNCTION_NONE); } return TETHER_ERROR_NO_ERROR; }
Source:
public void testSuggestLabelsToChangeWithLabels() throws Exception { final List<ChangeLabel> all = new ArrayList<ChangeLabel>(); all.add(new ChangeLabel(new Change.Id(1), "a")); all.add(new ChangeLabel(new Change.Id(1), "b")); all.add(new ChangeLabel(new Change.Id(2), "b")); all.add(new ChangeLabel(new Change.Id(3), "c")); all.add(new ChangeLabel(new Change.Id(4), "d")); final List<LabelKey> expected = new ArrayList<LabelKey>(); expected.add(new LabelKey("b")); expected.add(new LabelKey("c")); expected.add(new LabelKey("d")); doLabelsSuggestion(new Change.Id(1), all, expected); }

Target:
public void testSuggestLabelsToChangeWithLabels() throws Exception { final List<ChangeLabel> allExcludingOneChange = new ArrayList<ChangeLabel>(); allExcludingOneChange.add(new ChangeLabel(new Change.Id(2), "b")); allExcludingOneChange.add(new ChangeLabel(new Change.Id(3), "c")); allExcludingOneChange.add(new ChangeLabel(new Change.Id(4), "d")); final Set<LabelKey> expected = new HashSet<LabelKey>(); expected.add(new LabelKey("b")); expected.add(new LabelKey("c")); expected.add(new LabelKey("d")); doLabelsSuggestion(new Change.Id(1), allExcludingOneChange, expected); }
Source:
public Collection<RepeatableContentProducer> data() { return tableDefinitionDescriptor.getDataFile() .map(dataFile -> singleton(asRepeatableContentProvider(dataFile))) .orElse(ImmutableSet.of()); }

Target:
public Collection<RepeatableContentProducer> data() { return tableDefinitionDescriptor.getDataFile() .map(this::asRepeatableContentProducer) .map(ImmutableSet::of) .orElse(ImmutableSet.of()); }
Source:
public void onDeleteLinkClick(final ClickEvent clickEvent) { locker.fire(new LockRequiredEvent()); if (!Objects.isNull(getOnDeleted())) { getOnDeleted().accept(externalLink); } }

Target:
public void onDeleteLinkClick(final ClickEvent clickEvent) { if (!Objects.isNull(getOnDeleted())) { getOnDeleted().accept(externalLink); } }
Source:
public SocketChannel requestForConnection(InetSocketAddress hostAddr) throws Exception { SocketChannel socket = connectToHost(hostAddr); ByteBuffer currentTimeBuf = ByteBuffer.allocate(8); while (currentTimeBuf.hasRemaining()) { socket.read(currentTimeBuf); } currentTimeBuf.flip(); long skew = System.currentTimeMillis() - currentTimeBuf.getLong(); assert(currentTimeBuf.remaining() == 0); JSONObject jsObj = new JSONObject(); jsObj.put(TYPE, ConnectionType.REQUEST_CONNECTION.toString()); jsObj.put(VERSION_STRING, m_acceptor.getVersionChecker().getVersionString()); jsObj.put(HOST_ID, m_localHostId); jsObj.put(PORT, m_internalPort); jsObj.put(ADDRESS, m_internalInterface.isEmpty() ? m_reportedInternalInterface : m_internalInterface); byte[] jsBytes = jsObj.toString(4).getBytes(StandardCharsets.UTF_8); ByteBuffer addConnection = ByteBuffer.allocate(4 + jsBytes.length); addConnection.putInt(jsBytes.length); addConnection.put(jsBytes).flip(); while (addConnection.hasRemaining()) { socket.write(addConnection); } final String remoteAddress = socket.socket().getRemoteSocketAddress().toString(); processJSONResponse(socket, remoteAddress, Sets.newHashSet()); return socket; }

Target:
public SocketChannel requestForConnection(InetSocketAddress hostAddr) throws Exception { SocketChannel socket = connectToHost(hostAddr); ByteBuffer currentTimeBuf = ByteBuffer.allocate(8); while (currentTimeBuf.hasRemaining()) { socket.read(currentTimeBuf); } currentTimeBuf.flip(); currentTimeBuf.getLong(); assert(currentTimeBuf.remaining() == 0); JSONObject jsObj = new JSONObject(); jsObj.put(TYPE, ConnectionType.REQUEST_CONNECTION.toString()); jsObj.put(VERSION_STRING, m_acceptor.getVersionChecker().getVersionString()); jsObj.put(HOST_ID, m_localHostId); jsObj.put(PORT, m_internalPort); jsObj.put(ADDRESS, m_internalInterface.isEmpty() ? m_reportedInternalInterface : m_internalInterface); byte[] jsBytes = jsObj.toString(4).getBytes(StandardCharsets.UTF_8); ByteBuffer addConnection = ByteBuffer.allocate(4 + jsBytes.length); addConnection.putInt(jsBytes.length); addConnection.put(jsBytes).flip(); while (addConnection.hasRemaining()) { socket.write(addConnection); } final String remoteAddress = socket.socket().getRemoteSocketAddress().toString(); processJSONResponse(socket, remoteAddress, Sets.newHashSet()); return socket; }
Source:
private GroupMembers getRegisteredUsers() throws OrmException { final AccountGroup registeredUsersGroup = groupCache.get(AccountGroup.REGISTERED_USERS); final TreeSet<Account> allAccounts = new TreeSet<Account>(new AccountComparator()); allAccounts.addAll(reviewDb.accounts().all().toList()); return new GroupMembers(registeredUsersGroup, allAccounts, new TreeSet<GroupMembers>()); }

Target:
private GroupMembers getRegisteredUsers() throws OrmException, NoSuchGroupException { final GroupControl groupControl = groupControlFactory.controlFor(AccountGroup.REGISTERED_USERS); final AccountGroup registeredUsersGroup = groupControl.getAccountGroup(); final TreeSet<Account> allAccounts = new TreeSet<Account>(new AccountComparator()); final GroupMembers groupMembers = new GroupMembers(registeredUsersGroup, allAccounts, new TreeSet<GroupMembers>()); if (groupControl.isOwner() || registeredUsersGroup.isVisibleToAll()) { allAccounts.addAll(reviewDb.accounts().all().toList()); } else { groupMembers.setGroupVisible(false); } return groupMembers; }
Source:
public void getConceptStateConversion_shouldTestGetConceptStateConversion() { ConceptStateConversion conceptStateConversion1 = pws.getAllConceptStateConversions().get(0); int id = conceptStateConversion1.getId(); ConceptStateConversion conceptStateConversion2 = pws.getConceptStateConversion(id); assertEquals(conceptStateConversion1, conceptStateConversion2); }

Target:
public void getConceptStateConversion_shouldTestGetConceptStateConversion() { ConceptStateConversion conceptStateConversion1 = pws.getAllConceptStateConversions().get(0); int conceptStateConversion1Id = conceptStateConversion1.getId(); ConceptStateConversion conceptStateConversion2 = pws.getConceptStateConversion(conceptStateConversion1Id); assertEquals(conceptStateConversion1, conceptStateConversion2); }
Source:
private String getLocal(String name, final int colon) { return name != null && colon > 0 ? (colon + 1 < name.length() ? name.substring(colon + 1) : "") : name; }

Target:
private String getLocal(String name, final int colon) { if (name != null && colon > 0) { return colon + 1 < name.length() ? name.substring(colon + 1) : ""; } else { return name; } }
Source:
public void testLineGapWidth() throws IOException, ParseException { JSONObject jsonObject = parseTestStyle("lineStyleGapTest.json"); MBStyle mbStyle = new MBStyle(jsonObject); StyledLayerDescriptor sld = mbStyle.transform(); SLDTransformer styleTransform = new SLDTransformer(); String xml; try { xml = styleTransform.transform(sld); System.out.print(xml); } catch (TransformerException e) { e.printStackTrace(); } List<MBLayer> layers = mbStyle.layers("test-source"); assertEquals(1, layers.size()); assertTrue(layers.get(0) instanceof LineMBLayer); LineMBLayer mbLine = (LineMBLayer) layers.get(0); List<FeatureTypeStyle> fts = mbLine.transform(mbStyle); assertEquals(1, fts.get(0).rules().size()); Rule r = fts.get(0).rules().get(0); assertEquals(2, r.symbolizers().size()); Symbolizer symbolizer = r.symbolizers().get(0); assertTrue(symbolizer instanceof LineSymbolizer); LineSymbolizer lsym = (LineSymbolizer) symbolizer; assertEquals(new Color(0, 153, 255), lsym.getStroke().getColor().evaluate(null, Color.class)); assertEquals("square", lsym.getStroke().getLineCap().evaluate(null, String.class)); assertEquals("round", lsym.getStroke().getLineJoin().evaluate(null, String.class)); assertEquals(.5d, lsym.getStroke().getOpacity().evaluate(null, Double.class), .0001); assertEquals(Integer.valueOf(10), lsym.getStroke().getWidth().evaluate(null, Integer.class)); assertEquals(Integer.valueOf(-5), lsym.getPerpendicularOffset().evaluate(null, Integer.class)); }

Target:
public void testLineGapWidth() throws IOException, ParseException { JSONObject jsonObject = parseTestStyle("lineStyleGapTest.json"); MBStyle mbStyle = new MBStyle(jsonObject); List<MBLayer> layers = mbStyle.layers("test-source"); assertEquals(1, layers.size()); assertTrue(layers.get(0) instanceof LineMBLayer); LineMBLayer mbLine = (LineMBLayer) layers.get(0); List<FeatureTypeStyle> fts = mbLine.transform(mbStyle); assertEquals(1, fts.get(0).rules().size()); Rule r = fts.get(0).rules().get(0); assertEquals(2, r.symbolizers().size()); Symbolizer symbolizer = r.symbolizers().get(0); assertTrue(symbolizer instanceof LineSymbolizer); LineSymbolizer lsym = (LineSymbolizer) symbolizer; assertEquals(new Color(0, 153, 255), lsym.getStroke().getColor().evaluate(null, Color.class)); assertEquals("square", lsym.getStroke().getLineCap().evaluate(null, String.class)); assertEquals("round", lsym.getStroke().getLineJoin().evaluate(null, String.class)); assertEquals(.5d, lsym.getStroke().getOpacity().evaluate(null, Double.class), .0001); assertEquals(Integer.valueOf(10), lsym.getStroke().getWidth().evaluate(null, Integer.class)); assertEquals(Integer.valueOf(-5), lsym.getPerpendicularOffset().evaluate(null, Integer.class)); }
Source:
public void copyAdditionalPropertiesFrom(BaseResourceMessage theMsg) { if (theMsg.myAdditionalProperties != null) { if (myAdditionalProperties == null) { myAdditionalProperties = new HashMap<>(); } myAdditionalProperties.putAll(theMsg.myAdditionalProperties); } }

Target:
public void copyAdditionalPropertiesFrom(BaseResourceMessage theMsg) { if (theMsg.myAttributes != null) { if (myAttributes == null) { myAttributes = new HashMap<>(); } myAttributes.putAll(theMsg.myAttributes); } }
Source:
public void testDecoratorWithWhitelist() { ListFilteredDimensionSpec spec = new ListFilteredDimensionSpec( new DefaultDimensionSpec("foo", "bar"), ImmutableSet.of("c", "g"), true ); DimensionSelector selector = spec.decorate(TestDimensionSelector.INSTACE); Assert.assertEquals(2, selector.getValueCardinality()); IndexedInts row = selector.getRow(); Assert.assertEquals(2, row.size()); Assert.assertEquals(0, row.get(0)); Assert.assertEquals(1, row.get(1)); Assert.assertEquals("c", selector.lookupName(0)); Assert.assertEquals("g", selector.lookupName(1)); Assert.assertEquals(0, selector.idLookup().lookupId("c")); Assert.assertEquals(1, selector.idLookup().lookupId("g")); }

Target:
public void testDecoratorWithWhitelist() { ListFilteredDimensionSpec spec = new ListFilteredDimensionSpec( new DefaultDimensionSpec("foo", "bar"), ImmutableSet.of("c", "g"), true ); DimensionSelector selector = spec.decorate(TestDimensionSelector.INSTANCE); Assert.assertEquals(2, selector.getValueCardinality()); IndexedInts row = selector.getRow(); Assert.assertEquals(2, row.size()); Assert.assertEquals(0, row.get(0)); Assert.assertEquals(1, row.get(1)); Assert.assertEquals("c", selector.lookupName(0)); Assert.assertEquals("g", selector.lookupName(1)); Assert.assertEquals(0, selector.idLookup().lookupId("c")); Assert.assertEquals(1, selector.idLookup().lookupId("g")); }
Source:
public boolean hasNext() { return replicaIterator.hasNext() && (inflightCount < parallelism || isMostRecentRequestPastDue()); }

Target:
public boolean hasNext() { return replicaIterator.hasNext() && (inflightCount < parallelism || isOldestRequestPastDue()); }
Source:
private OperationTimer createTimer() { return new OperationTimer( driverContext.isCpuTimerEnabled(), driverContext.isCpuTimerEnabled() && driverContext.isVerboseStats()); }

Target:
private OperationTimer createTimer() { return new OperationTimer( driverContext.isCpuTimerEnabled(), driverContext.isCpuTimerEnabled() && driverContext.isPerOperatorCpuTimerEnabled()); }
Source:
public void shouldNotBeAbleToChangeClusterMembersDatabaseName() throws Exception { CoreClusterMember member = cluster.coreMembers().stream().findFirst().orElseThrow( IllegalArgumentException::new ); cluster.shutdownCoreMembers( member ); member.updateDbNameConfig( "new_name" ); try { cluster.startCoreMembers( member ); fail( "Cluster member should fail to restart after database name change." ); } catch ( ExecutionException e ) { } }

Target:
public void shouldNotBeAbleToChangeClusterMembersDatabaseName() throws Exception { CoreClusterMember member = cluster.coreMembers().stream().findFirst().orElseThrow( IllegalArgumentException::new ); cluster.shutdownCoreMember( member ); member.updateConfig( CausalClusteringSettings.database, "new_name" ); try { cluster.startCoreMember( member ); fail( "Cluster member should fail to restart after database name change." ); } catch ( ExecutionException e ) { } }
Source:
private void setEventOrAlarm(Position position, String trigger, Integer reportType) { if (trigger.equals("9")) { position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); } else if (trigger.equals("1")) { position.set(Position.KEY_ALARM, Position.ALARM_POWER_ON); } else if (trigger.equals("i")) { position.set(Position.KEY_IGNITION, true); } else if (trigger.equals("I")) { position.set(Position.KEY_IGNITION, false); } else if (trigger.equals("E")) { position.set(Position.KEY_ALARM, Position.ALARM_POWER_RESTORED); } else if (trigger.equals("e")) { position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); } else if (trigger.equals("!")) { position.set(Position.KEY_ALARM, Position.ALARM_TOW); } else if (trigger.equals("s")) { position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED); } else if (trigger.equals("h")) { switch (reportType) { case 0: case 3: position.set(Position.KEY_ALARM, Position.ALARM_BRAKING); break; case 1: case 4: position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION); break; case 2: case 5: default: position.set(Position.KEY_ALARM, Position.ALARM_CORNERING); break; } } }

Target:
private void setEventOrAlarm(Position position, String trigger, Integer reportType) { switch (trigger) { case "9": position.set(Position.KEY_ALARM, Position.ALARM_LOW_BATTERY); break; case "1": position.set(Position.KEY_ALARM, Position.ALARM_POWER_ON); break; case "i": position.set(Position.KEY_IGNITION, true); break; case "I": position.set(Position.KEY_IGNITION, false); break; case "E": position.set(Position.KEY_ALARM, Position.ALARM_POWER_RESTORED); break; case "e": position.set(Position.KEY_ALARM, Position.ALARM_POWER_CUT); break; case "!": position.set(Position.KEY_ALARM, Position.ALARM_TOW); break; case "s": position.set(Position.KEY_ALARM, Position.ALARM_OVERSPEED); break; case "h": switch (reportType) { case 0: case 3: position.set(Position.KEY_ALARM, Position.ALARM_BRAKING); break; case 1: case 4: position.set(Position.KEY_ALARM, Position.ALARM_ACCELERATION); break; case 2: case 5: default: position.set(Position.KEY_ALARM, Position.ALARM_CORNERING); break; } break; default: break; } }
Source:
protected Boolean doInBackground(Void... params) { Hashtable<String, String> device_ping = new Hashtable<>(); device_ping.put(Aware_Preferences.DEVICE_ID, Aware.getSetting(awareContext, Aware_Preferences.DEVICE_ID)); device_ping.put("ping", String.valueOf(System.currentTimeMillis())); device_ping.put("platform", "android"); try { PackageInfo package_info = awareContext.getPackageManager().getPackageInfo(awareContext.getPackageName(), 0); device_ping.put("package_name", package_info.packageName); device_ping.put("package_version_code", String.valueOf(package_info.versionCode)); device_ping.put("package_version_name", String.valueOf(package_info.versionName)); } catch (PackageManager.NameNotFoundException e) { } try { new Https(awareContext, SSLManager.getHTTPS(getApplicationContext(), "<LINK_0>")).dataPOST("<LINK_0>/awaredev/alive", device_ping, true); } catch (FileNotFoundException e) { e.printStackTrace(); } return true; }

Target:
protected Boolean doInBackground(Void... params) { Hashtable<String, String> device_ping = new Hashtable<>(); device_ping.put(Aware_Preferences.DEVICE_ID, Aware.getSetting(awareContext, Aware_Preferences.DEVICE_ID)); device_ping.put("ping", String.valueOf(System.currentTimeMillis())); device_ping.put("platform", "android"); try { PackageInfo package_info = awareContext.getPackageManager().getPackageInfo(awareContext.getPackageName(), 0); device_ping.put("package_name", package_info.packageName); if (package_info.packageName.equals("com.aware.phone")) { device_ping.put("package_version_code", String.valueOf(package_info.versionCode)); device_ping.put("package_version_name", String.valueOf(package_info.versionName)); } } catch (PackageManager.NameNotFoundException e) { } try { new Https(awareContext, SSLManager.getHTTPS(getApplicationContext(), "<LINK_0>")).dataPOST("<LINK_0>/awaredev/alive", device_ping, true); } catch (FileNotFoundException e) { e.printStackTrace(); } return true; }
Source:
public static boolean isInside(Message message) { return message.getError().getExtension(ELEMENT, NAMESPACE) != null; }

Target:
public static boolean isInside(Message message) { return from(message) != null; }
Source:
StreamTask createTask(final Consumer<byte[], byte[]> mainConsumer, final TaskId taskId, final Set<TopicPartition> partitions) { createTaskSensor.record(); final String threadIdPrefix = String.format("stream-thread [%s] ", Thread.currentThread().getName()); final String logPrefix = threadIdPrefix + String.format("%s [%s] ", "task", taskId); final LogContext logContext = new LogContext(logPrefix); final ProcessorTopology topology = builder.build(taskId.topicGroupId); final ProcessorStateManager stateManager = new ProcessorStateManager( taskId, partitions, Task.TaskType.ACTIVE, stateDirectory, topology.storeToChangelogTopic(), storeChangelogReader, logContext); if (threadProducer == null) { final Map<String, Object> producerConfigs = config.getProducerConfigs(getTaskProducerClientId(threadId, taskId)); producerConfigs.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, applicationId + "-" + taskId); log.info("Creating producer client for task {}", taskId); taskProducer.put(taskId, clientSupplier.getProducer(producerConfigs)); } final RecordCollector recordCollector = new RecordCollectorImpl( logContext, taskId, mainConsumer, threadProducer != null ? new TransactionManager(threadProducer) : new TransactionManager(taskProducer.get(taskId), applicationId, taskId), config.defaultProductionExceptionHandler(), EXACTLY_ONCE.equals(config.getString(StreamsConfig.PROCESSING_GUARANTEE_CONFIG)), streamsMetrics); return new StreamTask( taskId, partitions, topology, mainConsumer, config, streamsMetrics, stateDirectory, cache, time, stateManager, recordCollector); }

Target:
StreamTask createTask(final Consumer<byte[], byte[]> mainConsumer, final TaskId taskId, final Set<TopicPartition> partitions) { createTaskSensor.record(); final String threadIdPrefix = String.format("stream-thread [%s] ", Thread.currentThread().getName()); final String logPrefix = threadIdPrefix + String.format("%s [%s] ", "task", taskId); final LogContext logContext = new LogContext(logPrefix); final ProcessorTopology topology = builder.build(taskId.topicGroupId); final ProcessorStateManager stateManager = new ProcessorStateManager( taskId, partitions, Task.TaskType.ACTIVE, stateDirectory, topology.storeToChangelogTopic(), storeChangelogReader, logContext); if (threadProducer == null) { final Map<String, Object> producerConfigs = config.getProducerConfigs(getTaskProducerClientId(threadId, taskId)); producerConfigs.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, applicationId + "-" + taskId); log.info("Creating producer client for task {}", taskId); taskProducers.put(taskId, clientSupplier.getProducer(producerConfigs)); } final RecordCollector recordCollector = new RecordCollectorImpl( logContext, taskId, mainConsumer, threadProducer != null ? new StreamsProducer(logContext, threadProducer) : new StreamsProducer(logContext, taskProducers.get(taskId), applicationId, taskId), config.defaultProductionExceptionHandler(), EXACTLY_ONCE.equals(config.getString(StreamsConfig.PROCESSING_GUARANTEE_CONFIG)), streamsMetrics); return new StreamTask( taskId, partitions, topology, mainConsumer, config, streamsMetrics, stateDirectory, cache, time, stateManager, recordCollector); }