auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testExtractValues() throws Exception { @SuppressWarnings("serial") FieldApprover notNullDataInfoFieldApprover = new FieldApprover() { @Override public boolean approve(DataInfo dataInfo) { return dataInfo != null; } }; DataInfo dataInfo = new DataInfo(); Collection<StructuredProperty> source = Lists.newArrayList(); String validValue = "someValue"; source.add(generateStructuredProperty(validValue, dataInfo)); source.add(generateStructuredProperty(null, dataInfo)); source.add(generateStructuredProperty("toBeRejectedBecauseOfNullDataInfo", null)); List<String> results = MetadataConverterUtils.extractValues(source, notNullDataInfoFieldApprover); assertNotNull(results); assertEquals(1, results.size()); assertEquals(validValue, results.get(0)); }

Target:
public void testExtractValues() { FieldApprover notNullDataInfoFieldApprover = Objects::nonNull; DataInfo dataInfo = new DataInfo(); Collection<StructuredProperty> source = Lists.newArrayList(); String validValue = "someValue"; source.add(generateStructuredProperty(validValue, dataInfo)); source.add(generateStructuredProperty(null, dataInfo)); source.add(generateStructuredProperty("", dataInfo)); source.add(generateStructuredProperty("toBeRejectedBecauseOfNullDataInfo", null)); List<String> results = MetadataConverterUtils.extractValues(source, notNullDataInfoFieldApprover); assertNotNull(results); assertEquals(1, results.size()); assertEquals(validValue, results.get(0)); }
Source:
protected T getResultValue(String aResponse) { try { String result = extractValueFromXML(aResponse, getXPathString()); return unmarshal(result); } catch (XPathExpressionException ex) { ex.printStackTrace(); } catch (ParserConfigurationException ex) { ex.printStackTrace(); } catch (SAXException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } return null; }

