auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void validate(T values) { for (int i = 0; i < expressions.size(); i++) { expressions.get(i).setNextRow(values); } for (int i = 0; i < inputs.size(); i++) { Object val = inputs.get(i).value(); if (val == null) { throw new IllegalArgumentException("\"" + notNullColumns.get(i) + "\" must not be null"); } } for (Map.Entry<String, Tuple<Input<?>, String>> checkEntry : checkConstraints.entrySet()) { Input<?> checkInput = checkEntry.getValue().v1(); Boolean value = (Boolean) checkInput.value(); if (null == value) { continue; } if (!value.booleanValue()) { String checkName = checkEntry.getKey(); String checkExpr = checkEntry.getValue().v2(); Object offendingValues = values instanceof Doc ? ((Doc) values).getSource() : values; throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Failed CONSTRAINT %s CHECK (%s) and values %s", checkName, checkExpr, offendingValues)); } } }

Target:
public void validate(T values) { for (int i = 0; i < expressions.size(); i++) { expressions.get(i).setNextRow(values); } for (int i = 0; i < inputs.size(); i++) { Object val = inputs.get(i).value(); if (val == null) { throw new IllegalArgumentException("\"" + notNullColumns.get(i) + "\" must not be null"); } } for (int i = 0; i < checkConstraints.size(); i++) { Tuple<? extends Input<?>, CheckConstraint<Symbol>> checkEntry = checkConstraints.get(i); Input<?> checkInput = checkEntry.v1(); Boolean value = (Boolean) checkInput.value(); if (value == null) { continue; } if (!value.booleanValue()) { CheckConstraint<Symbol> chk = checkEntry.v2(); throw new IllegalArgumentException(String.format( Locale.ENGLISH, "Failed CONSTRAINT %s CHECK (%s) and values %s", chk.name(), chk.expressionStr(), values)); } } }
Source:
private void removeUnnecessaryHooks() { ResourceSetHookRegistry resourceSetHookRegistry = EMFCompareIDEPlugin.getDefault() .getResourceSetHookRegistry(); Collection<IResourceSetHook> resourceSetHooks = resourceSetHookRegistry.getResourceSetHooks(); for (IResourceSetHook resourceSetHook : resourceSetHooks) { if ((resourceSetHook.getClass().getName()).equals(SaveParameterHook.class.getName())) { continue; } else { resourceSetHookRegistry.remove(resourceSetHook.getClass().getName()); } } }

Target:
private void removeUnnecessaryHooks() { ResourceSetHookRegistry resourceSetHookRegistry = EMFCompareIDEPlugin.getDefault() .getResourceSetHookRegistry(); Collection<IResourceSetHook> resourceSetHooks = resourceSetHookRegistry.getResourceSetHooks(); for (IResourceSetHook resourceSetHook : resourceSetHooks) { String resourceSetHookId = resourceSetHook.getClass().getName(); if (!resourceSetHookId.equals(SaveParameterHook.class.getName())) { ResourceSetHookDescriptor descriptor = resourceSetHookRegistry.remove(resourceSetHookId); if (descriptor != null) { removedResourceSetHooks.put(resourceSetHookId, descriptor); } } } }
Source:
protected String[] getAttributes() { String[] attributes = RuleAttributeWidget.getAttributesList(); attributes[attributes.length] = GuidedDecisionTable52.NEGATE_RULE_ATTR; return attributes; }

Target:
protected String[] getAttributes() { String[] attributes = RuleAttributeWidget.getAttributesList(); attributes = Arrays.copyOf( attributes, attributes.length + 1 ); attributes[attributes.length - 1] = GuidedDecisionTable52.NEGATE_RULE_ATTR; return attributes; }
Source:
public List<ApplicationDeploymentDescription> getApplicationDeployements(Map<String, String> filters) throws AppCatalogException { if(filters.containsKey(DBConstants.ApplicationDeployment.APPLICATION_MODULE_ID)) { Map<String, Object> queryParameters = new HashMap<>(); queryParameters.put(DBConstants.ApplicationDeployment.APPLICATION_MODULE_ID, filters.get(DBConstants.ApplicationDeployment.APPLICATION_MODULE_ID)); List<ApplicationDeploymentDescription> applicationDeploymentDescriptionList = select(QueryConstants.FIND_APPLICATION_DEPLOYMENTS_FOR_APPLICATION_MODULE_ID, -1, 0, queryParameters); return applicationDeploymentDescriptionList; } else if(filters.containsKey(DBConstants.ApplicationDeployment.COMPUTE_HOST_ID)) { Map<String, Object> queryParameters = new HashMap<>(); queryParameters.put(DBConstants.ApplicationDeployment.COMPUTE_HOST_ID, filters.get(DBConstants.ApplicationDeployment.COMPUTE_HOST_ID)); List<ApplicationDeploymentDescription> applicationDeploymentDescriptionList = select(QueryConstants.FIND_APPLICATION_DEPLOYMENTS_FOR_COMPUTE_HOST_ID, -1, 0, queryParameters); return applicationDeploymentDescriptionList; } else { logger.error("Unsupported field name for app deployment.", new IllegalArgumentException()); throw new IllegalArgumentException("Unsupported field name for app deployment."); } }

Target:
public List<ApplicationDeploymentDescription> getApplicationDeployements(Map<String, String> filters) throws AppCatalogException { if(filters.containsKey(DBConstants.ApplicationDeployment.APPLICATION_MODULE_ID)) { logger.debug("Fetching all Application Deployments for given Application Module ID"); Map<String, Object> queryParameters = new HashMap<>(); queryParameters.put(DBConstants.ApplicationDeployment.APPLICATION_MODULE_ID, filters.get(DBConstants.ApplicationDeployment.APPLICATION_MODULE_ID)); List<ApplicationDeploymentDescription> applicationDeploymentDescriptionList = select(QueryConstants.FIND_APPLICATION_DEPLOYMENTS_FOR_APPLICATION_MODULE_ID, -1, 0, queryParameters); return applicationDeploymentDescriptionList; } else if(filters.containsKey(DBConstants.ApplicationDeployment.COMPUTE_HOST_ID)) { logger.debug("Fetching Application Deployments for given Compute Host ID"); Map<String, Object> queryParameters = new HashMap<>(); queryParameters.put(DBConstants.ApplicationDeployment.COMPUTE_HOST_ID, filters.get(DBConstants.ApplicationDeployment.COMPUTE_HOST_ID)); List<ApplicationDeploymentDescription> applicationDeploymentDescriptionList = select(QueryConstants.FIND_APPLICATION_DEPLOYMENTS_FOR_COMPUTE_HOST_ID, -1, 0, queryParameters); return applicationDeploymentDescriptionList; } else { logger.error("Unsupported field name for app deployment."); throw new IllegalArgumentException("Unsupported field name for app deployment."); } }
Source:
private HttpURLConnection setupConnection() throws IOException { Logger.v(TAG, "HttpWebRequest setupConnection thread:" + android.os.Process.myTid()); if (mUrl == null) { throw new IllegalArgumentException("requestURL"); } if (!mUrl.getProtocol().equalsIgnoreCase("http") && !mUrl.getProtocol().equalsIgnoreCase("https")) { throw new IllegalArgumentException("requestURL"); } HttpURLConnection.setFollowRedirects(true); final HttpURLConnection connection = HttpUrlConnectionFactory.createHttpUrlConnection(mUrl); connection.setConnectTimeout(CONNECT_TIME_OUT); if (Build.VERSION.SDK_INT > 13) { connection.setRequestProperty("Connection", "close"); } final Iterator<String> headerKeys = mRequestHeaders.keySet().iterator(); while (headerKeys.hasNext()) { String header = headerKeys.next(); Logger.v(TAG, "Setting header: " + header); connection.setRequestProperty(header, mRequestHeaders.get(header)); } System.setProperty("http.keepAlive", "false"); connection.setReadTimeout(READ_TIME_OUT); connection.setInstanceFollowRedirects(mInstanceRedirectsFollow); connection.setUseCaches(mUseCaches); connection.setRequestMethod(mRequestMethod); connection.setDoInput(true); setRequestBody(connection, mRequestContent, mRequestContentType); return connection; }

Target:
private HttpURLConnection setupConnection() throws IOException { Logger.v(TAG, "HttpWebRequest setupConnection thread:" + android.os.Process.myTid()); if (mUrl == null) { throw new IllegalArgumentException("requestURL"); } if (!mUrl.getProtocol().equalsIgnoreCase("http") && !mUrl.getProtocol().equalsIgnoreCase("https")) { throw new IllegalArgumentException("requestURL"); } HttpURLConnection.setFollowRedirects(true); final HttpURLConnection connection = HttpUrlConnectionFactory.createHttpUrlConnection(mUrl); connection.setConnectTimeout(CONNECT_TIME_OUT); if (Build.VERSION.SDK_INT > 13) { connection.setRequestProperty("Connection", "close"); } final Iterator<String> headerKeys = mRequestHeaders.keySet().iterator(); while (headerKeys.hasNext()) { String header = headerKeys.next(); Logger.v(TAG, "Setting header: " + header); connection.setRequestProperty(header, mRequestHeaders.get(header)); } connection.setReadTimeout(READ_TIME_OUT); connection.setInstanceFollowRedirects(mInstanceRedirectsFollow); connection.setUseCaches(mUseCaches); connection.setRequestMethod(mRequestMethod); connection.setDoInput(true); setRequestBody(connection, mRequestContent, mRequestContentType); return connection; }
Source:
public AssociationRows(AssociationKey associationKey, Collection<?> wrapped, AssociationRowFactory associationRowFactory) { this.rows = new LinkedHashMap<>( wrapped.size() ); for ( Object object : wrapped ) { AssociationRow<?> row = associationRowFactory.createAssociationRow( associationKey, object ); rows.put( row.getKey(), row ); } }

Target:
public AssociationRows(AssociationKey associationKey, Collection<?> wrapped, AssociationRowFactory associationRowFactory) { this.rows = CollectionHelper.newHashMap( wrapped.size() ); for ( Object object : wrapped ) { AssociationRow<?> row = associationRowFactory.createAssociationRow( associationKey, object ); rows.put( row.getKey(), row ); } }
Source:
protected void onCreate(Bundle savedInstanceState) { Log_OC.v(TAG, "onCreate() start"); super.onCreate(savedInstanceState); if (savedInstanceState == null) { FileObserverService.initialize(this); } mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); if (savedInstanceState != null) { mFileWaitingToPreview = (OCFile) savedInstanceState.getParcelable( FileDisplayActivity.KEY_WAITING_TO_PREVIEW); mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS); mWaitingToSend = (OCFile) savedInstanceState.getParcelable( FileDisplayActivity.KEY_WAITING_TO_SEND); } else { mFileWaitingToPreview = null; mSyncInProgress = false; mWaitingToSend = null; } setContentView(R.layout.files); setupToolbar(); setupDrawer(R.id.nav_all_files); mDualPane = getResources().getBoolean(R.bool.large_land_layout); mLeftFragmentContainer = findViewById(R.id.left_fragment_container); mRightFragmentContainer = findViewById(R.id.right_fragment_container); getSupportActionBar().setHomeButtonEnabled(true); FragmentManager fm = getSupportFragmentManager(); TaskRetainerFragment taskRetainerFragment = (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT); if (taskRetainerFragment == null) { taskRetainerFragment = new TaskRetainerFragment(); fm.beginTransaction() .add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit(); } Log_OC.v(TAG, "onCreate() end"); AppRater.appLaunched(this, "com.owncloud.android"); }

Target:
protected void onCreate(Bundle savedInstanceState) { Log_OC.v(TAG, "onCreate() start"); super.onCreate(savedInstanceState); if (savedInstanceState == null) { FileObserverService.initialize(this); } mLocalBroadcastManager = LocalBroadcastManager.getInstance(this); if (savedInstanceState != null) { mFileWaitingToPreview = (OCFile) savedInstanceState.getParcelable( FileDisplayActivity.KEY_WAITING_TO_PREVIEW); mSyncInProgress = savedInstanceState.getBoolean(KEY_SYNC_IN_PROGRESS); mWaitingToSend = (OCFile) savedInstanceState.getParcelable( FileDisplayActivity.KEY_WAITING_TO_SEND); } else { mFileWaitingToPreview = null; mSyncInProgress = false; mWaitingToSend = null; } setContentView(R.layout.files); setupToolbar(); setupDrawer(R.id.nav_all_files); mDualPane = getResources().getBoolean(R.bool.large_land_layout); mLeftFragmentContainer = findViewById(R.id.left_fragment_container); mRightFragmentContainer = findViewById(R.id.right_fragment_container); getSupportActionBar().setHomeButtonEnabled(true); FragmentManager fm = getSupportFragmentManager(); TaskRetainerFragment taskRetainerFragment = (TaskRetainerFragment) fm.findFragmentByTag(TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT); if (taskRetainerFragment == null) { taskRetainerFragment = new TaskRetainerFragment(); fm.beginTransaction() .add(taskRetainerFragment, TaskRetainerFragment.FTAG_TASK_RETAINER_FRAGMENT).commit(); } Log_OC.v(TAG, "onCreate() end"); if (getResources().getBoolean(R.bool.enable_rate_me_feature)) { AppRater.appLaunched(this, getPackageName()); } }
Source:
private List<DiskImage> createSnapshotsForDiskImage(Guid diskId) { List<DiskImage> result = new ArrayList<>(); for (int i = 0; i < NUM_OF_SNAPSHOTS_TO_CREATE; i++) { result.add(createDiskSnapshot(diskId)); } return result; }

Target:
private List<DiskImage> createSnapshotsForDiskImage(Guid diskId) { return IntStream.range(0, NUM_OF_SNAPSHOTS_TO_CREATE).mapToObj(i -> createDiskImage(diskId)).collect( Collectors.toList()); }
Source:
ParameterMap getQueryParams(MuleEvent event) { return resolveParams(event, HttpParamType.QUERY_PARAM); }

Target:
public ParameterMap getQueryParams(MuleEvent event) { return resolveParams(event, HttpParamType.QUERY_PARAM); }
Source:
@Override public void run() { while (hiveStatement.hasMoreLogs()) { try { if (progressBarUpdateCompleted) { updateQueryLog(); } else { TProgressUpdateResp progressResponse = hiveStatement.getProgressResponse(); commands.debug("progress response sent: " + (progressResponse == null ? "null" : progressResponse.toString())); if (progressResponse == null || TJobExecutionStatus.NOT_AVAILABLE .equals(progressResponse.getStatus())) { progressBarUpdateCompleted = true; } else { inPlaceUpdate.render(new ProgressMonitorWrapper(progressResponse)); if (receivedAllProgressUpdates(progressResponse.getStatus())) { progressBarUpdateCompleted = true; } } } Thread.sleep(queryProgressInterval); } catch (SQLException e) { commands.error(new SQLWarning(e)); } catch (InterruptedException e) { commands.debug("Getting log thread is interrupted, since query is done!"); commands.showRemainingProgress(hiveStatement, inPlaceUpdate); } } }

Target:
@Override public void run() { while (hiveStatement.hasMoreLogs()) { try { updateQueryLog(); Thread.sleep(queryProgressInterval); } catch (SQLException e) { commands.error(new SQLWarning(e)); } catch (InterruptedException e) { commands.debug("Getting log thread is interrupted, since query is done!"); commands.showRemainingLogsIfAny(hiveStatement); } } }
Source:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { "plaintext", Config.build().withEncryptionLevel( Config.EncryptionLevel.NONE ) }, { "tls encrypted", Config.build().withEncryptionLevel( Config.EncryptionLevel.REQUIRED ) } }); }

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][] { { "plaintext", Config.EncryptionLevel.NONE }, { "tls encrypted", Config.EncryptionLevel.REQUIRED } }); }
Source:
public final synchronized void mark(int readlimit) { try { mark = OptionalLong.of(position()); } catch (IOException e) { } }

