auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static ByteBuf encodeMetadata( ByteBufAllocator allocator, String customAuthType, ByteBuf metadata) { int actualASCIILength = ByteBufUtil.utf8Bytes(customAuthType); if (actualASCIILength != customAuthType.length()) { metadata.release(); throw new IllegalArgumentException("custom auth type must be US_ASCII characters only"); } <START> if (actualASCIILength < 1 || actualASCIILength > 128) { <END> metadata.release(); throw new IllegalArgumentException( "custom auth type must have a strictly positive length that fits on 7 unsigned bits, ie 1-128"); } int capacity = 1 + actualASCIILength; ByteBuf headerBuffer = allocator.buffer(capacity, capacity); headerBuffer.writeByte(actualASCIILength - 1); ByteBufUtil.reserveAndWriteUtf8(headerBuffer, customAuthType, actualASCIILength); return TupleByteBuf.of(allocator, headerBuffer, metadata); }</code><technical_language>~~should this 127?~~ n.m. code below</technical_language>

Target:
public static ByteBuf encodeMetadata( ByteBufAllocator allocator, String customAuthType, ByteBuf metadata) { int actualASCIILength = ByteBufUtil.utf8Bytes(customAuthType); if (actualASCIILength != customAuthType.length()) { throw new IllegalArgumentException("custom auth type must be US_ASCII characters only"); } if (actualASCIILength < 1 || actualASCIILength > 128) { throw new IllegalArgumentException( "custom auth type must have a strictly positive length that fits on 7 unsigned bits, ie 1-128"); } int capacity = 1 + actualASCIILength; ByteBuf headerBuffer = allocator.buffer(capacity, capacity); headerBuffer.writeByte(actualASCIILength - 1); ByteBufUtil.reserveAndWriteUtf8(headerBuffer, customAuthType, actualASCIILength); return TupleByteBuf.of(allocator, headerBuffer, metadata); }
Source:
<code>public boolean hasResponsePayload(final ImmutableList<Ds3ResponseCode> responseCodes) { for(final Ds3ResponseCode responseCode : responseCodes) { final int rc = responseCode.getCode(); if( rc >= 200 && rc < 300) for (final Ds3ResponseType responseType : responseCode.getDs3ResponseTypes()) { if(ConverterUtil.hasContent(responseType.getType())) { LOG.debug("response type " + responseType.getType()); return true; } <START> else if(ConverterUtil.hasContent(responseType.getComponentType())) { <END> LOG.debug("response type " + responseType.getComponentType()); return true; } } } return false; }</code><technical_language>Extra return, be: } else if ..</technical_language>

Target:
public static boolean hasResponsePayload(final ImmutableList<Ds3ResponseCode> responseCodes) { for (final Ds3ResponseCode responseCode : responseCodes) { final int rc = responseCode.getCode(); if (rc >= 200 && rc < 300) for (final Ds3ResponseType responseType : responseCode.getDs3ResponseTypes()) { if (ConverterUtil.hasContent(responseType.getType()) && !Objects.equals(responseType.getType(), "null")) { LOG.debug("response type " + responseType.getType()); return true; } else if (ConverterUtil.hasContent(responseType.getComponentType()) && !Objects.equals(responseType.getComponentType(), "null")) { LOG.debug("response type " + responseType.getComponentType()); return true; } } } return false; }
Source:
<code>private boolean isClobReturningFunction(String castSource) { for (int i = 0; i < clobReturningFunctions.length; i++) { <START> if (castSource.toLowerCase().startsWith(clobReturningFunctions[i] + "(")) { <END> return true; } } return false; }</code><technical_language>suggestion if (castSource.toLowerCase().startsWith(clobReturningFunctions[i])) {</technical_language>

Target:
private static boolean isClobReturningFunction(String castSource) { for (int i = 0; i < CLOB_RETURNING_FUNCTIONS.length; i++) { if (castSource.toLowerCase().startsWith(CLOB_RETURNING_FUNCTIONS[i])) { return true; } } return false; }
Source:
<code>public void patchByForbiddenUser() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/netid", "newNetId"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); <START> <END> }</code><technical_language>check changes applied</technical_language>

Target:
public void patchByForbiddenUser() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/netid", "newNetId"); ops.add(replaceOperation); String patchBody = getPatchContent(ops); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/eperson/epersons/" + ePerson.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.netid", Matchers.is(nullValue()))); }
Source:
<code>private List<StereotypeModel> findStereotypes(ComponentModel componentModel, ParameterDeclaration propertyDeclaration) { final String expectedPropertyReference = ExpressionManager.DEFAULT_EXPRESSION_PREFIX + BindingContextUtils.VARS + "." + propertyDeclaration.getName() + ExpressionManager.DEFAULT_EXPRESSION_POSTFIX; if (!componentModel.getModel(ParameterizedModel.class).isPresent()) { return emptyList(); } <START> return ((SpringComponentModel) componentModel).getParameters().stream() <END> .filter(paramAst -> paramAst.getRawValue() != null) .filter(paramAst -> paramAst.getRawValue().equals(expectedPropertyReference)) .map(paramAst -> paramAst.getModel().getName()) .map(attributeName -> findStereotypes(componentModel.getIdentifier(), attributeName)) .flatMap(Collection::stream) .collect(toList()); }</code><technical_language>this cast ComponentAst instead of SpringComponentModel</technical_language>

Target:
private List<StereotypeModel> findStereotypes(ComponentModel componentModel, ParameterDeclaration propertyDeclaration) { final String expectedPropertyReference = ExpressionManager.DEFAULT_EXPRESSION_PREFIX + BindingContextUtils.VARS + "." + propertyDeclaration.getName() + ExpressionManager.DEFAULT_EXPRESSION_POSTFIX; if (!componentModel.getModel(ParameterizedModel.class).isPresent()) { return emptyList(); } return ((ComponentAst) componentModel).getParameters().stream() .filter(paramAst -> expectedPropertyReference.equals(paramAst.getRawValue())) .map(paramAst -> paramAst.getModel().getName()) .map(attributeName -> findStereotypes(componentModel.getIdentifier(), attributeName)) .flatMap(Collection::stream) .collect(toList()); }
Source:
<code>public void evaluateOpac() { clearValues(); readProjectConfigs(); try { PrefsInterface myPrefs = serviceManager.getRulesetService().getPreferences(this.template.getRuleset()); this.myRdf = UghImplementation.INSTANCE.createMetsMods(myPrefs); this.myRdf.read(this.metadataFile.getPath()); this.docType = this.myRdf.getDigitalDocument().getLogicalDocStruct().getDocStructType().getName(); fillFieldsFromMetadataFile(this.myRdf); fillFieldsFromConfig(); } catch (Exception e) { <START> logger.error("Fehler beim Einlesen des Opac-Ergebnisses ", e); <END> Helper.setFehlerMeldung("Fehler beim Einlesen des Opac-Ergebnisses ", e); e.printStackTrace(); } }</code><technical_language>setErrorMessage</technical_language>

Target:
public void evaluateOpac() { clearValues(); readProjectConfigs(); try { PrefsInterface myPrefs = serviceManager.getRulesetService().getPreferences(this.template.getRuleset()); this.myRdf = UghImplementation.INSTANCE.createMetsMods(myPrefs); this.myRdf.read(this.metadataFile.getPath()); this.docType = this.myRdf.getDigitalDocument().getLogicalDocStruct().getDocStructType().getName(); fillFieldsFromMetadataFile(this.myRdf); fillFieldsFromConfig(); } catch (PreferencesException | ReadException | RuntimeException e) { Helper.setErrorMessage("Fehler beim Einlesen des Opac-Ergebnisses ", logger, e); } }
Source:
<code>public List<Module> transform(List<Module> modules) { <START> BindingTracingVisitor visitor = new BindingTracingVisitor(); <END> for (Element binding : Elements.getElements(modules)) { LOG.debug("Binding : {}", binding); } return modules; }</code><technical_language>This used</technical_language>

Target:
public List<Module> transform(List<Module> modules) { for (Element binding : Elements.getElements(modules)) { LOG.debug("Binding : {}", binding); } return modules; }
Source:
<code>public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (args == null) { args = NO_ARGS; } final Thread currentThread = Thread.currentThread(); final ClassLoader origClassLoader = currentThread.getContextClassLoader(); try { ClassLoader pluginClassLoader = Jenkins.getInstance().getPluginManager().getPlugin(Constants.DEPLOYIT_PLUGIN).classLoader; currentThread.setContextClassLoader(pluginClassLoader); return doInvoke(proxy, method, args); } catch (InvocationTargetException e) { <START> throw new DeployitPluginException(e.getCause().getMessage(), e.getCause()); <END> } finally { currentThread.setContextClassLoader(origClassLoader); } }</code><technical_language>NPE. getCause return null. Add constructor a</technical_language>

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (args == null) { args = NO_ARGS; } final Thread currentThread = Thread.currentThread(); final ClassLoader origClassLoader = currentThread.getContextClassLoader(); try { ClassLoader pluginClassLoader = origClassLoader; if (null != Jenkins.getInstance()) { pluginClassLoader = Jenkins.getInstance().getPluginManager().getPlugin(Constants.DEPLOYIT_PLUGIN).classLoader; } currentThread.setContextClassLoader(pluginClassLoader); return doInvoke(proxy, method, args); } catch (InvocationTargetException e) { if (null != e.getCause()) { throw new DeployitPluginException(e.getCause()); } else { throw new DeployitPluginException(e); } } finally { currentThread.setContextClassLoader(origClassLoader); } }
Source:
<code>public <T extends Action> T getAction(@NonNull Class<T> type) { <START> return ChangeRequestAction.class.equals(type) ? (T)new ChangeRequestAction(){} : null; <END> }</code><technical_language>No, I meant implement methods</technical_language>

