auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public AnnotatedTypeMirror visitArrayAccess(ArrayAccessTree node, AnnotatedTypeFactory f) { Pair<Tree, AnnotatedTypeMirror> preAssCtxt = f.visitorState.getAssignmentContext(); try { f.visitorState.setAssignmentContext(null); AnnotatedTypeMirror type = f.getAnnotatedType(node.getExpression()); <START> if (type instanceof AnnotatedArrayType) { <END> return ((AnnotatedArrayType) type).getComponentType(); } else if (type instanceof AnnotatedWildcardType) { AnnotatedWildcardType wc = (AnnotatedWildcardType) type; AnnotatedTypeMirror wcbound = wc.getExtendsBound(); if (wcbound instanceof AnnotatedArrayType) { return ((AnnotatedArrayType) wcbound).getComponentType(); } } throw new BugInCF("Unexpected type: " + type); } finally { f.visitorState.setAssignmentContext(preAssCtxt); } }</code><technical_language>this is TypeKinds instead of instanceof</technical_language>

Target:
public AnnotatedTypeMirror visitArrayAccess(ArrayAccessTree node, AnnotatedTypeFactory f) { Pair<Tree, AnnotatedTypeMirror> preAssCtxt = f.visitorState.getAssignmentContext(); try { f.visitorState.setAssignmentContext(null); AnnotatedTypeMirror type = f.getAnnotatedType(node.getExpression()); if (type.getKind() == TypeKind.ARRAY) { return ((AnnotatedArrayType) type).getComponentType(); } else if (type.getKind() == TypeKind.WILDCARD && ((AnnotatedWildcardType) type).isUninferredTypeArgument()) { AnnotatedTypeMirror wcbound = ((AnnotatedWildcardType) type).getExtendsBound(); if (wcbound instanceof AnnotatedArrayType) { return ((AnnotatedArrayType) wcbound).getComponentType(); } } throw new BugInCF("Unexpected type: " + type); } finally { f.visitorState.setAssignmentContext(preAssCtxt); } }
Source:
<code>public String scheduleRequest(String containerId, String payload, String marshallingType) { JobRequestInstance jobRequest = null; if (containerId != null && !containerId.isEmpty()) { logger.debug("About to unmarshal job request from payload: '{}' using container marshaller", payload, containerId); jobRequest = marshallerHelper.unmarshal(containerId, payload, marshallingType, JobRequestInstance.class); jobRequest.getData().put("deploymentId", containerId); } else { logger.debug("About to unmarshal job request from payload: '{}' using server marshaller", payload); jobRequest = marshallerHelper.unmarshal(payload, marshallingType, JobRequestInstance.class); } Long requestId = null; if(!validateCommand(jobRequest.getCommand())){ <START> throw new IllegalArgumentException("Invalid command type"); <END> } if (jobRequest.getScheduledDate() != null) { logger.debug("Scheduling job at future date '{}' for request {}", jobRequest.getScheduledDate(), jobRequest); requestId = executorService.scheduleRequest(jobRequest.getCommand(), jobRequest.getScheduledDate(), new CommandContext(jobRequest.getData())); } else { logger.debug("Scheduling job at current date '{}' for request {}", new Date(), jobRequest); requestId = executorService.scheduleRequest(jobRequest.getCommand(), new CommandContext(jobRequest.getData())); } String response = marshallerHelper.marshal(marshallingType, requestId); return response; }</code><technical_language>add class (jobRequest.getCommand()) provide direct feedback</technical_language>

Target:
public String scheduleRequest(String containerId, String payload, String marshallingType) { JobRequestInstance jobRequest = null; if (containerId != null && !containerId.isEmpty()) { logger.debug("About to unmarshal job request from payload: '{}' using container marshaller", payload, containerId); jobRequest = marshallerHelper.unmarshal(containerId, payload, marshallingType, JobRequestInstance.class); jobRequest.getData().put("deploymentId", containerId); } else { logger.debug("About to unmarshal job request from payload: '{}' using server marshaller", payload); jobRequest = marshallerHelper.unmarshal(payload, marshallingType, JobRequestInstance.class); } Long requestId = null; if(!validateCommand(jobRequest.getCommand())){ throw new IllegalArgumentException("Invalid command type "+jobRequest.getCommand()); } if (jobRequest.getScheduledDate() != null) { logger.debug("Scheduling job at future date '{}' for request {}", jobRequest.getScheduledDate(), jobRequest); requestId = executorService.scheduleRequest(jobRequest.getCommand(), jobRequest.getScheduledDate(), new CommandContext(jobRequest.getData())); } else { logger.debug("Scheduling job at current date '{}' for request {}", new Date(), jobRequest); requestId = executorService.scheduleRequest(jobRequest.getCommand(), new CommandContext(jobRequest.getData())); } String response = marshallerHelper.marshal(marshallingType, requestId); return response; }
Source:
<code>MetadataClientDriver initialize(ClientConfiguration conf, ScheduledExecutorService scheduler, StatsLogger statsLogger, Optional<Object> ctx) throws MetadataException; String getScheme(); RegistrationClient getRegistrationClient(); LedgerManagerFactory getLedgerManagerFactory() throws MetadataException; LayoutManager getLayoutManager(); @Override void close(); <START> @FunctionalInterface <END> interface ConnectionExpiredListener { void onConnectionExpired(); }</code><technical_language>I if a more neutral term. This is a ZK specific concept</technical_language>

Target:
MetadataClientDriver initialize(ClientConfiguration conf, ScheduledExecutorService scheduler, StatsLogger statsLogger, Optional<Object> ctx) throws MetadataException; String getScheme(); RegistrationClient getRegistrationClient(); LedgerManagerFactory getLedgerManagerFactory() throws MetadataException; LayoutManager getLayoutManager(); @Override void close(); @FunctionalInterface interface SessionStateListener { void onSessionExpired(); }
Source:
<code>public void testReadingBounds() { fTrace.indexTrace(true); assertEquals(fTrace.getStartTime(), fTrace.readStart()); <START> assertEquals(fTrace.getEndTime(), fTrace.readEnd()); <END> }</code><technical_language>I test more robust if bounds read indexing trace explicitly</technical_language>