Target:
public final synchronized void mark(int readlimit) { try { mark = OptionalLong.of(position()); } catch (final ClosedChannelException e) { } catch (final IOException e) { throw new RuntimeIOException(e); } }
Source:
public void testAbandonChange() throws Exception { String message1 = "abandon, time: " + System.currentTimeMillis(); ChangeDetail changeDetail = reviewHarness.getClient().abandon(reviewHarness.getShortId(), 1, message1, new NullProgressMonitor()); reviewHarness.retrieve(); assertThat(changeDetail, notNullValue()); assertThat(changeDetail.getChange().getStatus(), is(Status.ABANDONED)); List<ChangeMessage> messages = changeDetail.getMessages(); int offset = COMMENT_OFFSET; assertThat(messages.size(), is(offset + 1)); ChangeMessage lastMessage = messages.get(offset + 0); assertThat(lastMessage.getAuthor().get(), is(1000001)); assertThat(lastMessage.getMessage(), endsWith("Abandoned\n\n" + message1)); assertThat(getReview().getState(), is(ReviewStatus.ABANDONED)); List<IComment> comments = getReview().getComments(); assertThat(comments.size(), is(offset + 1)); IComment lastComment = comments.get(offset + 0); assertThat(lastComment.getAuthor().getDisplayName(), is("tests")); assertThat(lastComment.getAuthor().getId(), is("1000001")); assertThat(lastComment.getDescription(), endsWith("Abandoned\n\n" + message1)); }

