auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private EditPart getEditPart(final String semanticElement) { modelSetFixture.getPageManager().openPage(diagram); View diagramView = DiagramUtils.findShape(diagram, semanticElement); if <START> (diagramView == null) { <END> diagramView = DiagramUtils.findEdge(diagram, semanticElement); } if (diagramView == null) { Iterator<?> iterator = diagram.eAllContents(); while (null == diagramView && iterator.hasNext()) { Object object = iterator.next(); if (object instanceof View) { diagramView = DiagramUtils.findShape((View) object, semanticElement); if (diagramView == null) { diagramView = DiagramUtils.findEdge((View) object, semanticElement); } } } } assertNotNull(diagramView); IGraphicalEditPart semanticEP = DiagramUtils.findEditPartforView(modelSetFixture.getEditor(), diagramView, IGraphicalEditPart.class); assertNotNull(semanticEP); return semanticEP; }</code><technical_language>null =</technical_language>

Target:
private EditPart getEditPart(final String semanticElement) { modelSetFixture.getPageManager().openPage(diagram); View diagramView = DiagramUtils.findShape(diagram, semanticElement); if (null == diagramView) { diagramView = DiagramUtils.findEdge(diagram, semanticElement); } if (null == diagramView) { Iterator<?> iterator = diagram.eAllContents(); while (null == diagramView && iterator.hasNext()) { Object object = iterator.next(); if (object instanceof View) { diagramView = DiagramUtils.findShape((View) object, semanticElement); if (null == diagramView) { diagramView = DiagramUtils.findEdge((View) object, semanticElement); } } } } assertNotNull(diagramView); IGraphicalEditPart semanticEP = DiagramUtils.findEditPartforView(modelSetFixture.getEditor(), diagramView, IGraphicalEditPart.class); assertNotNull(semanticEP); return semanticEP; }
Source:
<code>private NodeIterator getNodeIterator(SessionProvider sProvider, Node node, String nodeType, StringBuilder strQuery) throws Exception { try { StringBuilder pathQuery = new StringBuilder(Utils.JCR_ROOT).append(node.getPath()).append(" strQuery = pathQuery; QueryManager qm = node.getSession().getWorkspace().getQueryManager(); Query query = qm.createQuery(pathQuery.toString(), Query.XPATH); QueryResult result = query.execute(); return result.getNodes(); } catch (Exception e) { <START> log.error(String.format("\n Get not by query %s is failed.", strQuery), e); <END> return null; } }</code><technical_language>Get -> Get node</technical_language>

Target:
private NodeIterator getNodeIterator(SessionProvider sProvider, Node node, String nodeType, StringBuilder strQuery) throws Exception { try { StringBuilder pathQuery = new StringBuilder(Utils.JCR_ROOT).append(node.getPath()).append(" strQuery = pathQuery; QueryManager qm = node.getSession().getWorkspace().getQueryManager(); Query query = qm.createQuery(pathQuery.toString(), Query.XPATH); QueryResult result = query.execute(); return result.getNodes(); } catch (Exception e) { log.error(String.format("\n Get node iterator by query %s is failed.", strQuery), e); return null; } }
Source:
<code>public static FeatureCollection<?, ?> transformIfNecessary( Layer layer, Rectangle paintArea, double mapScale, FeatureType schema, FeatureCollection<?, ?> features) throws IOException { List<LiteFeatureTypeStyle> featureTypeStyles = VectorMapRenderUtils.getFeatureStyles(layer, paintArea, mapScale, schema); <START> if (!featureTypeStyles.isEmpty() && featureTypeStyles.get(0).transformation != null) { <END> Expression transform = featureTypeStyles.get(0).transformation; return (FeatureCollection<?, ?>) transform.evaluate(features); } else { return features; } }</code><technical_language>A layer multiple FTS attached transformed while others not, transformations FTS. If I understand module works (mind, original creator maintainer) for this case supported layer split in multiple ones, guessing checking FTSs grouping uniform transform</technical_language>

Target:
public static FeatureCollection<?, ?> transformIfNecessary( Layer layer, Rectangle paintArea, double mapScale, FeatureType schema, FeatureCollection<?, ?> features) throws IOException { List<LiteFeatureTypeStyle> featureTypeStyles = VectorMapRenderUtils.getFeatureStyles(layer, paintArea, mapScale, schema); if (!featureTypeStyles.isEmpty()) { for (LiteFeatureTypeStyle featureTypeStyle : featureTypeStyles) { try { if (featureTypeStyle.transformation != null) { Expression transform = featureTypeStyle.transformation; features = (FeatureCollection<?, ?>) transform.evaluate(features); } } catch (Exception ex) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, "Error while appliying transformation", ex); } } } } return features; }
Source:
<code><START> public CompiledScript getCompiledScript(String packageAndClassName) throws ScriptException { <END> CompiledScript compiledScript = compiledScripts.get(packageAndClassName); if (compiledScript == null) { String source = sources.get(packageAndClassName); final String lang; if (isJavascriptSource(source)) lang = "javascript"; else throw new IllegalStateException("Unkown language for " + source); final Compilable jsEngine = (Compilable) new ScriptEngineManager().getEngineByName(lang); compiledScript = jsEngine.compile(source); compiledScripts.put(packageAndClassName, compiledScript); } return compiledScript; }</code><technical_language>this private, call getCompiledJavascript, support else</technical_language>

Target:
public CompiledScript getCompiledScript(String packageAndClassName) throws ScriptException { CompiledScript compiledScript = compiledScripts.get(packageAndClassName); if (compiledScript == null) { String source = sources.get(packageAndClassName); final String lang; if (isJavascriptSource(source)) lang = "javascript"; else if (isRubySource(source)) lang = "ruby"; else throw new IllegalStateException("Unknown language for " + source); final Compilable jsEngine = (Compilable) new ScriptEngineManager().getEngineByName(lang); compiledScript = jsEngine.compile(source); compiledScripts.put(packageAndClassName, compiledScript); } return compiledScript; }
Source:
<code>public AmbariServiceNodeDiscoverer(String apiRootUrl, String username, String password) { this.apiRootUrl = apiRootUrl; this.username = username; this.password = password; <START> setupClient(); <END> }</code><technical_language>Minor: Ideally avoid work in constructor. Pas apiRooUrl Client constructor, provide a factory method receiving apiRootUrl, username password creating constructor dependencies</technical_language>

Target:
public AmbariServiceNodeDiscoverer(String apiRootUrl, String username, String password) { this.apiRootUrl = apiRootUrl; this.username = username; this.password = password; }
Source:
<code>private void copyKeyAndLink() { List<BibEntry> entries = stateManager.getSelectedEntries(); StringBuilder keyAndLink = new StringBuilder(); List<BibEntry> entriesWithKey = entries.stream() .filter(BibEntry::hasCiteKey) .collect(Collectors.toList()); if (entriesWithKey.isEmpty()) { dialogService.notify(Localization.lang("None of the selected entries have citation keys.")); return; } for (BibEntry entry : entriesWithKey) { String key = entry.getCiteKeyOptional().get(); String url = entry.getField(StandardField.URL).orElse(""); keyAndLink.append(url.isEmpty() ? key : String.format("<a href=\"%s\">%s</a>", url, key)); keyAndLink.append(OS.NEWLINE); } <START> clipBoardManager.setContent(keyAndLink.toString()); <END> if (entriesWithKey.size() == entries.size()) { dialogService.notify(Localization.lang("Copied '%0' to clipboard.", JabRefDialogService.shortenDialogMessage(keyAndLink.toString()))); } else { dialogService.notify(Localization.lang("Warning: %0 out of %1 entries have undefined citation key.", Long.toString(entries.size() - entriesWithKey.size()), Integer.toString(entries.size()))); } }</code><technical_language>This puts html string clipboard, if paste notepad get <a href="url">key</a>. Instead, add html, in addition a fallback string of format key - url. In this way, get desired behavior paste in applications do understand html (e.g onenote). In order for this work, need add a fallback argument <LINK_0> is added ClipboardContent putString</technical_language>

Target:
private void copyKeyAndLink() { List<BibEntry> entries = stateManager.getSelectedEntries(); StringBuilder keyAndLink = new StringBuilder(); StringBuilder fallbackString = new StringBuilder(); List<BibEntry> entriesWithKey = entries.stream() .filter(BibEntry::hasCitationKey) .collect(Collectors.toList()); if (entriesWithKey.isEmpty()) { dialogService.notify(Localization.lang("None of the selected entries have citation keys.")); return; } for (BibEntry entry : entriesWithKey) { String key = entry.getCitationKey().get(); String url = entry.getField(StandardField.URL).orElse(""); keyAndLink.append(url.isEmpty() ? key : String.format("<a href=\"%s\">%s</a>", url, key)); keyAndLink.append(OS.NEWLINE); fallbackString.append(url.isEmpty() ? key : String.format("%s - %s", key, url)); fallbackString.append(OS.NEWLINE); } clipBoardManager.setHtmlContent(keyAndLink.toString(), fallbackString.toString()); if (entriesWithKey.size() == entries.size()) { dialogService.notify(Localization.lang("Copied '%0' to clipboard.", JabRefDialogService.shortenDialogMessage(keyAndLink.toString()))); } else { dialogService.notify(Localization.lang("Warning: %0 out of %1 entries have undefined citation key.", Long.toString(entries.size() - entriesWithKey.size()), Integer.toString(entries.size()))); } }
Source:
<code>@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == REQUEST_READ_CONTACTS) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { loadContacts(); } else { <START> Toast.makeText(getApplicationContext(), "Read contacts permission denied", <END> Toast.LENGTH_LONG).show(); finish(); } } else { super.onRequestPermissionsResult(requestCode, permissions, grantResults); } }</code><technical_language>nitpick: this instead of application</technical_language>

