auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldExpireWithPaymentProvider_whenGatewayStateIsCancellable(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); ChargeEntity chargeEntity = ChargeEntityFixture.aValidChargeEntity() .withAmount(200L) .withCreatedDate(ZonedDateTime.now()) .withStatus(status) .withGatewayAccountEntity(gatewayAccount) .build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(true); when(mockWorldpayCancelResponse.cancelStatus()).thenReturn(CancelStatus.CANCELLED); when(mockChargeDao.findByExternalId(chargeEntity.getExternalId())).thenReturn(Optional.of(chargeEntity)); when(mockPaymentProvider.cancel(any())).thenReturn(gatewayResponse); ArgumentCaptor<CancelGatewayRequest> cancelCaptor = ArgumentCaptor.forClass(CancelGatewayRequest.class); ChargeEntity expiredCharge = mockExpiredChargeEntity(); when(mockChargeService.transitionChargeState(any(String.class), any())).thenReturn(expiredCharge); chargeExpiryService.expire(singletonList(chargeEntity)); verify(mockPaymentProvider).cancel(cancelCaptor.capture()); assertThat(cancelCaptor.getValue().getTransactionId(), is(chargeEntity.getGatewayTransactionId())); <START> verify(mockChargeService).transitionChargeState(chargeEntity.getExternalId(), EXPIRED); <END> }</code><technical_language>I improve this slightly removing verify improving stub for this method expects exact arguments. For newer versions of Mockito, need a stub a verify if method is called Mockito complain if stub is unused</technical_language>

Target:
public void shouldExpireWithPaymentProvider_whenGatewayStateIsCancellable(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); ChargeEntity chargeEntity = ChargeEntityFixture.aValidChargeEntity() .withAmount(200L) .withCreatedDate(ZonedDateTime.now()) .withStatus(status) .withGatewayAccountEntity(gatewayAccount) .build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(true); when(mockWorldpayCancelResponse.cancelStatus()).thenReturn(CancelStatus.CANCELLED); when(mockChargeDao.findByExternalId(chargeEntity.getExternalId())).thenReturn(Optional.of(chargeEntity)); when(mockPaymentProvider.cancel(any())).thenReturn(gatewayResponse); ArgumentCaptor<CancelGatewayRequest> cancelCaptor = ArgumentCaptor.forClass(CancelGatewayRequest.class); ChargeEntity expiredCharge = mockExpiredChargeEntity(); when(mockChargeService.transitionChargeState(chargeEntity.getExternalId(), EXPIRED)).thenReturn(expiredCharge); chargeExpiryService.expire(singletonList(chargeEntity)); verify(mockPaymentProvider).cancel(cancelCaptor.capture()); assertThat(cancelCaptor.getValue().getTransactionId(), is(chargeEntity.getGatewayTransactionId())); }
Source:
<code>public void testChannelEventNotification() throws Exception { final AtomicBoolean chunkArrivalNotified = new AtomicBoolean(false); final AtomicBoolean closeNotified = new AtomicBoolean(false); ByteBufferAsyncWritableChannel channel = new ByteBufferAsyncWritableChannel(new ByteBufferAsyncWritableChannel.ChannelEventListener() { @Override public void onEvent(ByteBufferAsyncWritableChannel.EventType e) { if (e == ByteBufferAsyncWritableChannel.EventType.ChunkArrival) { chunkArrivalNotified.set(true); } else if (e == ByteBufferAsyncWritableChannel.EventType.Close) { closeNotified.set(true); } } }); <START> channel.write(ByteBuffer.allocate(5), null); <END> assertTrue("Write should have been notified", chunkArrivalNotified.get()); channel.close(); assertTrue("Close should have been notified", closeNotified.get()); }</code><technical_language>check atomic booleans false calling write</technical_language>

