auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void handleAnqpResult(String eventStr, String iface) { int addrPos = eventStr.indexOf(ADDR_STRING); int resPos = eventStr.indexOf(RESULT_STRING); if (addrPos < 0 || resPos < 0) { throw new IllegalArgumentException("Unexpected ANQP result notification"); } int eoaddr = eventStr.indexOf(' ', addrPos + ADDR_STRING.length()); if (eoaddr < 0) { eoaddr = eventStr.length(); } int eoresult = eventStr.indexOf(' ', resPos + RESULT_STRING.length()); if (eoresult < 0) { eoresult = eventStr.length(); } long bssid = 0; int result = 0; try { bssid = Utils.parseMac(eventStr.substring(addrPos + ADDR_STRING.length(), eoaddr)); result = eventStr.substring( resPos + RESULT_STRING.length(), eoresult).equalsIgnoreCase("success") ? 1 : 0; } catch (IllegalArgumentException iae) { Log.e(TAG, "Bad MAC address in ANQP response: " + iae.getMessage()); return; } <START> AnqpEvent anqpEvent = null; <END> if (bssid != 0 && result != 0) { String bssData = mWifiNative.scanResult(Utils.macToString(bssid)); if (TextUtils.isEmpty(bssData)) { result = 0; } else { anqpEvent = AnqpEvent.buildAnqpEvent(bssid, bssData); if (anqpEvent == null) { result = 0; } } } broadcastAnqpDoneEvent(iface, result, anqpEvent); }</code><technical_language>I want |anqpEvent| populated of result, bssid. bssid is caller identify request</technical_language>

Target:
private void handleAnqpResult(String eventStr, String iface) { int addrPos = eventStr.indexOf(ADDR_STRING); int resPos = eventStr.indexOf(RESULT_STRING); if (addrPos < 0 || resPos < 0) { throw new IllegalArgumentException("Unexpected ANQP result notification"); } int eoaddr = eventStr.indexOf(' ', addrPos + ADDR_STRING.length()); if (eoaddr < 0) { eoaddr = eventStr.length(); } int eoresult = eventStr.indexOf(' ', resPos + RESULT_STRING.length()); if (eoresult < 0) { eoresult = eventStr.length(); } long bssid = 0; int result = 0; try { bssid = Utils.parseMac(eventStr.substring(addrPos + ADDR_STRING.length(), eoaddr)); result = eventStr.substring( resPos + RESULT_STRING.length(), eoresult).equalsIgnoreCase("success") ? 1 : 0; } catch (IllegalArgumentException iae) { Log.e(TAG, "Bad MAC address in ANQP response: " + iae.getMessage()); return; } AnqpEvent anqpEvent = null; if (bssid != 0 && result != 0) { String bssData = mWifiNative.scanResult(Utils.macToString(bssid)); anqpEvent = AnqpEvent.buildAnqpEvent(bssid, bssData); } else { anqpEvent = AnqpEvent.buildAnqpEvent(bssid, null); } broadcastAnqpDoneEvent(iface, anqpEvent); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (getDisk().getDiskStorageType() == DiskStorageType.LUN) { return getSucceeded() ? AuditLogType.USER_FINISHED_REMOVE_DISK_NO_DOMAIN <START> : AuditLogType.USER_FINISHED_FAILED_REMOVE_DISK_NO_DOMAIN; <END> } else { return getSucceeded() ? AuditLogType.USER_FINISHED_REMOVE_DISK : AuditLogType.USER_FINISHED_FAILED_REMOVE_DISK; } default: return AuditLogType.UNASSIGNED; } }</code><technical_language>lun disks removal fail in execute part, a simple removal db..but i mind for future in case add ops fail</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (getDisk().getDiskStorageType() == DiskStorageType.LUN) { return getSucceeded() ? AuditLogType.USER_FINISHED_REMOVE_DISK_NO_DOMAIN : AuditLogType.USER_FINISHED_FAILED_REMOVE_DISK_NO_DOMAIN; } return getSucceeded() ? AuditLogType.USER_FINISHED_REMOVE_DISK : AuditLogType.USER_FINISHED_FAILED_REMOVE_DISK; default: return AuditLogType.UNASSIGNED; } }
Source:
<code>public static String toSynapseFriendlyName(String input) { if (input == null) { return ""; <START> } <END> return input.replaceAll("[^a-zA-Z0-9\\.\\-_\\s]", " ").replaceAll("\\s+", " ").trim(); }</code><technical_language>pretty "" is a Synapse-friendly name either. (Or if is, a useful one.) throw a null input</technical_language>

Target:
public static String toSynapseFriendlyName(String input) { checkNotNull(input); String value = input.replaceAll("[^a-zA-Z0-9\\.\\-_\\s]", " ").replaceAll("\\s+", " ").trim(); checkArgument(StringUtils.isNotBlank(value)); return value; }
Source:
<code>protected void installApp(Artifact artifact) throws Exception { if (artifact.getFile() == null) { throw new MojoExecutionException(messages.getString("error.install.app.missing")); } <START> setAppsDirectory(); <END> if (getAppsDirectory().equalsIgnoreCase("apps") && !isApplicationConfigured()) { addAppConfiguration(artifact.getArtifactId()); } File destDir = new File(serverDirectory, getAppsDirectory()); log.info(MessageFormat.format(messages.getString("info.install.app"), artifact.getFile().getCanonicalPath())); Copy copyFile = (Copy) ant.createTask("copy"); copyFile.setFile(artifact.getFile()); if (stripVersion) { String file = stripVersionFromName(artifact.getFile().getCanonicalPath(), artifact.getVersion()); file = file.substring(file.lastIndexOf(File.separator) + 1); copyFile.setTofile(new File(destDir, file)); } else { copyFile.setTodir(destDir); } copyFile.execute(); }</code><technical_language>call setAppsDirectory() getAppsDirectory() method</technical_language>