Target:
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == REQUEST_READ_CONTACTS) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { loadContacts(); } else { Toast.makeText(this, "Read contacts permission denied", Toast.LENGTH_LONG).show(); finish(); } } else { super.onRequestPermissionsResult(requestCode, permissions, grantResults); } }
Source:
<code>private void initLegacyStep() { if (steps == null) { steps = new ArrayList<>(); } if (step == null) { step = new Step(); Response response = new Response(); <START> response.setAssertions(Collections.singletonList(Response.DEFAULT_ASSERTION)); <END> step.setResponse(response); steps.add(step); } }</code><technical_language>new static field: Response.DEFAULT_RESPONSE</technical_language>

Target:
private void initLegacyStep() { if (steps == null) { steps = new ArrayList<>(); } if (step == null) { step = new Step(); step.setResponse(Response.DEFAULT_RESPONSE); steps.add(step); } }
Source:
<code>protected boolean copyDatabaseCreationScript() { String creationScriptContents = DatastoreMixins.getDatabaseCreationScriptAsString(entity); if (creationScriptContents==null) return false; creationScriptContents = processTemplateContents(creationScriptContents); Reader creationContents = new StringReader(creationScriptContents); <START> getMachine().copyTo(creationContents, getRunDir() + "/creation-script.sql"); <END> return true; }</code><technical_language>copyTemplate instead of previous lines</technical_language>

Target:
protected boolean copyDatabaseCreationScript() { String creationScriptContents = DatastoreMixins.getDatabaseCreationScriptAsString(entity); if (creationScriptContents==null) return false; File templateFile; try { templateFile = File.createTempFile("mysql", null); templateFile.deleteOnExit(); BufferedWriter writer = new BufferedWriter(new FileWriter(templateFile)); writer.write (creationScriptContents); } catch (IOException e) { throw Exceptions.propagate(e); } copyTemplate(templateFile.getAbsoluteFile(), getRunDir() + "/creation-script.sql"); templateFile.delete(); return true; }
Source:
<code>public void testMaxRequestsAndQueueCapacityDefaults() throws Exception { Configuration conf = getRawConfiguration(); final AzureBlobFileSystem fs = getFileSystem(conf); <START> FSDataOutputStream out = fs.create(TEST_FILE_PATH); <END> AbfsOutputStream stream = (AbfsOutputStream) out.getWrappedStream(); Assertions.assertThat(stream.getMaxConcurrentRequestCount()).describedAs( "maxConcurrentRequests should be " + getConfiguration() .getWriteMaxConcurrentRequestCount()) .isEqualTo(getConfiguration().getWriteMaxConcurrentRequestCount()); Assertions.assertThat(stream.getMaxRequestsThatCanBeQueued()).describedAs( "maxRequestsToQueue should be " + getConfiguration() .getMaxWriteRequestsToQueue()) .isEqualTo(getConfiguration().getMaxWriteRequestsToQueue()); }</code><technical_language>try resources,</technical_language>

