auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public StramLocalCluster(LogicalPlan dag) throws IOException, ClassNotFoundException { dag.validate(); cloneLogicalPlan(dag); <START> final String pathUri; <END> String appPath = dag.getAttributes().get(LogicalPlan.APPLICATION_PATH); if (appPath == null) { pathUri = new File("target", StramLocalCluster.class.getName()).toURI().toString(); dag.getAttributes().put(LogicalPlan.APPLICATION_PATH, pathUri); } else { pathUri = new File(appPath).toURI().toString(); } try { FileContext.getLocalFSFileContext().delete(new Path(pathUri), true); } catch (IllegalArgumentException e) { throw e; } catch (IOException e) { throw new RuntimeException("could not cleanup test dir", e); } dag.getAttributes().put(LogicalPlan.APPLICATION_ID, "app_local_" + System.currentTimeMillis()); if (dag.getAttributes().get(OperatorContext.STORAGE_AGENT) == null) { dag.setAttribute(OperatorContext.STORAGE_AGENT, new AsyncFSStorageAgent(new Path(pathUri, LogicalPlan.SUBDIR_CHECKPOINTS).toString(), null)); } this.dnmgr = new StreamingContainerManager(dag); this.umbilical = new UmbilicalProtocolLocalImpl(); if (!perContainerBufferServer) { StreamingContainer.eventloop.start(); bufferServer = new Server(0, 1024 * 1024,8); bufferServer.setSpoolStorage(new DiskStorage()); bufferServerAddress = InetSocketAddress.createUnresolved(LOCALHOST, bufferServer.run(StreamingContainer.eventloop).getPort()); LOG.info("Buffer server started: {}", bufferServerAddress); } }</code><technical_language>URI instead of String</technical_language>

Target:
public StramLocalCluster(LogicalPlan dag) throws IOException, ClassNotFoundException { dag.validate(); cloneLogicalPlan(dag); final Path pathUri; String appPath = dag.getAttributes().get(LogicalPlan.APPLICATION_PATH); if (appPath == null) { pathUri = new Path(DEFAULT_APP_DIR.toURI()); dag.getAttributes().put(LogicalPlan.APPLICATION_PATH, pathUri.toString()); } else { Path tmp = new Path(appPath); if (!tmp.isAbsolute()) { pathUri = new Path(new File(appPath).toURI()); } else { pathUri = tmp; } } try { FileContext.getLocalFSFileContext().delete(pathUri, true); } catch (IllegalArgumentException e) { throw e; } catch (IOException e) { throw new RuntimeException("could not cleanup test dir", e); } dag.getAttributes().put(LogicalPlan.APPLICATION_ID, "app_local_" + System.currentTimeMillis()); if (dag.getAttributes().get(OperatorContext.STORAGE_AGENT) == null) { dag.setAttribute(OperatorContext.STORAGE_AGENT, new AsyncFSStorageAgent(new Path(pathUri, LogicalPlan.SUBDIR_CHECKPOINTS).toString(), null)); } this.dnmgr = new StreamingContainerManager(dag); this.umbilical = new UmbilicalProtocolLocalImpl(); }
Source:
<code>public void testObtainRegistrationId() { SwrveConfig swrveConfig = new SwrveConfig(); assertEquals(true, swrveConfig.isObtainRegistrationIdEnabled()); <START> swrveConfig.setAndroidIdLoggingEnabled(false); <END> assertEquals(false, swrveConfig.isObtainRegistrationIdEnabled()); }</code><technical_language>Is this right</technical_language>

