auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void testReplaceFailedAndDiscardState() throws Exception { <END> new Context() {{ runTest( () -> { leaderCallbackGrantLeadership(); final KubernetesStateHandleStore<Long> store = new KubernetesStateHandleStore<>( flinkKubeClient, LEADER_CONFIGMAP_NAME, longStateStorage, filter, LOCK_IDENTITY); final Long newState = 23456L; store.add(key, state); getLeaderCallback().notLeader(); electionEventHandler.waitForRevokeLeader(TIMEOUT); getLeaderConfigMap().getAnnotations().remove(KubernetesLeaderElector.LEADER_ANNOTATION_KEY); final String resourceVersion = store.exists(key); store.replace(key, resourceVersion, newState); assertThat(store.getAll().size(), is(1)); assertThat(store.get(key).retrieveState(), is(state)); assertThat(longStateStorage.getStateHandles().size(), is(2)); assertThat(longStateStorage.getStateHandles().get(0).getNumberOfDiscardCalls(), is(0)); assertThat(longStateStorage.getStateHandles().get(1).getNumberOfDiscardCalls(), is(1)); }); }}; }</code><technical_language>This test case verifies state is replaced discarded due lost of leadership. need another case verifies state is replaced due failures, testing kube client returns false for checkAndUpdate</technical_language>

Target:
public void testReplaceFailedAndDiscardState() throws Exception { final FlinkRuntimeException updateException = new FlinkRuntimeException("Failed to update"); new Context() {{ runTest( () -> { leaderCallbackGrantLeadership(); final KubernetesStateHandleStore<Long> store = new KubernetesStateHandleStore<>( flinkKubeClient, LEADER_CONFIGMAP_NAME, longStateStorage, filter, LOCK_IDENTITY); store.addAndLock(key, state); final FlinkKubeClient anotherFlinkKubeClient = createFlinkKubeClientBuilder() .setCheckAndUpdateConfigMapFunction((configMapName, function) -> { throw updateException; }).build(); final KubernetesStateHandleStore<Long> anotherStore = new KubernetesStateHandleStore<>( anotherFlinkKubeClient, LEADER_CONFIGMAP_NAME, longStateStorage, filter, LOCK_IDENTITY); final Long newState = 23456L; final StringResourceVersion resourceVersion = anotherStore.exists(key); assertThat(resourceVersion.isExisting(), is(true)); try { anotherStore.replace(key, resourceVersion, newState); fail("We should get an exception when kube client failed to update."); } catch (Exception ex) { assertThat(ex, FlinkMatchers.containsCause(updateException)); } assertThat(anotherStore.getAllAndLock().size(), is(1)); assertThat(anotherStore.getAndLock(key).retrieveState(), is(state)); assertThat(longStateStorage.getStateHandles().size(), is(2)); assertThat(longStateStorage.getStateHandles().get(0).getNumberOfDiscardCalls(), is(0)); assertThat(longStateStorage.getStateHandles().get(1).getNumberOfDiscardCalls(), is(1)); }); }}; }
Source:
<code>private void updateCaret() { <START> if (fSourceViewer == null || fSourceViewer.getTextWidget() == null) <END> return; StyledText styledText= fSourceViewer.getTextWidget(); InsertMode mode= getInsertMode(); styledText.setCaret(null); disposeNonDefaultCaret(); if (getPreferenceStore() == null || !getPreferenceStore().getBoolean(PREFERENCE_USE_CUSTOM_CARETS)) Assert.isTrue(fNonDefaultCaret == null); else if (fIsOverwriting) fNonDefaultCaret= createOverwriteCaret(styledText); else if (SMART_INSERT == mode) fNonDefaultCaret= createInsertCaret(styledText); else if (INSERT == mode) fNonDefaultCaret= createRawInsertModeCaret(styledText); if (fNonDefaultCaret != null) { styledText.setCaret(fNonDefaultCaret); fNonDefaultCaretImage= fNonDefaultCaret.getImage(); } else if (fInitialCaret != styledText.getCaret()) { styledText.setCaret(fInitialCaret); } }</code><technical_language>brackets for single statements in new code</technical_language>

Target:
private void updateCaret() { if (fSourceViewer == null || fSourceViewer.getTextWidget() == null) { return; } StyledText styledText= fSourceViewer.getTextWidget(); InsertMode mode= getInsertMode(); styledText.setCaret(null); disposeNonDefaultCaret(); if (getPreferenceStore() == null || !getPreferenceStore().getBoolean(PREFERENCE_USE_CUSTOM_CARETS)) { Assert.isTrue(fNonDefaultCaret == null); } else if (fIsOverwriting) { fNonDefaultCaret= createOverwriteCaret(styledText); } else if (SMART_INSERT == mode) { fNonDefaultCaret= createInsertCaret(styledText); } else if (INSERT == mode) { fNonDefaultCaret= createRawInsertModeCaret(styledText); } if (fNonDefaultCaret != null) { styledText.setCaret(fNonDefaultCaret); fNonDefaultCaretImage= fNonDefaultCaret.getImage(); } else if (fInitialCaret != styledText.getCaret()) { styledText.setCaret(fInitialCaret); } }
Source:
<code>public void import12BranchHeadTimestampUpdateAfterImporting() { final Branching branches = RepositoryRequests.branching(); final String repositoryId = SnomedDatastoreActivator.REPOSITORY_UUID; final String branchA = "a"; final Branch branchBeforeImport = branches.prepareCreate() .setParent(Branch.MAIN_PATH) .setName(branchA) .build(repositoryId) .execute(getBus()) .getSync(1, TimeUnit.MINUTES); assertEquals("After branch creation timestamps should still be equal", branchBeforeImport.baseTimestamp(), branchBeforeImport.headTimestamp()); importArchive("SnomedCT_Release_INT_20160131_unique_concept.zip", branchBeforeImport.path(), false, Rf2ReleaseType.DELTA.name()); final Branch branchAfterImport = branches.prepareGet(branchBeforeImport.path()) .build(repositoryId) .execute(getBus()) .getSync(1, TimeUnit.MINUTES); IBranchPath path = BranchPathUtils.createPath(branchAfterImport.path()); getComponent(path, SnomedComponentType.CONCEPT, "301795004").statusCode(200); <START> assertThat(branchBeforeImport.baseTimestamp(), not(equalTo(branchAfterImport.headTimestamp()))); <END> }</code><technical_language>a shorter version of assertion increase readability: assertNotEquals(branchAfterImport.baseTimestamp(), branchAfterImport.headTimestamp())</technical_language>

