auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void createVault() throws InterruptedException { server.enqueue(jsonResponse("/vaultcreate.json").setResponseCode(200)); final VaultApi vaultApi = api.getVaultApi(resourceGroup); Vault vault = vaultApi.createOrUpdateVault(vaultName, location, VaultProperties.builder() .tenantId(this.tenantId) .sku(SKU.create(location, "standard", null, "A")) .accessPolicies(ImmutableList.of(VaultProperties.AccessPolicyEntry.create(null, this.identityObjId, this.tenantId, VaultProperties.Permissions.create( ImmutableList.of( "Get", "List", "Update", "Create", "Import", "Delete", "ManageContacts", "ManageIssuers", "GetIssuers", "ListIssuers", "SetIssuers", "DeleteIssuers", "Purge", "Recover" ), ImmutableList.of( "Get", "List", "Update", "Create", "Import", "Delete", "Recover", "Backup", "Restore", "Purge" ), ImmutableList.of( "Get", "List", "Set", "Delete", "Recover", "Backup", "Restore", "Purge" ), ImmutableList.<String>of() )))) .build(), null); String path = String.format( "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.KeyVault/vaults/%s?%s", subscriptionId, resourceGroup, vaultName, apiVersion ); <START> assertSent(server, "PUT", path); <END> assertNotNull(vault); assertNotNull(vault.properties().vaultUri()); assertTrue(!vault.name().isEmpty()); }</code><technical_language>I this kind of a pain, need assert payload for requests a body. This *really* helps future maintenance of APIs</technical_language>

Target:
public void createVault() throws InterruptedException { server.enqueue(jsonResponse("/vaultcreate.json").setResponseCode(200)); final VaultApi vaultApi = api.getVaultApi(resourceGroup); Vault vault = vaultApi.createOrUpdateVault(vaultName, location, VaultProperties.builder() .tenantId(this.tenantId) .sku(SKU.create(location, "standard", null, "A")) .accessPolicies(ImmutableList.of(VaultProperties.AccessPolicyEntry.create(null, this.identityObjId, this.tenantId, VaultProperties.Permissions.create( ImmutableList.of( "Get", "List", "Update", "Create", "Import", "Delete", "ManageContacts", "ManageIssuers", "GetIssuers", "ListIssuers", "SetIssuers", "DeleteIssuers", "Purge", "Recover" ), ImmutableList.of( "Get", "List", "Update", "Create", "Import", "Delete", "Recover", "Backup", "Restore", "Purge", "Encrypt", "Decrypt", "Sign", "Verify", "WrapKey", "UnwrapKey" ), ImmutableList.of( "Get", "List", "Set", "Delete", "Recover", "Backup", "Restore", "Purge" ), ImmutableList.<String>of() )))) .build(), null); String path = String.format( "/subscriptions/%s/resourcegroups/%s/providers/Microsoft.KeyVault/vaults/%s?%s", subscriptionId, resourceGroup, vaultName, apiVersion ); assertSent(server, "PUT", path, stringFromResource("/vaultcreaterequestbody.json")); assertNotNull(vault); assertNotNull(vault.properties().vaultUri()); assertTrue(!vault.name().isEmpty()); }
Source:
<code>public String[] getInfoForIdentifier(String identifier) { String name = Const.USER_NOBODY_TEXT; String teamName = Const.USER_NOBODY_TEXT; String sectionName = Const.DEFAULT_SECTION; boolean isStudent = this.getStudentForEmail(identifier) != null; boolean isInstructor = this.getInstructorForEmail(identifier) != null; boolean isTeam = this.getTeamToMembersTable().containsKey(identifier); if (isStudent) { StudentAttributes student = this.getStudentForEmail(identifier); name = student.getName(); teamName = student.getTeam(); sectionName = student.getSection(); } else if (isInstructor) { InstructorAttributes instructor = this.getInstructorForEmail(identifier); name = instructor.getName(); teamName = Const.USER_TEAM_FOR_INSTRUCTOR; sectionName = Const.DEFAULT_SECTION; } else if (isTeam) { StudentAttributes teamMember = this.getTeamToMembersTable().get(identifier).iterator().next(); name = identifier; teamName = identifier; sectionName = teamMember.getSection(); } <START> return new String[] { name, teamName, sectionName }; <END> }</code><technical_language>While this works, define another small data structure 3 fields for this. need INFO_* variables</technical_language>

