auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void enqueuePendingNativeReports() { setChanged(); notifyObservers(new Message( NativeInterface.MessageType.DELIVER_PENDING, null)); }

Target:
private void enqueuePendingNativeReports() { setChanged(); notifyObservers(new Message( NativeInterface.MessageType.DELIVER_PENDING, null)); }
Source:
public Optional<String> getLocalHadoopConfigurationDirectory() { final String hadoopConfDirEnv = System.getenv(Constants.ENV_HADOOP_CONF_DIR); final String hadoopHomeEnv = System.getenv(Constants.ENV_HADOOP_HOME); if (StringUtils.isNotBlank(hadoopConfDirEnv)) { return Optional.of(hadoopConfDirEnv); } if (StringUtils.isNotBlank(hadoopHomeEnv)) { return Optional.of(new Path(hadoopHomeEnv, "/etc/hadoop").toString()); } return Optional.empty(); }

Target:
public Optional<String> getLocalHadoopConfigurationDirectory() { final String hadoopConfDirEnv = System.getenv(Constants.ENV_HADOOP_CONF_DIR); if (StringUtils.isNotBlank(hadoopConfDirEnv)) { return Optional.of(hadoopConfDirEnv); } final String hadoopHomeEnv = System.getenv(Constants.ENV_HADOOP_HOME); if (StringUtils.isNotBlank(hadoopHomeEnv)) { final File hadoop2ConfDir = new File(hadoopHomeEnv, "/etc/hadoop"); if (hadoop2ConfDir.exists()) { return Optional.of(hadoop2ConfDir.getAbsolutePath()); } final File hadoop1ConfDir = new File(hadoopHomeEnv, "/conf"); if (hadoop1ConfDir.exists()) { return Optional.of(hadoop1ConfDir.getAbsolutePath()); } } return Optional.empty(); }
Source:
public final synchronized void pause() { if (this.lifecycle instanceof Pausable) { ((Pausable)this.lifecycle).pause(); } }

Target:
public final synchronized void pause() { if (this.lifecycle instanceof Pausable) { ( (Pausable) this.lifecycle).pause(); } else { logger.warn("Attempted to pause a component that does not support Pausable " + this.lifecycle); } }
Source:
public void execute() throws MojoExecutionException, MojoFailureException { try { File sourceFatJar = getTargetFile(); thin(sourceFatJar); } catch (Exception e) { throw new MojoExecutionException(e.getMessage()); } }

Target:
public void execute() throws MojoExecutionException, MojoFailureException { try { File sourceFatJar = getTargetFile(); thin(sourceFatJar); } catch (SpringBootThinException e) { throw new MojoExecutionException( "Plugin execution failed because the application archive is not an executable archive. The repackage goal of the spring-boot-maven-plugin must be configured to run first in order to create the required executable archive.", e); } catch (Exception e) { throw new MojoExecutionException(e.getMessage(), e); } }
Source:
public <T extends Comparable<T>> Boolean visit(Operators.Eq<T> eq) { T value = eq.getValue(); if (value == null) { return BLOCK_MIGHT_MATCH; } Operators.Column<T> filterColumn = eq.getColumn(); ColumnChunkMetaData meta = getColumnChunk(filterColumn.getColumnPath()); ColumnDescriptor col = new ColumnDescriptor(meta.getPath().toArray(), meta.getType(), -1, -1); if (meta == null) { return BLOCK_CANNOT_MATCH; } BloomFilterUtility bloomFilterUtility = bloomFilterReader.buildBloomFilterUtility(col); if (bloomFilterUtility != null && !bloomFilterUtility.contains(value)) { return BLOCK_CANNOT_MATCH; } return BLOCK_MIGHT_MATCH; }

Target:
public <T extends Comparable<T>> Boolean visit(Operators.Eq<T> eq) { T value = eq.getValue(); if (value == null) { return BLOCK_MIGHT_MATCH; } Operators.Column<T> filterColumn = eq.getColumn(); ColumnChunkMetaData meta = getColumnChunk(filterColumn.getColumnPath()); if (meta == null) { return BLOCK_CANNOT_MATCH; } try { BloomFilter bloomFilter = bloomFilterReader.readBloomFilter(meta); if (bloomFilter != null && !bloomFilter.findHash(bloomFilter.hash(value))) { return BLOCK_CANNOT_MATCH; } } catch (RuntimeException e) { LOG.warn(e.getMessage()); return BLOCK_MIGHT_MATCH; } return BLOCK_MIGHT_MATCH; }
Source:
public int hashCode() { return (((startCommit.hashCode() * 31) + numbers.length) * 31) + getNumber(); }

Target:
public int hashCode() { return ((startCommit.hashCode() + numbers.length) * 31) + getNumber(); }
Source:
private Locale determineLocale(final HttpServletRequest request) { Locale locale = LocaleUtils.getLocaleFromString(request.getParameter(LOCALE)); if (locale == null) { locale = getLocaleFromCookies(request.getCookies()); } if (locale == null) { locale = request.getLocale(); } if (locale == null) { locale = Locale.US; } locale = lookupSupportedLocale(locale, getLocaleKeys()); log.debug("Filter determined locale to be: " + locale.toLanguageTag()); return locale; }

Target:
private Locale determineLocale(final HttpServletRequest request) { Locale locale = LocaleUtils.getLocaleFromString(request.getParameter(LOCALE)); if (locale == null) { locale = getLocaleFromCookies(request.getCookies()); } if (locale == null) { locale = request.getLocale(); } if (locale == null) { locale = Locale.US; } Locale resolvedLocale = lookupSupportedLocale(locale, getLocaleKeys()); log.debug(String.format("Incoming locale: %s. Filter determined locale to be: %s", locale.toLanguageTag(), resolvedLocale.toLanguageTag())); return resolvedLocale; }
Source:
private void testRecordedVideoPlaybackWithAngle(int angle) throws Exception { int width = RECORDED_VIDEO_WIDTH; int height = RECORDED_VIDEO_HEIGHT; final String file = RECORDED_FILE; final long durationMs = RECORDED_DURATION_MS; if (!hasCamera()) { return; } boolean isSupported = false; mCamera = Camera.open(0); Camera.Parameters parameters = mCamera.getParameters(); List<Camera.Size> previewSizes = parameters.getSupportedVideoSizes(); for (Camera.Size size : previewSizes) { if (size.width == width && size.height == height) { isSupported = true; break; } } mCamera.release(); mCamera = null; if (!isSupported) { width = previewSizes.get(0).width; height = previewSizes.get(0).height; } checkOrientation(angle); recordVideo(width, height, angle, file, durationMs); checkDisplayedVideoSize(width, height, angle, file); checkVideoRotationAngle(angle, file); }

