auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean validate() { getNetwork().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); getBond().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH), new BondNameValidation() }); getAddress().setIsValid(true); getSubnet().setIsValid(true); getGateway().setIsValid(true); if (getIsStaticAddress()) { getAddress().validateEntity(new IValidation[] { new NotEmptyValidation(), new IpAddressValidation() }); getSubnet().validateEntity(new IValidation[] { new NotEmptyValidation(), new SubnetMaskValidation() }); getGateway().validateEntity(new IValidation[] { new NotEmptyValidation(), new IpAddressValidation() }); } if (getBondingOptions().getSelectedItem().getKey().equals("custom")) { getCustomEditor().validateEntity(new IValidation[] { new NotEmptyValidation() }); } return getBond().getIsValid() && getNetwork().getIsValid() && getAddress().getIsValid() && getSubnet().getIsValid() && getGateway().getIsValid() && getCustomEditor().getIsValid(); }

Target:
public boolean validate() { getNetwork().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); getBond().validateSelectedItem(new IValidation[] { new NotEmptyValidation(), new LengthValidation(BusinessEntitiesDefinitions.HOST_NIC_NAME_LENGTH), new BondNameValidation() }); getAddress().setIsValid(true); getSubnet().setIsValid(true); getGateway().setIsValid(true); if (getIsStaticAddress()) { getAddress().validateEntity(new IValidation[] { new NotEmptyValidation(), new IpAddressValidation() }); getSubnet().validateEntity(new IValidation[] { new NotEmptyValidation(), new SubnetMaskValidation() }); getGateway().validateEntity(new IValidation[] { new NotEmptyValidation(), new IpAddressValidation() }); } if (getBondingOptions().getSelectedItem().getKey().equals(CUSTOM_BONDING_MODE)) { getCustomBondMode().validateEntity(new IValidation[] { new NotEmptyValidation() }); } return getBond().getIsValid() && getNetwork().getIsValid() && getAddress().getIsValid() && getSubnet().getIsValid() && getGateway().getIsValid() && getCustomBondMode().getIsValid(); }
Source:
public void before() throws TmfTraceException { fBot = new SWTWorkbenchBot(); fBot.closeAllEditors(); for (SWTBotView viewBot : fBot.views()) { viewBot.close(); } fTrace = new TmfTraceStub() { @Override public @NonNull String getName() { return "Stub"; } @Override public TmfContext seekEvent(ITmfLocation location) { return new TmfContext(); } }; fTrace.setStartTime(TmfTimestamp.fromNanos(0)); fTrace.setEndTime(TmfTimestamp.fromNanos(180)); TmfTraceStub trace = fTrace; trace.initialize(null, "", ITmfEvent.class); assertNotNull(trace); TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null)); SWTBotUtils.openView(XYChartViewStub.ID); fViewBot = fBot.viewById(XYChartViewStub.ID); fViewBot.show(); IViewPart viewSite = fViewBot.getViewReference().getView(true); fXyViewer = getChartViewer(viewSite); fViewBot.bot().waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return fXyViewer.getSwtChart() != null; } @Override public String getFailureMessage() { return "SWT Chart is null"; } }); resetTimeRange(); }

Target:
public void before() throws TmfTraceException { fBot = new SWTWorkbenchBot(); fBot.closeAllEditors(); for (SWTBotView viewBot : fBot.views()) { viewBot.close(); } fTrace = new TmfTraceStub() { @Override public @NonNull String getName() { return "Stub"; } @Override public TmfContext seekEvent(ITmfLocation location) { return new TmfContext(); } }; fTrace.setStartTime(TmfTimestamp.fromNanos(0)); fTrace.setEndTime(TmfTimestamp.fromNanos(180)); TmfTraceStub trace = fTrace; trace.initialize(null, "", ITmfEvent.class); assertNotNull(trace); UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null))); SWTBotUtils.openView(XYChartViewStub.ID); fViewBot = fBot.viewById(XYChartViewStub.ID); fViewBot.show(); IViewPart viewSite = fViewBot.getViewReference().getView(true); fXyViewer = getChartViewer(viewSite); fViewBot.bot().waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return fXyViewer.getSwtChart() != null; } @Override public String getFailureMessage() { return "SWT Chart is null"; } }); resetTimeRange(); }
Source:
protected void onInit() { super.onInit(); if (this.streamReceiverOptions != null) { this.streamReceiver = StreamReceiver.create(this.reactiveConnectionFactory, this.streamReceiverOptions); } else { this.streamReceiver = StreamReceiver.create(this.reactiveConnectionFactory); } this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); }

Target:
protected void onInit() { super.onInit(); this.streamReceiver = StreamReceiver.create(this.reactiveConnectionFactory, this.streamReceiverOptions); if (StringUtils.hasText(this.consumerName) && StringUtils.isEmpty(this.consumerGroup)) { this.consumerGroup = getBeanName(); } this.reactiveRedisTemplate = new ReactiveRedisTemplate<>(this.reactiveConnectionFactory, RedisSerializationContext.string()); this.reactiveStreamOperations = this.reactiveRedisTemplate.opsForStream(); }
Source:
public synchronized boolean start() { if (!started.get()) { started.set(loadingLookup.isOpen()); LOGGER.info("starting loading lookup [%s]", id); } return started.get(); }

Target:
public synchronized boolean start() { if (!started.get()) { started.set(loadingLookup.isOpen()); LOGGER.info("created loading lookup with id [%s]", id); } return started.get(); }
Source:
public <T extends Closeable> Mono<T> bind(ServerTransport<T> transport) { return Mono.defer( new Supplier<Mono<T>>() { ServerSetup serverSetup = serverSetup(); @Override public Mono<T> get() { return Mono.just(transport) .flatMap( transport -> transport.start( duplexConnection -> acceptor(serverSetup, duplexConnection), mtu)) .doOnNext(c -> c.onClose().doFinally(v -> serverSetup.dispose()).subscribe()); } }); }