Target:
protected void installApp(Artifact artifact) throws Exception { if (artifact.getFile() == null) { throw new MojoExecutionException(messages.getString("error.install.app.missing")); } String appsDir = getAppsDirectory(); if (appsDir.equalsIgnoreCase("apps") && !isAppConfigInTargetServerXml()) { String fileName = getApplicationFilename(); if (fileName != null && fileName.endsWith(".war")) { addAppConfiguration(fileName.substring(0, fileName.length() - 4), "war"); } } else if (appsDir.equalsIgnoreCase("dropins") && isAppConfigInTargetServerXml()) throw new MojoExecutionException(messages.getString("error.install.app.dropins.directory")); File destDir = new File(serverDirectory, appsDir); log.info(MessageFormat.format(messages.getString("info.install.app"), artifact.getFile().getCanonicalPath())); Copy copyFile = (Copy) ant.createTask("copy"); copyFile.setFile(artifact.getFile()); if (stripVersion) { String file = stripVersionFromName(artifact.getFile().getCanonicalPath(), artifact.getVersion()); file = file.substring(file.lastIndexOf(File.separator) + 1); copyFile.setTofile(new File(destDir, file)); } else { copyFile.setTodir(destDir); } copyFile.execute(); }
Source:
<code>public AbstractPartitionDataStoreWriter(Configuration configuration, Path basePath, CodecInfo codec, PartitionStrategy<T, K> partitionStrategy) { super(); <START> this.configuration = configuration; <END> this.basePath = basePath; this.codec = codec; this.partitionStrategy = partitionStrategy; }</code><technical_language>assert for null ctor args</technical_language>

Target:
public AbstractPartitionDataStoreWriter(Configuration configuration, Path basePath, CodecInfo codec, PartitionStrategy<T, K> partitionStrategy) { super(); this.configuration = configuration; this.basePath = basePath; this.codec = codec; this.partitionStrategy = partitionStrategy; Assert.notNull(partitionStrategy, "Partition strategy must be set"); }
Source:
<code>public ResponseEntity<String> getApplicantsByGroupID(@PathVariable String groupID) { try { resultBYGroupID = applicantService.getApplicantsInAGroup(groupID); } catch (GroupNotFoundException e) { String badRequest = jsonUtil.toJson("group not found"); <START> return new ResponseEntity<>(badRequest, HttpStatus.BAD_REQUEST); <END> } String response = jsonUtil.toJson(resultBYGroupID); return new ResponseEntity<>(response, HttpStatus.OK); }</code><technical_language>In success response return json, fail - return plain-text. is good idea</technical_language>

Target:
public ResponseEntity<List<Applicant>> getApplicantsByGroupID(@PathVariable String groupID) { List<Applicant> resultBYGroupID = applicantService.getApplicantsByGroupID(groupID); if(resultBYGroupID.isEmpty() || resultBYGroupID == null){ return new ResponseEntity<>(resultBYGroupID, HttpStatus.BAD_REQUEST); } return new ResponseEntity<>(resultBYGroupID, HttpStatus.OK); }
Source:
<code>public Throwable handleError(RetrofitError cause) { Response response = cause.getResponse(); Collection<String> contentTypes = ImmutableSet.of(); for (Header header : response.getHeaders()) { if (header.getName().equals("Content-Type")) { contentTypes = ImmutableSet.of(header.getValue()); break; } } InputStream body; try { body = response.getBody().in(); } catch (IOException e) { return new RuntimeException("Cannot get input stream from response: " + e.getMessage(), e); } <START> return SerializableErrorErrorDecoder.INSTANCE.decode(contentTypes, response.getStatus(), response.getReason(), <END> body); }</code><technical_language>move try block</technical_language>

Target:
public Throwable handleError(RetrofitError cause) { Response response = cause.getResponse(); Collection<String> contentTypes = ImmutableSet.of(); for (Header header : response.getHeaders()) { if (header.getName().equals("Content-Type")) { contentTypes = ImmutableSet.of(header.getValue()); break; } } InputStream body; try { body = response.getBody().in(); } catch (IOException e) { return new RuntimeException("Cannot get input stream from response: " + e.getMessage(), e); } return SerializableErrorToExceptionConverter.getException(contentTypes, response.getStatus(), response.getReason(), body); }
Source:
<code>public void should_print_number_of_analyzed_classes() throws Exception { execute("report", "-classfiles", getClassPath()); assertOk(); <START> assertContains("[INFO] Writing report with 14 classes.", out); <END> }</code><technical_language>@marchof message is a bit misleading written disk</technical_language>

Target:
public void should_print_number_of_analyzed_classes() throws Exception { execute("report", "--classfiles", getClassPath()); assertOk(); assertContains("[INFO] Analyzing 14 classes.", out); }
Source:
<code>public int hashCode() { <START> int result = id.hashCode(); <END> result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + model.hashCode(); result = 31 * result + fields.hashCode(); result = 31 * result + layoutTemplate.hashCode(); return result; }</code><technical_language>advisable ~~ (or other "narrowing" operation) ensure JS's "int" overflow a Java "int". numerous emails BSIG in this.. happy dig out if want more explanation</technical_language>

Target:
public int hashCode() { int result = id.hashCode(); result = ~~result; result = 31 * result + (name != null ? name.hashCode() : 0); result = ~~result; result = 31 * result + model.hashCode(); result = ~~result; result = 31 * result + fields.hashCode(); result = ~~result; result = 31 * result + layoutTemplate.hashCode(); result = ~~result; return result; }
Source:
<code><START> public synchronized void registerServer(BlobServer server) { <END> log.info("Registering new blob server of class \"" + server.getClass().getName() + "\"."); servers.add(server); }</code><technical_language>Doron, Juan - expect some sort of "registration load" (i.e - lots of registration requests?) refine synchronization here, if is a case for that</technical_language>

Target:
public void registerServer(BlobServer server) { log.info("Registering blob server of class \"" + server.getClass().getName() + "\"."); serverReference.set(server); }
Source:
<code>public void testValidatePrimaryKeyColumns() { Schema pinotSchema; pinotSchema = new Schema.SchemaBuilder() .addTime(new TimeGranularitySpec(DataType.LONG, TimeUnit.MILLISECONDS, "time"), new TimeGranularitySpec(DataType.INT, TimeUnit.DAYS, "time")).addSingleValueDimension("col", DataType.INT) .setPrimaryKeyColumns(Lists.newArrayList("test")).build(); checkValidationFails(pinotSchema); pinotSchema = new Schema.SchemaBuilder() .addTime(new TimeGranularitySpec(DataType.LONG, TimeUnit.MILLISECONDS, "time"), new TimeGranularitySpec(DataType.INT, TimeUnit.DAYS, "time")).addSingleValueDimension("col", DataType.INT) .setPrimaryKeyColumns(Lists.newArrayList("time")).build(); checkValidationFails(pinotSchema); pinotSchema = new Schema.SchemaBuilder() .addTime(new TimeGranularitySpec(DataType.LONG, TimeUnit.MILLISECONDS, "time"), new TimeGranularitySpec(DataType.INT, TimeUnit.DAYS, "time")).addSingleValueDimension("col", DataType.INT) .setPrimaryKeyColumns(Lists.newArrayList("col")).build(); <START> checkValidationFails(pinotSchema); <END> }</code><technical_language>fail?</technical_language>

