auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testGetNoMappingExists() { ServerStore store = newStore(); Chain chain = store.get(1); <START> assertThat(chain.isEmpty(), is(true)); <END> }</code><technical_language>want assert behavior of iterator</technical_language>

Target:
public void testGetNoMappingExists() { ServerStore store = newStore(); Chain chain = store.get(1); assertThat(chain.isEmpty(), is(true)); assertThat(chain.iterator().hasNext(), is(false)); }
Source:
<code>public void onCatch(Throwable caught) { if (Utils.throwableContainsSpecificType(caught, SSLException.class) && WikipediaApp.getInstance().incSslFailCount() < 2) { WikipediaApp.getInstance().setSslFallback(true); <START> NetworkUtils.toastFail(); <END> cancel(); return; } throw new RuntimeException(caught); }</code><technical_language>SaneAsyncTask networking. ApiTask instead</technical_language>

Target:
public void onCatch(Throwable caught) { }
Source:
<code>private Container decorateMainContainer(Container container) { <START> VolumeMount[] volumeMounts = kubernetesComponentConf <END> .getSecretNamesToMountPaths() .entrySet() .stream() .map(secretNameToPath -> new VolumeMountBuilder() .withName(secretVolumeName(secretNameToPath.getKey())) .withMountPath(secretNameToPath.getValue()) .build() ).toArray(VolumeMount[]::new); return new ContainerBuilder(container) .addToVolumeMounts(volumeMounts) .build(); }</code><technical_language>suggestion final VolumeMount[] volumeMounts = kubernetesComponentConf</technical_language>

Target:
private Container decorateMainContainer(Container container) { final VolumeMount[] volumeMounts = kubernetesComponentConf.getSecretNamesToMountPaths().entrySet().stream() .map(secretNameToPath -> new VolumeMountBuilder() .withName(secretVolumeName(secretNameToPath.getKey())) .withMountPath(secretNameToPath.getValue()) .build() ) .toArray(VolumeMount[]::new); return new ContainerBuilder(container) .addToVolumeMounts(volumeMounts) .build(); }
Source:
<code>public FileHandler getFileHandler(ConnectionConfiguration connectionConfig) throws IOException { FileHandler handler = null; boolean isLocal = isLocal(connectionConfig.getHostname()); if (isLocal) { handler = new LocalFileHandler(); } else { handler = new RemoteFileHandler(); <START> ((RemoteFileHandler) handler).setConnectionConfiguration(connectionConfig); <END> } return handler; }</code><technical_language>Type casting avoided indicative of a problem model. passing configuration constructor?</technical_language>

Target:
public FileHandler getFileHandler(ConnectionConfiguration connectionConfig) throws IOException { FileHandler handler = null; boolean isLocal = isLocal(connectionConfig.getAuthorization().getHostname()); if (isLocal) { handler = new LocalFileHandler(); } else { RemoteFileHandler remoteHandler = new RemoteFileHandler(); remoteHandler.setConnectionConfiguration(connectionConfig); handler = remoteHandler; } return handler; }
Source:
<code>public void updateAuthenticationItems(AuthenticationItems items) throws IOException { MergePropertiesContext mergePropertiesContext = authenticationProvidersRegistry.mergeProperties(); for (AuthenticationItem item : items.getAuthenticationItemList()) { Map<String, Object> properties = authenticationProvidersRegistry.getAuthenticationProperties(item.getName()); properties.put("order", item.getOrder()); <START> properties.put(Properties.ENABLED, Boolean.TRUE.equals(item.getEnabled())); <END> mergePropertiesContext = mergePropertiesContext.merge(item.getName(), properties); } boolean result = mergePropertiesContext.apply(); if (!result) { return; } reloadAuthenticationItems(); }</code><technical_language>@liooh please double check Properties usage ensure for domain model related places</technical_language>

Target:
public void updateAuthenticationItems(AuthenticationItems items) throws IOException { MergePropertiesContext mergePropertiesContext = authenticationProvidersRegistry.mergeProperties(); for (AuthenticationItem item : items.getAuthenticationItemList()) { Map<String, Object> properties = authenticationProvidersRegistry.getAuthenticationProperties(item.getName()); properties.put("order", item.getOrder()); properties.put("enabled", Boolean.TRUE.equals(item.getEnabled())); mergePropertiesContext = mergePropertiesContext.merge(item.getName(), properties); } boolean result = mergePropertiesContext.apply(); if (!result) { return; } reloadAuthenticationItems(); }
Source:
<code><START> private ReflectionUtil () <END></code><technical_language>indentation is right</technical_language>

Target:
private ReflectionUtil() { throw new UnsupportedOperationException("no instantiation"); }
Source:
<code>private void tryInitialize() { TableMetadata scrubTableMeta = TableMetadata.internal() .rowMetadata(NameMetadataDescription.create("row", ValueType.BLOB)) <START> .columns(new ColumnMetadataDescription(new DynamicColumnDescription( <END> NameMetadataDescription.create( ImmutableList.of( NameComponentDescription.of("table", ValueType.VAR_STRING), NameComponentDescription.of("col", ValueType.BLOB))), ColumnValueDescription.forType(ValueType.VAR_LONG)))) .build(); keyValueService.createTable(AtlasDbConstants.SCRUB_TABLE, scrubTableMeta.persistToBytes()); }</code><technical_language>want utility methods defined</technical_language>

Target:
private void tryInitialize() { TableMetadata scrubTableMeta = TableMetadata.internal() .singleRowComponent("row", ValueType.BLOB) .dynamicColumns(ImmutableList.of( NameComponentDescription.of("table", ValueType.VAR_STRING), NameComponentDescription.of("col", ValueType.BLOB)), ValueType.VAR_LONG) .build(); keyValueService.createTable(AtlasDbConstants.SCRUB_TABLE, scrubTableMeta.persistToBytes()); }
Source:
<code>public void listNamespaces() { try { System.out.println("Listing all default namespaces..."); String nss = client.listNamespaces(storename, true); Assert.assertNotNull(nss); for (String ns : nss) { System.out.println("Namespace (global): " + ns); listNamespaceKeys(storename, ns, true); client.fetchAllNSKeys(storename,ns,true); } nss = client.listNamespaces(storename, false); Assert.assertNotNull(nss); for (String ns : nss) { System.out.println("Namespace (user): " + ns); listNamespaceKeys(storename, ns, false); client.fetchAllNSKeys(storename, ns,false); } } catch (Exception e) { Assert.fail(e.getLocalizedMessage()); } catch (ArrayOfEspExceptionWrapper e) { e.toString(); <START> Assert.fail(); <END> } }</code><technical_language>question</technical_language>