Target:
public void testReadingBounds() { ITmfTimestamp start = fTrace.readStart(); ITmfTimestamp end = fTrace.readEnd(); fTrace.indexTrace(true); assertEquals(fTrace.getStartTime(), start); assertEquals(fTrace.getEndTime(), end); }
Source:
<code>public String render(final GetTapesResult obj) throws JsonProcessingException { final Tapes result = obj.getTapes(); final CommonJsonView view = CommonJsonView.newView(CommonJsonView.Status.OK); if( (result == null) || (null == result.getTapes()) ){ <START> view.message("You do not have any buckets"); <END> return JsonMapper.toJson(view); } return JsonMapper.toJson(view.data(result)); }</code><technical_language>"You do tapes"</technical_language>

Target:
public String render(final GetTapesResult obj) throws JsonProcessingException { final Tapes result = obj.getTapes(); final CommonJsonView view = CommonJsonView.newView(CommonJsonView.Status.OK); if( (result == null) || (null == result.getTapes()) ){ view.message("You do not have any tapes"); return JsonMapper.toJson(view); } return JsonMapper.toJson(view.data(result)); }
Source:
<code><START> public void setWatchingDirectoryChanges(boolean watchDirectoryChanges) { <END> this.watchingDirectoryChanges = watchDirectoryChanges; }</code><technical_language>Functions called in constructor final keyword. final keyword a derived class overwrite stuff parent class is fully initialized</technical_language>

Target:
public final void setWatchingDirectoryChanges(boolean watchDirectoryChanges) { this.watchingDirectoryChanges = watchDirectoryChanges; }
Source:
<code>CacheEntry<K, V> toCacheEntry(Object o) { if (o instanceof Map.Entry) { Map.Entry<K, V> entry = (Map.Entry<K, V>) o; K key = entry.getKey(); K newKey = keyToStorage(key); V value = entry.getValue(); V newValue = valueToStorage(value); if (key != newKey || value != newValue) { if (o instanceof CacheEntry) { CacheEntry returned = (CacheEntry) o; return convertEntry(newKey, newValue, returned); } else { return entryFactory.create(newKey, newValue, (Metadata) null); } } if (entry instanceof CacheEntry) { return (CacheEntry<K, V>) entry; } else { <START> return entryFactory.create(entry.getKey(), entry.getValue(), (Metadata) null); <END> } } return null; }</code><technical_language>key variables here, right</technical_language>

Target:
CacheEntry<K, V> toCacheEntry(Object o) { if (o instanceof Map.Entry) { Map.Entry<K, V> entry = (Map.Entry<K, V>) o; K key = entry.getKey(); K newKey = keyToStorage(key); V value = entry.getValue(); V newValue = valueToStorage(value); if (key != newKey || value != newValue) { if (o instanceof CacheEntry) { CacheEntry returned = (CacheEntry) o; return convertEntry(newKey, newValue, returned); } else { return entryFactory.create(newKey, newValue, (Metadata) null); } } if (entry instanceof CacheEntry) { return (CacheEntry<K, V>) entry; } else { return entryFactory.create(key, value, (Metadata) null); } } return null; }
Source:
<code>public CachedDatastreamReader(ZkClient zkclient, String cluster) { _zkclient = zkclient; _cluster = cluster; _datastreamList = fetchAllDatastreamNamesFromZk(); String path = KeyBuilder.datastreams(_cluster); LOG.info("Subscribing to notification on zk path " + path); _zkclient.subscribeChildChanges(path, new IZkChildListener() { @Override public void handleChildChange(String parentPath, List<String> currentChildren) throws Exception { <START> synchronized (CachedDatastreamReader.this) { <END> LOG.info( String.format("Received datastream add or delete notification. parentPath %s, children %s", parentPath, currentChildren)); _datastreamList = currentChildren.stream().collect(Collectors.toCollection(() -> new ArrayList<>(currentChildren.size()))); List<String> datastreamsRemoved = _datastreams.keySet().stream().filter(x -> !_datastreamList.contains(x)).collect(Collectors.toList()); if (!datastreamsRemoved.isEmpty()) { LOG.info(String.format("Removing the deleted datastreams {%s} from cache", datastreamsRemoved)); datastreamsRemoved.stream().forEach(_datastreams::remove); } LOG.info(String.format("New datastream list in the cache: %s", _datastreamList)); } } }); }</code><technical_language>difference this a synchronized function</technical_language>

Target:
public CachedDatastreamReader(ZkClient zkclient, String cluster) { _zkclient = zkclient; _cluster = cluster; _datastreamList = fetchAllDatastreamNamesFromZk(); String path = KeyBuilder.datastreams(_cluster); LOG.info("Subscribing to notification on zk path " + path); _zkclient.subscribeChildChanges(path, new IZkChildListener() { @Override public void handleChildChange(String parentPath, List<String> currentChildren) throws Exception { synchronized (CachedDatastreamReader.this) { LOG.debug( String.format("Received datastream add or delete notification. parentPath %s, children %s", parentPath, currentChildren)); _datastreamList = currentChildren.stream().collect(Collectors.toCollection(() -> new ArrayList<>(currentChildren.size()))); List<String> datastreamsRemoved = _datastreams.keySet().stream().filter(x -> !_datastreamList.contains(x)).collect(Collectors.toList()); if (!datastreamsRemoved.isEmpty()) { LOG.info(String.format("Removing the deleted datastreams {%s} from cache", datastreamsRemoved)); datastreamsRemoved.stream().forEach(_datastreams::remove); } LOG.debug(String.format("New datastream list in the cache: %s", _datastreamList)); } } }); }
Source:
<code>public boolean containsAnyScope(List<String> scope) { for (String s : scope) { <START> if (getScope().contains(s)) { <END> return true; } } return false; }</code><technical_language>worry case sensitivity wrt scopes</technical_language>