Target:
public void import12BranchHeadTimestampUpdateAfterImporting() { final Branching branches = RepositoryRequests.branching(); final String repositoryId = SnomedDatastoreActivator.REPOSITORY_UUID; final String branchA = "a"; final Branch branchBeforeImport = branches.prepareCreate() .setParent(Branch.MAIN_PATH) .setName(branchA) .build(repositoryId) .execute(getBus()) .getSync(1, TimeUnit.MINUTES); assertEquals("After branch creation timestamps should still be equal", branchBeforeImport.baseTimestamp(), branchBeforeImport.headTimestamp()); importArchive("SnomedCT_Release_INT_20160131_unique_concept.zip", branchBeforeImport.path(), false, Rf2ReleaseType.DELTA.name()); final Branch branchAfterImport = branches.prepareGet(branchBeforeImport.path()) .build(repositoryId) .execute(getBus()) .getSync(1, TimeUnit.MINUTES); IBranchPath path = BranchPathUtils.createPath(branchAfterImport.path()); getComponent(path, SnomedComponentType.CONCEPT, "301795004").statusCode(200); assertNotEquals(branchBeforeImport.baseTimestamp(), branchAfterImport.headTimestamp()); }
Source:
<code>public void sendMail_template() throws MessagingException { String to = "to@shogun2.de"; String str1 = "The Username"; String str2 = "<LINK_0>"; registrationMailMessageTemplate.setTo(to); registrationMailMessageTemplate.setText( String.format( registrationMailMessageTemplate.getText(), str1, str2 ) <START> ); <END> mailPublisher.sendMail(registrationMailMessageTemplate); assertTrue(greenMail.waitForIncomingEmail(5000, 1)); Message[] messages = greenMail.getReceivedMessages(); assertEquals(1, messages.length); assertEquals(mailPublisher.getDefaultMailSender(), messages[0].getFrom()[0].toString()); assertEquals(to, messages[0].getRecipients( Message.RecipientType.TO)[0].toString()); }</code><technical_language>Indentation a bit here</technical_language>

Target:
public void sendMail_template() throws MessagingException { String to = "to@shogun2.de"; String str1 = "The Username"; String str2 = "<LINK_0>"; registrationMailMessageTemplate.setTo(to); registrationMailMessageTemplate.setText( String.format( registrationMailMessageTemplate.getText(), str1, str2 ) ); mailPublisher.sendMail(registrationMailMessageTemplate); assertTrue(greenMail.waitForIncomingEmail(5000, 1)); Message[] messages = greenMail.getReceivedMessages(); assertEquals(1, messages.length); assertEquals(mailPublisher.getDefaultMailSender(), messages[0].getFrom()[0].toString()); assertEquals(to, messages[0].getRecipients( Message.RecipientType.TO)[0].toString()); assertTrue(GreenMailUtil.getBody( messages[0]).contains(str1)); assertTrue(GreenMailUtil.getBody( messages[0]).contains(str2)); }
Source:
<code>public long until(final Temporal endExclusive, final TemporalUnit unit) { InternationalFixedDate end = InternationalFixedDate.from(endExclusive); if (unit instanceof ChronoUnit) { switch ((ChronoUnit) unit) { case DAYS: return daysUntil(end); <START> case WEEKS: <END> return daysUntil(end) / InternationalFixedChronology.DAYS_IN_WEEK; case MONTHS: return monthsUntil(end); case YEARS: return monthsUntil(end) / InternationalFixedChronology.MONTHS_IN_YEAR; case DECADES: return monthsUntil(end) / (InternationalFixedChronology.MONTHS_IN_YEAR * 10); case CENTURIES: return monthsUntil(end) / (InternationalFixedChronology.MONTHS_IN_YEAR * 100); case MILLENNIA: return monthsUntil(end) / (InternationalFixedChronology.MONTHS_IN_YEAR * 1000); case ERAS: return end.getLong(ChronoField.ERA) - getLong(ChronoField.ERA); } throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit); } return unit.between(this, end); }</code><technical_language>need a special weeksUntil(end), year-day (and a greater extent, leap-day) throws off. Again, Discordian</technical_language>

Target:
public long until(final Temporal endExclusive, final TemporalUnit unit) { return until(InternationalFixedDate.from(endExclusive), unit); }
Source:
<code>public int getInputVersion() { <START> return 1; <END> }</code><technical_language>this a DataVersions constant more understandable differences versions</technical_language>

Target:
public int getInputVersion() { return DataVersions.Potion.BROKEN_POTION_ID; }
Source:
<code>public static String simpleDownloadUrlAs(List<String> urls, String user, String password, String saveAs) { if (urls.isEmpty()) throw new IllegalArgumentException("No URLs supplied to download "+saveAs); List<String> commands = new ArrayList<String>(); for (String url : urls) { <START> String command = "curl -f -L "; <END> if (user!=null && password!=null) { command = command + format("-u %s:%s ", user, password); } command = command + format("\"%s\"", url); if (saveAs!=null) { command = command + format(" -o %s", saveAs); } commands.add(command); } return alternatives(commands); }</code><technical_language>happened -k flag</technical_language>