Target:
public void listNamespaces() { try { System.out.println("Listing all default namespaces..."); String nss = client.listNamespaces(storename, true); Assert.assertNotNull(nss); for (String ns : nss) { System.out.println("Namespace (global): " + ns); listNamespaceKeys(storename, ns, true); client.fetchAllNSKeys(storename,ns,true); } nss = client.listNamespaces(storename, false); Assert.assertNotNull(nss); for (String ns : nss) { System.out.println("Namespace (user): " + ns); listNamespaceKeys(storename, ns, false); client.fetchAllNSKeys(storename, ns,false); } } catch (Exception e) { Assert.fail(e.getLocalizedMessage()); } catch (ArrayOfEspExceptionWrapper e) { Assert.fail(e.toString()); } }
Source:
<code>public static boolean hasContentType(IFile resource, String contentTypeId) { <START> IContentTypeManager ctManager = Platform.getContentTypeManager(); <END> IContentType expected = ctManager.getContentType(contentTypeId); if (expected == null) { return false; } InputStream resourceContent = null; IContentType[] contentTypes = null; try { resourceContent = resource.getContents(); contentTypes = ctManager.findContentTypesFor(resourceContent, resource.getName()); } catch (CoreException e) { ctManager.findContentTypesFor(resource.getName()); } catch (IOException e) { ctManager.findContentTypesFor(resource.getName()); } finally { if (resourceContent != null) { try { resourceContent.close(); } catch (IOException e) { } } } boolean hasContentType = false; if (contentTypes != null) { for (int i = 0; i < contentTypes.length && !hasContentType; i++) { if (contentTypes[i].isKindOf(expected)) { hasContentType = true; } } } return hasContentType; }</code><technical_language>I extract logic get of content types of IFile in a separate private static method (and return empty array if content type instead of null ContentTypeManager do)</technical_language>

Target:
public static boolean hasContentType(IFile resource, String contentTypeId) { IContentTypeManager ctManager = Platform.getContentTypeManager(); IContentType expected = ctManager.getContentType(contentTypeId); if (expected == null) { return false; } final IContentType[] contentTypes = getContentTypes(resource); boolean hasContentType = false; for (int i = 0; i < contentTypes.length && !hasContentType; i++) { if (contentTypes[i].isKindOf(expected)) { hasContentType = true; } } return hasContentType; }
Source:
<code>public void reportStageProgress(String stageName, String metricName, long count) throws SemanticException { if (isEnabled) { Progress progress = replicationMetric.getProgress(); Stage stage = progress.getStageByName(stageName); Metric metric = stage.getMetricByName(metricName); metric.setCurrentCount(metric.getCurrentCount() + count); if (metric.getCurrentCount() > metric.getTotalCount()) { metric.setTotalCount(metric.getCurrentCount()); } stage.addMetric(metric); <START> progress.addStage(stage); <END> replicationMetric.setProgress(progress); metricCollector.addMetric(replicationMetric); } }</code><technical_language>progress.addStage() is required, progress it</technical_language>

Target:
public void reportStageProgress(String stageName, String metricName, long count) throws SemanticException { if (isEnabled) { Progress progress = replicationMetric.getProgress(); Stage stage = progress.getStageByName(stageName); Metric metric = stage.getMetricByName(metricName); metric.setCurrentCount(metric.getCurrentCount() + count); if (metric.getCurrentCount() > metric.getTotalCount()) { metric.setTotalCount(metric.getCurrentCount()); } stage.addMetric(metric); replicationMetric.setProgress(progress); metricCollector.addMetric(replicationMetric); } }
Source:
<code>public int setTabIndexes(int nextTabIndex) { <START> certificateAuthority.setTabIndex(++nextTabIndex); prometheusUrl.setTabIndex(++nextTabIndex); prometheusCertificateAuthority.setTabIndex(++nextTabIndex); <END> return nextTabIndex; }</code><technical_language>Please change incrementing index (nextTabIndex++) instead of (++nextTabIndex) for 3 lines, need click tab field get next one</technical_language>

Target:
public int setTabIndexes(int nextTabIndex) { certificateAuthority.setTabIndex(nextTabIndex++); prometheusUrl.setTabIndex(nextTabIndex++); prometheusCertificateAuthority.setTabIndex(nextTabIndex++); return nextTabIndex; }
Source:
<code>public static void closeInputStream(InputStream inputStream) { <START> if (inputStream == null) return; <END> try { inputStream.close(); } catch (IOException e) { throw new UncheckedIOException(e); } }</code><technical_language>This is breaking existing conventions allowing nulls. If receive null inputstream throw error here. avoid them, change calling site, utility methods, operate narrow set of constraints. suggestion</technical_language>

