auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isSecure() { <START> return secureMode != SecurityMode.NO_SEC || useOscore == true; <END> }</code><technical_language>I this is a bit strange I change this. Historically this if unsecured(coap) endpoint secured(coaps) endpoint. right name is "isCoaps" ? I read code this sense now, more wise touch for now</technical_language>

Target:
public boolean isSecure() { return secureMode != SecurityMode.NO_SEC; }
Source:
<code><START> protected DiagramEventBroker getDiagramEventBroker() { <END> TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); if (theEditingDomain != null) { return DiagramEventBroker.getInstance(theEditingDomain); } return null; }</code><technical_language>Multi return is avoid</technical_language>

Target:
protected DiagramEventBroker getDiagramEventBroker() { DiagramEventBroker eventBroker = null; TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); if (null != editingDomain) { eventBroker = DiagramEventBroker.getInstance(editingDomain); } return eventBroker; }
Source:
<code>Set<SpecificHaxeClassReference> getCompatibleTypes(Compatibility direction) { HaxeClassModel model = getHaxeClassModel(); boolean skipCachingForDebug = HaxeDebugUtil.isCachingDisabled(); <START> if(false) { <END> Set<SpecificHaxeClassReference> result = context.getUserData(COMPATIBLE_TYPES_KEY); if (result == null) { processedElements.get().clear(); result = getCompatibleTypesInternal(direction); result.add(this); context.putUserData(COMPATIBLE_TYPES_KEY, result); } return result; } else { processedElements.get().clear(); Set<SpecificHaxeClassReference>result = getCompatibleTypesInternal(direction); result.add(this); return result; } }</code><technical_language>Pull this change out. a temporary override</technical_language>

Target:
Set<SpecificHaxeClassReference> getCompatibleTypes(Compatibility direction) { HaxeClassModel model = getHaxeClassModel(); boolean skipCachingForDebug = HaxeDebugUtil.isCachingDisabled(); if (!skipCachingForDebug && (null == model || !model.hasGenericParams())) { Set<SpecificHaxeClassReference> result = context.getUserData(COMPATIBLE_TYPES_KEY); if (result == null) { processedElements.get().clear(); result = getCompatibleTypesInternal(direction); result.add(this); context.putUserData(COMPATIBLE_TYPES_KEY, result); } return result; } else { processedElements.get().clear(); Set<SpecificHaxeClassReference>result = getCompatibleTypesInternal(direction); result.add(this); return result; } }
Source:
<code>public void doSomething() throws WqpException { try { int div = 1/ 0; <START> if (div == 0) return; <END> } catch (Exception e) { throw new WqpException(WqpExceptionId.URL_PARSING_EXCEPTION, Klass.class, "doSomething", "div by zero"); } }</code><technical_language>div 0 if exception throw, test fail there. remove line #13... needed</technical_language>

Target:
public void doSomething() throws WqpException { try { int div = 1/ 0; } catch (Exception e) { throw new WqpException(WqpExceptionId.URL_PARSING_EXCEPTION, Klass.class, "doSomething", "div by zero"); } }
Source:
<code>public void start() { bootstrap = new ClientBootstrap( new NioClientSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool()) ); bootstrap.setPipelineFactory(new TimberClientPipelineFactory(this, bootstrap)); bootstrap.setOption("tcpNoDelay", true); bootstrap.setOption("remoteAddress", new InetSocketAddress(host, port)); log.info("Client connecting to " + host + ":" + port + "..."); <START> ChannelFuture connectFuture = bootstrap.connect().awaitUninterruptibly(); <END> log.info("Client connected to " + host + ":" + port); }</code><technical_language>Variable used</technical_language>

Target:
public void start() { bootstrap = new ClientBootstrap( new NioClientSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool()) ); bootstrap.setPipelineFactory(new TimberClientPipelineFactory(this, bootstrap)); bootstrap.setOption("tcpNoDelay", true); bootstrap.setOption("remoteAddress", new InetSocketAddress(host, port)); log.info("Client connecting to " + host + ":" + port + "..."); bootstrap.connect().awaitUninterruptibly(); }
Source:
<code>public void update(boolean force) { final List<MToolBar> children = modelService.findElements(window, null, MToolBar.class, null); for (MToolBar el : children) { ToolBarManagerRenderer renderer = (ToolBarManagerRenderer) rendererFactory.getRenderer( el, null); final ToolBarManager manager = renderer.getManager((MToolBar) el); if (manager != null) { fill(el, manager); <START> manager.update(true); <END> ToolBar tb = manager.getControl(); if (tb != null && !tb.isDisposed()) { tb.getShell().layout(new Control[] { tb }, SWT.DEFER); } } } if (!trimBarsAdded) { topTrim.setToBeRendered(true); trimBarsAdded = true; } }</code><technical_language>needs modified calls manager.update(true) if extra toolItem creating is triggered line 730</technical_language>

Target:
public void update(boolean force) { final List<MToolBar> children = modelService.findElements(window, null, MToolBar.class, null); for (MToolBar el : children) { ToolBarManagerRenderer renderer = (ToolBarManagerRenderer) rendererFactory.getRenderer( el, null); final ToolBarManager manager = renderer.getManager((MToolBar) el); if (manager != null) { fill(el, manager); ToolBar tb = manager.getControl(); if (tb != null && !tb.isDisposed()) { tb.getShell().layout(new Control[] { tb }, SWT.DEFER); } } } if (!trimBarsAdded) { topTrim.setToBeRendered(true); trimBarsAdded = true; } }
Source:
<code>private boolean isDistinct(AggregationNode node) { <START> return !node.getAssignments().isEmpty() || <END> node.getOutputSymbols().size() != node.getGroupingKeys().size() || !node.getOutputSymbols().containsAll(node.getGroupingKeys()); }</code><technical_language>I thought this diff moving Aggregation it</technical_language>