Target:
public <T extends Closeable> Mono<T> bind(ServerTransport<T> transport) { return Mono.defer( new Supplier<Mono<T>>() { ServerSetup serverSetup = serverSetup(); @Override public Mono<T> get() { return transport .start(duplexConnection -> acceptor(serverSetup, duplexConnection), mtu) .doOnNext(c -> c.onClose().doFinally(v -> serverSetup.dispose()).subscribe()); } }); }
Source:
private TypeMirror getUnwrappedType(TypeMirror type) { Optional<TypeMirror> optional = constraintHelper.getUnwrappedToByDefault( getQualifiedName( type ) ); if ( optional.isPresent() ) { return optional.get(); } else { return type; } }

Target:
private Optional<TypeMirror> getUnwrappedType(TypeMirror type) { return constraintHelper.getUnwrappedToByDefault( getQualifiedName( type ) ); }
Source:
public ResponseEntity<FileSystemResource> getTemplate(@PathVariable final String cropName) { final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); final List<VariableDetails> units = this.variableService.getVariablesByFilter(variableFilter); Set<Integer> locationTypes =new HashSet<>(); locationTypes.add(1500); final List<LocationDto> locations = locationService.getLocations(locationTypes, null, false, null); final File file = this.lotExcelTemplateExportServiceImpl.export(locations, units); final HttpHeaders headers = new HttpHeaders(); headers .add(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s", FileUtils.sanitizeFileName(file.getName()))); final FileSystemResource fileSystemResource = new FileSystemResource(file); return new ResponseEntity<>(fileSystemResource, headers, HttpStatus.OK); }

Target:
public ResponseEntity<FileSystemResource> getTemplate(@PathVariable final String cropName) { final VariableFilter variableFilter = new VariableFilter(); variableFilter.addPropertyId(TermId.INVENTORY_AMOUNT_PROPERTY.getId()); final List<VariableDetails> units = this.variableService.getVariablesByFilter(variableFilter); final List<LocationDto> locations = locationService.getLocations(LotResource.STORAGE_LOCATION_TYPE, null, false, null); final File file = this.lotTemplateExportServiceImpl.export(locations, units); final HttpHeaders headers = new HttpHeaders(); headers .add(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s", FileUtils.sanitizeFileName(file.getName()))); final FileSystemResource fileSystemResource = new FileSystemResource(file); return new ResponseEntity<>(fileSystemResource, headers, HttpStatus.OK); }
Source:
public static ArrayList<String> teamKeys(JsonArray teamsJson) { ArrayList<String> teamKeys = new ArrayList<>(); for (int i = 0; i < teamsJson.size(); i++) { teamKeys.add(teamsJson.get(i).getAsString()); } return teamKeys; }

Target:
public static ArrayList<String> teamKeys(JsonArray teamsJson) { ArrayList<String> teamKeys = new ArrayList<>(teamsJson.size()); for (JsonElement key : teamsJson) { teamKeys.add(key.getAsString()); } return teamKeys; }
Source:
private boolean validateCommit(byte[] commit) { boolean returnValue = true; for (int offset = 0; returnValue && offset < commit.length; offset++) { int lineEnd = 0; for (lineEnd = offset; lineEnd < commit.length && commit[lineEnd] != '\n'; lineEnd++); switch (commit[offset]) { case 'a': case 'c': returnValue = validateLine(commit, offset, lineEnd); break; case 't': case 'p': break; default: return returnValue; } offset = lineEnd; } return returnValue; }

Target:
private boolean validateCommit(byte[] commit) { boolean returnValue = true; for (int offset = 0; returnValue && offset < commit.length; offset++) { int lineEnd = 0; for (lineEnd = offset; lineEnd < commit.length && commit[lineEnd] != '\n'; lineEnd++) {}; switch (commit[offset]) { case 'a': case 'c': returnValue = validateLine(commit, offset, lineEnd); break; case 't': case 'p': break; default: return returnValue; } offset = lineEnd; } return returnValue; }
Source:
public void testHttpIngestionPartialInvalidCollectionTime() throws Exception { String postfix = getPostfix(); long validTime = System.currentTimeMillis(); long pastTime = System.currentTimeMillis() - TIME_DIFF_MS - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); long futureTime = System.currentTimeMillis() + TIME_DIFF_MS + Configuration.getInstance().getLongProperty( CoreConfig.AFTER_CURRENT_COLLECTIONTIME_MS ); String jsonBody = getJsonFromFile("sample_multi_partial_invalid_payload.json", postfix); jsonBody = updateTimeStampJson(jsonBody, "\"%TIMESTAMP%\"", validTime); jsonBody = updateTimeStampJson(jsonBody, "\"%PAST_TIMESTAMP%\"", pastTime); jsonBody = updateTimeStampJson(jsonBody, "\"%FUTURE_TIMESTAMP%\"", futureTime); jsonBody = jsonBody.replaceAll("%TENANT_ID_.%", TID); HttpResponse response = httpPost( TID, postMultiPath, jsonBody ); String[] output = getBodyArray( response ); try { assertEquals("Should get status 207 from ingestion server for POST with invalid collectionTime", 207, response.getStatusLine().getStatusCode() ); assertEquals( 4, output.length ); assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 1 ] ) ); assertTrue( Pattern.matches( PAST_COLLECTION_TIME_REGEX, output[ 2 ] ) ); assertTrue( Pattern.matches( FUTURE_COLLECTION_TIME_REGEX, output[ 3 ] ) ); } finally { EntityUtils.consume( response.getEntity() ); } }