Target:
public static void closeInputStream(InputStream inputStream) { try { inputStream.close(); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public void shutdown_should_deregister_mbean_when_enabled() throws Exception { options.setJmx(true); Agent agent = createAgent(); agent.startup(); agent.shutdown(); ObjectName objectName = new ObjectName("org.jacoco:type=Runtime"); <START> ManagementFactory.getPlatformMBeanServer().getMBeanInfo(objectName); <END> }</code><technical_language>Combine startup_should_register_mbean_when_enabled</technical_language>

Target:
public void shutdown_should_deregister_mbean_when_enabled() throws Exception { options.setJmx(true); Agent agent = createAgent(); agent.startup(); agent.shutdown(); ObjectName objectName = new ObjectName("org.jacoco:type=Runtime"); try { ManagementFactory.getPlatformMBeanServer().getMBeanInfo(objectName); fail("InstanceNotFoundException expected"); } catch (InstanceNotFoundException e) { } }
Source:
<code>private GlusterBrickEntity getBrick(List<GlusterBrickEntity> bricksList, String qualifiedBrickName) { String[] pathElements = qualifiedBrickName.split(StorageConstants.GLUSTER_VOL_SEPARATOR); String hostName = pathElements[0]; String hostAddress; try { hostAddress = InetAddress.getByName(hostName).getHostAddress(); } catch (UnknownHostException e) { return null; <START> } <END> for (GlusterBrickEntity brick : bricksList) { VDS vds = getVdsDao().get(brick.getServerId()); for (VdsNetworkInterface vdsNi : getInterfaceDao().getAllInterfacesForVds(vds.getId())) { if (vdsNi.getIpv4Address().equals(hostAddress) || vdsNi.getIpv6Address().equals(hostAddress)) { return brick; } } } return null; }</code><technical_language>host address, change brick name hostAddress:/path - GlusterCoreUtil.getBrickByQualifiedName interfaces mapping again. getBrickByQualifiedName gluster network address match, do need retrieve NetworkInterface list</technical_language>

Target:
private GlusterBrickEntity getBrick(List<GlusterBrickEntity> bricksList, String qualifiedBrickName) { GlusterBrickEntity brick = GlusterCoreUtil.getBrickByQualifiedName(bricksList, qualifiedBrickName); if (brick == null) { String[] pathElements = qualifiedBrickName.split(StorageConstants.GLUSTER_VOL_SEPARATOR); String hostName = pathElements[0]; String hostAddress; try { hostAddress = InetAddress.getByName(hostName).getHostAddress(); } catch (UnknownHostException e) { return null; } qualifiedBrickName = hostAddress + StorageConstants.GLUSTER_VOL_SEPARATOR + pathElements[1]; return GlusterCoreUtil.getBrickByQualifiedName(bricksList, qualifiedBrickName); } return brick; }
Source:
<code>private Change.Id insertPatchSet(Repository git, RevWalk revWalk, Change change, PatchSet.Id patchSetId, RevCommit cherryPickCommit, RefControl refControl) throws InvalidChangeOperationException, IOException, OrmException, NoSuchChangeException { final PatchSetInserter inserter = patchSetInserterFactory .create(git, revWalk, refControl, currentUser, change, cherryPickCommit); <START> final PatchSet.Id newPatchSetId = inserter.getPatchSetId(); ChangeMessage cmsg = new ChangeMessage(new ChangeMessage.Key(patchSetId.getParentKey(), ChangeUtil.messageUUID(db)), currentUser.getAccountId(), newPatchSetId); cmsg.setMessage("Uploaded patch set " + newPatchSetId.get() + "."); <END> inserter .setMessage(cmsg) .insert(); return change.getId(); }</code><technical_language>PatchSetInserter a setMessage(String) version vastly simplify this code. Please it</technical_language>

Target:
private Change.Id insertPatchSet(Repository git, RevWalk revWalk, Change change, PatchSet.Id patchSetId, RevCommit cherryPickCommit, RefControl refControl) throws InvalidChangeOperationException, IOException, OrmException, NoSuchChangeException { final PatchSetInserter inserter = patchSetInserterFactory .create(git, revWalk, refControl, currentUser, change, cherryPickCommit); final PatchSet.Id newPatchSetId = inserter.getPatchSetId(); inserter .setMessage("Uploaded patch set " + newPatchSetId.get() + ".") .insert(); return change.getId(); }
Source:
<code>public void onSaveInstanceState(Bundle outState) { Log_OC.d(SAML_DIALOG_TAG, "onSaveInstanceState being CALLED"); super.onSaveInstanceState(outState); outState.putString(ARG_INITIAL_URL, mInitialUrl); outState.putString(ARG_TARGET_URL, mTargetUrl); Bundle webviewState = new Bundle(); <START> ((WebView) getDialog().findViewById(R.id.sso_webview)).saveState(webviewState); <END> outState.putBundle(KEY_WEBVIEW_STATE, webviewState); }</code><technical_language>If ssoWebView is a global variable is necessary for webview reference in mSsoWebView</technical_language>

Target:
public void onSaveInstanceState(Bundle outState) { Log_OC.d(SAML_DIALOG_TAG, "onSaveInstanceState being CALLED"); super.onSaveInstanceState(outState); outState.putString(ARG_INITIAL_URL, mInitialUrl); outState.putString(ARG_TARGET_URL, mTargetUrl); Bundle webviewState = new Bundle(); mSsoWebView.saveState(webviewState); outState.putBundle(KEY_WEBVIEW_STATE, webviewState); }
Source:
<code>public void testUserPage() { RuntimeEnvironment instance = RuntimeEnvironment.getInstance(); String page = null; <START> assertNull(instance.getUserPage()); <END> }</code><technical_language>this work. is this change necessary</technical_language>

Target:
public void testUserPage() { RuntimeEnvironment instance = RuntimeEnvironment.getInstance(); String page = "<LINK_0>"; assertNull(instance.getUserPage()); instance.setUserPage(page); assertEquals(page, instance.getUserPage()); }
Source:
<code>private static Directive parseLine(String line, int lineNumber) { int equalSignIndex = 0; boolean insideString = false; boolean afterBackSlash = false; int i = 0; <START> for (; i < line.length(); i++) { <END> char c = line.charAt(i); if (c == '=') { equalSignIndex = i; } if (c == ';' && !insideString) { break; } if (c == '"' && !afterBackSlash) { insideString = !insideString; } afterBackSlash = c == '\\'; } String name = line.substring(0, equalSignIndex); if (name.isEmpty()) { return null; } String value = line.substring(equalSignIndex + 1, i); return new DirectiveImpl(lineNumber, name, value); }</code><technical_language>@pynicolas imo while rename i currentIndex (but imo :))</technical_language>

Target:
private static Directive parseLine(String line, int lineNumber) { int equalSignIndex = -1; boolean insideString = false; boolean afterBackSlash = false; int currentCharIndex = 0; while (currentCharIndex < line.length()) { char currentChar = line.charAt(currentCharIndex); if (!insideString) { if (currentChar == '=') { checkState(equalSignIndex < 0, lineNumber, line); equalSignIndex = currentCharIndex; } if (currentChar == ';') { break; } } if (currentChar == '"' && !afterBackSlash) { insideString = !insideString; } afterBackSlash = currentChar == '\\'; currentCharIndex++; } return createDirective(line, lineNumber, equalSignIndex, currentCharIndex); }
Source:
<code><START> public static String getWarningMessages(String filename){ <END> String warningMessage = ""; if (getErrorMessage(filename).length() == 0 && filename.length() > 0) { if (!filename.matches("[A-Za-z][A-Za-z0-9_]*")) { String errorMessage = MESSAGES.whitespaceProjectNameError(); filename = filename.replaceAll("( )+", " ").replace(" ","_"); warningMessage = errorMessage + ". \n '" + filename + "' will be used if continued."; } } return warningMessage; }</code><technical_language>Missed a space ) {</technical_language>

Target:
public static String getWarningMessages(String filename) { String warningMessage = ""; if (getErrorMessage(filename).length() == 0 && filename.trim().length() > 0) { if (!filename.matches("[A-Za-z][A-Za-z0-9_]*")) { String errorMessage = MESSAGES.whitespaceProjectNameError(); filename = filename.trim().replaceAll("( )+", " ").replace(" ","_"); warningMessage = errorMessage + ". \n '" + filename + "' will be used if continued."; } } return warningMessage; }
Source:
<code><START> protected void <END> setUp() throws Exception { refreshPolicy(Policy.getPolicy()); System.setSecurityManager(new SecurityManager()); Appender appender = new WriterAppender( new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN), errorOutputWriter); org.apache.log4j.Logger.getRootLogger().addAppender(appender); super.setUp(); }</code><technical_language>setup method needs JUnit annotation @Before protected public</technical_language>