Target:
public boolean containsAnyScope(List<String> scope) { for (String s : scope) { for (String s2 : getScopes()) { if (s.equalsIgnoreCase(s2)) { return true; } } } return false; }
Source:
<code>public void fault( long pageRef, PageSwapper swapper, int swapperId, long filePageId, PageFaultEvent event ) throws IOException { if ( swapper == null ) { throw new IllegalArgumentException( "swapper cannot be null" ); } int currentSwapper = getSwapperId( pageRef ); long currentFilePageId = getFilePageId( pageRef ); if ( filePageId == PageCursor.UNBOUND_PAGE_ID || !isExclusivelyLocked( pageRef ) || currentSwapper != 0 || currentFilePageId != PageCursor.UNBOUND_PAGE_ID ) { throw cannotFaultException( pageRef, swapper, swapperId, filePageId, currentSwapper, currentFilePageId ); } setFilePageId( pageRef, filePageId ); PageObj page = new PageObj( cachePageSize, address( pageRef ) ); <START> long bytesRead = swapper.read( filePageId, page ); <END> event.addBytesRead( bytesRead ); event.setCachePageId( (int) pageRef ); setSwapperId( pageRef, swapperId ); }</code><technical_language>purpose of this line is immediately clear me. Care elaborate</technical_language>

Target:
public void fault( long pageRef, PageSwapper swapper, int swapperId, long filePageId, PageFaultEvent event ) throws IOException { if ( swapper == null ) { throw swapperCannotBeNull(); } int currentSwapper = getSwapperId( pageRef ); long currentFilePageId = getFilePageId( pageRef ); if ( filePageId == PageCursor.UNBOUND_PAGE_ID || !isExclusivelyLocked( pageRef ) || currentSwapper != 0 || currentFilePageId != PageCursor.UNBOUND_PAGE_ID ) { throw cannotFaultException( pageRef, swapper, swapperId, filePageId, currentSwapper, currentFilePageId ); } setFilePageId( pageRef, filePageId ); long bytesRead = swapper.read( filePageId, getAddress( pageRef ), cachePageSize ); event.addBytesRead( bytesRead ); event.setCachePageId( toId( pageRef ) ); setSwapperId( pageRef, swapperId ); }
Source:
<code>private void getJavaMethods (ArrayList<JavaMethod> methods, TypeDeclaration<?> type) { classStack.push(type); if (type.getMembers() != null) { for (BodyDeclaration<?> member : type.getMembers()) { if (member.isClassOrInterfaceDeclaration() || member.isEnumDeclaration()) { getJavaMethods(methods, (TypeDeclaration)member); } else { if (member instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration)member; <START> if(method.isNative()) continue; <END> methods.add(createMethod(method)); } } } } classStack.pop(); }</code><technical_language>I missing ! here</technical_language>

Target:
private void getJavaMethods (ArrayList<JavaMethod> methods, TypeDeclaration<?> type) { classStack.push(type); if (type.getMembers() != null) { for (BodyDeclaration<?> member : type.getMembers()) { if (member.isClassOrInterfaceDeclaration() || member.isEnumDeclaration()) { getJavaMethods(methods, (TypeDeclaration)member); } else { if (member instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration)member; if(!method.isNative()) continue; methods.add(createMethod(method)); } } } } classStack.pop(); }
Source:
<code>public void run() { try { returnSize = min(returnSize, dao.pollNextWorkflowInstanceIds(batchSize).size()); <START> } catch (PollingBatchException ex) { <END> ex.printStackTrace(); returnSize = 0; detectedRaceCondition = ex.getMessage().startsWith("Race condition"); } }</code><technical_language>Is this change valid</technical_language>

Target:
public void run() { try { returnSize = min(returnSize, dao.pollNextWorkflowInstanceIds(batchSize).size()); } catch (PollingRaceConditionException ex) { ex.printStackTrace(); returnSize = 0; detectedRaceCondition = true; } }
Source:
<code>private void deleteTempFile(File file) { notNull(file, "file"); if (!file.delete()) { <START> throw new GoodDataException("Unable to delete temporary file " + file.getAbsolutePath()); <END> } }</code><technical_language>I process deploy fail in case of temp file deletion fail</technical_language>

Target:
private void deleteTempFile(File file) { notNull(file, "file"); file.delete(); }
Source:
<code>public void onRemovePassenger(net.minecraft.entity.Entity passenger, CallbackInfo ci) { if (!this.worldObj.isRemote) { DismountEntityEvent event = SpongeEventFactory.createDismountEntityEvent(Cause.of(NamedCause.source(passenger)), this); <START> SpongeImpl.postEvent(event); <END> } }</code><technical_language>collapsed line. java SpongeImpl.postEvent(SpongeEventFactory.createDismountEntityEvent(Cause.of(NamedCause.source(passenger)), this));</technical_language>

Target:
public void onRemovePassenger(net.minecraft.entity.Entity passenger, CallbackInfo ci) { if (!this.worldObj.isRemote && ShouldFire.DISMOUNT_ENTITY_EVENT) { SpongeImpl.postEvent(SpongeEventFactory.createDismountEntityEvent(Cause.of(NamedCause.source(passenger)), this)); } }
Source:
<code>public CommandCallback getCallback() { VDS <START> vds = <END> getVds(); if (vds.getClusterSupportsGlusterService() && getParameters().getIsStopGlusterProcesses()) { return new HostMaintenanceCallback(); } else { return super.getCallback(); } }</code><technical_language>s/vds/host</technical_language>

Target:
public CommandCallback getCallback() { VDS host = getVds(); if (host.getClusterSupportsGlusterService() && getParameters().isStopGlusterService()) { return new HostMaintenanceCallback(); } else { return super.getCallback(); } }
Source:
<code>private void clearUi() { title.setVisibility(View.INVISIBLE); instr.setVisibility(View.INVISIBLE); <START> passcodeField.setVisibility(View.INVISIBLE); <END> passcodeBox.setVisibility(View.INVISIBLE); logoutButton.setVisibility(View.INVISIBLE); verifyButton.setVisibility(View.INVISIBLE); bioInstrTitle.setVisibility(View.INVISIBLE); bioInstr.setVisibility(View.INVISIBLE); notNowButton.setVisibility(View.INVISIBLE); enableButton.setVisibility(View.INVISIBLE); biometricBox.setVisibility(View.INVISIBLE); fingerImage.setVisibility(View.INVISIBLE); }</code><technical_language>of GONE</technical_language>