Target:
public void testAbandonChange() throws Exception { String message1 = "abandon, time: " + System.currentTimeMillis(); ChangeDetail changeDetail = reviewHarness.getClient().abandon(reviewHarness.getShortId(), 1, message1, new NullProgressMonitor()); reviewHarness.retrieve(); assertThat(changeDetail, notNullValue()); assertThat(changeDetail.getChange().getStatus(), is(Status.ABANDONED)); List<ChangeMessage> messages = changeDetail.getMessages(); assertThat(messages.size(), is(2)); ChangeMessage lastMessage = messages.get(1); assertThat(lastMessage.getAuthor().get(), is(1000001)); assertThat(lastMessage.getMessage(), endsWith("Abandoned\n\n" + message1)); assertThat(getReview().getState(), is(ReviewStatus.ABANDONED)); List<IComment> comments = getReview().getComments(); assertThat(comments.size(), is(2)); IComment lastComment = comments.get(1); assertThat(lastComment.getAuthor().getDisplayName(), is("tests")); assertThat(lastComment.getAuthor().getId(), is("1000001")); assertThat(lastComment.getDescription(), endsWith("Abandoned\n\n" + message1)); }
Source:
public void setDepth(int depth) { int[] allowedValues = {2, 4, 8, 16, 32, 64, 256, 4096}; for (int i = 0; i < allowedValues.length; i++) { if(depth == allowedValues[i]) { this.depth = depth; return; } } throw new IllegalArgumentException("Invalid depth value"); }