Target:
public void testValidatePrimaryKeyColumns() { Schema pinotSchema; pinotSchema = new Schema.SchemaBuilder() .addTime(new TimeGranularitySpec(DataType.LONG, TimeUnit.MILLISECONDS, "incoming"), new TimeGranularitySpec(DataType.INT, TimeUnit.DAYS, "outgoing")).addSingleValueDimension("col", DataType.INT) .setPrimaryKeyColumns(Lists.newArrayList("test")).build(); checkValidationFails(pinotSchema); pinotSchema = new Schema.SchemaBuilder() .addTime(new TimeGranularitySpec(DataType.LONG, TimeUnit.MILLISECONDS, "incoming"), new TimeGranularitySpec(DataType.INT, TimeUnit.DAYS, "outgoing")).addSingleValueDimension("col", DataType.INT) .setPrimaryKeyColumns(Lists.newArrayList("col")).build(); SchemaUtils.validate(pinotSchema); }
Source:
<code>public void testTagKeyById_404() throws Exception { server.enqueue(response404()); <START> api.getTagApi().tagKeyById("tagKeyId"); <END> assertSent(GET, "/caas/2.4/6ac1e746-b1ea-4da5-a24e-caf1a978789d/tag/tagKey/tagKeyId"); }</code><technical_language>Assert returned is null</technical_language>

Target:
public void testTagKeyById_404() throws Exception { server.enqueue(response404()); final TagKey tagKey = api.getTagApi().tagKeyById("tagKeyId"); assertSent(GET, "/caas/" + VERSION + "/6ac1e746-b1ea-4da5-a24e-caf1a978789d/tag/tagKey/tagKeyId"); assertNull(tagKey); }
Source:
<code>void handleExpiredResource(SamzaResourceRequest request, SamzaResource resource, String preferredHost, ResourceRequestState resourceRequestState, ContainerAllocator allocator) { <START> LOG.info("Allocated resource has been expired for Processor ID: request: re-requesting resource again", <END> resource, request.getProcessorId(), request); resourceRequestState.releaseUnstartableContainer(resource, preferredHost); resourceRequestState.cancelResourceRequest(request); SamzaResourceRequest resourceRequest = allocator.getResourceRequest(request.getProcessorId(), request.getPreferredHost()); if (hasActiveContainerPlacementAction(request.getProcessorId())) { ContainerPlacementMetadata metadata = getPlacementActionMetadata(request.getProcessorId()).get(); metadata.recordResourceRequest(resourceRequest); } allocator.issueResourceRequest(request); }</code><technical_language>"has expired" "{}. Re-requesting again"</technical_language>

Target:
void handleExpiredResource(SamzaResourceRequest request, SamzaResource resource, String preferredHost, ResourceRequestState resourceRequestState, ContainerAllocator allocator) { LOG.info("Allocated resource has expired for Processor ID: request: {}. Re-requesting resource again", resource, request.getProcessorId(), request); resourceRequestState.releaseUnstartableContainer(resource, preferredHost); resourceRequestState.cancelResourceRequest(request); SamzaResourceRequest newResourceRequest = allocator.getResourceRequest(request.getProcessorId(), request.getPreferredHost()); if (hasActiveContainerPlacementAction(newResourceRequest.getProcessorId())) { ContainerPlacementMetadata metadata = getPlacementActionMetadata(request.getProcessorId()).get(); metadata.recordResourceRequest(newResourceRequest); } allocator.issueResourceRequest(newResourceRequest); }
Source:
<code>public PhoneNumber parsePhoneNumber(String numberText) { if (!StringUtils.isEmpty(numberText)) { if (numberText.startsWith("00")) { numberText = numberText.replaceFirst("00", "+"); } try { final PhoneNumber phoneNumber = PHONE_UTIL.parse(numberText, null); if (PHONE_UTIL.isValidNumber(phoneNumber)) { return phoneNumber; } } catch (NumberParseException e) { <START> System.out.println("O n�mero n�o � v�lido:" + e); <END> return null; } } return null; }</code><technical_language>System.out is strictly forbidden. This line deleted</technical_language>

Target:
public PhoneNumber parsePhoneNumber(String numberText) { if (!StringUtils.isEmpty(numberText)) { if (numberText.startsWith("00")) { numberText = numberText.replaceFirst("00", "+"); } try { final PhoneNumber phoneNumber = PHONE_UTIL.parse(numberText, null); if (PHONE_UTIL.isValidNumber(phoneNumber)) { return phoneNumber; } } catch (NumberParseException e) { return null; } } return null; }
Source:
<code>public void testSharedPreferencesClearedOnLoggingFailed() { CrashReporter.storeUnhandledException(exception); <START> assertTrue(!sharedPreferences.getString(CrashReporter.EXCEPTION_FOR_REPORT, "").isEmpty()); <END> CrashReporter.sendUnhandledCaughtException(); assertTrue(sharedPreferences.getString(CrashReporter.EXCEPTION_FOR_REPORT, "").isEmpty()); }</code><technical_language>assertFalse(...);</technical_language>

Target:
public void testSharedPreferencesClearedOnLoggingFailed() { CrashReporter.storeUnhandledException(exception); assertFalse(sharedPreferences.getString(CrashReporter.EXCEPTION_FOR_REPORT, "").isEmpty()); CrashReporter.sendUnhandledCaughtException(); assertTrue(sharedPreferences.getString(CrashReporter.EXCEPTION_FOR_REPORT, "").isEmpty()); }
Source:
<code>public static List<String> sanitizeListForCsv(List<String> strList) { List<String> sanitizedStrList = new ArrayList<>(); <START> strList.forEach(string -> sanitizedStrList.add(sanitizeForCsv(string))); <END> return sanitizedStrList; }</code><technical_language>remove temporary variable map this method a one-liner</technical_language>

Target:
public static List<String> sanitizeListForCsv(List<String> strList) { return strList.stream().map(string -> sanitizeForCsv(string)) .collect(Collectors.toList()); }
Source:
<code>public Locale getLocale() { <START> return Locale.forLanguageTag(this.locale); <END> }</code><technical_language>return LanguageUtil.LOCALE_CACHE.getUnchecked(this.locale);</technical_language>