Target:
public void testHttpIngestionPartialInvalidCollectionTime() throws Exception { String postfix = getPostfix(); long validTime = System.currentTimeMillis(); long pastTime = System.currentTimeMillis() - TIME_DIFF_MS - Configuration.getInstance().getLongProperty( CoreConfig.BEFORE_CURRENT_COLLECTIONTIME_MS ); long futureTime = System.currentTimeMillis() + TIME_DIFF_MS + Configuration.getInstance().getLongProperty( CoreConfig.AFTER_CURRENT_COLLECTIONTIME_MS ); String jsonBody = getJsonFromFile("sample_multi_payload_with_different_time.json", postfix); jsonBody = updateTimeStampJson(jsonBody, "\"%TIMESTAMP_1%\"", validTime); jsonBody = updateTimeStampJson(jsonBody, "\"%TIMESTAMP_2%\"", pastTime); jsonBody = updateTimeStampJson(jsonBody, "\"%TIMESTAMP_3%\"", futureTime); jsonBody = jsonBody.replaceAll("%TENANT_ID_.%", TID); HttpResponse response = httpPost( TID, postMultiPath, jsonBody ); String[] output = getBodyArray( response ); try { assertEquals("Should get status 207 from " + String.format(postMultiPath, TID), 207, response.getStatusLine().getStatusCode() ); assertEquals("", output[0]); } finally { EntityUtils.consume( response.getEntity() ); } }
Source:
private static boolean areParametersSame(Method method, Method targetMethod) { Class<?>[] methodTypes = method.getParameterTypes(); Class<?>[] targetMethodTypes = targetMethod.getParameterTypes(); int i = -1; if (methodTypes.length == targetMethodTypes.length) { for (Class<?> clz : methodTypes) { i++; if (clz.equals(targetMethodTypes[i].getClass())) { continue; } else { return false; } } return true; } return false; }

Target:
private static boolean areParametersSame(Method method, Method targetMethod) { Class<?>[] methodTypes = method.getParameterTypes(); Class<?>[] targetMethodTypes = targetMethod.getParameterTypes(); if (methodTypes.length == targetMethodTypes.length) { for (int i = 0; i< methodTypes.length; i++) { if (methodTypes[i].getName().equals(targetMethodTypes[i].getName())) { continue; } else { return false; } } return true; } return false; }
Source:
private static int numericalCompare(String i, String j) { Number number1 = toNumber(i); Number number2 = toNumber(j); if (number1 == null || number2 == null) { return 0; } else if (number1 instanceof Double || number2 instanceof Double || number1 instanceof Float || number2 instanceof Float) { return Double.compare(number1.doubleValue(), number2.doubleValue()); } return Long.compare(number1.longValue(), number2.longValue()); }

Target:
private static int numericalCompare(String i, String j) { Number number1 = toNumber(i); if (number1 == null) { return 0; } Number number2 = toNumber(j); if (number2 == null) { return 0; } else if (number1 instanceof Double || number2 instanceof Double || number1 instanceof Float || number2 instanceof Float) { return Double.compare(number1.doubleValue(), number2.doubleValue()); } return Long.compare(number1.longValue(), number2.longValue()); }
Source:
@Override public boolean equals(Object o) { LinkedList<Object> linkedList = new LinkedList<Object>(); linkedList.add(o); return validate().litems.equals(linkedList); }

Target:
@Override public boolean equals(Object o) { return validate().linkedListItems.equals(o); }
Source:
public void setUp() { ReflectionTestUtils.setField(service, "dataBucketName", dataBucketName); ReflectionTestUtils.setField(service, "stateBucketName", stateBucketName); ReflectionTestUtils.setField(service, "dataDir", dataDir); ReflectionTestUtils.setField(service, "bucketPoolSize", 5); ReflectionTestUtils.setField(service, "bucketKeySize", 2); ReflectionTestUtils.setField(service, "expiration", 7); ReflectionTestUtils.setField(service, "urlGenerator", new AmazonURLGenerator()); ReflectionTestUtils.setField(service, "partCalculator", new SimplePartCalculator(20000)); }

Target:
public void setUp() { namingService.setObjectBucketName(objectBucketName); namingService.setStateBucketName(stateBucketName); namingService.setBucketPoolSize(16); namingService.setBucketKeySize(3); service.setBucketNamingService(namingService); ReflectionTestUtils.setField(service, "dataDir", dataDir); ReflectionTestUtils.setField(service, "expiration", 7); ReflectionTestUtils.setField(service, "urlGenerator", new AmazonURLGenerator()); ReflectionTestUtils.setField(service, "partCalculator", new SimplePartCalculator(20000)); }
Source:
private boolean deleteDataSources(Manifest manifest, List<DataSource> dataSources) { final Path dataSourcePath = manifest.getDataSourcePath(); progress.progress(Bundle.DeleteCaseTask_progress_deletingDataSource(dataSourcePath)); logger.log(Level.INFO, String.format("Deleting data source %s from %s", dataSourcePath, caseNodeData.getDisplayName())); Set<Path> filesToDelete = new HashSet<>(); int index = 0; while (index < dataSources.size() && filesToDelete.isEmpty()) { DataSource dataSource = dataSources.get(index); if (dataSource instanceof Image) { Image image = (Image) dataSource; String[] imageFilePaths = image.getPaths(); for (String imageFilePath : imageFilePaths) { Path candidatePath = Paths.get(imageFilePath); if (candidatePath.equals(dataSourcePath)) { for (String path : imageFilePaths) { filesToDelete.add(Paths.get(path)); } break; } } } } filesToDelete.add(dataSourcePath); boolean allFilesDeleted = true; for (Path path : filesToDelete) { File fileOrDir = path.toFile(); if (fileOrDir.exists() && !FileUtil.deleteFileDir(fileOrDir)) { allFilesDeleted = false; logger.log(Level.WARNING, String.format("Failed to delete data source file at %s for %s", path, caseNodeData.getDisplayName())); } } return allFilesDeleted; }