Target:
public void testObtainRegistrationId() { SwrveConfig swrveConfig = new SwrveConfig(); assertEquals(true, swrveConfig.isPushRegistrationAutomatic()); swrveConfig.setPushRegistrationAutomatic(false); assertEquals(false, swrveConfig.isPushRegistrationAutomatic()); }
Source:
<code>private void runOneIteration() { ShardAndStrategy shardStrategy = ShardAndStrategy.of(getShardAndIncrement(), sweepStrategy); try { sweepNextBatch(shardStrategy); } catch (Throwable th) { <START> log.error("Targeted sweep for failed and will be retried later.", <END> SafeArg.of("shardStrategy", shardStrategy.toText()), th); } }</code><technical_language>guaranteed try next shardStrategy next time? test it: like: when(sweepNextBatch(any()).thenFail().thenReturn() verifying arguments sweepNextBatch() calls same</technical_language>

Target:
private void runOneIteration() { ShardAndStrategy shardStrategy = ShardAndStrategy.of(lockNextShardToSweep(), sweepStrategy); try { sweepNextBatch(shardStrategy); } catch (Throwable th) { log.warn("Targeted sweep for failed and will be retried later.", SafeArg.of("shardStrategy", shardStrategy.toText()), th); } finally { unlockShard(shardStrategy.shard()); } }
Source:
<code>@Override public Set<T> get() { List<T> result = new ArrayList<T>(); for (SetBinding<T> setBinding = this; setBinding != null; setBinding = setBinding.parent) { <START> for (Binding<?> contributor : setBinding.contributors) { <END> Object contribution = contributor.get(); if (contributor.provideKey.equals(provideKey)) { result.addAll((Set<T>) contribution); } else { result.add((T) contribution); } } } return Collections.unmodifiableSet(new LinkedHashSet<T>(result)); }</code><technical_language>save iterator index loop</technical_language>

Target:
@Override public Set<T> get() { List<T> result = new ArrayList<T>(); for (SetBinding<T> setBinding = this; setBinding != null; setBinding = setBinding.parent) { for (int i = 0, size = setBinding.contributors.size(); i < size; i++) { Binding<?> contributor = setBinding.contributors.get(i); Object contribution = contributor.get(); if (contributor.provideKey.equals(provideKey)) { result.addAll((Set<T>) contribution); } else { result.add((T) contribution); } } } return Collections.unmodifiableSet(new LinkedHashSet<T>(result)); }
Source:
<code>public void onClick(View view) { if (view.getId() == R.id.email_provider) { if (mActivityHelper.getFlowParams().isReauth) { String reauthEmail = mActivityHelper.getFlowParams().reauthEmail; if (reauthEmail == null) { <START> Log.e(TAG, "Attempting to reauth with email but no reauthEmail provided"); <END> return; } startActivityForResult( WelcomeBackPasswordPrompt.createIntent( this, mActivityHelper.getFlowParams(), new IdpResponse( AuthUI.EMAIL_PROVIDER, reauthEmail)), RC_EMAIL_DIRECT_SIGN_IN); } else { startActivityForResult( RegisterEmailActivity.createIntent(this, mActivityHelper.getFlowParams()), RC_EMAIL_FLOW); } } }</code><technical_language>I build() method prevent this throw IllegalArgumentException if dev do this</technical_language>

Target:
public void onClick(View view) { if (view.getId() == R.id.email_provider) { startActivityForResult( RegisterEmailActivity.createIntent(this, mActivityHelper.getFlowParams()), RC_EMAIL_FLOW); } }
Source:
<code>public void writeUTF(String s) { int startPos = skipIntSize(); int localPos = pos; byte[] localBuf = bytes; int strlen = s.length(); int c = 0; int i=0; for (i=0; i<strlen; i++) { c = s.charAt(i); if (!((c >= 0x0001) && (c <= 0x007F))) break; if(localPos == bytes.length) { pos = localPos; ensureCapacity(1); localBuf = bytes; } localBuf[localPos++] = (byte) c; } for (;i < strlen; i++){ c = s.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { if(localPos == bytes.length) { pos = localPos; ensureCapacity(1); localBuf = bytes; } localBuf[localPos++] = (byte) c; } else if (c > 0x07FF) { if(localPos+3 >= bytes.length) { pos = localPos; ensureCapacity(3); localBuf = bytes; } localBuf[localPos++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); localBuf[localPos++] = (byte) (0x80 | ((c >> 6) & 0x3F)); <START> localBuf[localPos++] = (byte) (0x80 | ((c >> 0) & 0x3F)); <END> } else { if(localPos + 2 >= bytes.length) { pos = localPos; ensureCapacity(2); localBuf = bytes; } localBuf[localPos++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); localBuf[localPos++] = (byte) (0x80 | ((c >> 0) & 0x3F)); } } pos = localPos; writeIntDirect(localPos - 4 - startPos, startPos); }</code><technical_language>need for >> 0</technical_language>

Target:
public void writeUTF(String s) { int startPos = skipIntSize(); int localPos = pos; byte[] localBuf = bytes; int strlen = s.length(); int c = 0; int i=0; for (i=0; i<strlen; i++) { c = s.charAt(i); if (!((c >= 0x0001) && (c <= 0x007F))) break; if(localPos == bytes.length) { pos = localPos; ensureCapacity(1); localBuf = bytes; } localBuf[localPos++] = (byte) c; } for (;i < strlen; i++){ c = s.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { if(localPos == bytes.length) { pos = localPos; ensureCapacity(1); localBuf = bytes; } localBuf[localPos++] = (byte) c; } else if (c > 0x07FF) { if(localPos+3 >= bytes.length) { pos = localPos; ensureCapacity(3); localBuf = bytes; } localBuf[localPos++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); localBuf[localPos++] = (byte) (0x80 | ((c >> 6) & 0x3F)); localBuf[localPos++] = (byte) (0x80 | (c & 0x3F)); } else { if(localPos + 2 >= bytes.length) { pos = localPos; ensureCapacity(2); localBuf = bytes; } localBuf[localPos++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); localBuf[localPos++] = (byte) (0x80 | (c & 0x3F)); } } pos = localPos; writeIntDirect(localPos - 4 - startPos, startPos); }
Source:
<code>public Query createAndStartQuery(final String queryId, final ApplicationInfo applicationInfo, final DAG<ConfigVertex, MISTEdge> configDag) throws ClassNotFoundException, IOException { final Query query = new DefaultQueryImpl(queryId); groupAllocationTableModifier.addEvent(new WritingEvent(WritingEvent.EventType.QUERY_ADD, new Tuple<>(applicationInfo, query))); <START> final Group group = applicationInfo.getGroups().get(0); <END> group.getQueryStarter().start(queryId, query, configDag, applicationInfo.getJarFilePath()); return query; }</code><technical_language>random select here</technical_language>

Target:
public Query createAndStartQuery(final String queryId, final ApplicationInfo applicationInfo, final DAG<ConfigVertex, MISTEdge> configDag) throws ClassNotFoundException, IOException { final Query query = new DefaultQueryImpl(queryId); groupAllocationTableModifier.addEvent(new WritingEvent(WritingEvent.EventType.QUERY_ADD, new Tuple<>(applicationInfo, query))); final Group group = applicationInfo.getRandomGroup(); group.getQueryStarter().start(queryId, query, configDag, applicationInfo.getJarFilePath()); return query; }
Source:
<code>public void addProfile(ProfileService profile) { <START> Message m = mHandler.obtainMessage(MESSAGE_PROFILE_SERVICE_STATE_CHANGED); m.obj = profile; m.arg1 = MESSAGE_PROFILE_REGISTERED; <END> mHandler.sendMessage(m); }</code><technical_language>This done call obtainMessage(what, arg1, arg2, obj)</technical_language>

Target:
public void addProfile(ProfileService profile) { Message m = mHandler.obtainMessage(MESSAGE_PROFILE_SERVICE_REGISTERED, profile); mHandler.sendMessage(m); }
Source:
<code>public void setPageSource(IPageSource pageSource) { if (provision != null) { throw new IllegalStateException( <START> "A provision was already been done. The provider can be forcefully detached or a new one needs to be used to provide using this page source."); <END> } this.pageSource = pageSource; }</code><technical_language>bad, I meant say: "to able **change** page source". I improve this exception message</technical_language>

Target:
public void setPageSource(IPageSource pageSource) { if (provision != null) { throw new IllegalStateException("A page was already provided."); } this.pageSource = pageSource; }
Source:
<code>public ChangeInfo apply(RevisionResource rsrc, Input input) throws BadRequestException, ResourceConflictException, EmailException, OrmException, ResourceNotFoundException, IOException { if (Strings.isNullOrEmpty(input.message)) { throw new BadRequestException("message must be non-empty"); } final Repository git; try { git = gitManager.openRepository(rsrc.getChange().getProject()); } catch (RepositoryNotFoundException e) { throw new ResourceNotFoundException(e.getMessage()); } try { return json.format(ChangeUtil.editCommitMessage( rsrc.getPatchSet().getId(), rsrc.getControl().getRefControl(), (IdentifiedUser) rsrc.getControl().getCurrentUser(), input.message, dbProvider.get(), commitMessageEditedSenderFactory, git, myIdent, patchSetInserterFactory)); } catch (InvalidChangeOperationException e) { throw new BadRequestException(e.getMessage()); } catch (MissingObjectException e) { throw new ResourceConflictException(e.getMessage()); } catch (IncorrectObjectTypeException e) { throw new ResourceConflictException(e.getMessage()); } catch (PatchSetInfoNotAvailableException e) { throw new ResourceConflictException(e.getMessage()); } catch (NoSuchChangeException e) { <START> throw new ResourceNotFoundException(e.getMessage()); <END> } finally { git.close(); } }</code><technical_language>This a message, takes id of resource is missing. I no-arg constructor</technical_language>

Target:
public ChangeInfo apply(RevisionResource rsrc, Input input) throws BadRequestException, ResourceConflictException, EmailException, OrmException, ResourceNotFoundException, IOException { if (Strings.isNullOrEmpty(input.message)) { throw new BadRequestException("message must be non-empty"); } final Repository git; try { git = gitManager.openRepository(rsrc.getChange().getProject()); } catch (RepositoryNotFoundException e) { throw new ResourceNotFoundException(e.getMessage()); } try { return json.format(ChangeUtil.editCommitMessage( rsrc.getPatchSet().getId(), rsrc.getControl().getRefControl(), (IdentifiedUser) rsrc.getControl().getCurrentUser(), input.message, dbProvider.get(), commitMessageEditedSenderFactory, git, myIdent, patchSetInserterFactory)); } catch (InvalidChangeOperationException e) { throw new BadRequestException(e.getMessage()); } catch (MissingObjectException e) { throw new ResourceConflictException(e.getMessage()); } catch (IncorrectObjectTypeException e) { throw new ResourceConflictException(e.getMessage()); } catch (PatchSetInfoNotAvailableException e) { throw new ResourceConflictException(e.getMessage()); } catch (NoSuchChangeException e) { throw new ResourceNotFoundException(); } finally { git.close(); } }
Source:
<code>private <R> R performWithConnection(Function<Object, R> function) { connectionSupplier = getConnectionSupplier(); Object connection = getConnection(connectionSupplier); try { R result = function.apply(connection); connectionSupplier.close(); return result; } catch (Exception e) { if (isFirstPage) { silentlyCloseDelegate(connection); } <START> extractConnectionException(e).ifPresent(ex -> connectionSupplier.invalidateConnection()); <END> throw e; } }</code><technical_language>fixed. If this fails, original exception get swallowed</technical_language>

Target:
private <R> R performWithConnection(Function<Object, R> function) { ConnectionSupplier connectionSupplier = getConnectionSupplier(); Object connection = getConnection(connectionSupplier); try { R result = function.apply(connection); return result; } catch (Exception exception) { if (isFirstPage) { safely(() -> delegate.close(connection), e -> LOGGER.debug("Found exception closing paging provider", e)); } extractConnectionException(exception).ifPresent(ex -> connectionSupplier.invalidateConnection()); throw exception; } finally { safely(connectionSupplier::close, e -> LOGGER.debug("Found exception closing the connection supplier", e)); } }
Source:
<code>protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__DEACTIVATE); <START> addCanDoActionMessage(VdcBllMessages.VAR__TYPE__INTERFACE); <END> }</code><technical_language>HotPlugUnplugVmNic Command is for Plug ("Activate") UnPlug ("Deactivate") actions. Therefore, I ActionMessageParameters set "Action" property HotPlugUnplugVmNicParameters class: If getAction() is PlugAction.PLUG, CanDoActionMessages array-list added "VAR__ACTION__ACTIVATE" message ("activate"). If getAction() is PlugAction.UNPLUG, CanDoActionMessages array-list added "VAR__ACTION__DEACTIVATE" message ("deactivate"). [worth consulting engine-core maintainer this]</technical_language>