Target:
public static String simpleDownloadUrlAs(List<String> urls, String user, String password, String saveAs) { if (urls.isEmpty()) throw new IllegalArgumentException("No URLs supplied to download "+saveAs); List<String> commands = new ArrayList<String>(); for (String url : urls) { String command = "curl -f -L -k "; if (user!=null && password!=null) { command = command + format("-u %s:%s ", user, password); } command = command + format("\"%s\"", url); if (saveAs!=null) { command = command + format(" -o %s", saveAs); } commands.add(command); } return alternatives(commands); }
Source:
<code>public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); IEditorInput editorInput = this.getEditorInput(); IFile sessionResourceFile = ((FileEditorInput) editorInput).getFile(); final URI sessionResourceURI = URI.createPlatformResourceURI(sessionResourceFile.getFullPath().toOSString(), true); session = SessionManager.INSTANCE.getSession(sessionResourceURI, <START> new NullProgressMonitor()); <END> if (!session.isOpen()) { session.open(new NullProgressMonitor()); } }</code><technical_language>This hides feedback</technical_language>

Target:
public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); IEditorInput editorInput = this.getEditorInput(); IFile sessionResourceFile = ((FileEditorInput) editorInput).getFile(); final URI sessionResourceURI = URI.createPlatformResourceURI(sessionResourceFile.getFullPath().toOSString(), true); try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); subMonitor.beginTask("Session loading", 1); session = SessionManager.INSTANCE.getSession(sessionResourceURI, subMonitor); if (!session.isOpen()) { session.open(monitor); } subMonitor.worked(1); subMonitor.done(); } }); } catch (InvocationTargetException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_session_loading_error_message, new Object[0]), e.getMessage(), Status.CANCEL_STATUS); } catch (InterruptedException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_session_loading_error_message, new Object[0]), e.getMessage(), Status.CANCEL_STATUS); } }
Source:
<code>public void canSearchForCodes() throws Exception { final MkGithub github = new MkGithub("jeff"); github.repos().create( Json.createObjectBuilder().add("name", "TestCode").build() ); <START> github.users().self(); <END> MatcherAssert.assertThat( github.search().codes("jeff", "repositories", "desc"), Matchers.not(Matchers.emptyIterable()) ); }</code><technical_language>this line is for? I get</technical_language>

Target:
public void canSearchForCodes() throws Exception { final MkGithub github = new MkGithub("jeff"); github.repos().create( Json.createObjectBuilder().add("name", "TestCode").build() ); MatcherAssert.assertThat( github.search().codes("jeff", "repositories", "desc"), Matchers.not(Matchers.emptyIterable()) ); }
Source:
<code>synchronized boolean sendReport(BluetoothDevice device, int id, byte[] data) { if (DBG) { Log.d(TAG, "sendReport(): device=" + device + " id=" + id + <START> " caller=" + Binder.getCallingUid()); <END> } return checkDevice(device) && checkCallingUid() && mHidDeviceNativeInterface.sendReport(id, data); }</code><technical_language>In common case, this useful information. logging CallingUid in checkCallingUid() if match mCallingUid? cases want if wrong Uid is used</technical_language>

Target:
synchronized boolean sendReport(BluetoothDevice device, int id, byte[] data) { if (DBG) { Log.d(TAG, "sendReport(): device=" + device + " id=" + id); } return checkDevice(device) && checkCallingUid() && mHidDeviceNativeInterface.sendReport(id, data); }
Source:
<code><START> public InvalidApiKeyException(String apiKey, ErrorCode errorCode) { <END> super(apiKey, errorCode); }</code><technical_language>Code style. Private constructor + static factory method</technical_language>

Target:
private InvalidApiKeyException(String apiKey, ErrorCode errorCode) { super(apiKey, errorCode); }
Source:
<code>private void filterNonRequiredNetworks(List<Network> networks, List<Network> selected) { AsyncDataProvider.getInstance().getRequiredNetworksByDataCenterId(new AsyncQuery<>(reqNetworks -> { <START> List<Network> nonRequiredNetworks = networks.stream() .filter(n -> !reqNetworks.contains(n)) .collect(Collectors.toList()); <END> getNetworks().setItems(nonRequiredNetworks); getNetworks().setSelectedItems(selected); }), getStoragePool().getId()); }</code><technical_language>networks.removeAll(reqNetworks)</technical_language>

Target:
private void filterNonRequiredNetworks(List<Network> networks, List<Network> selected) { AsyncDataProvider.getInstance().getRequiredNetworksByDataCenterId(new AsyncQuery<>(reqNetworks -> { networks.removeAll(reqNetworks); getNetworks().setItems(networks); getNetworks().setSelectedItems(selected); }), getStoragePool().getId()); }
Source:
<code>public void handleClose(final Channel closed, final IOException exception) { if(CLIModelControllerClient.this.state.get() == CLOSED) { return; } <START> if(CLIModelControllerClient.this.state.get() == CONNECTING) { <END> CLIModelControllerClient.this.state.set(LOST_CONNECTION); return; } synchronized(lock) { if (strategy != null) { if(strategy != originalStrategy) { new Exception("Channel close handler " + strategy + " " + originalStrategy).printStackTrace(); } strategy = null; closeHandler.handleClose(); } channelAssociation.handleChannelClosed(closed, exception); lock.notifyAll(); } closed.getConnection().addCloseHandler(new CloseHandler<Connection>(){ @Override public void handleClose(Connection closed, IOException exception) { StreamUtils.safeClose(originalStrategy); }}); }</code><technical_language>This like: java if (CLIModelControllerClient.this.state.compareAndSet(CONNECTING, LOST_CONNECTION)) { return; }</technical_language>