Target:
public ParticipantInfo getInfoForIdentifier(String identifier) { String name = Const.USER_NOBODY_TEXT; String teamName = Const.USER_NOBODY_TEXT; String sectionName = Const.DEFAULT_SECTION; boolean isStudent = getStudentForEmail(identifier) != null; boolean isInstructor = getInstructorForEmail(identifier) != null; boolean isTeam = getTeamToMembersTable().containsKey(identifier); if (isStudent) { StudentAttributes student = getStudentForEmail(identifier); name = student.getName(); teamName = student.getTeam(); sectionName = student.getSection(); } else if (isInstructor) { InstructorAttributes instructor = getInstructorForEmail(identifier); name = instructor.getName(); teamName = Const.USER_TEAM_FOR_INSTRUCTOR; sectionName = Const.DEFAULT_SECTION; } else if (isTeam) { StudentAttributes teamMember = getTeamToMembersTable().get(identifier).iterator().next(); name = identifier; teamName = identifier; sectionName = teamMember.getSection(); } return new ParticipantInfo(name, teamName, sectionName); }
Source:
<code>public String getData() { String data; if (webSocketMessage == null || webSocketMessage.payload == null) { data = ""; } else { try { <START> data = webSocketMessage.getPayloadAsString(); <END> isErrorMessage = false; } catch (InvalidUtf8Exception e) { isErrorMessage = true; if (webSocketMessage.opcode.equals(WebSocketMessage.OPCODE_BINARY)) { data = Constant.messages.getString("websocket.payload.unreadable_binary"); } else { data = Constant.messages.getString("websocket.payload.invalid_utf8"); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Unable to decode " + Arrays.toString((byte[]) webSocketMessage.payload) + " as UTF-8.", e); } } } } return data; }</code><technical_language>This breaks current handling of binary payloads (InvalidUtf8Exception is longer thrown end replacing contents, potentially malformed data). view is editable older method</technical_language>

Target:
public String getData() { String data; if (webSocketMessage == null || webSocketMessage.payload == null) { data = ""; }else if(editable){ try { data = webSocketMessage.getReadablePayload(); isErrorMessage = false; } catch (InvalidUtf8Exception e) { isErrorMessage = true; if (webSocketMessage.opcode.equals(WebSocketMessage.OPCODE_BINARY)) { data = Constant.messages.getString("websocket.payload.unreadable_binary"); } else { data = Constant.messages.getString("websocket.payload.invalid_utf8"); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Unable to decode " + Arrays.toString((byte[]) webSocketMessage.payload) + " as UTF-8.", e); } } } }else { data = webSocketMessage.getPayloadAsString(); } return data; }
Source:
<code>private boolean copyFile(URI srcUri, URI dstUri) throws IOException { try { String encodedUrl = null; try { encodedUrl = URLEncoder.encode(srcUri.getHost() + srcUri.getPath(), StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } String dstPath = sanitizePath(dstUri.getPath()); CopyObjectRequest.Builder copyReqBuilder = CopyObjectRequest.builder().copySource(encodedUrl) .destinationBucket(dstUri.getHost()).destinationKey(dstPath); CopyObjectRequest copyReq; <START> if (!disableAcl) { <END> copyReq = copyReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL).build(); } else { copyReq = copyReqBuilder.build(); } CopyObjectResponse copyObjectResponse = _s3Client.copyObject(copyReq); return copyObjectResponse.sdkHttpResponse().isSuccessful(); } catch (S3Exception e) { throw new IOException(e); } }</code><technical_language>if (!disableAcl) { copyReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL); } CopyObjectRequest copyReq = copyReqBuilder.build();</technical_language>

Target:
private boolean copyFile(URI srcUri, URI dstUri) throws IOException { try { String encodedUrl = null; try { encodedUrl = URLEncoder.encode(srcUri.getHost() + srcUri.getPath(), StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } String dstPath = sanitizePath(dstUri.getPath()); CopyObjectRequest.Builder copyReqBuilder = CopyObjectRequest.builder().copySource(encodedUrl) .destinationBucket(dstUri.getHost()).destinationKey(dstPath); if (!disableAcl) { copyReqBuilder.acl(ObjectCannedACL.BUCKET_OWNER_FULL_CONTROL); } CopyObjectRequest copyReq = copyReqBuilder.build(); CopyObjectResponse copyObjectResponse = _s3Client.copyObject(copyReq); return copyObjectResponse.sdkHttpResponse().isSuccessful(); } catch (S3Exception e) { throw new IOException(e); } }
Source:
<code>public List<Object> merge(List<?>... items) { if (ArrayUtils.isEmpty(items)) { <START> return new ArrayList<Object>(); <END> } List<Object> result = new ArrayList<Object>(); for (List<?> item : items) { if (item != null) { result.addAll(item); } } return result; }</code><technical_language>Pls. Collections.emptyList() instead</technical_language>

Target:
public List<Object> merge(List<?>... items) { if (ArrayUtils.isEmpty(items)) { return Collections.emptyList(); } List<Object> result = new ArrayList<Object>(); for (List<?> item : items) { if (item != null) { result.addAll(item); } } return result; }
Source:
<code>private static void setValueProperty(String entryId, String subKey, Object value) throws Exception { ConcurrentHashMap<String, Object> entryMap = entryIdToKalturaLiveEntryMap.get(entryId); entryMap.put(subKey, value); entryMap.put(Constants.KALTURA_ENTRY_START_TIME, System.currentTimeMillis()); <START> logger.debug("(" + entryId + ") Successfully updated entry. Sub key \"" + subKey + "\" (map size:" + entryIdToKalturaLiveEntryMap.size() + ")"); <END> }</code><technical_language>remove map put time</technical_language>

Target:
private static void setValueProperty(String entryId, String subKey, Object value) throws Exception { ConcurrentHashMap<String, Object> entryMap = entryIdToKalturaLiveEntryMap.get(entryId); entryMap.put(subKey, value); long time = System.currentTimeMillis(); entryMap.put(Constants.KALTURA_ENTRY_VALIDATED_TIME, time); logger.debug("(" + entryId + ") Successfully updated entry ; Sub key \"" + subKey + "\" ; Time: (" + time + ")"); }
Source:
<code>public void handle(Context context) throws Exception { <START> if (!name.equals(DEFAULT_NAME_TOKEN)) { <END> handleByName(context, name); } else { handleAll(context); } }</code><technical_language>This logic right. want support is running a check if name a path token. This classes param name of path token for. If token is present, render check name matches</technical_language>

Target:
public void handle(Context context) throws Exception { if (name != null && !"".equals(name)) { handleByName(context, name); } else { handleAll(context); } }
Source:
<code>private static ContinuousStream<Map<String, Object>> cepStatelessRulesTranslator( final ContinuousStream<Map<String, Object>> inputMap, final List<CepStatelessRule> cepStatelessRules) { final int ruleNum = cepStatelessRules.size(); for (int i = 0; i < ruleNum; i++) { final CepStatelessRule rule = cepStatelessRules.get(i); final CepAction action = rule.getAction(); final CepSink sink = action.getCepSink(); ContinuousStream<Map<String, Object>> temp = inputMap; switch (action.getCepActionType()) { case TEXT_WRITE: { switch (sink.getCepSinkType()) { case TEXT_SOCKET_OUTPUT: { temp = cepConditionTranslator(temp, rule.getCondition()); final List<Object> params = action.getParams(); final String separator = sink.getSeparator(); temp.map(new CepMapToStringFunction(params, separator)) .textSocketOutput((String)sink.getSinkConfigs().get("SOCKET_SINK_ADDRESS"), (int)sink.getSinkConfigs().get("SOCKET_SINK_PORT")); break; } case MQTT_OUTPUT: { temp = cepConditionTranslator(temp, rule.getCondition()); final List<Object> params = action.getParams(); final String separator = sink.getSeparator(); temp.map(new CepMapToStringFunction(params, separator)) .map(value -> new MqttMessage(value.getBytes())) .mqttOutput((String) sink.getSinkConfigs().get("MQTT_SINK_BROKER_URI"), (String) sink.getSinkConfigs().get("MQTT_SINK_TOPIC")); break; } default: <START> throw new IllegalStateException("Wrong sink type!"); <END> } break; } default: continue; } } return inputMap; }</code><technical_language>adding type of sinks here? (TEXT_SOCKET_OUTPUT, MQTT_OUTPUT)</technical_language>

Target:
private static ContinuousStream<Map<String, Object>> cepStatelessRulesTranslator( final ContinuousStream<Map<String, Object>> inputMap, final List<CepStatelessRule> cepStatelessRules) { final int ruleNum = cepStatelessRules.size(); for (int i = 0; i < ruleNum; i++) { final CepStatelessRule rule = cepStatelessRules.get(i); final CepAction action = rule.getAction(); final CepSink sink = action.getCepSink(); ContinuousStream<Map<String, Object>> temp = inputMap; switch (action.getCepActionType()) { case TEXT_WRITE: { switch (sink.getCepSinkType()) { case TEXT_SOCKET_OUTPUT: { temp = cepConditionTranslator(temp, rule.getCondition()); final List<Object> params = action.getParams(); final String separator = sink.getSeparator(); temp.map(new CepMapToStringFunction(params, separator)) .textSocketOutput((String)sink.getSinkConfigs().get("SOCKET_SINK_ADDRESS"), (int)sink.getSinkConfigs().get("SOCKET_SINK_PORT")); break; } case MQTT_OUTPUT: { temp = cepConditionTranslator(temp, rule.getCondition()); final List<Object> params = action.getParams(); final String separator = sink.getSeparator(); temp.map(new CepMapToStringFunction(params, separator)) .map(value -> new MqttMessage(value.getBytes())) .mqttOutput((String) sink.getSinkConfigs().get("MQTT_SINK_BROKER_URI"), (String) sink.getSinkConfigs().get("MQTT_SINK_TOPIC")); break; } default: throw new IllegalStateException("TEXT_SOCKET_OUTPUT, MQTT_OUTPUT are available!"); } break; } default: continue; } } return inputMap; }
Source:
<code>void onCanvasElementUpdated(final @Observes CanvasElementUpdatedEvent event) { final Element<?> element = event.getElement(); if ((element instanceof Node)) { final Node node = (Node) element; if (node.getContent() instanceof Definition) { final Definition definition = (Definition) node.getContent(); hasExpression.ifPresent(e -> { if (e.equals(definition.getDefinition())) { view.setReturnToDRGText(Optional.ofNullable((HasName) definition.getDefinition())); } }); } <START> } <END> }</code><technical_language>blocks code hard readable, I able more readable code. is expcetion. do need line final Node node = (Node) element;. minimize dangerous of NPE Objects.equals(e, definition.getDefinition()) code like: java final Element<?> element = event.getElement(); if ((element instanceof Node)) { if (element.getContent() instanceof Definition) { final Definition definition = (Definition) element.getContent(); hasExpression.ifPresent(e -> { if (Objects.equals(e, definition.getDefinition())) { view.setReturnToDRGText(Optional.ofNullable((HasName) definition.getDefinition())); } }); } }</technical_language>

Target:
void onCanvasElementUpdated(final @Observes CanvasElementUpdatedEvent event) { final Element<?> element = event.getElement(); if ((element instanceof Node)) { if (element.getContent() instanceof Definition) { final Definition definition = (Definition) element.getContent(); hasExpression.ifPresent(e -> { if (Objects.equals(e, definition.getDefinition())) { view.setReturnToDRGText(Optional.ofNullable((HasName) definition.getDefinition())); } }); } } }
Source:
<code>public void testPipelineCompatibility() throws Exception { WorkflowJob p = rule.jenkins.createProject(WorkflowJob.class, "p"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " catchError {error 'oops'}\n" + " step([$class: 'Mailer', recipients: '" + RECIPIENT + "'])\n" + "}", true)); Mailbox inbox = getMailbox(RECIPIENT); inbox.clear(); WorkflowRun b = rule.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get()); <START> assertEquals(1, inbox.size()); <END> assertEquals("Build failed in Jenkins: " + b.getFullDisplayName(), inbox.get(0).getSubject()); assertThat(rule.getLog(b), containsString("Sending e-mails to")); }</code><technical_language>NIT: assertThat below, hasSize yield a clearer message in case of failure</technical_language>

Target:
public void testPipelineCompatibility() throws Exception { WorkflowJob p = rule.jenkins.createProject(WorkflowJob.class, "p"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " catchError {error 'oops'}\n" + " step([$class: 'Mailer', recipients: '" + RECIPIENT + "'])\n" + "}", true)); Mailbox inbox = getMailbox(RECIPIENT); inbox.clear(); WorkflowRun b = rule.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get()); assertThat("One email should have been sent", inbox, hasSize(1)); assertEquals("Build failed in Jenkins: " + b.getFullDisplayName(), inbox.get(0).getSubject()); assertThat(rule.getLog(b), containsString("Sending e-mails to")); }
Source:
<code>public Map<String, String> get(@PathParam("location") Integer locationId) { <START> return asMap(locationId, store.get(locationId)); <END> }</code><technical_language>If this returned instance of Location, automatically converted json etc</technical_language>

Target:
public LocationSummary get(@PathParam("location") Integer locationId) { return new LocationSummary(locationId.toString(), store.get(locationId)); }
Source:
<code>public int hashCode() { <START> int result = storageDomainId != null ? storageDomainId.hashCode() : 0; result = 31 * result + (imageGroupId != null ? imageGroupId.hashCode() : 0); result = 31 * result + (baseImageId != null ? baseImageId.hashCode() : 0); result = 31 * result + (topImageId != null ? topImageId.hashCode() : 0); result = 31 * result + (baseImageGeneration != null ? baseImageGeneration.hashCode() : 0); result = 31 * result + (baseImage != null ? baseImage.hashCode() : 0); result = 31 * result + (topImage != null ? topImage.hashCode() : 0); return result; <END> }</code><technical_language>Objects.hashCode</technical_language>

Target:
public int hashCode() { return Objects.hash(storageDomainId, imageGroupId, baseImageId, topImageId, baseImageGeneration, baseImage, topImage); }
Source:
<code>private <T extends Serializable> void sendMessageToAllRegionsSync(final T body) throws IOException { if ( sns == null ) { logger.error( "SNS client is null, perhaps it failed to initialize successfully" ); return; } final String stringBody = toString( body ); String topicArn = getWriteTopicArn(); if ( logger.isTraceEnabled() ) { logger.trace( "Publishing Message...{} to arn: {}", stringBody, topicArn ); } try { PublishResult publishResult = sns.publish(topicArn, toString(body)); if ( logger.isTraceEnabled() ) { logger.trace( "Successfully published... messageID=[{}], arn=[{}]", publishResult.getMessageId(), topicArn ); } } catch (Exception e) { if (logger.isErrorEnabled()) { <START> logger.error("Failed to send this message to SNS queue at {}", stringBody, topicArn); <END> } sendMessageToAllRegionsAsync(body); } }</code><technical_language>"Failed send this message SNS queue {}, sending asynchronously" -- this logger.info? format in logs for ease of parsing if need a cron job? "FAILED INDEX REQUEST: Failed send message SNS Queue, sending asynchronously. Message:[{}] URL:[{}]"</technical_language>

Target:
private <T extends Serializable> void sendMessageToAllRegionsSync(final T body) throws IOException { if ( sns == null ) { logger.error( "SNS client is null, perhaps it failed to initialize successfully" ); return; } final String stringBody = toString( body ); String topicArn = getWriteTopicArn(); if ( logger.isTraceEnabled() ) { logger.trace( "Publishing Message...{} to arn: {}", stringBody, topicArn ); } try { PublishResult publishResult = sns.publish(topicArn, toString(body)); if ( logger.isTraceEnabled() ) { logger.trace( "Successfully published... messageID=[{}], arn=[{}]", publishResult.getMessageId(), topicArn ); } } catch (Exception e) { if (logger.isErrorEnabled()) { logger.error(FAILED_TO_SEND_MESSAGE, stringBody, topicArn, e); } sendMessageToAllRegionsAsync(body); } }
Source:
<code>private void handleVdsLiveSnapshotFailure(VdcBLLException e) { log.warnFormat("Wasn't able to live snpashot due to error: {0}. VM will still be configured to the new created snapshot", ExceptionUtils.getMessage(e)); AuditLogableBase logable = new AuditLogableBase(); logable.AddCustomValue("SnapshotName", getSnapshotName()); <START> logable.AddCustomValue("VmName", getVmName()); <END> AuditLogDirector.log(logable, AuditLogType.USER_CREATE_LIVE_SNAPSHOT_FINISHED_FAILURE); }</code><technical_language>set attributes command itself</technical_language>

Target:
private void handleVdsLiveSnapshotFailure(VdcBLLException e) { log.warnFormat("Wasn't able to live snpashot due to error: {0}. VM will still be configured to the new created snapshot", ExceptionUtils.getMessage(e)); AddCustomValue("SnapshotName", getSnapshotName()); AddCustomValue("VmName", getVmName()); AuditLogDirector.log(this, AuditLogType.USER_CREATE_LIVE_SNAPSHOT_FINISHED_FAILURE); }
Source:
<code>protected Marshaller getMarshaller() { Marshaller marshaller = null; try { JAXBContextHandler oHandler = new JAXBContextHandler(); JAXBContext jc = oHandler.getJAXBContext(CORE_X12AuditDataTransformConstants.CORE_X12_JAXB_CONTEXT); marshaller = jc.createMarshaller(); <START> return marshaller; <END> } catch (JAXBException ex) { LOG.error("JAXB Marshall error : " + ex.getMessage(), ex); } return marshaller; }</code><technical_language>This return is redundant removed</technical_language>

Target:
protected Marshaller getMarshaller() { Marshaller marshaller = null; try { JAXBContextHandler oHandler = new JAXBContextHandler(); JAXBContext jc = oHandler.getJAXBContext(CORE_X12AuditDataTransformConstants.CORE_X12_JAXB_CONTEXT); marshaller = jc.createMarshaller(); } catch (JAXBException ex) { LOG.error("JAXB Marshall error : " + ex.getMessage(), ex); } return marshaller; }
Source:
<code>private <T> RPCResponse<T> invoke(String name, String path, Class<T> resultType) throws FreeIpaClientException { Invocation.Builder builder = rpcTarget.path(path) .request() .headers(headers); try (Response response = builder.get()) { if (!response.bufferEntity()) { throw new FreeIpaClientException("Unable to buffer the response from FreeIPA"); } if (listener != null) { listener.onBeforeResponseProcessed(response); } if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL && response.getStatus() != Response.Status.SERVICE_UNAVAILABLE.getStatusCode()) { String message = String.format("Invoke FreeIpa health check failed: %d", response.getStatus()); throw new FreeIpaClientException(message, response.getStatus()); } return toRpcResponse(name, response, resultType); } catch (FreeIpaClientException e) { throw e; } catch (Throwable throwable) { <START> String message = String.format("Invoke FreeIpa health check failed: %s", throwable.getLocalizedMessage()); <END> LOGGER.warn(message); throw new FreeIpaClientException(message, throwable); } }</code><technical_language>FreeIpa FreeIPA asking in this pr word used</technical_language>

Target:
private <T> RPCResponse<T> invoke(String name, String path, Class<T> resultType) throws FreeIpaClientException { Invocation.Builder builder = rpcTarget.path(path) .request() .headers(headers); try (Response response = builder.get()) { bufferResponseEntity(response); processRpcListener(response); checkResponseStatus(response); return toRpcResponse(name, response, resultType); } catch (FreeIpaClientException e) { throw e; } catch (Throwable throwable) { String message = String.format("Invoke FreeIPA health check failed: %s", throwable.getLocalizedMessage()); LOGGER.warn(message); throw new FreeIpaClientException(message, throwable); } }
Source:
<code>private static Object getValueByName(Class<? extends Enum<?>> enumClass, String name) { final Enum<?>[] enumConstants = enumClass.getEnumConstants(); return JdbiOptionals.findFirstPresent( () -> Arrays.stream(enumConstants).filter(e -> { final Field field; try { field = enumClass.getField(e.name()); } catch (final NoSuchFieldException ex) { <START> throw new RuntimeException(ex); <END> } final DatabaseValue databaseValue = field.getAnnotation(DatabaseValue.class); return databaseValue != null && databaseValue.value().equals(name); }).findFirst(), () -> Arrays.stream(enumConstants).filter(e -> e.name().equals(name)).findFirst(), () -> Arrays.stream(enumConstants).filter(e -> e.name().equalsIgnoreCase(name)).findFirst() ) .orElseThrow(() -> new UnableToProduceResultException( String.format("no %s value could be matched to the name %s", enumClass.getSimpleName(), name))); }</code><technical_language>before: please Unchecked consider a private method ref instead of a lambda</technical_language>

Target:
private static Object getValueByName(Class<? extends Enum<?>> enumClass, String name) { final Enum<?>[] enumConstants = enumClass.getEnumConstants(); return JdbiOptionals.findFirstPresent( () -> Arrays.stream(enumConstants).filter(e -> { final Field field = Unchecked.function(enumClass::getField).apply(e.name()); final DatabaseValue databaseValue = field.getAnnotation(DatabaseValue.class); return databaseValue != null && databaseValue.value().equals(name); }).findFirst(), () -> Arrays.stream(enumConstants).filter(e -> e.name().equals(name)).findFirst(), () -> Arrays.stream(enumConstants).filter(e -> e.name().equalsIgnoreCase(name)).findFirst() ) .orElseThrow(() -> new UnableToProduceResultException( String.format("no %s value could be matched to the name %s", enumClass.getSimpleName(), name))); }
Source:
<code>private static Field[] getExportedPropertyFields(Class<?> klass) { if (sFieldsForClasses == null) { sFieldsForClasses = new HashMap<Class<?>, Field[]>(); } if (sAnnotations == null) { sAnnotations = new HashMap<AccessibleObject, ExportedProperty>(512); } final HashMap<Class<?>, Field[]> map = sFieldsForClasses; Field[] fields = map.get(klass); if (fields != null) { return fields; } try { <START> final Field[] declaredFields = klass.getDeclaredFieldsUnchecked(false); <END> final ArrayList<Field> foundFields = new ArrayList<Field>(); for (final Field field : declaredFields) { if (field.isAnnotationPresent(ExportedProperty.class)) { field.setAccessible(true); foundFields.add(field); sAnnotations.put(field, field.getAnnotation(ExportedProperty.class)); } } fields = foundFields.toArray(new Field[foundFields.size()]); map.put(klass, fields); } catch (NoClassDefFoundError e) { throw new AssertionError(e); } return fields; }</code><technical_language>this for: commit 99562fbbb40c72722468e5dc8c84b3e28494a20f Author: Alan Viverette <alanv@google.com> Date: Tue Oct 14 14:48:52 2014 -0700 Check type resolution declared methods fields in ViewDebug BUG: 17375269 Change-Id: I8a74dfab1a1cf11b4240afb011d2729beea307c5 making this tolerant missing types for fields</technical_language>

Target:
private static Field[] getExportedPropertyFields(Class<?> klass) { if (sFieldsForClasses == null) { sFieldsForClasses = new HashMap<Class<?>, Field[]>(); } if (sAnnotations == null) { sAnnotations = new HashMap<AccessibleObject, ExportedProperty>(512); } final HashMap<Class<?>, Field[]> map = sFieldsForClasses; Field[] fields = map.get(klass); if (fields != null) { return fields; } try { final Field[] declaredFields = klass.getDeclaredFieldsUnchecked(false); final ArrayList<Field> foundFields = new ArrayList<Field>(); for (final Field field : declaredFields) { if (field.getType() != null && field.isAnnotationPresent(ExportedProperty.class)) { field.setAccessible(true); foundFields.add(field); sAnnotations.put(field, field.getAnnotation(ExportedProperty.class)); } } fields = foundFields.toArray(new Field[foundFields.size()]); map.put(klass, fields); } catch (NoClassDefFoundError e) { throw new AssertionError(e); } return fields; }
Source:
<code>public void addDefaultRoute() { if ((mInterfaceName != null) && (mDefaultGatewayAddr != 0) && mDefaultRouteSet == false) { if (DBG) { Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr); } <START> InetAddress inetAddress = NetworkUtils.intToInetAddress(mDefaultGatewayAddr); <END> if (inetAddress == null) { if (DBG) Log.d(TAG, " Unable to add default route. mDefaultGatewayAddr Error"); } else { if (NetworkUtils.addDefaultRoute(mInterfaceName, inetAddress, 0)) { mDefaultRouteSet = true; } else { if (DBG) Log.d(TAG, " Unable to add default route."); } } } }</code><technical_language>If add mIPv6DefaultGateway member need add a IPv6 route well</technical_language>

Target:
public void addDefaultRoute() { if ((mInterfaceName != null) && (mDefaultGatewayAddr != 0) && mDefaultRouteSet == false) { if (DBG) { Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr); } InetAddress inetAddress = NetworkUtils.intToInetAddress(mDefaultGatewayAddr); if (inetAddress == null) { if (DBG) Log.d(TAG, " Unable to add default route. mDefaultGatewayAddr Error"); } else { if (NetworkUtils.addDefaultRoute(mInterfaceName, inetAddress)) { mDefaultRouteSet = true; } else { if (DBG) Log.d(TAG, " Unable to add default route."); } } } }
Source:
<code><START> public void testCountTotalNumberOfVariants() { <END> assertFalse(service.countTotalNumberOfVariants() < 0); }</code><technical_language>This test check specific number applies test dataset, a wrong positive number returned notice</technical_language>

Target:
public void testCountTotalNumberOfVariants() { assertEquals(498, service.countTotalNumberOfVariants()); }
Source:
<code>private void determineMessageFormat(){ if (!StringUtils.isEmpty(templatePath)) { messageFormat = MessageFormat.CUSTOM; } else if (messageFormat == null || messageFormat.equals("")) { messageFormat = MessageFormat.NONE; } <START> log.info("Message format: {}", messageFormat); <END> }</code><technical_language>This log message is missing some context</technical_language>

Target:
private MessageFormat determineMessageFormat(){ if (!StringUtils.isEmpty(templatePath)) { return MessageFormat.CUSTOM; } else if (messageFormat == null || messageFormat.equals("")) { return MessageFormat.NONE; } return messageFormat; }
Source:
<code>public void merge(SegmentStoreStatistics other) { long min = fMin.getLength(); long max = fMax.getLength(); fMin = min <= other.getMin() ? fMin : other.getMinSegment(); fMax = max >= other.getMax() ? fMax : other.getMaxSegment(); long weight = fNbSegments; double oldAverage = fAverage; fNbSegments += other.getNbSegments(); fTotal += other.getTotal(); <START> fAverage = ((weight * oldAverage) + (other.getAverage() * other.getNbSegments())) / fTotal; <END> double avgTemp1 = oldAverage - fAverage; double avgTemp2 = other.getAverage() - fAverage; fVariance = ((fVariance + avgTemp1 * avgTemp1) * weight + (other.fVariance + avgTemp2 * avgTemp1) * other.getNbSegments()) / fTotal; }</code><technical_language>This is multithread safe</technical_language>

Target:
public void merge(SegmentStoreStatistics other) { if (other.fNbSegments == 0) { return; } else if (fNbSegments == 0) { copy(other); } else if (other.fNbSegments == 1) { update(other.fMax); } else if (fNbSegments == 1) { SegmentStoreStatistics copyOther = new SegmentStoreStatistics(); copyOther.copy(other); copyOther.update(fMax); copy(copyOther); } else { internalMerge(other); } }
Source:
<code>public void encode(StringBuilder builder) { String xacmlVersionId = metaData.getXACMLIdentifier(); String version = getVersion(); <START> builder.append("<PolicySet xmlns=\"" + xacmlVersionId + "\"" + " PolicySetId=\"" + getId() + <END> "\"" + " Version=\"" + version + ""). append("\" PolicyCombiningAlgId=\"").append(getCombiningAlg().getIdentifier().toString()).append("\">\n"); String description = getDescription(); if (description != null){ builder.append("<Description>").append(description).append("</Description>\n"); } String xPathVersion = metaData.getXPathIdentifier(); if (xPathVersion != null){ builder.append("<PolicySetDefaults><XPathVersion>"). append(xPathVersion).append("</XPathVersion></PolicySetDefaults>\n"); } getTarget().encode(builder); encodeCommonElements(builder); builder.append("</PolicySet>\n"); }</code><technical_language>StringBuilder.append() String contact()</technical_language>

Target:
public void encode(StringBuilder builder) { String xacmlVersionId = metaData.getXACMLIdentifier(); String version = getVersion(); builder.append("<PolicySet xmlns=\"").append(xacmlVersionId).append("\" PolicySetId=\""). append(getId().toString()).append("\" PolicyCombiningAlgId=\""). append(getCombiningAlg().getIdentifier().toString()).append("\">\n"); String description = getDescription(); if (description != null){ builder.append("<Description>").append(description).append("</Description>\n"); } String xPathVersion = metaData.getXPathIdentifier(); if (xPathVersion != null){ builder.append("<PolicySetDefaults><XPathVersion>"). append(xPathVersion).append("</XPathVersion></PolicySetDefaults>\n"); } getTarget().encode(builder); encodeCommonElements(builder); builder.append("</PolicySet>\n"); }
Source:
<code>public void differentialRnaSeqExperimentEvidence(@RequestParam(defaultValue = "0") double logFoldChangeCutoff, @RequestParam(defaultValue = "1") double pValueCutoff, @RequestParam(defaultValue = "-1") int maxGenesPerContrast, @PathVariable String experimentAccession, @RequestParam(defaultValue = "") String accessKey, HttpServletResponse response) throws IOException { DifferentialExperiment experiment = (DifferentialExperiment) experimentTrader.getExperiment(experimentAccession, accessKey); response.setHeader("content-type", "application/json-seq; charset=UTF-8"); <START> response.setCharacterEncoding("UTF-8"); <END> PrintWriter w = response.getWriter(); diffRnaSeqEvidenceService.evidenceForExperiment( experiment, contrast -> { DifferentialRequestPreferences requestPreferences = new DifferentialRequestPreferences(); requestPreferences.setFoldChangeCutoff(logFoldChangeCutoff); requestPreferences.setCutoff(pValueCutoff); requestPreferences.setHeatmapMatrixSize(maxGenesPerContrast); requestPreferences.setSelectedColumnIds(ImmutableSet.of(contrast.getId())); return new RnaSeqRequestContext(requestPreferences, experiment); }, o -> w.println(GSON.toJson(o))); }</code><technical_language>forgot remove character encoding setting</technical_language>

Target:
public void differentialRnaSeqExperimentEvidence(@RequestParam(defaultValue = "0") double logFoldChangeCutoff, @RequestParam(defaultValue = "1") double pValueCutoff, @RequestParam(defaultValue = "-1") int maxGenesPerContrast, @PathVariable String experimentAccession, @RequestParam(defaultValue = "") String accessKey, HttpServletResponse response) throws IOException { DifferentialExperiment experiment = (DifferentialExperiment) experimentTrader.getExperiment(experimentAccession, accessKey); response.setHeader("content-type", "application/json-seq; charset=UTF-8"); PrintWriter w = response.getWriter(); diffRnaSeqEvidenceService.evidenceForExperiment( experiment, contrast -> { DifferentialRequestPreferences requestPreferences = new DifferentialRequestPreferences(); requestPreferences.setFoldChangeCutoff(logFoldChangeCutoff); requestPreferences.setCutoff(pValueCutoff); requestPreferences.setHeatmapMatrixSize(maxGenesPerContrast); requestPreferences.setSelectedColumnIds(ImmutableSet.of(contrast.getId())); return new RnaSeqRequestContext(requestPreferences, experiment); }, o -> w.println(GSON.toJson(o))); }
Source:
<code><START> public TrustingSslSocketFactory() { <END> super(); try { sslContext.init(null, new TrustManager[] { TRUST_ALL }, null); } catch (Exception e) { throw Throwables.propagate(e); } }</code><technical_language>If treating singleton (with static INSTANCE field etc), constructor private</technical_language>

Target:
protected TrustingSslSocketFactory() { super(); try { sslContext.init(null, new TrustManager[] { TRUST_ALL }, null); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>public void testInitializeTwiceFails() throws FluoAdmin.AlreadyInitializedException { FluoAdmin fluoAdmin = new FluoAdminImpl(config); config.setClearZookeeper(true); fluoAdmin.initialize(); fluoAdmin.initialize(); config.setClearZookeeper(false); try { <START> fluoAdmin.initialize(); <END> fail("This should have failed"); } catch(FluoAdmin.AlreadyInitializedException e) { } }</code><technical_language>I this test, a users data dropped if accidently init. init call, a call Accumulo ensure table exist</technical_language>

Target:
public void testInitializeTwiceFails() throws FluoAdmin.AlreadyInitializedException { FluoAdmin fluoAdmin = new FluoAdminImpl(config); config.setAllowReinitialize(true); fluoAdmin.initialize(); fluoAdmin.initialize(); config.setAllowReinitialize(false); try { fluoAdmin.initialize(); fail("This should have failed"); } catch(FluoAdmin.AlreadyInitializedException e) { } assertTrue(conn.tableOperations().exists(config.getAccumuloTable())); }
Source:
<code>public Map<String, Object> from(final Object identifier, final Saga saga) { checkNotNull(saga); final Map<String, Object> properties = Maps.newHashMap(); properties.put(X_KASPER_SAGA_CLASS, saga.getClass()); properties.put(X_KASPER_SAGA_IDENTIFIER, identifier); for (final Field field : saga.getClass().getDeclaredFields()) { field.setAccessible(Boolean.TRUE); if ( ! field.getName().startsWith("$") && (Serializable.class.isAssignableFrom(field.getType()) || field.getType().isPrimitive())) { Object value = null; try { value = field.get(saga); } catch (final IllegalAccessException e) { <START> e.printStackTrace(); END> } if (null != value) { properties.put(field.getName(), value); } } } return properties; }</code><technical_language>-1: ;p</technical_language>

Target:
public Map<String, Object> from(final Object identifier, final Saga saga) { checkNotNull(saga); final Map<String, Object> properties = Maps.newHashMap(); properties.put(X_KASPER_SAGA_CLASS, saga.getClass()); properties.put(X_KASPER_SAGA_IDENTIFIER, identifier); for (final Field field : saga.getClass().getDeclaredFields()) { field.setAccessible(Boolean.TRUE); if ( ! field.getName().startsWith("$") && (Serializable.class.isAssignableFrom(field.getType()) || field.getType().isPrimitive())) { Object value = null; try { value = field.get(saga); } catch (final IllegalAccessException e) { LOGGER.error("Failed to extract property '{}' from a saga, <saga={}> <identifier={}>", field.getName(), saga.getClass(), identifier, e); } if (null != value) { properties.put(field.getName(), value); } } } return properties; }
Source:
<code>public String getIdLabel() { Instance instance = getInstance(); if (instance == null) { return ""; } return String.format("%s (0x%x)", ValueDescriptorImpl.getIdLabel(myObjectReference), <START> getInstance().getUniqueId()); <END> }</code><technical_language>s/getInstance()/instance/</technical_language>

Target:
public String getIdLabel() { Instance instance = getInstance(); if (instance == null) { return ""; } return String.format("%s (0x%x)", ValueDescriptorImpl.getIdLabel(myObjectReference), instance.getUniqueId()); }
Source:
<code>getQuestionResponseMapByRecipientTeam() { LinkedHashMap<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> sortedMap = new LinkedHashMap<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>>(); Collections.sort(responses, compareByTeamQuestionRecipientTeamGiver); for (FeedbackResponseAttributes response : responses) { String recipientTeam = getTeamNameForEmail(response.recipientEmail); <START> if (recipientTeam == "") { <END> recipientTeam = getNameForEmail(response.recipientEmail); } if (!sortedMap.containsKey(recipientTeam)) { sortedMap.put(recipientTeam, new LinkedHashMap<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>()); } Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> responsesForOneRecipient = sortedMap.get(recipientTeam); FeedbackQuestionAttributes question = questions.get(response.feedbackQuestionId); if (!responsesForOneRecipient.containsKey(question)) { responsesForOneRecipient.put(question, new ArrayList<FeedbackResponseAttributes>()); } List<FeedbackResponseAttributes> responsesForOneRecipientOneQuestion = responsesForOneRecipient.get(question); responsesForOneRecipientOneQuestion.add(response); } return sortedMap; }</code><technical_language>LOL this is of PMD catch in recipientTeam.isEmpty() (oh means this conflict #5268)</technical_language>

Target:
getQuestionResponseMapByRecipientTeam() { LinkedHashMap<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> sortedMap = new LinkedHashMap<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>>(); Collections.sort(responses, compareByTeamQuestionRecipientTeamGiver); for (FeedbackResponseAttributes response : responses) { String recipientTeam = getTeamNameForEmail(response.recipientEmail); if (recipientTeam.isEmpty()) { recipientTeam = getNameForEmail(response.recipientEmail); } if (!sortedMap.containsKey(recipientTeam)) { sortedMap.put(recipientTeam, new LinkedHashMap<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>()); } Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> responsesForOneRecipient = sortedMap.get(recipientTeam); FeedbackQuestionAttributes question = questions.get(response.feedbackQuestionId); if (!responsesForOneRecipient.containsKey(question)) { responsesForOneRecipient.put(question, new ArrayList<FeedbackResponseAttributes>()); } List<FeedbackResponseAttributes> responsesForOneRecipientOneQuestion = responsesForOneRecipient.get(question); responsesForOneRecipientOneQuestion.add(response); } return sortedMap; }
Source:
<code>private void performTableModification(CommandCall commandCall) { Table table = new Table(commandCall.getElement()); Map<Integer, CommandCall> headerCommands = populateCommandCallByColumnMap(table, commandCall); <START> Row headerRow = table.getLastHeaderRow(); <END> for (Row row : table.getDetailRows()) { CommandCall rowCommand = duplicateCommandForDifferentElement(commandCall, row.getElement()); rowCommand.setParent(commandCall); for (int cellCount = 0; cellCount < row.getCells().length; cellCount++) { CommandCall headerCall = headerCommands.get(cellCount); if (headerCall != null) { Element cellElement = row.getCells()[cellCount]; CommandCall cellCommand = duplicateCommandForDifferentElement(headerCall, cellElement); cellCommand.setParent(rowCommand); } } } for (CommandCall headerCommand : headerCommands.values()) { headerCommand.setParent(null); } }</code><technical_language>currently</technical_language>

Target:
private void performTableModification(CommandCall commandCall) { Table table = new Table(commandCall.getElement()); Map<Integer, CommandCall> headerCommands = populateCommandCallByColumnMap(table, commandCall); Row[] detailRows = table.getDetailRows(); for (int i = 0; i < detailRows.length; i++) { Row row = detailRows[i]; Element[] cells = row.getCells(); if (cells.length != table.getLastHeaderRow().getCells().length) { throw new RuntimeException("The <table> 'execute' command only supports rows with an equal number of columns. Detail row " + (i + 1) + " has a different number of columns to the last header row"); } CommandCall rowCommand = duplicateCommandForDifferentElement(commandCall, row.getElement()); rowCommand.transferToParent(commandCall); for (int cellCount = 0; cellCount < cells.length; cellCount++) { CommandCall headerCall = headerCommands.get(cellCount); if (headerCall != null) { Element cellElement = cells[cellCount]; CommandCall cellCommand = duplicateCommandForDifferentElement(headerCall, cellElement); cellCommand.transferToParent(rowCommand); } } } for (CommandCall headerCommand : headerCommands.values()) { headerCommand.transferToParent(null); } }
Source:
<code>private Path addArtifactsToJar(Path artifactsLocation) throws Exception { Path jarFile = Paths.get(stormJarLocation); <START> if (artifactsLocation.toFile().isDirectory()) { <END> File[] artifacts = artifactsLocation.toFile().listFiles(); if (artifacts.length > 0) { Path newJar = Files.copy(jarFile, artifactsLocation.resolve(jarFile.getFileName())); for (File artifact : artifacts) { executeShellProcess( ImmutableList.of(javaJarCommand, "uf", newJar.toString(), "-C", artifactsLocation.toString(), artifact.getName())); LOG.debug("Added file to jar {}", artifact, jarFile); } return newJar; } } return jarFile; }</code><technical_language>minor: want log artifactsLocation is a directory</technical_language>

Target:
private Path addArtifactsToJar(Path artifactsLocation) throws Exception { Path jarFile = Paths.get(stormJarLocation); if (artifactsLocation.toFile().isDirectory()) { File[] artifacts = artifactsLocation.toFile().listFiles(); if (artifacts.length > 0) { Path newJar = Files.copy(jarFile, artifactsLocation.resolve(jarFile.getFileName())); for (File artifact : artifacts) { executeShellProcess( ImmutableList.of(javaJarCommand, "uf", newJar.toString(), "-C", artifactsLocation.toString(), artifact.getName())); LOG.debug("Added file to jar {}", artifact, jarFile); } return newJar; } } else { LOG.debug("Artifacts directory does not exist, not adding any artifacts to jar", artifactsLocation); } return jarFile; }
Source:
<code>public Annotation(String chromosome, int start, int end, String vepVersion, String vepCacheVersion, Set<? extends IXref> xrefs, Set<? extends IConsequenceType> consequenceTypes) { this.chromosome = chromosome; this.start = start; this.end = end; this.vepVersion = vepVersion; this.vepCacheVersion = vepCacheVersion; this.xrefs = new HashSet<>(); if (xrefs != null) { xrefs.stream().forEach(xref -> this.xrefs.add(new Xref(xref))); } this.consequenceTypes = new HashSet<>(); if (consequenceTypes != null) { <START> consequenceTypes.stream() <END> .forEach(consequence -> this.consequenceTypes.add(new ConsequenceType(consequence))); } }</code><technical_language>This changed for consequenceTypes.forEach(consequence -> this.consequenceTypes.add(new ConsequenceType(consequence))); I required overhead</technical_language>

Target:
public Annotation(String chromosome, int start, int end, String vepVersion, String vepCacheVersion, Set<? extends IXref> xrefs, Set<? extends IConsequenceType> consequenceTypes) { this.chromosome = chromosome; this.start = start; this.end = end; this.vepVersion = vepVersion; this.vepCacheVersion = vepCacheVersion; this.xrefs = new HashSet<>(); if (xrefs != null) { xrefs.forEach(xref -> this.xrefs.add(new Xref(xref))); } this.consequenceTypes = new HashSet<>(); if (consequenceTypes != null) { consequenceTypes.forEach(consequence -> this.consequenceTypes.add(new ConsequenceType(consequence))); } }
Source:
<code>protected GoVisitor buildGoVisitor(@NotNull ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitConditionalExpr(@NotNull GoConditionalExpr o) { if (o.getEq() == null) { return; } if (o.getLeft() instanceof GoIndexOrSliceExpr && o.getRight() instanceof GoStringLiteral) { GoIndexOrSliceExpr left = (GoIndexOrSliceExpr)o.getLeft(); GoStringLiteral right = (GoStringLiteral)o.getRight(); checkTypeMismatch(o, holder, left, right, STRING_INDEX_IS_BYTE_QUICK_FIX); } else if (o.getLeft() instanceof GoStringLiteral && o.getRight() instanceof GoIndexOrSliceExpr) { GoIndexOrSliceExpr right = (GoIndexOrSliceExpr)o.getRight(); GoStringLiteral left = (GoStringLiteral)o.getLeft(); <START> checkTypeMismatch(o, holder, right, left, STRING_INDEX_IS_BYTE_QUICK_FIX); <END> } } }; }</code><technical_language>Do need pass constant STRING_INDEX_IS_BYTE_QUICK_FIX argument</technical_language>

Target:
protected GoVisitor buildGoVisitor(@NotNull ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitConditionalExpr(@NotNull GoConditionalExpr o) { GoExpression left = o.getLeft(); GoExpression right = o.getRight(); GoIndexOrSliceExpr indexExpr = getFirstElementOfType(GoIndexOrSliceExpr.class, left, right); GoStringLiteral stringLiteral = getFirstElementOfType(GoStringLiteral.class, left, right); if (indexExpr == null || stringLiteral == null) { return; } if (isStringIndexExpression(indexExpr)) { LocalQuickFix[] fixes = isSingleCharLiteral(stringLiteral) ? new LocalQuickFix[]{STRING_INDEX_IS_BYTE_QUICK_FIX} : LocalQuickFix.EMPTY_ARRAY; holder.registerProblem(o, TEXT_HINT, ProblemHighlightType.GENERIC_ERROR, fixes); } } }; }