Target:
protected T getResultValue(String aResponse) { try { String result = extractValueFromXML(aResponse, getXPathString()); return unmarshal(result); } catch (XPathExpressionException ex) { logger.error("Error parsing XML data.", ex); } catch (ParserConfigurationException ex) { logger.error("Error parsing XML data.", ex); } catch (SAXException ex) { logger.error("Error parsing XML data.", ex); } catch (IOException ex) { logger.error("Error reading XML data.", ex); } return null; }
Source:
public Object[] getExpectedResultsForHive() { return new Object[]{ new Integer(1), new BigDecimal("100"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("100"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("1000000"), new BigDecimal("1000000.05000") }; }

Target:
public Object[] getExpectedResultsForHive() { return new Object[]{ new Integer(1), new BigDecimal("100"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("100"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("1000000"), null }; }
Source:
public long skip(long n) throws IOException { long seek = Math.min(position() + n, totalSize); ensureProperFile(false, seek); return sageFileChannel.skip(n - fileOffsets[currFileIndex]); }

Target:
public long skip(long n) throws IOException { if (n < 0) return 0; long pos = position(); long seek = Math.min(pos + n, totalSize); position(seek); return seek - pos; }
Source:
public static boolean isRecoverableException(ExecutionException e) { if (!(e.getCause() instanceof SdkException)) { return false; } SdkException ase = (SdkException) e.getCause(); return ase instanceof LimitExceededException || ase instanceof ProvisionedThroughputExceededException || ase instanceof ResourceInUseException; }

Target:
public static boolean isRecoverableException(ExecutionException e) { if (!(e.getCause() instanceof SdkException)) { return false; } SdkException ase = (SdkException) e.getCause(); return ase instanceof LimitExceededException || ase instanceof ProvisionedThroughputExceededException; }
Source:
public String getUnmodifiedInstance() { return m_ipAddress + "[" + m_serviceName + "]"; }

Target:
public String getUnmodifiedInstance() { return getInstance(); }
Source:
private static short configureAcks(ProducerConfig config, Logger log) { boolean userConfiguredAcks = config.originals().containsKey(ProducerConfig.ACKS_CONFIG); short acks = (short) ProducerConfig.parseAcks(config.getString(ProducerConfig.ACKS_CONFIG)); if (config.idempotenceEnabled() && !userConfiguredAcks) { log.info("Overriding the default to all since idempotence is enabled.", ProducerConfig.ACKS_CONFIG); } if (config.idempotenceEnabled() && acks != -1) { throw new ConfigException("Must set " + ProducerConfig.ACKS_CONFIG + " to all in order to use the idempotent " + "producer. Otherwise we cannot guarantee idempotence."); } return acks; }

Target:
private static short configureAcks(ProducerConfig config, Logger log) { boolean userConfiguredAcks = config.originals().containsKey(ProducerConfig.ACKS_CONFIG); short acks = Short.valueOf(config.getString(ProducerConfig.ACKS_CONFIG)); if (config.idempotenceEnabled()) { if (!userConfiguredAcks) log.info("Overriding the default to all since idempotence is enabled.", ProducerConfig.ACKS_CONFIG); else if (acks != -1) throw new ConfigException("Must set " + ProducerConfig.ACKS_CONFIG + " to all in order to use the idempotent " + "producer. Otherwise we cannot guarantee idempotence."); } return acks; }
Source:
public void fetchAndMerge(BibEntry entry, List<Field> fields) { for (Field field : fields) { Optional<String> fieldContent = entry.getField(field); if (fieldContent.isPresent()) { Optional<IdBasedFetcher> fetcher = WebFetchers.getIdBasedFetcherForField(field, Globals.prefs.getImportFormatPreferences()); if (fetcher.isPresent()) { BackgroundTask.wrap(() -> fetcher.get().performSearchById(fieldContent.get())) .onSuccess(fetchedEntry -> { ImportCleanup cleanup = new ImportCleanup(BibDatabaseModeDetection.inferMode(new BibDatabase(List.of(entry)))); cleanup.doPostCleanup(entry); String type = field.getDisplayName(); if (fetchedEntry.isPresent()) { showMergeDialog(entry, fetchedEntry.get(), fetcher.get()); } else { dialogService.notify(Localization.lang("Cannot get info based on given %0: %1", type, fieldContent.get())); } }) .onFailure(exception -> { LOGGER.error("Error while fetching bibliographic information", exception); dialogService.showErrorDialogAndWait(exception); }) .executeWith(Globals.TASK_EXECUTOR); } } else { dialogService.notify(Localization.lang("No %0 found", field.getDisplayName())); } } }

Target:
public void fetchAndMerge(BibEntry entry, List<Field> fields) { for (Field field : fields) { Optional<String> fieldContent = entry.getField(field); if (fieldContent.isPresent()) { Optional<IdBasedFetcher> fetcher = WebFetchers.getIdBasedFetcherForField(field, Globals.prefs.getImportFormatPreferences()); if (fetcher.isPresent()) { BackgroundTask.wrap(() -> fetcher.get().performSearchById(fieldContent.get())) .onSuccess(fetchedEntry -> { ImportCleanup cleanup = new ImportCleanup(panel.getBibDatabaseContext().getMode()); cleanup.doPostCleanup(entry); String type = field.getDisplayName(); if (fetchedEntry.isPresent()) { showMergeDialog(entry, fetchedEntry.get(), fetcher.get()); } else { dialogService.notify(Localization.lang("Cannot get info based on given %0: %1", type, fieldContent.get())); } }) .onFailure(exception -> { LOGGER.error("Error while fetching bibliographic information", exception); dialogService.showErrorDialogAndWait(exception); }) .executeWith(Globals.TASK_EXECUTOR); } } else { dialogService.notify(Localization.lang("No %0 found", field.getDisplayName())); } } }
Source:
private void loadWordAndShow(String serverID) { Word word = wordsStorage.getWordFromLocal(serverID, langCode); if (word != null) { showWord(word); } else { progress = ProgressDialog.show(this, getString(R.string.dialog_downloading), getString(R.string.dialog_download_word_please_wait), true); wordsStorage.getWordFromServer(serverID, langCode, new DownloadWordListener() { @Override public void onWordReceived(Word word) { progress.dismiss(); showWord(word); } @Override public void onError(int errorType, Exception e) { progress.dismiss(); Toast.makeText(CardActivity.this, e.getMessage(), Toast.LENGTH_LONG).show(); } }); } }

Target:
private void loadWordAndShow(String serverID) { Word word = wordsStorage.getWordFromLocal(serverID, langCode); if (word != null) { showWord(word); } else { progress = ProgressDialog.show(this, getString(R.string.dialog_title_downloading), getString(R.string.dialog_desc_downloading), true); wordsStorage.getWordFromServer(serverID, langCode, new DownloadWordListener() { @Override public void onWordReceived(Word word) { progress.dismiss(); showWord(word); } @Override public void onError(int errorType, Exception e) { String title = ""; String desc = ""; switch (errorType) { case DownloadWordListener.NETWORK_ERROR: title = getString(R.string.dialog_title_network_error); desc = getString(R.string.dialog_desc_network_error); break; case DownloadWordListener.HTTP_ERROR: title = getString(R.string.dialog_title_http_error); desc = getString(R.string.dialog_desc_http_error); break; case DownloadWordListener.INTERNAL_ERROR: title = getString(R.string.dialog_title_internal_error); desc = getString(R.string.dialog_desc_internal_error); break; } failOccurIndex = currentIndex--; progress.dismiss(); ShowAlertDialog(title, desc, failOccurIndex == 0); } }); } }
Source:
public HashMap<String, ArrayList<Order>> getSellOrders() { return sellOrders; }

Target:
private HashMap<String, ArrayList<Order>> getSellOrders() { return sellOrders; }
Source:
public void dropTableIfExistsCascade(final RelationKey relationKey) throws DbException { execute("DROP TABLE IF EXISTS " + relationKey.toString(MyriaConstants.STORAGE_SYSTEM_SQLITE)); }

Target:
public void dropTableIfExistsCascade(final RelationKey relationKey) throws DbException { LOGGER.warn("SQLite does not implement DROP TABLE...CASCADE, attempting DROP TABLE instead"); execute("DROP TABLE IF EXISTS " + relationKey.toString(MyriaConstants.STORAGE_SYSTEM_SQLITE)); }
Source:
public void setSpecialSelectionProvider(ISelectionProvider provider) { if (fSite.getSelectionProvider() != null) { ISelectionProvider currentProvider = fSpecialProvider != null ? fSpecialProvider : fSite.getSelectionProvider(); disposeAction(fFindDeclarationsAction, currentProvider); disposeAction(fFindDeclarationsInProjectAction, currentProvider); disposeAction(fFindDeclarationsInHierarchyAction, currentProvider); disposeAction(fFindDeclarationsInWorkingSetAction, currentProvider); } fSpecialProvider = provider; fFindDeclarationsAction.setSpecialSelectionProvider(provider); fFindDeclarationsInProjectAction.setSpecialSelectionProvider(provider); fFindDeclarationsInWorkingSetAction.setSpecialSelectionProvider(provider); fFindDeclarationsInHierarchyAction.setSpecialSelectionProvider(provider); if (provider != null && fSite.getSelectionProvider() != null) { ISelection selection = provider.getSelection(); registerAction(fFindDeclarationsAction, provider, selection); registerAction(fFindDeclarationsInProjectAction, provider, selection); registerAction(fFindDeclarationsInHierarchyAction, provider, selection); registerAction(fFindDeclarationsInWorkingSetAction, provider, selection); } }

Target:
public void setSpecialSelectionProvider(ISelectionProvider provider) { if (fRegisterInProvider) { unregisterActions(); } fSelectionProvider = provider; fFindDeclarationsAction.setSpecialSelectionProvider(provider); fFindDeclarationsInProjectAction.setSpecialSelectionProvider(provider); fFindDeclarationsInWorkingSetAction.setSpecialSelectionProvider(provider); fFindDeclarationsInHierarchyAction.setSpecialSelectionProvider(provider); if (fRegisterInProvider) { registerActions(); } }
Source:
public void save(String pluginName, String message) throws IOException { Repository repo = new FileRepository(path); try { inserter = repo.newObjectInserter(); reader = repo.newObjectReader(); try { RevWalk rw = new RevWalk(reader); try { RevTree srcTree = revision != null ? rw.parseTree(revision) : null; newTree = readTree(srcTree); saveConfig(ProjectConfig.PROJECT_CONFIG, cfg); ObjectId res = newTree.writeTree(inserter); if (res.equals(srcTree)) { return; } PersonIdent ident = new PersonIdent(pluginName, pluginName + "@gerrit"); String msg = "Update from plugin " + pluginName + ": " + message; CommitBuilder commit = new CommitBuilder(); commit.setAuthor(ident); commit.setCommitter(ident); commit.setMessage(msg); commit.setTreeId(res); if (revision != null) { commit.addParentId(revision); } ObjectId newRevision = inserter.insert(commit); updateRef(repo, ident, newRevision, "commit: " + msg); revision = newRevision; } finally { rw.release(); } } finally { if (inserter != null) { inserter.release(); } if (reader != null) { reader.release(); } } } finally { repo.close(); } }

Target:
public void save(String pluginName, String message) throws IOException { Repository repo = new FileRepository(path); try { inserter = repo.newObjectInserter(); reader = repo.newObjectReader(); try { RevWalk rw = new RevWalk(reader); try { RevTree srcTree = revision != null ? rw.parseTree(revision) : null; newTree = readTree(srcTree); saveConfig(ProjectConfig.PROJECT_CONFIG, cfg); ObjectId res = newTree.writeTree(inserter); if (res.equals(srcTree)) { return; } PersonIdent ident = new PersonIdent(pluginName, pluginName + "@gerrit"); String msg = "Update from plugin " + pluginName + ": " + message; CommitBuilder commit = new CommitBuilder(); commit.setAuthor(ident); commit.setCommitter(ident); commit.setMessage(msg); commit.setTreeId(res); if (revision != null) { commit.addParentId(revision); } ObjectId newRevision = inserter.insert(commit); updateRef(repo, ident, newRevision, "commit: " + msg); revision = newRevision; } finally { rw.release(); } } finally { if (inserter != null) { inserter.release(); inserter = null; } if (reader != null) { reader.release(); reader = null; } } } finally { repo.close(); } }
Source:
private void setVideo() { StepVideo video = mStep.getVideo(); StepVideoThumbnail thumb = video.getThumbnail(); fitVideoToSpace(thumb); mMainImage.setVisibility(View.VISIBLE); mVideoPlayButtonContainer.setVisibility(View.VISIBLE); mMainWebView.setVisibility(View.GONE); mMainProgress.setVisibility(View.GONE); mImageManager.displayImage(thumb.getUrl(), mContext, mMainImage); String videoURL = video.getEncodings().get(0).getURL(); mVideoPlayButton.setTag(R.id.guide_step_view_video_url, videoURL); mVideoPlayButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String url = (String) v.getTag(R.id.guide_step_view_video_url); Intent i = new Intent(mContext, VideoViewActivity.class); i.putExtra(VideoViewActivity.VIDEO_URL, url); startActivity(i); } }); }

Target:
private void setVideo() { StepVideo video = mStep.getVideo(); StepVideoThumbnail thumb = video.getThumbnail(); ViewGroup.LayoutParams params = fitToSpace(mMainImage, thumb.getWidth(), thumb.getHeight()); mMainImage.setLayoutParams(params); mVideoPlayButtonContainer.setLayoutParams(params); mMainImage.setVisibility(View.VISIBLE); mVideoPlayButtonContainer.setVisibility(View.VISIBLE); mMainWebView.setVisibility(View.GONE); mMainProgress.setVisibility(View.GONE); mImageManager.displayImage(thumb.getUrl(), mContext, mMainImage); String videoURL = video.getEncodings().get(0).getURL(); mVideoPlayButton.setTag(R.id.guide_step_view_video_url, videoURL); mVideoPlayButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String url = (String) v.getTag(R.id.guide_step_view_video_url); Intent i = new Intent(mContext, VideoViewActivity.class); i.putExtra(VideoViewActivity.VIDEO_URL, url); startActivity(i); } }); }
Source:
private void onGameLaunchMessage(GameLaunchMessage message) { if (message.getInitMode() != LobbyMode.AUTO_LOBBY) { return; } matchmakingQueues.stream().filter(q -> q.getMatchingStatus() != null).forEach(q -> { q.setTimedOutMatchingStatus(MatchingStatus.GAME_LAUNCHING, Duration.ofSeconds(15), taskScheduler); }); matchFoundAndWaitingForGameLaunch = false; gameService.onMatchmakerSearchStopped(); }