Target:
public void testChannelEventNotification() throws Exception { final AtomicBoolean writeNotified = new AtomicBoolean(false); final AtomicBoolean closeNotified = new AtomicBoolean(false); ByteBufferAsyncWritableChannel channel = new ByteBufferAsyncWritableChannel(new ByteBufferAsyncWritableChannel.ChannelEventListener() { @Override public void onEvent(ByteBufferAsyncWritableChannel.EventType e) { if (e == ByteBufferAsyncWritableChannel.EventType.Write) { writeNotified.set(true); } else if (e == ByteBufferAsyncWritableChannel.EventType.Close) { closeNotified.set(true); } } }); assertFalse("No write notification should have come in before any write", writeNotified.get()); channel.write(ByteBuffer.allocate(5), null); assertTrue("Write should have been notified", writeNotified.get()); assertFalse("No close event notification should have come in before a close", closeNotified.get()); channel.close(); assertTrue("Close should have been notified", closeNotified.get()); }
Source:
<code><START> void incrementTimestamp() { <END> if (rollups_enabled) { if (rollup_index == 0) { final RollupInterval interval = node.rollupIntervals().get(rollup_index); timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( timestamp.epoch() + (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } else { if (fallback_timestamp == null) { fallback_timestamp = getInitialTimestamp(rollup_index); } else if (rollup_index >= node.rollupIntervals().size()) { fallback_timestamp.add(Duration.of(1, ChronoUnit.HOURS)); } else { final RollupInterval interval = node.rollupIntervals().get(rollup_index); fallback_timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( fallback_timestamp.epoch() + (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } } } else { timestamp.add(Duration.of(1, ChronoUnit.HOURS)); } }</code><technical_language>Please add reverse scanning this</technical_language>

Target:
void incrementTimestamp() { if (rollups_enabled) { if (rollup_index == 0) { final RollupInterval interval = node.rollupIntervals().get(rollup_index); if (reversed) { timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( timestamp.epoch() - (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } else { timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( timestamp.epoch() + (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } } else { if (fallback_timestamp == null) { fallback_timestamp = getInitialTimestamp(rollup_index); } else if (rollup_index >= node.rollupIntervals().size()) { fallback_timestamp.add(Duration.of( (reversed ? - 1 : 1), ChronoUnit.HOURS)); } else { final RollupInterval interval = node.rollupIntervals().get(rollup_index); if (reversed) { fallback_timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( fallback_timestamp.epoch() - (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } else { fallback_timestamp.updateEpoch((long) RollupUtils.getRollupBasetime( fallback_timestamp.epoch() + (interval.getIntervalSeconds() * interval.getIntervals()), interval)); } } } } else { timestamp.add(Duration.of( (reversed ? -1 : 1), ChronoUnit.HOURS)); } }
Source:
<code>public DataObjectCreatedEvent( Project currentProject, DataObject currentDataObject ) { <START> super( null, currentProject, currentDataObject ); <END> }</code><technical_language>a lover of passing nulls methods constructors.. another constructor contextId better</technical_language>

Target:
public DataObjectCreatedEvent( Project currentProject, DataObject currentDataObject ) { super( currentProject, currentDataObject ); }
Source:
<code>protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_events); TextView eventLog = (TextView) findViewById(R.id.events_log); Button customButton = (Button) getLayoutInflater().inflate(R.layout.view_custom_button, null); new ShowcaseView.Builder(this) .withMaterialShowcase() .setStyle(R.style.CustomShowcaseTheme3) .setTarget(new ViewTarget(R.id.imageView, this)) .setContentTitle("Events") .setContentText("Listening to ShowcaseView events is easy!") <START> .setShowcaseEventListener(new MultiEventListener(new LogToTextListener(eventLog), new ShakeButtonListener(customButton))) <END> .replaceEndButton(customButton) .build(); }</code><technical_language>extract event listener in a dedicated local variable for readability</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_events); TextView eventLog = (TextView) findViewById(R.id.events_log); Button customButton = (Button) getLayoutInflater().inflate(R.layout.view_custom_button, null); MultiEventListener multiEventListener = new MultiEventListener(new LogToTextListener(eventLog), new ShakeButtonListener(customButton)); new ShowcaseView.Builder(this) .withMaterialShowcase() .setStyle(R.style.CustomShowcaseTheme3) .setTarget(new ViewTarget(R.id.imageView, this)) .setContentTitle("Events") .setContentText("Listening to ShowcaseView events is easy!") .setShowcaseEventListener(multiEventListener) .replaceEndButton(customButton) .build(); }
Source:
<code>public static String getDisableFlash() { <START> return String.valueOf(getProp("disableFlash")); <END> }</code><technical_language>do need String.valueOf</technical_language>

Target:
public static String getDisableFlash() { return getProp("disableFlash"); }
Source:
<code>public void close() throws IOException { <START> if (selectObjectContent != null) { <END> selectObjectContent.close(); } if (reader != null) { reader.close(); } if (selectClient != null) { selectClient.close(); } }</code><technical_language>guava Closer close these</technical_language>

Target:
public void close() throws IOException { closer.close(); }
Source:
<code>public Optional<PublishResult> publishMessage(String message) { if (!isEnabled.get()) { log.warn("Publishing is disabled for topic {}, dropping message {}", topicARN, message); return Optional.empty(); } try { PublishRequest publishRequest = new PublishRequest(topicARN.getArn(), message); <START> PublishResult publishResponse = amazonSNS.publish(publishRequest); <END> log.debug( "Published message with id to topic {}", message, publishResponse.getMessageId(), topicARN); getSuccessCounter().increment(); return Optional.of(publishResponse); } catch (Exception e) { log.error("failed to publish message to topic {}", message, topicARN, e); getErrorCounter(e).increment(); return Optional.empty(); } }</code><technical_language>do safely retry in here</technical_language>

Target:
public Optional<PublishResult> publishMessage(String message) { if (!isEnabled.get()) { log.warn("Publishing is disabled for topic {}, dropping message {}", topicARN, message); return Optional.empty(); } try { PublishRequest publishRequest = new PublishRequest(topicARN.getArn(), message); PublishResult publishResponse = retrySupport.retry( () -> amazonSNS.publish(publishRequest), 5, Duration.ofMillis(200), false); log.debug( "Published message with id to topic {}", message, publishResponse.getMessageId(), topicARN); getSuccessCounter().increment(); return Optional.of(publishResponse); } catch (Exception e) { log.error("failed to publish message to topic {}", message, topicARN, e); getErrorCounter(e).increment(); return Optional.empty(); } }
Source:
<code>private TimeLockServices createNewClient(String namespace) { Preconditions.checkArgument(!namespace.equals(PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE), "The client name '%s' is reserved for the leader election service, and may not be " + "used.", PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE); <START> if (getNumberOfActiveClients() >= maxNumberOfClients.get()) { <END> log.error( "Unable to create timelock services for client {}, as it would exceed the maximum number of " + "allowed clients ({}). If this is intentional, the maximum number of clients can be " + "increased via the maximum-number-of-clients runtime config property.", SafeArg.of("client", namespace), SafeArg.of("maxNumberOfClients", maxNumberOfClients)); throw new IllegalStateException("Maximum number of clients exceeded"); } return clientServicesFactory.apply(namespace); }</code><technical_language>nit: standardise public methods (so getMaxNumberOfClients())</technical_language>

Target:
private TimeLockServices createNewClient(String namespace) { Preconditions.checkArgument(!namespace.equals(PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE), "The client name '%s' is reserved for the leader election service, and may not be " + "used.", PaxosTimeLockConstants.LEADER_ELECTION_NAMESPACE); if (getNumberOfActiveClients() >= getMaxNumberOfClients()) { log.error( "Unable to create timelock services for client {}, as it would exceed the maximum number of " + "allowed clients ({}). If this is intentional, the maximum number of clients can be " + "increased via the maximum-number-of-clients runtime config property.", SafeArg.of("client", namespace), SafeArg.of("maxNumberOfClients", getMaxNumberOfClients())); throw new IllegalStateException("Maximum number of clients exceeded"); } return clientServicesFactory.apply(namespace); }
Source:
<code><START> public void clearKey(String tabName, String key) { <END> Map<String, Object> tab = getTab(tabName); tab.remove(key); }</code><technical_language>this needs package visible</technical_language>

Target:
void clearKey(String tabName, String key) { Map<String, Object> tab = getTab(tabName); tab.remove(key); }
Source:
<code><START> public void handleGet(ActionParameters params) throws ActionException { <END> final int layerId = params.getRequiredParamInt(PARAM_LAYER_ID); LOG.info("Checking layer usage in other layers for layerId: ", layerId); Map<String, Set<Integer>> layerUsages = new HashMap<>(); Set<Integer> timeseriesLayerIds = new HashSet<>(); for (OskariLayer layer : mapLayerService.findAll()) { JSONObject options = layer.getOptions(); try { if (options != null && options.has("timeseries")) { JSONObject timeseriesOptions = options.getJSONObject("timeseries"); Integer metadataLayerId = timeseriesOptions.getJSONObject("metadata").getInt("layer"); if (metadataLayerId == layerId) { timeseriesLayerIds.add(layer.getId()); } } } catch (JSONException e) { throw new ActionException("Cannot parse layer metadata options for layer: " + layer.getName() + ", id: " + layer.getId()); } } layerUsages.put("timeseries", timeseriesLayerIds); writeResponse(params, layerUsages); }</code><technical_language>Start this params.requireAdminUser() line this is for admins only. need care if expose ids require some permission</technical_language>

Target:
public void handleGet(ActionParameters params) throws ActionException { params.requireAdminUser(); final int layerId = params.getRequiredParamInt(PARAM_LAYER_ID); LOG.info("Checking layer usage in other layers for layerId: ", layerId); Map<String, Set<Integer>> layerUsages = new HashMap<>(); Set<Integer> timeseriesLayerIds = getTimeseriesLayerIds(layerId); layerUsages.put("timeseries", timeseriesLayerIds); ResponseHelper.writeResponse(params, new JSONObject(layerUsages)); }
Source:
<code>public void updated(Dictionary<String, ?> properties) { if (properties == null || properties.isEmpty()) { return; } Map<String, Map<String, Object>> brokerConfigs = extractBrokerConfigurations(properties); <START> <END> for (Map<String, Object> brokerConfig : brokerConfigs.values()) { try { addBrokerConnection(brokerConfig).start(); } catch (ConfigurationException e) { logger.warn("MqttBroker connection configuration faulty: {}", e.getMessage()); } catch (MqttException e) { logger.warn("MqttBroker start failed: {}", e.getMessage(), e); } } }</code><technical_language>this result in active connections discarded? runtime this happen if configuration is cleared config admin. disclaimer: I moderate knowledge OSGi this is more of assumption</technical_language>

Target:
public void updated(Dictionary<String, ?> properties) { if (properties == null || properties.isEmpty()) { return; } Iterator<Map.Entry<String, MqttBrokerConnection>> it = brokerConnections.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, MqttBrokerConnection> entry = it.next(); if (entry.getValue().isTextualConfiguredBroker()) { entry.getValue().close(); it.remove(); } } Map<String, Map<String, String>> brokerConfigs = extractBrokerConfigurations(properties); for (Map<String, String> brokerConfig : brokerConfigs.values()) { try { addBrokerConnection(brokerConfig).start(); } catch (ConfigurationException e) { logger.warn("MqttBroker connection configuration faulty: {}", e.getMessage()); } catch (MqttException e) { logger.warn("MqttBroker start failed: {}", e.getMessage(), e); } } }
Source:
<code><START> public static XmlHighlighting highlight(SensorContext context, XmlFile xmlFile) { <END> XmlHighlighting highlighting = new XmlHighlighting(xmlFile); highlighting.highlight(context); return highlighting; }</code><technical_language>returning XmlHighlighting instead of void? I</technical_language>

Target:
public static void highlight(SensorContext context, XmlFile xmlFile) { new XmlHighlighting(xmlFile).highlight(context); }
Source:
<code>private <T> RMFailoverProxyProvider<T> createRMFailoverProxyProvider( Configuration conf, Class<T> protocol) { <START> String defaultProviderClassName = <END> YarnConfiguration.DEFAULT_CLIENT_FAILOVER_PROXY_PROVIDER; Class<? extends RMFailoverProxyProvider<T>> defaultProviderClass; try { defaultProviderClass = (Class<? extends RMFailoverProxyProvider<T>>) Class.forName(defaultProviderClassName); } catch (Exception e) { throw new YarnRuntimeException("Invalid default failover provider class" + defaultProviderClassName, e); } RMFailoverProxyProvider<T> provider = ReflectionUtils.newInstance( conf.getClass(YarnConfiguration.CLIENT_FAILOVER_PROXY_PROVIDER, defaultProviderClass, RMFailoverProxyProvider.class), conf); provider.init(conf, (RMProxy<T>) this, protocol); return provider; }</code><technical_language>is worth this change</technical_language>

Target:
private <T> RMFailoverProxyProvider<T> createRMFailoverProxyProvider( Configuration conf, Class<T> protocol) { Class<? extends RMFailoverProxyProvider<T>> defaultProviderClass; try { defaultProviderClass = (Class<? extends RMFailoverProxyProvider<T>>) Class.forName( YarnConfiguration.DEFAULT_CLIENT_FAILOVER_PROXY_PROVIDER); } catch (Exception e) { throw new YarnRuntimeException("Invalid default failover provider class" + YarnConfiguration.DEFAULT_CLIENT_FAILOVER_PROXY_PROVIDER, e); } RMFailoverProxyProvider<T> provider = ReflectionUtils.newInstance( conf.getClass(YarnConfiguration.CLIENT_FAILOVER_PROXY_PROVIDER, defaultProviderClass, RMFailoverProxyProvider.class), conf); provider.init(conf, (RMProxy<T>) this, protocol); return provider; }
Source:
<code>public String toString() { <START> return "EntityHit(" + entity + " at " + intersection + " on " + normal + ")"; <END> }</code><technical_language>this</technical_language>

Target:
public String toString() { return "EntityHit(" + this.entity + " at " + this.intersection + " on " + this.normal + ")"; }
Source:
<code>public URL create(final String key, final long value) { <START> return create(key, ""+ value); <END> }</code><technical_language>I prefer String.valueOf(value)</technical_language>

Target:
public URL create(final String key, final long value) { return create(key, String.valueOf(value)); }
Source:
<code>public Mono<MsalToken> authenticateWithAuthorizationCode(TokenRequestContext request, String authorizationCode, URI redirectUrl) { return Mono.fromFuture(() -> getPublicClientApplication(false).acquireToken( AuthorizationCodeParameters.builder(authorizationCode, redirectUrl) .scopes(new HashSet<>(request.getScopes())) .build())) <START> .onErrorResume(t -> Mono.error(new ClientAuthenticationException("Failed to acquire token with " <END> + "authorization code", null, t))).map(ar -> new MsalToken(ar, options)); }</code><technical_language>onErrorMap</technical_language>

Target:
public Mono<MsalToken> authenticateWithAuthorizationCode(TokenRequestContext request, String authorizationCode, URI redirectUrl) { return Mono.fromFuture(() -> getPublicClientApplication(false).acquireToken( AuthorizationCodeParameters.builder(authorizationCode, redirectUrl) .scopes(new HashSet<>(request.getScopes())) .build())) .onErrorMap(t -> new ClientAuthenticationException("Failed to acquire token with authorization code", null, t)).map(ar -> new MsalToken(ar, options)); }
Source:
<code>public boolean isEdgeWithObliqueRoutingStyle() { boolean isEdgeObliqueRoutingStyle = false; if <START> (Routing.MANUAL_LITERAL.getLiteral().equals(getRoutingStyle())) <END> { isEdgeObliqueRoutingStyle = true; } return isEdgeObliqueRoutingStyle; }</code><technical_language>remove remark</technical_language>

Target:
public boolean isEdgeWithObliqueRoutingStyle() { boolean isEdgeObliqueRoutingStyle = false; if (Routing.MANUAL_LITERAL.equals(getRoutingStyle())) { isEdgeObliqueRoutingStyle = true; } return isEdgeObliqueRoutingStyle; }
Source:
<code>public void testCheckLengthVersion() throws Exception { System.setProperty("VERSION","1.0.0"); assertThatExceptionOfType(Exception.class).isThrownBy(() -> runontag.checkParams(runontag.getParams("@runOnEnv(VERSION>1.0)"))) <START> .withMessage("Error while parsing params. The versions must have the same numbers of elements"); <END> }</code><technical_language>.. number of elements</technical_language>

Target:
public void testCheckLengthVersion() throws Exception { System.setProperty("VERSION","1.0.0"); assertThatExceptionOfType(Exception.class).isThrownBy(() -> runontag.checkParams(runontag.getParams("@runOnEnv(VERSION>1.0)"))) .withMessage("Error while parsing params. The versions must have the same number of elements"); }
Source:
<code><START> public RelNode copyWithLimitOffset(RelTraitSet traitSet, RexNode offset, RexNode limit) { <END> VoltDBPTableSeqScan newScan = new VoltDBPTableSeqScan( getCluster(), traitSet, getTable(), getVoltTable(), getProgram(), offset, limit, getAggregateRelNode(), getPreAggregateRowType(), getPreAggregateProgram(), m_splitCount); return newScan; }</code><technical_language>return type VoltDBPTableSeqScan</technical_language>

Target:
public AbstractVoltDBTableScan copyWithLimitOffset(RelTraitSet traitSet, RexNode offset, RexNode limit) { VoltDBPTableSeqScan newScan = new VoltDBPTableSeqScan( getCluster(), traitSet, getTable(), getVoltTable(), getProgram(), offset, limit, getAggregateRelNode(), getPreAggregateRowType(), getPreAggregateProgram(), m_splitCount); return newScan; }
Source:
<code>private static void setVmTemplateStatus( Guid vmTemplateGuid, VmTemplateStatus status, CompensationContext compensationContext) { VmTemplate vmTemplate = DbFacade.getInstance().getVmTemplateDao().get(vmTemplateGuid); if (vmTemplate != null) { if (compensationContext != null) { compensationContext.snapshotEntityStatus(vmTemplate); } vmTemplate.setStatus(status); DbFacade.getInstance().getVmTemplateDao().update(vmTemplate); } else { log.warnFormat( <START> "VmTemplateHandler::setVmTemplateStatus: vmTemplate is null, not setting status '{0}' to vmTemplate", <END> status); } }</code><technical_language>I remove this redundant prefix (VmTemplateHandler::setVmTemplateStatus:)</technical_language>

Target:
private static void setVmTemplateStatus( Guid vmTemplateGuid, VmTemplateStatus status, CompensationContext compensationContext) { VmTemplate vmTemplate = DbFacade.getInstance().getVmTemplateDao().get(vmTemplateGuid); if (vmTemplate != null) { if (compensationContext != null) { compensationContext.snapshotEntityStatus(vmTemplate); } vmTemplate.setStatus(status); DbFacade.getInstance().getVmTemplateDao().update(vmTemplate); } else { log.warnFormat( "setVmTemplateStatus: vmTemplate is null, not setting status '{0}' to vmTemplate", status); } }
Source:
<code>public String ensureReadData(final String path, final long timeout) { Random rn = new Random(); int jitter; int retry = 1; int step = 50; int counter = 0; String content = super.readData(path, false); long totalWait = 0; while (content == null) { counter++; retry *= 2; jitter = rn.nextInt(100); long wait = retry * step + jitter; try { Thread.sleep(wait); } catch (InterruptedException e) { LOG.error("Failed to sleep at retry: " + counter + " " + e.getMessage()); } content = super.readData(path, false ); totalWait += wait; <START> if (totalWait > timeout) { <END> break; } } if (content == null) { LOG.warn("Failed to read znode data for path " + path + " within timeout " + timeout + " milliseconds"); } return content; }</code><technical_language>exceed timeout 2x a bit more. Please move check wait calculation (or add there), trim final wait if limit</technical_language>

Target:
public String ensureReadData(final String path, final long timeout) { Random rn = new Random(); int jitter; int retry = 1; int step = 50; int counter = 0; String content = super.readData(path, false); long totalWait = 0; long nextWait = 0; while (content == null && totalWait < timeout) { counter++; retry *= 2; jitter = rn.nextInt(100); nextWait = retry * step + jitter; if (totalWait + nextWait > timeout) { nextWait = timeout - totalWait; } try { Thread.sleep(nextWait); } catch (InterruptedException e) { LOG.error("Failed to sleep at retry: " + counter + " " + e.getMessage()); } totalWait += nextWait; content = super.readData(path, false ); } if (content == null) { LOG.warn("Failed to read znode data for path " + path + " within timeout " + timeout + " milliseconds"); } return content; }
Source:
<code>private void addVertex(UnpackedBakedQuad.Builder quadBuilder, float x, float y, float u, float v) { vec.x = x; vec.y = y; vec.z = 0; vec.w = 1; matrix.transform(vec); for(int e = 0; e < format.getElementCount(); e++) { switch(format.getElement(e).getUsage()) { case POSITION: quadBuilder.put(e, vec.x, vec.y, vec.z, vec.w); break; case UV: <START> if(format.getElement(e).getIndex() == 0) <END> quadBuilder.put(e, sprite.getInterpolatedU(u * 16), sprite.getInterpolatedV(v * 16), 0, 1); break; case COLOR: quadBuilder.put(e, r, g, b, a); break; case NORMAL: quadBuilder.put(e, 0, 0, 1, 1); break; default: quadBuilder.put(e); break; } } }</code><technical_language>braces</technical_language>

Target:
private void addVertex(UnpackedBakedQuad.Builder quadBuilder, float x, float y, float u, float v) { for(int e = 0; e < format.getElementCount(); e++) { switch(format.getElement(e).getUsage()) { case POSITION: vec.set(x, y, 0f, 1f); transform.transformPosition(vec); quadBuilder.put(e, vec.x, vec.y, vec.z, vec.w); break; case COLOR: quadBuilder.put(e, r, g, b, a); break; case NORMAL: quadBuilder.put(e, 0, 0, 1, 1); break; case UV: if(format.getElement(e).getIndex() == 0) { quadBuilder.put(e, sprite.getInterpolatedU(u * 16), sprite.getInterpolatedV(v * 16), 0, 1); break; } default: quadBuilder.put(e); break; } } }
Source:
<code>public Task getTask(int execServiceId, int facilityId, int engineID) { try { return this .getJdbcTemplate() .queryForObject( "select " + taskMappingSelectQuery + ", " + FacilitiesManagerImpl.facilityMappingSelectQuery + ", " + ExecServiceDaoJdbc.execServiceMappingSelectQuery + ", " + ServicesManagerImpl.serviceMappingSelectQuery + " from tasks left join exec_services on tasks.exec_service_id = exec_services.id " + "left join facilities on facilities.id = tasks.facility_id left join services on services.id = exec_services.service_id " + "where exec_services.id = ? and tasks.facility_id = ? and tasks.engine_id = ?", <START> new Object[] { execServiceId, facilityId, engineID < 0 ? "null" : engineID}, TASK_ROWMAPPER); <END> } catch (EmptyResultDataAccessException ex) { return null; } }</code><technical_language>fact, store string in integer column, modify select instead distinct tasks.engine_id is null tasks.engine_id = "+engineId+". I joining strings is generally safe, is a generic int, is harmless sql injection</technical_language>

Target:
public Task getTask(int execServiceId, int facilityId, int engineID) { try { return this .getJdbcTemplate() .queryForObject( "select " + taskMappingSelectQuery + ", " + FacilitiesManagerImpl.facilityMappingSelectQuery + ", " + ExecServiceDaoJdbc.execServiceMappingSelectQuery + ", " + ServicesManagerImpl.serviceMappingSelectQuery + " from tasks left join exec_services on tasks.exec_service_id = exec_services.id " + "left join facilities on facilities.id = tasks.facility_id left join services on services.id = exec_services.service_id " + "where exec_services.id = ? and tasks.facility_id = ? and tasks.engine_id " + (engineID < 0 ? "is null" : "= ?"), engineID < 0 ? new Integer[] { execServiceId, facilityId } : new Integer[] { execServiceId, facilityId, engineID}, TASK_ROWMAPPER); } catch (EmptyResultDataAccessException ex) { return null; } }
Source:
<code>public void verifyLoggingCustomEvents() { driver.logEvent("appium", "funEvent"); <START> Object value = driver.getSessionDetail("events"); <END> assertNotNull(((Map<String, Object>) value).get("appium:funEvent")); }</code><technical_language>session details is a part of W3C spec. events "mobile:" endpoint</technical_language>

Target:
public void verifyLoggingCustomEvents() { CustomEvent evt = new CustomEvent(); evt.setEventName("funEvent"); evt.setVendor("appium"); driver.logEvent(evt); ServerEvents events = driver.getEvents(); boolean hasCustomEvent = events.events.stream().anyMatch((TimedEvent event) -> event.name.equals("appium:funEvent") && event.occurrences.get(0).intValue() > 0 ); boolean hasCommandName = events.commands.stream().anyMatch((CommandEvent event) -> event.name.equals("logCustomEvent") ); assertTrue(hasCustomEvent); assertTrue(hasCommandName); assertThat(events.jsonData, Matchers.containsString("\"appium:funEvent\"")); }
Source:
<code>public void onEvent(Event event, Object source, Object data) <START> { <END> String name = ((ActionExecutionEvent) event).getActionName(); if (!SUPPORTED_EVENTS.contains(name)) { return; } if (event instanceof ActionExecutingEvent) { this.lockManager.lock(((XWikiDocument) source).getDocumentReference()); } else { this.lockManager.unlock(((XWikiDocument) source).getDocumentReference()); } }</code><technical_language>uncaught exception thrown this method caught [here](<LINK_0> XW core logged error, interrupt handling of action. This is important means e.g. a save action proceed anyway, lead modification of data in unexpected ways</technical_language>

Target:
public void onEvent(Event event, Object source, Object data) { if (event == null || source == null || !(event instanceof ActionExecutionEvent)) { return; } String name = ((ActionExecutionEvent) event).getActionName(); if (!SUPPORTED_EVENTS.contains(name)) { return; } if (event instanceof ActionExecutingEvent) { this.lockManager.lock(((XWikiDocument) source).getDocumentReference()); } else if (event instanceof ActionExecutedEvent) { this.lockManager.unlock(((XWikiDocument) source).getDocumentReference()); } }
Source:
<code><START> public String getDefaultOutput() { return ""; } <END></code><technical_language>enum is place for this. Move VoltDB</technical_language>

Target:
public String getDefaultOutput() { return m_defaultOutput; }
Source:
<code>public IVariable getVariable(int offset) throws DebugException { if (offset >= getLength()) { requestFailed(JDIDebugModelMessages.JDIArrayValue_6, new <START> IndexOutOfBoundsException()); <END> } return new JDIArrayEntryVariable(getJavaDebugTarget(), getArrayReference(), offset, fLogicalParent); }</code><technical_language>below: please add requested offset like: throw new IndexOutOfBoundsException(Integer.toString(offset));</technical_language>

Target:
public IVariable getVariable(int offset) throws DebugException { if (offset >= getLength()) { requestFailed(JDIDebugModelMessages.JDIArrayValue_6, new IndexOutOfBoundsException(Integer.toString(offset))); } return new JDIArrayEntryVariable(getJavaDebugTarget(), getArrayReference(), offset, fLogicalParent); }
Source:
<code>Mono<Response<String>> renewLeaseWithResponse(BlobRenewLeaseOptions options, Context context) { <START> StorageImplUtils.assertNotNull("options", options); <END> BlobLeaseRequestConditions requestConditions = (options.getRequestConditions() == null) ? new BlobLeaseRequestConditions() : options.getRequestConditions(); context = context == null ? Context.NONE : context; if (this.isBlob) { return this.client.blobs().renewLeaseWithRestResponseAsync(null, null, this.leaseId, null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getIfTags(), null, context.addData(AZ_TRACING_NAMESPACE_KEY, STORAGE_TRACING_NAMESPACE_VALUE)) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); } else { return this.client.containers().renewLeaseWithRestResponseAsync(null, this.leaseId, null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), null, context.addData(AZ_TRACING_NAMESPACE_KEY, STORAGE_TRACING_NAMESPACE_VALUE)) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); } }</code><technical_language>I options null here, right</technical_language>

Target:
Mono<Response<String>> renewLeaseWithResponse(BlobRenewLeaseOptions options, Context context) { StorageImplUtils.assertNotNull("options", options); BlobLeaseRequestConditions requestConditions = (options.getRequestConditions() == null) ? new BlobLeaseRequestConditions() : options.getRequestConditions(); context = context == null ? Context.NONE : context; if (this.isBlob) { return this.client.blobs().renewLeaseWithRestResponseAsync(null, null, this.leaseId, null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), requestConditions.getIfMatch(), requestConditions.getIfNoneMatch(), requestConditions.getTagsConditions(), null, context.addData(AZ_TRACING_NAMESPACE_KEY, STORAGE_TRACING_NAMESPACE_VALUE)) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); } else { return this.client.containers().renewLeaseWithRestResponseAsync(null, this.leaseId, null, requestConditions.getIfModifiedSince(), requestConditions.getIfUnmodifiedSince(), null, context.addData(AZ_TRACING_NAMESPACE_KEY, STORAGE_TRACING_NAMESPACE_VALUE)) .map(rb -> new SimpleResponse<>(rb, rb.getDeserializedHeaders().getLeaseId())); } }
Source:
<code>public boolean isEmpty() { <START> return getOutAverageLinkshare() == null && getOutAverageUpperlimit() == null && getOutAverageRealtime() == null; <END> }</code><technical_language>implementation is in HostNetworkQos, please implement in HostNetworkQosProperties</technical_language>

Target:
public boolean isEmpty() { return hostNetworkQosProperties.isEmpty(); }
Source:
<code>protected Conditions createConditions(final CallbackProperties properties) { DateTime issueInstant = properties.getIssueInstant(); DateTime beginValidTime = properties.getSamlConditionsNotBefore(); DateTime endValidTime = properties.getSamlConditionsNotAfter(); if (issueInstant == null) { issueInstant = new DateTime(); } <START> beginValidTime = setBeginValidTime(beginValidTime, issueInstant); <END> endValidTime = setEndValidTime(endValidTime, issueInstant); return OpenSAML2ComponentBuilder.getInstance().createConditions(beginValidTime, endValidTime); }</code><technical_language>This is if statement for checking property for allowing for corrected times</technical_language>

Target:
protected Conditions createConditions(final CallbackProperties properties) { DateTime issueInstant = new DateTime(); DateTime beginValidTime = properties.getSamlConditionsNotBefore(); DateTime endValidTime = properties.getSamlConditionsNotAfter(); if (beginValidTime != null || endValidTime != null) { beginValidTime = setBeginValidTime(beginValidTime, issueInstant); endValidTime = setEndValidTime(endValidTime, issueInstant); return OpenSAML2ComponentBuilder.getInstance().createConditions(beginValidTime, endValidTime); } return null; }
Source:
<code>public static Set<Path> getRequiredFields(EntityMetadata md, Projection p, QueryExpression q, Sort s) { Set<Path> fields=new HashSet<>(); FieldCursor cursor=md.getFieldCursor(); if(cursor.next()) { boolean done=false; do { Path field=cursor.getCurrentPath(); FieldTreeNode node=cursor.getCurrentNode(); LOGGER.debug("Checking if is included ({})",field,node); if(node instanceof ResolvedReferenceField|| node instanceof ReferenceField) { <START> done=!cursor.nextSibling(); <END> } else { if( (node instanceof ObjectField) || (node instanceof ArrayField && ((ArrayField)node).getElement() instanceof ObjectArrayElement) || (node instanceof ArrayElement)) { } else if( (p!=null && p.isFieldRequiredToEvaluateProjection(field)) || (q!=null && q.isRequired(field)) || (s!=null && s.isRequired(field)) ) { LOGGER.debug("{}: required",field); fields.add(field); } else { LOGGER.debug("{}: not required", field); } done=!cursor.next(); } } while(!done); } return fields; }</code><technical_language>this stop early? if ref field is in middle of cursor? if multiple references in query</technical_language>

Target:
public static Set<Path> getRequiredFields(EntityMetadata md, Projection p, QueryExpression q, Sort s) { Set<Path> fields=new HashSet<>(); FieldCursor cursor=md.getFieldCursor(); Path skipPrefix=null; if(cursor.next()) { boolean done=false; do { Path field=cursor.getCurrentPath(); if(skipPrefix!=null) { if(!field.matchingDescendant(skipPrefix)) { skipPrefix=null; } } if(skipPrefix==null) { FieldTreeNode node=cursor.getCurrentNode(); LOGGER.debug("Checking if is included ({})",field,node); if(node instanceof ResolvedReferenceField|| node instanceof ReferenceField) { skipPrefix=field; } else { if( (node instanceof ObjectField) || (node instanceof ArrayField && ((ArrayField)node).getElement() instanceof ObjectArrayElement) || (node instanceof ArrayElement)) { } else if( (p!=null && p.isFieldRequiredToEvaluateProjection(field)) || (q!=null && q.isRequired(field)) || (s!=null && s.isRequired(field)) ) { LOGGER.debug("{}: required",field); fields.add(field); } else { LOGGER.debug("{}: not required", field); } done=!cursor.next(); } } else done=!cursor.next(); } while(!done); } return fields; }
Source:
<code>private void insertText(String txt) { if (lastFocusedField!=null) { <START> if (lastFocusedField instanceof IActionCodeEditor) { <END> ((IActionCodeEditor)lastFocusedField).insertText(txt); } else if (lastFocusedField instanceof Text) { Text lastTextField = (Text) lastFocusedField; int begin = txt.indexOf('('); int end = txt.indexOf(')'); int offset = lastTextField.getSelection().x; lastTextField.insert(txt); if (begin>=0 && end>=0 && end>begin+1) lastTextField.setSelection(offset+begin+1, offset+end); lastTextField.setFocus(); } } }</code><technical_language>require IActionCodeEditor is derived a widget. I equip a method returns main control (I guess getInteractiveControl() is for purpose) for message/member insertion mechanism. need maintain a map control -> editor</technical_language>

Target:
private void insertText(String txt) { if (lastFocusedField != null) { if (actionEditorControlMap.containsKey(lastFocusedField)) { (actionEditorControlMap.get(lastFocusedField)).insertText(txt); } else if (lastFocusedField instanceof Text) { Text lastTextField = (Text) lastFocusedField; int begin = txt.indexOf('('); int end = txt.indexOf(')'); int offset = lastTextField.getSelection().x; lastTextField.insert(txt); if (begin >= 0 && end >= 0 && end > begin + 1) lastTextField .setSelection(offset + begin + 1, offset + end); lastTextField.setFocus(); } } }
Source:
<code>public TopicNode getPaginatedTopicTree(String topicPath, int startIndex, int numberOfTopicsPerRound) throws EventBrokerException { try { UserRegistry userRegistry = this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId()); if (!userRegistry.resourceExists(topicPath)) { userRegistry.put(topicPath, userRegistry.newCollection()); } log.info("Before calling userregistry.get method"); Collection collection = (Collection) userRegistry.get(topicPath); log.info("After calling userregistry.get method"); String[] paths = collection.getChildren(startIndex, numberOfTopicsPerRound); <START> log.info("Children Paths length: " + paths.length); <END> TopicNode rootTopic = new TopicNode("/", "/"); buildTopicTree(rootTopic, paths); log.info("After building topic Tree"); return rootTopic; } catch (RegistryException e) { throw new EventBrokerException(e.getMessage(), e); } }</code><technical_language>Do need logs? :)</technical_language>

