auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> protected String startServerCommand(String name, int port, int connectedLocatorPort) { <END> String command = "start server --name=" + name + " --server-port=" + port + " --locators=localhost[" + connectedLocatorPort + "]"; return command; }</code><technical_language>Is a subclass? protected methods private if possible</technical_language>

Target:
private String startServerCommand(String name, int port, int connectedLocatorPort) { String command = "start server --name=" + name + " --server-port=" + port + " --locators=localhost[" + connectedLocatorPort + "]"; return command; }
Source:
<code>protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslFactory == null) { throw new IllegalArgumentException("ssl factory shouldn't be null"); } SslHandler sslHandler = new SslHandler(sslFactory.createSSLEngine(host, port, SSLFactory.Mode.CLIENT)); pipeline.addLast(sslHandler); pipeline.addLast(Http2FrameCodecBuilder.forClient().build()); <START> pipeline.addLast(new Http2MultiplexHandler(new DummyChildHandler())); <END> }</code><technical_language>new Http2MultiplexHandler(new ChannelInboundHandlerAdapter()) do</technical_language>

Target:
protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslFactory == null) { throw new IllegalArgumentException("ssl factory shouldn't be null"); } SslHandler sslHandler = new SslHandler(sslFactory.createSSLEngine(host, port, SSLFactory.Mode.CLIENT)); pipeline.addLast(sslHandler); pipeline.addLast(Http2FrameCodecBuilder.forClient().build()); pipeline.addLast(new Http2MultiplexHandler(new ChannelInboundHandlerAdapter())); }
Source:
<code>static StatsSnapshot reduceByPartitionClass(StatsSnapshot statsSnapshot) { StatsSnapshot returnSnapshot = new StatsSnapshot(statsSnapshot.getValue(), new HashMap<>()); Map<String, StatsSnapshot> partitionClassSnapshots = statsSnapshot.getSubMap(); <START> if (partitionClassSnapshots != null) { <END> for (Map.Entry<String, StatsSnapshot> partitionClassToSnapshot : partitionClassSnapshots.entrySet()) { StatsSnapshot partitionClassSnapshot = partitionClassToSnapshot.getValue(); StatsSnapshot reducedPartitionClassSnapshot = new StatsSnapshot(0L, null); Map<String, StatsSnapshot> partitionToSnapshot = partitionClassSnapshot.getSubMap(); if (partitionToSnapshot != null) { for (StatsSnapshot snapshot : partitionToSnapshot.values()) { StatsSnapshot.aggregate(reducedPartitionClassSnapshot, snapshot); } returnSnapshot.getSubMap().put(partitionClassToSnapshot.getKey(), reducedPartitionClassSnapshot); } } } return returnSnapshot; }</code><technical_language>test cases partitionClassSnapshots == null partitionToSnapshot == null? Codecov cases covered</technical_language>

Target:
static StatsSnapshot reduceByPartitionClass(StatsSnapshot statsSnapshot) { StatsSnapshot returnSnapshot = new StatsSnapshot(statsSnapshot.getValue(), new HashMap<>()); Map<String, StatsSnapshot> partitionClassSnapshots = statsSnapshot.getSubMap(); if (!partitionClassSnapshots.isEmpty()) { for (Map.Entry<String, StatsSnapshot> partitionClassToSnapshot : partitionClassSnapshots.entrySet()) { StatsSnapshot partitionClassSnapshot = partitionClassToSnapshot.getValue(); StatsSnapshot reducedPartitionClassSnapshot = new StatsSnapshot(0L, null); Map<String, StatsSnapshot> partitionToSnapshot = partitionClassSnapshot.getSubMap(); for (StatsSnapshot snapshot : partitionToSnapshot.values()) { StatsSnapshot.aggregate(reducedPartitionClassSnapshot, snapshot); } returnSnapshot.getSubMap().put(partitionClassToSnapshot.getKey(), reducedPartitionClassSnapshot); } } return returnSnapshot; }
Source:
<code>public synchronized int read(byte[] buffer, int offset, int length) { requireNonNull(buffer, "buffer is null"); checkArgument(offset >= 0, "offset should equal to or greater than 0"); <START> checkArgument(length >= 0, "length should equal to or greater than 0"); <END> int totalReadBytes = 0; while (totalReadBytes < length && remainingBytes > 0 && (currentArray != null || arrays.hasNext())) { if (currentArray == null) { currentArray = arrays.next(); nextByte = 0; } int readBytes = min(remainingBytes, min(length - totalReadBytes, currentArray.length - nextByte)); arraycopy(currentArray, nextByte, buffer, offset + totalReadBytes, readBytes); totalReadBytes += readBytes; nextByte += readBytes; remainingBytes -= readBytes; if (nextByte >= currentArray.length || remainingBytes <= 0) { currentArray = null; } } return totalReadBytes > 0 ? totalReadBytes : -1; }</code><technical_language>is a guava preconditions method for this.... checkIndex</technical_language>

Target:
public synchronized int read(byte[] buffer, int offset, int length) { requireNonNull(buffer, "buffer is null"); checkPositionIndexes(offset, offset + length, buffer.length); if (remainingBytes == 0) { return -1; } int totalReadBytes = (int) min(length, remainingBytes); length = totalReadBytes; while (length > 0) { if (currentBufferPosition >= currentBuffer.length) { advanceCurrentBuffer(); } int readBytes = min(length, currentBuffer.length - currentBufferPosition); arraycopy(currentBuffer, currentBufferPosition, buffer, offset, readBytes); offset += readBytes; length -= readBytes; currentBufferPosition += readBytes; } remainingBytes -= totalReadBytes; return totalReadBytes; }
Source:
<code>private Set<String> getEvalGroupsForNodeSectionAware( String nodeID ) { Set<String> groups = new HashSet<>(); try { <START> List<HierarchyNodeRule> rules = this.getRulesByNodeID( Long.parseLong( nodeID ) ); <END> for( HierarchyNodeRule rule : rules ) { if( EvalConstants.HIERARCHY_RULE_SECTION.equals( rule.getOption() ) ) { groups.addAll( dao.getAllSiteIDsMatchingSectionTitle( rule.getRule() ) ); } else { groups.addAll( dao.getAllSiteIDsMatchingSiteTitle( rule.getRule() ) ); } } } catch( NumberFormatException ex ) { log.warn( ex ); } return groups; }</code><technical_language>Do need "this" here</technical_language>

