auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<IWorker<ITestNGMethod>> createWorkers(Arguments arguments) { <START> List<IWorker<ITestNGMethod>> result = Lists.newArrayList(); <END> ListMultiMap<Object, ITestNGMethod> lmm = Maps.newSortedListMultiMap(); for (ITestNGMethod m : arguments.getMethods()) { lmm.put(m.getInstance(), m); } for (Map.Entry<Object, List<ITestNGMethod>> es : lmm.entrySet()) { List<IMethodInstance> methodInstances = MethodHelper.methodsToMethodInstances(es.getValue()); IMethodInstance[] mArray = methodInstances.toArray(new IMethodInstance[methodInstances.size()]); TestMethodWorker tmw = new TestMethodWorker(arguments.getInvoker(), mArray, arguments.getTestContext().getCurrentXmlTest().getSuite(), arguments.getTestContext().getCurrentXmlTest().getAllParameters(), arguments.getConfigMethods(), arguments.getClassMethodMap(), arguments.getTestContext(), arguments.getListeners()); result.add(tmw); } return result; }</code><technical_language>Clearer if declared 2nd loop</technical_language>

Target:
public List<IWorker<ITestNGMethod>> createWorkers(Arguments arguments) { ListMultiMap<Object, ITestNGMethod> lmm = Maps.newSortedListMultiMap(); for (ITestNGMethod m : arguments.getMethods()) { lmm.put(m.getInstance(), m); } List<IWorker<ITestNGMethod>> result = Lists.newArrayList(); for (Map.Entry<Object, List<ITestNGMethod>> es : lmm.entrySet()) { List<IMethodInstance> methodInstances = MethodHelper.methodsToMethodInstances(es.getValue()); TestMethodWorker tmw = new TestMethodWorker(arguments.getInvoker(), methodInstances, arguments.getTestContext().getCurrentXmlTest().getSuite(), arguments.getTestContext().getCurrentXmlTest().getAllParameters(), arguments.getConfigMethods(), arguments.getClassMethodMap(), arguments.getTestContext(), arguments.getListeners()); result.add(tmw); } return result; }
Source:
<code>protected void runTask() { try { SpreadsheetEntry spreadsheet = Iterables.getOnlyElement(spreadsheetFetcher.getSpreadsheetByTitle(spreadsheetTitle)); WorksheetEntry worksheet = Iterables.getOnlyElement(spreadsheetFetcher.getWorksheetsFromSpreadsheet(spreadsheet)); ListFeed data = spreadsheetFetcher.getDataFromWorksheet(worksheet); BloombergDataProcessor<UpdateProgress> processor = processor(); for (ListEntry row : data.getEntries()) { CustomElementCollection customElements = row.getCustomElements(); <START> if (customElements.getValue(BloombergSpreadsheetColumn.SOURCE.getValue()).equals(BLOOMBERG.title())) { <END> processor.process(customElements); } } reportStatus(processor.getResult().toString()); } catch (Exception e) { reportStatus(e.getMessage()); throw Throwables.propagate(e); } }</code><technical_language>i extract this out a separate method predicate, a name _isBloomberg_ similar, which'd this line cleaner</technical_language>

Target:
protected void runTask() { try { ListFeed data = fetchData(); BloombergDataProcessor<UpdateProgress> processor = processor(); for (ListEntry row : data.getEntries()) { isBloomberg(processor, row.getCustomElements()); } reportStatus(processor.getResult().toString()); } catch (Exception e) { reportStatus(e.getMessage()); throw Throwables.propagate(e); } }
Source:
<code>public MapInputRowParser( @JsonProperty("timestampSpec") TimestampSpec timestampSpec, @JsonProperty("dimensions") List<String> dimensions, @JsonProperty("dimensionExclusions") List<String> dimensionExclusions ) { this.timestampSpec = timestampSpec; if (dimensions != null) { <START> this.dimensions = Collections.unmodifiableList(Lists.newArrayList(dimensions)); <END> } this.dimensionExclusions = Sets.newHashSet(); if (dimensionExclusions != null) { for (String dimensionExclusion : dimensionExclusions) { this.dimensionExclusions.add(dimensionExclusion.toLowerCase()); } } this.dimensionExclusions.add(timestampSpec.getTimestampColumn().toLowerCase()); }</code><technical_language>this.dimensions = ImmutableList.copyOf(dimensions); do thing</technical_language>

Target:
public MapInputRowParser( @JsonProperty("timestampSpec") TimestampSpec timestampSpec, @JsonProperty("dimensions") List<String> dimensions, @JsonProperty("dimensionExclusions") List<String> dimensionExclusions ) { this.timestampSpec = timestampSpec; if (dimensions != null) { this.dimensions = ImmutableList.copyOf(dimensions); } this.dimensionExclusions = Sets.newHashSet(); if (dimensionExclusions != null) { for (String dimensionExclusion : dimensionExclusions) { this.dimensionExclusions.add(dimensionExclusion.toLowerCase()); } } this.dimensionExclusions.add(timestampSpec.getTimestampColumn().toLowerCase()); }
Source:
<code>public ThermostatStateMsg(String rawMsg) { super(rawMsg); logger.debug(this.msgType+" Payload Len -> "+this.payload.length); if (this.payload.length == THERMOSTAT_STATE_SHORT_PAYLOAD_LEN || this.payload.length == THERMOSTAT_STATE_MEAS_PAYLOAD_LEN || this.payload.length == THERMOSTAT_STATE_TIME_PAYLOAD_LEN ) { ctrlMode = ThermostatControlMode.values()[(this.payload[0]&0x3)]; dstActive = extractBitFromByte(this.payload[0], 3);; lanGateway = extractBitFromByte(this.payload[0], 4); lockedForManualSetPoint = extractBitFromByte(this.payload[0], 5); rfError = extractBitFromByte(this.payload[0], 6); batteryLow = extractBitFromByte(this.payload[0], 7); valvePos = this.payload[1]; desiredTemperature = (this.payload[2] & 0x7f) / 2.0; if (this.payload.length == THERMOSTAT_STATE_MEAS_PAYLOAD_LEN) { if (ctrlMode != ThermostatControlMode.TEMPORARY) { int mTemp = (this.payload[3]&0x1); mTemp <<= 8; mTemp |= (((int)this.payload[4])&0xff); measuredTemperature = mTemp/10.0; if (measuredTemperature < 4.5) measuredTemperature = null; } } else if (this.payload.length == THERMOSTAT_STATE_TIME_PAYLOAD_LEN) { } } <START> else logger.error("Got "+this.msgType+" message with incorrect length!"); <END> }</code><technical_language>please add curly braces</technical_language>