Target:
public void handleClose(final Channel closed, final IOException exception) { if(CLIModelControllerClient.this.state.get() == CLOSED) { return; } if(CLIModelControllerClient.this.state.compareAndSet(CONNECTING, LOST_CONNECTION)) { return; } synchronized(lock) { if (strategy != null) { if(strategy != originalStrategy) { new Exception("Channel close handler " + strategy + " " + originalStrategy).printStackTrace(); } strategy = null; closeHandler.handleClose(); } channelAssociation.handleChannelClosed(closed, exception); lock.notifyAll(); } closed.getConnection().addCloseHandler(new CloseHandler<Connection>(){ @Override public void handleClose(Connection closed, IOException exception) { StreamUtils.safeClose(originalStrategy); }}); }
Source:
<code><START> public BlobClientBuilder endpoint(String endpoint) { <END> try { URL url = new URL(endpoint); BlobURLParts parts = URLParser.parse(url); this.endpoint = parts.scheme() + "://" + parts.host(); if (parts.containerName() != null) { this.containerName = parts.containerName(); } if (parts.blobName() != null) { this.blobName = parts.blobName(); } if (parts.snapshot() != null) { this.snapshot = parts.snapshot(); } SASTokenCredential credential = SASTokenCredential.fromQuery(url.getQuery()); if (credential != null) { this.credential(credential); } } catch (MalformedURLException ex) { throw new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed."); } return this; }</code><technical_language>This method needs able accept a fully formed URL a blob resource. This takes in scheme, host, snapshot, SAS; path is looked at</technical_language>

Target:
public BlobClientBuilder endpoint(String endpoint) { try { URL url = new URL(endpoint); BlobURLParts parts = URLParser.parse(url); this.endpoint = parts.scheme() + "://" + parts.host(); this.containerName = parts.containerName(); this.blobName = parts.blobName(); this.snapshot = parts.snapshot(); this.sasTokenCredential = SASTokenCredential.fromQueryParameters(parts.sasQueryParameters()); if (this.sasTokenCredential != null) { this.tokenCredential = null; this.sharedKeyCredential = null; } } catch (MalformedURLException ex) { throw new IllegalArgumentException("The Azure Storage Blob endpoint url is malformed."); } return this; }
Source:
<code><START> protected NetworkClusterDAO getNetworkClusterDAO() { <END> return DbFacade.getInstance().getNetworkClusterDAO(); }</code><technical_language>externalize DbFacade.getInstance() getDbFacade()</technical_language>

Target:
protected NetworkClusterDAO getNetworkClusterDAO() { return getDbFacade().getNetworkClusterDAO(); }
Source:
<code>public StorageServerNettyFactory(int http2Port, VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, final RestRequestHandler requestHandler, SSLFactory sslFactory, ServerSecurityService serverSecurityService, ServerMetrics serverMetrics) { if (verifiableProperties == null || metricRegistry == null || requestHandler == null || sslFactory == null) { throw new IllegalArgumentException("Null arg(s) received during instantiation of StorageServerNettyFactory"); } nettyConfig = new NettyConfig(verifiableProperties); performanceConfig = new PerformanceConfig(verifiableProperties); nettyMetrics = new NettyMetrics(metricRegistry); Http2ClientConfig http2ClientConfig = new Http2ClientConfig(verifiableProperties); ConnectionStatsHandler connectionStatsHandler = new ConnectionStatsHandler(nettyMetrics); this.serverSecurityChecker = new ServerSecurityChecker(serverSecurityService, serverMetrics); Map<Integer, ChannelInitializer<SocketChannel>> initializers = Collections.singletonMap(http2Port, new StorageServerNettyChannelInitializer(nettyConfig, http2ClientConfig, performanceConfig, nettyMetrics, <START> connectionStatsHandler, requestHandler, sslFactory, metricRegistry, this.serverSecurityChecker)); <END> channelInitializers = Collections.unmodifiableMap(initializers); }</code><technical_language>need this</technical_language>

Target:
public StorageServerNettyFactory(int http2Port, VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, final RestRequestHandler requestHandler, SSLFactory sslFactory, ServerSecurityService serverSecurityService, ServerMetrics serverMetrics) { if (verifiableProperties == null || metricRegistry == null || requestHandler == null || sslFactory == null) { throw new IllegalArgumentException("Null arg(s) received during instantiation of StorageServerNettyFactory"); } nettyConfig = new NettyConfig(verifiableProperties); performanceConfig = new PerformanceConfig(verifiableProperties); nettyMetrics = new NettyMetrics(metricRegistry); Http2ClientConfig http2ClientConfig = new Http2ClientConfig(verifiableProperties); ConnectionStatsHandler connectionStatsHandler = new ConnectionStatsHandler(nettyMetrics); this.serverSecurityHandler = new ServerSecurityHandler(serverSecurityService, serverMetrics); Map<Integer, ChannelInitializer<SocketChannel>> initializers = Collections.singletonMap(http2Port, new StorageServerNettyChannelInitializer(nettyConfig, http2ClientConfig, performanceConfig, nettyMetrics, connectionStatsHandler, requestHandler, sslFactory, metricRegistry, serverSecurityHandler)); channelInitializers = Collections.unmodifiableMap(initializers); }
Source:
<code>private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<HashEntry>(tableSize); loadLocks = new Lock[32]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new Lock(); int eb = (int) (tableSize * .1); if (64 < eb) eb = 64; else if (eb < 4) eb = 4; if (tableSize < eb) eb = tableSize; maxBytes = cfg.getBlockLimit(); blockSize = cfg.getBlockSize(); blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); clockHand = new Ref<Object>(null, -1, 0, null); clockHand.next = clockHand; readAheadLimit = cfg.getReadAheadLimit(); readAheadService = cfg.getReadAheadService(); packCache = new ConcurrentHashMap<DfsPackDescription, DfsPackFile>( <START> 16, 0.75f, 1); <END> packFiles = Collections.unmodifiableCollection(packCache.values()); statHit = new AtomicLong(); statMiss = new AtomicLong(); }</code><technical_language>// want override concurrencylevel</technical_language>