Target:
public TopicNode getPaginatedTopicTree(String topicPath, int startIndex, int numberOfTopicsPerRound) throws EventBrokerException { try { UserRegistry userRegistry = this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId()); if (!userRegistry.resourceExists(topicPath)) { userRegistry.put(topicPath, userRegistry.newCollection()); } Collection collection = (Collection) userRegistry.get(topicPath); String[] paths = collection.getChildren(startIndex, numberOfTopicsPerRound); TopicNode rootTopic = new TopicNode("/", "/"); buildTopicTree(rootTopic, paths); return rootTopic; } catch (RegistryException e) { throw new EventBrokerException(e.getMessage(), e); } }
Source:
<code>public static boolean isValidGenericValue(String generic) { <START> return isGeneric(generic) || Boolean.FALSE.toString().equals(generic); <END> }</code><technical_language>Boolean.FALSE.toString() need ignore upcase</technical_language>

Target:
public static boolean isValidGenericValue(String generic) { return isGeneric(generic) || Boolean.FALSE.toString().equalsIgnoreCase(generic); }
Source:
<code>private void setAllListModelsUnavailable() { for (ListModel m : getItems()) { if (!(m instanceof PluginModel)) { <START> m.setIsAvailable(false); <END> } } }</code><technical_language>Another do this override setIsAvailable in PluginModel no-op. (This allow get rid of instanceof check here.)</technical_language>