Target:
private void testRecordedVideoPlaybackWithAngle(int angle) throws Exception { int width = RECORDED_VIDEO_WIDTH; int height = RECORDED_VIDEO_HEIGHT; final String file = RECORDED_FILE; final long durationMs = RECORDED_DURATION_MS; if (!hasCamera()) { return; } boolean isSupported = false; mCamera = Camera.open(0); Camera.Parameters parameters = mCamera.getParameters(); List<Camera.Size> videoSizes = parameters.getSupportedVideoSizes(); for (Camera.Size size : videoSizes) { if (size.width == width && size.height == height) { isSupported = true; break; } } mCamera.release(); mCamera = null; if (!isSupported) { width = videoSizes.get(0).width; height = videoSizes.get(0).height; } checkOrientation(angle); recordVideo(width, height, angle, file, durationMs); checkDisplayedVideoSize(width, height, angle, file); checkVideoRotationAngle(angle, file); }
Source:
protected void openIntentChooser() throws ActivityNotFoundException { if (this.options.hasKey("forceDialog") && this.options.getBoolean("forceDialog")) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP_MR1) { IntentSender sender = TargetChosenReceiver.getSharingSenderIntent(this.reactContext); Intent chooser = Intent.createChooser(this.getIntent(), this.chooserTitle, sender); chooser.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); this.reactContext.getCurrentActivity().startActivityForResult(chooser, RNShareModule.SHARE_REQUEST_CODE); } else { Intent chooser = Intent.createChooser(this.getIntent(), this.chooserTitle); chooser.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); this.reactContext.getCurrentActivity().startActivityForResult(chooser, RNShareModule.SHARE_REQUEST_CODE); TargetChosenReceiver.sendCallback(true, true, "OK"); } } else { this.getIntent().setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.reactContext.startActivity(this.getIntent()); TargetChosenReceiver.sendCallback(true, true, this.getIntent().getPackage()); } }

Target:
protected void openIntentChooser() throws ActivityNotFoundException { if (this.options.hasKey("forceDialog") && this.options.getBoolean("forceDialog")) { Activity activity = this.reactContext.getCurrentActivity(); if (activity == null) { TargetChosenReceiver.sendCallback(false, "Something went wrong"); return; } if (TargetChosenReceiver.isSupported()) { IntentSender sender = TargetChosenReceiver.getSharingSenderIntent(this.reactContext); Intent chooser = Intent.createChooser(this.getIntent(), this.chooserTitle, sender); chooser.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); activity.startActivityForResult(chooser, RNShareModule.SHARE_REQUEST_CODE); } else { Intent chooser = Intent.createChooser(this.getIntent(), this.chooserTitle); chooser.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); activity.startActivityForResult(chooser, RNShareModule.SHARE_REQUEST_CODE); TargetChosenReceiver.sendCallback(true, true, "OK"); } } else { this.getIntent().setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.reactContext.startActivity(this.getIntent()); TargetChosenReceiver.sendCallback(true, true, this.getIntent().getPackage()); } }
Source:
public void afterPropertiesSet() throws Exception { if (this.beanFactory != null) { String[] beanNames = this.beanFactory.getBeanDefinitionNames(); for (String beanName : beanNames) { BeanDefinition def = this.beanFactory.getBeanDefinition(beanName); String className = def.getBeanClassName(); if (className == null && def.getSource() instanceof StandardMethodMetadata) { className = ((StandardMethodMetadata) def.getSource()).getIntrospectedMethod().getReturnType().getName(); } if (StringUtils.hasText(className)){ if (className.startsWith(SI_ROOT_PACKAGE) && !(className.endsWith(IntegrationMBeanExporter.class.getName()))){ siBeanNames.add(beanName); } } } } }

Target:
public void afterPropertiesSet() throws Exception { if (this.beanFactory != null) { String[] beanNames = this.beanFactory.getBeanDefinitionNames(); for (String beanName : beanNames) { BeanDefinition def = this.beanFactory.getBeanDefinition(beanName); String className = def.getBeanClassName(); if (className == null && def.getSource() instanceof StandardMethodMetadata) { className = ((StandardMethodMetadata) def.getSource()).getIntrospectedMethod().getReturnType().getName(); } if (StringUtils.hasText(className)){ if (className.startsWith(IntegrationConfigUtils.BASE_PACKAGE) && !(className.endsWith(IntegrationMBeanExporter.class.getName()))){ siBeanNames.add(beanName); } } } } }
Source:
public void testCreateRequestMessageBuilderPublishedAtPresent() { String bodyText = "body text"; Payload requestPayload = TestUtils.createPayloadWithTextBody(bodyText); Builder requestMessageBuilder = TestUtils.createMessageBuilder(); Message message = messageFactory.createRequestMessage(requestMessageBuilder, requestPayload); assertNotNull(message.getMeta().getPublishedAt()); }

Target:
public void testCreateRequestMessageBuilderPublishedAtPresent() { String bodyText = "body text"; Payload requestPayload = TestUtils.createPayloadWithTextBody(bodyText); Builder requestMessageBuilder = TestUtils.createMessageBuilder(FIXED_CLOCK); Message message = messageFactory.createRequestMessage(requestMessageBuilder, requestPayload); assertNotNull(message.getMeta().getPublishedAt()); assertEquals(message.getMeta().getPublishedAt(), FIXED_CLOCK.instant()); }
Source:
public List<BitstreamFormat> constructBitstreamFormatList(HttpServletRequest request, Context context) { return getStringListFromRequest(request).stream() .map(link -> { if (link.endsWith("/")) { link = link.substring(0, link.length() - 1); } return link.substring(link.lastIndexOf('/') + 1); }) .map(id -> { try { return bitstreamFormatService.find(context, parseInt(id)); } catch (SQLException e) { log.error(e.getMessage(), e); return null; } }) .filter(Objects::nonNull) .collect(toList()); }