Target:
public ThermostatStateMsg(String rawMsg) { super(rawMsg); logger.debug(this.msgType + " Payload Len -> " + this.payload.length); if (this.payload.length == THERMOSTAT_STATE_SHORT_PAYLOAD_LEN || this.payload.length == THERMOSTAT_STATE_MEAS_PAYLOAD_LEN || this.payload.length == THERMOSTAT_STATE_TIME_PAYLOAD_LEN) { ctrlMode = ThermostatControlMode.values()[(this.payload[0] & 0x3)]; dstActive = extractBitFromByte(this.payload[0], 3); ; lanGateway = extractBitFromByte(this.payload[0], 4); lockedForManualSetPoint = extractBitFromByte(this.payload[0], 5); rfError = extractBitFromByte(this.payload[0], 6); batteryLow = extractBitFromByte(this.payload[0], 7); valvePos = this.payload[1]; desiredTemperature = (this.payload[2] & 0x7f) / 2.0; if (this.payload.length == THERMOSTAT_STATE_MEAS_PAYLOAD_LEN) { if (ctrlMode != ThermostatControlMode.TEMPORARY) { int mTemp = (this.payload[3] & 0x1); mTemp <<= 8; mTemp |= (((int) this.payload[4]) & 0xff); measuredTemperature = mTemp / 10.0; if (measuredTemperature < 4.5) measuredTemperature = null; } } else if (this.payload.length == THERMOSTAT_STATE_TIME_PAYLOAD_LEN) { } } else { logger.error("Got " + this.msgType + " message with incorrect length!"); } }
Source:
<code>public DatasetService(RestTemplate restTemplate, DataStoreService dataStoreService) { super(restTemplate); <START> this.dataStoreService = notNull(dataStoreService, ""); <END> }</code><technical_language>Name of argument is missing</technical_language>

Target:
public DatasetService(RestTemplate restTemplate, DataStoreService dataStoreService) { super(restTemplate); this.dataStoreService = notNull(dataStoreService, "dataStoreService"); }
Source:
<code>public EventResult onPositionUpdate(PositionUpdateEvent event, EntityRef entity) { if (entity.hasComponent(Position.class)) { <START> Position position = entity.getComponent(Position.class).get(); position.position = event.getPosition(); <END> entity.setComponent(position); } return EventResult.CONTINUE; }</code><technical_language>Position position position.position. Hmm a name for some of :thinking: thinking aloud, end of world :+1:</technical_language>

Target:
public EventResult onPositionUpdate(PositionUpdateEvent event, EntityRef entity) { if (entity.hasComponent(Position.class)) { Position positionComponent = entity.getComponent(Position.class).get(); positionComponent.position = event.getPosition(); entity.setComponent(positionComponent); } return EventResult.CONTINUE; }
Source:
<code>private Response reload(BaragonRequest request, boolean delayReload) throws Exception { if (!delayReload) { <START> configHelper.reloadConfigs(); <END> } mostRecentRequestId.set(request.getLoadBalancerRequestId()); return Response.ok().build(); }</code><technical_language>i this want check. This is part of flow for individual updates coming baragon service, flow of bootstrapping. want split out reloadConfigs checkAndReload call independently</technical_language>

Target:
private Response reload(BaragonRequest request, boolean delayReload) throws Exception { if (!delayReload) { configHelper.checkAndReload(); } mostRecentRequestId.set(request.getLoadBalancerRequestId()); return Response.ok().build(); }
Source:
<code>public Doc() { meta = new Meta(); file = new File(); path = new Path(); <START> external = new HashMap<>(); <END> }</code><technical_language>I if this null default generate empty property external needed</technical_language>

Target:
public Doc() { meta = new Meta(); file = new File(); path = new Path(); external = null; }
Source:
<code>protected void createAdditionalWidgets(FormEntryContext context) { <START> createDoseUnitsWidget(context); <END> createRouteWidget(context); createCareSettingWidget(context); }</code><technical_language>this for quantity duration need separate ones</technical_language>