Target:
public Locale getLocale() { return LanguageUtil.LOCALE_CACHE.getUnchecked(this.locale); }
Source:
<code>public boolean canFlipToNextPage() { <START> if (selectedDataObservable.getValue() == null || selectedDataObservable.getValue() instanceof Document) { <END> return false; } return super.canFlipToNextPage(); }</code><technical_language>extract variable</technical_language>

Target:
public boolean canFlipToNextPage() { final Object data = selectedDataObservable.getValue(); if (data == null || data instanceof Document) { return false; } return super.canFlipToNextPage(); }
Source:
<code><START> protected Guid lookupStorageDomainIdByName(String name) { <END> List<storage_domains> storageDomains = getBackendCollection(storage_domains.class, VdcQueryType.GetAllStorageDomains, new VdcQueryParametersBase()); for (storage_domains storageDomain : storageDomains) { if (storageDomain.getstorage_name().equals(name)) { return storageDomain.getId(); } } return null; }</code><technical_language>please of search for admins (this is more efficient) if isFiltered() this code, e.g if (!isFiltered()) { return getEntity(storage_domains.class, SearchType.StorageDomain, "Storage: name=" + name).g etId(); } else { ... VdcQueryType.GetAllStorageDomains ... }</technical_language>

Target:
protected Guid lookupStorageDomainIdByName(String name) { if (!isFiltered()) { return getEntity(storage_domains.class, SearchType.StorageDomain, "Storage: name=" + name).getId(); } else { List<storage_domains> storageDomains = getBackendCollection(storage_domains.class, VdcQueryType.GetAllStorageDomains, new VdcQueryParametersBase()); for (storage_domains storageDomain : storageDomains) { if (storageDomain.getstorage_name().equals(name)) { return storageDomain.getId(); } } return null; } }
Source:
<code>StringBuilder buildValidationResultSummary(List<ValidationResult> validationResults) { StringBuilder validationResultSummary = new StringBuilder(); validationResultSummary .append("Import validation results for ") .append(project.getName()) .append("\n\n"); <START> if (validationResults.isEmpty()) { <END> validationResultSummary.append("Invalid - ").append(NO_PACKAGE_IMPORTS_FOUND).append("\n"); } else { for (ValidationResult result : validationResults) { validationResultSummary.append(result).append("\n"); } } return validationResultSummary; }</code><technical_language>Adding return appending in isEmpty case get rid of else: if (validationResults.isEmpty()) { validationResultSummary.append("Invalid - ").append(NO_PACKAGE_IMPORTS_FOUND).append("\n"); return validationResultSummary; } for (ValidationResult result : validationResults) validationResultSummary.append(result).append("\n"); return validationResultSummary;</technical_language>

Target:
StringBuilder buildValidationResultSummary(List<ValidationResult> validationResults) { StringBuilder validationResultSummary = new StringBuilder(); validationResultSummary .append("Import validation results for ") .append(project.getName()) .append("\n\n"); if (validationResults.isEmpty()) { validationResultSummary.append("Invalid - ").append(NO_PACKAGE_IMPORTS_FOUND).append("\n"); return validationResultSummary; } for (ValidationResult result : validationResults) { validationResultSummary.append(result).append("\n"); } return validationResultSummary; }
Source:
<code>private static void checkUpdatesDelivery(boolean isConcurrent, BoundedContextAction... dispatchActions) { checkNotNull(dispatchActions); final Stand stand = mock(Stand.class); final Executor executor = isConcurrent ? Executors.newFixedThreadPool(Given.THREADS_COUNT_IN_POOL_EXECUTOR) : MoreExecutors.directExecutor(); final BoundedContext boundedContext = spy(Given.boundedContext(stand, executor)); for (BoundedContextAction dispatchAction : dispatchActions) { dispatchAction.perform(boundedContext); } verify(boundedContext, times(dispatchActions.length)).getStandFunnel(); if (isConcurrent) { try { ((ExecutorService) executor).awaitTermination(Given.SEVERAL, TimeUnit.SECONDS); <START> } catch (InterruptedException ignore) { <END> } } verify(stand, times(dispatchActions.length)).update(ArgumentMatchers.any(), any(Any.class)); }</code><technical_language>ignored</technical_language>

Target:
private static void checkUpdatesDelivery(boolean isConcurrent, BoundedContextAction... dispatchActions) { checkNotNull(dispatchActions); final Stand stand = mock(Stand.class); final Executor executor = isConcurrent ? Executors.newFixedThreadPool(Given.THREADS_COUNT_IN_POOL_EXECUTOR) : MoreExecutors.directExecutor(); final BoundedContext boundedContext = spy(Given.boundedContext(stand, executor)); for (BoundedContextAction dispatchAction : dispatchActions) { dispatchAction.perform(boundedContext); } verify(boundedContext, times(dispatchActions.length)).getStandFunnel(); if (isConcurrent) { try { ((ExecutorService) executor).awaitTermination(Given.SEVERAL, TimeUnit.SECONDS); } catch (InterruptedException ignored) { } } verify(stand, times(dispatchActions.length)).update(ArgumentMatchers.any(), any(Any.class)); }
Source:
<code><START> void splitSegment(String processorName, int segmentId) { <END> EventProcessor eventProcessor = getEventProcessor(processorName); if (!(eventProcessor instanceof TrackingEventProcessor)) { logger.info("Split segment requested for processor which is not a Tracking Event Processor"); return; } ((TrackingEventProcessor) eventProcessor).splitSegment(segmentId).whenComplete( (result, throwable) -> { if (throwable != null) { logger.error("Failed to split segment for processor [{}]", segmentId, processorName, throwable); return; } if (result) { logger.info("Successfully split segment of processor [{}]", segmentId, processorName); } else { logger.warn("Was not able to split segment for processor [{}]", segmentId, processorName); } } ); }</code><technical_language>Errors logged here. calling split/merge AxonServer, get information result</technical_language>