Target:
public void setDepth(int depth) { int[] allowedValues = {2, 4, 8, 16, 32, 64, 256, 4096}; for (int i = 0; i < allowedValues.length; i++) { if(depth == allowedValues[i]) { this.depth = depth; return; } } throw new IllegalArgumentException("Invalid depth value. Valid values are 2, 4, 8, 16, 32, 64, 256, 4096."); }
Source:
private boolean isFeatureSupportedAsAdditionalFeature(Guid clusterId, String featureName) { Set<SupportedAdditionalClusterFeature> addtionalFeaturesSupported = clusterFeatureDao.getSupportedFeaturesByClusterId(clusterId); for (SupportedAdditionalClusterFeature supportedFeature : addtionalFeaturesSupported) { if (supportedFeature.getFeature().getName().equalsIgnoreCase(featureName)) { return supportedFeature.isEnabled(); } } return false; }

Target:
private boolean isFeatureSupportedAsAdditionalFeature(Guid clusterId, String featureName) { return clusterFeatureDao.getSupportedFeaturesByClusterId(clusterId).stream() .filter(SupportedAdditionalClusterFeature::isEnabled) .filter(f -> f.getFeature().getName().equals(featureName)) .findAny() .isPresent(); }
Source:
public synchronized File getHibernateFile(String hibernateFileName) throws PropertyAccessException { checkEnvVarSet(); LOG.debug("Checking the hibernate file."); String path = propertyFileDir + File.separator + "hibernate" + File.separator + hibernateFileName; LOG.info(path); File result = new File(path); if (!result.exists()) { throw new PropertyAccessException("Unable to locate " + result); } return result; }

Target:
public synchronized File getHibernateFile(String hibernateFileName) throws PropertyAccessException { checkEnvVarSet(); LOG.debug("Checking the hibernate file."); StringBuilder builder = new StringBuilder(); builder.append(propertyFileDir); builder.append(File.separator); builder.append("hibernate"); builder.append(File.separator); builder.append(hibernateFileName); String path = builder.toString(); LOG.info("Hibernate file path is: ", path); File result = new File(path); if (!result.exists()) { throw new PropertyAccessException("Unable to locate " + result); } return result; }
Source:
public Iterator<ObjectNode> convertObject(InputStream csvSource) throws IOException { CountInputStream countInputStream = new CountInputStream(csvSource); CsvSchema firstLineSchema = CsvSchema.emptySchema().withHeader(); Iterator<ObjectNode> objectItr = csvMapper.readerFor(ObjectNode.class).with(firstLineSchema) .readValues(countInputStream); return objectItr; }

Target:
public Iterator<ObjectNode> convertObject(InputStream csvSource) throws IOException { this.countInputStream = new CountInputStream(csvSource); CsvSchema firstLineSchema = CsvSchema.emptySchema().withHeader(); Iterator<ObjectNode> objectItr = csvMapper.readerFor(ObjectNode.class).with(firstLineSchema) .readValues(this.countInputStream); return objectItr; }
Source:
public boolean isSatisfied(CommandContext ctx) { if(satisfied == null) { satisfied = checkAccess(ctx); if(log.isTraceEnabled()) { log.trace(toString() + " " + satisfied); } } return satisfied; }

Target:
public boolean isSatisfied(CommandContext ctx) { if(satisfied == null) { satisfied = checkAccess(ctx); log.tracef("%s %s", this, satisfied); } return satisfied; }
Source:
public void setBufferLineLimit(int bufferLines) { if (bufferLines >= MIN_LOW_LINES_WATER_MARK) { int chars = bufferLines * CHARS_PER_LINE_AVG; setWaterMarks(chars, chars + LOW_TO_HIGH_BUFFER_CHARS_OFFSET); } }

Target:
public void setBufferLineLimit(int bufferLines) { int chars = bufferLines * CHARS_PER_LINE_AVG; setWaterMarks(chars, chars); }
Source:
private Set<FileRef> removeSmallest(Map<FileRef,DataFileValue> filesToCompact, int maxFilesToCompact) { if (filesToCompact.size() <= maxFilesToCompact) { Set<FileRef> smallestFiles = new HashSet<FileRef>(filesToCompact.size()); for (Iterator<FileRef> iterator = filesToCompact.keySet().iterator(); iterator.hasNext();) { smallestFiles.add(iterator.next()); iterator.remove(); } return smallestFiles; } PriorityQueue<Pair<FileRef,Long>> fileHeap = new PriorityQueue<Pair<FileRef,Long>>(filesToCompact.size(), new Comparator<Pair<FileRef,Long>>() { @Override public int compare(Pair<FileRef,Long> o1, Pair<FileRef,Long> o2) { if (o1.getSecond() == o2.getSecond()) return o1.getFirst().compareTo(o2.getFirst()); if (o1.getSecond() < o2.getSecond()) return -1; return 1; } }); for (Iterator<Entry<FileRef,DataFileValue>> iterator = filesToCompact.entrySet().iterator(); iterator.hasNext();) { Entry<FileRef,DataFileValue> entry = iterator.next(); fileHeap.add(new Pair<FileRef,Long>(entry.getKey(), entry.getValue().getSize())); } Set<FileRef> smallestFiles = new HashSet<FileRef>(); while (smallestFiles.size() < maxFilesToCompact && fileHeap.size() > 0) { Pair<FileRef,Long> pair = fileHeap.remove(); filesToCompact.remove(pair.getFirst()); smallestFiles.add(pair.getFirst()); } return smallestFiles; }

Target:
private Set<FileRef> removeSmallest(Map<FileRef,DataFileValue> filesToCompact, int maxFilesToCompact) { if (filesToCompact.size() <= maxFilesToCompact) { Set<FileRef> smallestFiles = new HashSet<FileRef>(filesToCompact.keySet()); filesToCompact.clear(); return smallestFiles; } PriorityQueue<Pair<FileRef,Long>> fileHeap = new PriorityQueue<Pair<FileRef,Long>>(filesToCompact.size(), new Comparator<Pair<FileRef,Long>>() { @Override public int compare(Pair<FileRef,Long> o1, Pair<FileRef,Long> o2) { if (o1.getSecond() == o2.getSecond()) return o1.getFirst().compareTo(o2.getFirst()); if (o1.getSecond() < o2.getSecond()) return -1; return 1; } }); for (Iterator<Entry<FileRef,DataFileValue>> iterator = filesToCompact.entrySet().iterator(); iterator.hasNext();) { Entry<FileRef,DataFileValue> entry = iterator.next(); fileHeap.add(new Pair<FileRef,Long>(entry.getKey(), entry.getValue().getSize())); } Set<FileRef> smallestFiles = new HashSet<FileRef>(); while (smallestFiles.size() < maxFilesToCompact && fileHeap.size() > 0) { Pair<FileRef,Long> pair = fileHeap.remove(); filesToCompact.remove(pair.getFirst()); smallestFiles.add(pair.getFirst()); } return smallestFiles; }
Source:
private List<Cookie> get(String domain, String path, boolean secure) { final boolean[] removeExpired = {false}; final List<Cookie> results = new ArrayList<>(); boolean exactDomainMatch = true; String subDomain = domain; while (MiscUtils.isNonEmpty(subDomain)) { results.addAll(getStoredCookies(subDomain, path, secure, removeExpired, exactDomainMatch)); exactDomainMatch = false; subDomain = DomainUtils.getSubDomain(subDomain); } return results; }