Target:
protected void onGameLaunchMessage(GameLaunchMessage message) { if (message.getInitMode() != LobbyMode.AUTO_LOBBY) { return; } matchmakingQueues.stream() .filter(q -> q.getMatchingStatus() != null) .forEach(q -> q.setTimedOutMatchingStatus(MatchingStatus.GAME_LAUNCHING, Duration.ofSeconds(15), taskScheduler)); matchFoundAndWaitingForGameLaunch = false; gameService.onMatchmakerSearchStopped(); }
Source:
protected List<URL> getUrls() throws MalformedURLException { List<URL> urls = Lists.newArrayList(); if (jars.isEmpty()) { if (!yaml.isEmpty()) { try { File yamlFolder = new File(yaml); if (yamlFolder.isDirectory()) { File[] fileList = yamlFolder.listFiles(); for (File file : fileList) { if (file.isFile() && (file.getName().contains(".yaml") || file.getName().contains(".bom"))) { urls.add(file.toURI().toURL()); } } } else { urls.add(new File(yaml).toURI().toURL()); } } catch (IOException e) { e.printStackTrace(); } } else { String classpath = System.getenv("INITIAL_CLASSPATH"); if (Strings.isNonBlank(classpath)) { List<String> entries = Splitter.on(":").omitEmptyStrings().trimResults().splitToList(classpath); for (String entry : entries) { if (entry.endsWith(".jar") || entry.endsWith("/*")) { urls.addAll(ClassFinder.toJarUrls(entry.replace("/*", ""))); } } } else { throw new IllegalArgumentException("No Jars to process"); } } } else { for (String jar : jars) { List<URL> expanded = ClassFinder.toJarUrls(jar); if (expanded.isEmpty()) LOG.warn("No jars found at: "+jar); urls.addAll(expanded); } } return urls; }