Target:
public void testMaxRequestsAndQueueCapacityDefaults() throws Exception { Configuration conf = getRawConfiguration(); final AzureBlobFileSystem fs = getFileSystem(conf); try (FSDataOutputStream out = fs.create(TEST_FILE_PATH)) { AbfsOutputStream stream = (AbfsOutputStream) out.getWrappedStream(); Assertions.assertThat(stream.getMaxConcurrentRequestCount()).describedAs( "maxConcurrentRequests should be " + getConfiguration() .getWriteMaxConcurrentRequestCount()) .isEqualTo(getConfiguration().getWriteMaxConcurrentRequestCount()); Assertions.assertThat(stream.getMaxRequestsThatCanBeQueued()).describedAs( "maxRequestsToQueue should be " + getConfiguration() .getMaxWriteRequestsToQueue()) .isEqualTo(getConfiguration().getMaxWriteRequestsToQueue()); } }
Source:
<code>protected Span getSpanFromContext(byte[] traceContext) { if (traceContext == null || traceContext.length == 0) { return BlankSpan.INSTANCE; } Tracer tracer = Tracing.getTracer(); BinaryFormat binaryFormat = Tracing.getPropagationComponent().getBinaryFormat(); try { SpanContext spanContext = binaryFormat.fromByteArray(traceContext); Span span = tracer.spanBuilderWithRemoteParent("work/" + getClass().getSimpleName(), spanContext) .startSpan(); span.addLink(Link.fromSpanContext(spanContext, Link.Type.PARENT_LINKED_SPAN)); HashMap<String, AttributeValue> map = new HashMap<>(); map.put("tx.thread", AttributeValue.stringAttributeValue(Thread.currentThread().getName())); map.put("work.id", AttributeValue.stringAttributeValue(getId())); map.put("work.category", AttributeValue.stringAttributeValue(getCategory())); map.put("work.title", AttributeValue.stringAttributeValue(getTitle())); map.put("work.parent_path", AttributeValue.stringAttributeValue(getSchedulePath().getParentPath())); map.put("work.caller_thread", AttributeValue.stringAttributeValue(callerThread)); map.put("work.to_string", AttributeValue.stringAttributeValue(toString())); if (docId != null) { map.put("work.doc_id", AttributeValue.stringAttributeValue(docId)); } if (docIds != null && !docIds.isEmpty()) { map.put("work.doc_count", AttributeValue.longAttributeValue(docIds.size())); } span.putAttributes(map); return span; } catch (SpanContextParseException e) { log.warn("No span context " + traceContext.length); } <START> return BlankSpan.INSTANCE; <END> }</code><technical_language>move this in catch please</technical_language>

Target:
protected Span getSpanFromContext(byte[] traceContext) { if (traceContext == null || traceContext.length == 0) { return BlankSpan.INSTANCE; } Tracer tracer = Tracing.getTracer(); BinaryFormat binaryFormat = Tracing.getPropagationComponent().getBinaryFormat(); try { SpanContext spanContext = binaryFormat.fromByteArray(traceContext); Span span = tracer.spanBuilderWithRemoteParent("work/" + getClass().getSimpleName(), spanContext) .startSpan(); span.addLink(Link.fromSpanContext(spanContext, Link.Type.PARENT_LINKED_SPAN)); HashMap<String, AttributeValue> map = new HashMap<>(); map.put("tx.thread", AttributeValue.stringAttributeValue(Thread.currentThread().getName())); map.put("work.id", AttributeValue.stringAttributeValue(getId())); map.put("work.category", AttributeValue.stringAttributeValue(getCategory())); map.put("work.title", AttributeValue.stringAttributeValue(getTitle())); map.put("work.parent_path", AttributeValue.stringAttributeValue(getSchedulePath().getParentPath())); map.put("work.caller_thread", AttributeValue.stringAttributeValue(callerThread)); map.put("work.to_string", AttributeValue.stringAttributeValue(toString())); if (docId != null) { map.put("work.doc_id", AttributeValue.stringAttributeValue(docId)); } if (docIds != null && !docIds.isEmpty()) { map.put("work.doc_count", AttributeValue.longAttributeValue(docIds.size())); } span.putAttributes(map); return span; } catch (SpanContextParseException e) { log.warn("No span context " + traceContext.length); return BlankSpan.INSTANCE; } }
Source:
<code>public void init() { broker = LdapFactory.getInstance(getProfileName()); context.put(ExtensionProperties.AUTHOR, "The oVirt Project"); context.put(ExtensionProperties.EXTENSION_NAME, "Internal Kerberos/LDAP authentication (Built-in)"); context.put(ExtensionProperties.LICENSE, "ASL 2.0"); context.put(ExtensionProperties.HOME, "<LINK_0>"); context.put(ExtensionProperties.VERSION, "N/A"); if (passwordChangeMsgPerDomain == null) { synchronized (ProvisionalAuthenticator.class) { if (passwordChangeMsgPerDomain == null) { String changePasswordUrl = Config.<String> getValue(ConfigValues.ChangePasswordMsg); String[] pairs = changePasswordUrl.split(","); for (String pair : pairs) { String[] pairParts = pair.split(":", 2); if (pairParts.length >= 2) { try { passwordChangeMsgPerDomain.put(pairParts[0], URLDecoder.decode(pairParts[1], "UTF-8")); } catch (UnsupportedEncodingException e) { throw new AAAExtensionException(AAAExtensionError.INVALID_CONFIGURATION, "error in obtaining the password change message or url for " + pairParts[0]); } } } } } } <START> passwordChangeMsgUrl = passwordChangeMsgPerDomain.get(getProfileName()); <END> }</code><technical_language>put in context</technical_language>