Target:
protected void setActionMessageParameters() { addCanDoActionMessage((getParameters().getAction() == PlugAction.PLUG) ? VdcBllMessages.VAR__ACTION__ACTIVATE : VdcBllMessages.VAR__ACTION__DEACTIVATE); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__INTERFACE); }
Source:
<code>public void initialize() { String updateModel = (String) getThing().getConfiguration().get(MagicBindingConstants.UPDATE_MODEL_PROPERTY); switch (updateModel) { case MagicBindingConstants.MODEL_ID_ABRACADABRA: <START> case MagicBindingConstants.MODEL_ID_SIMSALABIN: <END> case MagicBindingConstants.MODEL_ID_PREPARATUS: getThing().setProperty(Thing.PROPERTY_MODEL_ID, updateModel); } updateStatus(ThingStatus.ONLINE); }</code><technical_language>is point of this switch statement</technical_language>

Target:
public void initialize() { String updateModel = (String) getThing().getConfiguration().get(MagicBindingConstants.UPDATE_MODEL_PROPERTY); switch (updateModel) { case MagicBindingConstants.MODEL_ALOHOMORA: case MagicBindingConstants.MODEL_COLLOPORTUS: case MagicBindingConstants.MODEL_LUMOS: case MagicBindingConstants.MODEL_NOX: getThing().setProperty(Thing.PROPERTY_MODEL_ID, updateModel); } updateStatus(ThingStatus.ONLINE); }
Source:
<code>public void testBearerToken() throws Exception { MockEndpoint mockEndpoint = getMockEndpoint("mock:myapp"); mockEndpoint.expectedHeaderReceived(Exchange.HTTP_METHOD, "POST"); <START> LOG.debug("Number of exchanges in mock:myapp " + mockEndpoint.getExchanges().size()); <END> String response = template.requestBodyAndHeader("elytron:http://localhost:{{port}}/myapp", "empty body", Headers.AUTHORIZATION.toString(), "Bearer " + createToken("alice", "user", new Date(new Date().getTime() + 10000), getKeyPair().getPrivate()), String.class); assertNotNull(response); assertEquals("Hello alice!", response); }</code><technical_language>I route mock:myapp assertions mock. 3 lines removed (or extended routebuilder fill mock endpoint)? in test</technical_language>

Target:
public void testBearerToken() throws Exception { String response = template.requestBodyAndHeader("elytron:http://localhost:{{port}}/myapp", "empty body", Headers.AUTHORIZATION.toString(), "Bearer " + createToken("alice", "user", new Date(new Date().getTime() + 10000), getKeyPair().getPrivate()), String.class); assertNotNull(response); assertEquals("Hello alice!", response); }
Source:
<code>public void onClickOnValue(String UId) { <START> DashboardActivity.dashboardActivity.hideReview(UId); <END> }</code><technical_language>Presenter invoke presentation object. invoke methods of ReviewView communicate presentation layer. add navigateToQuestion(String uid) ReviewView</technical_language>