Target:
private boolean isDistinct(AggregationNode node) { return !node.getAggregations().isEmpty() || node.getOutputSymbols().size() != node.getGroupingKeys().size() || !node.getOutputSymbols().containsAll(node.getGroupingKeys()); }
Source:
<code>FacadeObjectImpl.BasicFacadeAdapter<? extends FacadeObjectImpl> createAdapter(T element) { FacadeObjectImpl.BasicFacadeAdapter<? extends FacadeObjectImpl> result = null; FacadeObject facade = null; if (stereotype == NO_STEREOTYPE) { <START> facade = <END> facadeFactory.apply(element); if (facade != null && facade instanceof FacadeObjectImpl) { result = ((FacadeObjectImpl) facade).createFacadeAdapter(); result.addAdapter(element); ((FacadeObjectImpl) facade).init(element, null); } } else { S application = getStereotypeApplication(element); if (application != null) { facade = facadeFactory.apply(element); if (facade != null && facade instanceof FacadeObjectImpl) { result = ((FacadeObjectImpl) facade).createFacadeAdapter(); result.addAdapter(element); ((FacadeObjectImpl) facade).init(element, application); } } } return result; }</code><technical_language>cast FacadeObjectImpl here</technical_language>

Target:
FacadeObjectImpl.BasicFacadeAdapter<? extends FacadeObjectImpl> createAdapter(T element) { FacadeObjectImpl.BasicFacadeAdapter<? extends FacadeObjectImpl> result = null; FacadeObjectImpl facade = null; if (stereotype == NO_STEREOTYPE) { facade = (FacadeObjectImpl) (facadeFactory.apply(element)); if (facade != null) { result = facade.createFacadeAdapter(); result.addAdapter(element); facade.init(element, null); } } else { S application = getStereotypeApplication(element); if (application != null) { facade = (FacadeObjectImpl) facadeFactory.apply(element); if (facade != null) { result = facade.createFacadeAdapter(); result.addAdapter(element); facade.init(element, application); } } } return result; }
Source:
<code>public void addContent(HttpContent httpContent) throws RestServiceException { if (!isOpen()) { nettyMetrics.multipartRequestAlreadyClosedError.inc(); throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } else { rawRequestContents.add(httpContent); <START> ReferenceCountUtil.retain(httpContent); <END> } }</code><technical_language>otherway</technical_language>

Target:
public void addContent(HttpContent httpContent) throws RestServiceException { if (!isOpen()) { nettyMetrics.multipartRequestAlreadyClosedError.inc(); throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } else { rawRequestContents.add(ReferenceCountUtil.retain(httpContent)); } }
Source:
<code>@Test public void connectViaHttpsToUntrustedServer() throws Exception { <START> jdkMatchRule.expectFailure(platform.platformMatcher(PlatformRule.CONSCRYPT_PROPERTY), <END> anything()); server.useHttps(handshakeCertificates.sslSocketFactory(), false); server.enqueue(new MockResponse()); try { getResponse(newRequest("/foo")); fail(); } catch (SSLHandshakeException expected) { assertThat(expected.getCause()).isInstanceOf(CertificateException.class); } assertThat(server.getRequestCount()).isEqualTo(0); }</code><technical_language>I find this syntax perplexing</technical_language>

Target:
@Test public void connectViaHttpsToUntrustedServer() throws Exception { platform.expectFailureOnConscryptPlatform(); server.useHttps(handshakeCertificates.sslSocketFactory(), false); server.enqueue(new MockResponse()); try { getResponse(newRequest("/foo")); fail(); } catch (SSLHandshakeException expected) { assertThat(expected.getCause()).isInstanceOf(CertificateException.class); } assertThat(server.getRequestCount()).isEqualTo(0); }
Source:
<code>public static List<Filter> toFilters(List<DimFilter> dimFilters) { return ImmutableList.copyOf( FunctionalIterable .create(dimFilters) <START> .filter( <END> new Predicate<DimFilter>() { @Override public boolean apply(DimFilter input) { return input != null; } } ).transform( new Function<DimFilter, Filter>() { @Override public Filter apply(DimFilter input) { return input.toFilter(); } } ) ); }</code><technical_language>throw exception instead if a DimFilter null</technical_language>

Target:
public static List<Filter> toFilters(List<DimFilter> dimFilters) { return ImmutableList.copyOf( FunctionalIterable .create(dimFilters) .transform( new Function<DimFilter, Filter>() { @Override public Filter apply(DimFilter input) { return input.toFilter(); } } ) ); }
Source:
<code>private void writeOutUsersDotAttributesFile(File userAttributesFile) { Map<String, Object> json = null; try (InputStream stream = Files.newInputStream(Paths.get(userAttributesFile.toURI()))) { <START> json = <END> GSON.fromJson( new InputStreamReader(stream), new TypeToken<Map<String, Object>>() {}.getType()); } catch (IOException e) { LOGGER.warn("Unable to read system user attribute file for hostname update.", e); return; } addGuestClaimsProfileAttributes(json); if (json.containsKey(oldHostName)) { json.put(System.getProperty(SystemBaseUrl.EXTERNAL_HOST), json.remove(oldHostName)); } for (Map.Entry<String, Object> entry : json.entrySet()) { json.put(entry.getKey(), replaceLocalhost(entry.getValue())); } try { FileUtils.writeStringToFile(userAttributesFile, GSON.toJson(json), Charset.defaultCharset()); } catch (IOException e) { LOGGER.warn("Unable to write user attribute file for system update.", e); } }</code><technical_language>a buffered reader Files instead of a stream</technical_language>

Target:
private void writeOutUsersDotAttributesFile(File userAttributesFile) { Map<String, Object> json = null; try (BufferedReader br = Files.newBufferedReader(Paths.get(userAttributesFile.toURI()))) { json = GSON.fromJson(br, MAP_STRING_TO_OBJECT_TYPE); } catch (IOException e) { LOGGER.warn("Unable to read system user attribute file for hostname update.", e); return; } addGuestClaimsProfileAttributes(json); if (json.containsKey(oldHostName)) { json.put(System.getProperty(SystemBaseUrl.EXTERNAL_HOST), json.remove(oldHostName)); } for (Map.Entry<String, Object> entry : json.entrySet()) { json.put(entry.getKey(), replaceLocalhost(entry.getValue())); } try { FileUtils.writeStringToFile(userAttributesFile, GSON.toJson(json), Charset.defaultCharset()); } catch (IOException e) { LOGGER.warn("Unable to write user attribute file for system update.", e); } }
Source:
<code>public static String resolveName(Object context, String path) { Preconditions.checkNotNull(path, "path must not be null"); <START> if (path==null || path.startsWith("/") || Urls.isUrlWithProtocol(path)) return path; <END> Preconditions.checkNotNull(context, "context must not be null when path is relative"); return packagePath(context)+path; }</code><technical_language>Unnecessary null check for path; trivial; ignoring</technical_language>