Target:
public void setUp() throws Exception { refreshPolicy(Policy.getPolicy()); System.setSecurityManager(new SecurityManager()); appender = new WriterAppender( new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN), errorOutputWriter); org.apache.log4j.Logger.getRootLogger().addAppender(appender); super.setUp(); }
Source:
<code>public ArchiveCommand setTree(ObjectId tree) throws IOException { <START> final RevWalk rw = new RevWalk(repo); <END> walk.reset(rw.parseTree(tree)); return this; }</code><technical_language>need release a RevWalk instance Inflater of ObjectReader is recycled freed</technical_language>

Target:
public ArchiveCommand setTree(ObjectId tree) throws IOException { final RevWalk rw = new RevWalk(repo); try { walk.reset(rw.parseTree(tree)); } finally { rw.release(); } return this; }
Source:
<code><START> public static void addToVisitedProcessors(String item) { <END> visitedProcessors.add(item); }</code><technical_language>this synchronized</technical_language>

Target:
public static synchronized void addToVisitedProcessors(String item) { visitedProcessors.add(item); }
Source:
<code>public IntermediateResultPartitionID() { this.partitionNum = -1; <START> this.intermediateDataSetID = new IntermediateDataSetID(new AbstractID()); <END> }</code><technical_language>IntermediateDataSetID a param-less ctor I think</technical_language>

Target:
public IntermediateResultPartitionID() { this.partitionNum = -1; this.intermediateDataSetID = new IntermediateDataSetID(); }
Source:
<code>private Double interpretOperatorCompare(Object left, Object right) { try { Double tempLeft = Double.valueOf(String.valueOf(left)); Double tempRight = Double.valueOf(String.valueOf(right)); int compareResult = getCompareResult(tempLeft, tempRight); if (compareResult < 0) { return 1d; } else if (compareResult > 0) { return 2d; } return 0d; } catch (NumberFormatException numberFormatException) { int compareResult = String.valueOf(left).toLowerCase().compareTo(String.valueOf(right).toLowerCase()); if (compareResult < 0) { return 1d; } else if (compareResult >0){ return 2d; <START> } <END> return 0d; } }</code><technical_language>Please change return type int return * 0 if left is equal right; * a 0 if left is right; * a greater 0 if left is greater right. This is default definition of compare methods</technical_language>

Target:
private int interpretOperatorCompare(Object left, Object right) { try { if(Math.abs(Double.valueOf(String.valueOf(left))) == 0 && Math.abs(Double.valueOf(String.valueOf(right))) == 0) return 0; return (Double.valueOf(String.valueOf(left))).compareTo(Double.valueOf(String.valueOf(right))); } catch (NumberFormatException numberFormatException) { return String.valueOf(left).toLowerCase().compareTo(String.valueOf(right).toLowerCase()); } }
Source:
<code>public static TLSSocketChannel create( ByteChannel channel, Logger logger, SSLEngine sslEngine ) throws IOException { TLSSocketChannel tlsChannel = new TLSSocketChannel( channel, logger, sslEngine ); try { tlsChannel.runHandshake(); } catch ( SSLHandshakeException e ) { <START> throw new UnauthorizedException( "Failed to establish secured connection with the server: " + e.getMessage(), e ); <END> } return tlsChannel; }</code><technical_language>reuse UnauthorizedException for TLS handshake failure for actual login failure. Python driver ServiceUnavailable right either. separate SecurityLayerUnavailable</technical_language>