Target:
private List<Cookie> get(String domain, String path, boolean secure) { boolean exactDomainMatch = true; String subDomain = domain; List<Cookie> results = null; while (MiscUtils.isNonEmpty(subDomain)) { final List<Cookie> storedCookies = getStoredCookies(subDomain, path, secure, exactDomainMatch); subDomain = DomainUtils.getSubDomain(subDomain); exactDomainMatch = false; if (storedCookies.isEmpty()) { continue; } if (results == null) { results = new ArrayList<>(4); } results.addAll(storedCookies); } return results == null ? Collections.emptyList() : results; }
Source:
private X509ExtendedTrustManager getX509ExtendedTrustManager() { TrustManagerFactory factory; try { factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); factory.init((KeyStore) null); } catch (NoSuchAlgorithmException nsae) { log.error("Unable to initialize default TrustManagerFactory, using no-op X509ExtendedTrustManager", nsae); return getNoOpInstance(); } catch (KeyStoreException nse) { log.error("Unable to initialize default TrustManagerFactory, using no-op X509ExtendedTrustManager", nse); return getNoOpInstance(); } for (TrustManager tm: factory.getTrustManagers()) { if (tm instanceof X509ExtendedTrustManager) { return (X509ExtendedTrustManager) tm; } } log.debug("No default X509TrustManager found, using no-op"); return getNoOpInstance(); }

Target:
private X509ExtendedTrustManager getX509ExtendedTrustManager() { TrustManagerFactory factory; try { factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); factory.init((KeyStore) null); } catch (NoSuchAlgorithmException nsae) { throw new RuntimeException("Unable to initialize default TrustManagerFactory", nsae); } catch (KeyStoreException nse) { throw new RuntimeException("Unable to initialize default TrustManagerFactory", nse); } for (TrustManager tm: factory.getTrustManagers()) { if (tm instanceof X509ExtendedTrustManager) { return (X509ExtendedTrustManager) tm; } } throw new RuntimeException("No default X509TrustManager found"); }
Source:
protected void configureServlets() { filter("/").through(OAuthWebFilter.class); filter("/login").through(OAuthWebFilter.class); filter("/oauth").through(OAuthWebFilter.class); bind(HttpClient.class).toProvider(PooledHttpClientProvider.class); }

Target:
protected void configureServlets() { filter("/").through(OAuthWebFilter.class); filter("/login").through(OAuthWebFilter.class); filter("/oauth").through(OAuthWebFilter.class); bind(HttpClient.class).toProvider(PooledHttpClientProvider.class).in( Scopes.SINGLETON); }
Source:
protected RevCommit findHead(Repository repo) { try (RevWalk walk = new RevWalk(repo)) { try { ObjectId head = repo.resolve(HEAD); return walk.parseCommit(head); } catch (RevisionSyntaxException e) { throw new RuntimeException(e); } catch (AmbiguousObjectException e) { throw new RuntimeException(e); } catch (IncorrectObjectTypeException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } } }

Target:
protected RevCommit findHead(Repository repo) { try (RevWalk walk = new RevWalk(repo)) { try { ObjectId head = repo.resolve(HEAD); return walk.parseCommit(head); } catch (RevisionSyntaxException | IOException e) { throw new RuntimeException(e); } } }
Source:
public String getRequestTokenEndpoint() { return null; }

Target:
public String getRequestTokenEndpoint() { throw new OAuthException("Echo API only supports 2-legged OAuth calls"); }
Source:
public void stop() { _runningTasks.values().forEach(AbstractKafkaBasedConnectorTask::stop); _daemonThreadExecutorService.shutdown(); _runningTasks.clear(); _taskThreads.clear(); _logger.info("stopped."); }

Target:
public void stop() { _daemonThreadExecutorService.shutdown(); _runningTasks.values().forEach(AbstractKafkaBasedConnectorTask::stop); _runningTasks.clear(); _taskThreads.clear(); _logger.info("stopped."); }
Source:
public static MessageValues serializePayload(Message<?> message) { Object originalPayload = message.getPayload(); boolean setOriginalContentType = (originalPayload instanceof String); Assert.isTrue(originalPayload instanceof byte[] || originalPayload instanceof String, "Failed to convert message's payload. No suitable converter found for provided contentType: " + message.getHeaders().get(MessageHeaders.CONTENT_TYPE) + " and paylod: " + originalPayload); Object originalContentType = message.getHeaders().get(MessageHeaders.CONTENT_TYPE); String contentType = setOriginalContentType ? JavaClassMimeTypeUtils.mimeTypeFromObject(originalPayload, ObjectUtils.nullSafeToString(originalContentType)).toString() : originalContentType.toString() ; Object payload = originalPayload instanceof byte[] ? originalPayload : ((String) originalPayload).getBytes(StandardCharsets.UTF_8); MessageValues messageValues = new MessageValues(message); messageValues.setPayload(payload); messageValues.put(MessageHeaders.CONTENT_TYPE, contentType); if (originalContentType != null && !originalContentType.toString().equals(contentType.toString())) { messageValues.put(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE, originalContentType.toString()); } return messageValues; }

Target:
public static MessageValues serializePayload(Message<?> message) { Object originalPayload = message.getPayload(); boolean setOriginalContentType = (originalPayload instanceof String); Assert.isTrue(originalPayload instanceof byte[] || originalPayload instanceof String, "Failed to convert message's payload. No suitable converter found for provided contentType: " + message.getHeaders().get(MessageHeaders.CONTENT_TYPE) + " and paylod: " + originalPayload); Object originalContentType = message.getHeaders().get(MessageHeaders.CONTENT_TYPE); String contentType = null; if (originalContentType != null) { contentType = setOriginalContentType ? JavaClassMimeTypeUtils.mimeTypeFromObject(originalPayload, ObjectUtils.nullSafeToString(originalContentType)).toString() : originalContentType.toString() ; } Object payload = originalPayload instanceof byte[] ? originalPayload : ((String) originalPayload).getBytes(StandardCharsets.UTF_8); MessageValues messageValues = new MessageValues(message); messageValues.setPayload(payload); if (StringUtils.hasText(contentType)) { messageValues.put(MessageHeaders.CONTENT_TYPE, contentType); if (originalContentType != null && !originalContentType.toString().equals(contentType.toString())) { messageValues.put(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE, originalContentType.toString()); } } return messageValues; }
Source:
public void setup() { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("test").build(); collection = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); }