Target:
protected List<URL> getUrls() throws MalformedURLException, IOException { List<URL> urls = Lists.newArrayList(); if (jars.isEmpty()) { if (!yaml.isEmpty()) { File yamlFolder = new File(yaml); if (yamlFolder.isDirectory()) { File[] fileList = yamlFolder.listFiles(); for (File file : fileList) { if (file.isFile() && (file.getName().contains(".yaml") || file.getName().contains(".bom"))) { urls.add(file.toURI().toURL()); } } } else { urls.add(new File(yaml).toURI().toURL()); } } else { String classpath = System.getenv("INITIAL_CLASSPATH"); if (Strings.isNonBlank(classpath)) { List<String> entries = Splitter.on(":").omitEmptyStrings().trimResults().splitToList(classpath); for (String entry : entries) { if (entry.endsWith(".jar") || entry.endsWith("/*")) { urls.addAll(ClassFinder.toJarUrls(entry.replace("/*", ""))); } } } else { throw new IllegalArgumentException("No Jars to process"); } } } else { for (String jar : jars) { List<URL> expanded = ClassFinder.toJarUrls(jar); if (expanded.isEmpty()) LOG.warn("No jars found at: "+jar); urls.addAll(expanded); } } return urls; }
Source:
protected void doDeactivate() throws Exception { CDOViewRegistryImpl.INSTANCE.deregister(this); LifecycleUtil.deactivate(invalidationRunner, OMLogger.Level.WARN); try { CDOSessionProtocol sessionProtocol = session.getSessionProtocol(); if (LifecycleUtil.isActive(sessionProtocol)) { sessionProtocol.closeView(viewID); } } catch (Exception ex) { OM.LOG.error(ex); } finally { synchronized (lockStates) { options.lockStatePrefetcher.dispose(); options.lockStatePrefetcher = null; if (!lockStates.isEmpty()) { List<CDOLockState> result = new ArrayList<CDOLockState>(); for (CDOLockState lockState : lockStates.values()) { if (((InternalCDOLockState)lockState).removeOwner(lockOwner)) { result.add(lockState); } } if (!result.isEmpty()) { CDOLockState[] deactivateLockStates = result.toArray(new CDOLockState[result.size()]); long timeStamp = session.getLastUpdateTime(); notifyOtherViewsAboutLockChanges(Operation.UNLOCK, null, timeStamp, deactivateLockStates); } lockStates.clear(); lockOwner = null; } } } try { session.viewDetached(this); } catch (Exception ex) { OM.LOG.error(ex); } changeSubscriptionManager = null; super.doDeactivate(); }

Target:
protected void doDeactivate() throws Exception { CDOViewRegistryImpl.INSTANCE.deregister(this); LifecycleUtil.deactivate(invalidationRunner, OMLogger.Level.WARN); try { CDOSessionProtocol sessionProtocol = session.getSessionProtocol(); if (LifecycleUtil.isActive(sessionProtocol)) { sessionProtocol.closeView(viewID); } } catch (Exception ex) { OM.LOG.error(ex); } finally { synchronized (lockStates) { if (options.lockStatePrefetcher != null) { options.lockStatePrefetcher.dispose(); options.lockStatePrefetcher = null; } if (!lockStates.isEmpty()) { List<CDOLockState> result = new ArrayList<CDOLockState>(); for (CDOLockState lockState : lockStates.values()) { if (((InternalCDOLockState)lockState).removeOwner(lockOwner)) { result.add(lockState); } } if (!result.isEmpty()) { CDOLockState[] deactivateLockStates = result.toArray(new CDOLockState[result.size()]); long timeStamp = session.getLastUpdateTime(); notifyOtherViewsAboutLockChanges(Operation.UNLOCK, null, timeStamp, deactivateLockStates); } lockStates.clear(); lockOwner = null; } } } try { session.viewDetached(this); } catch (Exception ex) { OM.LOG.error(ex); } changeSubscriptionManager = null; super.doDeactivate(); }
Source:
public List<TriggerEventRequest> buildTriggers() { List<TriggerEventRequest> triggers = new ArrayList<>(); Map<String, Set<String>> caseTypes = new HashMap<>(); for (Config config : configService.getConfigs().getConfigs()) { for (CommcareApplicationJson application : applicationService.getByConfigName(config.getName())) { for (CommcareModuleJson module : application.getModules()) { if (!caseTypes.containsKey(module.getCaseType())) { caseTypes.put(module.getCaseType(), new HashSet<>(module.getCaseProperties())); String applicationName = application.getApplicationName(); List<EventParameterRequest> parameterRequests = new ArrayList<>(); parameterRequests.add(new EventParameterRequest("commcare.field.configName", CONFIG_NAME)); addCommonCaseFields(parameterRequests); for (String caseProperty : module.getCaseProperties()) { parameterRequests.add(new EventParameterRequest(caseProperty, caseProperty)); } String displayName = DisplayNameHelper.buildDisplayName(RECEIVED_CASE, module.getCaseType(), applicationName, config.getName()); triggers.add(new TriggerEventRequest(displayName, CASE_EVENT + "." + config.getName() + "." + module.getCaseType(), null, parameterRequests, CASE_EVENT)); } } } } triggers.addAll(buildTriggersForMinimalStrategy()); return triggers; }