Target:
boolean splitSegment(String processorName, int segmentId) { EventProcessor eventProcessor = getEventProcessor(processorName); if (!(eventProcessor instanceof TrackingEventProcessor)) { logger.info("Split segment requested for processor which is not a Tracking Event Processor"); return false; } return ((TrackingEventProcessor) eventProcessor) .splitSegment(segmentId) .thenApply(result -> { if (result) { logger.info("Successfully split segment of processor [{}]", segmentId, processorName); } else { logger.warn("Was not able to split segment for processor [{}]", segmentId, processorName); } return result; }).join(); }
Source:
<code>public static void addCheckStyleMessagesToBundle(ClassLoader checkStylePluginClassLoader) throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException, IOException { <START> final Map<String, String> nameToModuleName = getModuleMapFromPackageObjectFactory(checkStylePluginClassLoader); <END> addMessagesToCheckStyleBundleForLoadedChecks(nameToModuleName, checkStylePluginClassLoader); }</code><technical_language>get rid of final here</technical_language>

Target:
public static void addCheckStyleMessagesToBundle(ClassLoader checkStylePluginClassLoader) throws ClassNotFoundException, IllegalAccessException, NoSuchFieldException, IOException { Map<String, String> nameToModuleName = getModuleMapFromPackageObjectFactory(checkStylePluginClassLoader); addMessagesToCheckStyleBundleForLoadedChecks(nameToModuleName, checkStylePluginClassLoader); }
Source:
<code>public void updateJob(int type, Job job) { switch(type) { case JobConstants.JOB_ADDED: list_.addJob(job); <START> if (job.show) bringToFront(); <END> events_.fireEvent(new JobSelectionEvent(job.id, true, false)); break; case JobConstants.JOB_REMOVED: if (job.id == current_) { hideJobOutput(job.id, true); } list_.removeJob(job); break; case JobConstants.JOB_UPDATED: list_.updateJob(job); if (job.id == current_) { if (job.completed > 0 && progress_ != null) { progress_.setComplete(); } else { if (progress_ == null) { progress_ = new JobProgress(); toolbar_.addLeftWidget(progress_); } progress_.showProgress(new LocalJobProgress(job)); } } break; default: Debug.logWarning("Unrecognized job update type " + type); } }</code><technical_language>skip firing selection event if showing job right -- switch job if pane open desired</technical_language>

Target:
public void updateJob(int type, Job job) { switch(type) { case JobConstants.JOB_ADDED: list_.addJob(job); if (job.show) { bringToFront(); events_.fireEvent(new JobSelectionEvent(job.id, true, false)); } break; case JobConstants.JOB_REMOVED: if (job.id == current_) { hideJobOutput(job.id, true); } list_.removeJob(job); break; case JobConstants.JOB_UPDATED: list_.updateJob(job); if (job.id == current_) { if (job.completed > 0 && progress_ != null) { progress_.setComplete(); } else { if (progress_ == null) { progress_ = new JobProgress(); toolbar_.addLeftWidget(progress_); } progress_.showProgress(new LocalJobProgress(job)); } } break; default: Debug.logWarning("Unrecognized job update type " + type); } }
Source:
<code>private void storeBuffer(Database db, long offset, TypeMarshalBuffer buf, int maxInlineSize) throws CoreException { int len= buf.getPosition(); if (len > 0) { if (len <= maxInlineSize) { db.putBytes(offset, buf.getBuffer(), len); } else { <START> db.putByte(offset, (byte) TypeMarshalBuffer.INDIRECT_TYPE); <END> long chainOffset = offset + 1; buf.putInt(len); int lenSize = buf.getPosition() - len; int bufferPos = 0; while (bufferPos < len) { int chunkLength = bufferPos == 0 ? len + lenSize : len - bufferPos; boolean chainingRequired = false; if (chunkLength > Database.MAX_MALLOC_SIZE) { chunkLength = Database.MAX_MALLOC_SIZE; chainingRequired = true; } long ptr = db.malloc(chunkLength); db.putRecPtr(chainOffset, ptr); if (bufferPos == 0) { db.putBytes(ptr, buf.getBuffer(), len, lenSize); ptr += lenSize; chunkLength -= lenSize; } if (chainingRequired) { chainOffset = ptr; ptr += Database.PTR_SIZE; chunkLength -= Database.PTR_SIZE; } db.putBytes(ptr, buf.getBuffer(), bufferPos, chunkLength); bufferPos += chunkLength; } buf.setPosition(len); } } }</code><technical_language>case necessary if INDIRECT_TYPE defined byte</technical_language>

Target:
private void storeBuffer(Database db, long offset, TypeMarshalBuffer buf, int maxInlineSize) throws CoreException { int len= buf.getPosition(); if (len > 0) { if (len <= maxInlineSize) { db.putBytes(offset, buf.getBuffer(), len); } else { db.putByte(offset, TypeMarshalBuffer.INDIRECT_TYPE); long chainOffset = offset + 1; buf.putInt(len); int lenSize = buf.getPosition() - len; int bufferPos = 0; while (bufferPos < len) { int chunkLength = bufferPos == 0 ? len + lenSize : len - bufferPos; boolean chainingRequired = false; if (chunkLength > Database.MAX_MALLOC_SIZE) { chunkLength = Database.MAX_MALLOC_SIZE; chainingRequired = true; } long ptr = db.malloc(chunkLength); db.putRecPtr(chainOffset, ptr); if (bufferPos == 0) { db.putBytes(ptr, buf.getBuffer(), len, lenSize); ptr += lenSize; chunkLength -= lenSize; } if (chainingRequired) { chainOffset = ptr; ptr += Database.PTR_SIZE; chunkLength -= Database.PTR_SIZE; } db.putBytes(ptr, buf.getBuffer(), bufferPos, chunkLength); bufferPos += chunkLength; } buf.setPosition(len); } } }
Source:
<code>public DetailViewPane(TimeLineController controller) { super(controller); <START> Platform.runLater(() -> { <END> VBox vBox = new VBox(getSpecificLabelPane(), getContextLabelPane()); vBox.setFillWidth(false); HBox hBox = new HBox(getSpacer(), vBox); hBox.setFillHeight(false); setBottom(hBox); DoubleBinding spacerSize = getYAxis().widthProperty().add(getYAxis().tickLengthProperty()).add(getAxisMargin()); getSpacer().minWidthProperty().bind(spacerSize); getSpacer().prefWidthProperty().bind(spacerSize); getSpacer().maxWidthProperty().bind(spacerSize); }); this.selectedEvents = new MappedList<>(getSelectedNodes(), EventNodeBase<?>::getEvent); setChart(new DetailsChart(controller, detailsChartDateAxis, pinnedDateAxis, verticalAxis, getSelectedNodes())); setSettingsNodes(new DetailViewSettingsPane(getChart().getLayoutSettings()).getChildrenUnmodifiable()); detailsChartDateAxis.getTickMarks().addListener((Observable observable) -> layoutDateLabels()); detailsChartDateAxis.getTickSpacing().addListener(observable -> layoutDateLabels()); verticalAxis.setAutoRanging(false); getSelectedNodes().addListener((Observable observable) -> { getChart().setHighlightPredicate(getSelectedNodes()::contains); getController().selectEventIDs(getSelectedNodes().stream() .flatMap(detailNode -> detailNode.getEventIDs().stream()) .collect(Collectors.toList())); }); }</code><technical_language>This pulled AbstractTimelineChart</technical_language>