Target:
public <T extends Action> T getAction(@NonNull Class<T> type) { return null; }
Source:
<code>public void addPapyrusTable(Table tableInstance) { <START> getResource().getContents().add(tableInstance); <END> }</code><technical_language>work controlled models</technical_language>

Target:
public void addPapyrusTable(Table tableInstance) { if (getResource() != null) { getResource().getContents().add(tableInstance); } }
Source:
<code>private void verifyRegenerateStudentCourseLinks(WebElement studentRow, String originalJoinLink) { <START> if (TestProperties.isDevServer() || TestProperties.INCLUDE_EMAIL_VERIFICATION) { <END> searchPage.verifyStatusMessage("Student's links for this course have been successfully " + "regenerated, and the email has been sent."); } else { searchPage.verifyStatusMessage("Student's links for this course have been successfully " + "regenerated, but the email failed to send."); } String regeneratedJoinLink = searchPage.getStudentJoinLink(studentRow); assertNotEquals(regeneratedJoinLink, originalJoinLink); }</code><technical_language>logic is right for reasons: - Production server is for emails failing send - TestProperties affect production system logic in of INCLUDE_EMAIL_VERIFICATION is affect emails</technical_language>

Target:
private void verifyRegenerateStudentCourseLinks(WebElement studentRow, String originalJoinLink) { if (TestProperties.isDevServer() || TestProperties.INCLUDE_EMAIL_VERIFICATION) { searchPage.verifyStatusMessage("Student's links for this course have been successfully " + "regenerated, and the email has been sent."); } String regeneratedJoinLink = searchPage.getStudentJoinLink(studentRow); assertNotEquals(regeneratedJoinLink, originalJoinLink); }
Source:
<code>public boolean isEmpty() { <START> return this.toProcess.isEmpty(); <END> }</code><technical_language>synchronize</technical_language>

Target:
public boolean isEmpty() { synchronized (this.toProcess) { return this.toProcess.isEmpty(); } }
Source:
<code><START> public final This bindList(String key, List<?> values) { <END> if (values.isEmpty()) { throw new IllegalArgumentException( getClass().getSimpleName() + ".defineList was passed an empty list."); } StringBuilder names = new StringBuilder(); for (int i = 0; i < values.size(); i++) { String name = "__" + key + "_" + i; if (i > 0) { names.append(','); } names.append(':').append(name); bind(name, values.get(i)); } return define(key, names.toString()); }</code><technical_language>this accept Collection Iterable? @BindList supports them</technical_language>

