auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static String getTagsRecord(Set<String> tags) { if (tags == null || tags.size() == 0) { return "[ ]"; } StringBuilder res = new StringBuilder().append("[ "); int i = 1; for (String tag : tags) { if (i < tags.size()) res.append(tag + ", "); else res.append(tag); i++; } return res.append(" ]").toString(); }

Target:
private static String getTagsRecord(Set<String> tags) { if (tags == null || tags.size() == 0) { return "[ ]"; } StringBuilder res = new StringBuilder().append("[ "); int i = 1; for (String tag : tags) { if (i < tags.size()) { res.append(tag + ", "); } else { res.append(tag); } i++; } return res.append(" ]").toString(); }
Source:
protected void getDowntime() { try { VDSReturnValue retVal = runVdsCommand(VDSCommandType.MigrateStatus, new MigrateStatusVDSCommandParameters(getDestinationVdsId(), getVmId())); if (retVal != null) { actualDowntime = (Integer) retVal.getReturnValue(); } } catch (VdcBLLException e) { migrationErrorCode = e.getErrorCode(); } }

Target:
protected void getDowntime() { if (FeatureSupported.migrateDowntime(getVm().getVdsGroupCompatibilityVersion())) { try { VDSReturnValue retVal = runVdsCommand(VDSCommandType.MigrateStatus, new MigrateStatusVDSCommandParameters(getDestinationVdsId(), getVmId())); if (retVal != null) { actualDowntime = (Integer) retVal.getReturnValue(); } } catch (VdcBLLException e) { migrationErrorCode = e.getErrorCode(); } } }
Source:
public String[] getGroupFilters() { String[] result = null; IAnnotation before = m_annotationFinder.findAnnotation(getConstructorOrMethod(), IBeforeMethod.class); if (before != null) { result = ((ConfigurationAnnotation) before).getGroupFilters(); } return result; }

Target:
public String[] getGroupFilters() { IBeforeMethod before = m_annotationFinder.findAnnotation(getConstructorOrMethod(), IBeforeMethod.class); if (before == null) { return new String[0]; } return before.getGroupFilters(); }
Source:
private void showLoginFields() { AnimationHelper.showView(findViewById(R.id.serverInput), 201); AnimationHelper.hideView(findViewById(R.id.serverFieldLayout), 100); realmNameET = (EditText) findViewById(R.id.realmName); if (getIntent().getBooleanExtra("FROM_ADDREALM", false)) { startedFromAddRealm = true; ((TextView) findViewById(R.id.textView1)).setText(R.string.add_realm); ((Button) findViewById(R.id.zulip_login)).setText(R.string.add_realm_login); } }

Target:
private void showLoginFields() { AnimationHelper.showView(findViewById(R.id.serverInput), 201); AnimationHelper.hideView(findViewById(R.id.serverFieldLayout), 100); realmNameET = (EditText) findViewById(R.id.realmName); if (getIntent().getBooleanExtra("FROM_ADDREALM", false)) { startedFromAddRealm = true; ((TextView) findViewById(R.id.welcome_zulip)).setText(R.string.add_realm); ((Button) findViewById(R.id.zulip_login)).setText(R.string.add_realm_login); } }
Source:
public int scan( int[] offsets, int beginOffset, int numOffsets, int endOffset, ResultsConsumer resultsConsumer) throws IOException { this.offsets = offsets; this.beginOffset = beginOffset; this.numOffsets = numOffsets; this.endOffset = endOffset; this.resultsConsumer = resultsConsumer; this.numResults = 0; this.offsetIdx = beginOffset; if (numLiterals > 0) { scanLiterals(); } while (offsetIdx < beginOffset + numOffsets) { used = 0; numLiterals = 0; scanDone = false; readValues(); if (!scanDone) { scanLiterals(); } } skip(endOffset - offsets[beginOffset + numOffsets - 1] - 1); this.offsets = null; return numResults; }

Target:
public int scan( int[] offsets, int beginOffset, int numOffsets, int endOffset, ResultsConsumer resultsConsumer) throws IOException { this.offsets = offsets; this.beginOffset = beginOffset; this.numOffsets = numOffsets; this.resultsConsumer = resultsConsumer; this.numResults = 0; this.offsetIdx = beginOffset; if (numLiterals > 0) { scanLiterals(); } while (offsetIdx < beginOffset + numOffsets) { used = 0; numLiterals = 0; readValues(); scanLiterals(); } skip(endOffset - offsets[beginOffset + numOffsets - 1] - 1); this.offsets = null; return numResults; }
Source:
public StateItem[] getStateTable() { if (fStateTable == null) { Map<@NonNull String, @NonNull OutputElementStyle> styles = getStyles(); if (styles == null || styles.isEmpty()) { return new StateItem[0]; } List<StateItem> stateItemList = new ArrayList<>(); int tableIndex = 0; for (Entry<@NonNull String, @NonNull OutputElementStyle> styleEntry : fStylesMap.entrySet()) { @NonNull Map<@NonNull String, @NonNull Object> elementStyle = styleEntry.getValue().getStyleValues(); Object color = elementStyle.get(StyleProperties.BACKGROUND_COLOR); RGB rgb = new RGB(0, 0, 0); if (color instanceof String) { RGB rgbColor = ColorUtils.fromHexColor((String) color); rgb = rgbColor != null ? rgbColor : new RGB(0, 0, 0); } fLabelToIndex.put(styleEntry.getKey(), tableIndex); tableIndex++; Map<String, Object> styleMap = new HashMap<>(); styleMap.put(ITimeEventStyleStrings.fillStyle(), ITimeEventStyleStrings.solidColorFillStyle()); styleMap.put(ITimeEventStyleStrings.fillColor(), new RGBAColor(rgb.red, rgb.green, rgb.blue).toInt()); styleMap.put(ITimeEventStyleStrings.label(), styleEntry.getKey()); Object styleGroup = elementStyle.get(StyleProperties.STYLE_GROUP); if (styleGroup != null) { styleMap.put(ITimeEventStyleStrings.group(), styleGroup); } stateItemList.add(new StateItem(styleMap)); } fStateTable = stateItemList.toArray(new StateItem[stateItemList.size()]); return fStateTable; } return fStateTable; }