Target:
protected void createAdditionalWidgets(FormEntryContext context) { createDosingTypeWidget(context); createDoseUnitsWidget(context); createQuantityWidget(context); createQuantityUnitsWidget(context); createDurationWidget(context); createDurationUnitsWidget(context); createRouteWidget(context); careSettingWidget = createCareSettingWidget(context, false); }
Source:
<code>public void visitToken(DetailAST ast) { <START> if (ast.findFirstToken(TokenTypes.ELIST).getChildCount() == 0) { <END> log(ast, MSG_CTOR); } }</code><technical_language>easy. [JLS 8.8.7.1](<LINK_0> super() redundant. For example: class Outer { class InnerNonStatic { } } class Derived extends Outer.InnerNonStatic { public Derived(Outer s) { s.super(); // a redundant call } }</technical_language>

Target:
public void visitToken(DetailAST ast) { if (ast.getFirstChild().getType() == TokenTypes.LPAREN && ast.findFirstToken(TokenTypes.ELIST).getChildCount() == 0) { log(ast, MSG_CTOR); } }
Source:
<code>protected void composeLine(final AllelicCount record, final DataLine dataLine) { switch (verbosity) { case BASIC: composeLineBasic(record, dataLine); break; case INTERMEDIATE: composeLineIntermediate(record, dataLine); break; case FULL: composeLineFull(record, dataLine); break; default: <START> throw new UserException.BadInput("The AllelicCount verbosity is invalid."); <END> } }</code><technical_language>fail early. This error throw construction. here; this point this exception blamed user presence of a bug</technical_language>

Target:
protected void composeLine(final AllelicCount record, final DataLine dataLine) { switch (verbosity) { case BASIC: composeLineBasic(record, dataLine); break; case INTERMEDIATE: composeLineIntermediate(record, dataLine); break; case FULL: composeLineFull(record, dataLine); break; } }
Source:
<code>public void readFields(DataInput in) throws IOException { reset(); super.readFields(in); readId = in.readLong(); if ((validMessageFlag & VALID_MESSAGE.PATH_LIST_AND_EDGETYPE_LIST) > 0){ pathList.readFields(in); edgeTypeList.readFields(in); } if ((validMessageFlag & VALID_MESSAGE.TARGET_VERTEX_ID) > 0) targetVertexId.readFields(in); <START> if ((validMessageFlag & VALID_MESSAGE.SRC_AND_DEST_READ_HEAD_ORIENTATION) > 0){ <END> srcReadHeadOrientation = READHEAD_ORIENTATION.fromByte(in.readByte()); destReadHeadOrientation = READHEAD_ORIENTATION.fromByte(in.readByte()); } if ((validMessageFlag & VALID_MESSAGE.TOTAL_BFS_LENGTH) > 0) totalBFSLength = in.readInt(); if ((validMessageFlag & VALID_MESSAGE.SCAFFOLDING_MAP) > 0) scaffoldingMap.readFields(in); }</code><technical_language>ctrl+shift+f</technical_language>

Target:
public void readFields(DataInput in) throws IOException { reset(); super.readFields(in); if ((validMessageFlag & BFS_MESSAGE_FIELDS.READ_ID) > 0) readId = in.readLong(); if ((validMessageFlag & BFS_MESSAGE_FIELDS.PATH_LIST_AND_EDGETYPE_LIST) > 0) { pathList.readFields(in); edgeTypeList.readFields(in); } if ((validMessageFlag & BFS_MESSAGE_FIELDS.TARGET_VERTEX_ID) > 0) targetVertexId.readFields(in); if ((validMessageFlag & BFS_MESSAGE_FIELDS.SRC_AND_DEST_READ_HEAD_ORIENTATION) > 0) { srcReadHeadOrientation = READHEAD_ORIENTATION.fromByte(in.readByte()); destReadHeadOrientation = READHEAD_ORIENTATION.fromByte(in.readByte()); } if ((validMessageFlag & BFS_MESSAGE_FIELDS.TOTAL_BFS_LENGTH) > 0) totalBFSLength = in.readInt(); if ((validMessageFlag & BFS_MESSAGE_FIELDS.SCAFFOLDING_MAP) > 0) scaffoldingMap.readFields(in); }
Source:
<code>public void sendErrorEmail(ExecutableFlow flow, String... extraReasons) { EmailMessage message = new EmailMessage(mailHost, mailUser, mailPassword); message.setFromAddress(mailSender); message.setTLS(tls); <START> message.setAuth(usesAuth); <END> ExecutionOptions option = flow.getExecutionOptions(); MailCreator mailCreator = DefaultMailCreator.getCreator(option.getMailCreator()); logger.debug("ExecutorMailer using mail creator:" + mailCreator.getClass().getCanonicalName()); boolean mailCreated = mailCreator.createErrorEmail(flow, message, azkabanName, scheme, clientHostname, clientPortNumber, extraReasons); if (mailCreated && !testMode) { try { message.sendEmail(); } catch (MessagingException e) { logger.error("Email message send failed", e); } } }</code><technical_language>call super.hasMailAuth()</technical_language>

Target:
public void sendErrorEmail(ExecutableFlow flow, String... extraReasons) { EmailMessage message = new EmailMessage(mailHost, mailUser, mailPassword); message.setFromAddress(mailSender); message.setTLS(tls); message.setAuth(super.hasMailAuth()); ExecutionOptions option = flow.getExecutionOptions(); MailCreator mailCreator = DefaultMailCreator.getCreator(option.getMailCreator()); logger.debug("ExecutorMailer using mail creator:" + mailCreator.getClass().getCanonicalName()); boolean mailCreated = mailCreator.createErrorEmail(flow, message, azkabanName, scheme, clientHostname, clientPortNumber, extraReasons); if (mailCreated && !testMode) { try { message.sendEmail(); } catch (MessagingException e) { logger.error("Email message send failed", e); } } }
Source:
<code>private final void pyPassByRef() { Set<JsonObject> pyops = findOperatorsByKinds(graph, PY_FUNC_OPS); if (pyops.isEmpty()) return; for (JsonObject pyop : pyops) { JsonArray outputs = array(pyop, "outputs"); if (outputs == null || outputs.size() == 0) continue; assert outputs.size() == 1; int[] connCounts = new int[outputs.size()]; for (int port = 0; port < connCounts.length; port++) { connCounts[port] = -1; JsonObject output = outputs.get(port).getAsJsonObject(); if (!"tuple<blob __spl_po>".equals(jstring(output, "type"))) continue; JsonArray conns = array(output, "connections"); if (conns == null || conns.size() == 0) { connCounts[port] = 0; continue; } boolean canPassByRef = true; Set<JsonObject> connected = getDownstream(pyop, graph); for (JsonObject connectedOp : connected) { if (!PY_FUNC_OPS.contains(kind(connectedOp))) { canPassByRef = false; break; } if (!kind(connectedOp).endsWith("::Map") && !kind(connectedOp).endsWith("::ForEach")) { canPassByRef = false; break; } } if (canPassByRef) connCounts[port] = conns.size(); } boolean paramNeeded = false; for (int i = 0; i < connCounts.length; i++) { <START> if (connCounts[0] != -1) { <END> paramNeeded = true; break; } } if (paramNeeded) { JsonObject value = new JsonObject(); if (connCounts.length == 1) value.addProperty("value", connCounts[0]); else { JsonArray ocs = new JsonArray(); for (int oc : connCounts) ocs.add(new JsonPrimitive(oc)); value.add("value", ocs); } GraphUtilities.addOpParameter(pyop, "outputConnections", value); } } }</code><technical_language>this connCounts[i] connCounts[0]</technical_language>

Target:
private final void pyPassByRef() { Set<JsonObject> pyops = findOperatorsByKinds(graph, PY_FUNC_OPS); if (pyops.isEmpty()) return; for (JsonObject pyop : pyops) { JsonArray outputs = array(pyop, "outputs"); if (outputs == null || outputs.size() == 0) continue; assert outputs.size() == 1; int[] connCounts = new int[outputs.size()]; for (int port = 0; port < connCounts.length; port++) { connCounts[port] = -1; JsonObject output = outputs.get(port).getAsJsonObject(); if (!"tuple<blob __spl_po>".equals(jstring(output, "type"))) continue; JsonArray conns = array(output, "connections"); if (conns == null || conns.size() == 0) { connCounts[port] = 0; continue; } boolean canPassByRef = true; Set<JsonObject> connected = getDownstream(pyop, graph); for (JsonObject connectedOp : connected) { if (!PY_FUNC_OPS.contains(kind(connectedOp))) { canPassByRef = false; break; } if (!kind(connectedOp).endsWith("::Map") && !kind(connectedOp).endsWith("::ForEach")) { canPassByRef = false; break; } } if (canPassByRef) connCounts[port] = conns.size(); } boolean paramNeeded = false; for (int oc: connCounts) { if (oc != -1) { paramNeeded = true; break; } } if (paramNeeded) { JsonObject value = new JsonObject(); if (connCounts.length == 1) value.addProperty("value", connCounts[0]); else { JsonArray ocs = new JsonArray(); for (int oc : connCounts) ocs.add(new JsonPrimitive(oc)); value.add("value", ocs); } GraphUtilities.addOpParameter(pyop, "outputConnections", value); } } }
Source:
<code>public ApplicationRegistry getMetrics(@RequestParam Map<String, String> filters) throws IOException { boolean all = filters.get("all") != null; <START> String filterMeterNameRegex = getWithDefault(filters, "meterNameRegex", ""); <END> String filterTagNameRegex = getWithDefault(filters, "tagNameRegex", ""); String filterTagValueRegex = getWithDefault(filters, "tagValueRegex", ""); TagMeasurementFilter queryFilter = new TagMeasurementFilter( filterMeterNameRegex, filterTagNameRegex, filterTagValueRegex); MeasurementFilter filter; if (all) { filter = queryFilter; } else { filter = new ChainedMeasurementFilter(queryFilter, getDefaultMeasurementFilter()); } ApplicationRegistry response = new ApplicationRegistry(); response.setApplicationName(applicationName); response.setApplicationVersion(applicationVersion); response.setMetrics(encodeRegistry(registry, filter)); return response; }</code><technical_language>getOrDefault map: java String filterMeterNameRegex = filters.getOrDefault("meterNameRegex", "");</technical_language>

Target:
public ApplicationRegistry getMetrics(@RequestParam Map<String, String> filters) throws IOException { boolean all = filters.get("all") != null; String filterMeterNameRegex = filters.getOrDefault("meterNameRegex", ""); String filterTagNameRegex = filters.getOrDefault("tagNameRegex", ""); String filterTagValueRegex = filters.getOrDefault("tagValueRegex", ""); TagMeasurementFilter queryFilter = new TagMeasurementFilter( filterMeterNameRegex, filterTagNameRegex, filterTagValueRegex); Predicate<Measurement> filter; if (all) { filter = queryFilter; } else { filter = queryFilter.and(getDefaultMeasurementFilter()); } ApplicationRegistry response = new ApplicationRegistry(); response.setApplicationName(applicationName); response.setApplicationVersion(applicationVersion); response.setMetrics(encodeRegistry(registry, filter)); return response; }
Source:
<code>private static boolean isHostnameVerifierSignature(LambdaExpressionTree lambdaExpressionTree) { List<VariableTree> parameters = lambdaExpressionTree.parameters(); <START> return lambdaExpressionTree.symbolType().isSubtypeOf("javax.net.ssl.HostnameVerifier") <END> && parameters.size() == 2 && TYPE_CRITERIA_STRING.test(parameters.get(0).type().symbolType()) && TYPE_CRITERIA_SSL_SESSION.test(parameters.get(1).type().symbolType()); }</code><technical_language>if a lambda a subtype of HostnameVerifier I need elements of condition. (in other words, is if this part is true of false, is uncoverable unit test useless) : && safely removed I think. (please prove wrong if I ;) )</technical_language>

Target:
private static boolean isHostnameVerifierSignature(LambdaExpressionTree lambdaExpressionTree) { return lambdaExpressionTree.symbolType().isSubtypeOf("javax.net.ssl.HostnameVerifier"); }
Source:
<code>public ListenableFuture<Void> write(String str, Charset charset) { <START> return write(str, charset, null); <END> }</code><technical_language>empty map null logic simpler (ImmutableMap.of())</technical_language>

Target:
public ListenableFuture<Void> write(String str, Charset charset) { return write(str, charset, ImmutableMap.<String, String>of()); }
Source:
<code>private void addNotification(Context context,File file){ NotificationCompat.Builder builder = new NotificationCompat.Builder(this,"notification_channel") .addAction(R.drawable.ic_share_black_24dp, getString(R.string.share_notification), shareFileIntent(context,file)) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(getString(R.string.download_complete)) .setContentText(file.toString()); Intent notificationIntent = openFile(file); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(contentIntent); NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); <START> manager.notify(0, builder.build()); <END> }</code><technical_language>a linting warning here, manager null, surround if (manager != null)</technical_language>

Target:
private void addNotification(Context context,File file){ NotificationCompat.Builder builder = new NotificationCompat.Builder(this,"notification_channel") .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(getString(R.string.download_complete)) .setContentText(file.toString()); if (Build.VERSION.SDK_INT >= 21) { NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.ic_share_black_24dp, getString(R.string.share_notification), shareFileIntent(context,file)).build(); builder.addAction(action); } else{ NotificationCompat.Action action = new NotificationCompat.Action.Builder(0, getString(R.string.share_notification), shareFileIntent(context,file)).build(); builder.addAction(action); } Intent notificationIntent = openFile(file); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(contentIntent); NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); if(manager!=null) { manager.notify(0, builder.build()); } }
Source:
<code>public static TServerSocket createTServerSocket(String portRange) throws IOException { TServerSocket tSocket = null; <START> if (portRange == null || portRange.equals(":")) { <END> try { tSocket = new TServerSocket(0); return tSocket; } catch (TTransportException e) { throw new IOException("Fail to create TServerSocket", e); } } int start = 1024; int end = 65535; String[] ports = portRange.split(":", -1); if (!ports[0].isEmpty()) { start = Integer.parseInt(ports[0]); } if (!ports[1].isEmpty()) { end = Integer.parseInt(ports[1]); } for (int i = start; i <= end; ++i) { try { tSocket = new TServerSocket(i); return tSocket; } catch (Exception e) { } } throw new IOException("No available port in the portRange: " + portRange); }</code><technical_language>if portRange == ""</technical_language>