Target:
public static String resolveName(Object context, String path) { Preconditions.checkNotNull(path, "path must not be null"); if (path.startsWith("/") || Urls.isUrlWithProtocol(path)) return path; Preconditions.checkNotNull(context, "context must not be null when path is relative"); return packagePath(context)+path; }
Source:
<code>public Optional<Furnace> build(DataView container) throws InvalidDataException { final Optional<Furnace> furnaceOptional = super.build(container); if (!furnaceOptional.isPresent()) { throw new InvalidDataException("The container had insufficient data to create a Furnace tile entity!"); } final Furnace furnace = furnaceOptional.get(); final TileEntityFurnace tileEntityFurnace = (TileEntityFurnace) furnace; final DataQuery burnTime = new DataQuery("BurnTime"); final DataQuery burnTimeTotal = new DataQuery("BurnTimeTotal"); final DataQuery cookTime = new DataQuery("CookTime"); final DataQuery cookTimeTotal = new DataQuery("cookTimeTotal"); final DataQuery customName = new DataQuery("CustomName"); if (container.contains(customName)) { tileEntityFurnace.setCustomInventoryName(container.getString(customName).get()); } if (!container.contains(burnTime) || !container.contains(burnTimeTotal) || !container.contains(cookTime) || !container.contains(cookTimeTotal)) { throw new InvalidDataException("The provided container does not contain the data to make a Furnace!"); } tileEntityFurnace.setField(0, container.getInt(burnTime).get() - container.getInt(burnTime).get()); tileEntityFurnace.setField(1, container.getInt(burnTimeTotal).get()); tileEntityFurnace.setField(2, container.getInt(cookTime).get()); tileEntityFurnace.setField(3, container.getInt(cookTimeTotal).get()); <START> tileEntityFurnace.validate(); <END> return Optional.of(furnace); }</code><technical_language>This invalidate instead</technical_language>

Target:
public Optional<Furnace> build(DataView container) throws InvalidDataException { final Optional<Furnace> furnaceOptional = super.build(container); if (!furnaceOptional.isPresent()) { throw new InvalidDataException("The container had insufficient data to create a Furnace tile entity!"); } final Furnace furnace = furnaceOptional.get(); final TileEntityFurnace tileEntityFurnace = (TileEntityFurnace) furnace; final DataQuery burnTime = new DataQuery("BurnTime"); final DataQuery burnTimeTotal = new DataQuery("BurnTimeTotal"); final DataQuery cookTime = new DataQuery("CookTime"); final DataQuery cookTimeTotal = new DataQuery("CookTimeTotal"); final DataQuery customName = new DataQuery("CustomName"); if (container.contains(customName)) { tileEntityFurnace.setCustomInventoryName(container.getString(customName).get()); } if (!container.contains(burnTime) || !container.contains(burnTimeTotal) || !container.contains(cookTime) || !container.contains(cookTimeTotal)) { throw new InvalidDataException("The provided container does not contain the data to make a Furnace!"); } tileEntityFurnace.setField(0, container.getInt(burnTime).get()); tileEntityFurnace.setField(1, container.getInt(burnTimeTotal).get()); tileEntityFurnace.setField(2, container.getInt(cookTime).get()); tileEntityFurnace.setField(3, container.getInt(cookTimeTotal).get()); tileEntityFurnace.markDirty(); return Optional.of(furnace); }
Source:
<code>protected void parseCurrencyPairs(int requestId, String responseString, List<CurrencyPairInfo> pairs) throws Exception { final JSONArray resultJsonArray = new JSONArray(responseString); for(int i=0; i<resultJsonArray.length(); ++i) { final JSONObject marketJsonObject = resultJsonArray.getJSONObject(i); final String symbol = marketJsonObject.getString("symbol"); for (String base : BASE_CURRENCIES) { if (symbol.endsWith(base)) { pairs.add(new CurrencyPairInfo( symbol.substring(0, symbol.lastIndexOf(base)), base, <START> null)); <END> } } } }</code><technical_language>symbol pairId instead of null</technical_language>

Target:
protected void parseCurrencyPairs(int requestId, String responseString, List<CurrencyPairInfo> pairs) throws Exception { final JSONArray resultJsonArray = new JSONArray(responseString); for(int i=0; i<resultJsonArray.length(); ++i) { final JSONObject marketJsonObject = resultJsonArray.getJSONObject(i); final String symbol = marketJsonObject.getString("symbol"); for (String counter : COUNTER_CURRENCIES) { if (symbol.endsWith(counter)) { pairs.add(new CurrencyPairInfo( symbol.substring(0, symbol.lastIndexOf(counter)), counter, symbol)); } } } }
Source:
<code>public void run() { try { Thread.currentThread().setName("LearnerCnxAcceptorHandler-" + serverSocket.getLocalSocketAddress()); while (!stop.get()) { acceptConnections(); } } catch (Exception e) { LOG.warn("Exception while accepting follower", e); <START> if (!fail.get()) { <END> handleException(getName(), e); fail.set(true); halt(); } } finally { latch.countDown(); } }</code><technical_language>want this fail.getAndSet(true) in order get benefits</technical_language>