Target:
public List<TriggerEventRequest> buildTriggers() { List<TriggerEventRequest> triggers = new ArrayList<>(); Set<String> caseTypes = new HashSet<>(); for (Config config : configService.getConfigs().getConfigs()) { for (CommcareApplicationJson application : schemaService.retrieveApplications(config.getName())) { for (CommcareModuleJson module : application.getModules()) { if (!caseTypes.contains(module.getCaseType())) { caseTypes.add(module.getCaseType()); String applicationName = application.getApplicationName(); List<EventParameterRequest> parameterRequests = new ArrayList<>(); parameterRequests.add(new EventParameterRequest("commcare.field.configName", CONFIG_NAME)); addCommonCaseFields(parameterRequests); for (String caseProperty : module.getCaseProperties()) { parameterRequests.add(new EventParameterRequest(caseProperty, caseProperty)); } String displayName = DisplayNameHelper.buildDisplayName(RECEIVED_CASE, module.getCaseType(), applicationName, config.getName()); triggers.add(new TriggerEventRequest(displayName, CASE_EVENT + "." + config.getName() + "." + module.getCaseType(), null, parameterRequests, CASE_EVENT)); } } } } triggers.addAll(buildTriggersForMinimalStrategy()); return triggers; }
Source:
private void doCopyRetry(FileSystem sourceFs, List<ReplChangeManager.FileInfo> srcFileList, FileSystem destinationFs, Path destination, boolean useRegularCopy) throws IOException, LoginException { int repeat = 0; boolean isCopyError = false; List<Path> pathList = Lists.transform(srcFileList, ReplChangeManager.FileInfo::getEffectivePath); while (!pathList.isEmpty() && (repeat < MAX_COPY_RETRY)) { LOG.info("Attempt: " + (repeat+1) + ". Copying files: " + pathList); try { isCopyError = false; doCopyOnce(sourceFs, pathList, destinationFs, destination, useRegularCopy); } catch (IOException e) { isCopyError = true; } pathList = getFilesToRetry(sourceFs, srcFileList, destinationFs, destination, isCopyError); repeat++; } if (!pathList.isEmpty() || isCopyError) { LOG.error("File copy failed even after several attempts. Files list: " + srcFileList); throw new IOException("File copy failed even after several attempts."); } }

Target:
private void doCopyRetry(FileSystem sourceFs, List<ReplChangeManager.FileInfo> srcFileList, FileSystem destinationFs, Path destination, boolean useRegularCopy) throws IOException, LoginException { int repeat = 0; boolean isCopyError = false; List<Path> pathList = Lists.transform(srcFileList, ReplChangeManager.FileInfo::getEffectivePath); while (!pathList.isEmpty() && (repeat < MAX_COPY_RETRY)) { LOG.info("Attempt: " + (repeat+1) + ". Copying files: " + pathList); try { isCopyError = false; doCopyOnce(sourceFs, pathList, destinationFs, destination, useRegularCopy); } catch (IOException e) { isCopyError = true; } pathList = getFilesToRetry(sourceFs, srcFileList, destinationFs, destination, isCopyError); repeat++; } if (!pathList.isEmpty()) { LOG.error("File copy failed even after several attempts. Files list: " + srcFileList); throw new IOException("File copy failed even after several attempts."); } }
Source:
public void setBuildContext(String buildContext) { this.buildContext = buildContext; }

Target:
public void setBuildContext(String buildContext) { this.buildContext = Util.fixEmptyAndTrim(buildContext); }
Source:
private void showQrCode() { RestApi restApi = mActivity.getApi(); if (restApi == null) { Toast.makeText(mActivity, R.string.syncthing_terminated, Toast.LENGTH_SHORT).show(); return; } String apiKey = restApi.getGui().apiKey; String deviceId = restApi.getLocalDevice().deviceID; URL url = restApi.getUrl(); new ImageGetRequest(mActivity, url, ImageGetRequest.QR_CODE_GENERATOR, apiKey, ImmutableMap.of("text", deviceId),qrCodeBitmap -> { mActivity.showQrCodeDialog(deviceId, qrCodeBitmap); mActivity.closeDrawer(); }, error -> Toast.makeText(mActivity, R.string.could_not_access_deviceid, Toast.LENGTH_SHORT).show()); }

Target:
private void showQrCode() { RestApi restApi = mActivity.getApi(); if (restApi == null) { Toast.makeText(mActivity, R.string.syncthing_terminated, Toast.LENGTH_SHORT).show(); return; } try { String apiKey = restApi.getGui().apiKey; String deviceId = restApi.getLocalDevice().deviceID; URL url = restApi.getUrl(); new ImageGetRequest(mActivity, url, ImageGetRequest.QR_CODE_GENERATOR, apiKey, ImmutableMap.of("text", deviceId),qrCodeBitmap -> { mActivity.showQrCodeDialog(deviceId, qrCodeBitmap); mActivity.closeDrawer(); }, error -> Toast.makeText(mActivity, R.string.could_not_access_deviceid, Toast.LENGTH_SHORT).show()); } catch (Exception e) { Log.e(TAG, "showQrCode", e); } }
Source:
private boolean checkMutable(BundlePermissions bundlePermissions, EvaluationCacheKey evaluationCacheKey, SecurityRow row) { Condition[] conditions = row.getConditions(bundlePermissions.getBundle()); for (Condition condition : conditions) { if (condition.isMutable()) { evaluationCache.put(evaluationCacheKey, MUTABLE); return true; } } return false; }

Target:
private boolean checkMutable(BundlePermissions bundlePermissions, EvaluationCacheKey evaluationCacheKey, SecurityRow row) { Condition[] conditions = row.getConditions(bundlePermissions); if (conditions != null) { for (Condition condition : conditions) { if (condition.isMutable()) { evaluationCache.put(evaluationCacheKey, MUTABLE); return true; } } } return false; }
Source:
public void configureSchemaCrawler(SchemaCrawlerOptions options) { options.setTableInclusionRule(new InclusionRule() { private static final long serialVersionUID = -1559715487368953641L; @Override public boolean test(String t) { final Pattern uca_metadata_TablePattern = Pattern.compile("\\w*.UCA_METADATA.\\w*"); boolean isuca_metadata_Table = uca_metadata_TablePattern.matcher(t).matches(); if (isuca_metadata_Table) { return false; } return true; } }); }