Target:
private void setAllListModelsUnavailable() { for (ListModel m : getItems()) { m.setIsAvailable(false); } }
Source:
<code>protected String getTemplate(Artifact artifact, PresentationType presentationType) throws OseeCoreException { boolean useTemplateOnce = getBooleanOption(USE_TEMPLATE_ONCE); boolean firstTime = getBooleanOption("FirstTime"); <START> boolean secondTime = getBooleanOption("SecondTime"); <END> Object option = getOption(TEMPLATE_OPTION); if ((option instanceof Artifact) && (!useTemplateOnce || (useTemplateOnce && (firstTime || secondTime)))) { Artifact template = (Artifact) option; if (useTemplateOnce) { if (secondTime) { setOption("SecondTime", false); } if (firstTime) { setOption("FirstTime", false); setOption("SecondTime", true); } } return template.getSoleAttributeValue(CoreAttributeTypes.WholeWordContent); } else if ((option == null || option instanceof String) || (useTemplateOnce && !firstTime)) { if (useTemplateOnce && !firstTime && !secondTime) { option = null; } Artifact templateArtifact = TemplateManager.getTemplate(this, artifact, presentationType, (String) option); return templateArtifact.getSoleAttributeValue(CoreAttributeTypes.WholeWordContent); } return Strings.EMPTY_STRING; }</code><technical_language>static string fields for strings multiple times</technical_language>