Target:
public static TServerSocket createTServerSocket(String portRange) throws IOException { TServerSocket tSocket = null; if (StringUtils.isBlank(portRange) || portRange.equals(":")) { try { tSocket = new TServerSocket(0); return tSocket; } catch (TTransportException e) { throw new IOException("Fail to create TServerSocket", e); } } int start = 1024; int end = 65535; String[] ports = portRange.split(":", -1); if (!ports[0].isEmpty()) { start = Integer.parseInt(ports[0]); } if (!ports[1].isEmpty()) { end = Integer.parseInt(ports[1]); } for (int i = start; i <= end; ++i) { try { tSocket = new TServerSocket(i); return tSocket; } catch (Exception e) { } } throw new IOException("No available port in the portRange: " + portRange); }
Source:
<code>public void dispatch() { Set<RemoteProcedure> operationsTmp = operations; operations = Sets.newConcurrentHashSet(); if (operationsTmp.isEmpty()) { return; } remoteDispatch(getKey(), operations); <START> operations.stream().filter(operation -> operation.storeInDispatchedQueue()) .forEach(operation -> dispatchedOperations.add(operation)); <END> }</code><technical_language>This replaced method references: operations.stream().filter(RemoteProcedure::storeInDispatchedQueue) .forEach(dispatchedOperations::add);</technical_language>