Target:
public List<BitstreamFormat> constructBitstreamFormatList(HttpServletRequest request, Context context) { return getStringListFromRequest(request).stream() .map(link -> { if (link.endsWith("/")) { link = link.substring(0, link.length() - 1); } return link.substring(link.lastIndexOf('/') + 1); }) .map(id -> { try { return bitstreamFormatService.find(context, parseInt(id)); } catch (SQLException | NumberFormatException e) { log.error("Could not find bitstream format for id: " + id, e); return null; } }) .filter(Objects::nonNull) .collect(toList()); }
Source:
private void createShortcut(File executable) { final String executablePath = executable.getAbsolutePath(); final String pathInContainers = executablePath.replace(containersPath, ""); final String[] split = pathInContainers.split("/"); final String engineContainer = split[0]; final String engine = (Character.toUpperCase(engineContainer.charAt(0)) + engineContainer.substring(1)) .replace("prefix", ""); final String container = split[1]; final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession(); interactiveScriptSession.eval("include([\"Engines\", \"" + engine + "\", \"Shortcuts\", \"" + engine + "\"]);", ignored -> interactiveScriptSession.eval("new " + engine + "Shortcut()", output -> { final ScriptObjectMirror shortcutObject = (ScriptObjectMirror) output; shortcutObject.callMember("name", executable.getName()); shortcutObject.callMember("search", executable.getName()); shortcutObject.callMember("prefix", container); shortcutObject.callMember("create"); }, e -> Platform.runLater(() -> new ErrorMessage(tr("Error while creating shortcut"), e))), e -> Platform.runLater(() -> new ErrorMessage(tr("Error while creating shortcut"), e))); }

Target:
private void createShortcut(File executable) { final String executablePath = executable.getAbsolutePath(); final String pathInContainers = executablePath.replace(containersPath, ""); final String[] split = pathInContainers.split("/"); final String engineContainer = split[0]; final String engine = (Character.toUpperCase(engineContainer.charAt(0)) + engineContainer.substring(1)) .replace("prefix", ""); final String container = split[1]; final InteractiveScriptSession interactiveScriptSession = scriptInterpreter.createInteractiveSession(); interactiveScriptSession.eval("include([\"Engines\", \"" + engine + "\", \"Shortcuts\", \"" + engine + "\"]);", ignored -> interactiveScriptSession.eval("new " + engine + "Shortcut()", output -> { final ScriptObjectMirror shortcutObject = (ScriptObjectMirror) output; shortcutObject.callMember("name", executable.getName()); shortcutObject.callMember("search", executable.getName()); shortcutObject.callMember("prefix", container); shortcutObject.callMember("create"); }, e -> this.showErrorMessage(e, tr("Error while creating shortcut"))), e -> this.showErrorMessage(e, tr("Error while creating shortcut"))); }
Source:
public void test_zeroContextThrowsNullPointException() { try { new NativeRef(0) {}; fail("Should throw NullPointerException when arguments are NULL"); } catch(NullPointerException e) { } }

Target:
public void test_zeroContextThrowsNullPointException() { try { new NativeRef(0) {}; fail("Should throw NullPointerException when arguments are NULL"); } catch(NullPointerException expected) { } }
Source:
public static String getInternationalizedString(@NonNull String key) { Context ctx = PreferencesState.getInstance().getContext(); String language = getUserLanguage(ctx); String translation = getLocalizedStringFromDB(key, language); if (key == null) { return key; } if (BuildConfig.activeSearchLanguageInDB && wasTranslationFound(translation)) { return translation; } else { return findStringFromAndroidResource(ctx, key, language); } }

Target:
public static String getInternationalizedString(@NonNull String key) { Context context = PreferencesState.getInstance().getContext(); String language = getUserLanguage(context); String translation = getLocalizedStringFromDB(key, language); if (key == null) { return ""; } if (BuildConfig.activeSearchLanguageInDB && wasTranslationFound(translation)) { return translation; } else { return findStringFromAndroidResource(context, key, language); } }
Source:
List<List<Integer>> slices(int num) { if (num > this.digitsSize || num == 0) { throw new IllegalArgumentException("Slice size is too big."); } final int limit = this.digitsSize - num + 1; List<List<Integer>> result = new ArrayList<>(limit); List<Integer> tmp; for (int i = 0; i < limit; i++) { tmp = this.digits.subList(i, i + num); result.add(tmp); } return result; }

Target:
List<List<String>> slices(int num) { if (num <= 0) { throw new IllegalArgumentException("Slice size is too small."); } if (num > this.digitsSize) { throw new IllegalArgumentException("Slice size is too big."); } final int limit = this.digitsSize - num + 1; List<List<String>> result = new ArrayList<>(limit); List<String> tmp; for (int i = 0; i < limit; i++) { tmp = this.digits.subList(i, i + num); result.add(tmp); } return result; }
Source:
private int checkForSpecialCharacters(int value) throws IOException { char currChar = (char) value; if (currChar == '&' && available() > 0) { final int readLimit = 10; boolean needsReset = true; super.mark(readLimit); readHelper.saveState(); try { StringBuilder specialCharBuffer = new StringBuilder(); specialCharBuffer.append(currChar); int readCount = 0; while (currChar != ';' && readCount < readLimit && super.available() > 0) { currChar = (char) readHelper.process(super.read()); specialCharBuffer.append(currChar); readCount++; } Character reserved = ReservedCharacters.toCharacter(specialCharBuffer.toString()); if (reserved != null) { needsReset = false; value = reserved; } } finally { if (needsReset) { if (super.markpos > -1) { super.reset(); } readHelper.restoreState(); } } } return value; }