Target:
public DetailViewPane(TimeLineController controller) { super(controller); this.selectedEvents = new MappedList<>(getSelectedNodes(), EventNodeBase<?>::getEvent); setChart(new DetailsChart(controller, detailsChartDateAxis, pinnedDateAxis, verticalAxis, getSelectedNodes())); setSettingsNodes(new DetailViewSettingsPane(getChart().getLayoutSettings()).getChildrenUnmodifiable()); detailsChartDateAxis.getTickMarks().addListener((Observable observable) -> layoutDateLabels()); detailsChartDateAxis.getTickSpacing().addListener(observable -> layoutDateLabels()); verticalAxis.setAutoRanging(false); getSelectedNodes().addListener((Observable observable) -> { getChart().setHighlightPredicate(getSelectedNodes()::contains); getController().selectEventIDs(getSelectedNodes().stream() .flatMap(detailNode -> detailNode.getEventIDs().stream()) .collect(Collectors.toList())); }); }
Source:
<code>public HierarchyElementView(Context context, HierarchyElement it) { super(context); RelativeLayout layout = (RelativeLayout) inflate(context, R.layout.hierarchy_element_view, null); layout.setBackgroundColor(it.getColor()); mPrimaryTextView = ((TextView)layout.findViewById(R.id.hev_primary_text)); mPrimaryTextView.setText(it.getPrimaryText()); mSecondaryTextView = ((TextView)layout.findViewById(R.id.hev_secondary_text)); mSecondaryTextView.setText(it.getSecondaryText()); mIcon = ((ImageView)layout.findViewById(R.id.hev_icon)); mIcon.setImageDrawable(it.getIcon()); addView(layout); if (BuildConfig.DEBUG) { <START> Log.i("HEVTYPE", "Type of HEV (" + hashCode() + ") is " + it.getType()); <END> Log.i("HEVTYPE", "Icon of HEV (" + hashCode() + ") is " + (it.getIcon() == null ? "null" : it.getIcon().toString())); } }</code><technical_language>TAG = HierarchyElementView.class.getSimpleName() pattern instead of "HEVTYPE"</technical_language>

Target:
public HierarchyElementView(Context context, HierarchyElement it) { super(context); RelativeLayout layout = (RelativeLayout) inflate(context, R.layout.hierarchy_element_view, null); layout.setBackgroundColor(it.getColor()); mPrimaryTextView = ((TextView)layout.findViewById(R.id.hev_primary_text)); mPrimaryTextView.setText(it.getPrimaryText()); mSecondaryTextView = ((TextView)layout.findViewById(R.id.hev_secondary_text)); mSecondaryTextView.setText(it.getSecondaryText()); mIcon = ((ImageView)layout.findViewById(R.id.hev_icon)); mIcon.setImageDrawable(it.getIcon()); addView(layout); if (BuildConfig.DEBUG) { Log.i(TAG, "Type of HEV (" + hashCode() + ") is " + it.getType()); Log.i(TAG, "Icon of HEV (" + hashCode() + ") is " + (it.getIcon() == null ? "null" : it.getIcon().toString())); } }
Source:
<code><START> public void setDigestAlgorithm(String digestAlgorithm) <END> throws NoSuchAlgorithmException { throw new IllegalStateException("Not implemented"); }</code><technical_language>decide throwing vs. silently ignoring (which is do in ReadableStreamChannelInputStreamTest)</technical_language>

Target:
public void setDigestAlgorithm(String digestAlgorithm) { throw new IllegalStateException("Not implemented"); }
Source:
<code>public String toString(String format) { StringBuilder sb = new StringBuilder(); <START> sb.append(super.toString(format)); <END> sb.append(String.format(format, "hubConfig", hubConfig)); sb.append(toString(format, "jettyMaxThreads", jettyMaxThreads)); sb.append(toString(format, "capabilityMatcher", capabilityMatcher.getClass().getCanonicalName())); sb.append(toString(format, "newSessionWaitTimeout", newSessionWaitTimeout)); sb.append(toString(format, "prioritizer", prioritizer != null? prioritizer.getClass().getCanonicalName(): null)); sb.append(toString(format, "throwOnCapabilityNotPresent", throwOnCapabilityNotPresent)); return sb.toString(); }</code><technical_language>odd. sb.append(format)</technical_language>

Target:
public String toString(String format) { StringBuilder sb = new StringBuilder(); sb.append(super.toString(format)); sb.append(toString(format, "hubConfig", hubConfig)); sb.append(toString(format, "jettyMaxThreads", jettyMaxThreads)); sb.append(toString(format, "capabilityMatcher", capabilityMatcher.getClass().getCanonicalName())); sb.append(toString(format, "newSessionWaitTimeout", newSessionWaitTimeout)); sb.append(toString(format, "prioritizer", prioritizer != null? prioritizer.getClass().getCanonicalName(): null)); sb.append(toString(format, "throwOnCapabilityNotPresent", throwOnCapabilityNotPresent)); return sb.toString(); }
Source:
<code>public ApprovedWhitelist() throws IOException { try { reconfigure(); } catch (IOException e) { LOG.log(Level.SEVERE, "Malformed signature entry in scriptApproval.xml: '" + e.getMessage() + "'"); <START> throw e; <END> } }</code><technical_language>rethrow? is clear JIRA PR catching IOException swallowed, I reason rethrow this. delete remove throws clause</technical_language>