Target:
public void dispatch() { Set<RemoteProcedure> operationsTmp = operations; operations = Sets.newConcurrentHashSet(); if (operationsTmp.isEmpty()) { return; } remoteDispatch(getKey(), operations); operations.stream().filter(RemoteProcedure::storeInDispatchedQueue) .forEach(dispatchedOperations::add); }
Source:
<code>private IDockerImage getDockerImage(final ILaunchConfiguration config, final IDockerConnection connection) throws CoreException { final String imageId = config.getAttribute( IRunDockerImageLaunchConfigurationConstants.IMAGE_NAME, (String) null); if (imageId != null) { <START> return connection.getImage(imageId); <END> } return null; }</code><technical_language>This new getImage interface is based image id RunImage launch configuration wizard image names pull-down. asking for image name feed getImage()</technical_language>

Target:
private IDockerImage getDockerImage(final ILaunchConfiguration config, final IDockerConnection connection) throws CoreException { final String imageId = config.getAttribute( IRunDockerImageLaunchConfigurationConstants.IMAGE_NAME, (String) null); if (imageId != null) { return ((DockerConnection) connection).getImage(imageId); } return null; }
Source:
<code>public void setDelay(int delay) { <START> if ((this.delay > 999 && this.delay < delay) || (this.delay < 6 && this.delay > delay)) return; else this.delay = delay; <END> }</code><technical_language>braces</technical_language>

Target:
public void setDelay(int delay) { if ((this.delay > 999 && this.delay < delay) || (this.delay < 6 && this.delay > delay)) { return; } else { this.delay = delay; } }
Source:
<code>public void setUp() throws IOException { PreferencesService preferencesService = new PreferencesService(eventBus); preferencesService.postConstruct(); <START> preferencesService.getPreferences().getMainWindow().setLastView("chat"); <END> instance = new PrivateChatTabController(userService, chatService, platformService, preferencesService, playerService, audioService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, webViewConfigurer, threadPoolExecutor ); playerName = "testUser"; Player player = new Player(playerName); when(playerService.getPlayerForUsername(playerName)).thenReturn(player); TabPane tabPane = new TabPane(); tabPane.setSkin(new TabPaneSkin(tabPane)); loadFxml("theme/chat/private_chat_tab.fxml", clazz -> instance); instance.setReceiver(playerName); WaitForAsyncUtils.asyncFx(() -> { getRoot().getChildren().setAll(tabPane); tabPane.getTabs().add(instance.getRoot()); }); WaitForAsyncUtils.waitForFxEvents(); verify(webViewConfigurer).configureWebView(instance.messagesWebView); }</code><technical_language>NavigationItem.CHAT.name() instead of "chat"</technical_language>

Target:
public void setUp() throws IOException { PreferencesService preferencesService = new PreferencesService(eventBus); preferencesService.postConstruct(); preferencesService.getPreferences().getMainWindow().setLastView(NavigationItem.CHAT.name()); instance = new PrivateChatTabController(clanService, userService, platformService, preferencesService, playerService, timeService, i18n, imageUploadService, urlPreviewResolver, notificationService, reportingService, uiService, autoCompletionHelper, eventBus, audioService, chatService, mapService, webViewConfigurer, countryFlagService); playerName = "testUser"; Player player = new Player(playerName); when(playerService.getPlayerForUsername(playerName)).thenReturn(player); when(userService.getUsername()).thenReturn(playerName); when(uiService.getThemeFileUrl(CHAT_CONTAINER)).then(invocation -> getThemeFileUrl(invocation.getArgument(0))); TabPane tabPane = new TabPane(); tabPane.setSkin(new TabPaneSkin(tabPane)); loadFxml("theme/chat/private_chat_tab.fxml", clazz -> { if (clazz == PrivateUserInfoController.class) { return privateUserInfoController; } if (clazz == GameDetailController.class) { return gameDetailController; } if (clazz == WatchButtonController.class) { return watchButtonController; } return instance; }); instance.setReceiver(playerName); WaitForAsyncUtils.asyncFx(() -> { getRoot().getChildren().setAll(tabPane); tabPane.getTabs().add(instance.getRoot()); }); WaitForAsyncUtils.waitForFxEvents(); verify(webViewConfigurer).configureWebView(instance.messagesWebView); }
Source:
<code>private Statistics computeStats(Dim dimension) { Statistics stats; <START> Set<Integer> steps = new HashSet<Integer>(); <END> for (int j = 0; j < fDataPoints.length; j++) { DataPoint dp = fDataPoints[j]; steps.add(new Integer(dp.getStep())); } if (steps.contains(new Integer(InternalPerformanceMeter.AVERAGE))) { stats = computeStatsFromAggregates(dimension); } else if (steps.contains(new Integer(InternalPerformanceMeter.AFTER))) { stats = computeStatsFromMeasurements(dimension, steps); } else { Assert.fail("illegal data set: contains neither AVERAGE nor AFTER values."); stats = null; } return stats; }</code><technical_language>Redundant specification</technical_language>