Target:
private Set<String> getEvalGroupsForNodeSectionAware( String nodeID ) { Set<String> groups = new HashSet<>(); try { List<HierarchyNodeRule> rules = getRulesByNodeID( Long.parseLong( nodeID ) ); for( HierarchyNodeRule rule : rules ) { if( EvalConstants.HIERARCHY_RULE_SECTION.equals( rule.getOption() ) ) { groups.addAll( dao.getAllSiteIDsMatchingSectionTitle( rule.getRule() ) ); } else { groups.addAll( dao.getAllSiteIDsMatchingSiteTitle( rule.getRule() ) ); } } } catch( NumberFormatException ex ) { LOG.warn( ex ); } return groups; }
Source:
<code>public int compareTo(ServerDescription o) { <START> if (this.getServerName().equalsIgnoreCase(o.getServerName())) <END> return 1; return this.getServerName().compareTo(o.getServerName()); }</code><technical_language>brackets ({ })</technical_language>

Target:
public int compareTo(ServerDescription o) { if (this.getServerName().equalsIgnoreCase(o.getServerName())) { return 1; } return this.getServerName().compareTo(o.getServerName()); }
Source:
<code>public TexParserResult parse(Path texFile) { <START> return parseTexFiles(new ArrayList<>(Collections.singletonList(texFile))); <END> }</code><technical_language>This is duplicated logic, Arrays.asList Collections.singletonList. Note singleton list is modifiable</technical_language>

Target:
public TexParserResult parse(Path texFile) { return parse(Collections.singletonList(texFile)); }
Source:
<code>public AcceleoProjectState getLastBuiltState(IProject project, IProgressMonitor monitor) { try { if (project.isAccessible() && project.hasNature(IAcceleoConstants.ACCELEO_NATURE_ID)) { AcceleoProjectInfo info = this.getAcceleoProjectInfo(project, true); if (!info.hasBeenRead()) { <START> info.markAsRead(); <END> info.setSavedState(this.readBuiltState(project)); } return info.getSavedState(); } } catch (CoreException e) { AcceleoCommonPlugin.log(e, true); } return null; }</code><technical_language>times create AcceleoProjectInfos, immediately set read. Is a point? Likewise, call "hasBeenRead" other location create AcceleoProjectInfo</technical_language>

Target:
public AcceleoProjectState getLastBuiltState(IProject project, IProgressMonitor monitor) { try { if (project.isAccessible() && project.hasNature(IAcceleoConstants.ACCELEO_NATURE_ID)) { AcceleoProjectInfo info = this.getAcceleoProjectInfo(project, true); if (!info.hasBeenRead()) { info.markAsRead(); info.setSavedState(this.readBuiltState(project)); } return info.getSavedState(); } } catch (CoreException e) { AcceleoLogger.log(e, true); } return null; }
Source:
<code>private JavadocNodeImpl createJavadocNode(ParseTree parseTree, DetailNode parent, int index) { final JavadocNodeImpl node = new JavadocNodeImpl(); node.setText(parseTree.getText()); final int parseTreeLine = getLine(parseTree); node.setColumnNumber(getColumn(parseTree)); <START> node.setLineNumber(parseTreeLine + blockCommentLineNumber); <END> node.setIndex(index); node.setType(getTokenType(parseTree)); node.setParent(parent); node.setChildren((DetailNode[]) new JavadocNodeImpl[parseTree.getChildCount()]); return node; }</code><technical_language>please revert this update, I do reason of it</technical_language>

Target:
private JavadocNodeImpl createJavadocNode(ParseTree parseTree, DetailNode parent, int index) { final JavadocNodeImpl node = new JavadocNodeImpl(); node.setText(parseTree.getText()); node.setColumnNumber(getColumn(parseTree)); node.setLineNumber(getLine(parseTree) + blockCommentLineNumber); node.setIndex(index); node.setType(getTokenType(parseTree)); node.setParent(parent); node.setChildren((DetailNode[]) new JavadocNodeImpl[parseTree.getChildCount()]); return node; }
Source:
<code>private void upgrade() { if (getWindow() != null) { return; } final VDS host = getEntity(); Model model; <START> if (host.getVdsType() <END> == VDSType.oVirtNode) { model = new UpgradeModel(host); } else { model = new UpgradeConfirmationModel(host); } model.initialize(); model.getCommands().add(UICommand.createCancelUiCommand("Cancel", this)); setWindow(model); }</code><technical_language>consider a ternary statement instead..</technical_language>

Target:
private void upgrade() { if (getWindow() != null) { return; } final VDS host = getEntity(); Model model = createUpgradeModel(host); model.initialize(); model.getCommands().add(UICommand.createCancelUiCommand("Cancel", this)); setWindow(model); }
Source:
<code>public void onDetach() { super.onDetach(); mLoginListener = null; if (mGoogleApiClient.isConnected()) { mGoogleApiClient.stopAutoManage(getActivity()); mGoogleApiClient.disconnect(); } <START> ActivityUtils.showKeyboard(getActivity().getCurrentFocus()); <END> }</code><technical_language>Hmm, elaborate need for resuming keyboard here</technical_language>

Target:
public void onDetach() { super.onDetach(); mLoginListener = null; if (mGoogleApiClient.isConnected()) { mGoogleApiClient.stopAutoManage(getActivity()); mGoogleApiClient.disconnect(); } }
Source:
<code>public List<PredefinedCalendarConfiguration> getAvailablePredefinedCalendarConfigurations(PortletRequest request) { final String username = getUsername(request); if (username != null) { return calendarStore.getPredefinedCalendarConfigurations(username, false); } else { <START> return new ArrayList<PredefinedCalendarConfiguration>(); <END> } }</code><technical_language>Log error</technical_language>