Target:
public final This bindList(String key, List<?> values) { if (values.isEmpty()) { throw new IllegalArgumentException( getClass().getSimpleName() + ".bindList was called with an empty list."); } StringBuilder names = new StringBuilder(); for (int i = 0; i < values.size(); i++) { String name = "__" + key + "_" + i; if (i > 0) { names.append(','); } names.append(':').append(name); bind(name, values.get(i)); } return define(key, names.toString()); }
Source:
<code>public String getQuestionSpecificEditFormHtml(int questionNumber) { boolean isMinOptionsToBeRankedEnabled = minOptionsToBeRanked != Integer.MIN_VALUE; boolean isMaxOptionsToBeRankedEnabled = maxOptionsToBeRanked != Integer.MIN_VALUE; return Templates.populateTemplate( FormTemplates.RANK_EDIT_RECIPIENTS_FORM, Slots.QUESTION_NUMBER, Integer.toString(questionNumber), Slots.OPTION_RECIPIENT_DISPLAY_NAME, "recipient", Slots.RANK_PARAM_IS_DUPLICATES_ALLOWED, Const.ParamsNames.FEEDBACK_QUESTION_RANKISDUPLICATESALLOWED, Slots.RANK_ARE_DUPLICATES_ALLOWED_CHECKED, isAreDuplicatesAllowed() ? "checked" : "", Slots.RANK_IS_MIN_RECIPIENTS_TO_BE_RANKED_ENABLED, isMinOptionsToBeRankedEnabled ? "checked" : "", Slots.RANK_PARAM_MIN_RECIPIENTS_CHECKBOX, Const.ParamsNames.FEEDBACK_QUESTION_RANKISMINRECIPIENTSTOBERANKEDENABLED, Slots.RANK_PARAM_MIN_RECIPIENTS_TO_BE_RANKED, Const.ParamsNames.FEEDBACK_QUESTION_RANKMINRECIPIENTSTOBERANKED, Slots.RANK_MIN_RECIPIENTS_TO_BE_RANKED, isMinOptionsToBeRankedEnabled <START> ? Integer.toString(minOptionsToBeRanked) : "1", <END> Slots.RANK_IS_MAX_RECIPIENTS_TO_BE_RANKED_ENABLED, isMaxOptionsToBeRankedEnabled ? "checked" : "", Slots.RANK_PARAM_MAX_RECIPIENTS_CHECKBOX, Const.ParamsNames.FEEDBACK_QUESTION_RANKISMAXRECIPIENTSTOBERANKEDENABLED, Slots.RANK_PARAM_MAX_RECIPIENTS_TO_BE_RANKED, Const.ParamsNames.FEEDBACK_QUESTION_RANKMAXRECIPIENTSTOBERANKED, Slots.RANK_MAX_RECIPIENTS_TO_BE_RANKED, isMaxOptionsToBeRankedEnabled ? Integer.toString(maxOptionsToBeRanked) : "1"); }</code><technical_language>forget this</technical_language>

Target:
public String getQuestionSpecificEditFormHtml(int questionNumber) { boolean isMinOptionsToBeRankedEnabled = minOptionsToBeRanked != Integer.MIN_VALUE; boolean isMaxOptionsToBeRankedEnabled = maxOptionsToBeRanked != Integer.MIN_VALUE; return Templates.populateTemplate( FormTemplates.RANK_EDIT_RECIPIENTS_FORM, Slots.QUESTION_NUMBER, Integer.toString(questionNumber), Slots.OPTION_RECIPIENT_DISPLAY_NAME, "recipient", Slots.RANK_PARAM_IS_DUPLICATES_ALLOWED, Const.ParamsNames.FEEDBACK_QUESTION_RANKISDUPLICATESALLOWED, Slots.RANK_ARE_DUPLICATES_ALLOWED_CHECKED, isAreDuplicatesAllowed() ? "checked" : "", Slots.RANK_PARAM_MIN_RECIPIENTS_CHECKBOX, Const.ParamsNames.FEEDBACK_QUESTION_RANKISMINRECIPIENTSTOBERANKEDENABLED, Slots.RANK_PARAM_MIN_RECIPIENTS_TO_BE_RANKED, Const.ParamsNames.FEEDBACK_QUESTION_RANKMINRECIPIENTSTOBERANKED, Slots.RANK_MIN_RECIPIENTS_TO_BE_RANKED, isMinOptionsToBeRankedEnabled ? Integer.toString(minOptionsToBeRanked) : "1", Slots.RANK_IS_MIN_RECIPIENTS_TO_BE_RANKED_ENABLED, isMinOptionsToBeRankedEnabled ? "checked" : "", Slots.RANK_PARAM_MAX_RECIPIENTS_CHECKBOX, Const.ParamsNames.FEEDBACK_QUESTION_RANKISMAXRECIPIENTSTOBERANKEDENABLED, Slots.RANK_PARAM_MAX_RECIPIENTS_TO_BE_RANKED, Const.ParamsNames.FEEDBACK_QUESTION_RANKMAXRECIPIENTSTOBERANKED, Slots.RANK_MAX_RECIPIENTS_TO_BE_RANKED, isMaxOptionsToBeRankedEnabled ? Integer.toString(maxOptionsToBeRanked) : "1", Slots.RANK_IS_MAX_RECIPIENTS_TO_BE_RANKED_ENABLED, isMaxOptionsToBeRankedEnabled ? "checked" : ""); }
Source:
<code>private void addNewAmbryPartitions(List<Partition> partitions, String resourceName) { if (partitions.isEmpty()) { throw new IllegalArgumentException("Cannot add resource with zero partitions"); } for (Map.Entry<String, HelixAdmin> entry : adminForDc.entrySet()) { String dcName = entry.getKey(); HelixAdmin dcAdmin = entry.getValue(); AutoModeISBuilder resourceISBuilder = new AutoModeISBuilder(resourceName); int numReplicas = 0; <START> resourceISBuilder.setStateModel("LeaderStandby"); <END> for (Partition partition : partitions) { String partitionName = Long.toString(partition.getId()); boolean sealed = partition.getPartitionState().equals(PartitionState.READ_ONLY); List<ReplicaId> replicaList = getReplicasInDc(partition, dcName); numReplicas = replicaList.size(); String[] instances = updateInstancesAndGetInstanceNames(dcAdmin, partitionName, replicaList, sealed); resourceISBuilder.assignPreferenceList(partitionName, instances); } resourceISBuilder.setNumReplica(numReplicas); IdealState idealState = resourceISBuilder.build(); dcAdmin.addResource(clusterName, resourceName, idealState); } }</code><technical_language>LeaderStandbySMD.name located org.apache.helix.model</technical_language>