Target:
public void init() { broker = LdapFactory.getInstance(getProfileName()); context.put(ExtensionProperties.AUTHOR, "The oVirt Project"); context.put(ExtensionProperties.EXTENSION_NAME, "Internal Kerberos/LDAP authentication (Built-in)"); context.put(ExtensionProperties.LICENSE, "ASL 2.0"); context.put(ExtensionProperties.HOME, "<LINK_0>"); context.put(ExtensionProperties.VERSION, "N/A"); if (passwordChangeMsgPerDomain == null) { synchronized (ProvisionalAuthenticator.class) { if (passwordChangeMsgPerDomain == null) { String changePasswordUrl = Config.<String> getValue(ConfigValues.ChangePasswordMsg); String[] pairs = changePasswordUrl.split(","); for (String pair : pairs) { String[] pairParts = pair.split(":", 2); if (pairParts.length >= 2) { try { passwordChangeMsgPerDomain.put(pairParts[0], URLDecoder.decode(pairParts[1], "UTF-8")); } catch (UnsupportedEncodingException e) { throw new AAAExtensionException(AAAExtensionError.INVALID_CONFIGURATION, "error in obtaining the password change message or url for " + pairParts[0]); } } } } } } String changePasswordMsgOrUrl = passwordChangeMsgPerDomain.get(getProfileName()); if (changePasswordMsgOrUrl != null) { ExtensionProperties key = containsURL(changePasswordMsgOrUrl) ? ExtensionProperties.CHANGE_EXPIRED_PASSWORD_URL : ExtensionProperties.CHANGE_EXPIRED_PASSWORD_MSG; context.put(key, changePasswordMsgOrUrl); } }
Source:
<code>public void itShouldSetOptionalAttributes() { try { final Set<Integer> zoneIds = new HashSet(Arrays.asList(10, 11, 12)); final int campaignId = 100; final int flightId = 3; final int adId = 42; final String clickUrl = "clickUrl"; final Set<Integer> eventIds = new HashSet(Arrays.asList(1, 2, 3)); <START> Placement div1 = new Placement("div1", 9999, 77777, 5, 6); <END> div1.setZoneIds(zoneIds); div1.setCampaignId(campaignId); div1.setFlightId(flightId); div1.setAdId(adId); div1.setClickUrl(clickUrl); div1.setEventIds(eventIds); assertThat(div1.getZoneIds()).containsAll(zoneIds); assertThat(div1.getCampaignId()).isEqualTo(campaignId); assertThat(div1.getFlightId()).isEqualTo(flightId); assertThat(div1.getAdId()).isEqualTo(adId); assertThat(div1.getClickUrl()).isEqualTo(clickUrl); assertThat(div1.getEventIds()).containsAll(eventIds); } catch(IllegalArgumentException e) { fail("Should not throw exception: " + e.getMessage()); } }</code><technical_language>Demonstrate placement "builder" pattern here</technical_language>

Target:
public void itShouldSetOptionalAttributes() { try { final Set<Integer> zoneIds = new HashSet(Arrays.asList(10, 11, 12)); final int campaignId = 100; final int flightId = 3; final int adId = 42; final String clickUrl = "clickUrl"; final Set<Integer> eventIds = new HashSet(Arrays.asList(1, 2, 3)); Placement div1 = new Placement("div1", 9999, 77777, 5, 6) .setZoneIds(zoneIds) .setCampaignId(campaignId) .setFlightId(flightId) .setAdId(adId) .setClickUrl(clickUrl) .setEventIds(eventIds); assertThat(div1.getZoneIds()).containsAll(zoneIds); assertThat(div1.getCampaignId()).isEqualTo(campaignId); assertThat(div1.getFlightId()).isEqualTo(flightId); assertThat(div1.getAdId()).isEqualTo(adId); assertThat(div1.getClickUrl()).isEqualTo(clickUrl); assertThat(div1.getEventIds()).containsAll(eventIds); } catch(IllegalArgumentException e) { fail("Should not throw exception: " + e.getMessage()); } }
Source:
<code>private void loadCaCert() { InputStream inStream = null; try { String httpsCertPath = getFilesDir()+"/"+SyncthingService.HTTPS_CERT_FILE; inStream = new FileInputStream(httpsCertPath); CertificateFactory cf = CertificateFactory.getInstance("X.509"); mCaCert = (X509Certificate) cf.generateCertificate(inStream); } catch (Exception e) { throw new IllegalArgumentException("Untrusted Certificate!"); } finally { try { if (inStream != null) inStream.close(); } catch (IOException e) { <START> e.printStackTrace(); <END> } } }</code><technical_language>Log.x()</technical_language>

Target:
private void loadCaCert() { InputStream inStream = null; try { String httpsCertPath = getFilesDir() + "/" + SyncthingService.HTTPS_CERT_FILE; inStream = new FileInputStream(httpsCertPath); CertificateFactory cf = CertificateFactory.getInstance("X.509"); mCaCert = (X509Certificate) cf.generateCertificate(inStream); } catch (FileNotFoundException|CertificateException e) { throw new IllegalArgumentException("Untrusted Certificate"); } finally { try { if (inStream != null) inStream.close(); } catch (IOException e) { Log.w(TAG, e); } } }
Source:
<code>public void validate() throws ConfigurationException { verifyNotNull("name", _name); verifyNotNull("guid", _guid); verifyNotNull("zone", _zoneId); verifyNotNull("hostname", _hostName); verifyNotNull("CMS username", _cmsUser); verifyNotNull("CMS password", _cmsUserPassword); if (org.apache.commons.lang.StringUtils.isBlank(_apiVersion)) { throw new ConfigurationException("Unable to find API version"); <START> } <END> try { new NuageVspApiVersion(_apiVersion); } catch(IllegalArgumentException e) { throw new ConfigurationException("Incorrect API version"); } verifyNotEmpty("number of retries", _retryCount); verifyNotEmpty("retry interval", _retryInterval); }</code><technical_language>verifyNotEmpty method perform this check</technical_language>