Target:
public ApprovedWhitelist() { try { reconfigure(); } catch (IOException e) { LOG.log(Level.SEVERE, "Malformed signature entry in scriptApproval.xml: '" + e.getMessage() + "'"); } }
Source:
<code>public void testCreateOrReplaceWithoutDeleteExisting() { server.expect().get().withPath("/api/v1/namespaces/ns1/services/my-service").andReturn(200 , service).once(); server.expect().get().withPath("/api/v1/namespaces/ns1/configmaps/my-configmap").andReturn(200, configMap).once(); server.expect().post().withPath("/api/v1/namespaces/ns1/services").andReturn(200, service).once(); <START> server.expect().post().withPath("/api/v1/namespaces/ns1/configmaps").andReturn(200, configMap).once(); <END> KubernetesClient client = server.getClient(); KubernetesList list = new KubernetesListBuilder().withItems(service, configMap).build(); client.resourceList(list).inNamespace("ns1").createOrReplace(); }</code><technical_language>a post a put</technical_language>

Target:
public void testCreateOrReplaceWithoutDeleteExisting() throws Exception { server.expect().get().withPath("/api/v1/namespaces/ns1/services/my-service").andReturn(200 , service).times(2); server.expect().get().withPath("/api/v1/namespaces/ns1/configmaps/my-configmap").andReturn(200, configMap).times(2); server.expect().put().withPath("/api/v1/namespaces/ns1/services/my-service").andReturn(200, updatedService).once(); server.expect().put().withPath("/api/v1/namespaces/ns1/configmaps/my-configmap").andReturn(200, updatedConfigMap).once(); KubernetesClient client = server.getClient(); KubernetesList list = new KubernetesListBuilder().withItems(updatedService, updatedConfigMap).build(); client.resourceList(list).inNamespace("ns1").createOrReplace(); assertEquals(6, server.getMockServer().getRequestCount()); RecordedRequest request = server.getLastRequest(); assertEquals("/api/v1/namespaces/ns1/configmaps/my-configmap", request.getPath()); assertEquals("PUT", request.getMethod()); }
Source:
<code>public void onBindViewHolder(HistoryScanHolder holder, int position) { holder.txtTitle.setText(list.get(position).getTitle()); holder.txtBarcode.setText(list.get(position).getBarcode()); holder.txtBrands.setText(list.get(position).getBrands()); holder.imgProduct.setImageBitmap(list.get(position).getUrl()); Date date = list.get(position).getTime(); long time = date.getTime(); <START> String timeStamp = String.valueOf(DateUtils.getRelativeTimeSpanString(time,System.currentTimeMillis(), DateUtils.HOUR_IN_MILLIS,DateUtils.FORMAT_ABBREV_RELATIVE)); <END> holder.txtDate.setText(timeStamp); }</code><technical_language>Timestamps hour rounded "0 hr. ago". I personally prefer showing "X min. ago" for cases "A moment ago" "Just now" for timestamps minute</technical_language>

Target:
public void onBindViewHolder(HistoryScanHolder holder, int position) { holder.txtTitle.setText(list.get(position).getTitle()); holder.txtBarcode.setText(list.get(position).getBarcode()); holder.txtBrands.setText(list.get(position).getBrands()); holder.imgProduct.setImageBitmap(list.get(position).getUrl()); Date date = list.get(position).getTime(); calcTime(date, holder); }
Source:
<code>public void toXmlTest() throws IOException, XmlPullParserException, SmackParsingException { String xml = "<tune xmlns='<LINK_0>'>" + "<artist>Yes</artist>" + "<length>686</length>" + "<rating>8</rating>" + "<source>Yessongs</source>" + "<title>Heart of the Sunrise</title>" + "<track>3</track>" + "<uri><LINK_1></uri>" + "</tune>"; URI uri = null; try { uri = new URI("<LINK_1>"); } catch (URISyntaxException e) { <START> throw new IllegalArgumentException("Invalid URI"); <END> } UserTuneElement.Builder builder = UserTuneElement.getBuilder(); UserTuneElement userTuneElement = builder.setArtist("Yes") .setLength(686) .setRating(8) .setSource("Yessongs") .setTitle("Heart of the Sunrise") .setTrack(3) .setUri(uri) .build(); assertXmlSimilar(xml, userTuneElement.toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); UserTuneElement parsed = UserTuneProvider.INSTANCE.parse(parser); assertEquals(xml, parsed.toXML().toString()); }</code><technical_language>do catch exception throw again? Simply method throw URISyntaxException. This code a lot more readable. swallow Exceptions! code loose information included in e</technical_language>

Target:
public void toXmlTest() throws IOException, XmlPullParserException, SmackParsingException, URISyntaxException { URI uri = new URI("<LINK_1>"); UserTuneElement.Builder builder = UserTuneElement.getBuilder(); UserTuneElement userTuneElement = builder.setArtist("Yes") .setLength(686) .setRating(8) .setSource("Yessongs") .setTitle("Heart of the Sunrise") .setTrack("3") .setUri(uri) .build(); assertXmlSimilar(xml, userTuneElement.toXML().toString()); }
Source:
<code>private PartitionId getPartitionForPut() throws CoordinatorException { if (clusterMap.getWritablePartitionIdsCount() < 1) { throw new CoordinatorException("No writable partitions available.", CoordinatorError.AmbryUnavailable); } <START> long index = getRandomLong(random, clusterMap.getWritablePartitionIdsCount()); <END> return clusterMap.getWritablePartitionIdAt(index); }</code><technical_language>change name random randomForPartitionSelection? This for that</technical_language>

Target:
private PartitionId getPartitionForPut() throws CoordinatorException { if (clusterMap.getWritablePartitionIdsCount() < 1) { throw new CoordinatorException("No writable partitions available.", CoordinatorError.AmbryUnavailable); } long index = getRandomLong(randomForPartitionSelection, clusterMap.getWritablePartitionIdsCount()); return clusterMap.getWritablePartitionIdAt(index); }
Source:
<code>private void applyEdits(ServiceFeatureTable featureTable) { <START> ListenableFuture<List<FeatureEditResult>> editResults = featureTable.applyEditsAsync(); <END> editResults.addDoneListener(() -> { try { if (editResults.get().iterator().hasNext()) { FeatureEditResult edit = editResults.get().iterator().next(); if (!edit.hasCompletedWithErrors()) { logToUser(false, getString(R.string.success_feature_deleted)); } else { throw edit.getError(); } } } catch (InterruptedException | ExecutionException e) { logToUser(true, getString(R.string.error_applying_edits, e.getCause().getMessage())); } }); }</code><technical_language>for some kind of future naming</technical_language>