Target:
private void clearUi() { title.setVisibility(View.GONE); instr.setVisibility(View.GONE); passcodeField.setVisibility(View.GONE); passcodeBox.setVisibility(View.GONE); logoutButton.setVisibility(View.GONE); verifyButton.setVisibility(View.GONE); bioInstrTitle.setVisibility(View.GONE); bioInstr.setVisibility(View.GONE); notNowButton.setVisibility(View.GONE); enableButton.setVisibility(View.GONE); biometricBox.setVisibility(View.GONE); fingerImage.setVisibility(View.GONE); }
Source:
<code>public void asyncRealmObjectShouldNotBlockBackgroundCommitNotification() { final AtomicInteger numberOfRealmCallbackInvocation = new AtomicInteger(0); final CountDownLatch signalClosedRealm = new CountDownLatch(1); final Realm realm = looperThread.realm; realm.addChangeListener(new RealmChangeListener<Realm>() { @Override <START> public void onChange(Realm object) { <END> switch (numberOfRealmCallbackInvocation.incrementAndGet()) { case 1: { Dog dog = realm.where(Dog.class).findFirstAsync(); assertTrue(dog.load()); dog.addChangeListener(new RealmChangeListener<Dog>() { @Override public void onChange(Dog dog) { } }); new Thread() { @Override public void run() { Realm realm = Realm.getInstance(looperThread.realmConfiguration); realm.beginTransaction(); realm.createObject(Dog.class); realm.commitTransaction(); realm.close(); signalClosedRealm.countDown(); } }.start(); break; } case 2: { TestHelper.awaitOrFail(signalClosedRealm); looperThread.testComplete(); break; } } } }); looperThread.postRunnable(new Runnable() { @Override public void run() { realm.beginTransaction(); realm.createObject(Dog.class); realm.commitTransaction(); } }); }</code><technical_language>find a name? I mean, read quickly, easily read a RealmObject</technical_language>

Target:
public void asyncRealmObjectShouldNotBlockBackgroundCommitNotification() { final AtomicInteger numberOfRealmCallbackInvocation = new AtomicInteger(0); final CountDownLatch signalClosedRealm = new CountDownLatch(1); final Realm realm = looperThread.realm; realm.addChangeListener(new RealmChangeListener<Realm>() { @Override public void onChange(Realm realm) { switch (numberOfRealmCallbackInvocation.incrementAndGet()) { case 1: { Dog dog = realm.where(Dog.class).findFirstAsync(); assertTrue(dog.load()); dog.addChangeListener(new RealmChangeListener<Dog>() { @Override public void onChange(Dog dog) { } }); new Thread() { @Override public void run() { Realm realm = Realm.getInstance(looperThread.realmConfiguration); realm.beginTransaction(); realm.createObject(Dog.class); realm.commitTransaction(); realm.close(); signalClosedRealm.countDown(); } }.start(); break; } case 2: { TestHelper.awaitOrFail(signalClosedRealm); looperThread.testComplete(); break; } } } }); looperThread.postRunnable(new Runnable() { @Override public void run() { realm.beginTransaction(); realm.createObject(Dog.class); realm.commitTransaction(); } }); }
Source:
<code>private static boolean isHtml(String str) { final String HTML_TAG_PATTERN = "<(\"[^\"]*\"|'[^']*'|[^'\">])*>"; Pattern htmlValidator = TextUtils.isEmpty(HTML_TAG_PATTERN) ? null : Pattern.compile(HTML_TAG_PATTERN); boolean isHtml = htmlValidator.matcher(str).find(); <START> return isHtml; <END> }</code><technical_language>need a variable</technical_language>

Target:
private static boolean isHtml(String str) { final String HTML_TAG_PATTERN = "<(\"[^\"]*\"|'[^']*'|[^'\">])*>"; Pattern htmlValidator = TextUtils.isEmpty(HTML_TAG_PATTERN) ? null : Pattern.compile(HTML_TAG_PATTERN); return htmlValidator.matcher(str).find(); }
Source:
<code>public void isValidShouldBeValidWithExactMinPasswordLength() { PasswordChangeDTO passwordChangeDtoExactMinLength = PasswordChangeDTO.builder() .newPassword(PASSWORD_WITH_LENGTH_EQUAL_TO_MIN) .build(); boolean result = rule.isValid(passwordChangeDtoExactMinLength); <START> assertThat(result, notNullValue()); <END> assertTrue(result); }</code><technical_language>need for null checks, primitive types nulls</technical_language>

Target:
public void isValidShouldBeValidWithExactMinPasswordLength() { PasswordChangeDTO passwordChangeDtoExactMinLength = PasswordChangeDTO.builder() .newPassword(PASSWORD_WITH_LENGTH_EQUAL_TO_MIN) .build(); boolean result = rule.isValid(passwordChangeDtoExactMinLength); assertTrue(result); }
Source:
<code>public void testDeleteActionForInstructorAsFeedbackParticipant() { prepareTestData(); FeedbackResponseCommentAttributes feedbackResponseComment = getCommentFromInstructor1(); assertNotNull("response comment not found", feedbackResponseComment); InstructorAttributes instructor = dataBundle.instructors.get("instructor1InCourse1"); gaeSimulation.loginAsInstructor(instructor.googleId); ______TS("Typical successful case when feedback participant is an instructor"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, feedbackResponseComment.commentText + " (Edited)", }; FeedbackParticipantFeedbackResponseCommentDeleteAction action = getAction(submissionParams); AjaxResult result = getAjaxResult(action); FeedbackResponseCommentAjaxPageData data = (FeedbackResponseCommentAjaxPageData) result.data; assertFalse(data.isError); FeedbackResponseCommentsDb feedbackResponseCommentsDb = new FeedbackResponseCommentsDb(); <START> assertNull(feedbackResponseCommentsDb.getFeedbackResponseComment(feedbackResponseComment.feedbackResponseId, <END> feedbackResponseComment.commentGiver, feedbackResponseComment.createdAt)); assertEquals("", result.getStatusMessage()); }</code><technical_language>feedback response ID? in multiple places</technical_language>

