auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Map<String, Object> updateSection(ParameterParser params, SessionState state) { String message; Map<String, Object> results = new HashMap<String, Object>(); try { String addSectionHTML = params.getString("addSectionHTML"); int locationId = params.getInt("locationId"); String cleanAddSectionHTML = getFormattedText().processFormattedText(addSectionHTML, new StringBuilder(), true, true); <START> cleanAddSectionHTML = cleanAddSectionHTML.replaceAll("'", "&#8217;").replaceAll("\"", "&#8220;"); <END> CitationCollectionOrder.SectionType sectionType = CitationCollectionOrder.SectionType.valueOf(params.getString("sectionType")); CitationCollection collection = getCitationCollection(state, false); CitationCollectionOrder citationCollectionOrder = new CitationCollectionOrder(collection.getId(), locationId, sectionType, cleanAddSectionHTML); getCitationService().updateSection(citationCollectionOrder); message = rb.getString("resource.updated"); } catch (Exception e){ message = e.getMessage(); logger.warn("Exception in updateSection() " + e); } if(message != null && ! message.trim().equals("")) { results.put("message", message); } return results; }</code><technical_language>this</technical_language>

Target:
protected Map<String, Object> updateSection(ParameterParser params, SessionState state) { String message; Map<String, Object> results = new HashMap<String, Object>(); try { String addSectionHTML = params.getString("addSectionHTML"); int locationId = params.getInt("locationId"); String cleanAddSectionHTML = getFormattedText().processFormattedText(addSectionHTML, new StringBuilder(), true, true); cleanAddSectionHTML = cleanAddSectionHTML.replaceAll("'", "&#39;").replaceAll("\"", "&#34;"); CitationCollectionOrder.SectionType sectionType = CitationCollectionOrder.SectionType.valueOf(params.getString("sectionType")); CitationCollection collection = getCitationCollection(state, false); CitationCollectionOrder citationCollectionOrder = new CitationCollectionOrder(collection.getId(), locationId, sectionType, cleanAddSectionHTML); getCitationService().updateSection(citationCollectionOrder); message = rb.getString("resource.updated"); } catch (Exception e){ message = e.getMessage(); logger.warn("Exception in updateSection() " + e); } if(message != null && ! message.trim().equals("")) { results.put("message", message); } return results; }
Source:
<code>public static List<InternalAPI> loadInternalAPIs(String apiFilePath) { List<InternalAPI> internalApis = new ArrayList<>(); OMElement apiConfig = MiscellaneousUtil.loadXMLConfig(apiFilePath); if (apiConfig != null) { if (!ROOT_Q.equals(apiConfig.getQName())) { handleException("Invalid internal api configuration file"); } Iterator iterator = apiConfig.getChildrenWithName(HANDLER_Q); while (iterator.hasNext()) { OMElement handlerElem = (OMElement) iterator.next(); String name = null; if (handlerElem.getAttribute(NAME_ATT) != null) { name = handlerElem.getAttributeValue(NAME_ATT); } else { handleException("Name not defined in one or more handlers"); } if (handlerElem.getAttribute(CLASS_Q) != null) { String className = handlerElem.getAttributeValue(CLASS_Q); <START> if (!"".equals(className)) { <END> InternalAPI internalApi = createAPI(className); if (internalApi != null) { internalApis.add(internalApi); internalApi.setName(name); } } else { handleException("Class name is null for Internal InternalAPI name : " + name); } } else { handleException("Class name not defined for Internal InternalAPI named : " + name); } } } return internalApis; }</code><technical_language>!className.isEmpty()</technical_language>

Target:
public static List<InternalAPI> loadInternalAPIs(String apiFilePath) { List<InternalAPI> internalApis = new ArrayList<>(); OMElement apiConfig = MiscellaneousUtil.loadXMLConfig(apiFilePath); if (apiConfig != null) { if (!ROOT_Q.equals(apiConfig.getQName())) { handleException("Invalid internal api configuration file"); } Iterator iterator = apiConfig.getChildrenWithName(HANDLER_Q); while (iterator.hasNext()) { OMElement handlerElem = (OMElement) iterator.next(); String name = null; if (handlerElem.getAttribute(NAME_ATT) != null) { name = handlerElem.getAttributeValue(NAME_ATT); } else { handleException("Name not defined in one or more handlers"); } if (handlerElem.getAttribute(CLASS_Q) != null) { String className = handlerElem.getAttributeValue(CLASS_Q); if (!className.isEmpty()) { InternalAPI internalApi = createAPI(className); if (internalApi != null) { internalApis.add(internalApi); internalApi.setName(name); } } else { handleException("Class name is null for Internal InternalAPI name : " + name); } } else { handleException("Class name not defined for Internal InternalAPI named : " + name); } } } return internalApis; }
Source:
<code>public Message next() { Message message; do { <START> updateFilter(); <END> message = receiver.next(); } while (consuming && filter(message)); return message; }</code><technical_language>I understand verify if filterChain needs updated message read. filterChain volatile</technical_language>