Target:
private int checkForSpecialCharacters(int value) throws IOException { char currChar = (char) value; if (currChar == '&' && available() > 0) { final int readLimit = 10; boolean needsReset = true; super.mark(readLimit); readHelper.saveState(); try { StringBuilder specialCharBuffer = new StringBuilder(); specialCharBuffer.append(currChar); int readCount = 0; while (currChar != ';' && readCount < readLimit && super.available() > 0) { currChar = (char) readHelper.process(super.read()); specialCharBuffer.append(currChar); readCount++; } Character reserved = ReservedCharacters.toCharacter(specialCharBuffer.toString()); if (reserved != null) { needsReset = false; value = reserved; } } finally { if (needsReset) { super.reset(); readHelper.restoreState(); } } } return value; }
Source:
public Token appendCheckpoints(CorfuRuntime rt, String author) { log.info("appendCheckpoints: appending checkpoints for maps", maps.size()); Token minSnapshot = Token.UNINITIALIZED; final long cpStart = System.currentTimeMillis(); try { for (ICorfuSMR<T> map : maps) { UUID streamId = map.getCorfuStreamID(); final long mapCpStart = System.currentTimeMillis(); int mapSize = ((T) map).size(); CheckpointWriter<T> cpw = new CheckpointWriter(rt, streamId, author, (T) map); ISerializer serializer = ((CorfuCompileProxy<Map>) map.getCorfuSMRProxy()) .getSerializer(); cpw.setSerializer(serializer); log.trace("appendCheckpoints: checkpoint map begin", Utils.toReadableId(map.getCorfuStreamID())); Token minCPSnapshot = cpw.appendCheckpoint(); if (minSnapshot == Token.UNINITIALIZED) { minSnapshot = minCPSnapshot; } else if (minSnapshot.getEpoch() != minCPSnapshot.getEpoch()) { throw new IllegalStateException("Epoch changed during GC cycle aborting"); } else if (Token.min(minCPSnapshot, minSnapshot) == minCPSnapshot) { minSnapshot = minCPSnapshot; } log.trace("appendCheckpoints: checkpoint map end", Utils.toReadableId(map.getCorfuStreamID())); final long mapCpEnd = System.currentTimeMillis(); log.info("appendCheckpoints: took ms to checkpoint entries for {}", mapCpEnd - mapCpStart, mapSize, streamId); } } finally { log.trace("appendCheckpoints: finished, author '{}' at min globalAddress {}", author, minSnapshot); rt.getObjectsView().TXEnd(); } final long cpStop = System.currentTimeMillis(); log.info("appendCheckpoints: took ms to append checkpoints", cpStop - cpStart, maps.size()); return minSnapshot; }

Target:
public Token appendCheckpoints(CorfuRuntime rt, String author) { log.info("appendCheckpoints: appending checkpoints for maps", maps.size()); Token minSnapshot = Token.UNINITIALIZED; final long cpStart = System.currentTimeMillis(); try { for (ICorfuSMR<T> map : maps) { UUID streamId = map.getCorfuStreamID(); CheckpointWriter<T> cpw = new CheckpointWriter(rt, streamId, author, (T) map); ISerializer serializer = ((CorfuCompileProxy<Map>) map.getCorfuSMRProxy()) .getSerializer(); cpw.setSerializer(serializer); Token minCPSnapshot = cpw.appendCheckpoint(); if (minSnapshot == Token.UNINITIALIZED) { minSnapshot = minCPSnapshot; } else if (minSnapshot.getEpoch() != minCPSnapshot.getEpoch()) { String msg = String.format("Epoch changed during GC cycle from %s to %s", minSnapshot, minCPSnapshot); throw new IllegalStateException(msg); } else if (Token.min(minCPSnapshot, minSnapshot) == minCPSnapshot) { minSnapshot = minCPSnapshot; } } } finally { log.trace("appendCheckpoints: finished, author '{}' at min globalAddress {}", author, minSnapshot); rt.getObjectsView().TXEnd(); } final long cpStop = System.currentTimeMillis(); log.info("appendCheckpoints: took ms to append checkpoints", cpStop - cpStart, maps.size()); return minSnapshot; }
Source:
public static String startAppiumServer() throws UnknownHostException { service = new AppiumServiceBuilder().usingPort(port).build(); service.start(); InetAddress inetAddress =InetAddress.getLocalHost(); return inetAddress.getHostAddress(); }

Target:
public static String startAppiumServer() throws UnknownHostException { service = new AppiumServiceBuilder().usingPort(PORT).build(); service.start(); InetAddress inetAddress = InetAddress.getLocalHost(); return inetAddress.getHostAddress(); }
Source:
private Set<String> filterUntrackedFolders(Set<String> untracked, Set<String> untrackedFolders) { Set<String> filtered = new TreeSet<String>(); fileLoop: for (String file : untracked) { for (String folder : untrackedFolders) { if (file.startsWith(folder)) { continue fileLoop; } } filtered.add(file); } return filtered; }

Target:
private Set<String> filterUntrackedFolders(Set<String> untracked, Set<String> untrackedFolders) { Set<String> filtered = new TreeSet<String>(untracked); for (String file : untracked) for (String folder : untrackedFolders) if (file.startsWith(folder)) { filtered.remove(file); break; } return filtered; }
Source:
public EmbeddedForeignKeyDescriptor( EmbeddedIdentifierMappingImpl mappingType, String keyColumnContainingTable, List<String> keyColumnExpressions, String targetColumnContainingTable, List<String> targetColumnExpressions, MappingModelCreationProcess creationProcess) { this.keyColumnContainingTable = keyColumnContainingTable; this.keyColumnExpressions = keyColumnExpressions; this.targetColumnContainingTable = targetColumnContainingTable; this.targetColumnExpressions = targetColumnExpressions; this.mappingType = mappingType; jdbcMappings = new ArrayList<>(); mappingType.getAttributes().forEach( attribute -> { final TypeConfiguration typeConfiguration = creationProcess.getCreationContext() .getTypeConfiguration(); if ( attribute instanceof SingularAssociationAttributeMapping ) { SingularAssociationAttributeMapping associationAttributeMapping = (SingularAssociationAttributeMapping) attribute; associationAttributeMapping.getAssociatedEntityMappingType() .getEntityPersister() .getIdentifierMapping() .visitJdbcTypes( jdbcMapping -> jdbcMappings.add( jdbcMapping ) , null, typeConfiguration ); } else { attribute.visitJdbcTypes( jdbcMapping -> { jdbcMappings.add( jdbcMapping ); }, null, typeConfiguration ); } } ); }

Target:
public EmbeddedForeignKeyDescriptor( EmbeddedIdentifierMappingImpl mappingType, String keyColumnContainingTable, List<String> keyColumnExpressions, String targetColumnContainingTable, List<String> targetColumnExpressions, MappingModelCreationProcess creationProcess) { this.keyColumnContainingTable = keyColumnContainingTable; this.keyColumnExpressions = keyColumnExpressions; this.targetColumnContainingTable = targetColumnContainingTable; this.targetColumnExpressions = targetColumnExpressions; this.mappingType = mappingType; jdbcMappings = new ArrayList<>(); mappingType.getAttributes().forEach( attribute -> { final TypeConfiguration typeConfiguration = creationProcess.getCreationContext() .getTypeConfiguration(); if ( attribute instanceof SingularAssociationAttributeMapping ) { SingularAssociationAttributeMapping associationAttributeMapping = (SingularAssociationAttributeMapping) attribute; associationAttributeMapping.getAssociatedEntityMappingType() .getEntityPersister() .getIdentifierMapping() .visitJdbcTypes( jdbcMapping -> jdbcMappings.add( jdbcMapping ) , null, typeConfiguration ); } else { attribute.visitJdbcTypes( jdbcMappings::add, null, typeConfiguration ); } } ); }
Source:
private void initCommandExecutor() { for (CommandEntity cmdEntity : commandsRepository.getCommands(true)) { if (!cmdEntity.isExecuted() && cmdEntity.getCommandStatus() != CommandStatus.FAILED && cmdEntity.getCommandStatus() != CommandStatus.EXECUTION_FAILED) { CommandBase<?> failedCommand = commandsRepository.retrieveCommand(cmdEntity.getId()); failedCommand.setCommandStatus(CommandStatus.EXECUTION_FAILED); } if (!cmdEntity.isCallbackNotified() && !cmdEntity.isWaitingForEvent()) { commandsRepository.addToCallbackMap(cmdEntity); } } }