Target:
protected String getTemplate(Artifact artifact, PresentationType presentationType) throws OseeCoreException { boolean useTemplateOnce = getBooleanOption(USE_TEMPLATE_ONCE); boolean firstTime = getBooleanOption(FIRST_TIME); boolean secondTime = getBooleanOption(SECOND_TIME); Object option = getOption(TEMPLATE_OPTION); if ((option instanceof Artifact) && (!useTemplateOnce || (useTemplateOnce && (firstTime || secondTime)))) { Artifact template = (Artifact) option; if (useTemplateOnce) { if (secondTime) { setOption(SECOND_TIME, false); } if (firstTime) { setOption(FIRST_TIME, false); setOption(SECOND_TIME, true); } } return template.getSoleAttributeValue(CoreAttributeTypes.WholeWordContent); } else if ((option == null || option instanceof String) || (useTemplateOnce && !firstTime)) { if (useTemplateOnce && !firstTime && !secondTime) { option = null; } Artifact templateArtifact = TemplateManager.getTemplate(this, artifact, presentationType, (String) option); return templateArtifact.getSoleAttributeValue(CoreAttributeTypes.WholeWordContent); } return Strings.EMPTY_STRING; }
Source:
<code>public Map<String, Fingerprint> identifyContaminant(final Path samFile, final double contamination) { <START> final Map<FingerprintIdDetails, Fingerprint> fingerprintIdDetailsFingerprintMap = this.fingerprintSamFile(samFile, (h) -> new HaplotypeProbabilitiesFromContaminatorSequence(h, contamination)); <END> final Map<FingerprintIdDetails, Fingerprint> fingerprintIdDetailsFingerprintbySample = Fingerprint.mergeFingerprintsBy(fingerprintIdDetailsFingerprintMap, Fingerprint.getFingerprintIdDetailsStringFunction(CrosscheckMetric.DataType.SAMPLE)); final Map<String,Fingerprint> fingerprintsBySample = fingerprintIdDetailsFingerprintbySample.entrySet().stream() .collect(Collectors.toMap(e -> e.getKey().sample, Map.Entry::getValue)); return fingerprintsBySample; }</code><technical_language>()s unnecessary for single arg lambda suggestion final Map<FingerprintIdDetails, Fingerprint> fingerprintIdDetailsFingerprintMap = this.fingerprintSamFile(samFile, h -> new HaplotypeProbabilitiesFromContaminatorSequence(h, contamination));</technical_language>