Target:
public List<PredefinedCalendarConfiguration> getAvailablePredefinedCalendarConfigurations(PortletRequest request) { final String username = getUsername(request); if (username != null) { return calendarStore.getPredefinedCalendarConfigurations(username, false); } else { log.warn("username is null -- returning empty calendar configuration list"); return new ArrayList<PredefinedCalendarConfiguration>(); } }
Source:
<code>public void shouldNotContinueWithConfigSaveIfUserIsUnauthorized() { when(goConfigService.isUserAdmin(currentUser)).thenReturn(false); when(goConfigService.isGroupAdministrator(currentUser.getUsername())).thenReturn(false); SCM updatedScm = new SCM("id", new PluginConfiguration("plugin-id", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("key1"),new ConfigurationValue("value1")))); UpdateSCMConfigCommand command = new UpdateSCMConfigCommand(updatedScm, pluggableScmService, goConfigService, currentUser, result, "md5", entityHashingService); assertThat(command.canContinue(cruiseConfig), is(false)); <START> } <END></code><technical_language>assert result object -- assertFalse(result.isSuccessful()) assertThat(result.toString(), containsString("UNAUTHORIZED_TO_EDIT"));</technical_language>

Target:
public void shouldNotContinueWithConfigSaveIfUserIsUnauthorized() { when(goConfigService.isUserAdmin(currentUser)).thenReturn(false); when(goConfigService.isGroupAdministrator(currentUser.getUsername())).thenReturn(false); SCM updatedScm = new SCM("id", new PluginConfiguration("plugin-id", "1"), new Configuration(new ConfigurationProperty(new ConfigurationKey("key1"),new ConfigurationValue("value1")))); UpdateSCMConfigCommand command = new UpdateSCMConfigCommand(updatedScm, pluggableScmService, goConfigService, currentUser, result, "md5", entityHashingService); assertThat(command.canContinue(cruiseConfig), is(false)); assertThat(result.toString(), containsString("UNAUTHORIZED_TO_EDIT")); }
Source:
<code><START> public void removeCustomizedView(List<String> resourceNames) { <END> for (String resourceName : resourceNames) { _customizedViewCache.remove(resourceName); } }</code><technical_language>Do need sync control map operations here</technical_language>

Target:
public synchronized void removeCustomizedView(List<String> resourceNames) { for (String resourceName : resourceNames) { _customizedViewCache.remove(resourceName); } }
Source:
<code>public void createApplicationContextFrom_validBuilderContext_shouldCreateAnApplicationContext() { <START> KasperPlatformConfiguration platformConfiguration = new KasperPlatformConfiguration(); <END> final Platform.BuilderContext builderContext = new Platform.BuilderContext( platformConfiguration.configuration(), platformConfiguration.eventBus(), platformConfiguration.commandGateway(), platformConfiguration.queryGateway(), platformConfiguration.metricRegistry(), Maps.<Platform.ExtraComponentKey, Object>newHashMap() ); ApplicationContext applicationContext = BuilderContextHelper.createApplicationContextFrom(builderContext); assertNotNull(applicationContext); assertEquals(platformConfiguration.configuration(), applicationContext.getBean(Config.class)); assertEquals(platformConfiguration.eventBus(), applicationContext.getBean(EventBus.class)); assertEquals(platformConfiguration.commandGateway(), applicationContext.getBean(CommandGateway.class)); assertEquals(platformConfiguration.queryGateway(), applicationContext.getBean(QueryGateway.class)); assertEquals(platformConfiguration.metricRegistry(), applicationContext.getBean(MetricRegistry.class)); }</code><technical_language>platformConfiguration final</technical_language>

Target:
public void createApplicationContextFrom_validBuilderContext_shouldCreateAnApplicationContext() { final KasperPlatformConfiguration platformConfiguration = new KasperPlatformConfiguration(); final Platform.BuilderContext builderContext = new Platform.BuilderContext( platformConfiguration.configuration(), platformConfiguration.eventBus(), platformConfiguration.commandGateway(), platformConfiguration.queryGateway(), platformConfiguration.metricRegistry(), Maps.<Platform.ExtraComponentKey, Object>newHashMap() ); final ApplicationContext applicationContext = BuilderContextHelper.createApplicationContextFrom(builderContext); assertNotNull(applicationContext); assertEquals(platformConfiguration.configuration(), applicationContext.getBean(Config.class)); assertEquals(platformConfiguration.eventBus(), applicationContext.getBean(EventBus.class)); assertEquals(platformConfiguration.commandGateway(), applicationContext.getBean(CommandGateway.class)); assertEquals(platformConfiguration.queryGateway(), applicationContext.getBean(QueryGateway.class)); assertEquals(platformConfiguration.metricRegistry(), applicationContext.getBean(MetricRegistry.class)); }
Source:
<code>private static boolean isHtmlTag(TagNode node) { <START> return "HTML".equalsIgnoreCase(node.getLocalName()); <END> }</code><technical_language>also, I getLocalName is necessary, want issue html tag, want consider other tag library a html tag element (<myTagLib:html>). Comparing full name getNodeName is sufficient</technical_language>

Target:
private static boolean isHtmlTag(TagNode node) { return "HTML".equalsIgnoreCase(node.getNodeName()); }
Source:
<code>private void init() { this.parent = getParent(); list.add(new PhantomReference(this, referenceQueue)); <START> INSTANCE_COUNT.set(INSTANCE_COUNT.get() + 1); <END> system = this.getClass().getClassLoader(); END SJSAS 6317864 securityManager = System.getSecurityManager(); if (securityManager != null) { refreshPolicy(); } addOverridablePackage("com.sun.faces.extensions"); permissionsHolder = new PermsHolder(); }</code><technical_language>This thread safe too</technical_language>

Target:
private void init() { this.parent = getParent(); system = this.getClass().getClassLoader(); END SJSAS 6317864 securityManager = System.getSecurityManager(); if (securityManager != null) { refreshPolicy(); } addOverridablePackage("com.sun.faces.extensions"); permissionsHolder = new PermsHolder(); }
Source:
<code><START> synchronized static public void init(){ <END> if( map == null ) { map = new HashMap<CtfTmfTrace, CtfIteratorViceManager>(); } }</code><technical_language>Pedantic mode again, do "public static synchronized". "public synchronized static". API visibility is important modifier</technical_language>

Target:
public static synchronized void init() { if (map == null) { map = new HashMap<CtfTmfTrace, CtfTraceManager>(); } }
Source:
<code>public ListenableFuture<Response> request(final HeliosRequest request) { final HeliosRequest req; final String authHeader = authProvider.currentAuthorization(); if (authHeader != null) { <START> req = request.toBuilder().header(HttpHeaders.AUTHORIZATION, authHeader).build(); <END> } else { req = request; } return Futures.transform(delegate.request(req), new AsyncFunction<Response, Response>() { @Override public ListenableFuture<Response> apply(final Response response) throws Exception { if (response != null && response.status() == HTTP_UNAUTHORIZED && response.header(HttpHeaders.WWW_AUTHENTICATE) != null) { return authenticateAndRetry(req, response); } else { return immediateFuture(response); } } }); }</code><technical_language>break request.toBuilder().header(HttpHeaders.AUTHORIZATION, authHeader).build(); method call long chain is a hard read</technical_language>