Target:
public void testDeleteActionForInstructorAsFeedbackParticipant() { FeedbackResponseCommentAttributes feedbackResponseComment = getCommentFromInstructor1AsFeedbackParticipant(); assertNotNull("response comment not found", feedbackResponseComment); InstructorAttributes instructor = dataBundle.instructors.get("instructor1InCourse1"); gaeSimulation.loginAsInstructor(instructor.googleId); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackResponseComment.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackResponseComment.feedbackSessionName, Const.ParamsNames.FEEDBACK_RESPONSE_ID, feedbackResponseComment.feedbackResponseId, Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_ID, feedbackResponseComment.getId().toString(), }; FeedbackParticipantFeedbackResponseCommentDeleteAction action = getAction(submissionParams); AjaxResult result = getAjaxResult(action); FeedbackResponseCommentAjaxPageData data = (FeedbackResponseCommentAjaxPageData) result.data; assertFalse(data.isError); FeedbackResponseCommentsDb feedbackResponseCommentsDb = new FeedbackResponseCommentsDb(); assertNull(feedbackResponseCommentsDb.getFeedbackResponseComment(feedbackResponseComment.feedbackResponseId, feedbackResponseComment.commentGiver, feedbackResponseComment.createdAt)); assertEquals("", result.getStatusMessage()); }
Source:
<code>public static String toUtcFormat(double hourOffsetTimeZone) { StringBuilder utcFormatTimeZone = new StringBuilder(); utcFormatTimeZone.append("UTC"); if (hourOffsetTimeZone != 0) { if ((int) hourOffsetTimeZone == hourOffsetTimeZone) { utcFormatTimeZone.append(String.format(" %+03d:00", (int) hourOffsetTimeZone)); } else { utcFormatTimeZone.append(String.format( " %+03d:%02d", (int) hourOffsetTimeZone, (int) (Math.abs(hourOffsetTimeZone - (int) hourOffsetTimeZone) * 300 / 5))); } } <START> return utcFormatTimeZone.toString(); <END> }</code><technical_language>I another place StringBuilder is needed. In conditionals, return original utcFormatTimeZone appended additions</technical_language>

Target:
public static String toUtcFormat(double hourOffsetTimeZone) { String utcFormatTimeZone = "UTC"; if (hourOffsetTimeZone != 0) { if ((int) hourOffsetTimeZone == hourOffsetTimeZone) { return utcFormatTimeZone + String.format(" %+03d:00", (int) hourOffsetTimeZone); } else { return utcFormatTimeZone + String.format( " %+03d:%02d", (int) hourOffsetTimeZone, (int) (Math.abs(hourOffsetTimeZone - (int) hourOffsetTimeZone) * 300 / 5)); } } return utcFormatTimeZone; }
Source:
<code>protected CoreEvent processFlow(CoreEvent event) throws Exception { setMuleContextIfNeeded(flow, muleContext); switch (mode) { case FLOW: return flow.process(event); case SOURCE: try { return just(event) .doOnNext(innerEvent -> flow.checkBackpressure(innerEvent)) .onErrorMap(FlowBackPressureException.class, <START> backpressureException -> { <END> try { return new MessagingException(newEvent(), backpressureException); } catch (MuleException e) { throw propagate(e); } }) .transform(triggerableMessageSource.getListener()) .block(); } catch (Throwable throwable) { throw rxExceptionToMuleException(throwable); } default: return null; } }</code><technical_language>extract function, this is repeated in line 653</technical_language>

Target:
protected CoreEvent processFlow(CoreEvent event) throws Exception { setMuleContextIfNeeded(flow, muleContext); switch (mode) { case FLOW: return flow.process(event); case SOURCE: try { return just(event) .doOnNext(flow::checkBackpressure) .onErrorMap(FlowBackPressureException.class, backPressureExceptionMapper()) .transform(triggerableMessageSource.getListener()) .block(); } catch (Throwable throwable) { throw rxExceptionToMuleException(throwable); } default: return null; } }
Source:
<code>private boolean canInvestNewbieLoan(String loginName) { if (newbieInvestLimit == 0) { return true; } int newbieInvestCount = investMapper.sumSuccessNewbieInvestCountByLoginName(loginName); <START> return (newbieInvestCount < newbieInvestLimit); <END> }</code><technical_language>newbieInvestLimit == 0 || newbieInvestCount < newbieInvestLimit</technical_language>