Target:
public Map<String, Fingerprint> identifyContaminant(final Path samFile, final double contamination) { final Map<FingerprintIdDetails, Fingerprint> fpIdDetailsMap = this.fingerprintSamFile(samFile, h -> new HaplotypeProbabilitiesFromContaminatorSequence(h, contamination)); final Map<FingerprintIdDetails, Fingerprint> fpIdDetailsBySample = Fingerprint.mergeFingerprintsBy(fpIdDetailsMap, Fingerprint.getFingerprintIdDetailsStringFunction(CrosscheckMetric.DataType.SAMPLE)); return fpIdDetailsBySample.entrySet().stream() .collect(Collectors.toMap(e -> e.getKey().sample, Map.Entry::getValue)); }
Source:
<code><START> public void post(Iterable<Event> events) { <END> post(events, StreamObservers.<Event>noOpObserver()); }</code><technical_language>final well? if try rewrite Mockito tests? I asking tweak tests for reasons: * final design; * avoid <p>Use {@code Bus} class abstract methods modify behavior of posting <p>This method defines general posting flow overridden.</technical_language>

Target:
public final void post(Iterable<Event> events) { post(events, StreamObservers.<IsSent>noOpObserver()); }
Source:
<code>public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { <START> FUtil.bcastMsg(ChatColor.GRAY + "[" + ChatColor.YELLOW + "Imposter" + ChatColor.GRAY + "] " <END> + ChatColor.WHITE + "< " + ChatColor.RESET + "" + sender.getName() + ChatColor.WHITE + "> " + ChatColor.YELLOW + "Has verified and is requesting to be added!" ); return true; }</code><technical_language>bcast Admins only? Ops spam</technical_language>