Target:
private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<HashEntry>(tableSize); loadLocks = new ReentrantLock[32]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new ReentrantLock(true ); int eb = (int) (tableSize * .1); if (64 < eb) eb = 64; else if (eb < 4) eb = 4; if (tableSize < eb) eb = tableSize; maxBytes = cfg.getBlockLimit(); blockSize = cfg.getBlockSize(); blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); clockHand = new Ref<Object>(null, -1, 0, null); clockHand.next = clockHand; readAheadLimit = cfg.getReadAheadLimit(); readAheadService = cfg.getReadAheadService(); packCache = new ConcurrentHashMap<DfsPackDescription, DfsPackFile>( 16, 0.75f, 1); packFiles = Collections.unmodifiableCollection(packCache.values()); statHit = new AtomicLong(); statMiss = new AtomicLong(); }
Source:
<code>public void initialize(URL location, ResourceBundle resources) { xpathExpressionArea.setSyntaxHighlightingEnabled(new XPathSyntaxHighlighter()); initGenerateXPathFromStackTrace(); EventStreams.valuesOf(xpathResultListView.getSelectionModel().selectedItemProperty()) .conditionOn(xpathResultListView.focusedProperty()) .filter(Objects::nonNull) .subscribe(parent::onNodeItemSelected); Platform.runLater(this::bindToParent); xpathExpressionArea.richChanges() .filter(t -> !t.isIdentity()) .successionEnds(XPATH_REFRESH_DELAY) .or(xpathVersionProperty().changes()) .subscribe(tick -> parent.refreshXPathResults()); xpathExpressionArea.richChanges() <START> .subscribe(t -> autoComplete()); <END> }</code><technical_language>This is wrong, display autocomplete time. plainTextChanges() instead filter changes touch a string segment of letters, is a /. pass this segment autocomplete method</technical_language>

Target:
public void initialize(URL location, ResourceBundle resources) { xpathExpressionArea.setSyntaxHighlighter(new XPathSyntaxHighlighter()); initGenerateXPathFromStackTrace(); xpathResultListView.setCellFactory(v -> new XpathViolationListCell()); EventStreams.valuesOf(xpathResultListView.getSelectionModel().selectedItemProperty()) .conditionOn(xpathResultListView.focusedProperty()) .filter(Objects::nonNull) .map(TextAwareNodeWrapper::getNode) .subscribe(parent::onNodeItemSelected); Platform.runLater(this::bindToParent); xpathExpressionArea.richChanges() .filter(t -> !t.isIdentity()) .successionEnds(XPATH_REFRESH_DELAY) .or(xpathVersionProperty().changes()) .subscribe(tick -> parent.refreshXPathResults()); EventStream<Integer> changesEventStream = xpathExpressionArea.plainTextChanges() .map(characterChanges -> { if (characterChanges.getRemoved().length() > 0) { return characterChanges.getRemovalEnd() - 1; } return characterChanges.getInsertionEnd(); }); EventStream<Integer> keyCombo = EventStreams.eventsOf(xpathExpressionArea, KeyEvent.KEY_PRESSED) .filter(key -> key.isControlDown() && key.getCode().equals(KeyCode.SPACE)) .map(searchPoint -> xpathExpressionArea.getCaretPosition()); EventStreams.merge(keyCombo, changesEventStream).map(searchPoint -> { int indexOfSlash = xpathExpressionArea.getText().lastIndexOf("/", searchPoint - 1) + 1; String input = xpathExpressionArea.getText(); if (searchPoint > input.length()) { searchPoint = input.length(); } input = input.substring(indexOfSlash, searchPoint); return Tuples.t(indexOfSlash, input); }) .filter(t -> StringUtils.isAlpha(t._2)) .subscribe(s -> autoComplete(s._1, s._2)); xpathExpressionArea.addEventHandler(KeyEvent.KEY_PRESSED, t -> { if (t.getCode() == KeyCode.ESCAPE) { autoCompletePopup.hide(); } }); }
Source:
<code>@Test public void testJoinRowType() { checkResultType( "select * from emp left join dept on emp.deptno = dept.deptno", "RecordType(INTEGER NOT NULL EMPNO," + " VARCHAR(20) NOT NULL ENAME," + " VARCHAR(10) NOT NULL JOB," + " INTEGER MGR," + " TIMESTAMP(0) NOT NULL HIREDATE," + " INTEGER NOT NULL SAL," + " INTEGER NOT NULL COMM," + " INTEGER NOT NULL DEPTNO," + " BOOLEAN NOT NULL SLACKER," + " INTEGER DEPTNO0," + " VARCHAR(10) NAME) NOT NULL"); checkResultType( "select * from emp right join dept on emp.deptno = dept.deptno", "RecordType(INTEGER EMPNO," + " VARCHAR(20) ENAME," + " VARCHAR(10) JOB," + " INTEGER MGR," + " TIMESTAMP(0) HIREDATE," + " INTEGER SAL," + " INTEGER COMM," + " INTEGER DEPTNO," + " BOOLEAN SLACKER," + " INTEGER NOT NULL DEPTNO0," + " VARCHAR(10) NOT NULL NAME) NOT NULL"); checkResultType( "select * from emp full join dept on emp.deptno = dept.deptno", "RecordType(INTEGER EMPNO," + " VARCHAR(20) ENAME," + " VARCHAR(10) JOB," + " INTEGER MGR," + " TIMESTAMP(0) HIREDATE," + " INTEGER SAL," + " INTEGER COMM," + " INTEGER DEPTNO," + " BOOLEAN SLACKER," + " INTEGER DEPTNO0," <START> + " VARCHAR(10) NAME)"); <END> }</code><technical_language>I a structured type representing result of a query sense nullable (and be). I guess this change fact returned fields nullable. introducing a separate field solves this problem. remark for tests below</technical_language>