Target:
public static TLSSocketChannel create( ByteChannel channel, Logger logger, SSLEngine sslEngine ) throws IOException { TLSSocketChannel tlsChannel = new TLSSocketChannel( channel, logger, sslEngine ); try { tlsChannel.runHandshake(); } catch ( SSLHandshakeException e ) { throw new SecurityException( "Failed to establish secured connection with the server: " + e.getMessage(), e ); } return tlsChannel; }
Source:
<code>private void refreshExecutors() { synchronized (activeExecutors) { ExecutorService taskExecutors = Executors.newFixedThreadPool(activeExecutors.size()); for (final Executor executor : activeExecutors) { taskExecutors.execute(new Runnable() { @Override public void run() { try { String jsonResponse = callExecutorForJsonString(executor.getHost(), executor.getPort(), "/serverstastics", null); executor.setExecutorInfo(ExecutorInfo .fromJSONString(jsonResponse)); } catch (Exception e) { logger.error("Failed to update ExecutorInfo executorId :" <START> + executor, e); <END> } } }); } taskExecutors.shutdown(); try { taskExecutors.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { logger.error("Timed out while waiting for executorInfo refresh", e); } } }</code><technical_language>executor.toString() writes out executor hostname id</technical_language>

Target:
private void refreshExecutors() { synchronized (activeExecutors) { List<Pair<Executor, Future<String>>> futures = new ArrayList<Pair<Executor, Future<String>>>(); for (final Executor executor : activeExecutors) { Future<String> fetchExecutionInfo = executorInforRefresherService.submit(new Callable<String>() { @Override public String call() throws Exception { return callExecutorForJsonString(executor.getHost(), executor.getPort(), "/serverstastics", null); } }); futures.add(new Pair<Executor, Future<String>>(executor, fetchExecutionInfo)); } boolean wasSuccess = true; for (Pair<Executor, Future<String>> refreshPair : futures) { Executor executor = refreshPair.getFirst(); try { String jsonString = refreshPair.getSecond().get(5, TimeUnit.SECONDS); executor.setExecutorInfo(ExecutorInfo.fromJSONString(jsonString)); logger.info("Successfully refreshed ExecutorInfo for executor: " + executor); } catch (TimeoutException e) { wasSuccess = false; logger.error("Timed out while waiting for ExecutorInfo refresh" + executor, e); } catch (Exception e) { wasSuccess = false; logger.error("Failed to update ExecutorInfo for executor : " + executor, e); } } if (wasSuccess) { lastSuccessfulExecutorInfoRefresh = System.currentTimeMillis(); } } }
Source:
<code>public void unhandledTypeMismatchExceptionCallbackSeverity() throws IllegalAccessException, NoSuchFieldException { Report report; Callback callback = new Callback() { @Override public void beforeNotify(Report report) { report.setSeverity(Severity.WARNING); } }; try { bugsnag.addCallback(callback); callUnhandledTypeMismatchExceptionEndpoint(); report = verifyAndGetReport(delivery); } finally { Field callbacksField = Configuration.class.getDeclaredField("callbacks"); <START> callbacksField.setAccessible(true); <END> @SuppressWarnings(value = "unchecked") Collection<Callback> callbacks = (Collection<Callback>) callbacksField.get(bugsnag.getConfig()); callbacks.remove(callback); } assertTrue(report.getUnhandled()); assertEquals("warning", report.getSeverity()); assertEquals("userCallbackSetSeverity", report.getSeverityReason().getType()); }</code><technical_language>is this change necessary</technical_language>

Target:
public void unhandledTypeMismatchExceptionCallbackSeverity() throws IllegalAccessException, NoSuchFieldException { Report report; Callback callback = new Callback() { @Override public void beforeNotify(Report report) { report.setSeverity(Severity.WARNING); } }; try { bugsnag.addCallback(callback); callUnhandledTypeMismatchExceptionEndpoint(); report = verifyAndGetReport(delivery); } finally { Field callbacksField = Configuration.class.getDeclaredField("callbacks"); @SuppressWarnings(value = "unchecked") Collection<Callback> callbacks = (Collection<Callback>) callbacksField.get(bugsnag.getConfig()); callbacks.remove(callback); } assertTrue(report.getUnhandled()); assertEquals("warning", report.getSeverity()); assertEquals("userCallbackSetSeverity", report.getSeverityReason().getType()); }
Source:
<code><START> private Subscription.State getEffectiveState(TopicName topicName, String subscriptionName) { <END> Set<Subscription.State> states = loadSubscriptionStatesFromAllDc(topicName, subscriptionName); if (states.contains(Subscription.State.ACTIVE)) { return Subscription.State.ACTIVE; } else if (states.contains(Subscription.State.SUSPENDED)) { return Subscription.State.SUSPENDED; } else { return Subscription.State.PENDING; } }</code><technical_language>logging a warning if set size is > 1 (which means is out of sync for this sub)</technical_language>

Target:
private Subscription.State getEffectiveState(TopicName topicName, String subscriptionName) { Set<Subscription.State> states = loadSubscriptionStatesFromAllDc(topicName, subscriptionName); if (states.size() > 1) { logger.warn("Some states are out of sync: {}", states); } if (states.contains(Subscription.State.ACTIVE)) { return Subscription.State.ACTIVE; } else if (states.contains(Subscription.State.SUSPENDED)) { return Subscription.State.SUSPENDED; } else { return Subscription.State.PENDING; } }
Source:
<code>public void testLastModifiedTime() throws IOException { AzureBlobFileSystem fs = this.getFileSystem(); Path testFilePath = new Path("childfile1.txt"); long createStartTime = System.currentTimeMillis(); fs.create(testFilePath); long createEndTime = System.currentTimeMillis(); FileStatus fStat = fs.getFileStatus(testFilePath); long lastModifiedTime = fStat.getModificationTime(); <START> assertTrue((createStartTime / 1000) * 1000 - 1 < lastModifiedTime); <END> assertTrue(createEndTime > lastModifiedTime); }</code><technical_language>assertion needs a message</technical_language>

Target:
public void testLastModifiedTime() throws IOException { AzureBlobFileSystem fs = this.getFileSystem(); Path testFilePath = new Path("childfile1.txt"); long createStartTime = System.currentTimeMillis(); long minCreateStartTime = (createStartTime / 1000) * 1000 - 1; fs.create(testFilePath); long createEndTime = System.currentTimeMillis(); FileStatus fStat = fs.getFileStatus(testFilePath); long lastModifiedTime = fStat.getModificationTime(); assertTrue("lastModifiedTime should be after minCreateStartTime", minCreateStartTime < lastModifiedTime); assertTrue("lastModifiedTime should be before createEndTime", createEndTime > lastModifiedTime); }
Source:
<code>private void loadLabels() throws OrmException { final ResultSet<ChangeLabel> changeLabels = db.changeLabels().byChange(changeId); final Set<ChangeLabel.LabelKey> labels = <START> new HashSet<ChangeLabel.LabelKey>(); <END> for (ChangeLabel cl : changeLabels) { labels.add(cl.getLabel()); } detail.setLabels(labels); }</code><technical_language>access size of resultset, seed hashset constructor it</technical_language>

Target:
private void loadLabels() throws OrmException { final List<ChangeLabel> changeLabels = db.changeLabels().byChange(changeId).toList(); final Set<ChangeLabel.LabelKey> labels = new HashSet<ChangeLabel.LabelKey>(changeLabels.size()); for (ChangeLabel cl : changeLabels) { labels.add(cl.getLabel()); } detail.setLabels(labels); }
Source:
<code>protected static Blob replaceURLsByAbsolutePaths(Blob blob, Path tempDirectory, Function<String, Blob> blobResolver) throws IOException { String initialBlobContent = blob.getString(); <START> Pattern pattern = Pattern.compile("(src=\")(.*?)(\")"); <END> Matcher matcher = pattern.matcher(initialBlobContent); StringBuffer sb = new StringBuffer(); while (matcher.find()) { String url = matcher.group(2); Blob imageBlob = blobResolver.apply(url); if (imageBlob == null) { break; } String safeFilename = FileUtils.getSafeFilename(imageBlob.getFilename()); File imageFile = tempDirectory.resolve(safeFilename).toFile(); imageBlob.transferTo(imageFile); matcher.appendReplacement(sb, "$1" + Matcher.quoteReplacement(imageFile.toPath().toString()) + "$3"); } matcher.appendTail(sb); String blobContentWithAbsolutePaths = sb.toString(); if (blobContentWithAbsolutePaths.equals(initialBlobContent)) { return blob; } Blob newBlob = new StringBlob(blobContentWithAbsolutePaths, blob.getMimeType(), blob.getEncoding()); newBlob.setFilename(blob.getFilename()); return newBlob; }</code><technical_language>nice match attributes delimited ', do pattern "(src=([\"']))(.*?)(\\2)" .group(2) (below) group 3 backreference $3 $4</technical_language>