Target:
public void onClickOnValue(String UId) { view.navigateToQuestion(UId); }
Source:
<code>public void showSkipImageInfo(){ DialogUtil.showAlertDialog(ReviewActivity.this, getString(R.string.skip_image), getString(R.string.skip_image_explanation), getString(R.string.about_translate_proceed), getString(android.R.string.cancel), <START> () -> runRandomizer(),null); <END> }</code><technical_language>I easier (based behaviour of other information icons in app - achievements nearby tab for examples), 'okay' button dismisses - skip image clicking 'proceed'. In case remove cancel button, change positive text android.R.string.ok</technical_language>

Target:
public void showSkipImageInfo(){ DialogUtil.showAlertDialog(ReviewActivity.this, getString(R.string.skip_image), getString(R.string.skip_image_explanation), getString(android.R.string.ok), "", null, null); }
Source:
<code>public static ConcurrentOption valueFromName(String name) { for(ConcurrentOption option: ConcurrentOption.values()) { if(option.name.equals(name)) { return option; } } <START> throw new IllegalArgumentException("No ConcurrentOption for name " + name); <END> }</code><technical_language>for log message</technical_language>

Target:
public static FailureAction valueFromName(String name) { for(FailureAction action: FailureAction.values()) { if(action.name.equals(name)) { return action; } } throw new IllegalArgumentException("No FailureAction for name " + name); }
Source:
<code>private void executorFinished(final RollupExecutor.FinishRollupMessage message) { final Optional<Throwable> failure = message.getFailure(); _periodicMetrics.recordCounter("rollup/manager/executor_finished/success", failure.isPresent() ? 0 : 1); if (!failure.isPresent()) { return; } final boolean isRetryable = RollupPartitioningUtils.mightSplittingFixFailure(failure.get()); _periodicMetrics.recordCounter("rollup/manager/executor_finished/unretriable", isRetryable ? 0 : 1); if (!isRetryable) { LOGGER.warn() .setMessage("giving up after non-retryable error") .addData("rollupDefinition", message.getRollupDefinition()) .setThrowable(failure.get()) .log(); return; } <START> <END> final ImmutableSet<RollupDefinition> subjobs; try { subjobs = RollupPartitioningUtils.splitJob(message.getRollupDefinition()); _periodicMetrics.recordCounter("rollup/manager/executor_finished/unsplittable", 0); } catch (final RollupPartitioningUtils.CannotSplitException e) { _periodicMetrics.recordCounter("rollup/manager/executor_finished/unsplittable", 1); LOGGER.error() .setMessage("giving up on job that can't be split any more") .addData("rollupDefinition", message.getRollupDefinition()) .setThrowable(failure.get()) .log(); return; } subjobs.forEach(subjob -> getSelf().tell(subjob, getSelf())); }</code><technical_language>a minimum log metrics retrying/splitting. Ideally a metric metricname if concerned cardinality logging. idea is this inform want if switched pre-splitting configuration some other mechanism</technical_language>

Target:
private void executorFinished(final RollupExecutor.FinishRollupMessage message) { try (Metrics metrics = _metricsFactory.create()) { metrics.addAnnotation("rollup_metric", message.getRollupDefinition().getDestinationMetricName()); metrics.incrementCounter("rollup/manager/executor_finished", 1); final Optional<Throwable> failure = message.getFailure(); if (!failure.isPresent()) { metrics.addAnnotation("outcome", "success"); return; } final boolean isRetryable = _partitioner.mightSplittingFixFailure(failure.get()); if (!isRetryable) { LOGGER.warn() .setMessage("giving up after non-retryable error") .addData("rollupDefinition", message.getRollupDefinition()) .setThrowable(failure.get()) .log(); metrics.addAnnotation("outcome", "non_retryable_error"); return; } final ImmutableSet<RollupDefinition> children; try { children = _partitioner.splitJob(message.getRollupDefinition()); } catch (final RollupPartitioner.CannotSplitException e) { LOGGER.error() .setMessage("giving up on job that can't be split any more") .addData("rollupDefinition", message.getRollupDefinition()) .setThrowable(failure.get()) .log(); metrics.addAnnotation("outcome", "unable_to_split"); return; } LOGGER.info() .setMessage("splitting and retrying job") .addData("parent", message.getRollupDefinition()) .addData("children", children) .setThrowable(failure.get()) .log(); metrics.addAnnotation("outcome", "split_and_retry"); children.forEach(child -> getSelf().tell(child, getSelf())); } }
Source:
<code>public void addFieldInNewModel(JSONObject m, JSONObject field) { assert(isModelNew(m)); _addField(m, field); <START> } <END></code><technical_language>Cool!!! I this idea of assertions clean exception handling code affecting safety</technical_language>

Target:
public void addFieldInNewModel(JSONObject m, JSONObject field) { Assert.that(isModelNew(m), "Model was assumed to be new, but is not"); _addField(m, field); }
Source:
<code>public Frame decorrelateRel(Join rel) { if (!rel.getJoinType().projectsRight()) { return decorrelateRel((RelNode) rel); } final RelNode oldLeft = rel.getInput(0); final RelNode oldRight = rel.getInput(1); final Frame leftFrame = getInvoke(oldLeft, rel); final Frame rightFrame = getInvoke(oldRight, rel); if (leftFrame == null || rightFrame == null) { return null; } final RelNode newJoin = relBuilder .push(leftFrame.r) .push(rightFrame.r) .join(rel.getJoinType(), decorrelateExpr(currentRel, map, cm, rel.getCondition()), <START> ImmutableSet.<CorrelationId>of()) <END> .build(); Map<Integer, Integer> mapOldToNewOutputs = new HashMap<>(); int oldLeftFieldCount = oldLeft.getRowType().getFieldCount(); int newLeftFieldCount = leftFrame.r.getRowType().getFieldCount(); int oldRightFieldCount = oldRight.getRowType().getFieldCount(); assert rel.getRowType().getFieldCount() == oldLeftFieldCount + oldRightFieldCount; mapOldToNewOutputs.putAll(leftFrame.oldToNewOutputs); for (int i = 0; i < oldRightFieldCount; i++) { mapOldToNewOutputs.put(i + oldLeftFieldCount, rightFrame.oldToNewOutputs.get(i) + newLeftFieldCount); } final SortedMap<CorDef, Integer> corDefOutputs = new TreeMap<>(leftFrame.corDefOutputs); for (Map.Entry<CorDef, Integer> entry : rightFrame.corDefOutputs.entrySet()) { corDefOutputs.put(entry.getKey(), entry.getValue() + newLeftFieldCount); } return register(rel, newJoin, mapOldToNewOutputs, corDefOutputs); }</code><technical_language>type inferred</technical_language>