Target:
public void validate() throws ConfigurationException { verifyNotNull("name", _name); verifyNotNull("guid", _guid); verifyNotNull("zone", _zoneId); verifyNotNull("hostname", _hostName); verifyNotNull("CMS username", _cmsUser); verifyNotNull("CMS password", _cmsUserPassword); verifyNotEmpty("API version", _apiVersion); try { new NuageVspApiVersion(_apiVersion); } catch(IllegalArgumentException e) { throw new ConfigurationException("Incorrect API version"); } verifyNotEmpty("number of retries", _retryCount); verifyNotEmpty("retry interval", _retryInterval); }
Source:
<code>public String toString() { <START> return Objects.toStringHelper(this).omitNullValues().add("id", id).add("userId", userId).add("projectId", projectId).add("source", source).add("firstSanpleTimestamp", firstSanpleTimestamp) <END> .add("lastSanpleTimestamp", lastSampleTimeStamp).toString(); }</code><technical_language>couple of sample/sanple typos</technical_language>

Target:
public String toString() { return Objects.toStringHelper(this).omitNullValues().add("id", id).add("userId", userId).add("projectId", projectId).add("source", source).add("firstSanpleTimestamp", firstSampleTimestamp) .add("lastSanpleTimestamp", lastSampleTimeStamp).toString(); }
Source:
<code>public void animateLayouts(View view){ if (view == null) { logger.warn("Null view cannot be animated!"); return; } <START> ViewAnimationUtil messageController; <END> ViewAnimationUtil.showMessageBar(view); }</code><technical_language>this declares a variable used</technical_language>

Target:
public void animateLayouts(View view){ if (view == null) { logger.warn("Null view cannot be animated!"); return; } ViewAnimationUtil.showMessageBar(view); }
Source:
<code>public static String getValueFromRowAsString(TelemetryBis.TelemetryField row, String name) { for (TelemetryBis.TelemetryField nestedField : row.getFieldsList()) { TelemetryBis.TelemetryField subField = findFieldWithName(nestedField, name); if (subField != null) { return subField.getStringValue(); } } <START> return ""; <END> }</code><technical_language>If change default of getValueAsString change this too</technical_language>

Target:
public static String getValueFromRowAsString(TelemetryBis.TelemetryField row, String name) { if (Objects.isNull(row) || Objects.isNull(name)) { return null; } for (TelemetryBis.TelemetryField nestedField : row.getFieldsList()) { TelemetryBis.TelemetryField subField = findFieldWithName(nestedField, name); if (subField != null) { return getStringValue(subField); } } return null; }
Source:
<code><START> public FeedbackResponseDetails getFeedbackResponseDetailsInstance(FeedbackQuestionDetails questionDetails, <END> String[] answer, Map<String, String[]> requestParameters, int questionIndx, int responseIndx) { FeedbackResponseDetails feedbackResponseDetails = null; switch (this) { case TEXT: feedbackResponseDetails = new FeedbackTextResponseDetails(); break; case MCQ: feedbackResponseDetails = new FeedbackMcqResponseDetails(); answer = appendOtherOptionFlagToAnswer(answer, requestParameters, questionIndx, responseIndx); break; case MSQ: feedbackResponseDetails = new FeedbackMsqResponseDetails(); break; case NUMSCALE: feedbackResponseDetails = new FeedbackNumericalScaleResponseDetails(); break; case CONSTSUM: feedbackResponseDetails = new FeedbackConstantSumResponseDetails(); break; case CONTRIB: feedbackResponseDetails = new FeedbackContributionResponseDetails(); break; case RUBRIC: feedbackResponseDetails = new FeedbackRubricResponseDetails(); break; default: Assumption.fail("Failed to instantiate Feedback*ResponseDetails instance for " + this.toString() + " question type."); return null; } try { feedbackResponseDetails.extractResponseDetails(this, questionDetails, answer); } catch (Exception e) { e.printStackTrace(); Utils.getLogger().warning("Failed to extract response details.\n" + e.toString()); return null; } return feedbackResponseDetails; }</code><technical_language>This method overloads getFeedbackResponseDetailsInstance, original getFeedbackResponseDetailsInstance is anymore? If case, remove it, update tests for test this instead</technical_language>

Target:
public FeedbackResponseDetails getFeedbackResponseDetailsInstance(FeedbackQuestionDetails questionDetails, String[] answer, Map<String, String[]> requestParameters, int questionIndx, int responseIndx) { FeedbackResponseDetails feedbackResponseDetails = null; switch (this) { case TEXT: feedbackResponseDetails = new FeedbackTextResponseDetails(); break; case MCQ: feedbackResponseDetails = new FeedbackMcqResponseDetails(); break; case MSQ: feedbackResponseDetails = new FeedbackMsqResponseDetails(); break; case NUMSCALE: feedbackResponseDetails = new FeedbackNumericalScaleResponseDetails(); break; case CONSTSUM: feedbackResponseDetails = new FeedbackConstantSumResponseDetails(); break; case CONTRIB: feedbackResponseDetails = new FeedbackContributionResponseDetails(); break; case RUBRIC: feedbackResponseDetails = new FeedbackRubricResponseDetails(); break; default: Assumption.fail("Failed to instantiate Feedback*ResponseDetails instance for " + this.toString() + " question type."); return null; } try { switch (this) { case MCQ: ((FeedbackMcqResponseDetails) feedbackResponseDetails).extractResponseDetails( this, questionDetails, answer, requestParameters, questionIndx, responseIndx); break; default: feedbackResponseDetails.extractResponseDetails(this, questionDetails, answer); } } catch (Exception e) { Utils.getLogger().warning("Failed to extract response details.\n" + e.toString()); return null; } return feedbackResponseDetails; }
Source:
<code>public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if(deploymentUnit.getParent() == null) { final EEResourceReferenceProcessorRegistry eeResourceReferenceProcessorRegistry = deploymentUnit.getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY); if (eeResourceReferenceProcessorRegistry != null) { final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); <START> if (eeModuleDescription != null && eeModuleDescription.getDefaultResourceJndiNames().getDataSource() != null) { <END> eeResourceReferenceProcessorRegistry.registerResourceReferenceProcessor(RESOURCE_REFERENCE_PROCESSOR); } } } }</code><technical_language>getJmsConnectionFactory()</technical_language>