Target:
private void initCommandExecutor() { for (CommandEntity cmdEntity : commandsRepository.getCommands(true)) { if (!cmdEntity.isExecuted() && cmdEntity.getCommandStatus() != CommandStatus.FAILED && cmdEntity.getCommandStatus() != CommandStatus.EXECUTION_FAILED) { CommandBase<?> failedCommand = commandsRepository.retrieveCommand(cmdEntity.getId()); failedCommand.setCommandStatus(CommandStatus.EXECUTION_FAILED); } if (!cmdEntity.isCallbackNotified()) { commandsRepository.addToCallbackMap(cmdEntity); } } }
Source:
protected static Encrypt0Message decompression(byte[] cipherText, Message message) throws OSException { Encrypt0Message enc = new Encrypt0Message(false, true); try { decodeObjectSecurity(message, enc); } catch (OSException e) { LOGGER.error(e.getMessage()); throw new OSException(e.getMessage()); } catch (Exception e) { LOGGER.error("Failed to decode object security option."); throw new OSException("Failed to decode object security option."); } if (cipherText != null) enc.setEncryptedContent(cipherText); return enc; }

Target:
protected static Encrypt0Message decompression(byte[] cipherText, Message message) throws OSException { Encrypt0Message enc = new Encrypt0Message(false, true); try { decodeObjectSecurity(message, enc); } catch (OSException e) { LOGGER.error(e.getMessage()); throw e; } catch (Exception e) { LOGGER.error("Failed to decode object security option."); throw new OSException("Failed to decode object security option."); } if (cipherText != null) enc.setEncryptedContent(cipherText); return enc; }
Source:
public SQLServerQueryRewriter(JdbcDataContext dataContext) { super(dataContext, 11); }

Target:
public SQLServerQueryRewriter(JdbcDataContext dataContext) { super(dataContext, FIRST_FETCH_SUPPORTING_VERSION); }
Source:
private EventResult runConnectHostToPoolEvent(final Guid storagePoolId, final VDS vds) { EventResult result = new EventResult(true, EventType.VDSCONNECTTOPOOL); storage_pool storagePool = getStoragePoolDAO().get(storagePoolId); StorageDomain masterDomain = getStorageDomainDAO().getStorageDomainByTypeAndPool(storagePoolId, StorageDomainType.Master); boolean shouldProceedVdsStats = true; try { runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds.getId(), storagePoolId, vds.getVdsSpmId(), masterDomain.getId(), storagePool.getmaster_domain_version())).getSucceeded(); } catch (VdcBLLException e) { if (e.getErrorCode() != VdcBllErrors.VDS_NETWORK_ERROR && e.getErrorCode() != VdcBllErrors.PROTOCOL_ERROR && (masterDomain.getStatus() == StorageDomainStatus.InActive || masterDomain.getStatus() == StorageDomainStatus.Unknown)) { shouldProceedVdsStats = false; } else { log.errorFormat("Could not connect host {0} to pool {1}", vds.getName(), storagePool .getname()); result.setSuccess(false); } } catch (RuntimeException exp) { log.errorFormat("Could not connect host {0} to pool {1}", vds.getName(), storagePool .getname()); result.setSuccess(false); } if (result.isSuccess() && shouldProceedVdsStats) { result.setSuccess(proceedVdsStats()); if (!result.isSuccess()) { AuditLogDirector.log(new AuditLogableBase(getVdsId()), AuditLogType.VDS_STORAGE_VDS_STATS_FAILED); } } return result; }

Target:
private EventResult runConnectHostToPoolEvent(final Guid storagePoolId, final VDS vds) { EventResult result = new EventResult(true, EventType.VDSCONNECTTOPOOL); StoragePool storagePool = getStoragePoolDAO().get(storagePoolId); StorageDomain masterDomain = getStorageDomainDAO().getStorageDomainByTypeAndPool(storagePoolId, StorageDomainType.Master); boolean shouldProceedVdsStats = true; try { runVdsCommand(VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(vds.getId(), storagePoolId, vds.getVdsSpmId(), masterDomain.getId(), storagePool.getmaster_domain_version())); } catch (VdcBLLException e) { if (e.getErrorCode() != VdcBllErrors.VDS_NETWORK_ERROR && (masterDomain.getStatus() == StorageDomainStatus.InActive || masterDomain.getStatus() == StorageDomainStatus.Unknown)) { shouldProceedVdsStats = false; log.infoFormat("Could not connect host {0} to pool {1}, as the master domain is in inactive/unknown status - not failing the operation", vds.getName(), storagePool .getname()); } else { log.errorFormat("Could not connect host {0} to pool {1}", vds.getName(), storagePool .getname()); result.setSuccess(false); } } if (result.isSuccess() && shouldProceedVdsStats) { result.setSuccess(proceedVdsStats()); if (!result.isSuccess()) { AuditLogDirector.log(new AuditLogableBase(getVdsId()), AuditLogType.VDS_STORAGE_VDS_STATS_FAILED); } } return result; }
Source:
public FormValidation doCheckTargetTraceCollectionPort(@QueryParameter("targetTraceCollectionPort") final String targetTraceCollectionPort) { if (!validatePort(targetTraceCollectionPort) && collectBuildLogs) { return FormValidation.error("Invalid Trace Collection Port"); } return FormValidation.ok("Valid Trace Collection Port"); }