Target:
public Frame decorrelateRel(Join rel) { if (!rel.getJoinType().projectsRight()) { return decorrelateRel((RelNode) rel); } final RelNode oldLeft = rel.getInput(0); final RelNode oldRight = rel.getInput(1); final Frame leftFrame = getInvoke(oldLeft, rel); final Frame rightFrame = getInvoke(oldRight, rel); if (leftFrame == null || rightFrame == null) { return null; } final RelNode newJoin = relBuilder .push(leftFrame.r) .push(rightFrame.r) .join(rel.getJoinType(), decorrelateExpr(currentRel, map, cm, rel.getCondition()), ImmutableSet.of()) .build(); Map<Integer, Integer> mapOldToNewOutputs = new HashMap<>(); int oldLeftFieldCount = oldLeft.getRowType().getFieldCount(); int newLeftFieldCount = leftFrame.r.getRowType().getFieldCount(); int oldRightFieldCount = oldRight.getRowType().getFieldCount(); assert rel.getRowType().getFieldCount() == oldLeftFieldCount + oldRightFieldCount; mapOldToNewOutputs.putAll(leftFrame.oldToNewOutputs); for (int i = 0; i < oldRightFieldCount; i++) { mapOldToNewOutputs.put(i + oldLeftFieldCount, rightFrame.oldToNewOutputs.get(i) + newLeftFieldCount); } final SortedMap<CorDef, Integer> corDefOutputs = new TreeMap<>(leftFrame.corDefOutputs); for (Map.Entry<CorDef, Integer> entry : rightFrame.corDefOutputs.entrySet()) { corDefOutputs.put(entry.getKey(), entry.getValue() + newLeftFieldCount); } return register(rel, newJoin, mapOldToNewOutputs, corDefOutputs); }
Source:
<code>protected DatastaxCassandraOrganisationStore( Session session, ConsistencyLevel writeConsistency, ConsistencyLevel readConsistency, OrganisationUriStore uriStore, MetricRegistry metricRegistry, String metricPrefix ) { this.session = checkNotNull(session); this.readConsistency = checkNotNull(readConsistency); this.serializer = new OrganisationSerializer(); this.writeConsistency = checkNotNull(writeConsistency); this.organisationUriStore = uriStore; RegularStatement statement = select().all() .from(ORGANISATION_TABLE) .where(in(PRIMARY_KEY_COLUMN, bindMarker(KEYS))); statement.setFetchSize(Integer.MAX_VALUE); selectStatement = session.prepare(statement); rowUpdate = session.prepare(update(ORGANISATION_TABLE) .where(eq(PRIMARY_KEY_COLUMN, bindMarker(ORGANISATION_ID))) .with(set(DATA_COLUMN, bindMarker(DATA)))) .setConsistencyLevel(writeConsistency); this.metricRegistry = metricRegistry; <START> write = metricPrefix + "write"; <END> }</code><technical_language>Trailing dot</technical_language>

Target:
protected DatastaxCassandraOrganisationStore( Session session, ConsistencyLevel writeConsistency, ConsistencyLevel readConsistency, OrganisationUriStore uriStore, MetricRegistry metricRegistry, String metricPrefix ) { this.session = checkNotNull(session); this.readConsistency = checkNotNull(readConsistency); this.serializer = new OrganisationSerializer(); this.writeConsistency = checkNotNull(writeConsistency); this.organisationUriStore = uriStore; RegularStatement statement = select().all() .from(ORGANISATION_TABLE) .where(in(PRIMARY_KEY_COLUMN, bindMarker(KEYS))); statement.setFetchSize(Integer.MAX_VALUE); selectStatement = session.prepare(statement); rowUpdate = session.prepare(update(ORGANISATION_TABLE) .where(eq(PRIMARY_KEY_COLUMN, bindMarker(ORGANISATION_ID))) .with(set(DATA_COLUMN, bindMarker(DATA)))) .setConsistencyLevel(writeConsistency); this.metricRegistry = metricRegistry; write = metricPrefix + "write."; }
Source:
<code>private void createDiskBasedOnImage() { AddImageFromScratchParameters parameters = new AddImageFromScratchParameters(Guid.Empty, getParameters().getVmId(), (DiskImage) getParameters().getDiskInfo()); parameters.setQuotaId(getParameters().getQuotaId()); parameters.setStorageDomainId(getStorageDomainId().getValue()); parameters.setParentCommand(VdcActionType.AddDisk); parameters.setEntityId(getParameters().getEntityId()); parameters.setStoragePoolId(getStorageDomain().getstorage_pool_id().getValue()); getParameters().getImagesParameters().add(parameters); parameters.setParentParemeters(getParameters()); if (getVm() != null) { setVmSnapshotIdForDisk(parameters); VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false, <START> ""); <END> } VdcReturnValueBase tmpRetValue = Backend.getInstance().runInternalAction(VdcActionType.AddImageFromScratch, parameters, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); getReturnValue().getTaskIdList().addAll(tmpRetValue.getInternalTaskIdList()); if (tmpRetValue.getActionReturnValue() != null) { DiskImage diskImage = (DiskImage) tmpRetValue.getActionReturnValue(); addDiskPermissions(diskImage); getReturnValue().setActionReturnValue(diskImage.getId()); } getReturnValue().setFault(tmpRetValue.getFault()); setSucceeded(tmpRetValue.getSucceeded()); }</code><technical_language>please remove alias setting (should encapsulated in addManagedDevice</technical_language>

Target:
private void createDiskBasedOnImage() { AddImageFromScratchParameters parameters = new AddImageFromScratchParameters(Guid.Empty, getParameters().getVmId(), (DiskImage) getParameters().getDiskInfo()); parameters.setQuotaId(getParameters().getQuotaId()); parameters.setStorageDomainId(getStorageDomainId().getValue()); parameters.setParentCommand(VdcActionType.AddDisk); parameters.setEntityId(getParameters().getEntityId()); parameters.setStoragePoolId(getStorageDomain().getstorage_pool_id().getValue()); getParameters().getImagesParameters().add(parameters); parameters.setParentParemeters(getParameters()); if (getVm() != null) { setVmSnapshotIdForDisk(parameters); VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), VmDeviceType.DISK, VmDeviceType.DISK, null, true, false); } VdcReturnValueBase tmpRetValue = Backend.getInstance().runInternalAction(VdcActionType.AddImageFromScratch, parameters, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); getReturnValue().getTaskIdList().addAll(tmpRetValue.getInternalTaskIdList()); if (tmpRetValue.getActionReturnValue() != null) { DiskImage diskImage = (DiskImage) tmpRetValue.getActionReturnValue(); addDiskPermissions(diskImage); getReturnValue().setActionReturnValue(diskImage.getId()); } getReturnValue().setFault(tmpRetValue.getFault()); setSucceeded(tmpRetValue.getSucceeded()); }
Source:
<code>public TreeExplorer.View addItem(final String uuid, final String parentsUuid, final String name, final IsWidget icon, final boolean isContainer, final boolean state, final OptionalInt index) { checkNotExist(uuid); final TreeItem.Type itemType = isContainer ? TreeItem.Type.CONTAINER : TreeItem.Type.ITEM; final TreeItem item = buildItem(uuid, name, icon, itemType); final TreeItem parent = tree.getItemByUuid(parentsUuid); parent.addItem(itemType, uuid, name, icon); <START> index.ifPresent(ind -> { <END> final int count = parent.getChildCount(); final LinkedList<TreeItem> children = IntStream.iterate(count - 2, i -> i - 1).limit(count - ind - 1) .mapToObj((IntFunction<TreeItem>) parent::getChild).collect(Collectors.toCollection(LinkedList::new)); if (!children.isEmpty()) { children.stream().forEachOrdered(parent::removeItem); Collections.reverse(children); children.stream().forEachOrdered(parent::addItem); } }); parent.setState(getState(state)); item.setState(getState(state)); return this; }</code><technical_language>line parent.addItem, adding item parent, index is present, sense? some conditional expression instead</technical_language>