Target:
private boolean canInvestNewbieLoan(String loginName) { int newbieInvestCount = investMapper.sumSuccessInvestCountByLoginName(loginName); return newbieInvestLimit == 0 || newbieInvestCount < newbieInvestLimit; }
Source:
<code>public void updateBridgeFirmware() { RestTemplate rt = new RestTemplate(); String bridgeConfigUrl = buildBridgeHttpAddress() + "config"; HueSWUpdate swUpdate = rt.getForEntity(bridgeConfigUrl, HueConfig.class).getBody().getSWUpdate(); if (swUpdate.isNotify()) { log.info("Bridge update completed"); rt.put(bridgeConfigUrl, "{\"swupdate\": {\"notify\":false}}"); } else if (swUpdate.getUpdatestate() == 0) { log.info("Initiating bridge update check"); rt.put(bridgeConfigUrl, "{\"swupdate\": {\"checkforupdate\":true}}"); } if (swUpdate.getUpdatestate() == 2) { log.info("Installing bridge update: {}", swUpdate.getText()); rt.put(bridgeConfigUrl, "{\"swupdate\": {\"updatestate\":3}}"); <START> } <END> }</code><technical_language>cleaner JSONObjects here? wondering, do for strobe (<LINK_0></technical_language>

Target:
public void updateBridgeFirmware() { RestTemplate rt = new RestTemplate(); String bridgeConfigUrl = buildBridgeHttpAddress() + "config"; HueSWUpdate swUpdate = rt.getForEntity(bridgeConfigUrl, HueConfig.class).getBody().getSWUpdate(); if (swUpdate.isNotify()) { log.info("Bridge update completed"); rt.put(bridgeConfigUrl, "{\"swupdate\": {\"notify\":false}}"); } else if (swUpdate.getUpdatestate() == 0) { log.info("Initiating bridge update check"); rt.put(bridgeConfigUrl, "{\"swupdate\": {\"checkforupdate\":true}}"); } else if (swUpdate.getUpdatestate() == 2) { log.info("Installing bridge update: {}", swUpdate.getText()); rt.put(bridgeConfigUrl, "{\"swupdate\": {\"updatestate\":3}}"); } }
Source:
<code>public String showExperimentPage(Model model, @PathVariable String experimentAccession, @RequestParam(defaultValue = "") String accessKey) { Experiment<Cell> experiment = experimentTrader.getExperiment(experimentAccession, accessKey); model.addAllAttributes(experimentAttributesService.getAttributes(experiment)); model.addAttribute("content", GSON.toJson(experimentPageContentForExperiment(experiment, accessKey))); <START> model.addAttribute("numberOfCells", tSnePlotServiceDao.fetchCellNumberByExperimentAccession(experimentAccession)); <END> return "experiment-page"; }</code><technical_language>move this line experimentPageContentForExperiment method, number of cells content</technical_language>

Target:
public String showExperimentPage(Model model, @PathVariable String experimentAccession, @RequestParam(defaultValue = "") String accessKey) { Experiment<Cell> experiment = experimentTrader.getExperiment(experimentAccession, accessKey); model.addAllAttributes(experimentAttributesService.getAttributes(experiment)); model.addAttribute("content", GSON.toJson(experimentPageContentForExperiment(experiment, accessKey))); model.addAttribute("numberOfCells", tSnePlotServiceDao.fetchNumberOfCellsByExperimentAccession(experimentAccession)); return "experiment-page"; }
Source:
<code>public void onSessionExecuted(String sessionId, String sessionComment, SessionExecutionStatus status) { log.debug("onSessionExecuted invoked"); <START> Namespace namespace = Namespace.of(sessionId,SESSION); <END> Multimap<String, Object> all = keyValueStorage.fetchAll(namespace); SessionData sessionData = new SessionData(); sessionData.setSessionId(sessionId); sessionData.setComment(sessionComment); Long startTime = (Long) getFirst(all, START_TIME); sessionData.setStartTime(new Date(startTime)); Long endTime = (Long) getFirst(all, END_TIME); sessionData.setEndTime(new Date(endTime)); Integer taskExecuted = (Integer) getFirst(all, TASK_EXECUTED); sessionData.setTaskExecuted(taskExecuted); Integer tasksFailed = (Integer) getFirst(all, FAILED); sessionData.setTaskFailed(tasksFailed); Integer activeKernels = (Integer) getFirst(all, KERNELS_COUNT); sessionData.setActiveKernels(activeKernels); String errorMessage = (String) getFirst(all, ERROR_MESSAGE); sessionData.setErrorMessage(errorMessage); getHibernateTemplate().persist(sessionData); persistTags(sessionId, sessionMetaDataStorage); }</code><technical_language>sessionId is in call of Namespace.of</technical_language>

Target:
public void onSessionExecuted(String sessionId, String sessionComment, SessionExecutionStatus status) { log.debug("onSessionExecuted invoked"); Namespace namespace = Namespace.of(SESSION, sessionId); Multimap<String, Object> all = keyValueStorage.fetchAll(namespace); SessionData sessionData = new SessionData(); sessionData.setSessionId(sessionId); sessionData.setComment(sessionComment); Long startTime = (Long) getFirst(all, START_TIME); sessionData.setStartTime(new Date(startTime)); Long endTime = (Long) getFirst(all, END_TIME); sessionData.setEndTime(new Date(endTime)); Integer taskExecuted = (Integer) getFirst(all, TASK_EXECUTED); sessionData.setTaskExecuted(taskExecuted); Integer tasksFailed = (Integer) getFirst(all, FAILED); sessionData.setTaskFailed(tasksFailed); Integer activeKernels = (Integer) getFirst(all, KERNELS_COUNT); sessionData.setActiveKernels(activeKernels); String errorMessage = (String) getFirst(all, ERROR_MESSAGE); sessionData.setErrorMessage(errorMessage); getHibernateTemplate().persist(sessionData); persistTags(sessionId, sessionMetaDataStorage); }
Source:
<code>public byte[] getClassDefinition() { mv.visitInsn(Opcodes.RETURN); <START> mv.visitMaxs(4, 0); <END> mv.visitEnd(); cw.visitEnd(); return cw.toByteArray(); }</code><technical_language>maxStack vary depending generator.generateDataAccessor? this ClassWriter.COMPUTE_MAXS</technical_language>

Target:
byte[] getClassDefinition() { cw.visitEnd(); final byte[] result = cw.toByteArray(); newCompanion(); return result; }
Source:
<code>ExecutionContext<T> getChildContext(Object obj) { if (subContexts == null) { return null; } ChildContext<T> subContext = subContexts.get(obj); if (subContext == null) { subContext = new ChildContext<T>(this); <START> } <END> ChildContext<T> old = subContexts.putIfAbsent(obj, subContext); if (old != null) { return old; } else { return subContext; } }</code><technical_language>this if above</technical_language>

Target:
ExecutionContext<T> getChildContext(Object obj) { if (subContexts == null) { return null; } ChildContext<T> subContext = subContexts.get(obj); if (subContext == null) { subContext = new ChildContext<T>(this); ChildContext<T> old = subContexts.putIfAbsent(obj, subContext); if (old != null) { subContext = old; } } return subContext; }
Source:
<code>protected String getCollectionString(String jsonString, boolean isList) { try { JSONValue jsonValue = JSONParser.parseStrict(jsonString); <START> if (jsonValue instanceof JSONString) { <END> String label = isList ? "List() " : "Map() "; return label + ConstantHolder.EXPRESSION; } String toFormat = isList ? "List(%s)" : "Map(%s)"; int size = -1; if (isList) { size = jsonValue.isArray().size(); } else { size = jsonValue.isObject().keySet().size(); } return toFormat.replace("%s", String.valueOf(size)); } catch (Exception e) { return jsonString; } }</code><technical_language>@yesamer I clearer "else" statement, create methods. Wdyt</technical_language>

Target:
protected String getCollectionString(String jsonString, boolean isList) { try { JSONValue jsonValue = JSONParser.parseStrict(jsonString); if (jsonValue instanceof JSONString) { return isList ? "List()" : "Map()"; } else { String toFormat = isList ? "List(%s)" : "Map(%s)"; int size = -1; if (isList) { size = jsonValue.isArray().size(); } else { size = jsonValue.isObject().keySet().size(); } return toFormat.replace("%s", String.valueOf(size)); } } catch (Exception e) { return jsonString; } }
Source:
<code>public Job mapRow(ResultSet rs, int rowNum) throws SQLException { Job job = new Job(); job.setId(Guid.createGuidFromString(rs.getString("job_id"))); job.setActionType(VdcActionType.valueOf(rs.getString("action_type"))); job.setDescription(rs.getString("description")); job.setStatus(JobExecutionStatus.valueOf(rs.getString("status"))); job.setOwnerId(NGuid.createGuidFromString(rs.getString("owner_id"))); job.setVisible(rs.getBoolean("visible")); job.setStartTime(DbFacadeUtils.fromDate(rs.getTimestamp("start_time"))); job.setEndTime(DbFacadeUtils.fromDate(rs.getTimestamp("end_time"))); job.setLastUpdateTime(DbFacadeUtils.fromDate(rs.getTimestamp("last_update_time"))); job.setCorrelationId(rs.getString("correlation_id")); job.setExternal(rs.getBoolean("is_external")); <START> job.setExternal(rs.getBoolean("is_auto_cleared")); <END> return job; }</code><technical_language>Bug. set auto_cleared external. Please fix</technical_language>

Target:
public Job mapRow(ResultSet rs, int rowNum) throws SQLException { Job job = new Job(); job.setId(Guid.createGuidFromString(rs.getString("job_id"))); job.setActionType(VdcActionType.valueOf(rs.getString("action_type"))); job.setDescription(rs.getString("description")); job.setStatus(JobExecutionStatus.valueOf(rs.getString("status"))); job.setOwnerId(NGuid.createGuidFromString(rs.getString("owner_id"))); job.setVisible(rs.getBoolean("visible")); job.setStartTime(DbFacadeUtils.fromDate(rs.getTimestamp("start_time"))); job.setEndTime(DbFacadeUtils.fromDate(rs.getTimestamp("end_time"))); job.setLastUpdateTime(DbFacadeUtils.fromDate(rs.getTimestamp("last_update_time"))); job.setCorrelationId(rs.getString("correlation_id")); job.setExternal(rs.getBoolean("is_external")); job.setAutoCleared(rs.getBoolean("is_auto_cleared")); return job; }
Source:
<code>public static Map<String, String> getUserClaimValues(String username, String[] requestedClaims, String profile) throws IdentityException { try { username = MultitenantUtils.getTenantAwareUsername(username); <START> UserRealm userRealm = AnonymousSessionUtil.getRealmByUserName(SAMLSSOUtil.getRegistryService(), <END> SAMLSSOUtil.getRealmService(), username); if(userRealm == null){ throw new IdentityException("User realm is not present for this user name:" + username); } UserStoreManager userStoreManager = userRealm.getUserStoreManager(); return userStoreManager.getUserClaimValues(username, requestedClaims, profile); } catch (UserStoreException e) { log.error("Error while retrieving claims values", e); throw new IdentityException( "Error while retrieving claims values", e); } catch (CarbonException e) { log.error("Error while retrieving claims values", e); throw new IdentityException( "Error while retrieving claim values", e); } }</code><technical_language>tenantAwareUsername get user realm. this approach work for tenants. returns super tenant realm</technical_language>

Target:
public static Map<String, String> getUserClaimValues(String username, String[] requestedClaims, String profile) throws IdentityException { try { UserRealm userRealm = AnonymousSessionUtil.getRealmByUserName(SAMLSSOUtil.getRegistryService(), SAMLSSOUtil.getRealmService(), username); if(userRealm == null){ throw new IdentityException("User realm is not present for this user name:" + username); } username = MultitenantUtils.getTenantAwareUsername(username); UserStoreManager userStoreManager = userRealm.getUserStoreManager(); return userStoreManager.getUserClaimValues(username, requestedClaims, profile); } catch (UserStoreException e) { log.error("Error while retrieving claims values", e); throw new IdentityException( "Error while retrieving claims values", e); } catch (CarbonException e) { log.error("Error while retrieving claims values", e); throw new IdentityException( "Error while retrieving claim values", e); } }
Source:
<code>private void diffReplace(Edit r) { Edit lcs = new HistogramDiffIndex<S>(maxChainLength, cmp, a, b, r) .findLongestCommonSequence(); if (lcs != null) { if (lcs.isEmpty()) { edits.add(r); } else { diff(r.before(lcs)); diff(r.after(lcs)); <START> queue.addAll(0, tmp); <END> } } else if (fallback instanceof LowLevelDiffAlgorithm) { LowLevelDiffAlgorithm fb = (LowLevelDiffAlgorithm) fallback; fb.diffNonCommon(edits, cmp, a, b, r); } else if (fallback != null) { SubsequenceComparator<HashedSequence<S>> cs = subcmp(); Subsequence<HashedSequence<S>> as = Subsequence.a(a, r); Subsequence<HashedSequence<S>> bs = Subsequence.b(b, r); EditList res = fallback.diffNonCommon(cs, as, bs); edits.addAll(Subsequence.toBase(res, as, bs)); } else { edits.add(r); } }</code><technical_language>Do want clear tmp too</technical_language>

Target:
private void diffReplace(Edit r) { Edit lcs = new HistogramDiffIndex<S>(maxChainLength, cmp, a, b, r) .findLongestCommonSequence(); if (lcs != null) { if (lcs.isEmpty()) { edits.add(r); } else { diff(r.before(lcs)); diff(r.after(lcs)); queue.addAll(0, tmp); tmp.clear(); } } else if (fallback instanceof LowLevelDiffAlgorithm) { LowLevelDiffAlgorithm fb = (LowLevelDiffAlgorithm) fallback; fb.diffNonCommon(edits, cmp, a, b, r); } else if (fallback != null) { SubsequenceComparator<HashedSequence<S>> cs = subcmp(); Subsequence<HashedSequence<S>> as = Subsequence.a(a, r); Subsequence<HashedSequence<S>> bs = Subsequence.b(b, r); EditList res = fallback.diffNonCommon(cs, as, bs); edits.addAll(Subsequence.toBase(res, as, bs)); } else { edits.add(r); } }
Source:
<code><START> void addDefinition(SerializationDefinition definition) { <END> serializerDefinitions.add(definition); }</code><technical_language>Is package private for tests</technical_language>

Target:
public void addDefinition(SerializationDefinition definition) { serializerDefinitions.add(definition); }
Source:
<code>protected Object doInBackground() throws Exception { Timer updateViewTime = new Timer(DELAY_DRAWING, this); try { beginDrawing = System.currentTimeMillis(); renderer = new ImageRenderer(); renderer.setRsProvider(resultSetProviderFactory); updateViewTime.start(); rendererImage = mapControl.getMapTransform().getImage(); renderer.draw(mapControl.getMapTransform(), mapContext.getLayerModel(), this.getProgressMonitor()); double renderingTime = (System.currentTimeMillis() - beginDrawing) / 1000.0; <START> if(renderingTime >= 1) { <END> LOGGER.debug(I18N.tr("Rendering done in {0} seconds", renderingTime)); } } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(), ex); } finally { mapControl.getMapTransform().setImage(rendererImage); intermediateDrawing.set(false); awaitingDrawing.set(false); updateViewTime.stop(); mapControl.repaint(); } return null; }</code><technical_language>Is set 1 a constant a System properties parameter</technical_language>