Target:
private void addNewAmbryPartitions(List<Partition> partitions, String resourceName) { if (partitions.isEmpty()) { throw new IllegalArgumentException("Cannot add resource with zero partitions"); } for (Map.Entry<String, HelixAdmin> entry : adminForDc.entrySet()) { String dcName = entry.getKey(); HelixAdmin dcAdmin = entry.getValue(); AutoModeISBuilder resourceISBuilder = new AutoModeISBuilder(resourceName); int numReplicas = 0; resourceISBuilder.setStateModel(LeaderStandbySMD.name); for (Partition partition : partitions) { String partitionName = Long.toString(partition.getId()); boolean sealed = partition.getPartitionState().equals(PartitionState.READ_ONLY); List<ReplicaId> replicaList = getReplicasInDc(partition, dcName); numReplicas = replicaList.size(); String[] instances = updateInstancesAndGetInstanceNames(dcAdmin, partitionName, replicaList, sealed); Collections.shuffle(Arrays.asList(instances)); resourceISBuilder.assignPreferenceList(partitionName, instances); } resourceISBuilder.setNumReplica(numReplicas); IdealState idealState = resourceISBuilder.build(); dcAdmin.addResource(clusterName, resourceName, idealState); } }
Source:
<code>public List<Scope> loadAllScopes(String tenantDomain) throws DataLoadingException { String scopesEp = APIConstants.SubscriptionValidationResources.SCOPES; List<Scope> scopes = new ArrayList<>(); String responseString; try { responseString = invokeService(scopesEp, tenantDomain); } catch (IOException e) { String msg = "Error while executing the http client " + scopesEp; log.error(msg, e); throw new DataLoadingException(msg, e); } if (responseString != null && !responseString.isEmpty()) { <START> scopes = (new Gson().fromJson(responseString, ScopesList.class)).getList(); <END> } return scopes; }</code><technical_language>suggestion scopes = new Gson().fromJson(responseString, ScopesList.class).getList();</technical_language>

Target:
public List<Scope> loadAllScopes(String tenantDomain) throws DataLoadingException { String scopesEp = APIConstants.SubscriptionValidationResources.SCOPES; List<Scope> scopes = new ArrayList<>(); String responseString; try { responseString = invokeService(scopesEp, tenantDomain); } catch (IOException e) { String msg = "Error while executing the HTTP client " + scopesEp; log.error(msg, e); throw new DataLoadingException(msg, e); } if (responseString != null && !responseString.isEmpty()) { scopes = new Gson().fromJson(responseString, ScopesList.class).getList(); } return scopes; }
Source:
<code>public void copyInto(final WireFeed feed, final SyndFeed syndFeed) { final Channel channel = (Channel) feed; super.copyInto(channel, syndFeed); syndFeed.setLanguage(channel.getLanguage()); syndFeed.setCopyright(channel.getCopyright()); syndFeed.setDocs(channel.getDocs()); syndFeed.setManagingEditor(channel.getManagingEditor()); syndFeed.setWebMaster(channel.getWebMaster()); syndFeed.setGenerator(channel.getGenerator()); final Date pubDate = channel.getPubDate(); if (pubDate != null) { syndFeed.setPublishedDate(pubDate); } else if (channel.getLastBuildDate() != null) { syndFeed.setPublishedDate(channel.getLastBuildDate()); } final String author = channel.getManagingEditor(); if (author != null) { final List<String> creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators(); if (!creators.contains(author)) { final Set<String> s = new LinkedHashSet<String>(); s.addAll(creators); s.add(author); creators.clear(); creators.addAll(s); } } final List<Item> items = channel.getItems(); if (items != null) { syndFeed.setEntries(createSyndEntries(items, syndFeed.isPreservingWireFeed())); <START> } <END> }</code><technical_language>Is this code necessary? ConverterForRSS091Userland inherit ConverterForRSS090</technical_language>

Target:
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) { final Channel channel = (Channel) feed; super.copyInto(channel, syndFeed); syndFeed.setLanguage(channel.getLanguage()); syndFeed.setCopyright(channel.getCopyright()); syndFeed.setDocs(channel.getDocs()); syndFeed.setManagingEditor(channel.getManagingEditor()); syndFeed.setWebMaster(channel.getWebMaster()); syndFeed.setGenerator(channel.getGenerator()); final Date pubDate = channel.getPubDate(); if (pubDate != null) { syndFeed.setPublishedDate(pubDate); } else if (channel.getLastBuildDate() != null) { syndFeed.setPublishedDate(channel.getLastBuildDate()); } final String author = channel.getManagingEditor(); if (author != null) { final List<String> creators = ((DCModule) syndFeed.getModule(DCModule.URI)).getCreators(); if (!creators.contains(author)) { final Set<String> s = new LinkedHashSet<String>(); s.addAll(creators); s.add(author); creators.clear(); creators.addAll(s); } } }
Source:
<code>private void revokeGithubOauthToken() { if (testGroupsToExclude == null <START> || testGroupsToExclude.contains(TestGroup.GITHUB.toLowerCase())) { <END> return; } try { gitHubClientService.deleteAllGrants(gitHubUsername, gitHubPassword); } catch (Exception e) { LOG.warn("There was an error of revoking the github oauth token.", e); } }</code><technical_language>"toLowerCase()" redundant, "TestGroup.GITHUB" constant is in lowercase</technical_language>