Target:
private Statistics computeStats(Dim dimension) { Statistics stats; Set<Integer> steps = new HashSet<>(); for (int j = 0; j < fDataPoints.length; j++) { DataPoint dp = fDataPoints[j]; steps.add(new Integer(dp.getStep())); } if (steps.contains(new Integer(InternalPerformanceMeter.AVERAGE))) { stats = computeStatsFromAggregates(dimension); } else if (steps.contains(new Integer(InternalPerformanceMeter.AFTER))) { stats = computeStatsFromMeasurements(dimension, steps); } else { Assert.fail("illegal data set: contains neither AVERAGE nor AFTER values."); stats = null; } return stats; }
Source:
<code>public FilterWriter(boolean validationEnabled) throws JAXBException { this.marshaller = JAXBContext.newInstance(FilterType.class).createMarshaller(); if (validationEnabled) { <START> LOGGER.info("Loading filter schemas..."); <END> URL schemaLocation = FilterWriter.class.getResource(FILTER_XSD_RESOURCE_PATH); SchemaFactory schemaFactory = SchemaFactory.newInstance(SCHEMA_LANGUAGE); try { marshaller.setSchema(schemaFactory.newSchema(schemaLocation)); } catch (SAXException e) { throw new JAXBException("Error reading filter schema", e); } } }</code><technical_language>if ... necessary</technical_language>

Target:
public FilterWriter(boolean validationEnabled) throws JAXBException { this.marshaller = JAXBContext.newInstance(FilterType.class).createMarshaller(); if (validationEnabled) { LOGGER.info("Loading filter schemas"); URL schemaLocation = FilterWriter.class.getResource(FILTER_XSD_RESOURCE_PATH); SchemaFactory schemaFactory = SchemaFactory.newInstance(SCHEMA_LANGUAGE); try { marshaller.setSchema(schemaFactory.newSchema(schemaLocation)); } catch (SAXException e) { throw new JAXBException("Error reading filter schema", e); } } }
Source:
<code>public void emitTuples() { if (currentWindowEmitCount < maxPerWindow) { POJO tuple = generatePOJO(); out.emit(tuple); currentWindowEmitCount++; logger.info("InputTuple: " + this.windowId + "-" + TimeBucket.MINUTE.roundDown(tuple.getTime()) + "-" + tuple.getTime() + "," + tuple.getAdvertiserId() + "," + tuple.getPublisherId() + "," + tuple.getLocationId() + "," + tuple.getClicks() + "," + tuple.getCost()); <START> } <END> }</code><technical_language>Good idea add sleep if is do. way, if limit is reached, calling emitTuple is do anything</technical_language>

Target:
public void emitTuples() { if (currentWindowEmitCount < maxPerWindow) { POJO tuple = generatePOJO(); out.emit(tuple); currentWindowEmitCount++; logger.info("InputTuple: " + this.windowId + "-" + TimeBucket.MINUTE.roundDown(tuple.getTime()) + "-" + tuple.getTime() + "," + tuple.getAdvertiserId() + "," + tuple.getPublisherId() + "," + tuple.getLocationId() + "," + tuple.getClicks() + "," + tuple.getCost()); } else { try { Thread.sleep(10); } catch (InterruptedException e) { logger.warn("Failed to sleep. Continuing..", e); } } }
Source:
<code>public List<Project> getProjects() { <START> List<Project> projects; <END> try { projects = projectLoader.fetchAllActiveProjects(); for (Project proj : projects) { loadAllProjectFlows(proj); } } catch (ProjectManagerException e) { throw new RuntimeException("Could not load projects from store.", e); } return projects; }</code><technical_language>This required populate project throw a runtime exception</technical_language>

Target:
public List<Project> getProjects() { List<Project> projects; try { projects = projectLoader.fetchAllActiveProjects(); } catch (ProjectManagerException e) { throw new RuntimeException("Could not load projects from store.", e); } return projects; }
Source:
<code>public void testUpdateReusesIndexesString() { myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); SearchParameterMap m1 = new SearchParameterMap().add("family", new StringParam("family1")).setLoadSynchronous(true); SearchParameterMap m2 = new SearchParameterMap().add("family", new StringParam("family2")).setLoadSynchronous(true); myCountHolder.clear(); Patient pt = new Patient(); pt.addName().setFamily("FAMILY1"); IIdType id = myPatientDao.create(pt).getId().toUnqualifiedVersionless(); <START> ourLog.info("Now have deleted", getQueryCount().getDelete()); <END> ourLog.info("Now have inserts", getQueryCount().getInsert()); myCountHolder.clear(); assertEquals(1, myPatientDao.search(m1).size().intValue()); assertEquals(0, myPatientDao.search(m2).size().intValue()); ourLog.info("** About to update"); pt = new Patient(); pt.setId(id); pt.addName().setFamily("FAMILY2"); myPatientDao.update(pt); ourLog.info("Now have deletes", getQueryCount().getDelete()); ourLog.info("Now have inserts", getQueryCount().getInsert()); ourLog.info("Now have updates", getQueryCount().getUpdate()); assertEquals(0, getQueryCount().getDelete()); assertEquals(1, getQueryCount().getInsert()); assertEquals(2, getQueryCount().getUpdate()); assertEquals(0, myPatientDao.search(m1).size().intValue()); assertEquals(1, myPatientDao.search(m2).size().intValue()); }</code><technical_language>want remove some of debugging log messages</technical_language>

Target:
public void testUpdateReusesIndexesString() { myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); SearchParameterMap m1 = new SearchParameterMap().add("family", new StringParam("family1")).setLoadSynchronous(true); SearchParameterMap m2 = new SearchParameterMap().add("family", new StringParam("family2")).setLoadSynchronous(true); myCountHolder.clear(); Patient pt = new Patient(); pt.addName().setFamily("FAMILY1"); IIdType id = myPatientDao.create(pt).getId().toUnqualifiedVersionless(); myCountHolder.clear(); assertEquals(1, myPatientDao.search(m1).size().intValue()); assertEquals(0, myPatientDao.search(m2).size().intValue()); ourLog.info("** About to update"); pt = new Patient(); pt.setId(id); pt.addName().setFamily("FAMILY2"); myPatientDao.update(pt); assertEquals(0, getQueryCount().getDelete()); assertEquals(1, getQueryCount().getInsert()); assertEquals(2, getQueryCount().getUpdate()); assertEquals(0, myPatientDao.search(m1).size().intValue()); assertEquals(1, myPatientDao.search(m2).size().intValue()); }
Source:
<code>public void testElementAt() { int i = fullList.get(0); <START> assertTrue(i == 1); <END> try { fullList.get(fullList.size()); } catch (IndexOutOfBoundsException e) { return; } fail("Should raise an ArrayIndexOutOfBoundsException"); }</code><technical_language>Do assertEquals() (with useful message) instead of assertTrue() get a useful stack trace if this fails? Future users this file example of write a good JUnit test</technical_language>