Target:
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); if(deploymentUnit.getParent() == null) { final EEResourceReferenceProcessorRegistry eeResourceReferenceProcessorRegistry = deploymentUnit.getAttachment(Attachments.RESOURCE_REFERENCE_PROCESSOR_REGISTRY); if (eeResourceReferenceProcessorRegistry != null) { final EEModuleDescription eeModuleDescription = deploymentUnit.getAttachment(Attachments.EE_MODULE_DESCRIPTION); if (eeModuleDescription != null && eeModuleDescription.getDefaultResourceJndiNames().getJmsConnectionFactory() != null) { eeResourceReferenceProcessorRegistry.registerResourceReferenceProcessor(RESOURCE_REFERENCE_PROCESSOR); } } } }
Source:
<code>public FakeLLRealtimeSegmentDataManager(RealtimeSegmentZKMetadata segmentZKMetadata, TableConfig tableConfig, RealtimeTableDataManager realtimeTableDataManager, String resourceDataDir, Schema schema, LLCSegmentName llcSegmentName, Map<Integer, Semaphore> semaphoreMap, ServerMetrics serverMetrics) throws Exception { super(segmentZKMetadata, tableConfig, realtimeTableDataManager, resourceDataDir, new IndexLoadingConfig(makeInstanceDataManagerConfig(), tableConfig), schema, llcSegmentName, semaphoreMap.get(llcSegmentName.getPartitionId()), serverMetrics, <START> new PartitionUpsertMetadataManager("testTable", 0, Mockito.mock(ServerMetrics.class))); <END> _state = LLRealtimeSegmentDataManager.class.getDeclaredField("_state"); _state.setAccessible(true); _shouldStop = LLRealtimeSegmentDataManager.class.getDeclaredField("_shouldStop"); _shouldStop.setAccessible(true); _stopReason = LLRealtimeSegmentDataManager.class.getDeclaredField("_stopReason"); _stopReason.setAccessible(true); _semaphoreMap = semaphoreMap; _streamMsgOffsetFactory = LLRealtimeSegmentDataManager.class.getDeclaredField("_streamPartitionMsgOffsetFactory"); _streamMsgOffsetFactory.setAccessible(true); _streamMsgOffsetFactory.set(this, new LongMsgOffsetFactory()); }</code><technical_language>serverMetrics instead of mocking</technical_language>

Target:
public FakeLLRealtimeSegmentDataManager(RealtimeSegmentZKMetadata segmentZKMetadata, TableConfig tableConfig, RealtimeTableDataManager realtimeTableDataManager, String resourceDataDir, Schema schema, LLCSegmentName llcSegmentName, Map<Integer, Semaphore> semaphoreMap, ServerMetrics serverMetrics) throws Exception { super(segmentZKMetadata, tableConfig, realtimeTableDataManager, resourceDataDir, new IndexLoadingConfig(makeInstanceDataManagerConfig(), tableConfig), schema, llcSegmentName, semaphoreMap.get(llcSegmentName.getPartitionId()), serverMetrics, new PartitionUpsertMetadataManager("testTable_REALTIME", 0, serverMetrics)); _state = LLRealtimeSegmentDataManager.class.getDeclaredField("_state"); _state.setAccessible(true); _shouldStop = LLRealtimeSegmentDataManager.class.getDeclaredField("_shouldStop"); _shouldStop.setAccessible(true); _stopReason = LLRealtimeSegmentDataManager.class.getDeclaredField("_stopReason"); _stopReason.setAccessible(true); _semaphoreMap = semaphoreMap; _streamMsgOffsetFactory = LLRealtimeSegmentDataManager.class.getDeclaredField("_streamPartitionMsgOffsetFactory"); _streamMsgOffsetFactory.setAccessible(true); _streamMsgOffsetFactory.set(this, new LongMsgOffsetFactory()); }
Source:
<code>public void loadStatistics() throws IOException, ParseException { String statisticsFilePath = getConfiguration().getStatisticsFilePath(); if(statisticsFilePath != null && !statisticsFilePath.isEmpty()){ File statisticsFile = new File(statisticsFilePath); if(statisticsFile != null && statisticsFile.exists()){ loadStatistics(statisticsFile); } <START> } <END> }</code><technical_language>I gain in this - if is a problem file raises exception expected - this is silently ignoring problem logging anything. Change test I suggested instead of this check</technical_language>

Target:
public void loadStatistics() throws IOException, ParseException { String statisticsFilePath = getConfiguration().getStatisticsFilePath(); if(statisticsFilePath == null) { throw new IOException("Statistics File path not found"); } loadStatistics(new File(statisticsFilePath)); }
Source:
<code>public boolean visit(CssRule x, Context ctx) { List<CssProperty> properties = x.getProperties(); <START> Set<String> duplicatePropertyNames = new HashSet<>(); <END> Set<String> seenPropertyNames = new HashSet<>(); for (CssProperty cssProperty : properties) { String name = cssProperty.getName(); if(!seenPropertyNames.contains(name)) { seenPropertyNames.add(name); } else { duplicatePropertyNames.add(name); } } for (String dupName : duplicatePropertyNames) { boolean firstProperty = true; for (CssProperty cssProperty : properties) { String name = cssProperty.getName(); if(name.equals(dupName)) { if(firstProperty) { firstProperty = false; } else { cssProperty.setName(" " + name); } } } } return false; }</code><technical_language>Java7 feature build fails. I for GWT source code,</technical_language>