Target:
private void applyEdits(ServiceFeatureTable featureTable) { ListenableFuture<List<FeatureEditResult>> featureEditsFuture = featureTable.applyEditsAsync(); featureEditsFuture.addDoneListener(() -> { try { if (featureEditsFuture.get().iterator().hasNext()) { FeatureEditResult edit = featureEditsFuture.get().iterator().next(); if (!edit.hasCompletedWithErrors()) { logToUser(false, getString(R.string.success_feature_deleted)); } else { throw edit.getError(); } } } catch (InterruptedException | ExecutionException e) { logToUser(true, getString(R.string.error_applying_edits, e.getCause().getMessage())); } }); }
Source:
<code>public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; int x1,y1,x2,y2; int cx,cy; x1 = (windowWidth - boardSize)/2; <START> y1 = 20; <END> x2 = x1 + boardSize; y2 = y1 + boardSize; cx = (x1 + x2)/2; cy = (y1 + y2)/2; cellSize = (x2 - x1) / numCells; g2.setPaint(new Color(255, 255, 255)); g2.fillRect(x1, y1, x2-x1, y2-y1); for (int i = -(numCells-1)/2; i <= (numCells-1)/2; i++) for (int j = -(numCells-1)/2; j <= (numCells-1)/2; j++) DrawCell(g2, cx + i*cellSize, cy + j*cellSize, xCenterCell + i, yCenterCell + j); }</code><technical_language>is this hardcoded number</technical_language>

Target:
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; int x1,y1,x2,y2; int cx,cy; x1 = (windowWidth - boardSize)/2; y1 = topPadding; x2 = x1 + boardSize; y2 = y1 + boardSize; cx = (x1 + x2)/2; cy = (y1 + y2)/2; cellSize = (x2 - x1) / numCells; g2.setPaint(new Color(255, 255, 255)); g2.fillRect(x1, y1, x2-x1, y2-y1); for (int i = -(numCells-1)/2; i <= (numCells-1)/2; i++) for (int j = -(numCells-1)/2; j <= (numCells-1)/2; j++) DrawCell(g2, cx + i*cellSize, cy + j*cellSize, xCenterCell + i, yCenterCell + j); }
Source:
<code>protected void doStart() { leaderElection = new LeaderElection(zkClient, "/tx.service/leader", new ElectionHandler() { @Override public void leader() { txManager = txManagerProvider.get(); txManager.addListener(new ServiceListenerAdapter() { @Override public void failed(State from, Throwable failure) { LOG.error("Transaction manager aborted, stopping transaction service"); TransactionService.this.abort(failure); } }, MoreExecutors.sameThreadExecutor()); server = ThriftRPCServer.builder(TTransactionServer.class) .setHost(address) .setPort(port) .setWorkerThreads(threads) .setMaxReadBufferBytes(maxReadBufferBytes) .setIOThreads(ioThreads) .build(new TransactionServiceThriftHandler(txManager)); try { server.startAndWait(); doRegister(); LOG.info("Transaction Thrift Service started successfully on " + getAddress()); } catch (Throwable t) { LOG.info("Transaction Thrift Service didn't start on " + server.getBindAddress()); leaderElection.stop(); notifyFailed(t); } } @Override public void follower() { if (server != null && server.isRunning()) { server.stopAndWait(); } <START> undoRegiser(); <END> } }); leaderElection.start(); notifyStarted(); }</code><technical_language>fix misspelling in this PR. undoRegister()</technical_language>

Target:
protected void doStart() { leaderElection = new LeaderElection(zkClient, "/tx.service/leader", new ElectionHandler() { @Override public void leader() { txManager = txManagerProvider.get(); txManager.addListener(new ServiceListenerAdapter() { @Override public void failed(State from, Throwable failure) { LOG.error("Transaction manager aborted, stopping transaction service"); TransactionService.this.abort(failure); } }, MoreExecutors.sameThreadExecutor()); server = ThriftRPCServer.builder(TTransactionServer.class) .setHost(address) .setPort(port) .setWorkerThreads(threads) .setMaxReadBufferBytes(maxReadBufferBytes) .setIOThreads(ioThreads) .build(new TransactionServiceThriftHandler(txManager)); try { server.startAndWait(); doRegister(); LOG.info("Transaction Thrift Service started successfully on " + getAddress()); } catch (Throwable t) { LOG.info("Transaction Thrift Service didn't start on " + server.getBindAddress()); leaderElection.stop(); notifyFailed(t); } } @Override public void follower() { if (server != null && server.isRunning()) { server.stopAndWait(); } undoRegister(); } }); leaderElection.start(); notifyStarted(); }
Source:
<code>public ByteBuffer transform(ClassLoader classLoader, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) throws IllegalArgumentException { final int position = classBytes.position(); final int limit = classBytes.limit(); final byte[] bytes; final Class<?> aClass = null; if (classBytes.hasArray() && classBytes.arrayOffset() == 0 && position == 0 && limit == classBytes.capacity()) { bytes = classBytes.array(); } else { bytes = new byte[limit - position]; classBytes.get(bytes); classBytes.position(position); } boolean transformed = false; byte[] transformedBuffer = bytes; for (javax.persistence.spi.ClassTransformer transformer : persistenceUnitMetadata.getTransformers()) { <START> byte[] result = new byte[0]; <END> try { result = transformer.transform(classLoader, className, aClass, protectionDomain, transformedBuffer); } catch (IllegalClassFormatException e) { throw JpaLogger.ROOT_LOGGER.invalidClassFormat(e, className); } if (result != null) { transformedBuffer = result; transformed = true; } } return transformed ? ByteBuffer.wrap(transformedBuffer) : null; }</code><technical_language>This assignment allocation is pointless. If transform call fails, exception thrown; assign result</technical_language>

Target:
public ByteBuffer transform(ClassLoader classLoader, String className, ProtectionDomain protectionDomain, ByteBuffer classBytes) throws IllegalArgumentException { byte[] transformedBuffer = getBytes(classBytes); boolean transformed = false; for (javax.persistence.spi.ClassTransformer transformer : persistenceUnitMetadata.getTransformers()) { if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.tracef("rewrite entity class '%s' using transformer '%s' for '%s'", className, transformer.getClass().getName(), persistenceUnitMetadata.getScopedPersistenceUnitName()); byte[] result; try { result = transformer.transform(classLoader, className, null, protectionDomain, transformedBuffer); } catch (IllegalClassFormatException e) { throw JpaLogger.ROOT_LOGGER.invalidClassFormat(e, className); } if (result != null) { transformedBuffer = result; transformed = true; if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.tracef("entity class '%s' was rewritten", className); } } return transformed ? ByteBuffer.wrap(transformedBuffer) : null; }