Target:
public StateItem[] getStateTable() { @Nullable StateItem[] stateTable = fStateTable; if (stateTable == null) { Map<@NonNull String, @NonNull OutputElementStyle> styles = getStyles(); if (styles.isEmpty()) { return new StateItem[0]; } List<StateItem> stateItemList = new ArrayList<>(); int tableIndex = 0; for (Entry<String, OutputElementStyle> styleEntry : styles.entrySet()) { Map<String, Object> elementStyle = styleEntry.getValue().getStyleValues(); Object color = elementStyle.get(StyleProperties.BACKGROUND_COLOR); RGB rgb = new RGB(0, 0, 0); if (color instanceof String) { RGB rgbColor = ColorUtils.fromHexColor((String) color); rgb = rgbColor != null ? rgbColor : new RGB(0, 0, 0); } fLabelToIndex.put(styleEntry.getKey(), tableIndex); tableIndex++; Map<String, Object> styleMap = new HashMap<>(); styleMap.put(ITimeEventStyleStrings.fillStyle(), ITimeEventStyleStrings.solidColorFillStyle()); styleMap.put(ITimeEventStyleStrings.fillColor(), new RGBAColor(rgb.red, rgb.green, rgb.blue).toInt()); styleMap.put(ITimeEventStyleStrings.label(), styleEntry.getKey()); Object styleGroup = elementStyle.get(StyleProperties.STYLE_GROUP); if (styleGroup != null) { styleMap.put(ITimeEventStyleStrings.group(), styleGroup); } stateItemList.add(new StateItem(styleMap)); } stateTable = stateItemList.toArray(new StateItem[stateItemList.size()]); fStateTable = stateTable; } return stateTable; }
Source:
protected AbstractVoltDBPTableScan(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, VoltTable voltDBTable, RexProgram program, RexNode offset, RexNode limit, RelNode aggregate, RelDataType preAggregateRowType, RexProgram preAggregateProgram, int splitCount) { super(cluster, traitSet.plus(VoltDBPRel.VOLTDB_PHYSICAL), table, voltDBTable); assert (program != null); assert (aggregate == null || aggregate instanceof AbstractVoltDBPAggregate); m_program = program; m_offset = offset; m_limit = limit; m_aggregate = aggregate; m_preAggregateRowType = preAggregateRowType; m_preAggregateProgram = preAggregateProgram; m_splitCount = splitCount; }

Target:
protected AbstractVoltDBPTableScan(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, VoltTable voltDBTable, RexProgram program, RexNode offset, RexNode limit, RelNode aggregate, RelDataType preAggregateRowType, RexProgram preAggregateProgram, int splitCount) { super(cluster, traitSet.plus(VoltDBPRel.VOLTDB_PHYSICAL), table, voltDBTable); Preconditions.checkNotNull(program); Preconditions.checkArgument(aggregate == null || aggregate instanceof AbstractVoltDBPAggregate); Preconditions.checkArgument(program.getOutputRowType().getFieldCount() > 0); m_program = program; m_offset = offset; m_limit = limit; m_aggregate = aggregate; m_preAggregateRowType = preAggregateRowType; m_preAggregateProgram = preAggregateProgram; m_splitCount = splitCount; }
Source:
boolean passesQualityCheck(final byte[] bases, final byte[] quals, final int seedLength, final int minQuality) { if (bases.length < seedLength) return false; for (int i = 0; i < seedLength; ++i) { if (SequenceUtil.isNoCall(bases[i])) return false; } final int maxReadLength = (MAX_READ_LENGTH <= 0) ? Integer.MAX_VALUE : MAX_READ_LENGTH; final int readLength = Math.min(bases.length, maxReadLength); int total = 0; for (int i = 0; i < readLength; i++) total += bases[i]; return total / readLength >= minQuality; }

Target:
boolean passesQualityCheck(final byte[] bases, final byte[] quals, final int seedLength, final int minQuality) { if (bases.length < seedLength) return false; for (int i = 0; i < seedLength; ++i) { if (SequenceUtil.isNoCall(bases[i])) return false; } final int maxReadLength = (MAX_READ_LENGTH <= 0) ? Integer.MAX_VALUE : MAX_READ_LENGTH; final int readLength = Math.min(bases.length, maxReadLength); int total = 0; for (int i = 0; i < readLength; i++) total += quals[i]; return total / readLength >= minQuality; }
Source:
public String getBaseComponentKey() { return getComponent(); }

Target:
public String getBaseComponentKey() { return baseComponentKey; }
Source:
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return null; } if (source instanceof List) { List<?> sourceList = (List<?>) source; if (!sourceList.isEmpty() && sourceList.get(0) instanceof String) { return source; } } if (source instanceof Collection) { final Collection<String> results = new ArrayList<>(); for (Object object : ((Collection<?>) source)) { if (object != null) { results.add(object.toString()); } } return results; } return Collections.singletonList(source.toString()); }

Target:
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return null; } if (source instanceof List) { List<?> sourceList = (List<?>) source; if (!sourceList.isEmpty() && sourceList.get(0) instanceof String) { return source; } } if (source instanceof Collection) { Collection<String> results = new ArrayList<>(); for (Object object : ((Collection<?>) source)) { if (object != null) { results.add(object.toString()); } } return results; } return Collections.singletonList(source.toString()); }
Source:
void put( long idx, V e, V[] evictions ) { if ( idx < 0 ) { throw new IllegalArgumentException( "Index must be >= 0" ); } if ( e == null ) { throw new IllegalArgumentException( "Null entries are not accepted" ); } if ( idx == endIndex + 1 ) { evictions[0] = circle.append( e ); endIndex = endIndex + 1; } else { circle.clear( evictions ); circle.append( e ); endIndex = idx; } }