Target:
protected Object doInBackground() throws Exception { Timer updateViewTime = new Timer(DELAY_DRAWING, this); try { beginDrawing = System.currentTimeMillis(); renderer = new ImageRenderer(); renderer.setRsProvider(resultSetProviderFactory); updateViewTime.start(); rendererImage = mapControl.getMapTransform().getImage(); renderer.draw(mapControl.getMapTransform(), mapContext.getLayerModel(), this.getProgressMonitor()); double renderingTime = (System.currentTimeMillis() - beginDrawing) / 1000.0; if(renderingTime >= Double.valueOf(System.getProperty("map.editor.renderingtimemin", DEFAULT_LOG_RENDERING_TIME_MIN))) { LOGGER.debug(I18N.tr("Rendering done in {0} seconds", renderingTime)); } } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(), ex); } finally { mapControl.getMapTransform().setImage(rendererImage); intermediateDrawing.set(false); awaitingDrawing.set(false); updateViewTime.stop(); mapControl.repaint(); } return null; }
Source:
<code>public static Collection<String> getParserPropertyValues(Class<? extends IParser> clazz, String propertyName) { String clazzName = clazz.getName(); ArrayList<String> propertyList = new ArrayList<String>(); try { WPSConfig mockConfig = MockUtil.getMockConfig(); PropertyDocument.Property properties[] = mockConfig.getPropertiesForParserClass(clazzName); for (Property property : properties) { if (propertyName.equals(property.getName())) { propertyList.add(property.getStringValue()); } } propertyList.trimToSize(); } catch (Exception e) { log.error("parse error", e); <START> System.err.println("ERROR parsing property " + propertyName + " for Parser class " + clazzName); <END> } return propertyList; }</code><technical_language>change System.err log.error</technical_language>