Target:
public void run() { try { Thread.currentThread().setName("LearnerCnxAcceptorHandler-" + serverSocket.getLocalSocketAddress()); while (!stop.get()) { acceptConnections(); } } catch (Exception e) { LOG.warn("Exception while accepting follower", e); if (fail.compareAndSet(false, true)) { handleException(getName(), e); halt(); } } finally { latch.countDown(); } }
Source:
<code>public void testColor() { Factory factory = new Factory(); assertEquals("#FF0000", ((Literal) Util.color("FF0000", factory)).getValue()); assertEquals("#00FF00", ((Literal) Util.color("00ff00", factory)).getValue()); assertEquals("#0000FF", ((Literal) Util.color("#0000FF", factory)).getValue()); assertEquals("#FFFF00", ((Literal) Util.color("0xFFFF00", factory)).getValue()); assertEquals("#00FFFF", ((Literal) Util.color("rgb(0, 255, 255)", factory)).getValue()); <START> assertEquals("#FF00FF", ((Literal) Util.color("f0f", factory)).getValue()); <END> }</code><technical_language>tests work as-is. If don't, broken some other behaviour in YSLD</technical_language>

Target:
public void testColor() { Factory factory = new Factory(); assertEquals(new Color(0xFF0000), ((Literal) Util.color("FF0000", factory)).getValue()); assertEquals(new Color(0x00FF00), ((Literal) Util.color("00ff00", factory)).getValue()); assertEquals(new Color(0x0000FF), ((Literal) Util.color("#0000FF", factory)).getValue()); assertEquals(new Color(0xFFFF00), ((Literal) Util.color("0xFFFF00", factory)).getValue()); assertEquals(new Color(0x00FFFF), ((Literal) Util.color("rgb(0, 255, 255)", factory)).getValue()); assertEquals(new Color(0xFF00FF), ((Literal) Util.color("f0f", factory)).getValue()); }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logo_picker); app = (MapleApplication) this.getApplication(); logos = app.getCurrentCompanyLogos(); companyTag = app.getCurrentCompany(); GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); <START> <END> gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { setLogo(v, position); } }); }</code><technical_language>siiiick</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logo_picker); app = (MapleApplication) this.getApplication(); logos = app.getCurrentCompanyLogos(); companyTag = app.getCurrentCompany(); TextView header = (TextView) findViewById(R.id.logoPickerTitle); header.setText("Pick A " + companyTag + " Logo"); gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { setSelectedView(position); setLogo(v, position); } }); }
Source:
<code>public String toString() { StringBuilder n = new StringBuilder(); n.append("PatchListKey["); if (projectKey != null) { n.append(projectKey.get()); n.append(" "); } n.append(oldId != null ? oldId.name() : "BASE"); n.append(".."); n.append(newId.name()); n.append(" "); <START> n.append(oldSeqNum); n.append(".."); n.append(newSeqNum); <END> n.append(" "); n.append(whitespace.name()); n.append("]"); return n.toString(); }</code><technical_language>If constructor is oldSeqNum newSeqNum explicitly initialized i.e. set zero. "0..0" in string representation of this object is useful "aPSID..bPSID". Include IDs in toString additionally include old/newSeqNum if set</technical_language>

Target:
public String toString() { StringBuilder n = new StringBuilder(); n.append("PatchListKey["); if (projectKey != null) { n.append(projectKey.get()); n.append(" "); } n.append(oldId != null ? oldId.name() : "BASE"); n.append(".."); n.append(newId.name()); if(oldSeqNum > 0 && newSeqNum > 0) { n.append(" "); n.append(oldSeqNum); n.append(".."); n.append(newSeqNum); } n.append(" "); n.append(whitespace.name()); n.append("]"); return n.toString(); }
Source:
<code>protected void exitSubrule(GrammarAST tree) { if (tree.getType() == CLOSURE || tree.getType() == POSITIVE_CLOSURE) { for (Map.Entry<String, MutableInt> entry : frequencies.peek().entrySet()) { entry.getValue().v = 2; } <START> int multiplier = tree.getType() == POSITIVE_CLOSURE ? 1 : 0; <END> for (Map.Entry<String, MutableInt> entry : minFrequencies.peek().entrySet()) { entry.getValue().v *= multiplier; } } }</code><technical_language>change this a boolean a multiplier? ;) fortran66 style hahah</technical_language>

Target:
protected void exitSubrule(GrammarAST tree) { if (tree.getType() == CLOSURE || tree.getType() == POSITIVE_CLOSURE) { for (Map.Entry<String, MutableInt> entry : frequencies.peek().entrySet()) { entry.getValue().v = 2; } } if (tree.getType() == CLOSURE) { minFrequencies.peek().clear(); } }
Source:
<code>public QuestionWidget(Context context, FormEntryPrompt prompt, AudioHelper audioHelper) { super(context); this.audioHelper = audioHelper; AppDependencyComponent component = DaggerUtils.getComponent((Activity) getContext()); this.referenceManager = component.referenceManager(); themeUtils = new ThemeUtils(context); playColor = themeUtils.getAccentColor(); if (context instanceof FormEntryActivity) { state = ((FormEntryActivity) context).getState(); permissionUtils = new PermissionUtils(); } if (context instanceof DependencyProvider) { injectDependencies((DependencyProvider) context); } player = new MediaPlayer(); questionFontSize = Collect.getQuestionFontsize(); formEntryPrompt = prompt; setGravity(Gravity.TOP); setPadding(0, 7, 0, 0); <START> questionQuestionLabel = createQuestionMediaLayout(prompt); <END> helpTextLayout = createHelpTextLayout(); helpTextLayout.setId(ViewIds.generateViewId()); guidanceTextLayout = helpTextLayout.findViewById(R.id.guidance_text_layout); textLayout = helpTextLayout.findViewById(R.id.text_layout); warningText = helpTextLayout.findViewById(R.id.warning_text); helpTextView = setupHelpText(helpTextLayout.findViewById(R.id.help_text_view), prompt); guidanceTextView = setupGuidanceTextAndLayout(helpTextLayout.findViewById(R.id.guidance_text_view), prompt); addQuestionMediaLayout(getQuestionQuestionLabel()); addHelpTextLayout(getHelpTextLayout()); if (context instanceof FormEntryActivity && !getFormEntryPrompt().isReadOnly()) { registerToClearAnswerOnLongPress((FormEntryActivity) context); } }</code><technical_language>createQuestionMediaLayout createQuestionLabel</technical_language>