Target:
public FormValidation doCheckTargetTraceCollectionPort(@QueryParameter("targetTraceCollectionPort") final String targetTraceCollectionPort) { if (!validatePort(targetTraceCollectionPort) && collectBuildTraces) { return FormValidation.error("Invalid Trace Collection Port"); } return FormValidation.ok("Valid Trace Collection Port"); }
Source:
public Transformation<RowData> createInputFormatTransformation( StreamExecutionEnvironment env, InputFormat<RowData, ?> inputFormat, InternalTypeInfo<RowData> outputTypeInfo, String name) { InputFormatSourceFunction<RowData> func = new InputFormatSourceFunction<>(inputFormat, outputTypeInfo); Transformation<RowData> transformation = env.addSource(func, name, outputTypeInfo).getTransformation(); ExecNodeUtil.setManagedMemoryWeight(transformation, 0L); return transformation; }

Target:
public Transformation<RowData> createInputFormatTransformation( StreamExecutionEnvironment env, InputFormat<RowData, ?> inputFormat, InternalTypeInfo<RowData> outputTypeInfo, String name) { InputFormatSourceFunction<RowData> func = new InputFormatSourceFunction<>(inputFormat, outputTypeInfo); return env.addSource(func, name, outputTypeInfo).getTransformation(); }
Source:
OSInAppMessageAction(@NonNull JSONObject json) throws JSONException { clickId = json.optString(ID, null); clickName = json.optString(NAME, null); clickUrl = json.optString(URL, null); urlTarget = OSInAppMessageActionUrlType.fromString(json.optString(URL_TARGET, null)); if (urlTarget == null) urlTarget = OSInAppMessageActionUrlType.IN_APP_WEBVIEW; closesMessage = json.optBoolean(CLOSE, true); if (json.has(OUTCOMES)) { JSONArray outcomesJsonArray = json.getJSONArray(OUTCOMES); for (int i = 0; i < outcomesJsonArray.length(); i++) { outcomes.add(new OSInAppMessageOutcome((JSONObject) outcomesJsonArray.get(i))); } } if (json.has(TAGS)) tags = new OSInAppMessageTag(json.getJSONObject(TAGS)); if (json.has(PROMPTS)) { JSONArray promptsJsonArray = json.getJSONArray(PROMPTS); for (int i = 0; i < promptsJsonArray.length(); i++) { if (promptsJsonArray.get(i).equals(LOCATION_PROMPT_KEY) ) { prompts.add(new OSInAppMessageLocationPrompt()); } } } }

Target:
OSInAppMessageAction(@NonNull JSONObject json) throws JSONException { clickId = json.optString(ID, null); clickName = json.optString(NAME, null); clickUrl = json.optString(URL, null); urlTarget = OSInAppMessageActionUrlType.fromString(json.optString(URL_TARGET, null)); if (urlTarget == null) urlTarget = OSInAppMessageActionUrlType.IN_APP_WEBVIEW; closesMessage = json.optBoolean(CLOSE, true); if (json.has(OUTCOMES)) parseOutcomes(json); if (json.has(TAGS)) tags = new OSInAppMessageTag(json.getJSONObject(TAGS)); if (json.has(PROMPTS)) parsePrompts(json); }
Source:
public ByteBuf internalReadEntry(long ledgerId, long entryId, long location) throws IOException, Bookie.NoEntryException { EntryLogBufferedReadChannel bc = null; try { long entryLogId = logIdForOffset(location); long pos = location & 0xffffffffL; ByteBuf sizeBuff = sizeBuffer.get(); sizeBuff.clear(); pos -= 4; bc = getChannelForLogId(entryLogId); if (readFromLogChannel(entryLogId, bc, sizeBuff, pos) != sizeBuff.capacity()) { throw new Bookie.NoEntryException("Short read from entrylog " + entryLogId, ledgerId, entryId); } pos += 4; int entrySize = sizeBuff.readInt(); if (entrySize > maxSaneEntrySize) { LOG.warn("Sanity check failed for entry size of " + entrySize + " at location " + pos + " in " + entryLogId); } if (entrySize < MIN_SANE_ENTRY_SIZE) { LOG.error("Read invalid entry length {}", entrySize); throw new IOException("Invalid entry length " + entrySize); } ByteBuf data = PooledByteBufAllocator.DEFAULT.directBuffer(entrySize, entrySize); int rc = readFromLogChannel(entryLogId, bc, data, pos); if (rc != entrySize) { data.release(); throw new Bookie.NoEntryException("Short read for " + ledgerId + "@" + entryId + " in " + entryLogId + "@" + pos + "(" + rc + "!=" + entrySize + ")", ledgerId, entryId); } data.writerIndex(entrySize); return data; } catch (FileNotFoundException e) { FileNotFoundException newe = new FileNotFoundException(e.getMessage() + " for " + ledgerId + " with location " + location); newe.setStackTrace(e.getStackTrace()); throw newe; } finally { if (null != bc) { bc.release(); } } }

Target:
public ByteBuf internalReadEntry(long ledgerId, long entryId, long location) throws IOException, Bookie.NoEntryException { long entryLogId = logIdForOffset(location); long pos = location & 0xffffffffL; ByteBuf sizeBuff = sizeBuffer.get(); sizeBuff.clear(); pos -= 4; try (EntryLogBufferedReadChannel bc = getChannelForLogId(entryLogId)){ if (readFromLogChannel(entryLogId, bc, sizeBuff, pos) != sizeBuff.capacity()) { throw new Bookie.NoEntryException("Short read from entrylog " + entryLogId, ledgerId, entryId); } pos += 4; int entrySize = sizeBuff.readInt(); if (entrySize > maxSaneEntrySize) { LOG.warn("Sanity check failed for entry size of at location in {}", entrySize, pos, entryLogId); } if (entrySize < MIN_SANE_ENTRY_SIZE) { LOG.error("Read invalid entry length {}", entrySize); throw new IOException("Invalid entry length " + entrySize); } ByteBuf data = PooledByteBufAllocator.DEFAULT.directBuffer(entrySize, entrySize); int rc = readFromLogChannel(entryLogId, bc, data, pos); if (rc != entrySize) { data.release(); throw new Bookie.NoEntryException("Short read for " + ledgerId + "@" + entryId + " in " + entryLogId + "@" + pos + "(" + rc + "!=" + entrySize + ")", ledgerId, entryId); } data.writerIndex(entrySize); return data; } catch (FileNotFoundException e) { FileNotFoundException newe = new FileNotFoundException(e.getMessage() + " for " + ledgerId + " with location " + location); newe.setStackTrace(e.getStackTrace()); throw newe; } }
Source:
public Flux<T> all() { return Flux.defer(() -> { String statement = assembleEntityQuery(false); System.out.println(statement); return template.getCouchbaseClientFactory().getCluster().reactive().query(statement, buildQueryOptions()) .onErrorMap(throwable -> { if (throwable instanceof RuntimeException) { return template.potentiallyConvertRuntimeException((RuntimeException) throwable); } else { return throwable; } }).flatMapMany(ReactiveQueryResult::rowsAsObject).map(row -> { String id = row.getString("__id"); long cas = row.getLong("__cas"); row.removeKey("__id"); row.removeKey("__cas"); return template.support().decodeEntity(id, row.toString(), cas, domainType); }); }); }