Target:
private boolean deleteDataSources(Manifest manifest, List<DataSource> dataSources) { final Path dataSourcePath = manifest.getDataSourcePath(); progress.progress(Bundle.DeleteCaseTask_progress_deletingDataSource(dataSourcePath)); logger.log(Level.INFO, String.format("Deleting data source %s from %s", dataSourcePath, caseNodeData.getDisplayName())); Set<Path> filesToDelete = new HashSet<>(); int index = 0; while (index < dataSources.size() && filesToDelete.isEmpty()) { DataSource dataSource = dataSources.get(index); if (dataSource instanceof Image) { Image image = (Image) dataSource; String[] imageFilePaths = image.getPaths(); for (String imageFilePath : imageFilePaths) { Path candidatePath = Paths.get(imageFilePath); if (candidatePath.equals(dataSourcePath)) { for (String path : imageFilePaths) { filesToDelete.add(Paths.get(path)); } break; } } } ++index; } filesToDelete.add(dataSourcePath); boolean allFilesDeleted = true; for (Path path : filesToDelete) { File fileOrDir = path.toFile(); if (fileOrDir.exists() && !FileUtil.deleteFileDir(fileOrDir)) { allFilesDeleted = false; logger.log(Level.WARNING, String.format("Failed to delete data source file at %s for %s", path, caseNodeData.getDisplayName())); } } return allFilesDeleted; }
Source:
protected Pair<Integer, Integer> computeStartEnd(int cardinality) { int startIndex = ignoreFirstN; if (previousStop != null && idLookup != null) { int lookupId = idLookup.lookupId(previousStop) + 1; if (lookupId < 0) { lookupId *= -1; } if (lookupId > ignoreFirstN + keepOnlyN) { startIndex = ignoreFirstN + keepOnlyN; } else { startIndex = Math.max(lookupId, startIndex); } } int endIndex = Math.min(ignoreFirstN + keepOnlyN, cardinality); if (ignoreAfterThreshold && query.getDimensionsFilter() == null) { endIndex = Math.min(endIndex, startIndex + query.getThreshold()); } return Pair.of(startIndex, endIndex); }