Target:
public ListenableFuture<Response> request(final HeliosRequest request) { final HeliosRequest req; final String authHeader = authProvider.currentAuthorizationHeader(); if (authHeader != null) { req = request.toBuilder().header(HttpHeaders.AUTHORIZATION, authHeader).build(); } else { req = request; } return Futures.transform(delegate.request(req), new AsyncFunction<Response, Response>() { @Override public ListenableFuture<Response> apply(final Response response) throws Exception { if (response != null && response.status() == HTTP_UNAUTHORIZED && response.header(HttpHeaders.WWW_AUTHENTICATE) != null) { return authenticateAndRetry(req, response); } else { return immediateFuture(response); } } }); }
Source:
<code><START> private boolean canVmNumaPinnedToVds(VM vm, List<VmNumaNode> nodes, VDS vds) { <END> List<VdsNumaNode> pNodes = DbFacade.getInstance().getVdsNumaNodeDAO().getAllVdsNumaNodeByVdsId(vds.getId()); if (pNodes == null || pNodes.isEmpty()) { return false; } Map<Integer, VdsNumaNode> indexMap = toMap(pNodes); for (VmNumaNode vNode : nodes) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vNode.getVdsNumaNodeList()) { if (pair.getSecond() != null && pair.getSecond().getFirst()) { if (vNode.getMemTotal() > indexMap.get(vNode.getIndex()).getNumaNodeStatistics().getMemFree()) { return false; } } } } return true; }</code><technical_language>This another 'black hole' explain ruled out. improved on</technical_language>

Target:
private boolean canVmNumaPinnedToVds(VM vm, List<VmNumaNode> nodes, VDS vds) { List<VdsNumaNode> pNodes = DbFacade.getInstance().getVdsNumaNodeDAO().getAllVdsNumaNodeByVdsId(vds.getId()); if (pNodes == null || pNodes.isEmpty()) { return false; } Map<Integer, VdsNumaNode> indexMap = toMap(pNodes); for (VmNumaNode vNode : nodes) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vNode.getVdsNumaNodeList()) { if (pair.getSecond() != null && pair.getSecond().getFirst()) { if (vNode.getMemTotal() > indexMap.get(pair.getSecond().getSecond()) .getNumaNodeStatistics() .getMemFree()) { return false; } } } } return true; }
Source:
<code>private static AbstractHandleClient getHandleServiceClient( final URL handleServiceUrl, final AuthToken handleMgrToken, final InitReporter rep) { final AbstractHandleClient cli; try { cli = new AbstractHandleClient( handleServiceUrl, handleMgrToken); if (handleServiceUrl.getProtocol().equals("http")) { rep.reportInfo("Warning - the Handle Service url uses insecure http. " + "https is recommended."); cli.setIsInsecureHttpConnectionAllowed(true); } <START> cli.isOwner(Arrays.asList("KBH_-100")); <END> } catch (Exception e) { rep.reportFail("Could not establish a connection to the Handle Service at " + handleServiceUrl + ": " + e.getMessage()); return null; } return cli; }</code><technical_language>service handle it</technical_language>

Target:
private static AbstractHandleClient getHandleServiceClient( final URL handleServiceUrl, final AuthToken handleMgrToken, final InitReporter rep) { final AbstractHandleClient cli; try { cli = new AbstractHandleClient( handleServiceUrl, handleMgrToken); if (handleServiceUrl.getProtocol().equals("http")) { rep.reportInfo("Warning - the Handle Service url uses insecure http. " + "https is recommended."); cli.setIsInsecureHttpConnectionAllowed(true); } cli.isOwner(Arrays.asList("FAKEHANDLE_-100")); } catch (Exception e) { rep.reportFail("Could not establish a connection to the Handle Service at " + handleServiceUrl + ": " + e.getMessage()); return null; } return cli; }
Source:
<code>public Page getOutput() { if (split == null) { return null; } if (source == null) { source = pageSourceProvider.createPageSource(operatorContext.getSession(), split, table, columns); } Page page = source.getNextPage(); if (page != null) { page = page.getLoadedPage(); long endCompletedBytes = source.getCompletedBytes(); long endCompletedPositions = source.getCompletedPositions(); if (endCompletedPositions < 0) { <START> endCompletedPositions = completedPositions + page.getPositionCount(); <END> } long endReadTimeNanos = source.getReadTimeNanos(); operatorContext.recordRawInputWithTiming(endCompletedBytes - completedBytes, endReadTimeNanos - readTimeNanos); operatorContext.recordProcessedInput(endCompletedBytes - completedBytes, endCompletedPositions - completedPositions); completedBytes = endCompletedBytes; completedPositions = endCompletedPositions; readTimeNanos = endReadTimeNanos; } systemMemoryContext.setBytes(source.getSystemMemoryUsage()); return page; }</code><technical_language>understand -- statement true</technical_language>

Target:
public Page getOutput() { if (split == null) { return null; } if (source == null) { source = pageSourceProvider.createPageSource(operatorContext.getSession(), split, table, columns); } Page page = source.getNextPage(); if (page != null) { page = page.getLoadedPage(); long endCompletedBytes = source.getCompletedBytes(); long endCompletedPositions = source.getCompletedPositions(); long endReadTimeNanos = source.getReadTimeNanos(); operatorContext.recordRawInputWithTiming(endCompletedBytes - completedBytes, endCompletedPositions - completedPositions, endReadTimeNanos - readTimeNanos); operatorContext.recordProcessedInput(page.getSizeInBytes(), page.getPositionCount()); completedBytes = endCompletedBytes; completedPositions = endCompletedPositions; readTimeNanos = endReadTimeNanos; } systemMemoryContext.setBytes(source.getSystemMemoryUsage()); return page; }
Source:
<code>public String getUuidProperty() { <START> return getObject().getIdentifierType().getUuid(); <END> }</code><technical_language>i above, uuid class instead of of of children</technical_language>