Target:
public Flux<T> all() { return Flux.defer(() -> { String statement = assembleEntityQuery(false); return template.getCouchbaseClientFactory().getCluster().reactive().query(statement, buildQueryOptions()) .onErrorMap(throwable -> { if (throwable instanceof RuntimeException) { return template.potentiallyConvertRuntimeException((RuntimeException) throwable); } else { return throwable; } }).flatMapMany(ReactiveQueryResult::rowsAsObject).map(row -> { String id = row.getString("__id"); long cas = row.getLong("__cas"); row.removeKey("__id"); row.removeKey("__cas"); return template.support().decodeEntity(id, row.toString(), cas, domainType); }); }); }
Source:
public StyledString getStyledText(Object element) { String text = getText(element); StyledString styledString = null; if (text != null) { styledString = new StyledString(text); if (element instanceof ITmfStyledProjectModelElement) { Styler styler = ((ITmfStyledProjectModelElement) element).getStyler(); if (styler != null) { styledString = new StyledString(text, styler); } } boolean displayTimeRange = Activator.getDefault().getPreferenceStore().getBoolean(ITmfUIPreferences.TRACE_DISPLAY_RANGE_PROJECTEXPLORER); if (displayTimeRange && element instanceof TmfTraceElement) { styledString.append(formatTraceRange(((TmfTraceElement) element).getElementUnderTraceFolder())); } } return styledString; }

Target:
public StyledString getStyledText(Object element) { String text = getText(element); StyledString styledString = null; if (text != null) { if (element instanceof ITmfStyledProjectModelElement) { Styler styler = ((ITmfStyledProjectModelElement) element).getStyler(); if (styler != null) { styledString = new StyledString(text, styler); } } if (styledString == null) { styledString = new StyledString(text); } boolean displayTimeRange = Activator.getDefault().getPreferenceStore().getBoolean(ITmfUIPreferences.TRACE_DISPLAY_RANGE_PROJECTEXPLORER); if (displayTimeRange && element instanceof TmfTraceElement) { styledString.append(formatTraceRange(((TmfTraceElement) element).getElementUnderTraceFolder())); } } return styledString; }
Source:
public Set<String> getBlacklist(List<Map<String, Set<Integer>>> supervisorsWithFailures, Cluster cluster, Topologies topologies) { Map<String, Integer> countMap = new HashMap<>(); for (Map<String, Set<Integer>> item : supervisorsWithFailures) { Set<String> supervisors = item.keySet(); for (String supervisor : supervisors) { int supervisorCount = countMap.getOrDefault(supervisor, 0); countMap.put(supervisor, supervisorCount + 1); } } for (Map.Entry<String, Integer> entry : countMap.entrySet()) { String supervisor = entry.getKey(); int count = entry.getValue(); if (count >= toleranceCount) { if (!blacklist.containsKey(supervisor)) { LOG.debug("Added supervisor to blacklist", supervisor); LOG.debug("supervisorsWithFailures : {}", supervisorsWithFailures); reporter.reportBlacklist(supervisor, supervisorsWithFailures); blacklist.put(supervisor, resumeTime / nimbusMonitorFreqSecs); } } } Set<String> toRelease = releaseBlacklistWhenNeeded(cluster, new ArrayList<>(blacklist.keySet())); cluster.setQuarantinedSupervisors(toRelease); if (toRelease != null) { LOG.debug("Releasing nodes because of low resources", toRelease.size()); for (String key : toRelease) { blacklist.remove(key); } } return blacklist.keySet(); }

Target:
public Set<String> getBlacklist(List<Map<String, Set<Integer>>> supervisorsWithFailures, Cluster cluster, Topologies topologies) { Map<String, Integer> countMap = new HashMap<>(); for (Map<String, Set<Integer>> item : supervisorsWithFailures) { Set<String> supervisors = item.keySet(); for (String supervisor : supervisors) { int supervisorCount = countMap.getOrDefault(supervisor, 0); countMap.put(supervisor, supervisorCount + 1); } } for (Map.Entry<String, Integer> entry : countMap.entrySet()) { String supervisor = entry.getKey(); int count = entry.getValue(); if (count >= toleranceCount) { if (!blacklist.containsKey(supervisor)) { LOG.debug("Added supervisor to blacklist", supervisor); LOG.debug("supervisorsWithFailures : {}", supervisorsWithFailures); reporter.reportBlacklist(supervisor, supervisorsWithFailures); blacklist.put(supervisor, resumeTime / nimbusMonitorFreqSecs); } } } Set<String> toRelease = releaseBlacklistWhenNeeded(cluster, new ArrayList<>(blacklist.keySet())); if (toRelease != null) { LOG.debug("Releasing nodes because of low resources", toRelease.size()); cluster.setGreyListedSupervisors(toRelease); for (String key : toRelease) { blacklist.remove(key); } } return blacklist.keySet(); }
Source:
public Mutex getMutexForHttpSession(final String sessionId) { Assert.requireNonBlank(sessionId, "sessionId"); WeakReference<Mutex> mutexReference = sessionMutexMap.get(sessionId); Assert.requireNonNull(mutexReference, "mutexReference"); return mutexReference.get(); }

Target:
public Mutex getMutexForHttpSession(final String sessionId) { Assert.requireNonBlank(sessionId, "sessionId"); final WeakReference<Mutex> mutexReference = sessionMutexMap.get(sessionId); Assert.requireNonNull(mutexReference, "mutexReference"); return mutexReference.get(); }
Source:
public Plan(PlanNode root, Map<Symbol, Type> types, Lookup lookup, Session session) { requireNonNull(root, "root is null"); requireNonNull(types, "types is null"); requireNonNull(lookup, "lookup is null"); this.root = root; this.types = ImmutableMap.copyOf(types); this.planNodeCosts = getPlanNodes(root) .stream() .collect(toImmutableMap(PlanNode::getId, node -> lookup.getCost(node, session, types))); }