Target:
public TreeExplorer.View addItem(final String uuid, final String parentsUuid, final String name, final IsWidget icon, final boolean isContainer, final boolean state, final OptionalInt index) { checkNotExist(uuid); final TreeItem.Type itemType = isContainer ? TreeItem.Type.CONTAINER : TreeItem.Type.ITEM; final TreeItem item = buildItem(uuid, name, icon, itemType); final TreeItem parent = tree.getItemByUuid(parentsUuid); if (index.isPresent()) { parent.insertItem(item, index.getAsInt()); } else { parent.addItem(item); } parent.setState(getState(state)); item.setState(getState(state)); return this; }
Source:
<code>public Future<?> execute(final Runnable callback) { int numRetries = MAX_NUM_RETRIES; <START> while (true) { <END> try { if (!syncInit && numRetries == 0) { break; } callback.run(); break; } catch (Exception e) { try { numRetries --; units.sleep(interval); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); return Futures.immediateFailure(e); } } } return executor.scheduleWithFixedDelay(new Runnable() { @Override public void run() { try { callback.run(); } catch (Exception e) { LOG.warn("Failed to load properties", e); } } }, interval, interval, units); }</code><technical_language>This a bit awkward in numRetries update condition check disconnected. This read java do { try { callback.run(); break; } catch (Exception e) { if (--numRetries == 0) { return Futures.immediateFailure(e); } try { units.sleep(interval); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); return Futures.immediateFailure(e); } } }while (syncInit);</technical_language>

Target:
public Future<?> execute(final Runnable callback) { while (true) { try { callback.run(); break; } catch (Exception e) { try { LOG.warn("Fail to poll the polling source", e); units.sleep(interval); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); return Futures.immediateFailure(e); } } } return executor.scheduleWithFixedDelay(new Runnable() { @Override public void run() { try { callback.run(); } catch (Exception e) { LOG.warn("Failed to load properties", e); } } }, interval, interval, units); }
Source:
<code>public String render(final GetCacheStateResult obj) { this.filesystemList = obj.getResult(); <START> if ((this.filesystemList == null) || (Guard.isNullOrEmpty(this.filesystemList)) ){ <END> return "No Cache Filesystems reported."; } initTable(ImmutableList.of("Path", "Available Capacity", "Used Capacity", "Unavailable Capacity", "Total Capacity", "Max Capacity", "Auto Reclaim Threshold", "Burst Threshold", "Max Utilization", "ID", "Node ID")); return ASCIITable.getInstance().getTable(getHeaders(), formatTableContents()); }</code><technical_language>null check is needed guard</technical_language>

Target:
public String render(final GetCacheStateResult obj) { this.filesystemList = obj.getResult(); if (Guard.isNullOrEmpty(this.filesystemList)){ return "No Cache Filesystems reported."; } initTable(ImmutableList.of("Path", "Available Capacity", "Used Capacity", "Unavailable Capacity", "Total Capacity", "Max Capacity", "Auto Reclaim Threshold", "Burst Threshold", "Max Utilization", "ID", "Node ID")); return ASCIITable.getInstance().getTable(getHeaders(), formatTableContents()); }
Source:
<code>public int getFrameTime() { <START> String saved = TheApp.getCurrentVersionPreferences().get("FrameRate", String.valueOf(frameRate)); <END> if (saved!= null) frameRate = Integer.parseInt(saved); TheApp.getCurrentVersionPreferences().put("FrameRate", String.valueOf(frameRate)); return frameRate; }</code><technical_language>"Internal.FrameRate"</technical_language>

Target:
public int getFrameTime() { String saved = TheApp.getCurrentVersionPreferences().get("Internal.FrameRate", String.valueOf(frameRate)); if (saved!= null) frameRate = Integer.parseInt(saved); TheApp.getCurrentVersionPreferences().put("Internal.FrameRate", String.valueOf(frameRate)); return frameRate; }
Source:
<code>public void process(Element elm, JID actorJID, IQ reqIQ, Element rsm) throws Exception { request = reqIQ; <START> String node = elm.attributeValue(XMLConstants.NAME_ELEM); <END> if (null == node) { createExtendedErrorReply(PacketError.Type.modify, PacketError.Condition.bad_request, XMLConstants.NODE_ID_REQUIRED); outQueue.put(response); return; } if (-1 == node.indexOf("@")) { specialItems.process(elm, actorJID, reqIQ, rsm); return; } userItems.process(elm, actorJID, reqIQ, rsm); }</code><technical_language>this NODE_ELEM</technical_language>