Target:
protected static Blob replaceURLsByAbsolutePaths(Blob blob, Path tempDirectory, Function<String, Blob> blobResolver) throws IOException { String initialBlobContent = blob.getString(); Pattern pattern = Pattern.compile("(src=([\"']))(.*?)(\\2)"); Matcher matcher = pattern.matcher(initialBlobContent); StringBuffer sb = new StringBuffer(); while (matcher.find()) { String url = matcher.group(3); Blob imageBlob = blobResolver.apply(url); if (imageBlob == null) { break; } String safeFilename = FileUtils.getSafeFilename(imageBlob.getFilename()); File imageFile = tempDirectory.resolve(safeFilename).toFile(); imageBlob.transferTo(imageFile); matcher.appendReplacement(sb, "$1" + Matcher.quoteReplacement(imageFile.toPath().toString()) + "$4"); } matcher.appendTail(sb); String blobContentWithAbsolutePaths = sb.toString(); if (blobContentWithAbsolutePaths.equals(initialBlobContent)) { return blob; } Blob newBlob = new StringBlob(blobContentWithAbsolutePaths, blob.getMimeType(), blob.getEncoding()); newBlob.setFilename(blob.getFilename()); return newBlob; }
Source:
<code>protected void onCreate() { FirebaseApp app = FirebaseApp.getInstance(getArguments().appName); mAuth = FirebaseAuth.getInstance(app); mPhoneAuth = PhoneAuthProvider.getInstance(mAuth); <START> mCredentialsClient = Credentials.getClient(this.getApplication()); <END> }</code><technical_language>Stray this</technical_language>

Target:
protected void onCreate() { FirebaseApp app = FirebaseApp.getInstance(getArguments().appName); mAuth = FirebaseAuth.getInstance(app); mPhoneAuth = PhoneAuthProvider.getInstance(mAuth); mCredentialsClient = Credentials.getClient(getApplication()); }
Source:
<code>public IObservableMap<K, V> getObservableMap() { return <START> typedSource; <END> }</code><technical_language>typedSource redundant returned getObservable() cast IObservableMap<K, V></technical_language>

Target:
public IObservableMap<K, V> getObservableMap() { return (IObservableMap<K, V>) getSource(); }
Source:
<code>public SideTabExtendedResourceView(ResourcesModelProvider modelProvider, EventBus eventBus, ClientStorage clientStorage, SubTableResources headerResources, ApplicationResources resources, ApplicationConstants constants) { vmTable = new VmTable(modelProvider, headerResources, resources, constants); <START> vmTable.setVisible(true); <END> SimpleRefreshManager refreshManager = new SimpleRefreshManager(modelProvider, eventBus, clientStorage); refreshPanel = refreshManager.getRefreshPanel(); cpusProgressBar = new QuotaProgressBar(QuotaProgressBar.QuotaType.CPU); memoryProgressBar = new QuotaProgressBar(QuotaProgressBar.QuotaType.MEM); storageProgressBar = new QuotaProgressBar(QuotaProgressBar.QuotaType.STORAGE); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); Driver.driver.initialize(this); ViewIdHandler.idHandler.generateAndSetIds(this); localize(); modelProvider.getModel().getUsedQuotaPercentage().getEntityChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { initQuotaList(model); } }); Window.addResizeHandler(new ResizeHandler() { @Override public void onResize(ResizeEvent resizeEvent) { vcpuExpanderContent.setHeight(infoBoxCpu.getOffsetHeight() - 150 + "px"); memoryExpanderContent.setHeight(infoBoxMemory.getOffsetHeight() - 150 + "px"); vmTable.setHeight(bottomLayoutPanel.getOffsetHeight() - 350 + "px"); } }); vcpuExpander.initWithContent(vcpuExpanderContent.getElement()); memoryExpander.initWithContent(memoryExpanderContent.getElement()); storageExpander.initWithContent(storageExpanderContent.getElement()); }</code><technical_language>true default</technical_language>