Target:
@Test public void testJoinRowType() { checkResultType( "select * from emp left join dept on emp.deptno = dept.deptno", "RecordType(INTEGER NOT NULL EMPNO," + " VARCHAR(20) NOT NULL ENAME," + " VARCHAR(10) NOT NULL JOB," + " INTEGER MGR," + " TIMESTAMP(0) NOT NULL HIREDATE," + " INTEGER NOT NULL SAL," + " INTEGER NOT NULL COMM," + " INTEGER NOT NULL DEPTNO," + " BOOLEAN NOT NULL SLACKER," + " INTEGER DEPTNO0," + " VARCHAR(10) NAME) NOT NULL"); checkResultType( "select * from emp right join dept on emp.deptno = dept.deptno", "RecordType(INTEGER EMPNO," + " VARCHAR(20) ENAME," + " VARCHAR(10) JOB," + " INTEGER MGR," + " TIMESTAMP(0) HIREDATE," + " INTEGER SAL," + " INTEGER COMM," + " INTEGER DEPTNO," + " BOOLEAN SLACKER," + " INTEGER NOT NULL DEPTNO0," + " VARCHAR(10) NOT NULL NAME) NOT NULL"); checkResultType( "select * from emp full join dept on emp.deptno = dept.deptno", "RecordType(INTEGER EMPNO," + " VARCHAR(20) ENAME," + " VARCHAR(10) JOB," + " INTEGER MGR," + " TIMESTAMP(0) HIREDATE," + " INTEGER SAL," + " INTEGER COMM," + " INTEGER DEPTNO," + " BOOLEAN SLACKER," + " INTEGER DEPTNO0," + " VARCHAR(10) NAME) NOT NULL"); }
Source:
<code>public void assignSlots(Topologies topologies, Map<String, Collection<WorkerSlot>> slotsForTopologiesNeedingAssignments) { <START> if (slotsForTopologiesNeedingAssignments.size() == 0) { <END> LOG.debug("assignSlots: no slots passed in, nothing to do"); return; } for (Map.Entry<String, Collection<WorkerSlot>> topologyToSlots : slotsForTopologiesNeedingAssignments.entrySet()) { String topologyId = topologyToSlots.getKey(); for (WorkerSlot slot : topologyToSlots.getValue()) { TopologyDetails details = topologies.getById(topologyId); LOG.debug("assignSlots: topologyId: worker being assigned to slot: with workerCpu: workerMem: {}", topologyId, slot, MesosCommon.topologyWorkerCpu(_conf, details), MesosCommon.topologyWorkerMem(_conf, details)); } } synchronized (_offersLock) { computeLaunchList(topologies, slotsForTopologiesNeedingAssignments); } }</code><technical_language>While it, change this .isEmpty()</technical_language>