Target:
public QuestionWidget(Context context, FormEntryPrompt prompt, AudioHelper audioHelper) { super(context); this.audioHelper = audioHelper; AppDependencyComponent component = DaggerUtils.getComponent((Activity) getContext()); this.referenceManager = component.referenceManager(); themeUtils = new ThemeUtils(context); playColor = themeUtils.getAccentColor(); if (context instanceof FormEntryActivity) { state = ((FormEntryActivity) context).getState(); permissionUtils = new PermissionUtils(); } if (context instanceof DependencyProvider) { injectDependencies((DependencyProvider) context); } player = new MediaPlayer(); questionFontSize = Collect.getQuestionFontsize(); formEntryPrompt = prompt; setGravity(Gravity.TOP); setPadding(0, 7, 0, 0); audioVideoImageTextLabel = createQuestionLabel(prompt); helpTextLayout = createHelpTextLayout(); helpTextLayout.setId(ViewIds.generateViewId()); guidanceTextLayout = helpTextLayout.findViewById(R.id.guidance_text_layout); textLayout = helpTextLayout.findViewById(R.id.text_layout); warningText = helpTextLayout.findViewById(R.id.warning_text); helpTextView = setupHelpText(helpTextLayout.findViewById(R.id.help_text_view), prompt); guidanceTextView = setupGuidanceTextAndLayout(helpTextLayout.findViewById(R.id.guidance_text_view), prompt); addQuestionMediaLayout(getAudioVideoImageTextLabel()); addHelpTextLayout(getHelpTextLayout()); if (context instanceof FormEntryActivity && !getFormEntryPrompt().isReadOnly()) { registerToClearAnswerOnLongPress((FormEntryActivity) context); } }
Source:
<code>protected HttpRequestBase createHttpRequestBase() { String bugUrl = getUrlSuffix(); BugzillaRestLoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); if ((!(this instanceof BugzillaRestValidateRequest) && !(this instanceof BugzillaRestUnauthenticatedGetRequest)) && token != null && bugUrl.length() > 0) { if (bugUrl.endsWith("?")) { <START> bugUrl += ("token=" + token.getToken()); END> } else { bugUrl += ("&token=" + token.getToken()); } } HttpRequestBase request = new HttpGet(baseUrl() + bugUrl); request.setHeader(CONTENT_TYPE, TEXT_XML_CHARSET_UTF_8); request.setHeader(ACCEPT, APPLICATION_JSON); return request; }</code><technical_language>(parens needed.)</technical_language>

Target:
protected HttpRequestBase createHttpRequestBase() { String bugUrl = getUrlSuffix(); BugzillaRestLoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); if ((!(this instanceof BugzillaRestValidateRequest) && !(this instanceof BugzillaRestUnauthenticatedGetRequest)) && token != null && bugUrl.length() > 0) { if (!bugUrl.endsWith("?")) { bugUrl += "&"; } bugUrl += "token=" + token.getToken(); } HttpRequestBase request = new HttpGet(baseUrl() + bugUrl); request.setHeader(CONTENT_TYPE, TEXT_XML_CHARSET_UTF_8); request.setHeader(ACCEPT, APPLICATION_JSON); return request; }
Source:
<code>public void writeToAtomicFile() throws Exception { afw.write(expectedContent, 0, expectedContent.length()); afw.flush(); assertTrue("File writer did not properly flush to temporary file", <START> Files.size(afw.getTemporaryPath()) == expectedContent.length()); <END> }</code><technical_language>assertEquals</technical_language>

Target:
public void writeToAtomicFile() throws Exception { afw.write(expectedContent, 0, expectedContent.length()); afw.flush(); assertEquals("File writer did not properly flush to temporary file", expectedContent.length(), Files.size(afw.getTemporaryPath())); }
Source:
<code>public CronTab(String format, int line, Hash hash) throws ANTLRException { <START> set(format, line, hash); <END> }</code><technical_language>I recommend <code>this()</code> in this constructor</technical_language>

Target:
public CronTab(String format, int line, Hash hash) throws ANTLRException { this(format, line, hash, null); }
Source:
<code>private boolean isSyscallEntry(String eventName) { return ((eventName.startsWith(fLayout.eventSyscallEntryPrefix()) || eventName.startsWith(fLayout.eventCompatSyscallEntryPrefix())) && <START> !(eventName.equals(fLayout.eventSyscallEntryPrefix() + "exit"))); END> }</code><technical_language>this in layout</technical_language>

Target:
private boolean isSyscallEntry(String eventName) { for (String prefix : fSysPrefixes) { if (eventName.startsWith(prefix)) { return !eventName.equals(prefix + fLayout.eventExitSyscallSuffix()); } } return false; }
Source:
<code>public void migrateName(String n) { <START> String space = " "; <END> String[] name = n.split(space); if (isClanner()) { int i = 0; givenName = name[i]; for (i = 1; i < name.length - 1; i++) { if (!name[i].equals(space)) { givenName += space + name[i]; } } if (!(!StringUtil.isNullOrEmpty(getBloodname()) && getBloodname().equals(name[i]))) { givenName += space + name[i]; } surname = null; } else { if (name.length == 1) { givenName = name[0]; surname = null; } else if (name.length == 2) { givenName = name[0]; surname = name[1]; } else if (name.length == 3) { givenName = name[0]; if (name[1].equals(space)) { surname = name[2]; } else { surname = name[1] + space + name[2]; } } else if (name.length > 3) { int i = 0; givenName = name[i]; for (i = 1; i < name.length - 2; i++) { if (!name[i].equals(space)) { givenName += space + name[i]; } } if (name[i].equals(space)) { surname = name[i + 1]; } else { surname = name[i] + space + name[i + 1]; } } } setFullName(); }</code><technical_language>suggestion final String space = " ";</technical_language>