Target:
public SideTabExtendedResourceView(ResourcesModelProvider modelProvider, EventBus eventBus, ClientStorage clientStorage, SubTableResources headerResources, ApplicationResources resources, ApplicationConstants constants) { vmTable = new VmTable(modelProvider, headerResources, resources, constants); SimpleRefreshManager refreshManager = new SimpleRefreshManager(modelProvider, eventBus, clientStorage); refreshPanel = refreshManager.getRefreshPanel(); cpusProgressBar = new QuotaProgressBar(QuotaProgressBar.QuotaType.CPU); memoryProgressBar = new QuotaProgressBar(QuotaProgressBar.QuotaType.MEM); storageProgressBar = new QuotaProgressBar(QuotaProgressBar.QuotaType.STORAGE); initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); Driver.driver.initialize(this); ViewIdHandler.idHandler.generateAndSetIds(this); localize(); modelProvider.getModel().getUsedQuotaPercentage().getEntityChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { initQuotaList(model); } }); setResizeHandler(); vcpuExpander.initWithContent(vcpuExpanderContent.getElement()); memoryExpander.initWithContent(memoryExpanderContent.getElement()); storageExpander.initWithContent(storageExpanderContent.getElement()); }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); mDispatcher.register(this); if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); mIsInSearchMode = savedInstanceState.getBoolean(IS_IN_SEARCH_MODE); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } setContentView(R.layout.theme_browser_activity); <START> if (savedInstanceState == null) { <END> AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_ACCESSED_THEMES_BROWSER, mSite); mThemeBrowserFragment = ThemeBrowserFragment.newInstance(mSite); mThemeSearchFragment = ThemeSearchFragment.newInstance(mSite); addBrowserFragment(); } if (!mIsInSearchMode) { fetchInstalledThemesIfJetpackSite(); fetchWpComThemesIfSyncTimedOut(false); } showToolbar(); }</code><technical_language>I this is part of changeset, a check for savedInstanceState this, combine together</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((WordPress) getApplication()).component().inject(this); mDispatcher.register(this); if (savedInstanceState == null) { mSite = (SiteModel) getIntent().getSerializableExtra(WordPress.SITE); if (mSite != null) { AnalyticsUtils.trackWithSiteDetails(Stat.THEMES_ACCESSED_THEMES_BROWSER, mSite); mThemeBrowserFragment = ThemeBrowserFragment.newInstance(mSite); mThemeSearchFragment = ThemeSearchFragment.newInstance(mSite); addBrowserFragment(); } } else { mSite = (SiteModel) savedInstanceState.getSerializable(WordPress.SITE); setIsInSearchMode(savedInstanceState.getBoolean(IS_IN_SEARCH_MODE)); } if (mSite == null) { ToastUtils.showToast(this, R.string.blog_not_found, ToastUtils.Duration.SHORT); finish(); return; } setContentView(R.layout.theme_browser_activity); if (!mIsInSearchMode) { fetchInstalledThemesIfJetpackSite(); fetchWpComThemesIfSyncTimedOut(false); } showToolbar(); }
Source:
<code>public void initFromPage(int valueCount, ByteBufferInputStream inputStream) throws IOException { <START> int bitWidth = BytesUtils.readIntLittleEndianOnOneByte(inputStream); <END> decoder = new RunLengthBitPackingHybridDecoder(bitWidth, inputStream); }</code><technical_language>static import readIntLittleEndianOnOneByte</technical_language>

Target:
public void initFromPage(int valueCount, ByteBufferInputStream inputStream) throws IOException { int bitWidth = readIntLittleEndianOnOneByte(inputStream); decoder = new RunLengthBitPackingHybridDecoder(bitWidth, inputStream); }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getName()) <START> .append(" {id=") <END> .append(getId()) .append(", vdsId=") .append(getVdsId()) .append(", name=") .append(getName()) .append(", networkName=") .append(getNetworkName()) .append(", vlanId=") .append(getVlanId()) .append(", bootProtocol=") .append(getBootProtocol()) .append(", address=") .append(getAddress()) .append(", subnet=") .append(getSubnet()) .append(", gateway=") .append(getGateway()) .append(", mtu=") .append(getMtu()) .append(", bridged=") .append(isBridged()) .append(", type=") .append(getType()) .append(", networkImplementationDetails=") .append(getNetworkImplementationDetails()) .append("]"); return builder.toString(); }</code><technical_language>open closing brackets match</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getName()) .append(" {id=") .append(getId()) .append(", vdsId=") .append(getVdsId()) .append(", name=") .append(getName()) .append(", networkName=") .append(getNetworkName()) .append(", vlanId=") .append(getVlanId()) .append(", bootProtocol=") .append(getBootProtocol()) .append(", address=") .append(getAddress()) .append(", subnet=") .append(getSubnet()) .append(", gateway=") .append(getGateway()) .append(", mtu=") .append(getMtu()) .append(", bridged=") .append(isBridged()) .append(", type=") .append(getType()) .append(", networkImplementationDetails=") .append(getNetworkImplementationDetails()) .append("}"); return builder.toString(); }
Source:
<code>public String getLocation() { if (location == null) { return null; } StringBuilder sb = new StringBuilder(); JsonObject locationObject; if (location.isJsonPrimitive() && location.getAsJsonPrimitive().isString()) { return location.getAsString(); } else { locationObject = location.getAsJsonObject(); String filename; <START> if (locationObject.has("file") && locationObject.get("file").getAsJsonPrimitive().isString()) { <END> filename = locationObject.get("file").getAsString(); } else if (locationObject.has("filepath") && locationObject.get("filepath").isJsonObject()) { JsonObject filePath = locationObject.get("filepath").getAsJsonObject(); if (filePath.has("filename") && filePath.get("filename").getAsJsonPrimitive().isString()) { filename = filePath.get("filename").getAsString(); } else { return null; } } else { return null; } sb.append(filename).append(":"); LinkedList<Integer> lineList = new LinkedList<>(); if (locationObject.has("lines") && locationObject.get("lines").isJsonObject()) { JsonObject lines = locationObject.get("lines").getAsJsonObject(); if (lines.has("data") && lines.get("data").isJsonArray()) { JsonArray data = lines.get("data").getAsJsonArray(); for (JsonElement lineElement : data) { try { int line = Integer.parseInt(lineElement.getAsString()); lineList.add(line); } catch (NumberFormatException e) { return null; } } } else { return null; } } else { return null; } if (lineList.size() > 1 && areConsecutive(lineList)) { sb.append(lineList.getFirst()).append("..").append(lineList.getLast()); } else { sb.append(StringUtils.join(lineList, ',')); } return sb.toString(); } }</code><technical_language>expose filePath file final static variable</technical_language>