Target:
public void assignSlots(Topologies topologies, Map<String, Collection<WorkerSlot>> slotsForTopologiesNeedingAssignments) { if (slotsForTopologiesNeedingAssignments.isEmpty()) { LOG.debug("assignSlots: no slots passed in, nothing to do"); return; } for (Map.Entry<String, Collection<WorkerSlot>> topologyToSlots : slotsForTopologiesNeedingAssignments.entrySet()) { String topologyId = topologyToSlots.getKey(); for (WorkerSlot slot : topologyToSlots.getValue()) { TopologyDetails details = topologies.getById(topologyId); LOG.debug("assignSlots: topologyId: worker being assigned to slot: with workerCpu: workerMem: {}", topologyId, slot, MesosCommon.topologyWorkerCpu(_conf, details), MesosCommon.topologyWorkerMem(_conf, details)); } } synchronized (_offersLock) { computeLaunchList(topologies, slotsForTopologiesNeedingAssignments); } }
Source:
<code>private ConnectionOptions getConnectionOptions() { if (credentials == null) { <START> throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " <END> + "They can be set using: connectionString(String), connectionString(String, String), " + "or credentials(String, String, TokenCredential)" )); } if (proxyOptions != null && proxyOptions.isProxyAddressConfigured() && transport != AmqpTransportType.AMQP_WEB_SOCKETS) { throw logger.logExceptionAsError(new IllegalArgumentException( "Cannot use a proxy when TransportType is not AMQP.")); } if (proxyOptions == null) { proxyOptions = getDefaultProxyConfiguration(configuration); } final CbsAuthorizationType authorizationType = credentials instanceof ServiceBusSharedKeyCredential ? CbsAuthorizationType.SHARED_ACCESS_SIGNATURE : CbsAuthorizationType.JSON_WEB_TOKEN; final ClientOptions options = clientOptions != null ? clientOptions : new ClientOptions(); return new ConnectionOptions(fullyQualifiedNamespace, credentials, authorizationType, transport, retryOptions, proxyOptions, scheduler, options, SslDomain.VerifyMode.VERIFY_PEER_NAME); }</code><technical_language>problem removing this line is if does: java var client = new ServiceBusClientBuilder().configuration(null) .buildClient(); default credential assign object creation</technical_language>

Target:
private ConnectionOptions getConnectionOptions() { configuration = configuration == null ? Configuration.getGlobalConfiguration().clone() : configuration; if (credentials == null) { throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " + "They can be set using: connectionString(String), connectionString(String, String), " + "or credentials(String, String, TokenCredential)" )); } if (proxyOptions != null && proxyOptions.isProxyAddressConfigured() && transport != AmqpTransportType.AMQP_WEB_SOCKETS) { throw logger.logExceptionAsError(new IllegalArgumentException( "Cannot use a proxy when TransportType is not AMQP.")); } if (proxyOptions == null) { proxyOptions = getDefaultProxyConfiguration(configuration); } final CbsAuthorizationType authorizationType = credentials instanceof ServiceBusSharedKeyCredential ? CbsAuthorizationType.SHARED_ACCESS_SIGNATURE : CbsAuthorizationType.JSON_WEB_TOKEN; final ClientOptions options = clientOptions != null ? clientOptions : new ClientOptions(); return new ConnectionOptions(fullyQualifiedNamespace, credentials, authorizationType, transport, retryOptions, proxyOptions, scheduler, options, SslDomain.VerifyMode.VERIFY_PEER_NAME); }
Source:
<code>public synchronized DruidNodeDiscovery getForNodeType(String nodeType) { if (stopped) { throw new ISE("Provider has been stopped."); } NodeTypeWatcher nodeTypeWatcher = nodeTypeWatchers.get(nodeType); if (nodeTypeWatcher == null) { <START> log.info("Creating/Starting NodeTypeWatcher for nodeType [%s].", nodeType); <END> nodeTypeWatcher = new NodeTypeWatcher( listenerExecutor, curatorFramework, config.getInternalDiscoveryPath(), jsonMapper, nodeType ); nodeTypeWatcher.start(); nodeTypeWatchers.put(nodeType, nodeTypeWatcher); log.info("Created/Started NodeTypeWatcher for nodeType [%s].", nodeType); } return nodeTypeWatchers.get(nodeType); }</code><technical_language>Nit: I read "/" "OR" weird creating starting. I message "Creating NodeTypeWatcher" "Creating starting NodeTypeWatcher"</technical_language>

Target:
public DruidNodeDiscovery getForNodeType(String nodeType) { Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS)); return nodeTypeWatchers.compute( nodeType, (k, v) -> { if (v != null) { return v; } log.info("Creating NodeTypeWatcher for nodeType [%s].", nodeType); NodeTypeWatcher nodeTypeWatcher = new NodeTypeWatcher( listenerExecutor, curatorFramework, config.getInternalDiscoveryPath(), jsonMapper, nodeType ); nodeTypeWatcher.start(); log.info("Created NodeTypeWatcher for nodeType [%s].", nodeType); return nodeTypeWatcher; } ); }
Source:
<code>public void getValue_givenLocationId_shouldCallDeserializeWithLocationUuid() throws Exception { List<Location> locations = Context.getLocationService().getAllLocations(); <START> Location testedLocation = locations.get(0); <END> final String locationId = String.valueOf(testedLocation.getLocationId()); final String formFieldName = "id"; MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter(formFieldName, locationId); LocationDatatype datatype = mock(LocationDatatype.class); SerializingFieldGenDatatypeHandler handler = new MockLocationFieldGenDatatypeHandler(); handler.getValue(datatype, request, formFieldName); verify(datatype).deserialize(eq(testedLocation.getUuid())); }</code><technical_language>Instead of first, get for a id? pick here: <LINK_0></technical_language>

Target:
public void getValue_givenLocationId_shouldCallDeserializeWithLocationUuid() throws Exception { Location testedLocation = Context.getLocationService().getLocation(1); final String locationId = String.valueOf(testedLocation.getLocationId()); final String formFieldName = "id"; MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter(formFieldName, locationId); LocationDatatype datatype = mock(LocationDatatype.class); SerializingFieldGenDatatypeHandler handler = new MockLocationFieldGenDatatypeHandler(); handler.getValue(datatype, request, formFieldName); verify(datatype).deserialize(eq(testedLocation.getUuid())); }
Source:
<code>public void testCustomColumnNames() throws Exception { final String firstColumnName = "first"; final String secondColumnName = "second"; final String thirdColumnName = "third"; final String fourthColumnName = "fourth"; <START> final ColumnType firstColumnType = ColumnType.STRING; <END> final ColumnType secondColumnType = ColumnType.STRING; final ColumnType thirdColumnType = ColumnType.STRING; final ColumnType fourthColumnType = ColumnType.NUMBER; final CsvConfiguration configuration = new CsvConfiguration(CsvConfiguration.DEFAULT_COLUMN_NAME_LINE, new CustomColumnNamingStrategy(firstColumnName, secondColumnName, thirdColumnName, fourthColumnName), new CustomColumnTypingStrategy(firstColumnType, secondColumnType, thirdColumnType, fourthColumnType), FileHelper.DEFAULT_ENCODING, CsvConfiguration.DEFAULT_SEPARATOR_CHAR, CsvConfiguration.DEFAULT_QUOTE_CHAR, CsvConfiguration.DEFAULT_ESCAPE_CHAR, false, true); final DataContext dataContext = new CsvDataContext(new File("src/test/resources/csv_people.csv"), configuration); final Table table = dataContext.getDefaultSchema().getTable(0); assertNotNull(table.getColumnByName(firstColumnName)); assertNotNull(table.getColumnByName(secondColumnName)); assertNotNull(table.getColumnByName(thirdColumnName)); assertNotNull(table.getColumnByName(fourthColumnName)); }</code><technical_language>I adds real put constants xxxColumnType variables, especially once. code more understandable more elegant</technical_language>

Target:
public void testCustomColumnNames() throws Exception { final String firstColumnName = "first"; final String secondColumnName = "second"; final String thirdColumnName = "third"; final String fourthColumnName = "fourth"; final CsvConfiguration configuration = new CsvConfiguration(CsvConfiguration.DEFAULT_COLUMN_NAME_LINE, new CustomColumnNamingStrategy(firstColumnName, secondColumnName, thirdColumnName, fourthColumnName), new CustomColumnTypingStrategy(ColumnType.STRING, ColumnType.STRING, ColumnType.STRING, ColumnType.NUMBER), FileHelper.DEFAULT_ENCODING, CsvConfiguration.DEFAULT_SEPARATOR_CHAR, CsvConfiguration.DEFAULT_QUOTE_CHAR, CsvConfiguration.DEFAULT_ESCAPE_CHAR, false, true); final DataContext dataContext = new CsvDataContext(new File("src/test/resources/csv_people.csv"), configuration); final Table table = dataContext.getDefaultSchema().getTable(0); assertNotNull(table.getColumnByName(firstColumnName)); assertNotNull(table.getColumnByName(secondColumnName)); assertNotNull(table.getColumnByName(thirdColumnName)); assertNotNull(table.getColumnByName(fourthColumnName)); }
Source:
<code>public List<Object> getAttributeAsList(String key) { Object o = getAttribute(key); <START> if( o == null) return Collections.emptyList(); <END> if( o instanceof List ) return (List<Object>)o; if( o.getClass().isArray() ) { return Arrays.asList( (Object[])o ); } return Collections.singletonList(o); }</code><technical_language>change style if (o == null) ... below</technical_language>

Target:
public List<Object> getAttributeAsList(String key) { Object o = getAttribute(key); if ( o == null ) return Collections.emptyList(); if ( o instanceof List ) return (List<Object>)o; if ( o.getClass().isArray() ) return Arrays.asList((Object[])o); return Collections.singletonList(o); }
Source:
<code>public static boolean isUpToDate(Host host, DomainGroup domainGroup, Domain domain) throws IOException { if (domain == null || domain.getVersions() == null) { return false; } Set<DomainAndVersion> domainAndVersion = new HashSet<>(); for (DomainAndVersion d : domainGroup.getDomainVersions()) { <START> if (d.getDomain().equals(domain)) domainAndVersion.add(d); <END> } if (!allPartitionsUpToDate(host, domainAndVersion, false)) { return false; } if (isAssignedDeletablePartition(host)) { return false; } return true; }</code><technical_language>this is super fiddly, I \{\} inline version else</technical_language>

Target:
public static boolean isUpToDate(Host host, DomainGroup domainGroup, Domain domain) throws IOException { if (domain == null || domain.getVersions() == null) { return false; } Set<DomainAndVersion> domainAndVersion = new HashSet<>(); domainAndVersion.add(domainGroup.getDomainVersion(domain)); return isUpToDateOrMoreRecent(host, domainAndVersion); }
Source:
<code>protected void executeQueryCommand() { if (getParameters().getConfigurationType() == null) { <START> log.info("received invalid configuration type: null"); <END> return; } switch(getParameters().getConfigurationType()) { case OVF: try { getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOvf(getParameters().getVmConfiguration()).getVm()); getQueryReturnValue().setSucceeded(true); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } break; case OVA: String ovfString = getParameters().getVmConfiguration(); ovfString = ovfString .replaceAll("[\r\n]+", "") .replaceAll("xmlns=[^-\\s]*", ""); try { getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOva(ovfString)); getQueryReturnValue().setSucceeded(true); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } break; } }</code><technical_language>log.error</technical_language>