Target:
public void migrateName(String n) { final String space = " "; String[] name = n.split(space); if (isClanner()) { int i = 0; givenName = name[i]; for (i = 1; i < name.length - 1; i++) { if (!name[i].equals(space)) { givenName += space + name[i]; } } if (!(!StringUtil.isNullOrEmpty(getBloodname()) && getBloodname().equals(name[i]))) { givenName += space + name[i]; } surname = null; } else { if (name.length == 1) { givenName = name[0]; surname = null; } else if (name.length == 2) { givenName = name[0]; surname = name[1]; } else if (name.length == 3) { givenName = name[0]; if (name[1].equals(space)) { surname = name[2]; } else { surname = name[1] + space + name[2]; } } else if (name.length > 3) { int i = 0; givenName = name[i]; for (i = 1; i < name.length - 2; i++) { if (!name[i].equals(space)) { givenName += space + name[i]; } } if (name[i].equals(space)) { surname = name[i + 1]; } else { surname = name[i] + space + name[i + 1]; } } } setFullName(); }
Source:
<code>public Result updateCreateVersionSet(final UUID uuid) { <START> final VersionSet view = request().body().as(VersionSet.class); <END> for (Map.Entry<String, PackageVersion> packageVersionEntry : view.getPackages().entrySet()) { if (!packageVersionEntry.getKey().equals(packageVersionEntry.getValue().getPackageName())) { return badRequest("versionSet.packages: keys must match package names."); } } final models.internal.VersionSet internalModel = viewToInternalVersionSpec(view); try { _versionSpecificationRepository.addOrUpdateVersionSet(internalModel); } catch (final Exception e) { LOGGER.error() .setMessage("Failed to create / update VersionSpecification") .addData("models.view.VersionSet", view) .addData("models.internal.VersionSet", internalModel) .setThrowable(e) .log(); return internalServerError(); } return ok(); }</code><technical_language>tells this wrong. Is view set null? exception thrown</technical_language>

Target:
public Result updateCreateVersionSet(final UUID uuid) { final String bodyText = request().body().asText(); final VersionSet view; try { view = OBJECT_MAPPER.readValue(bodyText, VersionSet.class); } catch (final IOException e) { LOGGER.error() .setMessage("Failed to deserialize body in updateCreateVersionSet") .addData("Body", bodyText) .addData("Uuid", uuid) .setThrowable(e) .log(); return badRequest("Malformed request body"); } for (Map.Entry<String, PackageVersion> packageVersionEntry : view.getPackages().entrySet()) { if (!packageVersionEntry.getKey().equals(packageVersionEntry.getValue().getPackageName())) { return badRequest("versionSet.packages: keys must match package names."); } } final models.internal.VersionSet internalModel = viewToInternalVersionSpec(view); try { _versionSpecificationRepository.addOrUpdateVersionSet(internalModel); } catch (final Exception e) { LOGGER.error() .setMessage("Failed to create / update VersionSpecification") .addData("Models.view.VersionSet", view) .addData("Models.internal.VersionSet", internalModel) .setThrowable(e) .log(); return internalServerError(); } return ok(); }
Source:
<code>public TaskSummary getTask(String serverTemplateId, String containerId, Long taskId) { if (serverTemplateId == null || serverTemplateId.isEmpty()) { return null; } <START> if (!specManagementService.getServerTemplate(serverTemplateId).getContainerSpec(containerId).getStatus().equals(KieContainerStatus.STARTED)) { <END> return null; } UserTaskServicesClient client = getClient(serverTemplateId, UserTaskServicesClient.class); try { TaskInstance task = client.getTaskInstance(containerId, taskId); return new TaskSummaryMapper().apply(task); } catch (KieServicesHttpException kieException) { if (kieException.getHttpCode() == NOT_FOUND_ERROR_CODE) { return null; } else { throw kieException; } } }</code><technical_language>thinking in terms of standards, this done in UI give specific error cause</technical_language>

Target:
public TaskSummary getTask(String serverTemplateId, String containerId, Long taskId) { if (serverTemplateId == null || serverTemplateId.isEmpty()) { return null; } UserTaskServicesClient client = getClient(serverTemplateId, UserTaskServicesClient.class); try { TaskInstance task = client.getTaskInstance(containerId, taskId); return new TaskSummaryMapper().apply(task); } catch (KieServicesHttpException kieException) { if (kieException.getHttpCode() == NOT_FOUND_ERROR_CODE) { return null; } else { throw kieException; } } }
Source:
<code>public void setup() { <START> RoboGuice.useAnnotationDatabases = false; <END> context = Robolectric.buildActivity(RoboActivity.class).create().get(); astroboy = RoboGuice.getInjector(context).getInstance(Astroboy.class); }</code><technical_language>Other wise test break for Robolectric. some point I introduced this, I corrected. TODO : investigate this</technical_language>

Target:
public void setup() { RoboGuice.setUseAnnotationDatabases(false); context = Robolectric.buildActivity(RoboActivity.class).create().get(); astroboy = RoboGuice.getInjector(context).getInstance(Astroboy.class); }
Source:
<code>private static InputStream getBody(Response response) { try { if (response.body() != null) { return response.body().asInputStream(); } } catch (IOException e) { log.warn("Unable to read message body from response {}", response, e); <START> return null; <END> } }</code><technical_language>need move this return out of catch-block if this. guessing currently get NPE blows up, change sense in general</technical_language>

Target:
private static InputStream getBody(Response response) { try { if (response.body() != null) { return response.body().asInputStream(); } } catch (IOException e) { log.warn("Unable to read message body from response {}", response, e); } return null; }
Source:
<code>public String socketDescription() { Socket socket = transportLayer.socketChannel().socket(); return "(Remote Address: " + ( <START> socket.getInetAddress() == null ? "[non-connected socket]" : socket.getInetAddress().toString() <END> ) + ", Local Address: " + socket.getLocalAddress().toString() + ")"; }</code><technical_language>get NPE if socket is null, right</technical_language>