Target:
private void revokeGithubOauthToken() { if (excludedGroups == null || excludedGroups.contains(TestGroup.GITHUB)) { return; } try { gitHubClientService.deleteAllGrants(gitHubUsername, gitHubPassword); } catch (Exception e) { LOG.warn("There was an error of revoking the github oauth token.", e); } }
Source:
<code><START> public Subtitle parse(InputStream inputStream, String inputEncoding, long startTimeUs) <END> throws IOException { DataInputStream in = new DataInputStream(inputStream); String text = in.readUTF(); text = (text == null) ? "" : text; Log.i(TAG,"parse(" + text + "," + startTimeUs + ")" ); SubtitleData cue = new SubtitleData(); cue.setSubtitleText(text); cue.setStartTimePos(startTimeUs); mSubtitleList.add(cue); Collections.sort(mSubtitleList, new Comparator<SubtitleData>() { @Override public int compare(SubtitleData o1 , SubtitleData o2) { if (o1.getStartTimePos() < o2.getStartTimePos()) return -1; if (o1.getStartTimePos() > o2.getStartTimePos()) return 1; return 0; } }); TextSubtitle textSubtitle = new TextSubtitle(mSubtitleList); return textSubtitle; }</code><technical_language>confused this method. stateless read InputStream, returning parsed result. specifically, mSubtitleList exist (and accumulate entries multiple calls parse(). SubtitleData class needed (if is, completely immutable unnecessary, for example end time - used)</technical_language>

Target:
public Subtitle parse(InputStream inputStream, String inputEncoding, long startTimeUs) throws IOException { DataInputStream in = new DataInputStream(inputStream); String text = in.readUTF(); text = (text == null) ? "" : text; SubtitleData cue = new SubtitleData(startTimeUs, text); if (subtitleList.size() > 0) { long lastTimeUs = subtitleList.get(subtitleList.size() - 1).startTimePosUs; if (startTimeUs < lastTimeUs) { subtitleList.clear(); } while (subtitleList.size() > MAX_SUBTITLE_COUNT) { subtitleList.remove(0); } } subtitleList.add(cue); Collections.sort(subtitleList, new Comparator<SubtitleData>() { @Override public int compare(SubtitleData o1 , SubtitleData o2) { if (o1.startTimePosUs < o2.startTimePosUs) return -1; if (o1.startTimePosUs > o2.startTimePosUs) return 1; return 0; } }); return new TextSubtitle(subtitleList); }
Source:
<code>public void next() { if (iter.hasNext()) { try { Handler<DeliveryContext> handler = iter.next(); if (handler != null) { handler.handle(this); } else { next(); } } catch (Throwable t) { log.error("Failure in interceptor", t); } } else { boolean local = true; if (message instanceof ClusteredMessage) { ClusteredMessage cmsg = (ClusteredMessage)message; if (cmsg.isFromWire()) { local = false; } } try { if (metrics != null) { metrics.beginHandleMessage(metric, local); } VertxTracer tracer = handlerContext.tracer(); if (tracer != null && !src) { <START> List<Map.Entry<String, String>> tags = Collections.singletonList(new AbstractMap.SimpleEntry<>("peer.service", message.address)); <END> Object trace = tracer.receiveRequest(context, message, message.isSend() ? "send" : "publish", message.headers, tags); handler.handle(message); tracer.sendResponse(context, null, trace, null, Collections.emptyList()); } else { handler.handle(message); } if (metrics != null) { metrics.endHandleMessage(metric, null); } } catch (Exception e) { log.error("Failed to handleMessage. address: " + message.address(), e); if (metrics != null) { metrics.endHandleMessage(metric, e); } context.reportException(e); } } }</code><technical_language>imho (and in zipkin) remote address is important enough a type. is easier change a type a named tag other around. name "service" is friendly name, IP. <LINK_0></technical_language>

Target:
public void next() { if (iter.hasNext()) { try { Handler<DeliveryContext> handler = iter.next(); if (handler != null) { handler.handle(this); } else { next(); } } catch (Throwable t) { log.error("Failure in interceptor", t); } } else { boolean local = true; if (message instanceof ClusteredMessage) { ClusteredMessage cmsg = (ClusteredMessage)message; if (cmsg.isFromWire()) { local = false; } } try { if (metrics != null) { metrics.beginHandleMessage(metric, local); } VertxTracer tracer = handlerContext.tracer(); if (tracer != null && !src) { Object trace = tracer.receiveRequest(context, message, message.isSend() ? "send" : "publish", message.headers, MessageTagExtractor.INSTANCE); handler.handle(message); tracer.sendResponse(context, null, trace, null, TagExtractor.empty()); } else { handler.handle(message); } if (metrics != null) { metrics.endHandleMessage(metric, null); } } catch (Exception e) { log.error("Failed to handleMessage. address: " + message.address(), e); if (metrics != null) { metrics.endHandleMessage(metric, e); } context.reportException(e); } } }
Source:
<code>private void sendAndReceive(HttpMessage msg) throws HttpException, IOException { if (this.getDelayInMs() > 0) { try { Thread.sleep(this.getDelayInMs()); } catch (InterruptedException e) { } } if (parent != null) { httpSender.sendAndReceive(msg, parent.getRedirectRequestConfig()); requestCount++; <START> parent.notifyNewMessage(msg); <END> } }</code><technical_language>Yes, remove parent null check, happen (it break earlier)</technical_language>

Target:
private void sendAndReceive(HttpMessage msg) throws HttpException, IOException { if (this.getDelayInMs() > 0) { try { Thread.sleep(this.getDelayInMs()); } catch (InterruptedException e) { } } httpSender.sendAndReceive(msg, parent.getRedirectRequestConfig()); requestCount++; parent.notifyNewMessage(msg); }
Source:
<code>public void start() throws Exception { LOGGER.info("Starting Cardinality Manager"); if (cardinalityConfig.isActive()) { LOGGER.info("Scheduling cardinality calculation job"); LocalDateTime localNow = LocalDateTime.now(); ZoneId currentZone = ZoneId.of(TIME_ZONE); ZonedDateTime zonedNow = ZonedDateTime.of(localNow, currentZone); ZonedDateTime zonedNext5 = zonedNow.withHour(cardinalityConfig.getInitialDelay()).withMinute(0).withSecond(0); if (zonedNow.compareTo(zonedNext5) > 0) zonedNext5 = zonedNext5.plusDays(1); Duration duration = Duration.between(zonedNow, zonedNext5); long initialDelay = duration.getSeconds(); scheduledExecutorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { LockingTaskExecutor executor = new DefaultLockingTaskExecutor(new HazelcastLockProvider(hazelcastConnection.getHazelcast())); Instant lockAtMostUntil = Instant.now().plusSeconds(TimeUnit.HOURS.toSeconds(MAX_TIME_TO_RUN_TASK_IN_HOURS)); executor.executeWithLock(new CardinalityCalculationRunnable(tableMetadataManager), new LockConfiguration("cardinalityCalculation", lockAtMostUntil)); } }, initialDelay, cardinalityConfig.getInterval(), TimeUnit.SECONDS); LOGGER.info("Scheduled cardinality calculation job"); } else { LOGGER.info("Not scheduling cardinality calculation job"); } <START> LOGGER.info("Started Cardinality Manager"); <END> }</code><technical_language>this is required</technical_language>