Target:
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { for (Player player : server.getOnlinePlayers()) { if (isAdmin(player)) { FUtil.msg(ChatColor.GRAY + "[" + ChatColor.YELLOW + "Imposter" + ChatColor.GRAY + "] " + ChatColor.WHITE + "< " + ChatColor.RESET + "" + sender.getName() + ChatColor.WHITE + "> " + ChatColor.YELLOW + "Has verified and is requesting to be added!"); } return true; } }
Source:
<code>public static boolean isStatusOk(Map<String, Object> response) { if (response.get("error") != null) { String errorCode = response.get("error_code") == null ? (String) response.get("error") : (String) response.get("error_code"); String errorDescription = response.get("error_description") == null ? (String) response.get("error") : (String) response.get("error_description"); <START> throw new RuntimeException(String.format("%s: %s", errorCode, errorDescription)); <END> } return true; }</code><technical_language>code more readable correct? public static boolean isStatusOk(Map<String, Object> response) { String error = (String) response.get("error"); if (error != null) { String errorCode = response.get("error_code"); String errorDescription = response.get("error_description"); StringBuilder sb = new StringBuilder(); sb.append(error); if (errorCode != null) { sb.append(", Code: "); sb.append(errorCode); } if (errorDescription != null) { sb.append(", Derscription: "); sb.append(errorDescription); } throw new RuntimeException(sb.toString()); } return true; }</technical_language>

Target:
public static boolean isStatusOk(Map<String, Object> response) { if (response.get("error") != null) { Object errorCode = response.get("error_code"); String msg; if (errorCode == null) { msg = String.format("%s: %s", response.get("error"), response.get("error_description")); } else { msg = String.format("%s: %s", errorCode, response.get("error")); } throw new RuntimeException(msg); } return true; }