Target:
public String getLocation() { if (location == null) { return null; } StringBuilder sb = new StringBuilder(); JsonObject locationObject; if (location.isJsonPrimitive() && location.getAsJsonPrimitive().isString()) { return location.getAsString(); } locationObject = location.getAsJsonObject(); String filename; if (jsonHasString(locationObject,"file")) { filename = locationObject.get("file").getAsString(); } else if (jsonHasJsonObject(locationObject,"filepath")) { JsonObject filePath = locationObject.get("filepath").getAsJsonObject(); if (jsonHasString(filePath,"filename")) { filename = filePath.get("filename").getAsString(); } else { return null; } } else { return null; } sb.append(filename).append(":"); LinkedList<Integer> lineList = new LinkedList<>(); if (jsonHasJsonObject(locationObject,"lines")) { JsonObject lines = locationObject.get("lines").getAsJsonObject(); if (jsonHasArray(lines,"data")) { JsonArray data = lines.get("data").getAsJsonArray(); for (JsonElement lineElement : data) { try { int line = Integer.parseInt(lineElement.getAsString()); lineList.add(line); } catch (NumberFormatException e) { return null; } } } else { return null; } } else { return null; } if (lineList.size() > 1 && areConsecutive(lineList)) { sb.append(lineList.getFirst()).append("..").append(lineList.getLast()); } else { sb.append(StringUtils.join(lineList, ',')); } return sb.toString(); }
Source:
<code>private void recordValidWriteIds(HiveTxnManager txnMgr) throws LockException { String txnString = conf.get(ValidTxnList.VALID_TXNS_KEY); if ((txnString == null) || (txnString.isEmpty())) { throw new IllegalStateException("calling recordValidWritsIdss() without initializing ValidTxnList " + JavaUtils.txnIdToString(txnMgr.getCurrentTxnId())); } ValidTxnWriteIdList txnWriteIds = txnMgr.getValidWriteIds(getTransactionalTableList(plan), txnString); String writeIdStr = txnWriteIds.toString(); conf.set(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY, writeIdStr); if (plan.getFetchTask() != null) { Operator<?> source = plan.getFetchTask().getWork().getSource(); if (source instanceof TableScanOperator) { TableScanOperator tsOp = (TableScanOperator)source; String fullTableName = AcidUtils.getFullTableName(tsOp.getConf().getDatabaseName(), tsOp.getConf().getTableName()); ValidWriteIdList writeIdList = txnWriteIds.getTableValidWriteIdList(fullTableName); <START> if (HiveConf.getBoolVar(conf, ConfVars.HIVE_TRANSACTIONAL_TABLE_SCAN, false) && (writeIdList == null)) { <END> throw new IllegalStateException("ACID table: " + fullTableName + " is missing from the ValidWriteIdList config: " + writeIdStr); } if (writeIdList != null) { plan.getFetchTask().setValidWriteIdList(writeIdList.toString()); } } } LOG.debug("Encoding valid txn write ids info " + writeIdStr + " txnid:" + txnMgr.getCurrentTxnId()); }</code><technical_language>ConfVars.HIVE_TRANSACTIONAL_TABLE_SCAN is set client side processing nodes a transactional scan. (with changes AcidUtils.isFullAcidScan). I expect this prop true ever...</technical_language>

Target:
private void recordValidWriteIds(HiveTxnManager txnMgr) throws LockException { String txnString = conf.get(ValidTxnList.VALID_TXNS_KEY); if ((txnString == null) || (txnString.isEmpty())) { throw new IllegalStateException("calling recordValidWritsIdss() without initializing ValidTxnList " + JavaUtils.txnIdToString(txnMgr.getCurrentTxnId())); } ValidTxnWriteIdList txnWriteIds = txnMgr.getValidWriteIds(getTransactionalTableList(plan), txnString); String writeIdStr = txnWriteIds.toString(); conf.set(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY, writeIdStr); if (plan.getFetchTask() != null) { Operator<?> source = plan.getFetchTask().getWork().getSource(); if (source instanceof TableScanOperator) { TableScanOperator tsOp = (TableScanOperator)source; String fullTableName = AcidUtils.getFullTableName(tsOp.getConf().getDatabaseName(), tsOp.getConf().getTableName()); ValidWriteIdList writeIdList = txnWriteIds.getTableValidWriteIdList(fullTableName); if (tsOp.getConf().isTranscationalTable() && (writeIdList == null)) { throw new IllegalStateException("ACID table: " + fullTableName + " is missing from the ValidWriteIdList config: " + writeIdStr); } if (writeIdList != null) { plan.getFetchTask().setValidWriteIdList(writeIdList.toString()); } } } LOG.debug("Encoding valid txn write ids info " + writeIdStr + " txnid:" + txnMgr.getCurrentTxnId()); }
Source:
<code><START> public int hashCode() { <END> return Objects.hash( actionType, correlationId, endTime, id, isVisible, jobSubjectEntities, lastUpdateTime, ownerId, startTime, status, steps, external, autoCleared ); }</code><technical_language>I asked in previous patch set, please add engineSessionsSeqId hashcode()</technical_language>

Target:
public int hashCode() { return Objects.hash( actionType, engineSessionSeqId, correlationId, endTime, id, isVisible, jobSubjectEntities, lastUpdateTime, ownerId, startTime, status, steps, external, autoCleared ); }
Source:
<code>public ExtensionEntry(Properties props) { <START> this.file = null; <END> context = new EnumMap<>(ExtensionProperties.class); load(props); }</code><technical_language>need for this.file = null null</technical_language>

Target:
public ExtensionEntry(Properties props) { load(props); }