Target:
public String socketDescription() { Socket socket = transportLayer.socketChannel().socket(); if (socket == null) return "[non-existing socket]"; return "(Remote Address: " + ( socket.getInetAddress() == null ? "[non-connected socket]" : socket.getInetAddress().toString() ) + ", Local Address: " + socket.getLocalAddress().toString() + ")"; }
Source:
<code>public void notEmptyExcludesShouldBeNotEmptyArguments() throws Exception { final Environment env = new Environment.Mock() .withExcludes("Foo,Bar"); final FindBugsExcludes excludes = new FindBugsExcludes(env); <START> final Collection<String> arguments = excludes.asArguments(); <END> MatcherAssert.assertThat( "The argument was empty for not empty excludes", arguments, new IsNot<>( new IsEmptyCollection<>() ) ); MatcherAssert.assertThat( "Expected a single argument", arguments.size(), new IsEqual<>(1) ); new FindBugsExcludesTest.ExcludesXml( new SAXReader().read(arguments.iterator().next()) ).assertXpath("count(/FindBugsFilter)=1"); }</code><technical_language>@ilyakharlamov I need create exclude variable</technical_language>

Target:
public void notEmptyExcludesShouldBeNotEmptyArguments() throws Exception { final List<String> arguments = new FindBugsExcludes( new Environment.Mock().withExcludes("Foo,Bar") ).asArguments(); MatcherAssert.assertThat( "The argument was empty for not empty excludes", arguments, new IsNot<>( new IsEmptyCollection<>() ) ); MatcherAssert.assertThat( "Expected a single argument", arguments.size(), new IsEqual<>(1) ); final Document doc = DocumentBuilderFactory.newInstance() .newDocumentBuilder() .parse(arguments.get(0)); MatcherAssert.assertThat( doc, new HasXPath( FindBugsExcludesTest.COUNT_FILTER, new IsEqual<>("1") ) ); }
Source:
<code>public static Long getLong(String name, Long def) { String v = getString(name); if (v != null) { try { return Long.decode(v); } catch (NumberFormatException e) { if (LOGGER.isLoggable(Level.CONFIG)) { <START> LOGGER.log(Level.CONFIG, "Property. Value is not integer: {0} => {1}", new Object[] {name, v}); <END> } } } return def; }</code><technical_language>ant: integer -> long</technical_language>

Target:
public static Long getLong(String name, Long def) { String v = getString(name); if (v != null) { try { return Long.decode(v); } catch (NumberFormatException e) { if (LOGGER.isLoggable(Level.CONFIG)) { LOGGER.log(Level.CONFIG, "Property. Value is not long: {0} => {1}", new Object[] {name, v}); } } } return def; }
Source:
<code>public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(ACTION) .setPost(true) .setDescription("Set Homepage of current user. Requires to be identified.") .setSince("7.0") .setHandler(this); action.createParam(PARAM_TYPE) .setDescription("Type of the requested page") .setRequired(true) .setPossibleValues(HomepageTypes.valuesAsString()); action.createParam(PARAM_KEY) <START> .setDescription("additional information to filter the page") <END> .setExampleValue("admin"); }</code><technical_language>Maj for letter</technical_language>

Target:
public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(ACTION) .setPost(true) .setDescription("Set Homepage of current user.<br> Requires authentication.") .setSince("7.0") .setHandler(this); action.createParam(PARAM_TYPE) .setDescription("Type of the requested page") .setRequired(true) .setPossibleValues(HomepageTypes.keys()); action.createParam(PARAM_VALUE) .setDescription("Additional information to filter the page (project or organization key)") .setExampleValue("my-project-key"); }
Source:
<code>public PlanState cloneWithApplied(PConstraintInfo op) { ArrayList<PConstraintInfo> newOperationsList = new ArrayList<>(this.getOperations()); <START> newOperationsList.add(op); <END> Collection<PVariable> deltaVariables = op.getFreeVariables(); Set<PVariable> allBoundVariables = new HashSet<>(this.getBoundVariables()); allBoundVariables.addAll(deltaVariables); PlanState newState = new PlanState(getAssociatedPBody(), newOperationsList, allBoundVariables, deltaVariables); newState.accountNewOperation(op); return newState; }</code><technical_language>this code performance sensitive, it? This call triggers arraylist reallocation. improved allocating arraylist size getOperations.size + 1 filling content</technical_language>

Target:
public PlanState cloneWithApplied(PConstraintInfo op) { ArrayList<PConstraintInfo> newOperationsList = new ArrayList<>(pBody.getConstraints().size()); newOperationsList.addAll(this.getOperations()); newOperationsList.add(op); Collection<PVariable> deltaVariables = op.getFreeVariables(); Set<PVariable> allBoundVariables = new HashSet<>(this.getBoundVariables().size() + deltaVariables.size()); allBoundVariables.addAll(this.getBoundVariables()); allBoundVariables.addAll(deltaVariables); PlanState newState = new PlanState(getAssociatedPBody(), newOperationsList, allBoundVariables, deltaVariables); newState.accountNewOperation(op); return newState; }
Source:
<code><START> private Cell getKeyCellForTable(TableReference tableRef) { <END> return Cell.create(getBytesForTableRef(tableRef), AtlasDbConstants.NAMESPACE_SHORT_COLUMN_BYTES); }</code><technical_language>static</technical_language>

Target:
static Cell getKeyCellForTable(TableReference tableRef) { return Cell.create(getBytesForTableRef(tableRef), AtlasDbConstants.NAMESPACE_SHORT_COLUMN_BYTES); }
Source:
<code>public synchronized void close() throws Exception { <START> if (!reqQueueExecutor.isShutdown()) reqQueueExecutor.shutdown(); <END> synchronized(scopedCleanupActions) { for (Callable<Void> actions : scopedCleanupActions.values()) { actions.call(); } scopedCleanupActions.clear(); } for (Callable<Void> action : cleanupActions) { action.call(); } cleanupActions.clear(); }</code><technical_language>improve readability please put call reqQueueExecutor.shutdown(); next line</technical_language>