Target:
public String getUuidProperty() { return getObject().getUuid(); }
Source:
<code>public void shouldReturnAllFoundTags() throws Exception { Tag foundTag = TestTagBuilder.aTag().build(); when(tagServiceMock.findAll()).thenReturn(asList(foundTag)); mockMvc.perform(get("/api/v1/tags") .accept(APPLICATION_JSON_UTF8)).andDo(print()) .andExpect(status().isOk()) .andExpect(content().contentType(APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$[0]." + ID).value(is(((int) foundTag.getId())))) .andExpect(jsonPath("$[0].name").value(is(foundTag.getName()))) <START> .andExpect(jsonPath("$[0].links", hasSize(0))); <END> verify(tagServiceMock, times(1)).findAll(); verifyNoMoreInteractions(tagServiceMock); }</code><technical_language>1 link</technical_language>

Target:
public void shouldReturnAllFoundTags() throws Exception { Tag foundTag = TestTagBuilder.aTag().build(); when(tagServiceMock.findAll()).thenReturn(asList(foundTag)); mockMvc.perform(get("/api/v1/tags") .accept(APPLICATION_JSON_UTF8)) .andExpect(status().isOk()) .andExpect(content().contentType(APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$[0]." + ID).value(is(((int) foundTag.getId())))) .andExpect(jsonPath("$[0].name").value(is(foundTag.getName()))) .andExpect(jsonPath("$[0].links", hasSize(2))) .andExpect(jsonPath("$[0].links[0].rel").value(is(Link.REL_SELF))) .andExpect(jsonPath("$[0].links[0].href").value(containsString("/api/v1/tags/" + foundTag.getId()))) .andExpect(jsonPath("$[0].links[1].rel").value(is(TagResourceAsm.IDEAS_REL))) .andExpect(jsonPath("$[0].links[1].href").value(containsString("/api/v1/tags/" + foundTag.getId() + "/ideas"))); verify(tagServiceMock, times(1)).findAll(); verifyNoMoreInteractions(tagServiceMock); }
Source:
<code>public String toString() { return "SubscriptionCalculator{" + "price=" + price + ", subscriptions=" + subscriptions + <START> "} " + super.toString(); <END> }</code><technical_language>super.toString()</technical_language>

Target:
public String toString() { return "SubscriptionCalculator{" + "price=" + price + ", subscriptions=" + subscriptions + "}"; }
Source:
<code>public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; ChangeControl cControl = StoredValues.CHANGE_CONTROL.get(engine); CurrentUser curUser = cControl.getCurrentUser(); Term resultTerm; if (curUser instanceof IdentifiedUser) { Account.Id id = ((IdentifiedUser)curUser).getAccountId(); resultTerm = new IntegerTerm(id.get()); } else if (curUser instanceof AnonymousUser) { resultTerm = anonymous; } else if (curUser instanceof PeerDaemonUser) { resultTerm = peerDaemon; } else if (curUser instanceof ReplicationUser) { <START> resultTerm = SymbolTerm.intern("replication"); <END> } else { throw new EvaluationException("Unknown user type"); } if (!a1.unify(new StructureTerm(user, resultTerm), engine.trail)) { return engine.fail(); } return cont; }</code><technical_language>this a private static final</technical_language>

Target:
public Operation exec(Prolog engine) throws PrologException { engine.setB0(); Term a1 = arg1.dereference(); PrologEnvironment env = (PrologEnvironment) engine.control; ChangeControl cControl = StoredValues.CHANGE_CONTROL.get(engine); CurrentUser curUser = cControl.getCurrentUser(); Term resultTerm; if (curUser instanceof IdentifiedUser) { Account.Id id = ((IdentifiedUser)curUser).getAccountId(); resultTerm = new IntegerTerm(id.get()); } else if (curUser instanceof AnonymousUser) { resultTerm = anonymous; } else if (curUser instanceof PeerDaemonUser) { resultTerm = peerDaemon; } else if (curUser instanceof ReplicationUser) { resultTerm = replication; } else { throw new EvaluationException("Unknown user type"); } if (!a1.unify(new StructureTerm(user, resultTerm), engine.trail)) { return engine.fail(); } return cont; }
Source:
<code>public Direction calculateDirection(Entity entity) { if (provider instanceof Block) { Optional<RayTracer.RayTraceBlockResult> hit = new RayTracer(entity) .setDistance(7) .rayTraceBlocks(entity.world()) .filter(res -> res.block != provider) .findFirst(); if (hit.isPresent()) { Direction dir = (isFlip) ? hit.get().side.opposite() : hit.get().side; <START> return rotationMask.test(dir) ? dir : calculateDirectionFromEntity(entity); <END> } } return Direction.UNKNOWN; }</code><technical_language>another version. I guess a tad cleaner. java /** * Calculates direction raytracing * @param entity entity start raytracing * @return side of block is hit raytracing */ public Direction calculateDirection(Entity entity) { if (provider instanceof Block) { return new RayTracer(entity) .setDistance(7) .rayTraceBlocks(entity.world()) .filter(res -> res.block != provider) .findFirst() .map(hit -> { Direction dir = isFlip ? hit.side.opposite() : hit.side; return rotationMask.test(dir) ? dir : calculateDirectionFromEntity(entity); }) .orElse(Direction.UNKNOWN); } else { return Direction.UNKNOWN; } }</technical_language>

Target:
public Direction calculateDirection(Entity entity) { if (provider instanceof Block) { return new RayTracer(entity) .setDistance(7) .rayTraceBlocks(entity.world()) .filter(res -> res.block != provider) .findFirst() .map(hit -> isFlip ? hit.side.opposite() : hit.side) .map(dir -> rotationFilter.test(dir) ? dir : calculateDirectionFromEntity(entity)) .orElse(Direction.UNKNOWN); } else { return Direction.UNKNOWN; } }
Source:
<code>public String getId() { <START> return RestoreRedundancyFunction.ID; <END> }</code><technical_language>need RestoreRedundancyFunction. qualifier</technical_language>

Target:
public String getId() { return ID; }
Source:
<code>private void insertReferencesToYears(HashMap<Integer, String> years, int ownYear, DigitalDocumentInterface act, PrefsInterface ruleSet) <START> throws TypeNotAllowedForParentException, MetadataTypeNotAllowedException, TypeNotAllowedAsChildException { <END> for (Map.Entry<Integer, String> year : years.entrySet()) { if (year.getKey() != ownYear) { DocStructInterface child = getOrCreateChild(act.getLogicalDocStruct(), yearLevelName, MetsModsImportExportInterface.CREATE_LABEL_ATTRIBUTE_TYPE, year.getKey().toString(), MetsModsImportExportInterface.CREATE_ORDERLABEL_ATTRIBUTE_TYPE, act, ruleSet); child.addMetadata(MetsModsImportExportInterface.CREATE_MPTR_ELEMENT_TYPE, year.getValue()); } } }</code><technical_language>TypeNotAllowedForParentException - exception</technical_language>

Target:
private void insertReferencesToYears(HashMap<Integer, String> years, int ownYear, DigitalDocumentInterface act, PrefsInterface ruleSet) throws MetadataTypeNotAllowedException, TypeNotAllowedAsChildException { for (Map.Entry<Integer, String> year : years.entrySet()) { if (year.getKey() != ownYear) { DocStructInterface child = getOrCreateChild(act.getLogicalDocStruct(), yearLevelName, MetsModsImportExportInterface.CREATE_LABEL_ATTRIBUTE_TYPE, year.getKey().toString(), MetsModsImportExportInterface.CREATE_ORDERLABEL_ATTRIBUTE_TYPE, act, ruleSet); child.addMetadata(MetsModsImportExportInterface.CREATE_MPTR_ELEMENT_TYPE, year.getValue()); } } }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent){ if (convertView == null){ LayoutInflater inflater = LayoutInflater.from(mContext); convertView = inflater.inflate(R.layout.item_snooze, parent, false); } TextView title = (TextView)convertView; if (position == 0){ title.setText("In an hour"); } else if (position == 1){ title.setText("This time tomorrow"); } else if (position == 2){ title.setText("Pick a date and time"); <START> } <END> return convertView; }</code><technical_language>for 3 text strings</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent){ if (convertView == null){ LayoutInflater inflater = LayoutInflater.from(mContext); convertView = inflater.inflate(R.layout.item_snooze, parent, false); } TextView title = (TextView)convertView; if (position == 0){ title.setText(R.string.later_in_an_hour); } else if (position == 1){ title.setText(R.string.later_tomorrow); } else if (position == 2){ title.setText(R.string.later_pick); } return convertView; }
Source:
<code>public void shouldNotAlertIfResponseIsJsonOrXml(String contentType) throws Exception { <START> nano.addHandler(new MiscOkResponse(" END> HttpMessage message = getHttpMessage(URL); rule.init(message, parent); rule.scan(); assertThat(alertsRaised, hasSize(0)); }</code><technical_language>path meant URL? (It's giving 404 otherwise.)</technical_language>

Target:
public void shouldNotAlertIfResponseIsJsonOrXml(String contentType) throws Exception { nano.addHandler(new MiscOkResponse(URL, contentType)); HttpMessage message = getHttpMessage(URL); rule.init(message, parent); rule.scan(); assertThat(alertsRaised, hasSize(0)); }
Source:
<code>protected ViewModel onValidSubmit(HttpServletRequest request, HttpServletResponse response, Form form) { Application application = (Application) request.getAttribute(Application.class.getName()); String email = form.getFieldValue("email"); Map<String, Object> model = new HashMap<String, Object>(); try { request.setAttribute("form", form); AccountStore accountStore = accountStoreResolver.getAccountStore(request, response); if (accountStore != null) { application.sendPasswordResetEmail(email, accountStore); } else { application.sendPasswordResetEmail(email); } } catch (ResourceException e) { if (e.getCode() != 404) { <START> if (UserAgents.get(request).isJsonPreferred()) { <END> model.put("status", 200); model.put("message", "OK"); return new DefaultViewModel("stormpathJsonView", model); } throw e; } } if (UserAgents.get(request).isJsonPreferred()) { model.put("status", 200); model.put("message", "OK"); return new DefaultViewModel("stormpathJsonView", model); } return new DefaultViewModel(nextUri).setRedirect(true); }</code><technical_language>This ContentNegotiationReslver</technical_language>

Target:
protected ViewModel onValidSubmit(HttpServletRequest request, HttpServletResponse response, Form form) { Application application = (Application) request.getAttribute(Application.class.getName()); String email = form.getFieldValue("email"); Map<String, Object> model = new HashMap<String, Object>(); try { request.setAttribute("form", form); AccountStore accountStore = accountStoreResolver.getAccountStore(request, response); if (accountStore != null) { application.sendPasswordResetEmail(email, accountStore); } else { application.sendPasswordResetEmail(email); } } catch (ResourceException e) { if (isJsonPreferred(request, response)) { model.put("status", 200); model.put("message", "OK"); return new DefaultViewModel("stormpathJsonView", model); } } if (isJsonPreferred(request, response)) { model.put("status", 200); model.put("message", "OK"); return new DefaultViewModel("stormpathJsonView", model); } return new DefaultViewModel(nextUri).setRedirect(true); }
Source:
<code>public void setEndUserCreatedAt(long createdAt) { <START> if (createdAt > 9999999999L) { <END> Log.d(TAG, "WARNING: The created date exceeds the maximum 10 characters allowed. " + "If you are using System.currentTimeMillis() divide it by 1000."); } endUser.setCreatedAt(createdAt); }</code><technical_language>Hmm convert a date valid is in future</technical_language>

Target:
public void setEndUserCreatedAt(long createdAt) { Utils.checkDate(createdAt); endUser.setCreatedAt(createdAt); }
Source:
<code>public void testActivateAppUnknownApp() throws Exception { App app = when(mock(App.class).isActive()).thenReturn(false).getMock(); MvcResult result = mockMvc.perform(post(AppsController.URI + "/id/activate")).andReturn(); <START> assertEquals(result.getResolvedException().getMessage(), "Unknown app 'id'"); <END> }</code><technical_language>check exception class parameters, message user</technical_language>

Target:
public void testActivateAppUnknownApp() throws Exception { App app = when(mock(App.class).isActive()).thenReturn(false).getMock(); MvcResult result = mockMvc.perform(post(AppsController.URI + "/id/activate")).andReturn(); throw result.getResolvedException(); }
Source:
<code>protected static String buildAggregatesClause(PageProvider provider) { try { Properties namedParameters = (Properties) provider.getSearchDocumentModel() .getContextData(NAMED_PARAMETERS); Map<String, Aggregate<? extends Bucket>> aggregates = provider.getAggregates(); if (namedParameters == null) { <START> return null; <END> } String aggregatesClause = ""; for (Aggregate<? extends Bucket> aggregate : aggregates.values()) { if (namedParameters.containsKey(aggregate.getId())) { JsonNode node = OBJECT_MAPPER.readTree(namedParameters.get(aggregate.getId())); List<String> keys = StreamSupport.stream(node.spliterator(), false) .map(value -> value.asText().replaceAll("^\"|\"$", "")) .collect(Collectors.toList()); String aggClause = aggregate.getBuckets() .stream() .filter(bucket -> keys.contains(bucket.getKey())) .map(bucket -> getClauseFromBucket(bucket, aggregate.getXPathField())) .collect(Collectors.joining(" OR ")); if (StringUtils.isNotEmpty(aggClause)) { aggClause = "(" + aggClause + ")"; aggregatesClause = StringUtils.isEmpty(aggregatesClause) ? aggClause : NXQLQueryBuilder.appendClause(aggregatesClause, aggClause); } } } return aggregatesClause; } catch (IOException e) { throw new NuxeoException(e); } }</code><technical_language>impact returning null instead of "" previously? early exit line before</technical_language>

Target:
protected static String buildAggregatesClause(PageProvider provider) { try { Properties namedParameters = (Properties) provider.getSearchDocumentModel() .getContextData(NAMED_PARAMETERS); if (namedParameters == null) { return ""; } Map<String, Aggregate<? extends Bucket>> aggregates = provider.getAggregates(); String aggregatesClause = ""; for (Aggregate<? extends Bucket> aggregate : aggregates.values()) { if (namedParameters.containsKey(aggregate.getId())) { JsonNode node = OBJECT_MAPPER.readTree(namedParameters.get(aggregate.getId())); List<String> keys = StreamSupport.stream(node.spliterator(), false) .map(value -> value.asText().replaceAll("^\"|\"$", "")) .collect(Collectors.toList()); String aggClause = aggregate.getBuckets() .stream() .filter(bucket -> keys.contains(bucket.getKey())) .map(bucket -> getClauseFromBucket(bucket, aggregate.getXPathField())) .collect(Collectors.joining(" OR ")); if (StringUtils.isNotEmpty(aggClause)) { aggClause = "(" + aggClause + ")"; aggregatesClause = StringUtils.isEmpty(aggregatesClause) ? aggClause : NXQLQueryBuilder.appendClause(aggregatesClause, aggClause); } } } return aggregatesClause; } catch (IOException e) { throw new NuxeoException(e); } }
Source:
<code>private void writeRewrittenHashes() throws RevisionSyntaxException, IOException, RefNotFoundException { File currentCommitFile = rebaseState.getFile(CURRENT_COMMIT); if (!currentCommitFile.exists()) return; <START> ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) { headId = getHead().getObjectId(); } <END> String head = headId.getName(); String currentCommits = rebaseState.readFile(CURRENT_COMMIT); for (String current : currentCommits.split("\n")) RebaseState .createFile(rebaseState.getRewrittenDir(), current, head); FileUtils.delete(currentCommitFile); }</code><technical_language>This happen in step: ObjectId = getHead().getObjectId(); (resolve() is able avoid creating a Ref this is simple resolve scenes)</technical_language>

Target:
private void writeRewrittenHashes() throws RevisionSyntaxException, IOException, RefNotFoundException { File currentCommitFile = rebaseState.getFile(CURRENT_COMMIT); if (!currentCommitFile.exists()) return; ObjectId headId = getHead().getObjectId(); String head = headId.getName(); String currentCommits = rebaseState.readFile(CURRENT_COMMIT); for (String current : currentCommits.split("\n")) RebaseState .createFile(rebaseState.getRewrittenDir(), current, head); FileUtils.delete(currentCommitFile); }
Source:
<code>public JSONObject changePoolIdBarcode(HttpSession session, JSONObject json) { Long poolId = json.getLong("poolId"); String idBarcode = json.getString("identificationBarcode"); try { if (!"".equals(idBarcode)) { <START> Pool pool = requestManager.getPoolById(poolId); <END> pool.setIdentificationBarcode(idBarcode); requestManager.savePool(pool); } else { return JSONUtils.SimpleJSONError("New identification barcode not recognized"); } } catch (IOException e) { e.printStackTrace(); return JSONUtils.SimpleJSONError(e.getMessage()); } return JSONUtils.SimpleJSONResponse("New identification barcode successfully assigned."); }</code><technical_language>This warning Plate is a raw type. References generic type Plate<T,S> parameterized</technical_language>

Target:
public JSONObject changePoolIdBarcode(HttpSession session, JSONObject json) { Long poolId = json.getLong("poolId"); String idBarcode = json.getString("identificationBarcode"); try { if (!isStringEmptyOrNull(idBarcode)) { Pool<? extends Poolable> pool = requestManager.getPoolById(poolId); pool.setIdentificationBarcode(idBarcode); requestManager.savePool(pool); } else { return JSONUtils.SimpleJSONError("New identification barcode not recognized"); } } catch (IOException e) { log.debug("Could not change Pool identificationBarcode: " + e.getMessage()); e.printStackTrace(); return JSONUtils.SimpleJSONError(e.getMessage()); } return JSONUtils.SimpleJSONResponse("New identification barcode successfully assigned."); }
Source:
<code>public final int doPhase2Commit () { if (jtsLogger.logger.isTraceEnabled()) { jtsLogger.logger.trace("ServerTransaction::doPhase2Commit ( " + get_uid() + " )"); } org.omg.CosTransactions.Status s = get_status(); if (s == org.omg.CosTransactions.Status.StatusCommitting || s == org.omg.CosTransactions.Status.StatusCommitted) { <START> TransactionCache.ReplayPhaseReturnStatus replayStatus = TransactionCache.replayPhase2(get_uid(), type()); <END> if(replayStatus == TransactionCache.ReplayPhaseReturnStatus.NONE) { return ActionStatus.COMMITTING; } } if (s != org.omg.CosTransactions.Status.StatusPrepared) { jtsLogger.i18NLogger.warn_orbspecific_interposition_coordinator_txnotprepared("ServerTransaction.doPhase2Commit", Utility.stringStatus(s)); return finalStatus(); } super.phase2Commit(true); if (super.failedList != null && super.failedList.size() > 0) { return ActionStatus.COMMITTING; } try { doAfterCompletion(get_status()); } catch (Exception e) { } if (parentTransaction != null) parentTransaction.removeChildAction(this); super.destroyAction(); ActionManager.manager().remove(get_uid()); return finalStatus(); }</code><technical_language>I need some more this. I hoping this TransactionCache call XATerminator called classes, i.e.: <LINK_0></technical_language>

Target:
public final int doPhase2Commit () { if (jtsLogger.logger.isTraceEnabled()) { jtsLogger.logger.trace("ServerTransaction::doPhase2Commit ( " + get_uid() + " )"); } org.omg.CosTransactions.Status s = get_status(); if (s != org.omg.CosTransactions.Status.StatusPrepared) { jtsLogger.i18NLogger.warn_orbspecific_interposition_coordinator_txnotprepared("ServerTransaction.doPhase2Commit", Utility.stringStatus(s)); return finalStatus(); } super.phase2Commit(true); if (super.failedList != null && super.failedList.size() > 0) { return ActionStatus.COMMITTING; } try { doAfterCompletion(get_status()); } catch (Exception e) { } if (parentTransaction != null) parentTransaction.removeChildAction(this); super.destroyAction(); ActionManager.manager().remove(get_uid()); return finalStatus(); }
Source:
<code>public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { List<String> tservers; String filterText = null; final InstanceOperations instanceOps = shellState.getConnector().instanceOperations(); final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt()); if (cl.hasOption(tserverOption.getOpt())) { tservers = new ArrayList<>(); tservers.add(cl.getOptionValue(tserverOption.getOpt())); } else { tservers = instanceOps.getTabletServers(); } if (cl.hasOption(filterOption.getOpt())) { filterText = cl.getOptionValue(filterOption.getOpt()); } Iterator<String> activeCompactionIterator = new ActiveCompactionIterator(tservers, instanceOps); if (filterText != null) { String finalFilterText = filterText; activeCompactionIterator = Iterators.filter(activeCompactionIterator, <START> t -> t.contains(finalFilterText)); <END> } shellState.printLines(activeCompactionIterator, paginate); return 0; }</code><technical_language>do a regex instead of contains</technical_language>

Target:
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState) throws Exception { List<String> tservers; String filterText = null; final InstanceOperations instanceOps = shellState.getConnector().instanceOperations(); final boolean paginate = !cl.hasOption(disablePaginationOpt.getOpt()); if (cl.hasOption(tserverOption.getOpt())) { tservers = new ArrayList<>(); tservers.add(cl.getOptionValue(tserverOption.getOpt())); } else { tservers = instanceOps.getTabletServers(); } if (cl.hasOption(filterOption.getOpt())) { filterText = ".*" + cl.getOptionValue(filterOption.getOpt()) + ".*"; } Iterator<String> activeCompactionIterator = new ActiveCompactionIterator(tservers, instanceOps); if (filterText != null) { String finalFilterText = filterText; activeCompactionIterator = Iterators.filter(activeCompactionIterator, t -> t.matches(finalFilterText)); } shellState.printLines(activeCompactionIterator, paginate); return 0; }
Source:
<code>public void shouldCreateOrderForValidTokenAndThreeDS() { OrderRequest orderRequest = createOrderRequestWithThreeDS(); orderRequest.setToken(createToken()); OrderResponse response = orderService.create(orderRequest); assertThat(response.getOrderCode(), is(notNullValue())); <START> assertThat(response.getAmount(), is(1999)); <END> assertThat(response.getKeyValueResponse().getCustomerIdentifiers(), is(notNullValue())); assertThat("Response code", response.getOrderCode(), is(notNullValue())); assertThat("Amount", response.getAmount(), is(1999)); assertThat("Customer identifier", response.getKeyValueResponse().getCustomerIdentifiers(), is(notNullValue())); }</code><technical_language>999 is repeated</technical_language>

Target:
public void shouldCreateOrderForValidTokenAndThreeDS() { OrderRequest orderRequest = createOrderRequestWithThreeDS(); orderRequest.setToken(createToken()); OrderResponse response = orderService.create(orderRequest); assertThat("Response code", response.getOrderCode(), is(notNullValue())); assertThat("Amount", response.getAmount(), is(1999)); assertThat("Customer identifier", response.getKeyValueResponse().getCustomerIdentifiers(), is(notNullValue())); }
Source:
<code>public byte[] serialize(String topic, StreamlineEvent streamlineEvent) { SchemaMetadata schemaMetadata = Utils.getSchemaKey(topic, false); SchemaVersionInfo schemaVersionInfo; try { <START> schemaMetadata = this.schemaRegistryClient.getSchemaMetadataInfo(schemaMetadata.getName()).getSchemaMetadata(); <END> schemaVersionInfo = this.schemaRegistryClient.getLatestSchemaVersionInfo(schemaMetadata.getName()); } catch (SchemaNotFoundException e) { LOG.error("Exception occured while getting SchemaVersionInfo for " + schemaMetadata, e); throw new RuntimeException(e); } if (streamlineEvent == null || streamlineEvent.isEmpty()) { return null; } else { return avroSnapshotSerializer.serialize(getAvroGenericRecord(streamlineEvent, schemaVersionInfo.getSchemaText()), schemaMetadata); } }</code><technical_language>@priyank5485 assuming schema is registered? This return null if is registered yet</technical_language>

Target:
public byte[] serialize(String topic, StreamlineEvent streamlineEvent) { SchemaMetadata schemaMetadata = Utils.getSchemaKey(topic, false); SchemaVersionInfo schemaVersionInfo; try { schemaMetadata = this.schemaRegistryClient.getSchemaMetadataInfo(schemaMetadata.getName()).getSchemaMetadata(); schemaVersionInfo = this.schemaRegistryClient.getLatestSchemaVersionInfo(schemaMetadata.getName()); } catch (SchemaNotFoundException e) { LOG.error("Exception occured while getting SchemaVersionInfo for " + schemaMetadata, e); throw new RuntimeException(e); } if (streamlineEvent == null || streamlineEvent.isEmpty()) { return null; } else { return avroSnapshotSerializer.serialize(getAvroRecord(streamlineEvent, new Schema.Parser().parse(schemaVersionInfo.getSchemaText())), schemaMetadata); } }