Target:
public boolean visit(CssRule x, Context ctx) { List<CssProperty> properties = x.getProperties(); Set<String> duplicatePropertyNames = new HashSet<String>(); Set<String> seenPropertyNames = new HashSet<String>(); for (CssProperty cssProperty : properties) { String name = cssProperty.getName(); if(!seenPropertyNames.contains(name)) { seenPropertyNames.add(name); } else { duplicatePropertyNames.add(name); } } for (String dupName : duplicatePropertyNames) { boolean firstProperty = true; for (CssProperty cssProperty : properties) { String name = cssProperty.getName(); if(name.equals(dupName)) { if(firstProperty) { firstProperty = false; } else { cssProperty.setName(" " + name); } } } } return false; }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; <START> Header header = (Header) o; <END> return fileLength == header.fileLength && totalNumberOfRecords == header.totalNumberOfRecords && granularity == header.granularity && Arrays.equals(md5, header.md5) && Arrays.equals(uuid, header.uuid); }</code><technical_language>final</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final Header header = (Header) o; return fileLength == header.fileLength && totalNumberOfRecords == header.totalNumberOfRecords && granularity == header.granularity && Arrays.equals(md5, header.md5) && Arrays.equals(uuid, header.uuid); }
Source:
<code>public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { getPreferenceManager().setSharedPreferencesName(ADMIN_PREFERENCES); setPreferencesFromResource(R.xml.admin_preferences, rootKey); <START> ((CollectAbstractActivity) getActivity()).initToolbar(getPreferenceScreen().getTitle()); <END> findPreference("odk_preferences").setOnPreferenceClickListener(this); findPreference(KEY_CHANGE_ADMIN_PASSWORD).setOnPreferenceClickListener(this); findPreference(KEY_IMPORT_SETTINGS).setOnPreferenceClickListener(this); findPreference("main_menu").setOnPreferenceClickListener(this); findPreference("user_settings").setOnPreferenceClickListener(this); findPreference("form_entry").setOnPreferenceClickListener(this); findPreference("save_legacy_settings").setOnPreferenceClickListener(this); }</code><technical_language>do a conditional cast in BasePreferencesFragment</technical_language>

Target:
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { getPreferenceManager().setSharedPreferencesName(ADMIN_PREFERENCES); setPreferencesFromResource(R.xml.admin_preferences, rootKey); findPreference("odk_preferences").setOnPreferenceClickListener(this); findPreference(KEY_CHANGE_ADMIN_PASSWORD).setOnPreferenceClickListener(this); findPreference(KEY_IMPORT_SETTINGS).setOnPreferenceClickListener(this); findPreference("main_menu").setOnPreferenceClickListener(this); findPreference("user_settings").setOnPreferenceClickListener(this); findPreference("form_entry").setOnPreferenceClickListener(this); findPreference("save_legacy_settings").setOnPreferenceClickListener(this); }
Source:
<code>public BooleanWrapper shutdown(boolean preempt) { if (toShutDown) return new BooleanWrapper(false); logger.info("RMCore shutdown request"); this.monitoring.rmEvent(new RMEvent(RMEventType.SHUTTING_DOWN)); this.toShutDown = true; if (PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean() || this.deployedNodeSources.size() == 0) { finalizeShutdown(); } else { for (Entry<String, NodeSource> entry : this.deployedNodeSources.entrySet()) { removeAllNodes(entry.getKey(), preempt, true); entry.getValue().shutdown(caller); } <START> <END> boolean atLeastOneAlive = false; int millisBeforeHardShutdown = 0; do { millisBeforeHardShutdown++; try { Thread.sleep(100); } catch (InterruptedException e) { logger.warn("", e); } for (Entry<String, NodeSource> entry : this.deployedNodeSources.entrySet()) { atLeastOneAlive = atLeastOneAlive || PAActiveObject.pingActiveObject(entry.getValue()); } } while (atLeastOneAlive && millisBeforeHardShutdown < PAResourceManagerProperties.RM_SHUTDOWN_TIMEOUT.getValueAsInt()); finalizeShutdown(); } return new BooleanWrapper(true); }</code><technical_language>extract wait logic in a dedicated method</technical_language>

Target:
public BooleanWrapper shutdown(boolean preempt) { if (toShutDown) return new BooleanWrapper(false); logger.info("RMCore shutdown request"); this.monitoring.rmEvent(new RMEvent(RMEventType.SHUTTING_DOWN)); this.toShutDown = true; if (PAResourceManagerProperties.RM_PRESERVE_NODES_ON_SHUTDOWN.getValueAsBoolean() || this.deployedNodeSources.size() == 0) { finalizeShutdown(); } else { for (Entry<String, NodeSource> entry : this.deployedNodeSources.entrySet()) { removeAllNodes(entry.getKey(), preempt, true); entry.getValue().shutdown(caller); } waitForAllNodeSourcesToBeShutdown(); finalizeShutdown(); } return new BooleanWrapper(true); }
Source:
<code>public boolean requestRouteToHostAddress(int networkType, String hostAddress) { enforceChangePermission(); if (!ConnectivityManager.isNetworkTypeValid(networkType)) { return false; } NetworkStateTracker tracker = mNetTrackers[networkType]; <START> if (!tracker.getNetworkInfo().isConnected() || tracker.isTeardownRequested()) { <END> if (DBG) { Slog.d(TAG, "requestRouteToHostAddress on down network " + "(" + networkType + ") - dropped"); } return false; } try { InetAddress inetAddress = InetAddress.getByName(hostAddress); return tracker.requestRouteToHost(inetAddress); } catch (UnknownHostException e) { return false; } }</code><technical_language>add check for tracker==null get NPE try unprovisioned network (ie try for wifi a device wifi)</technical_language>

Target:
public boolean requestRouteToHostAddress(int networkType, String hostAddress) { enforceChangePermission(); if (!ConnectivityManager.isNetworkTypeValid(networkType)) { return false; } NetworkStateTracker tracker = mNetTrackers[networkType]; if (tracker == null || !tracker.getNetworkInfo().isConnected() || tracker.isTeardownRequested()) { if (DBG) { Slog.d(TAG, "requestRouteToHostAddress on down network " + "(" + networkType + ") - dropped"); } return false; } try { InetAddress inetAddress = InetAddress.getByName(hostAddress); return tracker.requestRouteToHost(inetAddress); } catch (UnknownHostException e) { return false; } }
Source:
<code>public void nullToString() { try { assertEquals(new NullToString(), new NullToString()); } catch (AssertionError e) { assertEquals("expected: org.junit.tests.assertion.AssertionTest$NullToString<null> but " + "was: org.junit.tests.assertion.AssertionTest$NullToString<null>", e.getMessage()); return; } <START> fail("Failed on assertion."); <END> }</code><technical_language>do need this fail statement</technical_language>