Target:
public void configureSchemaCrawler(SchemaCrawlerOptions options) { options.setTableInclusionRule(new InclusionRule() { private static final long serialVersionUID = -1559715487368953641L; @Override public boolean test(String t) { final Pattern uca_metadata_TablePattern = Pattern.compile("\\w*.UCA_METADATA.\\w*"); final Pattern sys_TablePattern = Pattern.compile("\\w*.SYS.\\w*"); boolean isuca_metadata_Table = uca_metadata_TablePattern.matcher(t).matches(); if (isuca_metadata_Table) { return false; } boolean isSys_Table = sys_TablePattern.matcher(t).matches(); if (isSys_Table) { return false; } return true; } }); }
Source:
private ProgramState initialStateWithArgumentConstraints(ProgramState initialState, Map<Symbol, Constraint> argumentConstraints) { for (Entry<Symbol, Constraint> entry : argumentConstraints.entrySet()) { initialState = initialState.newSymbolicValue(entry.getKey(), entry.getValue()); } return initialState; }

Target:
private static ProgramState initialStateWithArgumentConstraints(ProgramState initialState, Map<Symbol, Constraint> argumentConstraints) { ProgramState updatedInitialState = initialState; for (Entry<Symbol, Constraint> entry : argumentConstraints.entrySet()) { updatedInitialState = updatedInitialState.newSymbolicValue(entry.getKey(), entry.getValue()); } return updatedInitialState; }
Source:
public void setPreview(final Preview preview) { if (preview == null) { return; } preview.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() { @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) { try { logger.debug("Player state=" + state); Surface surface = new Surface(surfaceTexture); setSurface(surface); logger.debug("Surface created and set to the player"); if (!isPlaying()) { seekTo(lastCurrentPosition); } } catch (Exception ex) { logger.error(ex); } } @Override public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { } @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { return true; } @Override public void onSurfaceTextureUpdated(SurfaceTexture surface) { } }); preview.setOnTouchListener(new OnSwipeListener(preview.getContext()) { @Override public void onSwipeLeft() { super.onSwipeLeft(); if (controller != null) { controller.playNext(); } } @Override public void onSwipeRight() { super.onSwipeRight(); if (controller != null) { controller.playPrevious(); } } @Override public void onClick() { super.onClick(); if (controller != null && state != PlayerState.RESET && state != PlayerState.URI_SET) { logger.debug("Player touched"); if (controller.isShowing()) { controller.hide(); } else { controller.setLmsUrl(lmsURL); controller.setTitle(videoTitle); controller.show(); } } } }); }

Target:
public void setPreview(final Preview preview) { if (preview == null) { return; } preview.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() { @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int width, int height) { try { logger.debug("Player state=" + state); Surface surface = new Surface(surfaceTexture); setSurface(surface); logger.debug("Surface created and set to the player"); if (!isPlaying()) { seekTo(lastCurrentPosition); } } catch (Exception ex) { logger.error(ex); } } @Override public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { } @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { return true; } @Override public void onSurfaceTextureUpdated(SurfaceTexture surface) { } }); preview.setOnTouchListener(new OnSwipeListener(preview.getContext()) { @Override public void onSwipeLeft() { super.onSwipeLeft(); if (controller != null) { controller.playNext(); } } @Override public void onSwipeRight() { super.onSwipeRight(); if (controller != null) { controller.playPrevious(); } } @Override public void onClick() { super.onClick(); if (controller != null && state != PlayerState.RESET && state != PlayerState.URI_SET) { logger.debug("Player touched"); if (controller.isShowing() && autoHideControls) { controller.hide(); } else { controller.setLmsUrl(lmsURL); controller.setTitle(videoTitle); controller.show(); } } } }); }
Source:
public void unsubscribe() { synchronized (this) { if (ONCE_UPDATER.getAndSet(this, 1) == 0) { worker.schedule(new Action0() { @Override public void call() { worker.unsubscribe(); } }); } } }

Target:
public void unsubscribe() { if (ONCE_UPDATER.getAndSet(this, 1) == 0) { worker.schedule(new Action0() { @Override public void call() { worker.unsubscribe(); } }); } }
Source:
default Flux<Aggregation> aggregate(Consumer<SearchRequest> consumer) { SearchRequest request = new SearchRequest(); consumer.accept(request); return aggregate(request); }

Target:
default Flux<Aggregation> aggregate(Consumer<SearchRequest> consumer) { Assert.notNull(consumer, "consumer must not be null"); SearchRequest request = new SearchRequest(); consumer.accept(request); return aggregate(request); }
Source:
protected void writeKeySpecification( String key, String type, GraphMLMetadata<?> ds, BufferedWriter bw) throws IOException { bw.write("<key id=\"" + key + "\" for=\"" + type + "\""); if (null != ds.attributeName) bw.write(" attr.name=\"" + ds.attributeName.replace("\"", "&quot;") + "\""); if (null != ds.attributeType) bw.write(" attr.type=\"" + ds.attributeType.getValue() + "\""); boolean closed = false; String desc = ds.description; if (desc != null) { if (!closed) { bw.write(">\n"); closed = true; } bw.write("<desc>" + desc + "</desc>\n"); } Object def = ds.default_value; if (def != null) { if (!closed) { bw.write(">\n"); closed = true; } bw.write("<default>" + def.toString() + "</default>\n"); } if (!closed) { bw.write("/>\n"); } else { bw.write("</key>\n"); } }

Target:
protected void writeKeySpecification( String key, String type, GraphMLMetadata<?> ds, BufferedWriter bw) throws IOException { bw.write("<key id=\"" + key + "\" for=\"" + type + "\""); if (null != ds.attributeName) { bw.write(" attr.name=\"" + ds.attributeName.replace("\"", "&quot;") + "\""); } if (null != ds.attributeType) { bw.write(" attr.type=\"" + ds.attributeType.getValue() + "\""); } boolean closed = false; String desc = ds.description; if (desc != null) { if (!closed) { bw.write(">\n"); closed = true; } bw.write("<desc>" + desc + "</desc>\n"); } Object def = ds.default_value; if (def != null) { if (!closed) { bw.write(">\n"); closed = true; } bw.write("<default>" + def.toString() + "</default>\n"); } if (!closed) { bw.write("/>\n"); } else { bw.write("</key>\n"); } }
Source:
protected List<? extends Block> getBlockTitle(RssMacroParameters parameters, String content, MacroTransformationContext context) { return generateBoxTitle("rsschanneltitle", getFeed()); }