Target:
public void process(Element elm, JID actorJID, IQ reqIQ, Element rsm) throws Exception { request = reqIQ; String node = elm.attributeValue(XMLConstants.NODE_ATTR); if (null == node) { createExtendedErrorReply(PacketError.Type.modify, PacketError.Condition.bad_request, XMLConstants.NODE_ID_REQUIRED); outQueue.put(response); return; } if (-1 == node.indexOf("@")) { specialItems.process(elm, actorJID, reqIQ, rsm); return; } userItems.process(elm, actorJID, reqIQ, rsm); }
Source:
<code>public void testGetUriByFilenameFindsResourceRelativeToRootClasspath() throws Exception { final String filename = "commonutil/InputCommonUtilTest_resource.txt"; final URI uri = CommonUtil.getUriByFilename(filename); assertThat("URI is null for: " + filename, uri, is(not(nullValue()))); assertThat("URI contains com/puppycrawl/tools/checkstyle/utils", <START> uri.toString(), not(containsString("com/puppycrawl/tools/checkstyle/utils"))); <END> final ByteArrayOutputStream out = new ByteArrayOutputStream(); try (InputStream in = uri.toURL().openStream()) { IOUtils.copy(in, out); } assertThat("Content mismatches for: " + uri, new String(out.toByteArray(), StandardCharsets.UTF_8), startsWith("good")); }</code><technical_language>validating path of URI? Current assetions be</technical_language>

Target:
public void testGetUriByFilenameFindsResourceRelativeToRootClasspath() throws Exception { final String filename = getPackageLocation() + "/InputCommonUtilTest_resource.txt"; final URI uri = CommonUtil.getUriByFilename(filename); assertThat("URI is null for: " + filename, uri, is(not(nullValue()))); final String uriRelativeToPackage = "com/puppycrawl/tools/checkstyle/utils/" + getPackageLocation() + "/InputCommonUtilTest_resource.txt"; assertThat("URI is relative to package " + uriRelativeToPackage, uri.toString(), not(containsString(uriRelativeToPackage))); final String content = IOUtils.toString(uri.toURL(), StandardCharsets.UTF_8); assertThat("Content mismatches for: " + uri, content, startsWith("good")); }
Source:
<code>static Task generateFromTestGroup(JParallelTestsGroup jParallelTestsGroup, boolean monitoringEnabled) { CompositeTask compositeTask = new CompositeTask(); compositeTask.setLeading(new ArrayList<>()); compositeTask.setAttendant(new ArrayList<>()); compositeTask.setNumber(++number); compositeTask.setName(jParallelTestsGroup.getId() + "-group"); for (JLoadTest test : jParallelTestsGroup.getTests()) { WorkloadTask task = generateFromTest(test); <START> task.setNumber(number); <END> if (task.getTerminateStrategyConfiguration() instanceof InfiniteTerminationStrategyConfiguration) { compositeTask.getAttendant().add(task); } else { compositeTask.getLeading().add(task); } } if (monitoringEnabled) { MonitoringTask attendantMonitoring = new MonitoringTask(number, jParallelTestsGroup.getId() + " --- monitoring", jParallelTestsGroup.getId(), new InfiniteDuration()); compositeTask.getAttendant().add(attendantMonitoring); } return compositeTask; }</code><technical_language>compositeTask.getNumber please</technical_language>

Target:
static Task generateFromTestGroup(JParallelTestsGroup jParallelTestsGroup, boolean monitoringEnabled) { CompositeTask compositeTask = new CompositeTask(); compositeTask.setLeading(new ArrayList<>()); compositeTask.setAttendant(new ArrayList<>()); compositeTask.setNumber(++number); compositeTask.setName(jParallelTestsGroup.getId() + "-group"); for (JLoadTest test : jParallelTestsGroup.getTests()) { WorkloadTask task = generateFromTest(test); task.setNumber(compositeTask.getNumber()); if (task.getTerminateStrategyConfiguration() instanceof InfiniteTerminationStrategyConfiguration) { compositeTask.getAttendant().add(task); } else { compositeTask.getLeading().add(task); } } if (monitoringEnabled) { MonitoringTask attendantMonitoring = new MonitoringTask(compositeTask.getNumber(), jParallelTestsGroup.getId() + " --- monitoring", jParallelTestsGroup.getId(), new InfiniteDuration()); compositeTask.getAttendant().add(attendantMonitoring); } return compositeTask; }
Source:
<code>private Result<Subscription> createSubscriptionInternal(final SubscriptionBase subscriptionBase, final Client client) throws InternalNakadiException, DuplicatedSubscriptionException, ServiceUnavailableException { final Map<String, Optional<EventType>> eventTypeMapping = subscriptionBase.getEventTypes().stream() .collect(Collectors.toMap(Function.identity(), Try.wrap(eventTypeRepository::findByNameO).andThen(Try::getOrThrow))); final List<String> missingEventTypes = eventTypeMapping.entrySet().stream() .filter(entry -> !entry.getValue().isPresent()) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (!missingEventTypes.isEmpty()) { final Problem problem = Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, createMissingEventsErrorMessage(missingEventTypes)); return Result.problem(problem); } eventTypeMapping.values().stream() .filter(Optional::isPresent) .map(Optional::get) .forEach(eventType -> client.checkScopes(eventType.getReadScopes())); if (featureToggleService.isFeatureEnabled(DISABLE_SUBSCRIPTION_CREATION)) { try { <START> return Result.ok(getExistingSubscription(subscriptionBase)); <END> } catch (final NoSuchSubscriptionException e) { throw new ServiceUnavailableException("Subscription creation is temporarily unavailable", e); } } final Subscription subscription = subscriptionRepository.createSubscription(subscriptionBase); return Result.ok(subscription); }</code><technical_language>if return existing subscription - user get a wrong response code 201, created</technical_language>