Target:
public void nullToString() { try { assertEquals(new NullToString(), new NullToString()); } catch (AssertionError e) { assertEquals("expected: org.junit.tests.assertion.AssertionTest$NullToString<null> but " + "was: org.junit.tests.assertion.AssertionTest$NullToString<null>", e.getMessage()); return; } fail("AssertionError expected"); }
Source:
<code>public void _provlar(CommandInterpreter interpreter) { String urlString = processArgument(interpreter.nextArgument()); if (urlString == null) { URI[] repositories = ProvisioningHelper.getArtifactRepositories(agent); if (repositories == null) return; for (URI <START> repositorie : <END> repositories) { interpreter.println(repositorie); } return; } URI repoURL = toURI(interpreter, urlString); if (repoURL == null) return; IArtifactRepository repo = ProvisioningHelper.getArtifactRepository(agent, repoURL); IQueryResult<IArtifactKey> keys = null; try { keys = (repo != null) ? repo.query(ArtifactKeyQuery.ALL_KEYS, null) : null; } catch (UnsupportedOperationException e) { interpreter.println("Repository does not support queries."); return; } if (keys == null || keys.isEmpty()) { interpreter.println("Repository has no artifacts"); return; } IFileArtifactRepository fileRepo = repo.getAdapter(IFileArtifactRepository.class); for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) { IArtifactKey key = iterator.next(); IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(key); for (IArtifactDescriptor descriptor : descriptors) { File location = null; if (fileRepo != null) location = fileRepo.getArtifactFile(descriptor); println(interpreter, key, location); } } }</code><technical_language>repository is proper name</technical_language>

Target:
public void _provlar(CommandInterpreter interpreter) { String urlString = processArgument(interpreter.nextArgument()); if (urlString == null) { URI[] repositories = ProvisioningHelper.getArtifactRepositories(agent); if (repositories == null) return; for (URI repository : repositories) { interpreter.println(repository); } return; } URI repoURL = toURI(interpreter, urlString); if (repoURL == null) return; IArtifactRepository repo = ProvisioningHelper.getArtifactRepository(agent, repoURL); IQueryResult<IArtifactKey> keys = null; try { keys = (repo != null) ? repo.query(ArtifactKeyQuery.ALL_KEYS, null) : null; } catch (UnsupportedOperationException e) { interpreter.println("Repository does not support queries."); return; } if (keys == null || keys.isEmpty()) { interpreter.println("Repository has no artifacts"); return; } IFileArtifactRepository fileRepo = repo.getAdapter(IFileArtifactRepository.class); for (IArtifactKey key : keys) { IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(key); for (IArtifactDescriptor descriptor : descriptors) { File location = null; if (fileRepo != null) location = fileRepo.getArtifactFile(descriptor); println(interpreter, key, location); } } }
Source:
<code>public MessageCodec<?> find(int opcode) { <START> if (opcode < 0 || opcode > opcodeTable.length + 1) { <END> throw new IllegalArgumentException("Opcode " + opcode + " is out of bounds"); } return opcodeTable[opcode]; }</code><technical_language>if (opcode < 0 || opcode >= opcodeTable.length) { remove TODO</technical_language>

Target:
public MessageCodec<?> find(int opcode) { if (opcode < 0 || opcode >= opcodeTable.length) { throw new IllegalArgumentException("Opcode " + opcode + " is out of bounds"); } return opcodeTable[opcode]; }
Source:
<code>public <T> T readValue(@Nonnull final IMAPResponse[] content, @Nonnull final Class<T> valueType) throws ImapAsyncClientException, <START> ProtocolException { <END> if (valueType == Capability.class) { return (T) parser.parseToCapabilities(content); } if (valueType == AppendUID.class) { return (T) parser.parseToAppendUid(content); } if (valueType == CopyUID.class) { return (T) parser.parseToCopyUid(content); } if (valueType == ExtensionMailboxInfo.class) { return (T) parser.parseToExtensionMailboxInfo(content); } if (valueType == MailboxInfo.class) { return (T) parser.parseToMailboxInfo(content); } if (valueType == ListInfoList.class) { return (T) parser.parseToListInfoList(content); } if (valueType == Status.class) { return (T) parser.parseToStatus(content); } if (valueType == IdResult.class) { return (T) parser.parseToIdResult(content); } if (valueType == SearchResult.class) { return (T) parser.parseToSearchResult(content); } return readValue(content, valueType, EMPTY_FETCH_ITEMS); }</code><technical_language>ParsingException</technical_language>

Target:
public <T> T readValue(@Nonnull final IMAPResponse[] content, @Nonnull final Class<T> valueType) throws ImapAsyncClientException, ParsingException { if (valueType == Capability.class) { return (T) parser.parseToCapabilities(content); } if (valueType == AppendUID.class) { return (T) parser.parseToAppendUid(content); } if (valueType == CopyUID.class) { return (T) parser.parseToCopyUid(content); } if (valueType == ExtensionMailboxInfo.class) { return (T) parser.parseToExtensionMailboxInfo(content); } if (valueType == MailboxInfo.class) { return (T) parser.parseToMailboxInfo(content); } if (valueType == ListInfoList.class) { return (T) parser.parseToListInfoList(content); } if (valueType == Status.class) { return (T) parser.parseToStatus(content); } if (valueType == IdResult.class) { return (T) parser.parseToIdResult(content); } if (valueType == SearchResult.class) { return (T) parser.parseToSearchResult(content); } if (valueType == FetchResult.class) { return (T) parser.parseToFetchResult(content, new FetchItem[0]); } if (valueType == StoreResult.class) { return (T) parser.parseToStoreResult(content); } throw new ImapAsyncClientException(FailureType.UNKNOWN_PARSE_RESULT_TYPE); }