Target:
protected Pair<Integer, Integer> computeStartEnd(int cardinality) { int startIndex = ignoreFirstN; if (previousStop != null) { if (idLookup == null) { throw new UnsupportedOperationException("Only DimensionSelectors which support idLookup() are supported yet"); } int lookupId = idLookup.lookupId(previousStop) + 1; if (lookupId < 0) { lookupId *= -1; } if (lookupId > ignoreFirstN + keepOnlyN) { startIndex = ignoreFirstN + keepOnlyN; } else { startIndex = Math.max(lookupId, startIndex); } } int endIndex = Math.min(ignoreFirstN + keepOnlyN, cardinality); if (ignoreAfterThreshold && query.getDimensionsFilter() == null) { endIndex = Math.min(endIndex, startIndex + query.getThreshold()); } return Pair.of(startIndex, endIndex); }
Source:
public Transfer buy(Money amount, String paymentMethodId, Boolean commit) throws CoinbaseException, IOException { URL buysUrl; try { buysUrl = new URL(_baseApiUrl, "buys"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } Request request = newAccountSpecificRequest(); request.setQty(amount.getAmount().doubleValue()); request.setPaymentMethodId(paymentMethodId); request.setCurrency(amount.getCurrencyUnit().getCurrencyCode()); if(commit != null) request.setCommit(commit); return post(buysUrl, request, TransferResponse.class).getTransfer(); }

Target:
public Transfer buy(Money amount, String paymentMethodId, Boolean commit) throws CoinbaseException, IOException { URL buysUrl; try { buysUrl = new URL(_baseApiUrl, "buys"); } catch (MalformedURLException ex) { throw new AssertionError(ex); } Request request = newAccountSpecificRequest(); request.setQty(amount.getAmount().doubleValue()); request.setPaymentMethodId(paymentMethodId); request.setCurrency(amount.getCurrencyUnit().getCurrencyCode()); request.setCommit(commit); return post(buysUrl, request, TransferResponse.class).getTransfer(); }
Source:
public IUnitRating getUnitRating() { if(unitRating == null) { UnitRatingMethod method = getCampaignOptions().getUnitRatingMethod(); if (method.equals(UnitRatingMethod.FLD_MAN_MERCS_REV)) { unitRating = new FieldManualMercRevDragoonsRating(this); } else { unitRating = new CampaignOpsReputation(this); } } return unitRating; }

Target:
public IUnitRating getUnitRating() { if(unitRating != null && (unitRating.getUnitRatingMethod() != getCampaignOptions().getUnitRatingMethod())) { unitRating = null; } if(unitRating == null) { UnitRatingMethod method = getCampaignOptions().getUnitRatingMethod(); if (UnitRatingMethod.FLD_MAN_MERCS_REV.equals(method)) { unitRating = new FieldManualMercRevDragoonsRating(this); } else { unitRating = new CampaignOpsReputation(this); } } return unitRating; }
Source:
public Iterator<V2> iterator() { return new Iterator<V2>(){ Iterator<V1> backing = original.iterator(); int cursor; @Override public boolean hasNext() { return cursor <= size(); } @Override public V2 next() { V1 backingNext = backing.next(); cursor += 1; return function.apply(backingNext); } }; }

Target:
public Iterator<V2> iterator() { return new Iterator<V2>(){ Iterator<V1> backing = original.iterator(); @Override public boolean hasNext() { return backing.hasNext(); } @Override public V2 next() { V1 backingNext = backing.next(); return function.apply(backingNext); } }; }
Source:
public static StatementInfo fromJson(String json) { String right_json = ""; try { gson.fromJson(json, StatementInfo.class); right_json = json; } catch (Exception e) { if (json.contains("\"traceback\":{}")) { LOGGER.info("traceback type mismatch, replacing the mismatching part "); right_json = json.replace("\"traceback\":{}", "\"traceback\":[]"); LOGGER.info("new json string is {}", right_json); } } return gson.fromJson(right_json, StatementInfo.class); }

Target:
public static StatementInfo fromJson(String json) { String right_json = ""; try { gson.fromJson(json, StatementInfo.class); right_json = json; } catch (Exception e) { if (json.contains("\"traceback\":{}")) { LOGGER.debug("traceback type mismatch, replacing the mismatching part "); right_json = json.replace("\"traceback\":{}", "\"traceback\":[]"); LOGGER.debug("new json string is {}", right_json); } } return gson.fromJson(right_json, StatementInfo.class); }
Source:
public static CommandResult processed() { return new CommandResultBuilder().processed(true).build(); }

Target:
public static CommandResult processed() { return PROCESSED; }
Source:
protected boolean useDirectReplyTo() { if (Address.TEMPORARY_REPLY_QUEUE_TOKEN.equals(this.replyAddress)) { return false; } if (this.replyAddress == null || Address.AMQ_RABBITMQ_REPLY_TO.equals(this.replyAddress)) { try { execute(new ChannelCallback<Void>() { @Override public Void doInRabbit(Channel channel) throws Exception { channel.queueDeclarePassive(Address.AMQ_RABBITMQ_REPLY_TO); return null; } }); return true; } catch (Exception e) { if (this.replyAddress != null) { logger.error("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " + "queues will be used:" + e.getMessage() + "."); } else { if (logger.isDebugEnabled()) { logger.debug("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " + "queues will be used:" + e.getMessage() + "."); } } this.replyAddress = null; } } return false; }

Target:
protected boolean useDirectReplyTo() { if (this.useTemporaryReplyQueues) { if (this.replyAddress != null) { logger.error("'useTemporaryReplyQueues' is ignored when a 'replyAddress' is provided"); } else { return false; } } if (this.replyAddress == null || Address.AMQ_RABBITMQ_REPLY_TO.equals(this.replyAddress)) { try { execute(new ChannelCallback<Void>() { @Override public Void doInRabbit(Channel channel) throws Exception { channel.queueDeclarePassive(Address.AMQ_RABBITMQ_REPLY_TO); return null; } }); return true; } catch (Exception e) { if (this.replyAddress != null) { logger.error("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " + "queues will be used:" + e.getMessage() + "."); } else { if (logger.isDebugEnabled()) { logger.debug("Broker does not support fast replies via 'amq.rabbitmq.reply-to', temporary " + "queues will be used:" + e.getMessage() + "."); } } this.replyAddress = null; } } return false; }
Source:
public int getRenderState() { int state = speed.ordinal(); if (getReverse()) state = 14; if (isPowered()) { if (getReverse()) state += 1; else state += 7; } return state; }

Target:
public int getRenderState() { int state = speed.ordinal(); if (getReverse()) state = 4; if (isPowered()) state += 5; return state; }
Source:
public String getClientPackageElementName(String packageElementName) { { if (packageElementName.matches(".*client$")) { return packageElementName; } String[] packageUnits = packageElementName.split("\\."); String parentPackageElementName = ""; for (int i = 0; i < packageUnits.length - 1; i++) { parentPackageElementName += packageUnits[i]; if (i < packageUnits.length - 2) { parentPackageElementName += "."; } if (packageUnits[i].equals("client")) { break; } } if (parentPackageElementName.matches(".*\\.$")) { parentPackageElementName = parentPackageElementName.replaceAll("\\.$", ""); } return parentPackageElementName; } }

Target:
public String getClientPackageElementName(String packageElementName) { if (packageElementName.matches(".*client$")) { return packageElementName; } String[] packageUnits = packageElementName.split("\\."); String parentPackageElementName = ""; for (int i = 0; i < packageUnits.length - 1; i++) { parentPackageElementName += packageUnits[i]; if (i < packageUnits.length - 2) { parentPackageElementName += "."; } if (packageUnits[i].equals("client")) { break; } } if (parentPackageElementName.matches(".*\\.$")) { parentPackageElementName = parentPackageElementName.replaceAll("\\.$", ""); } return parentPackageElementName; }
Source:
public void setUpLanguageScrollTabData(List<String> languageCodes, Callback callback, int position) { this.callback = callback; this.languagecodes = languageCodes; for (int i = 0; i < languageCodes.size(); i++) { TabLayout.Tab tab = horizontalLanguageScroll.newTab(); horizontalLanguageScroll.addTab(tab); horizontalLanguageScroll.getTabAt(i).setCustomView(createLanguageTab(languageCodes.get(i))); } selectLanguageTab(position); }

Target:
public void setUpLanguageScrollTabData(List<String> languageCodes, Callback callback, int position) { if (this.callback != null) { this.callback = null; } if (horizontalLanguageScroll.getChildCount() > 0) { horizontalLanguageScroll.removeAllTabs(); } this.callback = callback; this.languagecodes = languageCodes; for (int i = 0; i < languageCodes.size(); i++) { TabLayout.Tab tab = horizontalLanguageScroll.newTab(); tab.setCustomView(createLanguageTab(languageCodes.get(i))); horizontalLanguageScroll.addTab(tab); updateTabView(false, tab); } selectLanguageTab(position); }
Source:
public void write(CommandId id, CommandStorageRecord record) { checkNotNull(id); checkNotDefault(id); checkNotNull(record); final String commandId = record.getCommandId(); checkNotEmptyOrBlank(commandId, "Command ID"); put(id, record); }

Target:
public void write(CommandId id, CommandStorageRecord record) { checkNotClosed(); checkNotDefault(id); checkNotDefault(record); final String commandId = record.getCommandId(); checkNotEmptyOrBlank(commandId, "Command ID"); put(id, record); }
Source:
public VdcActionParametersBase(String engineSessionId) { shouldbelogged = true; transctionOption = TransactionScopeOption.Required; setTaskGroupSuccess(true); setParentCommand(VdcActionType.Unknown); executionReason = CommandExecutionReason.REGULAR_FLOW; compensationEnabled = false; parentCommand = VdcActionType.Unknown; commandType = VdcActionType.Unknown; imagesParameters = new ArrayList<VdcActionParametersBase>(); sessionid = engineSessionId; }

Target:
public VdcActionParametersBase(String engineSessionId) { this(); sessionid = engineSessionId; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request instanceof HttpServletRequest) { HttpServletRequest httpServletRequest = (HttpServletRequest) request; String language = httpServletRequest.getHeader("Accept-Language"); if (language != null) { if (!requestsByLanguage.containsKey(language)) { requestsByLanguage.put(language, new MutableLong(0)); } requestsByLanguage.get(language).increment(); } } chain.doFilter(request, response); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (request instanceof HttpServletRequest && !Telemetry.isDisabled()) { HttpServletRequest httpServletRequest = (HttpServletRequest) request; String language = httpServletRequest.getHeader("Accept-Language"); if (language != null) { if (!requestsByLanguage.containsKey(language)) { requestsByLanguage.put(language, new AtomicLong(0)); } requestsByLanguage.get(language).incrementAndGet(); } } chain.doFilter(request, response); }
Source:
protected void onUnload() { super.onUnload(); $(listBox.getElement()).material_select("destroy"); }