Target:
public Plan(PlanNode root, Map<Symbol, Type> types, Lookup lookup, Session session) { requireNonNull(root, "root is null"); requireNonNull(types, "types is null"); requireNonNull(lookup, "lookup is null"); this.root = root; this.types = ImmutableMap.copyOf(types); this.planNodeStatsEstimates = getPlanNodes(root) .stream() .collect(toImmutableMap(PlanNode::getId, node -> lookup.getStats(node, session, types))); }
Source:
private Row fetchNodeInfo(Host host, Connection c) throws ConnectionException, BusyConnectionException, ExecutionException, InterruptedException { boolean isConnectedHost = c.address.equals(host.getSocketAddress()); if (isConnectedHost || host.getBroadcastSocketAddress() != null) { String query; if (isConnectedHost) { query = SELECT_LOCAL; } else { InetSocketAddress broadcastAddress = host.getBroadcastSocketAddress(); query = isPeersV2 ? SELECT_PEERS_V2 + " WHERE peer='" + broadcastAddress.getAddress().getHostAddress() + "' AND peer_port=" + broadcastAddress.getPort() : SELECT_PEERS + " WHERE peer='" + broadcastAddress.getAddress().getHostAddress() + "'"; } DefaultResultSetFuture future = new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(query)); c.write(future); Row row = future.get().one(); if (row != null) { return row; } else { InetSocketAddress address = host.getBroadcastSocketAddress(); String addressToUse = address.getPort() != 0 ? address.toString() : address.getAddress().toString(); logger.debug( "Could not find peer with broadcast address {}, " + "falling back to a full system.peers scan to fetch info for " + "(this can happen if the broadcast address changed)", address, host); } } ListenableFuture<ResultSet> future = selectPeersFuture(c); for (Row row : future.get()) { InetSocketAddress addr = nativeAddressForPeerHost(row, c.address, cluster); if (addr != null && addr.equals(host.getSocketAddress())) return row; } return null; }

Target:
private Row fetchNodeInfo(Host host, Connection c) throws ConnectionException, BusyConnectionException, ExecutionException, InterruptedException { boolean isConnectedHost = c.address.equals(host.getSocketAddress()); if (isConnectedHost || host.getBroadcastSocketAddress() != null) { String query; if (isConnectedHost) { query = SELECT_LOCAL; } else { InetSocketAddress broadcastAddress = host.getBroadcastSocketAddress(); query = isPeersV2 ? SELECT_PEERS_V2 + " WHERE peer='" + broadcastAddress.getAddress().getHostAddress() + "' AND peer_port=" + broadcastAddress.getPort() : SELECT_PEERS + " WHERE peer='" + broadcastAddress.getAddress().getHostAddress() + "'"; } DefaultResultSetFuture future = new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(query)); c.write(future); Row row = future.get().one(); if (row != null) { return row; } else { InetSocketAddress address = host.getBroadcastSocketAddress(); String addressToUse = address.getPort() != 0 ? address.toString() : address.getAddress().toString(); logger.debug( "Could not find peer with broadcast address {}, " + "falling back to a full system.peers scan to fetch info for " + "(this can happen if the broadcast address changed)", addressToUse, host); } } ListenableFuture<ResultSet> future = selectPeersFuture(c); for (Row row : future.get()) { InetSocketAddress addr = nativeAddressForPeerHost(row, c.address, cluster); if (addr != null && addr.equals(host.getSocketAddress())) return row; } return null; }
Source:
public void forwardMergeBranchExcludeChange() throws Exception { indexRevision(MAIN, NEW_DATA); indexRevision(MAIN, NEW_DATA2); String child = createBranch(MAIN, "a"); indexChange(child, NEW_DATA, CHANGED_DATA); assertState(child, MAIN, BranchState.FORWARD); branching() .prepareMerge(child, MAIN) .exclude(STORAGE_KEY1) .squash(true) .merge(); assertState(MAIN, child, BranchState.FORWARD); assertState(child, MAIN, BranchState.BEHIND); assertNotNull(getRevision(MAIN, RevisionData.class, STORAGE_KEY2)); assertNotNull(getRevision(MAIN, RevisionData.class, STORAGE_KEY1)); assertEquals(getRevision(MAIN, RevisionData.class, STORAGE_KEY1), NEW_DATA); }

Target:
public void forwardMergeBranchExcludeChange() throws Exception { indexRevision(MAIN, NEW_DATA); indexRevision(MAIN, NEW_DATA2); String child = createBranch(MAIN, "a"); indexChange(child, NEW_DATA, CHANGED_DATA); assertState(child, MAIN, BranchState.FORWARD); branching() .prepareMerge(child, MAIN) .exclude(STORAGE_KEY1) .squash(true) .merge(); assertState(MAIN, child, BranchState.FORWARD); assertState(child, MAIN, BranchState.BEHIND); assertNotNull(getRevision(MAIN, RevisionData.class, STORAGE_KEY2)); assertEquals(getRevision(MAIN, RevisionData.class, STORAGE_KEY1), NEW_DATA); }
Source:
public SimpleRabbitListenerContainerFactory consumerBatchContainerFactory() { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); factory.setConnectionFactory(rabbitConnectionFactory()); factory.setConsumerTagStrategy(consumerTagStrategy()); factory.setBatchListener(true); factory.setContainerConfigurer(container -> { container.setConsumerBatchEnabled(true); container.setDeBatchingEnabled(true); container.setBatchSize(2); }); return factory; }

Target:
public SimpleRabbitListenerContainerFactory consumerBatchContainerFactory() { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); factory.setConnectionFactory(rabbitConnectionFactory()); factory.setConsumerTagStrategy(consumerTagStrategy()); factory.setBatchListener(true); factory.setBatchSize(2); factory.setConsumerBatchEnabled(true); return factory; }
Source:
public static String parent(String deckName) { int index = deckName.lastIndexOf("::"); if (index == -1) { return null; } if (deckName.charAt(index-1) == ':') { index -= 1; } return deckName.substring(0, index); }

Target:
public static String parent(String deckName) { List<String> parts = Arrays.asList(deckName.split("::", -1)); if (parts.size() < 2) { return null; } else { parts = parts.subList(0, parts.size() - 1); return TextUtils.join("::", parts); } }