Target:
public void testElementAt() { int i = fullList.get(0); assertEquals(1,i); try { fullList.get(fullList.size()); } catch (IndexOutOfBoundsException e) { return; } fail("Should raise an ArrayIndexOutOfBoundsException"); }
Source:
<code><START> public Collection<MgfMsSpectrum> getResult() { <END> return null; }</code><technical_language>Change Collection List</technical_language>

Target:
public List<MgfMsSpectrum> getResult() { return spectra; }
Source:
<code>public Result visit(Project e) { e.getVariablesSet(); Result x = visitChild(0, e.getInput()); parseCorrelTable(e, x); if (isStar(e.getChildExps(), e.getInput().getRowType(), e.getRowType())) { return x; } final Builder builder; if (e.getInput() instanceof Sort) { builder = x.builder(e); builder.clauses.add(Clause.SELECT); <START> } else { <END> builder = x.builder(e, Clause.SELECT); } final List<SqlNode> selectList = new ArrayList<>(); for (RexNode ref : e.getChildExps()) { SqlNode sqlExpr = builder.context.toSql(null, ref); if (SqlUtil.isNullLiteral(sqlExpr, false)) { sqlExpr = castNullType(sqlExpr, e.getRowType().getFieldList().get(selectList.size())); } addSelect(selectList, sqlExpr, e.getRowType()); } builder.setSelect(new SqlNodeList(selectList, POS)); return builder.result(); }</code><technical_language>builder.clauses.add(Clause.SELECT) is useless</technical_language>