Target:
protected void onUnload() { super.onUnload(); $(listBox.getElement()).off("change"); $(listBox.getElement()).material_select("destroy"); }
Source:
public <T> FieldProjectionBuilder<T> createFieldValueProjectionBuilder(String absoluteFieldPath, Class<T> expectedType, ProjectionConverter projectionConverter) { checkProjectable( absoluteFieldPath, projectable ); if ( projectionConverter.isEnabled() && !converter.isConvertedTypeAssignableTo( expectedType ) ) { throw log.invalidProjectionInvalidType( absoluteFieldPath, expectedType, EventContexts.fromIndexFieldAbsolutePath( absoluteFieldPath ) ); } return (FieldProjectionBuilder<T>) new ElasticsearchFieldProjectionBuilder<>( absoluteFieldPath, getConverter( projectionConverter ), codec ); }

Target:
public <T> FieldProjectionBuilder<T> createFieldValueProjectionBuilder(String absoluteFieldPath, Class<T> expectedType, ProjectionConverter projectionConverter) { checkProjectable( absoluteFieldPath, projectable ); FromDocumentFieldValueConverter<? super F, ?> requestConverter = getConverter( projectionConverter ); if ( !requestConverter.isConvertedTypeAssignableTo( expectedType ) ) { throw log.invalidProjectionInvalidType( absoluteFieldPath, expectedType, EventContexts.fromIndexFieldAbsolutePath( absoluteFieldPath ) ); } return (FieldProjectionBuilder<T>) new ElasticsearchFieldProjectionBuilder<>( absoluteFieldPath, requestConverter, codec ); }
Source:
public ByteBuffer sliceAsByteBuffer(int index, int length) { if (base != null) { return ByteBuffer.wrap((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length); } else { assert (!isUniversalBuffer); return DirectBufferAccess.newByteBuffer(address, index, length, reference); } }

Target:
public ByteBuffer sliceAsByteBuffer(int index, int length) { if (hasArray()) { return ByteBuffer.wrap((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length); } else { assert (!isUniversalBuffer); return DirectBufferAccess.newByteBuffer(address, index, length, reference); } }
Source:
public void init() throws IOException { kafkaConfig.put(ConsumerConfig.GROUP_ID_CONFIG, minionIdentity.getLocation()); kafkaConfig.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true"); kafkaConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getCanonicalName()); kafkaConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getCanonicalName()); kafkaConfig.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000"); kafkaConfig.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); kafkaConfig.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getCanonicalName()); kafkaConfig.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class.getCanonicalName()); kafkaConfig.putAll(kafkaConfigProvider.getProperties()); LOG.info("initializing the Kafka producer with: {}", kafkaConfig); producer = Utils.runWithGivenClassLoader(() -> new KafkaProducer<String, byte[]>(kafkaConfig), KafkaProducer.class.getClassLoader()); maxBufferSize = KafkaRpcConstants.getMaxBufferSize(kafkaConfig); delayQueueExecutor.execute(() -> { while(true) { try { rpcIdQueue.take(); } catch (InterruptedException e) { LOG.error("Delay Queue has been interrupted ", e); break; } } }); }