Target:
protected List<? extends Block> getBlockTitle(RssMacroParameters parameters, String content, MacroTransformationContext context) { List<? extends Block> blockTitle = super.getBlockTitle(parameters, content, context); if (blockTitle == null) { return generateBoxTitle("rsschanneltitle", getFeed()); } else { return blockTitle; } }
Source:
public EventPublishingController eventPublishingController() { return new EventPublishingController(new InMemoryTopicRepository(), new InMemoryEventTypeRepository()); }

Target:
public EventPublishingController eventPublishingController() { return new EventPublishingController(kafkaRepository, new InMemoryEventTypeRepository()); }
Source:
public void setAwake(final Registration reg) { if (reg.usesQueueMode()) { boolean stateChanged; final AtomicReference<ScheduledFuture<?>> timerFuture = new AtomicReference<>(); AtomicReference<ScheduledFuture<?>> previous = clientPrecenses.put(reg.getEndpoint(), timerFuture); if (previous != null) { stateChanged = false; previous.get().cancel(false); } else { stateChanged = true; } int clientAwakeTime = awakeTimeProvider.getClientAwakeTime(reg); if (clientAwakeTime != 0) { timerFuture.set(clientTimersExecutor.schedule(new Runnable() { @Override public void run() { boolean removed = clientPrecenses.remove(reg.getEndpoint(), timerFuture); if (removed) { for (PresenceListener listener : listeners) { listener.onSleeping(reg); } } } }, clientAwakeTime, TimeUnit.MILLISECONDS)); } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }

Target:
public void setAwake(final Registration reg) { if (reg.usesQueueMode()) { boolean stateChanged; final AtomicReference<ScheduledFuture<?>> timerFuture = new AtomicReference<>(); AtomicReference<ScheduledFuture<?>> previous = clientPresences.put(reg.getEndpoint(), timerFuture); if (previous != null) { stateChanged = false; if (previous.get() != null) { previous.get().cancel(false); } } else { stateChanged = true; } int clientAwakeTime = awakeTimeProvider.getClientAwakeTime(reg); if (clientAwakeTime != 0) { timerFuture.set(clientTimersExecutor.schedule(new Runnable() { @Override public void run() { boolean removed = clientPresences.remove(reg.getEndpoint(), timerFuture); if (removed) { for (PresenceListener listener : listeners) { listener.onSleeping(reg); } } } }, clientAwakeTime, TimeUnit.MILLISECONDS)); if (clientPresences.get(reg.getEndpoint()) != timerFuture) { timerFuture.get().cancel(false); } } if (stateChanged) { for (PresenceListener listener : listeners) { listener.onAwake(reg); } } } }
Source:
private boolean validateAccountingLine(ConcurStandardAccountingExtractDetailLine line, ConcurStandardAccountingExtractBatchReportData reportData) { if (!getConcurStandardAccountingExtractCashAdvanceService().isCashAdvanceLine(line)) { ConcurAccountInfo accountingInformation = buildConcurAccountingInformation(line, line.getJournalAccountCode(), line.getSubObjectCode()); ValidationResult validationResults = buildValidationResult(accountingInformation, false); if (validationResults.isNotValid()) { reportData.addValidationErrorFileLine(new ConcurBatchReportLineValidationErrorItem(line.getReportId(), line.getEmployeeId(), line.getEmployeeLastName(), line.getEmployeeFirstName(), line.getEmployeeMiddleInitital(), validationResults.getMessages())); } return validationResults.isValid(); } else { LOG.debug("validateAccountingLine, found a cash advance line, no need to validate"); return true; } }

Target:
private boolean validateAccountingLine(ConcurStandardAccountingExtractDetailLine line, ConcurStandardAccountingExtractBatchReportData reportData) { if (!getConcurStandardAccountingExtractCashAdvanceService().isCashAdvanceLine(line)) { ConcurAccountInfo accountingInformation = buildConcurAccountingInformation(line); ValidationResult validationResults = buildValidationResult(accountingInformation, false); if (validationResults.isNotValid()) { reportData.addValidationErrorFileLine(new ConcurBatchReportLineValidationErrorItem(line.getReportId(), line.getEmployeeId(), line.getEmployeeLastName(), line.getEmployeeFirstName(), line.getEmployeeMiddleInitital(), validationResults.getMessages())); } return validationResults.isValid(); } else { LOG.debug("validateAccountingLine, found a cash advance line, no need to validate"); return true; } }
Source:
public Subscriber<? super T> call(final Subscriber<? super T> child) { return new Subscriber<T>(child) { @Override public void onCompleted() { child.onCompleted(); } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onNext(T t) { } }; }

Target:
public Subscriber<? super T> call(final Subscriber<? super T> child) { Subscriber<T> parent = new Subscriber<T>() { @Override public void onCompleted() { child.onCompleted(); } @Override public void onError(Throwable e) { child.onError(e); } @Override public void onNext(T t) { } }; child.add(parent); return parent; }
Source:
static TypeMirror asMemberOf(Types typeUtils, ProcessingEnvironment env, VersionInformation versionInformation, DeclaredType containing, Element element) { TypeMirror result = null; Exception lastException = null; try { try { result = typeUtils.asMemberOf( containing, element ); } catch ( IllegalArgumentException e ) { lastException = e; if ( versionInformation.isEclipseJDTCompiler() ) { result = (TypeMirror) ClassLoaderHelper.getAsMemberOf( element.getClass().getClassLoader() ) .invoke( null, env, containing, element ); } } } catch ( Exception e ) { lastException = e; } if ( null == result ) { throw new RuntimeException( "Fallback implementation of asMemberOf didn't work for " + element + " in " + containing, lastException ); } return result; }

Target:
static TypeMirror asMemberOf(Types typeUtils, ProcessingEnvironment env, VersionInformation versionInformation, DeclaredType containing, Element element) { TypeMirror result = null; Exception lastException = null; try { try { result = typeUtils.asMemberOf( containing, element ); } catch ( IllegalArgumentException e ) { lastException = e; if ( versionInformation.isEclipseJDTCompiler() ) { result = EclipseClassLoaderBridge.invokeAsMemberOfWorkaround( env, containing, element ); } } } catch ( Exception e ) { lastException = e; } if ( null == result ) { throw new RuntimeException( "Fallback implementation of asMemberOf didn't work for " + element + " in " + containing, lastException ); } return result; }
Source:
public void pulse() { Location location = parentEntity.getLocation(); World w = location.getWorld(); double x = location.getX() % 1; double y = location.getY() % 1; double z = location.getZ() % 1; Block[] blocksTouching = new Block[]{null, null, new Location(w, location.getX(), location.getY() - 1, location.getZ()).getBlock()}; if (x >= 0.7) { blocksTouching[0] = new Location(w, location.getX() + 1, location.getY(), location.getZ()).getBlock(); } else if (x <= 0.3) { blocksTouching[0] = new Location(w, location.getX() - 1, location.getY(), location.getZ()).getBlock(); } if (z >= 0.7) { blocksTouching[1] = new Location(w, location.getX(), location.getY(), location.getZ() + 1).getBlock(); } else if (z <= 0.3) { blocksTouching[1] = new Location(w, location.getX(), location.getY(), location.getZ() - 1).getBlock(); } if (y > 0.9) { blocksTouching[2] = new Location(w, location.getX(), location.getY(), location.getZ()).getBlock(); } for (Block touching : blocksTouching) { if (touching == null) continue; if (touching.getType().equals(Material.CACTUS)) { if (lastCactusDamageTick + 10 < parentEntity.getWorld().getWorldAge()) { EntityDamageByBlockEvent ev = new EntityDamageByBlockEvent(touching, parentEntity, EntityDamageEvent.DamageCause.CONTACT, 1.0); damage(1.0, ev); lastCactusDamageTick = parentEntity.getWorld().getWorldAge(); } } } }

Target:
public void pulse() { Location location = parentEntity.getLocation(); World w = location.getWorld(); double x = location.getX() % 1; double y = location.getY() % 1; double z = location.getZ() % 1; Location[] blocksTouching = new Location[]{null, null, new Location(w, location.getX(), location.getY() - 1, location.getZ())}; if ((x > 0 && x >= 0.7) || (x < 0 && x > -0.3)) { blocksTouching[0] = new Location(w, location.getX() + 1, location.getY(), location.getZ()); } else if ((x > 0 && x <= 0.3) || (x < 0 && x < -0.7)) { blocksTouching[0] = new Location(w, location.getX() - 1, location.getY(), location.getZ()); } if ((z > 0 && z >= 0.7) || (z < 0 && z > -0.3)) { blocksTouching[1] = new Location(w, location.getX(), location.getY(), location.getZ() + 1); } else if ((z > 0 && z <= 0.3) || (z < 0 && z < -0.7)) { blocksTouching[1] = new Location(w, location.getX(), location.getY(), location.getZ() - 1); } if (y > 0.9) { blocksTouching[2] = new Location(w, location.getX(), location.getY(), location.getZ()); } for (Location touchingLoc : blocksTouching) { if (touchingLoc == null) { continue; } Block touching = w.getBlockAt(touchingLoc); if (touching == null) { continue; } if (touching.getType() == Material.CACTUS) { if (lastCactusDamageTick + 10 < parentEntity.getWorld().getWorldAge()) { EntityDamageByBlockEvent ev = new EntityDamageByBlockEvent(touching, parentEntity, EntityDamageEvent.DamageCause.CONTACT, 1.0); this.parentEntity.getServer().getPluginManager().callEvent(ev); damage(ev); lastCactusDamageTick = parentEntity.getWorld().getWorldAge(); } } } }
Source:
private File createZipFile1(IPath out, String[] fileEntries) throws Exception { String c = "this is a file"; out.toFile().getParentFile().mkdirs(); File f = out.toFile(); FileOutputStream fos = new FileOutputStream(f); ZipOutputStream zos = new ZipOutputStream(fos); for( int i = 0; i < fileEntries.length; i++ ) { addToZipFile(toIS(c), fileEntries[i], zos); } zos.close(); fos.close(); return f; }

Target:
private File createZipFile1(IPath out, String[] fileEntries) throws Exception { String c = "this is a file"; out.toFile().getParentFile().mkdirs(); File f = out.toFile(); try (FileOutputStream fos = new FileOutputStream(f); ZipOutputStream zos = new ZipOutputStream(fos); ) { for( int i = 0; i < fileEntries.length; i++ ) { addToZipFile(toIS(c), fileEntries[i], zos); } } return f; }
Source:
protected void dispatchOnRangeSelected(final CalendarDay firstDay, final CalendarDay lastDay) { final OnRangeSelectedListener listener = rangeListener; final List<CalendarDay> days = new ArrayList<>(); final SortedSet<Date> sortedDays = new TreeSet<>(); sortedDays.add(firstDay.getDate()); sortedDays.add(lastDay.getDate()); final Date first = sortedDays.first(); final Date last = sortedDays.last(); final Calendar counter = Calendar.getInstance(); counter.setTime(first); final Calendar end = Calendar.getInstance(); end.setTime(last); while (counter.before(end) || counter.equals(end)) { final CalendarDay current = CalendarDay.from(counter); adapter.setDateSelected(current, true); days.add(current); counter.add(Calendar.DATE, 1); } if (listener != null) { listener.onRangeSelected(MaterialCalendarView.this, days); } }

Target:
protected void dispatchOnRangeSelected(final CalendarDay firstDay, final CalendarDay lastDay) { final OnRangeSelectedListener listener = rangeListener; final List<CalendarDay> days = new ArrayList<>(); final Calendar counter = Calendar.getInstance(); counter.setTime(firstDay.getDate()); final Calendar end = Calendar.getInstance(); end.setTime(lastDay.getDate()); while (counter.before(end) || counter.equals(end)) { final CalendarDay current = CalendarDay.from(counter); adapter.setDateSelected(current, true); days.add(current); counter.add(Calendar.DATE, 1); } if (listener != null) { listener.onRangeSelected(MaterialCalendarView.this, days); } }
Source:
public int hashCode() { int hash = 7; hash = 31 * hash + Objects.hashCode(podSpec); hash = 31 * hash + Objects.hashCode(podMeta); return hash; }

Target:
public int hashCode() { return Objects.hash(podSpec, podMeta); }