Target:
private Result<Subscription> createSubscriptionInternal(final SubscriptionBase subscriptionBase, final Client client) throws InternalNakadiException, DuplicatedSubscriptionException, ServiceUnavailableException { final Map<String, Optional<EventType>> eventTypeMapping = subscriptionBase.getEventTypes().stream() .collect(Collectors.toMap(Function.identity(), Try.wrap(eventTypeRepository::findByNameO).andThen(Try::getOrThrow))); final List<String> missingEventTypes = eventTypeMapping.entrySet().stream() .filter(entry -> !entry.getValue().isPresent()) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (!missingEventTypes.isEmpty()) { final Problem problem = Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, createMissingEventsErrorMessage(missingEventTypes)); return Result.problem(problem); } eventTypeMapping.values().stream() .filter(Optional::isPresent) .map(Optional::get) .forEach(eventType -> client.checkScopes(eventType.getReadScopes())); final Subscription subscription = subscriptionRepository.createSubscription(subscriptionBase); return Result.ok(subscription); }
Source:
<code>protected boolean createVirtualenv(File virtualEnvDir) { CLog.d("Creating virtualenv at " + virtualEnvDir); String[] cmd = new String[] { "virtualenv", "-p", "python" + mPythonVersion, virtualEnvDir.getAbsolutePath()}; long waitRetryCreate = 5 * SECOND_IN_MSECS; for (int try_count = 0; try_count < PIP_RETRY + 1; try_count++) { if (try_count > 0) { getRunUtil().sleep(waitRetryCreate); } CommandResult c = <START> getRunUtil().runTimedCmd(10 * MINUTE_IN_MSECS, cmd); <END> if (!CommandStatus.SUCCESS.equals(c.getStatus())) { String message_lower = (c.getStdout() + c.getStderr()).toLowerCase(); if (message_lower.contains("errno 26") || message_lower.contains("text file busy")) { CLog.e("detected the virtualenv path is being created by other process."); } else { CLog.e("Exit code: %s, stdout: %s, stderr: %s", c.getStatus(), c.getStdout(), c.getStderr()); break; } } else { CLog.d("Successfully created virtualenv at " + virtualEnvDir); return true; } } return false; }</code><technical_language>option</technical_language>

Target:
protected boolean createVirtualenv(File virtualEnvDir) { CLog.d("Creating virtualenv at " + virtualEnvDir); String[] cmd = new String[] { "virtualenv", "-p", "python" + mPythonVersion, virtualEnvDir.getAbsolutePath()}; long waitRetryCreate = 5 * SECOND_IN_MSECS; for (int try_count = 0; try_count < PIP_RETRY + 1; try_count++) { if (try_count > 0) { getRunUtil().sleep(waitRetryCreate); } CommandResult c = getRunUtil().runTimedCmd( mVirtualEnvInstallationWaitTimeMinutes * MINUTE_IN_MSECS, cmd); if (!CommandStatus.SUCCESS.equals(c.getStatus())) { String message_lower = (c.getStdout() + c.getStderr()).toLowerCase(); if (message_lower.contains("errno 26") || message_lower.contains("text file busy")) { CLog.e("detected the virtualenv path is being created by other process."); } else { CLog.e("Exit code: %s, stdout: %s, stderr: %s", c.getStatus(), c.getStdout(), c.getStderr()); break; } } else { CLog.d("Successfully created virtualenv at " + virtualEnvDir); return true; } } return false; }
Source:
<code>public void testBadClient() throws Exception { MQTT mqtt = createMQTTConnection(); mqtt.setClientId(""); mqtt.setCleanSession(true); BlockingConnection connection = mqtt.blockingConnection(); connection.connect(); try { connection = mqtt.blockingConnection(); connection.connect(); fail("second connection shouldn't be allowed"); } catch (Exception e) { } NettyAcceptor acceptor = (NettyAcceptor) server.getRemotingService().getAcceptor("MQTT"); assertEquals(1, acceptor.getConnections().size()); RemotingConnection conn = server.getRemotingService().getConnections().iterator().next(); assertTrue(conn instanceof MQTTConnection); conn.fail(new ActiveMQException("testBadClient")); <START> assertEquals("Server connection not cleaned up!", 0, acceptor.getConnections().size()); <END> connection = mqtt.blockingConnection(); connection.connect(); connection.disconnect(); }</code><technical_language>Wait.assertEquals please? this is asynchronous operation eventual fail wait here</technical_language>

Target:
public void testBadClient() throws Exception { MQTT mqtt = createMQTTConnection(); mqtt.setClientId(""); mqtt.setCleanSession(true); BlockingConnection connection = mqtt.blockingConnection(); connection.connect(); try { connection = mqtt.blockingConnection(); connection.connect(); fail("second connection shouldn't be allowed"); } catch (Exception e) { } NettyAcceptor acceptor = (NettyAcceptor) server.getRemotingService().getAcceptor("MQTT"); assertEquals(1, acceptor.getConnections().size()); RemotingConnection conn = server.getRemotingService().getConnections().iterator().next(); assertTrue(conn instanceof MQTTConnection); conn.fail(new ActiveMQException("testBadClient")); Wait.assertEquals(0, ()->acceptor.getConnections().size()); connection = mqtt.blockingConnection(); connection.connect(); connection.disconnect(); }
Source:
<code>public JHttpResponse execute(JHttpEndpoint endpoint, JHttpQuery query) { setRestTemplateParamsForQuery(query); URI endpointURI = endpoint.getURI(query.getQueryParams()); if (endpoint.getProtocol() == HTTPS) { restTemplate.setRequestFactory(getSslAllTrustRequestFactory()); } <START> RequestEntity requestEntity = mapToRequestEntity(query, endpointURI); <END> ResponseEntity responseEntity = restTemplate.exchange(endpointURI, query.getMethod(), requestEntity, Object.class); restoreDefaultRestTemplateParams(); return mapToJHttpResponse(responseEntity); }</code><technical_language>is parametrised? is raw type is recommended</technical_language>

Target:
public JHttpResponse execute(JHttpEndpoint endpoint, JHttpQuery query) { URI endpointURI = endpoint.getURI(query.getPath(), query.getQueryParams()); RequestEntity requestEntity = mapToRequestEntity(query, endpointURI); ResponseEntity responseEntity; if (query.getResponseBodyType() != null) { responseEntity = restTemplate.exchange(endpointURI, query.getMethod(), requestEntity, query.getResponseBodyType()); } else { responseEntity = restTemplate.exchange(endpointURI, query.getMethod(), requestEntity, byte[].class); } return mapToJHttpResponse(responseEntity); }