Target:
public void close() throws Exception { if (running.compareAndSet(true, false)) { LOGGER.info("closing PreDestroyMonitor..."); reqQueueExecutor.shutdown(); synchronized(scopedCleanupActions) { for (Callable<Void> actions : scopedCleanupActions.values()) { actions.call(); } scopedCleanupActions.clear(); scopedCleanupActions = Collections.emptyMap(); } if (!reqQueueExecutor.awaitTermination(90, TimeUnit.SECONDS)) { LOGGER.error("internal executor still active; shutting down now"); reqQueueExecutor.shutdownNow(); } for (Callable<Void> action : cleanupActions) { action.call(); } cleanupActions.clear(); markerReferenceQueue = null; scopeBindings.clear(); scopeBindings = Collections.emptyMap(); } else { LOGGER.warn("PreDestroyMonitor.close() invoked but instance is not running"); } }
Source:
<code>private static Function<Page, Page> enforceLayoutProcessor(List<Symbol> expectedLayout, Map<Symbol, Integer> inputLayout) { int[] channels = new int[expectedLayout.size()]; for (int i = 0; i < expectedLayout.size(); i++) { Symbol symbol = expectedLayout.get(i); Integer channel = inputLayout.get(symbol); <START> checkArgument(channel != null, "channel not found for symbol: %s", symbol); <END> channels[i] = channel; } if (Arrays.equals(channels, range(0, inputLayout.size()).toArray())) { return Function.identity(); } return new PageChannelSelector(channels); }</code><technical_language>retain original stream-based code, this: int[] channels = expectedLayout.stream() .peek(symbol -> checkArgument(inputLayout.containsKey(symbol), "channel for symbol: %s", symbol)) // --- added .mapToInt(inputLayout::get) .toArray();</technical_language>

Target:
private static Function<Page, Page> enforceLayoutProcessor(List<Symbol> expectedLayout, Map<Symbol, Integer> inputLayout) { int[] channels = expectedLayout.stream() .peek(symbol -> checkArgument(inputLayout.containsKey(symbol), "channel not found for symbol: %s", symbol)) .mapToInt(inputLayout::get) .toArray(); if (Arrays.equals(channels, range(0, inputLayout.size()).toArray())) { return Function.identity(); } return new PageChannelSelector(channels); }
Source:
<code>private static File createNewBasePersistDirectory() { try { return Files.createTempDir(); } catch (IllegalStateException e) { <START> String message = "Failed to create temporary directory!" + System.lineSeparator() + <END> "Make sure `java.io.tmpdir` property is set to existing and writable directory."; throw new IllegalStateException(message, e); } }</code><technical_language>Nit: error messages line breaks tougher grep logs, weird, I leave out</technical_language>

Target:
private static File createNewBasePersistDirectory() { try { return Files.createTempDir(); } catch (IllegalStateException e) { String messageTemplate = "Failed to create temporary directory in [%s]! " + "Make sure the `java.io.tmpdir` property is set to an existing and writable directory " + "with enough free space."; throw new ISE(e, messageTemplate, System.getProperty("java.io.tmpdir")); } }
Source:
<code>public static PluginManager createPluginManager() { PluginManager pluginManager = new DefaultPluginManager() { @Override protected ExtensionFinder createExtensionFinder() { return new BuckExtensionFinder(); } @Override protected CompoundPluginDescriptorFinder createPluginDescriptorFinder() { CompoundPluginDescriptorFinder finder = new CompoundPluginDescriptorFinder(); finder.add(new ManifestPluginDescriptorFinder()); return finder; } @Override protected PluginRepository createPluginRepository() { try { <START> return new DefaultPluginRepository( <END> Files.createTempDirectory("pf4j-plugins"), false); } catch (IOException e) { throw new RuntimeException(e); } } }; pluginManager.loadPlugins(); pluginManager.startPlugins(); return pluginManager; }</code><technical_language>new DefaultPluginRepository(getPluginsRoot(), isDevelopment()</technical_language>

Target:
public static PluginManager createPluginManager() { PluginManager pluginManager = new DefaultPluginManager() { @Override protected ExtensionFinder createExtensionFinder() { return new BuckExtensionFinder(); } @Override public Path getPluginsRoot() { return Paths.get("buck-plugins"); } }; pluginManager.loadPlugins(); pluginManager.startPlugins(); return pluginManager; }
Source:
<code>public Response toResponse(final Exception e) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity(e.getMessage()) <START> .type(MediaType.TEXT_PLAIN) <END> .build(); }</code><technical_language>more for json {status: 500, message: <message>}</technical_language>

Target:
public Response toResponse(final Exception e) { logger.log(Level.WARNING, "Exception while processing request", e); return ExceptionMapperUtils.toResponse(Response.Status.INTERNAL_SERVER_ERROR, e); }
Source:
<code>protected void volumeType_SelectedItemChanged() { if (getVolumeType().getSelectedItem() == null || getDataCenter().getSelectedItem() == null || getStorageDomain().getSelectedItem() == null) { return; } if <START> (!isInStorageDomainUpdate) { <END> isUserSelectVolumeType = true; } VolumeType volumeType = getVolumeType().getSelectedItem(); StorageType storageType = getStorageDomain().getSelectedItem().getStorageType(); updateShareable(volumeType, storageType); }</code><technical_language>s/isUserSelectVolumeType/isUserSelectedVolumeType</technical_language>

Target:
protected void volumeType_SelectedItemChanged() { if (getVolumeType().getSelectedItem() == null || getDataCenter().getSelectedItem() == null || getStorageDomain().getSelectedItem() == null) { return; } if (!isInStorageDomainUpdate) { isUserSelectedVolumeType = true; } VolumeType volumeType = getVolumeType().getSelectedItem(); StorageType storageType = getStorageDomain().getSelectedItem().getStorageType(); updateShareable(volumeType, storageType); }
Source:
<code>private boolean isExecutableType(TypeMirror accessorType) { <START> return accessorType.getKind() == TypeKind.EXECUTABLE && accessorType instanceof ExecutableType; <END> }</code><technical_language>I reckon && is needed, right</technical_language>

Target:
private boolean isExecutableType(TypeMirror accessorType) { return accessorType.getKind() == TypeKind.EXECUTABLE; }
Source:
<code>public TankItem(Block blockIn, Properties builder) { super(blockIn, builder); <START> this.addPropertyOverride(new ResourceLocation("tconstruct","amount"), (stack, world, entity) -> { <END> System.out.println("test1"); return 0.0F; } ); }</code><technical_language>Fix :P I tooltips working in Ceramics, try comparing if needed</technical_language>

Target:
public TankItem(Block blockIn, Properties builder) { super(blockIn, builder); }