Target:
protected void executeQueryCommand() { if (getParameters().getConfigurationType() == null) { log.error("received invalid configuration type: null"); return; } switch(getParameters().getConfigurationType()) { case OVF: try { getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOvf(getParameters().getVmConfiguration()).getVm()); getQueryReturnValue().setSucceeded(true); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } break; case OVA: try { getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOva(getParameters().getVmConfiguration())); getQueryReturnValue().setSucceeded(true); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } break; } }
Source:
<code><START> public void testQuerySysJobsLogReturnsLogEntriesRelevantToUser() { <END> executeAsSuperuser("select 2"); executeAsSuperuser("select 3"); execute("select 1", null, testUserSession()); String stmt = "select username, stmt " + "from sys.jobs_log " + "where stmt in ('select 1', 'select 2', 'select 3') " + "order by stmt"; executeAsSuperuser(stmt); assertThat(printedTable(response.rows()), is("privileges_test_user| select 1\n" + "crate| select 2\n" + "crate| select 3\n")); executeAsSuperuser("grant dql on table sys.jobs_log to " + TEST_USERNAME); execute(stmt, null, testUserSession()); assertThat(printedTable(response.rows()), is("privileges_test_user| select 1\n")); }</code><technical_language>wondering if instead sense a unit test for concrete StaticTableDefinition ? cheaper execute more deterministic full integration tests filtering works is integrated</technical_language>

Target:
public void testQuerySysJobsLogReturnsLogEntriesRelevantToUser() { executeAsSuperuser("grant dql on table sys.jobs_log to " + TEST_USERNAME); executeAsSuperuser("select 2"); executeAsSuperuser("select 3"); execute("select 1", null, testUserSession()); String stmt = "select username, stmt " + "from sys.jobs_log " + "where stmt in ('select 1', 'select 2', 'select 3') " + "order by stmt"; executeAsSuperuser(stmt); assertThat(printedTable(response.rows()), is("privileges_test_user| select 1\n" + "crate| select 2\n" + "crate| select 3\n")); execute(stmt, null, testUserSession()); assertThat(printedTable(response.rows()), is("privileges_test_user| select 1\n")); }
Source:
<code>public int selectPartition(Object key, int partitionCount) { int hashCode = key.hashCode(); if (hashCode == Integer.MIN_VALUE) { hashCode = 0; } <START> return Math.abs(hashCode) % partitionCount; <END> }</code><technical_language>Actually, I modulo part of strategy is applied. Even, closer inspection, I is issue if (partition >= meta.partitionCount) { partition = partition % meta.partitionCount; } if (partition < 0) { partition = Math.abs(partition); } => if partition is -meta.partitionCount ? modulo applied, abs() IMHO</technical_language>

Target:
public int selectPartition(Object key, int partitionCount) { int hashCode = key.hashCode(); if (hashCode == Integer.MIN_VALUE) { hashCode = 0; } return Math.abs(hashCode); }
Source:
<code>public ConstraintMatchTotal deserialize(JsonParser parser, DeserializationContext context) throws IOException { <START> ObjectMapper mapper = new ObjectMapper(); <END> JsonNode tree = parser.getCodec().readTree(parser); String constraintPackage = tree.get("constraintPackage").asText(); String constraintName = tree.get("constraintName").asText(); Score<?> scoreTotal = DeserializationUtils.deserializePolymorphicProperty(parser, context, tree, "scoreTotal"); ConstraintMatchTotal out = new ConstraintMatchTotal(constraintPackage, constraintName, scoreTotal); Set<ConstraintMatch> constraintMatchSet = new HashSet<>(); for (JsonNode t : tree.get("constraintMatchSet")) { constraintMatchSet.add(constraintMatchDeserializer.deserialize(mapper.getFactory().createParser(t .toString()), context)); } out.getConstraintMatchSet().addAll(constraintMatchSet); return out; }</code><technical_language>creating a new ObjectMapper part of a deserialiation problematic, of bootstrap cost inherit original's ObjectMapper's configuration? For example, of justification objects a Foo object for origional ObjectMapper a special (de)serializer configured</technical_language>

Target:
public ConstraintMatchTotal deserialize(JsonParser parser, DeserializationContext context) throws IOException { JsonNode tree = parser.getCodec().readTree(parser); String constraintPackage = tree.get("constraintPackage").asText(); String constraintName = tree.get("constraintName").asText(); Score<?> scoreTotal = DeserializationUtils.deserializePolymorphicProperty(parser, context, tree, "scoreTotal"); ConstraintMatchTotal out = new ConstraintMatchTotal(constraintPackage, constraintName, scoreTotal); Set<ConstraintMatch> constraintMatchSet = new HashSet<>(); for (JsonNode t : tree.get("constraintMatchSet")) { constraintMatchSet.add(constraintMatchDeserializer.deserialize(parser.getCodec().getFactory().createParser(t .toString()), context)); } out.getConstraintMatchSet().addAll(constraintMatchSet); return out; }