Target:
public static Collection<String> getParserPropertyValues(Class<? extends IParser> clazz, String propertyName) { String clazzName = clazz.getName(); ArrayList<String> propertyList = new ArrayList<String>(); try { WPSConfig mockConfig = MockUtil.getMockConfig(); PropertyDocument.Property properties[] = mockConfig.getPropertiesForParserClass(clazzName); for (Property property : properties) { if (propertyName.equals(property.getName())) { propertyList.add(property.getStringValue()); } } propertyList.trimToSize(); } catch (Exception e) { log.error("ERROR parsing property " + propertyName + " for Parser class " + clazzName, e); } return propertyList; }
Source:
<code>public void init(ByteBuffer buf, int position) { card = AdaptiveCounting.Builder.obyCount(Integer.MAX_VALUE).build(); try { <START> byte[] bytes = card.getBytes(); <END> int size = card.sizeof(); for (int i = 0; i < size; i++) { buf.put(position + i, bytes[i]); } } catch (IOException e) { throw new RuntimeException("Failed to init: "+e); } }</code><technical_language>java buf.put(bytes, position, bytes.length); do trick here</technical_language>

Target:
public void init(ByteBuffer buf, int position) { card = AdaptiveCounting.Builder.obyCount(Integer.MAX_VALUE).build(); try { byte[] bytes = card.getBytes(); ByteBuffer copy = buf.duplicate(); copy.position(position); copy.put(bytes); } catch (IOException e) { throw new RuntimeException("Failed to init: "+e); } }
Source:
<code>public static PluginImpl getInstance() { Jenkins jenkins = Jenkins.getInstance(); if (jenkins != null) { return jenkins.getPlugin(PluginImpl.class); } else { <START> logger.error("INITIALIZATION Error, Jenkins could not be found, so no plugin!"); <END> return null; } }</code><technical_language>shut up</technical_language>

Target:
public static PluginImpl getInstance() { Jenkins jenkins = Jenkins.getInstance(); if (jenkins != null) { return jenkins.getPlugin(PluginImpl.class); } else { logger.debug("Error, Jenkins could not be found, so no plugin!"); return null; } }
Source:
<code>public void drop( String identifier, FulltextIndexType type ) throws IOException { if ( type == FulltextIndexType.NODES ) { nodeIndices.remove( identifier ).drop(); <START> writableNodeIndices.remove( identifier ).close(); <END> } else { relationshipIndices.remove( identifier ).drop(); writableRelationshipIndices.remove( identifier ).close(); } rebuildProperties(); }</code><technical_language>need protect hashmaps concurrent access</technical_language>

Target:
void drop( String identifier, FulltextIndexType type ) throws IOException { configurationLock.writeLock().lock(); try { awaitPopulation(); if ( type == FulltextIndexType.NODES ) { writableNodeIndices.remove( identifier ).drop(); } else { writableRelationshipIndices.remove( identifier ).drop(); } rebuildProperties(); } finally { configurationLock.writeLock().unlock(); } }
Source:
<code>public String getJobParameter(String key, String defaultValue) { final GlobalJobParameters conf = context.getExecutionConfig().getGlobalJobParameters(); if (conf != null) { <START> final String value = conf.toMap().get(key); <END> if (value != null) { return value; } } return defaultValue; }</code><technical_language>nit: return conf.toMap().getOrDefault(key, defaultValue);</technical_language>

Target:
public String getJobParameter(String key, String defaultValue) { final GlobalJobParameters conf = context.getExecutionConfig().getGlobalJobParameters(); if (conf != null) { return conf.toMap().getOrDefault(key, defaultValue); } return defaultValue; }