Target:
void put( long idx, V e, V[] evictions ) { if ( idx < 0 ) { throw new IllegalArgumentException( format( "Index must be >= 0 (was %d)", idx ) ); } if ( e == null ) { throw new IllegalArgumentException( "Null entries are not accepted" ); } if ( idx == endIndex + 1 ) { evictions[0] = circle.append( e ); endIndex = endIndex + 1; } else { circle.clear( evictions ); circle.append( e ); endIndex = idx; } }
Source:
public CreateBranchWizard(Repository repository, String base) { try (RevWalk rw = new RevWalk(repository)) { if (base == null) { myPage = new CreateBranchPage(repository, (Ref) null); } else if (ObjectId.isId(base)) { RevCommit commit = rw.parseCommit(ObjectId .fromString(base)); myPage = new CreateBranchPage(repository, commit); } else { if (base.startsWith(Constants.R_HEADS) || base.startsWith(Constants.R_REMOTES) || base.startsWith(Constants.R_TAGS)) { Ref currentBranch = repository.findRef(base); myPage = new CreateBranchPage(repository, currentBranch); } else { RevCommit commit = rw.parseCommit( repository.resolve(base + "^{commit}")); myPage = new CreateBranchPage(repository, commit); } } } catch (IOException e) { myPage = new CreateBranchPage(repository, (Ref) null); } setWindowTitle(UIText.CreateBranchWizard_NewBranchTitle); }

Target:
public CreateBranchWizard(Repository repository, String base) { try (RevWalk rw = new RevWalk(repository)) { if (base == null) { myPage = new CreateBranchPage(repository, (Ref) null); } else if (ObjectId.isId(base)) { RevCommit commit = rw.parseCommit(ObjectId .fromString(base)); myPage = new CreateBranchPage(repository, commit); } else { if (base.startsWith(Constants.R_HEADS) || base.startsWith(Constants.R_REMOTES) || base.startsWith(Constants.R_TAGS)) { Ref currentBranch = repository.exactRef(base); myPage = new CreateBranchPage(repository, currentBranch); } else { RevCommit commit = rw.parseCommit( repository.resolve(base + "^{commit}")); myPage = new CreateBranchPage(repository, commit); } } } catch (IOException e) { myPage = new CreateBranchPage(repository, (Ref) null); } setWindowTitle(UIText.CreateBranchWizard_NewBranchTitle); }
Source:
public JobDetail refreshPools( @PathParam("owner_key") String ownerKey, @QueryParam("auto_create_owner") @DefaultValue("false") Boolean autoCreateOwner, @QueryParam("lazy_regen") @DefaultValue("true") Boolean lazyRegen) { Owner owner = ownerCurator.lookupByKey(ownerKey); if (owner == null) { if (autoCreateOwner) { if (ownerService.isOwnerKeyValidForCreation(ownerKey)) { owner = this.createOwner(new Owner(ownerKey, ownerKey)); } } else { throw new NotFoundException(i18n.tr( "owner with key: {0} was not found.", ownerKey)); } } return RefreshPoolsJob.forOwner(owner, lazyRegen); }

Target:
public JobDetail refreshPools( @PathParam("owner_key") String ownerKey, @QueryParam("auto_create_owner") @DefaultValue("false") Boolean autoCreateOwner, @QueryParam("lazy_regen") @DefaultValue("true") Boolean lazyRegen) { Owner owner = ownerCurator.lookupByKey(ownerKey); if (owner == null) { if (autoCreateOwner && ownerService.isOwnerKeyValidForCreation(ownerKey)) { owner = this.createOwner(new Owner(ownerKey, ownerKey)); } else { throw new NotFoundException(i18n.tr( "owner with key: {0} was not found.", ownerKey)); } } return RefreshPoolsJob.forOwner(owner, lazyRegen); }
Source:
private void initDescription() { final VerticalPanel vp = new VerticalPanel(); vp.add(new SmallHeading(Util.C.headingDescription())); descTxt = new NpTextArea(); descTxt.setVisibleLines(6); descTxt.setCharacterWidth(60); vp.add(descTxt); add(vp); saveEnabler = new OnEditEnabler(saveProject, descTxt); }

Target:
private void initDescription() { final VerticalPanel vp = new VerticalPanel(); vp.add(new SmallHeading(Util.C.headingDescription())); descTxt = new NpTextArea(); descTxt.setVisibleLines(6); descTxt.setCharacterWidth(60); vp.add(descTxt); add(vp); saveEnabler = new OnEditEnabler(saveProject); saveEnabler.listenTo(descTxt); }
Source:
public void visitMethodInvocation(MethodInvocationTree tree) { if (OPTIONAL_IS_PRESENT.matches(tree)) { constraintManager.setValueFactory(id -> new OptionalSymbolicValue(id, programState.peekValue())); } else if (OPTIONAL_GET.matches(tree) && presenceHasNotBeenChecked(programState.peekValue())) { String identifier = getIdentifierPart(tree.methodSelect()); context.reportIssue(tree, check, String.format("Call \"%sisPresent()\" before accessing the value.", StringUtils.isEmpty(identifier) ? "Optional#" : (identifier + ".")), Flows.singleton(String.format("Optional %sis accessed", StringUtils.isEmpty(identifier) ? "" : (identifier + " ")), tree.methodSelect())); programState = null; } }

Target:
public void visitMethodInvocation(MethodInvocationTree tree) { if (OPTIONAL_IS_PRESENT.matches(tree)) { constraintManager.setValueFactory(id -> new OptionalSymbolicValue(id, programState.peekValue())); } else if (OPTIONAL_GET.matches(tree) && presenceHasNotBeenChecked(programState.peekValue())) { String identifier = getIdentifierPart(tree.methodSelect()); String issueMsg; String flowMsg; if (identifier.isEmpty()) { issueMsg = "Optional#"; flowMsg = ""; } else { issueMsg = identifier + "."; flowMsg = identifier + " "; } Set<List<JavaFileScannerContext.Location>> flow = FlowComputation.singleton("Optional " + flowMsg + "is accessed", tree.methodSelect()); context.reportIssue(tree, check, "Call \""+ issueMsg + "isPresent()\" before accessing the value.", flow); programState = null; } }
Source:
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { ErlangFunction function = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), ErlangFunction.class, false); if (function == null) return; PsiFile file = function.getContainingFile(); if (!(file instanceof ErlangFile)) return; List<ErlangAttribute> attributes = ((ErlangFile) file).getAttributes(); for (ErlangAttribute attribute : attributes) { ErlangImportDirective importDirective = attribute.getImportDirective(); if (importDirective == null || importDirective.getModuleRef() == null) continue; ErlangImportFunctions importFunctions = importDirective.getImportFunctions(); if (importFunctions == null) continue; if (importFunctions.getImportFunctionList().size() == 0) continue; if (importFunctions.getImportFunctionList().size() == 1) { attribute.delete(); continue; } StringBuilder newImport = new StringBuilder(); for (ErlangImportFunction ef : importFunctions.getImportFunctionList()) { if (!ef.getText().equals(function.getName() + "/" + function.getArity())) { if (newImport.length() > 0) newImport.append(", "); newImport.append(ef.getText()); } } String moduleName = importDirective.getModuleRef().getText(); attribute.replace(ErlangElementFactory.createImportFromText(project, moduleName, newImport.toString())); } }