Target:
public Message next() { Message message; do { message = receiver.next(); } while (consuming && filter(message)); return message; }
Source:
<code>public void foreach(Callback<T> callback) { for (T pair : pairs) { Object observer = pair.observerRef.get(); if (observer == null) { pairs.remove(pair); <START> } else if (cleared) { <END> break; } else if (!pair.removed) { callback.onCalled(pair, observer); } } }</code><technical_language>this check done beginning of iteration? java for (T pair : pairs) { if (cleared) { break; } else { // rest of logic Object observer = pair.observerRef.get(); if (observer == null) // else } } cleared processed if if (observer == null)</technical_language>

Target:
public void foreach(Callback<T> callback) { for (T pair : pairs) { if (cleared) { break; } else { Object observer = pair.observerRef.get(); if (observer == null) { pairs.remove(pair); } else if (!pair.removed) { callback.onCalled(pair, observer); } } } }
Source:
<code>private CacheStoreHolder initDir(File cacheWorkDir, int grpId, int partitions, LongAdderMetric allocatedTracker, boolean encrypted) throws IgniteCheckedException { try { boolean dirExisted = checkAndInitCacheWorkDir(cacheWorkDir); File idxFile = new File(cacheWorkDir, INDEX_FILE_NAME); if (dirExisted && !idxFile.exists()) grpsWithoutIdx.add(grpId); FileVersionCheckingFactory pageStoreFactory = (FileVersionCheckingFactory)getPageStoreFactory(grpId, encrypted); if (encrypted) { <START> int headerSize = pageStoreFactory.headerSize(pageStoreFactory.latestVersion()); <END> ((EncryptedFileIOFactory)pageStoreFileIoFactory).headerSize(headerSize); ((EncryptedFileIOFactory)pageStoreV1FileIoFactory).headerSize(headerSize); } PageStore idxStore = pageStoreFactory.createPageStore( PageMemory.FLAG_IDX, idxFile, allocatedTracker); if (cctx.snapshotMgr() != null) idxStore.setListener(new SnapshotPageStoreListener(grpId, INDEX_PARTITION, cctx.snapshotMgr(), idxStore)); PageStore[] partStores = new PageStore[partitions]; for (int partId = 0; partId < partStores.length; partId++) { final int p = partId; PageStore partStore = pageStoreFactory.createPageStore( PageMemory.FLAG_DATA, () -> getPartitionFilePath(cacheWorkDir, p), allocatedTracker); if (cctx.snapshotMgr() != null) partStore.setListener(new SnapshotPageStoreListener(grpId, partId, cctx.snapshotMgr(), partStore)); partStores[partId] = partStore; } return new CacheStoreHolder(idxStore, partStores); } catch (IgniteCheckedException e) { if (X.hasCause(e, StorageException.class, IOException.class)) cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); throw e; } }</code><technical_language>change headerSIze for instances of pageStoreFactory pageStoreV1FileIoFactory. fix, local variables (instances of EncryptedFileIOFactory), fix class fields (instances of AsyncFileIOFactory), I class cast exception if encryption enabled</technical_language>

Target:
private CacheStoreHolder initDir(File cacheWorkDir, int grpId, int partitions, LongAdderMetric allocatedTracker, boolean encrypted) throws IgniteCheckedException { try { boolean dirExisted = checkAndInitCacheWorkDir(cacheWorkDir); File idxFile = new File(cacheWorkDir, INDEX_FILE_NAME); if (dirExisted && !idxFile.exists()) grpsWithoutIdx.add(grpId); FilePageStoreFactory pageStoreFactory = getPageStoreFactory(grpId, encrypted); PageStore idxStore = pageStoreFactory.createPageStore( PageMemory.FLAG_IDX, idxFile, allocatedTracker); PageStore[] partStores = new PageStore[partitions]; for (int partId = 0; partId < partStores.length; partId++) { final int p = partId; PageStore partStore = pageStoreFactory.createPageStore( PageMemory.FLAG_DATA, () -> getPartitionFilePath(cacheWorkDir, p), allocatedTracker); partStores[partId] = partStore; } return new CacheStoreHolder(idxStore, partStores); } catch (IgniteCheckedException e) { if (X.hasCause(e, StorageException.class, IOException.class)) cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); throw e; } }
Source:
<code>public void whenConsumeWithJsonb_thenGetPerson() { String url = BASE_URL + API_PERSON + "/1"; String result = RestConsumer.consumeWithJsonb(url); Person person = JsonbBuilder.create().fromJson(result, Person.class); assertEquals(person.getId(), 1); assertEquals(person.getUsername(), "normanlewis"); <START> assertEquals(person.getEmail(), "normanlewis@email.com"); <END> }</code><technical_language>Switch order of arguments. assertEquals(expected, actual) assertEquals(1, person.getId()); assertEquals("normanlewis", person.getUsername()); assertEquals("normanlewis@email.com", person.getEmail());</technical_language>