Target:
public void setup() { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("test").build(); collection = CollectionBuilder.createCollection(context, parentCommunity).withName("Collection 1").build(); context.restoreAuthSystemState(); }
Source:
public void validate() { if (clustering().cacheMode().isReplicated()) { log.warnPartitionHandlingForReplicatedCaches(); } }

Target:
public void validate() { if (enabled && clustering().cacheMode().isReplicated()) { log.warnPartitionHandlingForReplicatedCaches(); } }
Source:
public static int getBuf(FSDataInputStream f, ByteBuffer readBuf, int maxSize) throws IOException { int res = 0; if (useV21) { try { res = (Integer) invoke(fileAPI.PROVIDE_BUF_READ_METHOD, "Unexpected error reading into a ByteBuffer", readBuf); }catch (UnsupportedOperationException e) { } } else { byte[] buf = new byte[maxSize]; res = f.read(buf); readBuf.put(buf, 0, maxSize); } if (res == 0) { throw new EOFException("Null ByteBuffer returned"); } return res; }

Target:
public static int getBuf(FSDataInputStream f, ByteBuffer readBuf, int maxSize) throws IOException { int res; if (useV21) { try { res = (Integer) fileAPI.PROVIDE_BUF_READ_METHOD.invoke(f, readBuf); } catch (InvocationTargetException e) { if (e.getCause() instanceof UnsupportedOperationException) { useV21 = false; return getBuf(f, readBuf, maxSize); } else if (e.getCause() instanceof IOException) { throw (IOException) e.getCause(); } else { throw new IOException("Error reading out of an FSDataInputStream " + "using the Hadoop 2 ByteBuffer based read method.", e.getCause()); } } catch (IllegalAccessException e) { throw new ShouldNeverHappenException(e); } } else { byte[] buf = new byte[maxSize]; res = f.read(buf); readBuf.put(buf, 0, res); } return res; }
Source:
synchronized Map<QueryId, Map<String, Long>> getTaggedMemoryAllocations() { Map<QueryId, Map<String, Long>> queryIdMap = new HashMap<>(); taggedMemoryAllocations.forEach( (queryId, memoryAllocations) -> { queryIdMap.put( queryId, memoryAllocations.entrySet() .stream() .filter(entry -> !entry.getKey().equals(FORCE_FREE_TAG)) .collect(Collectors.toMap(map -> map.getKey(), map -> map.getValue()))); }); return ImmutableMap.copyOf(queryIdMap); }

Target:
synchronized Map<QueryId, Map<String, Long>> getTaggedMemoryAllocations() { return taggedMemoryAllocations.keySet().stream() .collect(toImmutableMap(identity(), this::getTaggedMemoryAllocations)); }
Source:
public synchronized <T> T bridgeCommunicate(BridgeCommunicationProtocol<T> communication, boolean useAuthentication) { logger.trace("bridgeCommunicate({},{}authenticated) called.", communication.name(), useAuthentication ? "" : "un"); if (!isAuthenticated()) { if (useAuthentication) { logger.trace("bridgeCommunicate(): no auth token available, aborting."); return null; } else { logger.trace("bridgeCommunicate(): no auth token available, continueing."); } } String sapURL = configuration.bridgeProtocol.concat("://").concat(configuration.bridgeIPAddress).concat(":") .concat(Integer.toString(configuration.bridgeTCPPort)).concat(communication.getURL()); logger.trace("bridgeCommunicate(): using SAP {}.", sapURL); Object getRequest = communication.getObjectOfRequest(); Class<T> classOfResponse = communication.getClassOfResponse(); T response; try { if (useAuthentication) { response = ioAuthenticated(sapURL, authenticationToken, getRequest, classOfResponse); } else { response = ioUnauthenticated(sapURL, getRequest, classOfResponse); } logger.trace("bridgeCommunicate(): communication result is {}, returning details.", communication.isCommunicationSuccessful(response)); return response; } catch (IOException ioe) { logger.info("bridgeCommunicate(): Exception occurred on accessing {}: {}.", sapURL, ioe.getMessage()); return null; } catch (JsonSyntaxException jse) { logger.info("bridgeCommunicate(): Exception occurred on (de-)serialization during accessing {}: {}.", sapURL, jse.getMessage()); return null; } }

Target:
public synchronized <T> T bridgeCommunicate(BridgeCommunicationProtocol<T> communication, boolean useAuthentication) { logger.trace("bridgeCommunicate({},{}authenticated) called.", communication.name(), useAuthentication ? "" : "un"); if (!isAuthenticated()) { if (useAuthentication) { logger.trace("bridgeCommunicate(): no auth token available, aborting."); return null; } else { logger.trace("bridgeCommunicate(): no auth token available, continuing."); } } String sapURL = configuration.bridgeProtocol.concat("://").concat(configuration.bridgeIPAddress).concat(":") .concat(Integer.toString(configuration.bridgeTCPPort)).concat(communication.getURL()); logger.trace("bridgeCommunicate(): using SAP {}.", sapURL); Object getRequest = communication.getObjectOfRequest(); Class<T> classOfResponse = communication.getClassOfResponse(); T response; try { if (useAuthentication) { response = ioAuthenticated(sapURL, authenticationToken, getRequest, classOfResponse); } else { response = ioUnauthenticated(sapURL, getRequest, classOfResponse); } logger.trace("bridgeCommunicate(): communication result is {}, returning details.", communication.isCommunicationSuccessful(response)); return response; } catch (IOException ioe) { logger.info("bridgeCommunicate(): Exception occurred on accessing {}: {}.", sapURL, ioe.getMessage()); return null; } catch (JsonSyntaxException jse) { logger.info("bridgeCommunicate(): Exception occurred on (de-)serialization during accessing {}: {}.", sapURL, jse.getMessage()); return null; } }
Source:
public boolean hasAnyTicket(String username) { Collection<Ticket> tickets = ticketRepository.findAllByOwnerUsername(username); return tickets.stream().anyMatch(Ticket::isValid); }