Target:
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement function = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), ErlangFunction.class); if (function == null) { function = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), ErlangImportFunction.class, false); } if (function == null) return; PsiFile file = function.getContainingFile(); if (!(file instanceof ErlangFile)) return; List<ErlangAttribute> attributes = ((ErlangFile) file).getAttributes(); for (ErlangAttribute attribute : attributes) { ErlangImportDirective importDirective = attribute.getImportDirective(); if (importDirective == null || importDirective.getModuleRef() == null) continue; ErlangImportFunctions fns = importDirective.getImportFunctions(); List<ErlangImportFunction> functoins = fns == null ? ContainerUtil.<ErlangImportFunction>emptyList() : fns.getImportFunctionList(); if (functoins.isEmpty()) continue; if (functoins.size() == 1) { attribute.delete(); continue; } List<String> newImports = ContainerUtil.newArrayList(); String fullName; if (function instanceof ErlangFunction) { fullName = ErlangPsiImplUtil.createFunctionPresentation((ErlangFunction) function); } else { fullName = ErlangPsiImplUtil.createFunctionPresentation((ErlangImportFunction) function); } for (ErlangImportFunction f : functoins) { String presentation = ErlangPsiImplUtil.createFunctionPresentation(f); if (presentation == null || !presentation.equals(fullName)) { newImports.add(f.getText()); } } String moduleName = importDirective.getModuleRef().getText(); attribute.replace(ErlangElementFactory.createImportFromText(project, moduleName, StringUtil.join(newImports, ", "))); } }
Source:
private List<MavenProject> trimSelectedProjects( List<MavenProject> projects, ProjectDependencyGraph graph, MavenExecutionRequest request ) throws MavenExecutionException { List<MavenProject> result = projects; if ( !request.getSelectedProjects().isEmpty() ) { File reactorDirectory = getReactorDirectory( request ); Collection<MavenProject> selectedProjects = new LinkedHashSet<>( request.getSelectedProjects().size() ); for ( String selector : request.getSelectedProjects() ) { MavenProject selectedProject = projects.stream() .filter( project -> isMatchingProject( project, selector, reactorDirectory ) ) .findFirst() .orElseThrow( () -> new MavenExecutionException( "Could not find the selected project in the reactor: " + selector, request.getPom() ) ); selectedProjects.add( selectedProject ); } result = new ArrayList<>( selectedProjects ); result = includeAlsoMakeTransitively( result, request, graph ); List<MavenProject> sortedProjects = graph.getSortedProjects(); result.sort( comparing( sortedProjects::indexOf ) ); } return result; }

Target:
private List<MavenProject> trimSelectedProjects( List<MavenProject> projects, ProjectDependencyGraph graph, MavenExecutionRequest request ) throws MavenExecutionException { List<MavenProject> result = projects; if ( !request.getSelectedProjects().isEmpty() ) { File reactorDirectory = getReactorDirectory( request ); Collection<MavenProject> selectedProjects = new LinkedHashSet<>( request.getSelectedProjects().size(), 1 ); for ( String selector : request.getSelectedProjects() ) { MavenProject selectedProject = projects.stream() .filter( project -> isMatchingProject( project, selector, reactorDirectory ) ) .findFirst() .orElseThrow( () -> new MavenExecutionException( "Could not find the selected project in the reactor: " + selector, request.getPom() ) ); selectedProjects.add( selectedProject ); } result = new ArrayList<>( selectedProjects ); result = includeAlsoMakeTransitively( result, request, graph ); List<MavenProject> sortedProjects = graph.getSortedProjects(); result.sort( comparing( sortedProjects::indexOf ) ); } return result; }
Source:
protected void checkConfig() { String msg = null; if (localConfig == null && remoteConfig == null) { msg = "No local or remote configuration provided, aborting"; } if (clientConfig == null) { msg = "No client configuration provided, aborting"; } if (msg != null) { log.error(msg); throw new IllegalStateException(msg); } }

Target:
protected void checkConfig() { if (clientConfig == null) { throw new IllegalStateException("No Elasticsearch Client configuration provided, aborting"); } }
Source:
public List<OutputPin> deriveResults(CallBehaviorAction node) { List<OutputPin> derivedOutputPins = new ArrayList<OutputPin>(); if (node.getBehavior() != null) { for (Parameter parameter : node.getBehavior().getOwnedParameters()) { if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL | parameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL | parameter.getDirection() == ParameterDirectionKind.OUT_LITERAL) { OutputPin derivedPin = UMLFactory.eINSTANCE.createOutputPin(); derivedPin.setType(parameter.getType()); derivedPin.setLower(parameter.getLower()); derivedPin.setUpper(parameter.getUpper()); if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) { derivedPin.setName("[out] " + parameter.getName()); } else { derivedPin.setName(parameter.getName()); } derivedOutputPins.add(derivedPin); } } } return derivedOutputPins; }