Target:
public void start() throws Exception { LOGGER.info("Starting Cardinality Manager"); if (cardinalityConfig.isActive()) { LOGGER.info("Scheduling cardinality calculation job"); LocalDateTime localNow = LocalDateTime.now(); Calendar now = Calendar.getInstance(); ZoneId currentZone = ZoneId.of(now.getTimeZone().getID()); ZonedDateTime zonedNow = ZonedDateTime.of(localNow, currentZone); ZonedDateTime zonedNext5 = zonedNow.withHour(cardinalityConfig.getInitialDelay()).withMinute(0).withSecond(0); if (zonedNow.compareTo(zonedNext5) > 0) zonedNext5 = zonedNext5.plusDays(1); Duration duration = Duration.between(zonedNow, zonedNext5); long initialDelay = duration.getSeconds(); scheduledExecutorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { LockingTaskExecutor executor = new DefaultLockingTaskExecutor(new HazelcastLockProvider(hazelcastConnection.getHazelcast())); Instant lockAtMostUntil = Instant.now().plusSeconds(TimeUnit.HOURS.toSeconds(MAX_TIME_TO_RUN_TASK_IN_HOURS)); executor.executeWithLock(new CardinalityCalculationRunnable(tableMetadataManager), new LockConfiguration("cardinalityCalculation", lockAtMostUntil)); } }, initialDelay, cardinalityConfig.getInterval(), TimeUnit.SECONDS); LOGGER.info("Scheduled cardinality calculation job"); } else { LOGGER.info("Not scheduling cardinality calculation job"); } }
Source:
<code>public void offerSp(InitiateResponseMessage msg, boolean isLeader, long handle) { long truncationHandle = m_lastSpTruncationHandle; if (isLeader) { truncationHandle = handle; } <START> if (msg.getSpHandle() >= truncationHandle || truncationHandle == Long.MIN_VALUE) { <END> m_mailbox.send(msg.getInitiatorHSId(), msg); } else { m_shortCircuitReadSp.add(new Item(msg)); } releaseShortCircuitRead(truncationHandle, IS_SP); }</code><technical_language>need check for truncationHandle == Long.MIN_VALUE</technical_language>

Target:
public void offerSp(InitiateResponseMessage msg, boolean isLeader, long handle) { long truncationHandle = m_lastSpTruncationHandle; if (isLeader) { truncationHandle = handle; } if (msg.getSpHandle() >= truncationHandle) { m_mailbox.send(msg.getInitiatorHSId(), msg); } else { m_shortCircuitReadSp.add(new Item(msg)); } releaseShortCircuitRead(truncationHandle, IS_SP); }
Source:
<code>void requestMore(long n) { if (n > 0) { while (true) { final int s = state.get(); if (s == NOT_REQUESTED_NOT_COMPLETED) { if (state.compareAndSet(NOT_REQUESTED_NOT_COMPLETED, REQUESTED_NOT_COMPLETED)) { <START> request(Long.MAX_VALUE); <END> return; } } else if (s == NOT_REQUESTED_COMPLETED) { if (state.compareAndSet(NOT_REQUESTED_COMPLETED, REQUESTED_COMPLETED)) { emit(); return; } } else return; } } }</code><technical_language>override onStart request MAX_VALUE subcsription this is no-op removed. If intention request downstream requests, I pre-start upstream meet</technical_language>

Target:
void requestMore(long n) { if (n > 0) { while (true) { final int s = state.get(); if (s == NOT_REQUESTED_NOT_COMPLETED) { if (state.compareAndSet(NOT_REQUESTED_NOT_COMPLETED, REQUESTED_NOT_COMPLETED)) { return; } } else if (s == NOT_REQUESTED_COMPLETED) { if (state.compareAndSet(NOT_REQUESTED_COMPLETED, REQUESTED_COMPLETED)) { emit(); return; } } else return; } } }
Source:
<code>public AuthConfig createAuthConfig(boolean isPush, boolean skipExtendedAuth, Map authConfig, Settings settings, String user, String registry) throws MojoExecutionException { <START> AuthConfig ret = createAuthConfig(isPush, authConfig, settings, user, registry); <END> if (ret != null) { if (registry == null ) { log.debug("default registry; no extended auth"); return ret; } if (skipExtendedAuth) { log.debug("skipping extended auth"); return ret; } try { return extendedAuthentication(registry, ret); } catch (IOException e) { throw new MojoExecutionException(e.getMessage(), e); } } ret = getAuthConfigFromDockerConfig(registry); if(ret != null) { log.debug("found credentials in ~.docker/config.json"); return ret; } log.debug("no credentials found"); return null; }</code><technical_language>I rename original createAuthConfig() a private method a distinguished name clarify this single entry point</technical_language>