Target:
public void whenConsumeWithJsonb_thenGetPerson() { String url = BASE_URL + API_PERSON + "/1"; String result = RestConsumer.consumeWithJsonb(url); Person person = JsonbBuilder.create().fromJson(result, Person.class); assertEquals(1, person.getId()); assertEquals("normanlewis", person.getUsername()); assertEquals("normanlewis@email.com", person.getEmail()); }
Source:
<code>public Attribute fillAttribute(PerunSessionImpl perunSession, User user, AttributeDefinition attribute) throws InternalErrorException { Attribute filledAttribute = new Attribute(attribute); if (attribute.getFriendlyName().equals(attrNameFenix)) { <START> filledAttribute.setValue(sha1HashCount(user, getDomainNameFenix()).toString() + getDomainNameFenix()); <END> return filledAttribute; } else { return filledAttribute; } }</code><technical_language>realized domain name property stored "@" character. However, need include "@" while setting attribute value. So, please change code this? if (attribute.getFriendlyName().equals(attrNameFenix)) { String domain = "@" + getDomainNameFenix(); filledAttribute.setValue(sha1HashCount(user, domain).toString() + domain);</technical_language>

Target:
public Attribute fillAttribute(PerunSessionImpl perunSession, User user, AttributeDefinition attribute) throws InternalErrorException { Attribute filledAttribute = new Attribute(attribute); if (attribute.getFriendlyName().equals(attrNameFenix)) { String domain = "@" + getDomainNameFenix(); filledAttribute.setValue(sha1HashCount(user, domain).toString() + domain); return filledAttribute; } else { return filledAttribute; } }
Source:
<code>public void deleteFolderWithAllCopiedFiles() throws Exception { final File directory = new File(DEST_PATH); if (directory.exists()) { FileUtils.cleanDirectory(directory); <START> if (!directory.delete()) { <END> throw new RuntimeException("Could not delete folder " + DEST_PATH); } } }</code><technical_language>.. I want delete too, leave folder clean test ran</technical_language>

Target:
public void deleteFolderWithAllCopiedFiles() throws Exception { final File directory = new File(DEST_PATH); FileUtils.deleteDirectory(directory); }
Source:
<code>private void configNonVpnNetwork() { <START> final Network network = new Network(mNetwork); <END> final Network[] networks = new Network[] {network}; doReturn(networks).when(sMockConnectivityManager).getAllNetworks(); final NetworkCapabilities nonVpnCapabilities = new NetworkCapabilities(); doReturn(nonVpnCapabilities).when(sMockConnectivityManager).getNetworkCapabilities(network); }</code><technical_language>need this local, inline member in next line. (it matter)</technical_language>

Target:
private void configNonVpnNetwork() { final Network[] networks = new Network[] {new Network(mNetwork)}; doReturn(networks).when(sMockConnectivityManager).getAllNetworks(); final NetworkCapabilities nonVpnCapabilities = new NetworkCapabilities() .addTransportType(NetworkCapabilities.TRANSPORT_WIFI); doReturn(nonVpnCapabilities).when(sMockConnectivityManager).getNetworkCapabilities( mNetwork); }
Source:
<code>private static long getRecommendedMetaspaceSize(long loadedClassesCount) { <START> return (loadedClassesCount * 5800) + 14000000; <END> }</code><technical_language>14_000_000</technical_language>

Target:
private static long getRecommendedMetaspaceSize(long loadedClassesCount) { return (loadedClassesCount * 5800) + 14_000_000; }
Source:
<code>public static Endpoint createFixed(String url) { <START> checkNotNull(url, "URL == null"); <END> if (url.trim().length() == 0) { throw new IllegalArgumentException("URL is empty"); } final HttpUrl httpUrl = HttpUrl.parse(url); if (httpUrl == null) { throw new IllegalArgumentException("Invalid URL: " + url); } return new Endpoint() { @Override public HttpUrl url() { return httpUrl; } }; }</code><technical_language>This lowercase denote method parameter name. others referenced uppercase acronym a noun</technical_language>

Target:
public static Endpoint createFixed(String url) { checkNotNull(url, "url == null"); if (url.trim().length() == 0) { throw new IllegalArgumentException("Empty URL"); } final HttpUrl httpUrl = HttpUrl.parse(url); if (httpUrl == null) { throw new IllegalArgumentException("Invalid URL: " + url); } return new Endpoint() { @Override public HttpUrl url() { return httpUrl; } }; }
Source:
<code>public void cancelQuery( @QueryParam("uri") String uri, @QueryParam("hmac") String hash, @Context HttpServletRequest servletRequest, @Suspended AsyncResponse asyncResponse) { if (!hmac.hashString(uri, UTF_8).equals(HashCode.fromString(hash))) { throw badRequest(FORBIDDEN, "Failed to validate HMAC of URI"); } Request.Builder request = prepareDelete().setUri(URI.create(uri)); performRequest(servletRequest, asyncResponse, request, response -> <START> responseWithHeaders(Response.noContent(), response)); <END> }</code><technical_language>Static import noContent() put line</technical_language>

Target:
public void cancelQuery( @QueryParam("uri") String uri, @QueryParam("hmac") String hash, @Context HttpServletRequest servletRequest, @Suspended AsyncResponse asyncResponse) { if (!hmac.hashString(uri, UTF_8).equals(HashCode.fromString(hash))) { throw badRequest(FORBIDDEN, "Failed to validate HMAC of URI"); } Request.Builder request = prepareDelete().setUri(URI.create(uri)); performRequest(servletRequest, asyncResponse, request, response -> responseWithHeaders(noContent(), response)); }
Source:
<code><START> public void setImageList(List<Guid> value) { <END> privateImageList = value; }</code><technical_language>now</technical_language>

Target:
private void setImageList(List<Guid> value) { privateImageList = value; }
Source:
<code>public void testCharacterUnboxingAutoReboxing() throws IOException { String translation = translateSourceFile( "class Test { " <START> + "void test() { Character toChar = 'A', toInt = 'A', toLong = 'A', toFlt = 'A', toDbl = 'A'; " <END> + "Object[] arr = {(char) toChar, (int) toInt, (long) toLong, (float) toFlt, (double) toDbl}; } }", "Test", "Test.m"); assertTranslation(translation, "IOSObjectArray *arr = [IOSObjectArray arrayWithObjects:(id[]){ " + "JavaLangCharacter_valueOfWithChar_([toChar charValue]), JavaLangInteger_valueOfWithInt_((jint) " + "[toInt charValue]), JavaLangLong_valueOfWithLong_((jlong) [toLong charValue]), " + "JavaLangFloat_valueOfWithFloat_((jfloat) [toFlt charValue]), JavaLangDouble_valueOfWithDouble_" + "((jdouble) [toDbl charValue]) } count:5 type:NSObject_class_()];"); }</code><technical_language>For consistency other tests, indention testCharacterWrapperCastToPrimitive() above</technical_language>

Target:
public void testCharacterUnboxingAutoReboxing() throws IOException { String translation = translateSourceFile( "class Test { " + "void test() { " + "Character toChar = 'A', toInt = 'A', toLong = 'A', toFlt = 'A', toDbl = 'A'; " + "Object[] arr = " + "{(char) toChar, (int) toInt, (long) toLong, (float) toFlt, (double) toDbl}; } }", "Test", "Test.m"); assertTranslation( translation, "IOSObjectArray *arr = [IOSObjectArray arrayWithObjects:(id[]){ " + "JavaLangCharacter_valueOfWithChar_([toChar charValue]), " + "JavaLangInteger_valueOfWithInt_((jint) [toInt charValue]), " + "JavaLangLong_valueOfWithLong_((jlong) [toLong charValue]), " + "JavaLangFloat_valueOfWithFloat_((jfloat) [toFlt charValue])," + " JavaLangDouble_valueOfWithDouble_((jdouble) [toDbl charValue]) }" + " count:5 type:NSObject_class_()];"); }
Source:
<code>private static Label createErrorLabel(Composite parent) { final Label label = new Label(parent, SWT.WRAP); Color color = new Color(parent.getDisplay(), 0xe7, 0x4c, 0x3c); label.setForeground(color); final FontDescriptor fd = FontDescriptor.createFrom(parent.getFont()); fd.setHeight(9); Font font = fd.createFont(parent.getDisplay()); label.setFont(font); label.addDisposeListener(e -> { color.dispose(); <START> font.dispose(); <END> }); return label; }</code><technical_language>I sorry, I induced in error. this font created a font descriptor created original font modification, createFont() returns original font, system font. disposing system font result is pretty... :(</technical_language>

Target:
private static Label createErrorLabel(Composite parent) { final Label label = new Label(parent, SWT.WRAP); Color color = new Color(parent.getDisplay(), 0xe7, 0x4c, 0x3c); label.setForeground(color); final FontDescriptor fd = FontDescriptor.createFrom(parent.getFont()); fd.setHeight(9); Font font = fd.createFont(parent.getDisplay()); label.setFont(font); label.addDisposeListener(e -> { color.dispose(); fd.destroyFont(font); }); return label; }
Source:
<code>public boolean configure(FeatureContext context) { if(context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT) return false; Dispatcher dispatcher = ResteasyProviderFactory.getContextData(Dispatcher.class); if(dispatcher == null) { <START> System.err.println("Creating new context for "+context.getConfiguration().getRuntimeType()+" deployment because it looks like we're in a special thread"); <END> return false; } dispatcher.getDefaultContextObjects().put(Context.class, new Context()); return true; }</code><technical_language>This i18n log</technical_language>

Target:
public boolean configure(FeatureContext context) { if(context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT) return false; Dispatcher dispatcher = ResteasyProviderFactory.getContextData(Dispatcher.class); if(dispatcher == null) { return false; } dispatcher.getDefaultContextObjects().put(Context.class, new Context()); return true; }
Source:
<code>void set(CommentLinkProcessor commentLinkProcessor, ChangeInfo change, String revision) { RevisionInfo revInfo = change.revision(revision); CommitInfo commit = revInfo.commit(); String sub = commit.subject(); String msg = commit.message(); if (msg.startsWith(sub)) { msg = msg.substring(sub.length()); if (msg.length() > 0 && msg.charAt(0) == '\n') { msg = msg.substring(1); } } commitName.setText(revision); <START> commitName.setPreviewText(revision); <END> idText.setText("Change-Id: " + change.change_id()); idText.setPreviewText(change.change_id()); formatLink(commit.author(), authorNameEmail, authorDate, change.status()); formatLink(commit.committer(), committerNameEmail, committerDate, change.status()); text.setHTML(commentLinkProcessor.apply( new SafeHtmlBuilder().append(msg).linkify())); GitwebLink gw = Gerrit.getGitwebLink(); if (gw != null && gw.canLink(revInfo)) { browserLink.setInnerText(gw.getLinkName()); browserLink.setHref(gw.toRevision(change.project(), revision)); } else { UIObject.setVisible(browserLink, false); } }</code><technical_language>Unnecessary string is same</technical_language>

Target:
void set(CommentLinkProcessor commentLinkProcessor, ChangeInfo change, String revision) { RevisionInfo revInfo = change.revision(revision); CommitInfo commit = revInfo.commit(); String sub = commit.subject(); String msg = commit.message(); if (msg.startsWith(sub)) { msg = msg.substring(sub.length()); if (msg.length() > 0 && msg.charAt(0) == '\n') { msg = msg.substring(1); } } commitName.setText(revision); idText.setText("Change-Id: " + change.change_id()); idText.setPreviewText(change.change_id()); formatLink(commit.author(), authorNameEmail, authorDate, change.status()); formatLink(commit.committer(), committerNameEmail, committerDate, change.status()); text.setHTML(commentLinkProcessor.apply( new SafeHtmlBuilder().append(msg).linkify())); GitwebLink gw = Gerrit.getGitwebLink(); if (gw != null && gw.canLink(revInfo)) { browserLink.setInnerText(gw.getLinkName()); browserLink.setHref(gw.toRevision(change.project(), revision)); } else { UIObject.setVisible(browserLink, false); } }
Source:
<code>static void validateMultiPageDataLabeled(List<RecognizedForm> actualRecognizedFormsList) { actualRecognizedFormsList.forEach(recognizedForm -> { assertEquals(1, recognizedForm.getPageRange().getFirstPageNumber()); assertEquals(3, recognizedForm.getPageRange().getLastPageNumber()); assertEquals(3, recognizedForm.getPages().size()); recognizedForm.getFields().forEach((label, formField) -> { assertNotNull(formField.getName()); assertNotNull(formField.getValue()); <START> assertNotNull(formField.getValueData().getText()); <END> }); }); }</code><technical_language>this removed</technical_language>

Target:
static void validateMultiPageDataLabeled(List<RecognizedForm> actualRecognizedFormsList) { actualRecognizedFormsList.forEach(recognizedForm -> { assertEquals(1, recognizedForm.getPageRange().getFirstPageNumber()); assertEquals(3, recognizedForm.getPageRange().getLastPageNumber()); assertEquals(3, recognizedForm.getPages().size()); recognizedForm.getFields().forEach((label, formField) -> { assertNotNull(formField.getName()); assertNotNull(formField.getValue()); assertNotNull(formField.getValueData().getText()); assertNull(formField.getLabelData()); }); }); }
Source:
<code>private void setConstructors() { constructor = generatedClass.constructor(PRIVATE); JVar constructorContextParam = constructor.param(getClasses().CONTEXT, "context"); JBlock constructorBody = constructor.body(); List<ExecutableElement> constructors = ElementFilter.constructorsIn(annotatedElement.getEnclosedElements()); ExecutableElement superConstructor = constructors.get(0); if (superConstructor.getParameters().size() == 1) { constructorBody.invoke("super").arg(constructorContextParam); } constructorBody.assign(getContextField(), constructorContextParam); overloadedConstructor = generatedClass.constructor(PRIVATE); JVar overloadedConstructorContextParam = overloadedConstructor.param(getClasses().CONTEXT, "context"); JVar overloadedConstructorRootFragmentParam = overloadedConstructor.param(getClasses().OBJECT, "rootFragment"); JBlock overloadedConstructorBody = overloadedConstructor.body(); if (superConstructor.getParameters().size() == 1) { overloadedConstructorBody.invoke("super").arg(constructorContextParam); } <START> overloadedConstructorBody.assign(getContextField(), overloadedConstructorContextParam); <END> overloadedConstructorBody.assign(getRootFragmentField(), overloadedConstructorRootFragmentParam); }</code><technical_language>Travis fails of this i think. write: java overloadedConstructorBody.add(JExpr.invokeSuper().arg(constructorContextParam));</technical_language>

Target:
private void setConstructors() { constructor = generatedClass.constructor(PRIVATE); JVar constructorContextParam = constructor.param(getClasses().CONTEXT, "context"); JBlock constructorBody = constructor.body(); List<ExecutableElement> constructors = ElementFilter.constructorsIn(annotatedElement.getEnclosedElements()); ExecutableElement superConstructor = constructors.get(0); if (superConstructor.getParameters().size() == 1) { constructorBody.add(JExpr.invokeSuper().arg(constructorContextParam)); } constructorBody.assign(getContextField(), constructorContextParam); overloadedConstructor = generatedClass.constructor(PRIVATE); JVar overloadedConstructorContextParam = overloadedConstructor.param(getClasses().CONTEXT, "context"); JVar overloadedConstructorRootFragmentParam = overloadedConstructor.param(getClasses().OBJECT, "rootFragment"); JBlock overloadedConstructorBody = overloadedConstructor.body(); if (superConstructor.getParameters().size() == 1) { overloadedConstructorBody.add(JExpr.invokeSuper().arg(constructorContextParam)); } overloadedConstructorBody.assign(getContextField(), overloadedConstructorContextParam); overloadedConstructorBody.assign(getRootFragmentField(), overloadedConstructorRootFragmentParam); }
Source:
<code>public void setPassword(String thisPassword) { logger.trace("setPassword({}) called.",thisPassword); request.params.password = thisPassword; <START> return; <END> }</code><technical_language>Remove this line</technical_language>

Target:
public void setPassword(String thisPassword) { logger.trace("setPassword({}) called.", thisPassword); request.params.password = thisPassword; }
Source:
<code>public final Response delete(@Context final HttpServletRequest request, @PathParam("schemeId") final String schemeId) { final InitDataObject initDataObject = this.webResource.init(null, true, request, true, null); Logger.debug(this, "Deleting scheme with id: " + schemeId); Response response = null; try { this.workflowHelper.delete(schemeId, initDataObject.getUser()); response = Response.ok(new ResponseEntityView(OK)).build(); } catch ( DoesNotExistException e) { Logger.error(this.getClass(), "Exception attempting to delete a nonexistent schema identified by : " +schemeId + ", exception message: " + e.getMessage(), e); <START> response = ExceptionMapperUtil.createResponse(e, Response.Status.BAD_REQUEST); <END> } catch (Exception e) { Logger.error(this.getClass(), "Exception attempting to delete schema identified by : " +schemeId + ", exception message: " + e.getMessage(), e); response = (e.getCause() instanceof SecurityException)? this.createUnAuthorizedResponse(e) : ExceptionMapperUtil.createResponse(e, Response.Status.INTERNAL_SERVER_ERROR); } return response; }</code><technical_language>I need send a Response.Status.NOT_FOUND instead of a Response.Status.BAD_REQUEST</technical_language>

Target:
public final Response delete(@Context final HttpServletRequest request, @PathParam("schemeId") final String schemeId) { final InitDataObject initDataObject = this.webResource.init(null, true, request, true, null); Logger.debug(this, "Deleting scheme with id: " + schemeId); Response response = null; try { this.workflowHelper.delete(schemeId, initDataObject.getUser()); response = Response.ok(new ResponseEntityView(OK)).build(); } catch ( DoesNotExistException e) { Logger.error(this.getClass(), "Exception attempting to delete a nonexistent schema identified by : " +schemeId + ", exception message: " + e.getMessage(), e); response = ExceptionMapperUtil.createResponse(e, Response.Status.NOT_FOUND); } catch (Exception e) { Logger.error(this.getClass(), "Exception attempting to delete schema identified by : " +schemeId + ", exception message: " + e.getMessage(), e); response = (e.getCause() instanceof SecurityException)? this.createUnAuthorizedResponse(e) : ExceptionMapperUtil.createResponse(e, Response.Status.INTERNAL_SERVER_ERROR); } return response; }
Source:
<code>private static void stopServer(final ClientContext context, final boolean tabletServersToo) throws AccumuloException, AccumuloSecurityException { <START> MasterClient.executeVoidWithConnRetry(context, <END> client -> client.shutdown(Tracer.traceInfo(), context.rpcCreds(), tabletServersToo)); }</code><technical_language>Is this place in code is timing out now? I wondering this method a name, executeVoidWithTimeout(). If I this code, clear this call timeout</technical_language>

Target:
private static void stopServer(final ClientContext context, final boolean tabletServersToo) throws AccumuloException, AccumuloSecurityException { MasterClient.executeVoidAdmin(context, new ClientExec<MasterClientService.Client>() { @Override public void execute(MasterClientService.Client client) throws Exception { client.shutdown(Tracer.traceInfo(), context.rpcCreds(), tabletServersToo); } }); }
Source:
<code>public static Datum createFromBytes(DataType dataType, byte[] bytes) { switch (dataType.getType()) { case BOOLEAN: return createBool(bytes[0]); case INT2: return createInt2(NumberUtil.toShort(bytes)); case INT4: return createInt4(NumberUtil.toInt(bytes)); case INT8: return createInt8(NumberUtil.toLong(bytes)); case FLOAT4: return createFloat4(NumberUtil.toFloat(bytes)); case FLOAT8: return createFloat8(NumberUtil.toDouble(bytes)); case CHAR: return createChar(bytes); case TEXT: return createText(bytes); case DATE: return new DateDatum(NumberUtil.toInt(bytes)); case TIME: return new TimeDatum(NumberUtil.toLong(bytes)); case TIMESTAMP: return new TimestampDatum(NumberUtil.toLong(bytes)); case BIT: return createBit(bytes[0]); case BLOB: return createBlob(bytes); case INET4: return createInet4(bytes); case PROTOBUF: try { return ProtobufDatumFactory.createDatum(dataType, bytes); } catch (IOException e) { e.printStackTrace(); throw new RuntimeException(e); } default: <START> throw new UnsupportedOperationException(dataType.toString()); <END> } }</code><technical_language>this line is included in changes, UnsupportedException wrapped TajoRuntimeException. need a ErrorMessage.java in order error message for UnsupportedException</technical_language>

Target:
public static Datum createFromBytes(DataType dataType, byte[] bytes) { switch (dataType.getType()) { case BOOLEAN: return createBool(bytes[0]); case INT2: return createInt2(NumberUtil.toShort(bytes)); case INT4: return createInt4(NumberUtil.toInt(bytes)); case INT8: return createInt8(NumberUtil.toLong(bytes)); case FLOAT4: return createFloat4(NumberUtil.toFloat(bytes)); case FLOAT8: return createFloat8(NumberUtil.toDouble(bytes)); case CHAR: return createChar(bytes); case TEXT: return createText(bytes); case DATE: return new DateDatum(NumberUtil.toInt(bytes)); case TIME: return new TimeDatum(NumberUtil.toLong(bytes)); case TIMESTAMP: return new TimestampDatum(NumberUtil.toLong(bytes)); case BIT: return createBit(bytes[0]); case BLOB: return createBlob(bytes); case INET4: return createInet4(bytes); case PROTOBUF: try { return ProtobufDatumFactory.createDatum(dataType, bytes); } catch (IOException e) { throw new TajoInternalError(e); } default: throw new TajoRuntimeException(new UnsupportedDataTypeException(dataType.toString())); } }
Source:
<code>public static Iterable<? extends Object> data() { <START> return EnumSet.allOf(TestPlatform.class); <END> }</code><technical_language>java public static Object[] data() { return TestPlatform.values(); }</technical_language>

Target:
public static Object[] data() { return TestPlatform.values(); }
Source:
<code>public ConfigParamPreprocessor() { fieldCache = new ClassAttributeCache.FieldCache(); <START> } <END></code><technical_language>class is lying unused in FieldCache. remove there</technical_language>

Target:
public ConfigParamPreprocessor() { this.resolver = new ParamResolver(new ParamSubstitutionHandlerFactory(new ParamsConfig()), new ClassAttributeCache.FieldCache()); }
Source:
<code>default <B> BiConstraintStream<A, B> join(Class<B> otherClass, BiJoiner<A, B>... joiners) { int joinerCount = joiners.length; int indexOfFirstFilter = -1; for (int i = 0; i < joinerCount; i++) { BiJoiner<A, B> joiner = joiners[i]; boolean hasAFilter = indexOfFirstFilter >= 0; if (joiner instanceof FilteringBiJoiner) { if (!hasAFilter) { indexOfFirstFilter = i; } } else if (hasAFilter) { throw new IllegalStateException("Indexing joiner (" + joiner + ") must not follow a filtering joiner (" + joiners[indexOfFirstFilter] + ")."); } } <START> if (indexOfFirstFilter < 0) { END> return join(otherClass, AbstractBiJoiner.merge(joiners)); } BiConstraintStream<A, B> joined = indexOfFirstFilter == 0 ? join(otherClass) : join(otherClass, Arrays.copyOf(joiners, indexOfFirstFilter)); BiPredicate<A, B> resultingFilter = (a, b) -> true; for (int i = indexOfFirstFilter; i < joinerCount; i++) { FilteringBiJoiner<A, B> filteringJoiner = (FilteringBiJoiner<A, B>) joiners[i]; resultingFilter = resultingFilter.and(filteringJoiner.getFilter()); } return joined.filter(resultingFilter); }</code><technical_language>"Only indexing joiners." is a sentence, end "."</technical_language>

Target:
default <B> BiConstraintStream<A, B> join(Class<B> otherClass, BiJoiner<A, B>... joiners) { int joinerCount = joiners.length; int indexOfFirstFilter = -1; for (int i = 0; i < joinerCount; i++) { BiJoiner<A, B> joiner = joiners[i]; if (indexOfFirstFilter >= 0) { if (!(joiner instanceof FilteringBiJoiner)) { throw new IllegalStateException("Indexing joiner (" + joiner + ") must not follow " + "a filtering joiner (" + joiners[indexOfFirstFilter] + ").\n" + "Maybe reorder the joiners such that filtering() joiners are later in the parameter list."); } } else { if (joiner instanceof FilteringBiJoiner) { indexOfFirstFilter = i; } } } if (indexOfFirstFilter < 0) { return join(otherClass, AbstractBiJoiner.merge(joiners)); } BiConstraintStream<A, B> joined = indexOfFirstFilter == 0 ? join(otherClass) : join(otherClass, Arrays.copyOf(joiners, indexOfFirstFilter)); int filterCount = joinerCount - indexOfFirstFilter; if (filterCount == 0) { return joined; } FilteringBiJoiner<A, B> filteringJoiner = (FilteringBiJoiner<A, B>) joiners[indexOfFirstFilter]; BiPredicate<A, B> resultingFilter = filteringJoiner.getFilter(); for (int i = indexOfFirstFilter + 1; i < joinerCount; i++) { FilteringBiJoiner<A, B> anoterFilteringJoiner = (FilteringBiJoiner<A, B>) joiners[i]; resultingFilter = resultingFilter.and(anoterFilteringJoiner.getFilter()); } return joined.filter(resultingFilter); }
Source:
<code>public void saveContent(final String pageId, final List<PageContainerForm.ContainerEntry> containerEntries) throws DotDataException { <START> final List<MultiTree> multiTres = new ArrayList<>(); <END> for (final PageContainerForm.ContainerEntry containerEntry : containerEntries) { int i = 0; final List<String> contentIds = containerEntry.getContentIds(); for (String contentletId : contentIds) { final MultiTree mt = new MultiTree().setContainer(containerEntry.getContainerId()) .setContentlet(contentletId) .setRelationType(containerEntry.getContainerUUID()) .setTreeOrder(i) .setHtmlPage(pageId); multiTres.add(mt); i++; } } multiTreeAPI.saveMultiTrees(pageId, multiTres); }</code><technical_language>ImmutableList</technical_language>

Target:
public void saveContent(final String pageId, final List<PageContainerForm.ContainerEntry> containerEntries) throws DotDataException { final List<MultiTree> multiTres = new ArrayList<>(); for (final PageContainerForm.ContainerEntry containerEntry : containerEntries) { int i = 0; final List<String> contentIds = containerEntry.getContentIds(); for (final String contentletId : contentIds) { final MultiTree multiTree = new MultiTree().setContainer(containerEntry.getContainerId()) .setContentlet(contentletId) .setRelationType(containerEntry.getContainerUUID()) .setTreeOrder(i++) .setHtmlPage(pageId); multiTres.add(multiTree); } } multiTreeAPI.saveMultiTrees(pageId, multiTres); }
Source:
<code>protected boolean set(ItemStack container, Boolean value) { if (!container.hasTagCompound()) { container.setTagCompound(new NBTTagCompound()); } if (container.getTagCompound().hasKey(NbtDataUtil.ITEM_HIDE_FLAGS, NbtDataUtil.TAG_INT)) { int flag = container.getTagCompound().getInteger(NbtDataUtil.ITEM_HIDE_FLAGS); <START> if (value && flag + 1 <= 63) { <END> container.getTagCompound() .setInteger(NbtDataUtil.ITEM_HIDE_FLAGS, flag + 1); } else if (!value && flag - 1 >= 0) { container.getTagCompound() .setInteger(NbtDataUtil.ITEM_HIDE_FLAGS, flag - 1); } } else { if (value) { container.getTagCompound().setInteger(NbtDataUtil.ITEM_HIDE_FLAGS, 1); } } return true; }</code><technical_language>This correct. setting solely based passed in - this causing toggle if I repeatedly offer true</technical_language>

Target:
protected boolean set(ItemStack container, Boolean value) { if (!container.hasTagCompound()) { container.setTagCompound(new NBTTagCompound()); } if (container.getTagCompound().hasKey(NbtDataUtil.ITEM_HIDE_FLAGS, NbtDataUtil.TAG_INT)) { int flag = container.getTagCompound().getInteger(NbtDataUtil.ITEM_HIDE_FLAGS); if (value) { container.getTagCompound() .setInteger(NbtDataUtil.ITEM_HIDE_FLAGS, flag | DataConstants.HIDE_ENCHANTMENTS_FLAG); } else { container.getTagCompound() .setInteger(NbtDataUtil.ITEM_HIDE_FLAGS, flag - DataConstants.HIDE_ENCHANTMENTS_FLAG >= 0 ? flag - DataConstants.HIDE_ENCHANTMENTS_FLAG : 0); } } else { if (value) { container.getTagCompound().setInteger(NbtDataUtil.ITEM_HIDE_FLAGS, DataConstants.HIDE_ENCHANTMENTS_FLAG); } } return true; }
Source:
<code>public static Leader create(String leader, Map<String, Follower> followers) { <START> return new AutoValue_Leader(leader, followers); <END> }</code><technical_language>map immutable ImmutableMap.copyOf</technical_language>

Target:
public static Leader create(String leader, Map<String, Follower> followers) { return new AutoValue_Leader(leader, ImmutableMap.copyOf(followers)); }
Source:
<code>public AnnotationRepositoryConfigurationSource(AnnotationMetadata metadata, Class<? extends Annotation> annotation, ResourceLoader resourceLoader, Environment environment) { super(environment); Assert.notNull(metadata, "Metadata must not be null!"); Assert.notNull(annotation, "Annotation must not be null!"); Assert.notNull(resourceLoader, "ResourceLoader must not be null!"); this.attributes = new AnnotationAttributes(metadata.getAnnotationAttributes(annotation.getName())); this.enableAnnotationMetadata = new StandardAnnotationMetadata(annotation); this.configMetadata = metadata; this.resourceLoader = resourceLoader; this.hasExplicitFilters = hasExplicitFilters(attributes); <START> beanNameGenerator = new RepositoryBeanNameGenerator(resourceLoader.getClassLoader()); <END> }</code><technical_language>Qualify this.</technical_language>

Target:
public AnnotationRepositoryConfigurationSource(AnnotationMetadata metadata, Class<? extends Annotation> annotation, ResourceLoader resourceLoader, Environment environment) { super(environment, resourceLoader.getClassLoader()); Assert.notNull(metadata, "Metadata must not be null!"); Assert.notNull(annotation, "Annotation must not be null!"); Assert.notNull(resourceLoader, "ResourceLoader must not be null!"); this.attributes = new AnnotationAttributes(metadata.getAnnotationAttributes(annotation.getName())); this.enableAnnotationMetadata = new StandardAnnotationMetadata(annotation); this.configMetadata = metadata; this.resourceLoader = resourceLoader; this.hasExplicitFilters = hasExplicitFilters(attributes); }
Source:
<code>public Secret getPassword() { if (Util.fixEmpty(apiUri) == null) { apiUri = "<LINK_0>"; } long now = System.currentTimeMillis(); String appInstallationToken; <START> if (cachedToken != null && now - tokenCacheTime < JwtHelper.VALIDITY_MS / 2) { <END> appInstallationToken = cachedToken; } else { appInstallationToken = generateAppInstallationToken(appID, privateKey.getPlainText(), apiUri); cachedToken = appInstallationToken; tokenCacheTime = now; } return Secret.fromString(appInstallationToken); }</code><technical_language>is this valid for 4 minutes</technical_language>

Target:
public Secret getPassword() { if (Util.fixEmpty(apiUri) == null) { apiUri = "<LINK_0>"; } long now = System.currentTimeMillis(); String appInstallationToken; if (cachedToken != null && now - tokenCacheTime < JwtHelper.VALIDITY_MS / 2) { appInstallationToken = cachedToken; } else { appInstallationToken = generateAppInstallationToken(appID, privateKey.getPlainText(), apiUri, owner); cachedToken = appInstallationToken; tokenCacheTime = now; } return Secret.fromString(appInstallationToken); }
Source:
<code>protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException { final ItemStack stack; try { stack = sign.getLine(1).equals("*") || sign.getLine(1).equalsIgnoreCase("any") ? null : getItemStack(sign.getLine(1), 1, ess); } catch (SignException e) { sign.setLine(1, "§c<item|any>"); throw e; } final String[] enchantLevel = sign.getLine(2).split(":"); int level = 1; final Enchantment enchantment = Enchantments.getByName(enchantLevel[0]); if (enchantment == null) { sign.setLine(2, "§c<enchant>"); throw new SignException(tl("enchantmentNotFound")); } <START> if (enchantLevel.length == 2) { <END> try { level = Integer.parseInt(enchantLevel[1]); } catch (NumberFormatException ex) { sign.setLine(2, "§c<enchant>"); throw new SignException(ex.getMessage(), ex); } } final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && player.isAuthorized("essentials.enchantments.allowunsafe") && player.isAuthorized("essentials.signs.enchant.allowunsafe"); if (level < 0 || (!allowUnsafe && level > enchantment.getMaxLevel())) { level = enchantment.getMaxLevel(); sign.setLine(2, enchantLevel[0] + ":" + level); } try { if (stack != null) { if (allowUnsafe) { stack.addUnsafeEnchantment(enchantment, level); } else { stack.addEnchantment(enchantment, level); } } } catch (Throwable ex) { throw new SignException(ex.getMessage(), ex); } getTrade(sign, 3, ess); return true; }</code><technical_language>This logic opens a weird validation corner case matter complain about.... enchant:level:somejunk is valid, if level > 1, level 1. This a validation error</technical_language>

Target:
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException { final ItemStack stack; try { stack = sign.getLine(1).equals("*") || sign.getLine(1).equalsIgnoreCase("any") ? null : getItemStack(sign.getLine(1), 1, ess); } catch (SignException e) { sign.setLine(1, "§c<item|any>"); throw e; } final String[] enchantLevel = sign.getLine(2).split(":"); int level = 1; final Enchantment enchantment = Enchantments.getByName(enchantLevel[0]); if (enchantment == null) { sign.setLine(2, "§c<enchant>"); throw new SignException(tl("enchantmentNotFound")); } if (enchantLevel.length > 1) { try { level = Integer.parseInt(enchantLevel[1]); } catch (NumberFormatException ex) { sign.setLine(2, "§c<enchant>"); throw new SignException(ex.getMessage(), ex); } } final boolean allowUnsafe = ess.getSettings().allowUnsafeEnchantments() && player.isAuthorized("essentials.enchantments.allowunsafe") && player.isAuthorized("essentials.signs.enchant.allowunsafe"); if (level < 0 || (!allowUnsafe && level > enchantment.getMaxLevel())) { level = enchantment.getMaxLevel(); sign.setLine(2, enchantLevel[0] + ":" + level); } try { if (stack != null) { if (allowUnsafe) { stack.addUnsafeEnchantment(enchantment, level); } else { stack.addEnchantment(enchantment, level); } } } catch (Throwable ex) { throw new SignException(ex.getMessage(), ex); } getTrade(sign, 3, ess); return true; }
Source:
<code>private static String getErrorMessage(String propertyFileName, String propertyName) { <START> return "Could not find the property: " + propertyName + " in the file:" + propertyFileName; <END> }</code><technical_language>messageFormat instead of string-concatination? String result = MessageFormat.format( "At {1,time} {1,date}, {2} planet {0,number,integer}.", planet, new Date(), event);</technical_language>

Target:
private static String getErrorMessage(String propertyFileName, String propertyName) { return MessageFormat.format("Could not find the property: {0} in the file: {1}", propertyName, propertyFileName); }
Source:
<code>public Response deleteDataSource( @PathParam("dataSourceName") final String dataSourceName, @QueryParam("kill") final String kill, @QueryParam("interval") final String interval ) { if (indexingServiceClient == null) { return Response.ok(ImmutableMap.of("error", "no indexing service found")).build(); } if (kill != null && Boolean.valueOf(kill)) { try { indexingServiceClient.killSegments(dataSourceName, new Interval(interval)); } catch (IllegalArgumentException e) { return Response.serverError().entity( ImmutableMap.of( "error", "Exception occurred. Probably the interval is invalid", "Error-Message", <START> e <END> ) ) .build(); } catch (Exception e) { return Response.serverError().entity( ImmutableMap.of( "error", "Exception occurred. Are you sure you have an indexing service?", "Error-Message", e ) ) .build(); } } else { if (!databaseSegmentManager.removeDatasource(dataSourceName)) { return Response.noContent().build(); } } return Response.ok().build(); }</code><technical_language>this is "message":e.getMessage()</technical_language>

Target:
public Response deleteDataSource( @PathParam("dataSourceName") final String dataSourceName, @QueryParam("kill") final String kill, @QueryParam("interval") final String interval ) { if (indexingServiceClient == null) { return Response.ok(ImmutableMap.of("error", "no indexing service found")).build(); } if (kill != null && Boolean.valueOf(kill)) { try { indexingServiceClient.killSegments(dataSourceName, new Interval(interval)); } catch (IllegalArgumentException e) { return Response.status(Response.Status.BAD_REQUEST) .entity( ImmutableMap.of( "error", "Exception occurred. Probably the interval is invalid", "message", e.toString() ) ) .build(); } catch (Exception e) { return Response.serverError().entity( ImmutableMap.of( "error", "Exception occurred. Are you sure you have an indexing service?", "message", e.toString() ) ) .build(); } } else { if (!databaseSegmentManager.removeDatasource(dataSourceName)) { return Response.noContent().build(); } } return Response.ok().build(); }
Source:
<code>public BasicInvocationStage visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { if (streamSummaryContainer.isEnabled() && ctx.isOriginLocal()) { for (Object key : command.getKeys()) { <START> streamSummaryContainer.addGet(key, false); <END> } } return invokeNext(ctx, command); }</code><technical_language>isRemote(command.getKey()) instead of false</technical_language>

Target:
public BasicInvocationStage visitGetAllCommand(InvocationContext ctx, GetAllCommand command) throws Throwable { if (streamSummaryContainer.isEnabled() && ctx.isOriginLocal()) { for (Object key : command.getKeys()) { streamSummaryContainer.addGet(key, isRemote(key)); } } return invokeNext(ctx, command); }
Source:
<code>public static CommentInput create(CommentInfo original) { CommentInput input = createObject().cast(); input.setId(original.id()); input.setPath(original.path()); input.setSide(original.side()); <START> input.setLine(original.line()); <END> input.setInReplyTo(original.in_reply_to()); input.setMessage(original.message()); return input; }</code><technical_language>if original a line, do want set line</technical_language>

Target:
public static CommentInput create(CommentInfo original) { CommentInput input = createObject().cast(); input.setId(original.id()); input.setPath(original.path()); input.setSide(original.side()); if (original.has_line()) { input.setLine(original.line()); } input.setInReplyTo(original.in_reply_to()); input.setMessage(original.message()); return input; }