Target:
public void init() throws IOException { kafkaConfig.put(ConsumerConfig.GROUP_ID_CONFIG, minionIdentity.getLocation()); kafkaConfig.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, "true"); kafkaConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getCanonicalName()); kafkaConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getCanonicalName()); kafkaConfig.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, "1000"); kafkaConfig.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); kafkaConfig.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getCanonicalName()); kafkaConfig.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class.getCanonicalName()); kafkaConfig.putAll(kafkaConfigProvider.getProperties()); LOG.info("initializing the Kafka producer with: {}", kafkaConfig); producer = Utils.runWithGivenClassLoader(() -> new KafkaProducer<String, byte[]>(kafkaConfig), KafkaProducer.class.getClassLoader()); maxBufferSize = KafkaRpcConstants.getMaxBufferSize(kafkaConfig); delayQueueExecutor.execute(() -> { while(true) { try { RpcId rpcId = rpcIdQueue.take(); messageCache.remove(rpcId.getRpcId()); } catch (InterruptedException e) { LOG.error("Delay Queue has been interrupted ", e); break; } } }); }
Source:
public Map<TaskName, Set<SystemStreamPartition>> group(Set<SystemStreamPartition> ssps) { Map<TaskName, Set<SystemStreamPartition>> groupedMap = new HashMap<>(); for (SystemStreamPartition ssp : ssps) { if (broadcastSystemStreamPartitions.contains(ssp)) { continue; } TaskName taskName = new TaskName(String.format("Partition %d", ssp.getPartition().getPartitionId())); if (!groupedMap.containsKey(taskName)) { groupedMap.put(taskName, new HashSet<>()); } groupedMap.get(taskName).add(ssp); } if (!broadcastSystemStreamPartitions.isEmpty()) { for (Set<SystemStreamPartition> value : groupedMap.values()) { value.addAll(broadcastSystemStreamPartitions); } } return groupedMap; }

Target:
public Map<TaskName, Set<SystemStreamPartition>> group(Set<SystemStreamPartition> ssps) { Map<TaskName, Set<SystemStreamPartition>> groupedMap = new HashMap<>(); for (SystemStreamPartition ssp : ssps) { if (broadcastStreams.contains(ssp)) { continue; } TaskName taskName = new TaskName(String.format("Partition %d", ssp.getPartition().getPartitionId())); if (!groupedMap.containsKey(taskName)) { groupedMap.put(taskName, new HashSet<>()); } groupedMap.get(taskName).add(ssp); } if (!broadcastStreams.isEmpty()) { for (Set<SystemStreamPartition> value : groupedMap.values()) { value.addAll(broadcastStreams); } } return groupedMap; }
Source:
static void write(ObjectOutput out, Object o) throws IOException { try { Method writeReplace = o.getClass().getDeclaredMethod("writeReplace"); writeReplace.setAccessible(true); SerializedLambda sl = (SerializedLambda) writeReplace.invoke(o); writeSerializedLamda(out, sl); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { throw new MarshallingException(e); } }

Target:
static void write(ObjectOutput out, Object o) throws IOException { try { Method writeReplace = SecurityActions.getMethodAndSetAccessible(o, "writeReplace"); SerializedLambda sl = (SerializedLambda) writeReplace.invoke(o); writeSerializedLambda(out, sl); } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { throw new MarshallingException(e); } }
Source:
public void setValue(ELContext context, Object base, Object property, Object value) { if (base instanceof DocumentModel) { try { super.setValue(context, base, property, value); } catch (PropertyNotFoundException e) { } } else if (base instanceof DocumentPropertyContext) { DocumentPropertyContext ctx = (DocumentPropertyContext) base; value = FieldAdapterManager.getValueForStorage(value); try { ctx.doc.setPropertyValue(getDocumentPropertyName(ctx, property), (Serializable) value); } catch (PropertyException e) { log.warn(e.toString()); } context.setPropertyResolved(true); } else if (base instanceof Property) { try { Property docProperty = (Property) base; Property subProperty = getDocumentProperty(docProperty, property); value = FieldAdapterManager.getValueForStorage(value); subProperty.setValue(value); } catch (PropertyException pe) { try { super.setValue(context, base, property, value); } catch (PropertyNotFoundException e) { log.warn(pe.toString()); } } context.setPropertyResolved(true); } else if (base instanceof Blob) { try { super.setValue(context, base, property, value); } catch (PropertyNotFoundException e) { Blob blob = (Blob) base; if ("name".equals(property)) { value = blob.getFilename(); context.setPropertyResolved(true); } else if ("mime-type".equals(property)) { value = blob.getMimeType(); context.setPropertyResolved(true); } } } }

Target:
public void setValue(ELContext context, Object base, Object property, Object value) { if (base instanceof DocumentModel) { try { super.setValue(context, base, property, value); } catch (PropertyNotFoundException e) { } } else if (base instanceof DocumentPropertyContext) { DocumentPropertyContext ctx = (DocumentPropertyContext) base; value = FieldAdapterManager.getValueForStorage(value); try { ctx.doc.setPropertyValue(getDocumentPropertyName(ctx, property), (Serializable) value); } catch (PropertyException e) { log.warn(e.toString()); } context.setPropertyResolved(true); } else if (base instanceof Property) { try { Property docProperty = (Property) base; Property subProperty = getDocumentProperty(docProperty, property); value = FieldAdapterManager.getValueForStorage(value); subProperty.setValue(value); } catch (PropertyException pe) { try { super.setValue(context, base, property, value); } catch (PropertyNotFoundException e) { log.warn(pe.toString()); } } context.setPropertyResolved(true); } else if (base instanceof Blob) { super.setValue(context, base, getBlobMapping(property), value); } }
Source:
public void patchMultipleOperationsWithFailure() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation0 = new ReplaceOperation("/canLogin", "true"); ops.add(replaceOperation0); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))); ReplaceOperation replaceOperation1 = new ReplaceOperation("/canLogin", "false"); ops.add(replaceOperation1); ReplaceOperation replaceOperation2 = new ReplaceOperation("/certificate", "true"); ops.add(replaceOperation2); ReplaceOperation replaceOperation3 = new ReplaceOperation("/cert", "false"); ops.add(replaceOperation3); ReplaceOperation replaceOperation4 = new ReplaceOperation("/certificate", "false"); ops.add(replaceOperation4); patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isBadRequest()); getClient(token).perform(get("/api/eperson/epersons/" + ePerson.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))); }