Target:
public AuthConfig createAuthConfig(boolean isPush, boolean skipExtendedAuth, Map authConfig, Settings settings, String user, String registry) throws MojoExecutionException { AuthConfig ret = createStandardAuthConfig(isPush, authConfig, settings, user, registry); if (ret != null) { if (registry == null ) { log.debug("default registry; no extended auth"); return ret; } if (skipExtendedAuth) { log.debug("skipping extended auth"); return ret; } try { return extendedAuthentication(registry, ret); } catch (IOException e) { throw new MojoExecutionException(e.getMessage(), e); } } ret = getAuthConfigFromDockerConfig(registry); if(ret != null) { log.debug("found credentials in ~.docker/config.json"); return ret; } log.debug("no credentials found"); return null; }
Source:
<code>public MemcachedBackupSession createSession( String sessionId ) { if ( _log.isDebugEnabled() ) { _log.debug( "createSession invoked: " + sessionId ); } checkMaxActiveSessions(); final MemcachedBackupSession session = createEmptySession(); session.setNew( true ); session.setValid( true ); session.setCreationTime( System.currentTimeMillis() ); session.setMaxInactiveInterval( _manager.getMaxInactiveInterval() ); if ( sessionId == null || !_memcachedNodesManager.canHitMemcached( sessionId ) ) { sessionId = _manager.generateSessionId(); } session.setId( sessionId ); final Request request = _currentRequest.get(); if(request != null) { request.setNote(NEW_SESSION_ID, sessionId); } if(!_sticky) { synchronized (_manager.getSessionsInternal()) { session.registerReference(); } } if ( _log.isDebugEnabled() ) { _log.debug( "Created new session with id " + session.getId() ); } _manager.incrementSessionCounter(); <START> if( _invalidSessionsCache.get(session.getId()) ){ <END> if ( _log.isDebugEnabled() ) { _log.debug( "Remove session id " + session.getId() + " from _invalidSessionsCache, marking new session valid" ); } _invalidSessionsCache.remove(session.getId()); } return session; }</code><technical_language>jvm unbox Boolean, this throw NPE if entry for session id. containsKey instead of get</technical_language>

Target:
public MemcachedBackupSession createSession( String sessionId ) { if ( _log.isDebugEnabled() ) { _log.debug( "createSession invoked: " + sessionId ); } checkMaxActiveSessions(); final MemcachedBackupSession session = createEmptySession(); session.setNew( true ); session.setValid( true ); session.setCreationTime( System.currentTimeMillis() ); session.setMaxInactiveInterval( _manager.getMaxInactiveInterval() ); if ( sessionId == null || !_memcachedNodesManager.canHitMemcached( sessionId ) ) { sessionId = _manager.generateSessionId(); } session.setId( sessionId ); final Request request = _currentRequest.get(); if(request != null) { request.setNote(NEW_SESSION_ID, sessionId); } if(!_sticky) { synchronized (_manager.getSessionsInternal()) { session.registerReference(); } } if ( _log.isDebugEnabled() ) { _log.debug( "Created new session with id " + session.getId() ); } _manager.incrementSessionCounter(); if( _invalidSessionsCache.containsKey(session.getId()) ){ if ( _log.isDebugEnabled() ) { _log.debug( "Remove session id " + session.getId() + " from _invalidSessionsCache, marking new session valid" ); } _invalidSessionsCache.remove(session.getId()); } return session; }
Source:
<code>void releaseAllResources() throws IOException { <START> if (isReleased.compareAndSet(false, true)) { <END> ArrayDeque<Buffer> releasedBuffers = new ArrayDeque<>(); synchronized (receivedBuffers) { releasedBuffers.addAll(receivedBuffers); receivedBuffers.clear(); } bufferManager.releaseAllBuffers(releasedBuffers); } }</code><technical_language>atomic? easily checked set synchronized (receivedBuffers) lock, simplifying threading model a bit avoid extra AtomicBoolean check hot path</technical_language>

Target:
void releaseAllResources() throws IOException { ArrayDeque<Buffer> releasedBuffers = new ArrayDeque<>(); boolean shouldRelease = false; synchronized (receivedBuffers) { if (!isReleased) { isReleased = true; shouldRelease = true; releasedBuffers.addAll(receivedBuffers); receivedBuffers.clear(); } } if (shouldRelease) { bufferManager.releaseAllBuffers(releasedBuffers); } }
Source:
<code>static void filterProperties(Message message, Set<String> namesToClear, List<Object> out) { List<String> names; try { names = list(message.getPropertyNames()); } catch (Throwable t) { propagateIfFatal(t); log(t, "error getting property names from {0}", message, null); return; } if (disjoint(namesToClear, names) && message instanceof BytesMessage) { return; } for (String name: names) { Object value; try { value = message.getObjectProperty(name); } catch (Throwable t) { propagateIfFatal(t); log(t, "error getting property {0} from message {1}", name, message); return; } if (!namesToClear.contains(name) && value != null) { out.add(name); out.add(value); } } try { message.clearProperties(); } catch (Throwable t) { propagateIfFatal(t); log(t, "error clearing properties of {0}", message, null); return; } <START> if (message instanceof BytesMessage) { <END> resetBytesMessageProperties(message, out); } else { resetProperties(message, out); } }</code><technical_language>I this check done too. Worth put a private method selfdescribes why</technical_language>

Target:
static void filterProperties(Message message, Set<String> namesToClear, List<Object> out) { List<String> names; try { names = list(message.getPropertyNames()); } catch (Throwable t) { propagateIfFatal(t); log(t, "error getting property names from {0}", message, null); return; } for (String name: names) { if (!namesToClear.contains(name)) { Object value; try { value = message.getObjectProperty(name); } catch (Throwable t) { propagateIfFatal(t); log(t, "error getting property {0} from message {1}", name, message); return; } if (value != null) { out.add(name); out.add(value); } } } try { message.clearProperties(); } catch (Throwable t) { propagateIfFatal(t); log(t, "error clearing properties of {0}", message, null); return; } if (message instanceof BytesMessage) { resetBytesMessageProperties(message, out); } else { resetProperties(message, out); } }
Source:
<code><START> public void setup() throws Exception { <END> profileInstances = spy(new MockInstanceImpl<>(profile1, profile2)); tested = new BackendProfileManager(definitionUtils, profileInstances); }</code><technical_language>Method throw exception</technical_language>

Target:
public void setup() { profileInstances = spy(new MockInstanceImpl<>(profile1, profile2)); tested = new BackendProfileManager(definitionUtils, profileInstances); }
Source:
<code>public Result apply(FilterNode filterNode, Captures captures, Context context) { TableScanNode tableScan = captures.get(TABLE_SCAN); TableLayoutRewriter tableLayoutRewriter = new TableLayoutRewriter(metadata, context.getSession(), context.getSymbolAllocator(), context.getIdAllocator()); PlanNode rewrittenTableScan = tableLayoutRewriter.planTableScan(captures.get(TABLE_SCAN), filterNode.getPredicate()); <START> if (arePlansEquivalent(filterNode, tableScan, rewrittenTableScan, context)) { <END> return Result.empty(); } return Result.ofPlanNode(rewrittenTableScan); }</code><technical_language>plans equivalent: central idea of a Rule is transform plan equivalent (but different) plan. Rename method</technical_language>