Target:
public List<OutputPin> deriveResults(CallBehaviorAction node) { List<OutputPin> derivedOutputPins = new ArrayList<OutputPin>(); if (node.getBehavior() != null) { for (Parameter parameter : node.getBehavior().getOwnedParameters()) { if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL || parameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL || parameter.getDirection() == ParameterDirectionKind.OUT_LITERAL) { OutputPin derivedPin = UMLFactory.eINSTANCE.createOutputPin(); derivedPin.setType(parameter.getType()); derivedPin.setLower(parameter.getLower()); derivedPin.setUpper(parameter.getUpper()); if (parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) { derivedPin.setName("[out] " + parameter.getName()); } else { derivedPin.setName(parameter.getName()); } derivedOutputPins.add(derivedPin); } } } return derivedOutputPins; }
Source:
public void multiService() { assert_().about(javaSources()) .that(Arrays.asList( JavaFileObjects.forResource("test/SomeService.java"), JavaFileObjects.forResource("test/MultiServiceProvider.java"), JavaFileObjects.forResource("test/AnotherService.java"))) .processedWith(new AutoServiceProcessor()) .compilesWithoutError() .and().generatesFiles( JavaFileObjects.forResource("META-INF/services/test.SomeService"), JavaFileObjects.forResource("META-INF/services/test.AnotherService")); }

Target:
public void multiService() { assertThat( JavaFileObjects.forResource("test/SomeService.java"), JavaFileObjects.forResource("test/AnotherService.java"), JavaFileObjects.forResource("test/MultiServiceProvider.java")) .processedWith(new AutoServiceProcessor()) .compilesWithoutError() .and().generatesFiles( JavaFileObjects.forResource("META-INF/services/test.SomeServiceMulti"), JavaFileObjects.forResource("META-INF/services/test.AnotherServiceMulti")); }
Source:
@Test public void testPullUpPredicatesFromMinus() { final RelMetadataQuery mq = RelMetadataQuery.instance(); RelNode rel = convertSql("" + "select empno, deptno, comm from emp where empno=1 and deptno=2\n" + "except all\n" + "select empno, deptno, comm from emp where comm=3"); assertThat(mq.getPulledUpPredicates(rel).pulledUpPredicates, sortsAs("[=($0, 1), =($1, 2)]")); }

Target:
@Test public void testPullUpPredicatesFromMinus() { final RelMetadataQuery mq = RelMetadataQuery.instance(); final RelNode rel = convertSql("" + "select empno, deptno, comm from emp where empno=1 and deptno=2\n" + "except all\n" + "select empno, deptno, comm from emp where comm=3"); assertThat(mq.getPulledUpPredicates(rel).pulledUpPredicates, sortsAs("[=($0, 1), =($1, 2)]")); }
Source:
protected void includeProperties(Set<Property> allProperties) { super.includeProperties(allProperties); for (Node n : nodes) { n.includeProperties(allProperties); } }

Target:
protected void includeProperties(Set<Property> allProperties) { super.includeProperties(allProperties); nodes.forEach(n -> n.includeProperties(allProperties)); }
Source:
public void storeNewPassword(GluuCustomPerson person, boolean validateOldPassword) { if (validateOldPassword) { boolean resultValidateOldPassword = false; try { if ((person != null) && StringHelper.isNotEmpty(person.getUid())) { resultValidateOldPassword = personService.authenticate(person.getUid(), oldPassword); } } catch (AuthenticationException ex) { log.debug("Failed to verify old person password", ex); } if (!resultValidateOldPassword) { if (graphValidator == null) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Old password isn't valid!", "Old password isn't valid!")); } else { FacesContext.getCurrentInstance().addMessage(graphValidator.getClientId(), new FacesMessage( FacesMessage.SEVERITY_ERROR, "Old password isn't valid!", "Old password isn't valid!")); } } } else { if (isSame()) { person.setUserPassword(this.password); personService.updatePerson(person); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Successfully changed!", "Successfully changed!")); } else { FacesContext.getCurrentInstance().addMessage(graphValidator.getClientId(), new FacesMessage(FacesMessage.SEVERITY_ERROR, "Password and confirm password value don't match", "Password and confirm password value don't match")); } } }

Target:
public void storeNewPassword(GluuCustomPerson person, boolean validateOldPassword) { if (validateOldPassword) { boolean resultValidateOldPassword = false; try { if ((person != null) && StringHelper.isNotEmpty(person.getUid())) { resultValidateOldPassword = personService.authenticate(person.getUid(), oldPassword); } } catch (AuthenticationException ex) { log.debug("Failed to verify old person password", ex); } if (!resultValidateOldPassword) { if (graphValidator == null) { facesMessages.add(FacesMessage.SEVERITY_ERROR, "Old password isn't valid!", "Old password isn't valid!"); } else { facesMessages.add(FacesMessage.SEVERITY_ERROR, "Old password isn't valid!", "Old password isn't valid!"); } } } else { if (this.password.equals(this.confirm)) { person.setUserPassword(this.password); personService.updatePerson(person); oxTrustAuditService.audit("USER " + person.getInum() + " PASSWORD UPDATED", identity.getUser(), (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()); facesMessages.add(FacesMessage.SEVERITY_INFO, "Successfully changed!", "Successfully changed!"); } else { facesMessages.add(FacesMessage.SEVERITY_ERROR, "Password and confirm password value don't match", "Password and confirm password value don't match"); } } }
Source:
public long getLanguageId() { try { return (Long) map.get(LANGUAGEID_KEY); } catch (ClassCastException e) { long languageId = Long.parseLong((String) map.get(LANGUAGEID_KEY)); map.put(LANGUAGEID_KEY, languageId); return languageId; } }

Target:
public long getLanguageId() { return ConversionUtils.toLong(map.get(LANGUAGEID_KEY), 0l); }
Source:
public List<String> createAndSaveOutputDataStagingTasks(ProcessModel processModel, String gatewayId) throws RegistryException { List<String> dataStagingTaskIds = new ArrayList<>(); List<OutputDataObjectType> processOutputs = processModel.getProcessOutputs(); String appName = OrchestratorUtils.getApplicationInterfaceName(orchestratorContext, processModel); if (processOutputs != null) { for (OutputDataObjectType processOutput : processOutputs) { DataType type = processOutput.getType(); switch (type) { case STDOUT : if(null == processOutput.getValue() || (null != processOutput.getValue() && processOutput.getValue().trim().isEmpty())){ processOutput.setValue(appName + ".stdout"); } createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput); break; case STDERR: if(null == processOutput.getValue() || (null != processOutput.getValue() && processOutput.getValue().trim().isEmpty())){ processOutput.setValue(appName + ".stderr"); } createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput); break; case URI: createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput); break; default: break; } } } try { if (isArchive(processModel, gatewayId)) { createArchiveDataStatgingTask(processModel, gatewayId, dataStagingTaskIds); } } catch (AppCatalogException e) { throw new RegistryException("Error! Application interface retrieval failed"); } return dataStagingTaskIds; }