Target:
public boolean hasAnyTicket(String username) { return ticketRepository.findAllByOwnerUsername(username).stream().anyMatch(Ticket::isValid); }
Source:
public void testContentTypeConfigurer() throws Exception { final CountDownLatch latch = new CountDownLatch(1); testSink.input().subscribe(new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { Assert.isTrue(message.getPayload() instanceof Tuple); Assert.isTrue(((Tuple)message.getPayload()).getFieldNames().get(0).equals("message")); Assert.isTrue(((Tuple) message.getPayload()).getValue(0).equals("Hi")); latch.countDown(); } }); testSource.output().send(MessageBuilder.withPayload("{\"message\":\"Hi\"}").build()); latch.await(10, TimeUnit.SECONDS); }

Target:
public void testContentTypeConfigurer() throws Exception { final CountDownLatch latch = new CountDownLatch(1); MessageHandler messageHandler = new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { assertTrue(message.getPayload() instanceof Tuple); assertTrue(((Tuple) message.getPayload()).getFieldNames().get(0).equals("message")); assertTrue(((Tuple) message.getPayload()).getValue(0).equals("Hi")); latch.countDown(); } }; testSink.input().subscribe(messageHandler); testSource.output().send(MessageBuilder.withPayload("{\"message\":\"Hi\"}").build()); latch.await(10, TimeUnit.SECONDS); assertTrue(latch.getCount() == 0); testSink.input().unsubscribe(messageHandler); }
Source:
private void extendDiskImageSize() { lockImageInDb(); VdcReturnValueBase ret = getBackend().runInternalAction( VdcActionType.ExtendImageSize, createExtendImageSizeParameters(), ExecutionHandler.createDefaultContexForTasks(getExecutionContext()) ); if (ret.getSucceeded()) { getReturnValue().getTaskIdList().addAll(ret.getInternalTaskIdList()); } else { propagateInternalCommandFailure(ret); unlockImageInDb(); getReturnValue().setFault(ret.getFault()); } setSucceeded(ret.getSucceeded()); }

Target:
private void extendDiskImageSize() { lockImageInDb(); VdcReturnValueBase ret = getBackend().runInternalAction( VdcActionType.ExtendImageSize, createExtendImageSizeParameters(), ExecutionHandler.createDefaultContexForTasks(getExecutionContext()) ); if (ret.getSucceeded()) { getReturnValue().getTaskIdList().addAll(ret.getInternalTaskIdList()); } else { propagateInternalCommandFailure(ret); getReturnValue().setFault(ret.getFault()); } setSucceeded(ret.getSucceeded()); }
Source:
public void testParseDateWithIncorrectWeekday() { GregorianCalendar exp1 = new GregorianCalendar(2014, 9, 8, 9, 00, 00); exp1.setTimeZone(TimeZone.getTimeZone("GMT")); Date expected = new Date(exp1.getTimeInMillis()); Date actual = DateUtils.parse("Thu, 8 Oct 2014 09:00:00 GMT"); assertEquals(expected, actual); }

Target:
public void testParseDateWithIncorrectWeekday() { GregorianCalendar exp1 = new GregorianCalendar(2014, 9, 8, 9, 0, 0); exp1.setTimeZone(TimeZone.getTimeZone("GMT")); Date expected = new Date(exp1.getTimeInMillis()); Date actual = DateUtils.parse("Thu, 8 Oct 2014 09:00:00 GMT"); assertEquals(expected, actual); }
Source:
public static Application rebind(LocalManagementContext newManagementContext, ClassLoader classLoader, RebindExceptionHandler exceptionHandler) throws Exception { Collection<Application> newApps = rebindAll(newManagementContext, classLoader, null); if (newApps.isEmpty()) throw new IllegalStateException("Application could not be rebinded; serialization probably failed"); return Iterables.getFirst(newApps, null); }

Target:
public static Application rebind(LocalManagementContext newManagementContext, ClassLoader classLoader, RebindExceptionHandler exceptionHandler) throws Exception { Collection<Application> newApps = rebindAll(newManagementContext, classLoader, exceptionHandler); if (newApps.isEmpty()) throw new IllegalStateException("Application could not be rebinded; serialization probably failed"); return Iterables.getFirst(newApps, null); }
Source:
public ACHBank(String fileData) { setBankRoutingNumber(getField(fileData, 1, 9)); setBankOfficeCode(getField(fileData, 10, 1)); setBankServiceNumber(getField(fileData, 11, 9)); setBankTypeCode(getField(fileData, 20, 1)); setBankNewRoutingNumber(getField(fileData, 27, 9)); setBankName(getField(fileData, 36, 36)); setBankStreetAddress(getField(fileData, 72, 36)); setBankCityName(getField(fileData, 108, 20)); setBankStateCode(getField(fileData, 128, 2)); setBankZipCode(getField(fileData, 130, 5)); setBankPhoneAreaCode(getField(fileData, 139, 3)); setBankPhonePrefixNumber(getField(fileData, 142, 3)); setBankPhoneSuffixNumber(getField(fileData, 145, 4)); setBankInstitutionStatusCode(getField(fileData, 149, 1)); setActive(true); setBankCountryCode(KFSConstants.COUNTRY_CODE_UNITED_STATES); }

Target:
public ACHBank(String fileData) { setBankRoutingNumber(getField(fileData, 1, 9)); setBankOfficeCode(getField(fileData, 10, 1)); setBankServiceNumber(getField(fileData, 11, 9)); setBankTypeCode(getField(fileData, 20, 1)); setBankNewRoutingNumber(getField(fileData, 27, 9)); setBankName(getField(fileData, 36, 36)); setBankStreetAddress(getField(fileData, 72, 36)); setBankCityName(getField(fileData, 108, 20)); setBankStateCode(getField(fileData, 128, 2)); setBankZipCode(getField(fileData, 130, 5)); setBankPhoneAreaCode(getField(fileData, 139, 3)); setBankPhonePrefixNumber(getField(fileData, 142, 3)); setBankPhoneSuffixNumber(getField(fileData, 145, 4)); setBankInstitutionStatusCode(getField(fileData, 149, 1)); setBankDataViewCode(getField(fileData, 150, 1)); setActive(true); setBankCountryCode(KFSConstants.COUNTRY_CODE_UNITED_STATES); }
Source:
public int hashCode() { int result = container.hashCode(); result = 31 * result + moduleSequence.hashCode(); result = 31 * result + moduleDescriptorKey.hashCode(); return result; }