Target:
public Result apply(FilterNode filterNode, Captures captures, Context context) { TableScanNode tableScan = captures.get(TABLE_SCAN); TableLayoutRewriter tableLayoutRewriter = new TableLayoutRewriter(metadata, context.getSession(), context.getSymbolAllocator(), context.getIdAllocator()); PlanNode rewritten = tableLayoutRewriter.planTableScan(captures.get(TABLE_SCAN), filterNode.getPredicate()); if (arePlansSame(filterNode, tableScan, rewritten)) { return Result.empty(); } return Result.ofPlanNode(rewritten); }
Source:
<code>private boolean isDomainExistAndActive() { <START> if (!validate(getStorageDomainValidator().isDomainExistAndActive())) { <END> return false; } return true; }</code><technical_language>replace this code return validate(getStorageDomainValidator().isDomainExistAndActive())</technical_language>

Target:
private boolean isDomainExistAndActive() { return (validate(getStorageDomainValidator().isDomainExistAndActive())); }
Source:
<code>public void testMapCountWithBackupReadEnabled() { HazelcastInstance hz = createHazelcastInstance(); Node node = getNode(hz); <START> PhoneHome phoneHome = new PhoneHome(node); <END> Map<String, String> parameters; parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpbrct"), "0"); Map<String, String> map1 = hz.getMap("hazelcast"); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpbrct"), "0"); node.getConfig().getMapConfig("hazelcast").setReadBackupData(true); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpbrct"), "1"); }</code><technical_language>3 lines duplicated in unittests. extract a @Before method node phoneHome initialized fields</technical_language>

Target:
public void testMapCountWithBackupReadEnabled() { Map<String, String> parameters; parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpbrct"), "0"); Map<String, String> map1 = node.hazelcastInstance.getMap("hazelcast"); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpbrct"), "0"); node.getConfig().getMapConfig("hazelcast").setReadBackupData(true); parameters = phoneHome.phoneHome(true); assertEquals(parameters.get("mpbrct"), "1"); }
Source:
<code>public EditShortcutPanel(ObjectMapper objectMapper) { super(); this.objectMapper = objectMapper; final VBox vBox = new VBox(); this.description = new Label(); this.description.setWrapText(true); this.gridPane = new GridPane(); this.gridPane.getStyleClass().add("grid"); this.gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70)); Region spacer = new Region(); spacer.setPrefHeight(40); GridPane buttons = new GridPane(); buttons.setAlignment(Pos.CENTER); ColumnConstraints runColumn = new ColumnConstraints(); runColumn.setPercentWidth(30); ColumnConstraints stopColumn = new ColumnConstraints(); stopColumn.setPercentWidth(30); ColumnConstraints uninstallColumn = new ColumnConstraints(); uninstallColumn.setPercentWidth(30); <START> buttons.getColumnConstraints().addAll(runColumn, stopColumn, uninstallColumn); <END> this.saveButton = new Button(tr("Save")); vBox.getChildren().addAll(this.description, this.gridPane, spacer, this.saveButton); this.setCenter(vBox); }</code><technical_language>30% * 3 = 90% missing 10%</technical_language>

Target:
public EditShortcutPanel(ObjectMapper objectMapper) { super(); this.objectMapper = objectMapper; final VBox vBox = new VBox(); this.description = new Label(); this.description.setWrapText(true); this.gridPane = new GridPane(); this.gridPane.getStyleClass().add("grid"); this.gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70)); Region spacer = new Region(); spacer.getStyleClass().add("detailsButtonSpacer"); this.saveButton = new Button(tr("Save")); vBox.getChildren().addAll(this.description, this.gridPane, spacer, this.saveButton); this.setCenter(vBox); }
Source:
<code>public void addAll(Collection<? extends Contributor> contributors) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) { super.addAll(contributors); <START> } else { <END> for (Contributor c : contributors) { add(c); } } }</code><technical_language>Need add setNotifyOnChange(false) setNotifyOnChange(true) items added. notify manually. implementation: /** * Adds Collection end of array. * * @param collection Collection add end of array. */ public void addAll(Collection<? extends T> collection) { synchronized (mLock) { if (mOriginalValues != null) { mOriginalValues.addAll(collection); } else { mObjects.addAll(collection); } } if (mNotifyOnChange) notifyDataSetChanged(); } /** * Adds object end of array. * * @param object object add end of array. */ public void add(T object) { synchronized (mLock) { if (mOriginalValues != null) { mOriginalValues.add(object); } else { mObjects.add(object); } } if (mNotifyOnChange) notifyDataSetChanged(); }</technical_language>

Target:
public void addAll(Collection<? extends Contributor> contributors) { setNotifyOnChange(false); for (Contributor c : contributors) { add(c); } notifyDataSetChanged(); }
Source:
<code>public void shouldNotThrowExceptionIfSerdesCorrectlySetFromProcessorContext() { EasyMock.expect(innerStoreMock.name()).andStubReturn("mocked-store"); EasyMock.replay(innerStoreMock); final MeteredTimestampedWindowStore<String, Long> store = new MeteredTimestampedWindowStore<>( innerStoreMock, 10L, "scope", new MockTime(), null, null ); store.init(context, innerStoreMock); try { store.put("key", ValueAndTimestamp.make(42L, 60000)); <START> } catch (final StreamsException exception) { <END> if (exception.getCause() instanceof ClassCastException) { fail("Serdes are not correctly set from processor context."); } } }</code><technical_language>I understand this ? do catch StreamsException? test fail if exception is thrown</technical_language>

Target:
public void shouldNotThrowExceptionIfSerdesCorrectlySetFromProcessorContext() { EasyMock.expect(innerStoreMock.name()).andStubReturn("mocked-store"); EasyMock.replay(innerStoreMock); final MeteredTimestampedWindowStore<String, Long> store = new MeteredTimestampedWindowStore<>( innerStoreMock, 10L, "scope", new MockTime(), null, null ); store.init(context, innerStoreMock); try { store.put("key", ValueAndTimestamp.make(42L, 60000)); } catch (final StreamsException exception) { if (exception.getCause() instanceof ClassCastException) { fail("Serdes are not correctly set from processor context."); } throw exception; } }