Target:
public void patchMultipleOperationsWithFailure() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); String token = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation0 = new ReplaceOperation("/canLogin", true); ops.add(replaceOperation0); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))); ReplaceOperation replaceOperation1 = new ReplaceOperation("/canLogin", false); ops.add(replaceOperation1); ReplaceOperation replaceOperation2 = new ReplaceOperation("/certificate", true); ops.add(replaceOperation2); ReplaceOperation replaceOperation3 = new ReplaceOperation("/nonexistentPath", "somevalue"); ops.add(replaceOperation3); ReplaceOperation replaceOperation4 = new ReplaceOperation("/certificate", false); ops.add(replaceOperation4); patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/eperson/epersons/" + ePerson.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isBadRequest()); getClient(token).perform(get("/api/eperson/epersons/" + ePerson.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.canLogIn", Matchers.is(true))); }
Source:
public void purgeDeletedCertificateWithResponseCodeSnippets() { CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); certificateAsyncClient.purgeDeletedCertificateWithResponse("deletedCertificateName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(purgeResponse -> System.out.printf("Purge Status response %d \n", purgeResponse.getStatusCode())); END: com.azure.security.keyvault.certificates.CertificateAsyncClient.purgeDeletedCertificateWithResponse#string }

Target:
public void purgeDeletedCertificateWithResponseCodeSnippets() { CertificateAsyncClient certificateAsyncClient = getCertificateAsyncClient(); certificateAsyncClient.purgeDeletedCertificateWithResponse("deletedCertificateName") .subscriberContext(Context.of(key1, value1, key2, value2)) .subscribe(purgeResponse -> System.out.printf("Purge Status response %d %n", purgeResponse.getStatusCode())); END: com.azure.security.keyvault.certificates.CertificateAsyncClient.purgeDeletedCertificateWithResponse#string }
Source:
private void stopWriteThread() { mmStoppingThread = Thread.currentThread(); mmWriteThreadRunning = false; synchronized(mmStoppingThread) { try { mmStoppingThread.wait(1000); } catch (InterruptedException e) { } if (mmWriteThread.isAlive()) { Log.w(TAG, "Write thread is still alive..."); } } }

Target:
private void stopWriteThread() { mmStoppingThread = Thread.currentThread(); mmWriteThreadRunning = false; synchronized(mmStoppingThread) { try { int waitTimeInMS = 1000; mmStoppingThread.wait(waitTimeInMS); } catch (InterruptedException e) { } if (mmWriteThread.isAlive()) { Log.w(TAG, "Write thread is still alive..."); } } }
Source:
private BuildResults build( final Project project, final Supplier<BuildResults> buildResultsSupplier ) { try { cache.invalidateCache( project ); final BuildResults results = buildResultsSupplier.get(); StringBuffer message = new StringBuffer(); message.append( "Build of project '" + project.getProjectName() + "' (requested by " + getIdentifier() + ") completed.\n" ); message.append( " Build: " + ( results.getErrorMessages().isEmpty() ? "SUCCESSFUL" : "FAILURE" ) ); BuildMessage infoMsg = new BuildMessage(); infoMsg.setLevel( Level.INFO ); infoMsg.setText( message.toString() ); results.addBuildMessage( 0, infoMsg ); return results; } catch ( Exception e ) { logger.error( e.getMessage(), e ); return buildExceptionResults( e, project.getPom().getGav() ); } }

Target:
private BuildResults build( final Project project, final Supplier<BuildResults> buildResultsSupplier ) { try { cache.invalidateCache( project ); final BuildResults results = buildResultsSupplier.get(); BuildMessage infoMsg = new BuildMessage(); infoMsg.setLevel( Level.INFO ); infoMsg.setText( buildResultMessage( project, results ).toString() ); results.addBuildMessage( 0, infoMsg ); return results; } catch ( Exception e ) { logger.error( e.getMessage(), e ); return buildExceptionResults( e, project.getPom().getGav() ); } }
Source:
public StatusOnlyReturnForXmlRpc snapshot(String vmId, Map<String, String>[] disks, String memory, boolean frozen) { JsonRpcRequest request = new RequestBuilder("VM.snapshot").withParameter("vmID", vmId) .withParameter("snapDrives", new ArrayList<Map<String, String>>(Arrays.asList(disks))) .withParameter("snapMemory", memory) .withParameter("frozen", frozen) .build(); Map<String, Object> response = new FutureMap(this.client, request); return new StatusOnlyReturnForXmlRpc(response); }

Target:
public StatusOnlyReturnForXmlRpc snapshot(String vmId, Map<String, String>[] disks, String memory, boolean frozen) { JsonRpcRequest request = new RequestBuilder("VM.snapshot").withParameter("vmID", vmId) .withParameter("snapDrives", new ArrayList<Map<String, String>>(Arrays.asList(disks))) .withOptionalParameter("snapMemory", memory) .withParameter("frozen", frozen) .build(); Map<String, Object> response = new FutureMap(this.client, request); return new StatusOnlyReturnForXmlRpc(response); }
Source:
C baseApply() { final TreeMap<String, String> t = new TreeMap<String, String>(validate()); if(!children.contains(t)) { C child = newChild(); children.put(t, child); return child; } else return children.get(t); }

Target:
C baseApply() { final TreeMap<String, String> t = new TreeMap<String, String>(validate()); C child = children.get(t); if(child == null) { child = newChild(); children.put(t, child); } return child; }