Target:
public Result visit(Project e) { e.getVariablesSet(); Result x = visitChild(0, e.getInput()); parseCorrelTable(e, x); if (isStar(e.getChildExps(), e.getInput().getRowType(), e.getRowType())) { return x; } final Builder builder = x.builder(e, Clause.SELECT); final List<SqlNode> selectList = new ArrayList<>(); for (RexNode ref : e.getChildExps()) { SqlNode sqlExpr = builder.context.toSql(null, ref); if (SqlUtil.isNullLiteral(sqlExpr, false)) { sqlExpr = castNullType(sqlExpr, e.getRowType().getFieldList().get(selectList.size())); } addSelect(selectList, sqlExpr, e.getRowType()); } builder.setSelect(new SqlNodeList(selectList, POS)); return builder.result(); }
Source:
<code><START> private Resource loadPackage(URI uri, URI normalized) { <END> if (uriCache.containsKey(normalized)) { return uriCache.get(normalized); } final URI trimmed = uri.trimFragment(); final Resource resource = createResource(trimmed, ContentHandler.UNSPECIFIED_CONTENT_TYPE); if (resource == null) { return null; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SRS@" + Integer.toHexString(hashCode()) + ".getResource - caching package " + uri); } InputStream stream = null; try { stream = getURIConverter().createInputStream(trimmed, null); resource.load(stream, Collections.emptyMap()); } catch (IOException e) { handleDemandLoadException(resource, e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { } } } Resource former = uriCache.putIfAbsent(normalized, resource); if (former != null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("SRS@" + Integer.toHexString(hashCode()) + ".getResource - duplicate caching has been avoided for " + uri); } return former; } return resource; }</code><technical_language>Do pass uri here? is normalized form sufficient</technical_language>

Target:
private Resource loadPackage(URI uri, URI normalized) { final URI trimmed = uri.trimFragment(); final Resource resource = createResource(trimmed, ContentHandler.UNSPECIFIED_CONTENT_TYPE); if (resource == null) { return null; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SRS@" + Integer.toHexString(hashCode()) + ".getResource - caching package " + uri); } Resource former = uriCache.putIfAbsent(normalized, resource); if (former != null) { return former; } InputStream stream = null; try { stream = getURIConverter().createInputStream(trimmed, null); resource.load(stream, Collections.emptyMap()); } catch (IOException e) { handleDemandLoadException(resource, e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { } } } loadedPackages.add(resource); return resource; }
Source:
<code>public Integer getDuration() { if (currentEntity != null) { MediaPlayer mp = currentEntity.getPlayer(); <START> return mp.getDuration() / 1000; <END> } return null; }</code><technical_language>Is a reason this in a lossy fashion v. sending ms count? Also: -1 a safer return val? If people try do straight math this result odd get a null pointer, I argument for sides</technical_language>

Target:
public Integer getDuration() { if (currentEntity != null) { MediaPlayer mp = currentEntity.getPlayer(); return mp.getDuration(); } return null; }
Source:
<code>public int translate(int xid, FVSlicer fvSlicer) { int ret = this.nextID++; if (nextID < MIN_XID) nextID = MIN_XID; xidMap.put(Integer.valueOf(ret), new XidPair(xid, fvSlicer.getSliceName())); <START> FVLog.log(LogLevel.DEBUG,null,"The Translated xid is: "+ret); <END> return ret; }</code><technical_language>need add this</technical_language>

Target:
public int translate(int xid, FVSlicer fvSlicer) { int ret = this.nextID++; if (nextID < MIN_XID) nextID = MIN_XID; xidMap.put(Integer.valueOf(ret), new XidPair(xid, fvSlicer.getSliceName())); return ret; }
Source:
<code>public String getUrlName() { return Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ? <START> "/selenium" : null; <END> }</code><technical_language>BTW I patch getIconFileName is needed (cf. core/src/main/resources/lib/hudson/actions.jelly). git ls-files -z | xargs -0 grep -lZ -- \\\(conFile\\\|rl\\\)Name\\\(\\\)\ \\\?\[\!\=\]\=\ \\\?null | xargs -0 ls -l</technical_language>

Target:
public String getUrlName() { return "/selenium"; }
Source:
<code>public String addLeadingZeros(String s) { if (s.length() >= THREAD_NAME_LENGTH) return THREAD_NAME_PREFIX+s; <START> else return THREAD_NAME_PREFIX+String.format("%0" + (THREAD_NAME_LENGTH - s.length()) + "d%s", 0, s); <END> }</code><technical_language>FYI for future - this method for this: <LINK_0></technical_language>

Target:
public String addLeadingZeros(String s) { if (s.length() >= THREAD_NAME_LENGTH) return THREAD_NAME_PREFIX + s; else return THREAD_NAME_PREFIX + StringUtils.leftPad(s, THREAD_NAME_LENGTH, "0"); }
Source:
<code>public Matrix4 setToRotation(final Vector3 axis, double angle) { if (angle == 0) return identity(); <START> return setAll(mQuat.fromAngleAxis(axis, angle)); <END> }</code><technical_language>return angle == 0 ? identity() : setAll(mQuat.fromAngleAxis(axis, angle));</technical_language>

Target:
public Matrix4 setToRotation(final Vector3 axis, double angle) { return angle == 0 ? identity() : setAll(mQuat.fromAngleAxis(axis, angle)); }
Source:
<code>public void testConcurrentWriteRead() throws Exception { final MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), 1, 1); final AtomicReference<Message<?>> messageHolder = new AtomicReference<Message<?>>(); queue.offer(new GenericMessage<String>("hello"), 1000, TimeUnit.SECONDS); Thread t1 = new Thread(() -> { try { queue.offer(new GenericMessage<String>("Hi"), 1000, TimeUnit.SECONDS); } catch (Exception e) { e.printStackTrace(); } }); Thread t2 = new Thread(() -> { try { queue.poll(1000, TimeUnit.SECONDS); messageHolder.set(queue.poll(1000, TimeUnit.SECONDS)); } catch (Exception e) { <START> e.printStackTrace(); <END> } }); t1.start(); Thread.sleep(1000); t2.start(); Thread.sleep(1000); assertTrue(messageHolder.get().getPayload().equals("Hi")); }</code><technical_language>I enough printStackTrace(). find other :smile:</technical_language>

Target:
public void testConcurrentWriteRead() throws Exception { final MessageGroupQueue queue = new MessageGroupQueue(new SimpleMessageStore(), 1, 1); final AtomicReference<Message<?>> messageHolder = new AtomicReference<Message<?>>(); queue.offer(new GenericMessage<String>("hello"), 1000, TimeUnit.SECONDS); Thread t1 = new Thread(() -> { try { queue.offer(new GenericMessage<String>("Hi"), 1000, TimeUnit.SECONDS); } catch (Exception e) { LogFactory.getLog(getClass()).error("queue offer failed", e); } }); Thread t2 = new Thread(() -> { try { queue.poll(1000, TimeUnit.SECONDS); messageHolder.set(queue.poll(1000, TimeUnit.SECONDS)); } catch (Exception e) { LogFactory.getLog(getClass()).error("queue poll failed", e); } }); t1.start(); Thread.sleep(1000); t2.start(); Thread.sleep(1000); assertTrue(messageHolder.get().getPayload().equals("Hi")); }
Source:
<code>private void recoverOne(RuntimeInfrastructure infra, RuntimeIdentity identity) throws ServerException { Workspace workspace; try { workspace = workspaceDao.get(identity.getWorkspaceId()); } catch (NotFoundException x) { LOG.error("Workspace configuration is missing for the runtime '{}:{}'. Runtime won't be recovered", identity.getWorkspaceId(), identity.getEnvName()); return; } Environment environment = workspace.getConfig().getEnvironments().get(identity.getEnvName()); if (environment == null) { LOG.error("Environment configuration is missing for the runtime '{}:{}'. Runtime won't be recovered", identity.getWorkspaceId(), identity.getEnvName()); return; } InternalRuntime runtime; try { runtime = infra.prepare(identity, environment).getRuntime(); } catch (InfrastructureException | ValidationException x) { LOG.error("Couldn't recover runtime '{}:{}'. Error: {}", identity.getWorkspaceId(), identity.getEnvName(), x.getMessage()); return; } RuntimeState prev = runtimes.putIfAbsent(identity.getWorkspaceId(), new RuntimeState(runtime, RUNNING)); if (prev == null) { LOG.info("Successfully recovered workspace runtime '{}'", identity.getWorkspaceId(), identity.getEnvName()); } else { <START> LOG.error("More than 1 runtime with id '{}:{}' found. " + <END> "Duplicate provided by infrastructure '{}' will be skipped", identity.getWorkspaceId(), identity.getEnvName(), prev.runtime.getContext().getInfrastructure().getName(), infra.getName()); } }</code><technical_language>Do need log</technical_language>

Target:
void recoverOne(RuntimeInfrastructure infra, RuntimeIdentity identity) throws ServerException { Workspace workspace; try { workspace = workspaceDao.get(identity.getWorkspaceId()); } catch (NotFoundException x) { LOG.error("Workspace configuration is missing for the runtime '{}:{}'. Runtime won't be recovered", identity.getWorkspaceId(), identity.getEnvName()); return; } Environment environment = workspace.getConfig().getEnvironments().get(identity.getEnvName()); if (environment == null) { LOG.error("Environment configuration is missing for the runtime '{}:{}'. Runtime won't be recovered", identity.getWorkspaceId(), identity.getEnvName()); return; } InternalRuntime runtime; try { runtime = infra.prepare(identity, environment).getRuntime(); } catch (InfrastructureException | ValidationException x) { LOG.error("Couldn't recover runtime '{}:{}'. Error: {}", identity.getWorkspaceId(), identity.getEnvName(), x.getMessage()); return; } RuntimeState prev = runtimes.putIfAbsent(identity.getWorkspaceId(), new RuntimeState(runtime, RUNNING)); if (prev == null) { LOG.info("Successfully recovered workspace runtime '{}'", identity.getWorkspaceId(), identity.getEnvName()); } else { LOG.error("More than 1 runtime with id '{}:{}' found. " + "Duplicate provided by infrastructure '{}' will be skipped", identity.getWorkspaceId(), identity.getEnvName(), prev.runtime.getContext().getInfrastructure().getName(), infra.getName()); } }
Source:
<code>public void dropRowRangeAsyncForTruncate(){ DropRowRangeRequest request = DropRowRangeRequest.newBuilder() .setName(TABLE_NAME) .setDeleteAllDataFromTable(true) .build(); when(mockAdminClient.dropRowRangeAsync(request)) .thenReturn(immediateFuture(Empty.newBuilder().build())); <START> clientWrapper.dropRowRangeAsync(TABLE_ID, request.getRowKeyPrefix().toStringUtf8()); <END> verify(mockAdminClient).dropRowRangeAsync(request); }</code><technical_language>this clientWrapper.dropRowRangeAsync(TABLE_ID, null);</technical_language>

Target:
public void dropRowRangeAsyncForTruncate(){ DropRowRangeRequest request = DropRowRangeRequest.newBuilder() .setName(TABLE_NAME) .setDeleteAllDataFromTable(true) .build(); when(mockAdminClient.dropRowRangeAsync(request)) .thenReturn(immediateFuture(Empty.newBuilder().build())); clientWrapper.dropRowRangeAsync(TABLE_ID, null); verify(mockAdminClient).dropRowRangeAsync(request); }