Target:
public int hashCode() { int result = container.hashCode(); result = 31 * result + moduleSequence; result = 31 * result + moduleDescriptorKey.hashCode(); return result; }
Source:
private String getResultFromStream(InputStream inputStream) { try (Scanner scanner = new Scanner(inputStream, charset.name())) { return scanner.useDelimiter("\\A").next().trim(); } }

Target:
private String getResultFromStream(InputStream inputStream) { try (Scanner scanner = new Scanner(inputStream, charset.name())) { String result = null; if (scanner.hasNextLine()) { result = scanner.nextLine(); if (scanner.hasNextLine()) { LOGGER.warn("External process has more than one line of output. " + "Only the first line is used."); } } else { LOGGER.warn("External process has not produced any output."); } return result; } }
Source:
public boolean filter(Bundle bundle) { for (int i = 0; i < in.length; i++) { ValueObject v = in[i].getValue(bundle); if (v == null) { continue; } switch (v.getObjectType()) { case ARRAY: ValueArray arr = v.asArray(); if (arr.size() > 0) { if (which != null) { ValueObject fieldName = ValueFactory.create(((CachingField) in[i]).name); which.setValue(bundle, fieldName); } out.setValue(bundle, arr); return true; } break; default: String str = ValueUtil.asNativeString(v); if (!Strings.isEmpty(str)) { if (which != null) { ValueObject fieldName = ValueFactory.create(((CachingField) in[i]).name); which.setValue(bundle, fieldName); } out.setValue(bundle, v); return true; } break; } } return false; }

Target:
public boolean filter(Bundle bundle) { for (int i = 0; i < in.length; i++) { ValueObject v = in[i].getValue(bundle); if (v == null) { continue; } switch (v.getObjectType()) { case ARRAY: ValueArray arr = v.asArray(); if (arr.size() > 0) { if (which != null) { ValueObject fieldName = ValueFactory.create(in[i].name); which.setValue(bundle, fieldName); } out.setValue(bundle, arr); return true; } break; default: String str = ValueUtil.asNativeString(v); if (!Strings.isEmpty(str)) { if (which != null) { ValueObject fieldName = ValueFactory.create(in[i].name); which.setValue(bundle, fieldName); } out.setValue(bundle, v); return true; } break; } } return false; }
Source:
public String getColumnText(Object aObj, int aIndex) { if (aObj instanceof GerritTask) { GerritTask reviewSummary = (GerritTask) aObj; switch (aIndex) { case 0: return reviewSummary.getAttribute(GerritTask.IS_STARRED); case 1: return reviewSummary.getAttribute(GerritTask.SHORT_CHANGE_ID); case 2: return reviewSummary.getAttribute(GerritTask.SUBJECT); case 3: return reviewSummary.getAttribute(GerritTask.OWNER); case 4: return reviewSummary.getAttribute(GerritTask.PROJECT); case 5: return reviewSummary.getAttribute(GerritTask.BRANCH); case 6: return reviewSummary.getAttribute(GerritTask.TOPIC); case 7: return reviewSummary.getAttributeAsDate(GerritTask.DATE_MODIFICATION); default: return EMPTY_STRING; } } return EMPTY_STRING; }

Target:
public String getColumnText(Object aObj, int aIndex) { if (aObj instanceof GerritTask) { GerritTask reviewSummary = (GerritTask) aObj; switch (aIndex) { case 0: return reviewSummary.getAttribute(GerritTask.IS_STARRED); case 1: return reviewSummary.getAttribute(GerritTask.SHORT_CHANGE_ID); case 2: return reviewSummary.getAttribute(GerritTask.SUBJECT); case 3: return reviewSummary.getAttribute(GerritTask.OWNER); case 4: return reviewSummary.getAttribute(GerritTask.PROJECT); case 5: String branch = reviewSummary.getAttribute(GerritTask.BRANCH); String topic = reviewSummary.getAttribute(GerritTask.TOPIC); if (topic != null && !topic.isEmpty()) { branch += " (" + reviewSummary.getAttribute(GerritTask.TOPIC) + ")"; } return branch; case 6: return reviewSummary.getAttributeAsDate(GerritTask.DATE_MODIFICATION); default: return EMPTY_STRING; } } return EMPTY_STRING; }
Source:
public void onReceivedHttpAuthRequest(WebView view, final HttpAuthHandler handler, String host, String realm) { Logger.i(TAG, "onReceivedHttpAuthRequest for host:" + host, ""); if (mUIEvent != null) { mUIEvent.setNTLM(true); } HttpAuthDialog authDialog = new HttpAuthDialog(mCallingContext, host, realm); authDialog.setOkListener(new HttpAuthDialog.OkListener() { public void onOk(String host, String realm, String username, String password) { Logger.i(TAG, "onReceivedHttpAuthRequest: handler proceed" + host, ""); handler.proceed(username, password); } }); authDialog.setCancelListener(new HttpAuthDialog.CancelListener() { public void onCancel() { Logger.i(TAG, "onReceivedHttpAuthRequest: handler cancelled", ""); handler.cancel(); cancelWebViewRequest(); } }); Logger.i(TAG, "onReceivedHttpAuthRequest: show dialog", ""); authDialog.show(); }

Target:
public void onReceivedHttpAuthRequest(WebView view, final HttpAuthHandler handler, String host, String realm) { Logger.i(TAG, "onReceivedHttpAuthRequest for host:" + host, ""); mUIEvent.setNTLM(true); HttpAuthDialog authDialog = new HttpAuthDialog(mCallingContext, host, realm); authDialog.setOkListener(new HttpAuthDialog.OkListener() { public void onOk(String host, String realm, String username, String password) { Logger.i(TAG, "onReceivedHttpAuthRequest: handler proceed" + host, ""); handler.proceed(username, password); } }); authDialog.setCancelListener(new HttpAuthDialog.CancelListener() { public void onCancel() { Logger.i(TAG, "onReceivedHttpAuthRequest: handler cancelled", ""); handler.cancel(); cancelWebViewRequest(); } }); Logger.i(TAG, "onReceivedHttpAuthRequest: show dialog", ""); authDialog.show(); }
Source:
private void closeCachedLookupSources() { rwLock.writeLock().lock(); try { suppliedLookupSources.values().forEach(LookupSource::close); suppliedLookupSources.clear(); } finally { rwLock.writeLock().unlock(); } }

Target:
private void closeCachedLookupSources() { lock.writeLock().lock(); try { suppliedLookupSources.values().forEach(LookupSource::close); suppliedLookupSources.clear(); } finally { lock.writeLock().unlock(); } }