Target:
public List<String> createAndSaveOutputDataStagingTasks(ProcessModel processModel, String gatewayId) throws RegistryException { List<String> dataStagingTaskIds = new ArrayList<>(); List<OutputDataObjectType> processOutputs = processModel.getProcessOutputs(); String appName = OrchestratorUtils.getApplicationInterfaceName(orchestratorContext, processModel); if (processOutputs != null) { for (OutputDataObjectType processOutput : processOutputs) { DataType type = processOutput.getType(); switch (type) { case STDOUT : if(null == processOutput.getValue() || processOutput.getValue().trim().isEmpty()){ processOutput.setValue(appName + ".stdout"); } createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput); break; case STDERR: if(null == processOutput.getValue() || processOutput.getValue().trim().isEmpty()){ processOutput.setValue(appName + ".stderr"); } createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput); break; case URI: createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput); break; default: break; } } } try { if (isArchive(processModel, gatewayId)) { createArchiveDataStatgingTask(processModel, gatewayId, dataStagingTaskIds); } } catch (AppCatalogException e) { throw new RegistryException("Error! Application interface retrieval failed"); } return dataStagingTaskIds; }
Source:
public Result execute(String cookieSentByRPC, Action<?> action) throws ActionException, ServiceException { if (action.isSecured() && !cookieMatch(cookieSentByRPC)) { String message = xsrfAttackMessage + " While executing action: " + action.getClass().getName(); logger.severe(message); throw new ServiceException(message); } try { return dispatch.execute(action); } catch (ActionException e) { if (logger.isLoggable(Level.WARNING)) { String newMessage = "Action exception while executing " + action.getClass().getName() + ": " + e.getMessage(); logger.log(Level.WARNING, newMessage, e); } e.setStackTrace(new StackTraceElement[]{}); throw e; } catch (ServiceException e) { if (logger.isLoggable(Level.WARNING)) { logger.log(Level.WARNING, "Service exception while executing " + action.getClass().getName() + ": " + e.getMessage(), e); } throw new ServiceException(e.getMessage()); } catch (RuntimeException e) { if (logger.isLoggable(Level.WARNING)) { logger.log(Level.WARNING, "Unexpected exception while executing " + action.getClass().getName() + ": " + "" + e.getMessage(), e); } throw new ServiceException(e.getMessage()); } }

Target:
public Result execute(String cookieSentByRPC, Action<?> action) throws ActionException, ServiceException { if (action.isSecured() && !cookieMatch(cookieSentByRPC)) { String message = xsrfAttackMessage + " While executing action: " + action.getClass().getName(); logger.severe(message); throw new ServiceException(message); } try { return dispatch.execute(action); } catch (ActionException e) { if (logger.isLoggable(Level.WARNING)) { String newMessage = "Action exception while executing " + action.getClass().getName() + ": " + e.getMessage(); logger.log(Level.WARNING, newMessage, e); } removeStacktraces(e); throw e; } catch (ServiceException e) { if (logger.isLoggable(Level.WARNING)) { logger.log(Level.WARNING, "Service exception while executing " + action.getClass().getName() + ": " + e.getMessage(), e); } throw new ServiceException(e.getMessage()); } catch (RuntimeException e) { if (logger.isLoggable(Level.WARNING)) { logger.log(Level.WARNING, "Unexpected exception while executing " + action.getClass().getName() + ": " + "" + e.getMessage(), e); } throw new ServiceException(e.getMessage()); } }
Source:
public void testInvalidParameterKey() { try { String key = "version=1;uuid=12345610-0000-0000-0000-000000000001"; DataMapKey deserializedParam = DataMapKey.deserialize(key); fail("InvalidParameterKeyException should have been raised"); } catch (InvalidPersistentMapKeyException e) { assertNotNull(e); } }

Target:
public void testInvalidParameterKey() { String key = "version=1;uuid=12345610-0000-0000-0000-000000000001"; DataMapKey deserializedParam = DataMapKey.deserialize(key); fail("InvalidParameterKeyException should have been raised"); }
Source:
public boolean equals(Object object) { boolean result; if (this == object) { result = true; } else { if ((object == null) || (object.getClass() != this.getClass())) { result = false; } else { SyntaxType syntaxType = (SyntaxType) object; result = (getId() == syntaxType.getId() || getId() != null && getId().equals(syntaxType.getId())); } } return result; }

Target:
public boolean equals(Object object) { boolean result; if (this == object) { result = true; } else { if ((object == null) || (object.getClass() != this.getClass())) { result = false; } else { SyntaxType syntaxType = (SyntaxType) object; result = getId() == syntaxType.getId() || (getId() != null && getId().equals(syntaxType.getId())); } } return result; }
Source:
public static List<Setting<?>> optionalSettings() { return List.of(Repository.ACCOUNT_SETTING, Repository.KEY_SETTING, Repository.CONTAINER_SETTING, Repository.BASE_PATH_SETTING, Repository.CHUNK_SIZE_SETTING, COMPRESS_SETTING, Repository.READONLY_SETTING, Repository.LOCATION_MODE_SETTING); }

Target:
public static List<Setting<?>> optionalSettings() { return List.of(Repository.CONTAINER_SETTING, Repository.BASE_PATH_SETTING, Repository.CHUNK_SIZE_SETTING, Repository.READONLY_SETTING, Repository.LOCATION_MODE_SETTING, COMPRESS_SETTING, Repository.MAX_RETRIES_SETTING, Repository.ENDPOINT_SUFFIX_SETTING, Repository.TIMEOUT_SETTING, Repository.PROXY_TYPE_SETTING, Repository.PROXY_HOST_SETTING, Repository.PROXY_PORT_SETTING); }
Source:
public VanillaFoodPantryAddon() { super("vanillafoodpantry"); addNonFoodRecipe(ADDITIONAL_RECIPES); addTool(TOOLS); CookingForBlockheadsAPI.addWaterItem(getModItemStack(FRESH_WATER_ITEM)); CookingForBlockheadsAPI.addMilkItem(getModItemStack(FRESH_MILK_ITEM)); }

Target:
public VanillaFoodPantryAddon() { super("vanillafoodpantry"); addNonFoodRecipe(ADDITIONAL_RECIPES); addWildcardNonFoodRecipe(WILDCARD_RECIPES); addTool(TOOLS); CookingForBlockheadsAPI.addWaterItem(getModItemStack(FRESH_WATER_ITEM)); CookingForBlockheadsAPI.addMilkItem(getModItemStack(FRESH_MILK_ITEM)); }
Source:
public void testLatitude() { try { String latStr; Double lat; for (int i = 0; i < 100; i++) { latStr = faker.address().latitude(); assertNotNull(latStr); lat = new Double(latStr); assertTrue(lat >= -90 && lat <= 90); } } catch (NumberFormatException e) { fail("Invalid Latitude"); } }

Target:
public void testLatitude() { String latStr; Double lat; for (int i = 0; i < 100; i++) { latStr = faker.address().latitude(); assertThat(latStr, isANumber()); lat = new Double(latStr); assertThat("Latitude is less then -90", lat >= -90); assertThat("Latitude is greater than 90", lat <= 90); } }
Source:
public void updateViewerInput() { if (session != null && treeViewer != null && treeViewer.getTree() != null && !treeViewer.getTree().isDisposed()) { Object[] children = siriusCommonContentModelProvider.getChildren(session); List<Object> childrenList = new ArrayList<>(); Resource sessionResource = session.getSessionResource(); IFile file = WorkspaceSynchronizer.getFile(sessionResource); ProjectDependenciesItem projectDependenciesItem = new NoDynamicProjectDependencies(file.getProject(), session); childrenList.add(projectDependenciesItem); childrenList.addAll(Arrays.asList(children).stream().map(obj -> { Object result = null; if (obj instanceof Resource) { Resource resource = (Resource) obj; URI uri = resource.getURI(); if (uri.toPlatformString(true) != null) { String platformString = uri.toPlatformString(true); IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformString)); if (file.getProject().equals(iFile.getProject())) { result = iFile; } } } return result; }).filter(obj -> obj != null).collect(Collectors.toList())); List<Object> directChildOfProjectDependency = Arrays.asList(siriusCommonContentModelProvider.getChildren(projectDependenciesItem)); treeViewer.setInput(childrenList.stream().filter(input -> !(input instanceof ViewpointsFolderItemImpl) && !directChildOfProjectDependency.contains(input)).collect(Collectors.toList())); treeViewer.expandToLevel(2); treeViewer.expandToLevel(projectDependenciesItem, 2); } }

Target:
public void updateViewerInput() { if (session != null && treeViewer != null && treeViewer.getTree() != null && !treeViewer.getTree().isDisposed()) { Object[] children = siriusCommonContentModelProvider.getChildren(session); List<Object> childrenList = new ArrayList<>(); Resource sessionResource = session.getSessionResource(); IFile file = WorkspaceSynchronizer.getFile(sessionResource); ProjectDependenciesItem projectDependenciesItem = new NoDynamicProjectDependencies(file.getProject(), session); childrenList.add(projectDependenciesItem); childrenList.addAll(Arrays.asList(children).stream().map(obj -> { Object result = null; if (obj instanceof Resource) { Resource resource = (Resource) obj; URI uri = resource.getURI(); String platformString = uri.toPlatformString(true); if (platformString != null) { IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformString)); if (file.getProject().equals(iFile.getProject())) { result = iFile; } } } return result; }).filter(obj -> obj != null).collect(Collectors.toList())); List<Object> directChildOfProjectDependency = Arrays.asList(siriusCommonContentModelProvider.getChildren(projectDependenciesItem)); treeViewer.setInput(childrenList.stream().filter(input -> !(input instanceof ViewpointsFolderItemImpl) && !directChildOfProjectDependency.contains(input)).collect(Collectors.toList())); treeViewer.expandToLevel(2); treeViewer.expandToLevel(projectDependenciesItem, 2); } }
Source:
public void testCreatePatientPostActionParameter() throws InterruptedException { TaskTriggerInformation triggerInformation = new TaskTriggerInformation("CREATE SettingsRecord", "data-services", MDS_CHANNEL_NAME, VERSION, TRIGGER_SUBJECT, TRIGGER_SUBJECT); SortedSet<TaskConfigStep> taskConfigStepSortedSet = new TreeSet<>(); taskConfigStepSortedSet.add(createPatientDataSource()); TaskConfig taskConfig = new TaskConfig(); taskConfig.addAll(taskConfigStepSortedSet); ArrayList<TaskActionInformation> taskActions = new ArrayList(); taskActions.add(prepareCreatePatientActionInformation("Slowackiego 15/2", "Jan Nowak")); taskActions.add(prepareCreatePatientActionInformation("{{pa.0.uuid}}", "Robert Kowalski")); Task task = new Task("OpenMRSPatientPostActionParameterTestTask", triggerInformation, taskActions, taskConfig, true, true); getTaskService().save(task); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); activateTrigger(); assertTrue(waitForTaskExecution(task.getId())); Patient patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "Jan Nowak"); String firstPatientUuid = patient.getUuid(); patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "Robert Kowalski"); Person.Address address = patient.getPerson().getPreferredAddress(); assertEquals(firstPatientUuid, address.getAddress1()); }

Target:
public void testCreatePatientPostActionParameter() throws InterruptedException { Task task = prepareCreatePatientPostActionParameterTask(); getTriggerHandler().registerHandlerFor(task.getTrigger().getEffectiveListenerSubject()); activateTrigger(); assertTrue(waitForTaskExecution(task.getId())); Patient patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "John Smith"); String firstPatientUuid = patient.getUuid(); patient = patientService.getPatientByMotechId(DEFAULT_CONFIG_NAME, "Jacob Lee"); Person.Address address = patient.getPerson().getPreferredAddress(); assertEquals(firstPatientUuid, address.getAddress1()); }
Source:
public String toString() { StringBuilder builder = new StringBuilder("{"); for (Map.Entry<String, Object> entry : this.entrySet()) { if (builder.length() > 2) { builder.append(","); } String key = entry.getKey(); Object value = entry.getValue(); builder.append(" \"" + key + "\""); builder.append(" : "); if (value.getClass().equals(String.class)) { builder.append("\"" + (String) value + "\" "); } else if (value.getClass().equals(Long.class)) { builder.append((Long) value + " "); } else { builder.append(value.toString() + " "); } } builder.append("}"); return builder.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder("{"); for (Map.Entry<String, Object> entry : this.entrySet()) { appendEntry(entry, builder); } builder.append("}"); return builder.toString(); }
Source:
public void testTouchCorrectionWithTooBigDelayBeforeUP() { long invalidTimestamp = 220; triggerTouchDownEvent(initalPositionX, initalPositionY); triggerMovementEvent(firstMovementTimestamp, firstMovementPositionX, firstMovementPositionY); triggerMovementEvent(secondMovementTimestamp, secondMovementPositionX, firstMovementPositionY); triggerTouchUpEvent(invalidTimestamp); verify(imageView, times(2)).setX(anyFloat()); }

Target:
public void testTouchCorrectionWithTooBigDelayBeforeUP() { long muchLaterTimestamp = 220; triggerTouchDownEvent(initalPositionX, initalPositionY); triggerMovementEvent(firstMovementTimestamp, firstMovementPositionX, firstMovementPositionY); verify(imageView, times(1)).setX(firstMovementPositionX); triggerMovementEvent(secondMovementTimestamp, secondMovementPositionX, secondMovementPositionY); verify(imageView, times(1)).setX(secondMovementPositionX); triggerTouchUpEvent(muchLaterTimestamp); verify(imageView, times(1)).setX(actionUpMovementPositionX); verify(imageView, times(3)).setX(anyFloat()); }
Source:
public HandlerRegistration addValueChangeHandler(final ValueChangeHandler<T> handler) { return asSuggestBox().addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { T value = wrap(event.getValue()); if (value != null) { handler.onValueChange(new ValueChangeEvent<T>(wrap(event.getValue())) { }); } } }); }

Target:
public HandlerRegistration addValueChangeHandler(final ValueChangeHandler<T> handler) { return asSuggestBox().addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { T value = asEntity(event.getValue()); if (value != null) { handler.onValueChange(new ValueChangeEvent<T>(value) { }); } } }); }
Source:
public boolean associate(HttpServletRequest request) { BoundBeanStore beanStore = getBeanStore(); if (beanStore != null) { ContextLogger.LOG.beanStoreLeakDuringAssociation(this.getClass().getName(), request); ContextLogger.LOG.beanStoreLeakAffectedBeanIdentifiers(this.getClass().getName(), Iterables.toMultiRowString(beanStore)); } beanStore = new RequestBeanStore(request, namingScheme); setBeanStore(beanStore); beanStore.attach(); return true; }

Target:
public boolean associate(HttpServletRequest request) { BoundBeanStore beanStore = getBeanStore(); if (beanStore != null) { ContextLogger.LOG.beanStoreLeakDuringAssociation(this.getClass().getName(), request); if (ContextLogger.LOG.isDebugEnabled()) { ContextLogger.LOG.beanStoreLeakAffectedBeanIdentifiers(this.getClass().getName(), Iterables.toMultiRowString(beanStore)); } } beanStore = new RequestBeanStore(request, namingScheme); setBeanStore(beanStore); beanStore.attach(); return true; }
Source:
public void addChangeListener_null() { try { collection.addChangeListener((RealmChangeListener)null); fail(); } catch (IllegalArgumentException ignored) { } }

Target:
public void addChangeListener_null() { try { collection.addChangeListener((RealmChangeListener<RealmResults<AllTypes>>) null); fail(); } catch (IllegalArgumentException ignored) { } }
Source:
private void populateDatastreamDestinationFromExistingDatastream(Datastream datastream, Datastream existingStream) { DatastreamDestination destination = existingStream.getDestination(); LOG.info(String.format("Datastream %s has same source as existing datastream, Setting the destination %s", datastream.getName(), destination)); datastream.setDestination(destination); if (existingStream.getMetadata().containsKey(DatastreamMetadataConstants.DESTINATION_CREATION_MS)) { datastream.getMetadata() .put(DatastreamMetadataConstants.DESTINATION_CREATION_MS, existingStream.getMetadata().get(DatastreamMetadataConstants.DESTINATION_CREATION_MS)); } if (existingStream.getMetadata().containsKey(DatastreamMetadataConstants.DESTINATION_RETENION_MS)) { datastream.getMetadata() .put(DatastreamMetadataConstants.DESTINATION_RETENION_MS, existingStream.getMetadata().get(DatastreamMetadataConstants.DESTINATION_RETENION_MS)); } }

Target:
private void populateDatastreamDestinationFromExistingDatastream(Datastream datastream, Datastream existingStream) { DatastreamDestination destination = existingStream.getDestination(); datastream.setDestination(destination); if (existingStream.getMetadata().containsKey(DatastreamMetadataConstants.DESTINATION_CREATION_MS)) { datastream.getMetadata() .put(DatastreamMetadataConstants.DESTINATION_CREATION_MS, existingStream.getMetadata().get(DatastreamMetadataConstants.DESTINATION_CREATION_MS)); } if (existingStream.getMetadata().containsKey(DatastreamMetadataConstants.DESTINATION_RETENION_MS)) { datastream.getMetadata() .put(DatastreamMetadataConstants.DESTINATION_RETENION_MS, existingStream.getMetadata().get(DatastreamMetadataConstants.DESTINATION_RETENION_MS)); } }