auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public SpongeWireAttachmentData() { <START> this(ImmutableMap.of(Direction.NORTH, WireAttachmentTypes.NONE, <END> Direction.SOUTH, WireAttachmentTypes.NONE, Direction.EAST, WireAttachmentTypes.NONE, Direction.WEST, WireAttachmentTypes.NONE)); }</code><technical_language>This map stored in final static field referenced here</technical_language>

Target:
public SpongeWireAttachmentData() { this(SpongeWireAttachmentData.DEFAULTS); }
Source:
<code>protected <T> ListenableFuture<T> createHttpClient(Class<T> clientClass, int serverPort) throws TTransportException, InterruptedException, ExecutionException { HostAndPort address = HostAndPort.fromParts("localhost", serverPort); ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(new Duration(1, TimeUnit.SECONDS)) .setReadTimeout(new Duration(1, TimeUnit.SECONDS)) .setWriteTimeout(new Duration(1, TimeUnit.SECONDS)); HttpClientChannel.Factory channelFactory = <START> new HttpClientChannel.Factory("localhost:4567", "/thrift/"); <END> return new ThriftClient<>(clientManager, clientClass, channelFactory, config, "asyncTestClient").open(address); }</code><technical_language>"localhost:4567" is "hostAndPort" "hostName", mislead clients if this test example</technical_language>

Target:
protected <T> ListenableFuture<T> createHttpClient(Class<T> clientClass, int serverPort) throws TTransportException, InterruptedException, ExecutionException { HostAndPort address = HostAndPort.fromParts("localhost", serverPort); ThriftClientConfig config = new ThriftClientConfig().setConnectTimeout(new Duration(1, TimeUnit.SECONDS)) .setReadTimeout(new Duration(1, TimeUnit.SECONDS)) .setWriteTimeout(new Duration(1, TimeUnit.SECONDS)); HttpClientChannel.Factory channelFactory = new HttpClientChannel.Factory("localhost:4567", "/thrift/"); return new ThriftClient<>(clientManager, clientClass, config, "asyncTestClient", channelFactory).open(address); }
Source:
<code>public void closeInterstitial() throws InterruptedException { boolean isMercury = false; try { isMercury = interstitialCloseButtonMercury.isDisplayed(); PageObjectLogging.log("Interstitial Mercury", "Yes", true); } catch (NoSuchElementException e) { PageObjectLogging.log("Interstitial Mercury", "No", true); } if (isMercury) { String closeButtonText = interstitialCloseButtonMercury.getText(); if (closeButtonText.length() > 0) { Integer waitTillCloseButtonAppears = Integer.parseInt(closeButtonText); PageObjectLogging.log("Wait time for close button", String.valueOf(waitTillCloseButtonAppears), true); <START> Thread.sleep((waitTillCloseButtonAppears+2) * 1000); <END> } } wait.forElementClickable(interstitialCloseButton); interstitialCloseButton.click(); }</code><technical_language>2 from? ;-)</technical_language>

Target:
public void closeInterstitial() throws InterruptedException { boolean isMercury = false; try { isMercury = interstitialCloseButtonMercury.isDisplayed(); PageObjectLogging.log("Interstitial Mercury", "Yes", true); } catch (NoSuchElementException e) { PageObjectLogging.log("Interstitial Mercury", "No", true); } if (isMercury) { String closeButtonText = interstitialCloseButtonMercury.getText(); if (closeButtonText.length() > 0) { Integer waitTillCloseButtonAppears = Integer.parseInt(closeButtonText); PageObjectLogging.log("Wait time for close button", String.valueOf(waitTillCloseButtonAppears), true); Thread.sleep((waitTillCloseButtonAppears+WAIT_BUTTON_DELAY_TOLERANCE) * 1000); } } wait.forElementClickable(interstitialCloseButton); interstitialCloseButton.click(); }
Source:
<code>public static void main(String[] args) { if (args.length < 4) { System.out.println("Please specify your access key and voice call flow arguments"); return; } final MessageBirdService wsr = new MessageBirdServiceImpl(args[0]); final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr); final VoiceCallFlowRequest voiceCallFlow = new VoiceCallFlowRequest(); voiceCallFlow.setTitle(args[1]); <START> voiceCallFlow.setRecord(args[2]); <END> voiceCallFlow.setSteps(args[3]); voiceCallFlow.setDefaultCall(args[4]); try { System.out.println("Creting a Voice Call Flow"); messageBirdClient.sendVoiceCallFlow(voiceCallFlow); System.out.println("Voice call flow created"); } catch (GeneralException | UnauthorizedException exception) { exception.printStackTrace(); } }</code><technical_language>Records, steps default call fields conversion error. "args" string values some fields VoiceCallFlowRequest class not</technical_language>

Target:
public static void main(String[] args) { if (args.length < 2) { System.out.println("Please specify your access key and voice call flow arguments"); return; } final MessageBirdService wsr = new MessageBirdServiceImpl(args[0]); final MessageBirdClient messageBirdClient = new MessageBirdClient(wsr); final VoiceCallFlowRequest voiceCallFlowRequest = new VoiceCallFlowRequest(); voiceCallFlowRequest.setTitle(args[1]); voiceCallFlowRequest.setRecord(true); VoiceStep voiceStep = new VoiceStep(); voiceCallFlowRequest.setSteps(Collections.singletonList(voiceStep)); voiceCallFlowRequest.setDefaultCall(true); try { System.out.println("Creting a Voice Call Flow"); messageBirdClient.sendVoiceCallFlow(voiceCallFlowRequest); System.out.println("Voice call flow created"); } catch (GeneralException | UnauthorizedException exception) { exception.printStackTrace(); } }
Source:
<code><START> @Override public void setMessageChannel(MessageChannel channel) { <END> checkNotNull(channel, "channel"); this.channel = channel; }</code><technical_language>Add a new line @Override please :)</technical_language>

Target:
public void setMessageChannel(MessageChannel channel) { checkNotNull(channel, "channel"); this.channel = channel; }
Source:
<code>public static void closeSession(Session session, boolean flush) { if (session != null) { if (flush) { session.flush(); } <START> if (session.isOpen()) { <END> session.close(); } } }</code><technical_language>I handle HibernernateException</technical_language>

Target:
public static void closeSession(Session session, boolean flush) { if (session != null) { if (flush) { session.flush(); } if (session.isOpen()) { try { session.close(); } catch (HibernateException ex) { LOG.error("There an error while closing the hibernate-session: ", ex.getMessage(), ex); } } } }
Source:
<code>Replica(HardwareLayout hardwareLayout, Partition partition, JSONObject jsonObject) throws JSONException { <START> this.partition = partition; <END> this.disk = hardwareLayout.findDisk(jsonObject.getString("hostname"), jsonObject.getInt("port"), jsonObject.getString("mountPath")); ClusterMapConfig clusterMapConfig = hardwareLayout.getClusterMapConfig(); try { ResourceStatePolicyFactory resourceStatePolicyFactory = Utils.getObj(clusterMapConfig.clusterMapResourceStatePolicyFactory, this, HardwareState.AVAILABLE, clusterMapConfig); resourceStatePolicy = resourceStatePolicyFactory.getResourceStatePolicy(); } catch (Exception e) { logger.error("Error creating resource state policy when instantiating a replica " + e); throw new IllegalStateException("Error creating resource state policy when instantiating a replica " + partition, e); } validate(); }</code><technical_language>if possible, call other constructor in this this(partition, hardwareLayout.findDisk(jsonObject.getString("hostname"), jsonObject.getInt("port"), jsonObject.getString("mountPath")), hardwareLayout.getClusterMapConfig())</technical_language>

Target:
Replica(HardwareLayout hardwareLayout, Partition partition, JSONObject jsonObject) throws JSONException { this(partition, hardwareLayout.findDisk(jsonObject.getString("hostname"), jsonObject.getInt("port"), jsonObject.getString("mountPath")), hardwareLayout.getClusterMapConfig()); }
Source:
<code>private void setupMock() { clusterUtils = mock(ClusterUtils.class); vdsDao = mock(VdsDAO.class); volumeDao = mock(GlusterVolumeDao.class); brickDao = mock(GlusterBrickDao.class); doReturn(clusterUtils).when(getQuery()).getClusterUtils(); doReturn(getVds(VDSStatus.Up)).when(clusterUtils).getUpServer(CLUSTER_ID); doReturn(vdsDao).when(clusterUtils).getVdsDao(); doReturn(vdsDao).when(getQuery()).getVdsDao(); when(vdsDao.getAllForVdsGroupWithStatus(CLUSTER_ID, VDSStatus.Up)).thenReturn(Collections.singletonList(getVds(VDSStatus.Up))); when(vdsDao.get(SERVER_ID)).thenReturn(getVds(VDSStatus.Up)); doReturn(volumeDao).when(getQuery()).getGlusterVolumeDao(); when(volumeDao.getById(VOLUME_ID)).thenReturn(getVolume()); doReturn(brickDao).when(getQuery()).getGlusterBrickDao(); when(brickDao.getById(BRICK_ID)).thenReturn(getBrick()); doReturn(CLUSTER_ID).when(getQueryParameters()).getClusterId(); <START> doReturn(VOLUME_ID).when(getQueryParameters()).getVolumeId(); <END> doReturn(BRICK_ID).when(getQueryParameters()).getBrickId(); doReturn(true).when(getQueryParameters()).isDetailRequired(); VDSReturnValue returnValue = new VDSReturnValue(); returnValue.setSucceeded(true); returnValue.setReturnValue(expectedVolumeAdvancedDetails); doReturn(returnValue).when(getQuery()).runVdsCommand(eq(VDSCommandType.GetGlusterVolumeAdvancedDetails), any(VDSParametersBase.class)); }</code><technical_language>a test for brickId is null in parameters. volumeId null - getServiceInfo is tested</technical_language>

Target:
private void setupMock() { clusterUtils = mock(ClusterUtils.class); vdsDao = mock(VdsDAO.class); volumeDao = mock(GlusterVolumeDao.class); brickDao = mock(GlusterBrickDao.class); doReturn(vdsDao).when(getQuery()).getVdsDao(); doReturn(volumeDao).when(getQuery()).getGlusterVolumeDao(); when(volumeDao.getById(VOLUME_ID)).thenReturn(getVolume()); doReturn(brickDao).when(getQuery()).getGlusterBrickDao(); when(brickDao.getById(BRICK_ID)).thenReturn(getBrick()); doReturn(CLUSTER_ID).when(getQueryParameters()).getClusterId(); doReturn(VOLUME_ID).when(getQueryParameters()).getVolumeId(); doReturn(true).when(getQueryParameters()).isDetailRequired(); VDSReturnValue returnValue = new VDSReturnValue(); returnValue.setSucceeded(true); returnValue.setReturnValue(expectedVolumeAdvancedDetails); doReturn(returnValue).when(getQuery()).runVdsCommand(eq(VDSCommandType.GetGlusterVolumeAdvancedDetails), any(VDSParametersBase.class)); }
Source:
<code>private SampleTester(Consumer<Sample> callback) { ArrayList<GError> errors = new ArrayList<GError>(); <START> String pipeline_descr = "videotestsrc is-live=true ! videoconvert ! appsink name=myappsink"; <END> Bin bin = Gst.parseBinFromDescription(pipeline_descr, false, errors); assertNotNull("Unable to create Bin from pipeline description: ", bin); AppSink appSink = (AppSink)bin.getElementByName("myappsink"); appSink.set("emit-signals", true); NewSampleListener sampleListener = new NewSampleListener(callback); appSink.connect(sampleListener); bin.play(); try { synchronized (sampleListener) { sampleListener.wait(); } } catch (InterruptedException e) { fail("Unexpected interruption waiting for sample"); } bin.stop(); appSink.disconnect(sampleListener); if (sampleListener.exception != null) { throw new AssertionError(sampleListener.exception); } }</code><technical_language>Please change default pipeline a valid reason? If need a pipeline for a test, pass in other methods SampleTester</technical_language>

Target:
private SampleTester(Consumer<Sample> callback) { ArrayList<GError> errors = new ArrayList<GError>(); String pipeline_descr = "videotestsrc ! videoconvert ! appsink name=myappsink"; Bin bin = Gst.parseBinFromDescription(pipeline_descr, false, errors); assertNotNull("Unable to create Bin from pipeline description: ", bin); AppSink appSink = (AppSink)bin.getElementByName("myappsink"); appSink.set("emit-signals", true); NewSampleListener sampleListener = new NewSampleListener(callback); appSink.connect(sampleListener); bin.play(); try { synchronized (sampleListener) { sampleListener.wait(); } } catch (InterruptedException e) { fail("Unexpected interruption waiting for sample"); } bin.stop(); appSink.disconnect(sampleListener); if (sampleListener.exception != null) { throw new AssertionError(sampleListener.exception); } }
Source:
<code>private LoadingCache<Cell, byte[]> createNewCacheForTable(TableReference tableRef) { return CacheBuilder.newBuilder() .softValues() .maximumWeight(maxCacheWeightPerTable) .weigher((Weigher<Cell, byte[]>) (key, value) -> value.length) <START> .build(getCacheLoader(tableRef)); <END> }</code><technical_language>log eviction debug info folks aware of insufficient size if concerned reading cached values</technical_language>

Target:
private LoadingCache<Cell, byte[]> createNewCacheForTable(TableReference tableRef) { return CacheBuilder.newBuilder() .softValues() .maximumWeight(maxCacheWeightPerTable) .weigher((Weigher<Cell, byte[]>) (key, value) -> value.length) .removalListener(notification -> { if (log.isDebugEnabled() && notification.wasEvicted()) { String rowName = notification.getKey() == null ? "null cell" : Arrays.toString(notification.getKey().getRowName()); String colName = notification.getKey() == null ? "null cell" : Arrays.toString(notification.getKey().getColumnName()); log.debug("Removing entry from caching transaction cache: Table {}, Row {}, Column {}," + " Eviction reason {}", tableRef.getQualifiedName(), rowName, colName, notification.getCause().toString()); } }) .build(getCacheLoader(tableRef)); }
Source:
<code>public ScalerUnit getScalerUnit() { <START> return this.scalerUnit; <END> }</code><technical_language>immutable making a copy</technical_language>

Target:
public ScalerUnit getScalerUnit() { return new ScalerUnit(this.scalerUnit.getDlmsUnit(), this.scalerUnit.getScaler()); }
Source:
<code><START> public SpiderHtmlFormParser(SpiderParam param, ValueGenerator valueGenerator) { <END> super(); if (param == null) { throw new IllegalArgumentException("Parameter param must not be null."); } this.param = param; this.valueGenerator = valueGenerator; }</code><technical_language>This breaks compatibility, is intentional</technical_language>

Target:
public SpiderHtmlFormParser(SpiderParam param, ValueGenerator valueGenerator) { super(); if (param == null) { throw new IllegalArgumentException("Parameter param must not be null."); } if (valueGenerator == null){ throw new IllegalArgumentException("Parameter valueGenerator must not be null."); } this.param = param; this.valueGenerator = valueGenerator; }
Source:
<code>public void testIntRead() throws Exception { MessageType requestedSchema = parseMessageType("message test { required int32 int32_field;}"); ParquetMetadata metadata = ParquetFileReader.readFooter(conf, file); ParquetFileReader fileReader = new ParquetFileReader(conf, metadata.getFileMetaData(), file, metadata.getBlocks(), requestedSchema.getColumns()); DictionaryPageReadStore dictionaryReadStore = fileReader.readNextRowGroupDictionaries(requestedSchema); ColumnDescriptor column = requestedSchema.getColumns().get(0); DictionaryPageReader dictionaryPageReader = dictionaryReadStore.getDictionaryPageReader(column); DictionaryPage dictionaryPage = dictionaryPageReader.readDictionaryPage(); <START> Dictionary dictionary = dictionaryPage.getEncoding().initDictionary(column, dictionaryPage); <END> for (int i = 0; i < intValues.length; i++) { assertEquals(intValues[i % intValues.length], dictionary.decodeToInt(i)); } fileReader.close(); }</code><technical_language>wrap this logic in a class returns Dictionary objects. Typically user code want interact Pages final decoded data</technical_language>

Target:
public void testIntRead() throws Exception { MessageType requestedSchema = parseMessageType("message test { required int32 int32_field;}"); ParquetMetadata metadata = ParquetFileReader.readFooter(conf, file); ParquetFileReader fileReader = new ParquetFileReader(conf, metadata.getFileMetaData(), file, metadata.getBlocks(), requestedSchema.getColumns()); DictionaryPageReadStore dictionaryReadStore = fileReader.getCurrentRowGroupDictionaries(requestedSchema); ColumnDescriptor column = requestedSchema.getColumns().get(0); DictionaryReader dictionaryReader = new DictionaryReader(column, dictionaryReadStore); Dictionary dictionary = dictionaryReader.readDictionary(); for (int i = 0; i < intValues.length; i++) { assertEquals(intValues[i % intValues.length], dictionary.decodeToInt(i)); } fileReader.close(); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } Condition condition = (Condition) o; if (!patient.equals(condition.patient)) { return false; } if (clinicalStatus != condition.clinicalStatus) { return false; } if (verificationStatus != condition.verificationStatus) { return false; } <START> if (this.condition.getCoded() != null ? <END> !this.condition.getCoded().equals(condition.getCondition().getCoded()) : condition.getCondition().getCoded() != null) { return false; } if (this.condition.getNonCoded() != null ? !this.condition.getNonCoded().equals(condition.getCondition().getNonCoded()) : condition.getCondition().getNonCoded() != null) { return false; } if (onsetDate != null ? !onsetDate.equals(condition.onsetDate) : condition.onsetDate != null) { return false; } if (additionalDetail != null ? !additionalDetail.equals(condition.additionalDetail) : condition.additionalDetail != null) { return false; } if (endDate != null ? !endDate.equals(condition.endDate) : condition.endDate != null) { return false; } return endReason != null ? endReason.equals(condition.endReason) : condition.endReason == null; }</code><technical_language>I this a bit more complicated. add a this.condition.getCoded() != null original if condition</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } Condition condition = (Condition) o; if (!patient.equals(condition.patient)) { return false; } if (clinicalStatus != condition.clinicalStatus) { return false; } if (verificationStatus != condition.verificationStatus) { return false; } if (this.condition.getCoded() != null && !this.condition.getCoded().equals(condition.getCondition().getCoded())) { return false; } if (this.condition.getNonCoded() != null ? !this.condition.getNonCoded().equals(condition.getCondition().getNonCoded()) : condition.getCondition().getNonCoded() != null) { return false; } if (onsetDate != null ? !onsetDate.equals(condition.onsetDate) : condition.onsetDate != null) { return false; } if (additionalDetail != null ? !additionalDetail.equals(condition.additionalDetail) : condition.additionalDetail != null) { return false; } if (endDate != null ? !endDate.equals(condition.endDate) : condition.endDate != null) { return false; } return endReason != null ? endReason.equals(condition.endReason) : condition.endReason == null; }
Source:
<code><START> public void performRemove(String id) { <END> StorageDomain storageDomain = getAttachedStorageDomainSubResource(id).get(); if (storageDomain.getStorage().getType().equals(StorageType.LOCALFS.value())) { RemoveStorageDomainParameters params = new RemoveStorageDomainParameters(asGuid(id)); params.setDoFormat(true); performAction(VdcActionType.RemoveStorageDomain, params); } else { performAction(VdcActionType.DetachStorageDomainFromPool, new DetachStorageDomainFromPoolParameters(asGuid(id), dataCenterId)); } }</code><technical_language>this method return Response</technical_language>

Target:
public Response performRemove(String id) { StorageDomain storageDomain = getAttachedStorageDomainSubResource(id).get(); if (storageDomain.getStorage().getType().equals(StorageType.LOCALFS.value())) { RemoveStorageDomainParameters params = new RemoveStorageDomainParameters(asGuid(id)); params.setDoFormat(true); return (performAction(VdcActionType.RemoveStorageDomain, params)); } else { return (performAction(VdcActionType.DetachStorageDomainFromPool, new DetachStorageDomainFromPoolParameters(asGuid(id), dataCenterId))); } }
Source:
<code>private boolean checkFileAreSame(String filePath1, String filePath) { try (BufferedReader br = new BufferedReader(new FileReader(new File(filePath)))) { try (BufferedReader br2 = new BufferedReader(new FileReader(new File(filePath1)))) { String lineRead = br.readLine(); String lineRead2 = br2.readLine(); while (lineRead != null) { if (!lineRead.equals(lineRead2)) { return false; } lineRead = br.readLine(); lineRead2 = br2.readLine(); } } } catch (IOException e) { <START> e.printStackTrace(); <END> } return true; }</code><technical_language>This fail test, no</technical_language>

Target:
private boolean checkFileAreSame(String filePath1, String filePath) throws IOException { try (BufferedReader br = new BufferedReader(new FileReader(new File(filePath)))) { try (BufferedReader br2 = new BufferedReader(new FileReader(new File(filePath1)))) { String lineRead = br.readLine(); String lineRead2 = br2.readLine(); while (lineRead != null) { if (!lineRead.equals(lineRead2)) { return false; } lineRead = br.readLine(); lineRead2 = br2.readLine(); } } } return true; }
Source:
<code>public static void main(String[] args) { NewCalendar myCalendar = new NewCalendar(); TimeZone tZone = TimeZone.getDefault(); Calendar calendar = Calendar.getInstance(); boolean printWeek = false; boolean printZone = false; for (int i = 0; i < args.length; ++i) { if (args[i].equals("-w")) { printWeek = true; } else if (args[i].equals("-m") && args.length >= i + 2) { try { int month = Integer.parseInt(args[++i]); if (month <= calendar.getActualMaximum(Calendar.MONTH) && month >= calendar .getActualMinimum(Calendar.MONTH)) { calendar.set(Calendar.MONTH, month); } else { throw new Exception(); } } catch (Exception e) { <START> Errors.printErrAndExit("Kye '-m': Invalid argument. Use: [-m MONTH] , MONTH = {1, ..., 12}"); <END> } } else if (args[i].equals("-y") && args.length >= i + 2) { try { int year = Integer.parseInt(args[++i]); if (year >= 999 && year <= 10000) { calendar.set(Calendar.YEAR, year); } else { throw new Exception(); } } catch (Exception e) { Errors.printErrAndExit("Kye '-y': Invalid argument. Use: [-y YEAR] , YEAR = 4 digits."); } } else if (args[i].equals("-t") && args.length >= i + 2) { tZone = TimeZone.getTimeZone(args[++i]); printZone = true; } else { Errors.printErrAndExit("Invalid argument. Use: 'java Calendar [-m MONTH] [-y YEAR] [-w] [-t TIMEZONE]'."); } } myCalendar.executeCalendar(calendar, printWeek, tZone, printZone); }</code><technical_language>kye == key</technical_language>

Target:
public static void main(String[] args) { NewCalendar myCalendar = new NewCalendar(); TimeZone tZone = TimeZone.getDefault(); Calendar calendar = Calendar.getInstance(); boolean printWeek = false; boolean printZone = false; for (int i = 0; i < args.length; ++i) { if (args[i].equals("-w")) { printWeek = true; } else if (args[i].equals("-m") && args.length >= i + 2) { try { int month = Integer.parseInt(args[++i]); if (month <= calendar.getActualMaximum(Calendar.MONTH) && month >= calendar .getActualMinimum(Calendar.MONTH)) { calendar.set(Calendar.MONTH, --month); } else { throw new Exception(); } } catch (Exception e) { Closers.printErrAndExit("Key '-m': Invalid argument. Use: [-m MONTH] , MONTH = {1, ..., 12}"); } } else if (args[i].equals("-y") && args.length >= i + 2) { try { int year = Integer.parseInt(args[++i]); if (year >= 999 && year <= 10000) { calendar.set(Calendar.YEAR, year); } else { throw new Exception(); } } catch (Exception e) { Closers.printErrAndExit("Key '-y': Invalid argument. Use: [-y YEAR] , YEAR = 4 digits."); } } else if (args[i].equals("-t") && args.length >= i + 2) { tZone = TimeZone.getTimeZone(args[++i]); printZone = true; } else { Closers.printErrAndExit("Invalid argument. Use: 'java Calendar [-m MONTH] [-y YEAR] [-w] [-t TIMEZONE]'."); } } myCalendar.executeCalendar(calendar, printWeek, tZone, printZone); }
Source:
<code>public static <A> F<Future<A>, P1<Either<Exception, A>>> Future_P1() { <START> return a -> new P1<Either<Exception, A>>() { <END> @SuppressWarnings({"OverlyBroadCatchBlock"}) public Either<Exception, A> _1() { Either<Exception, A> r; try { r = Either.right(a.get()); } catch (Exception e) { r = Either.left(e); } return r; } }; }</code><technical_language>P.lazy</technical_language>

Target:
public static <A> F<Future<A>, P1<Either<Exception, A>>> Future_P1() { return a -> P.lazy(u -> { Either<Exception, A> r; try { r = Either.right(a.get()); } catch (Exception e) { r = Either.left(e); } return r; }); }
Source:
<code>public void AddPenaltyModel(String id, boolean foulout_explusion, int period, int jam, String code) { synchronized (penaltiesLock) { if (foulout_explusion && code != null) { Penalty prev = foexp_penalty; id = UUID.randomUUID().toString(); if (prev != null) { id = prev.getId(); } foexp_penalty = new DefaultPenaltyModel(id, period, jam, code); scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_PENALTY_FOEXP, foexp_penalty, null)); } else if (foulout_explusion && code == null) { Penalty prev = foexp_penalty; foexp_penalty = null; scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_PENALTY_REMOVE_FOEXP, null, prev)); } else if (id == null ) { id = UUID.randomUUID().toString(); if (penalties.size() < 9) { DefaultPenaltyModel dpm = new DefaultPenaltyModel(id, period, jam, code); penalties.add(dpm); <START> sortPenalties(); <END> scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_PENALTY, dpm, null)); } } else { for (DefaultPenaltyModel p2 : penalties) { if (p2.getId().equals(id)) { if (code != null) { p2.period = period; p2.jam = jam; p2.code = code; sortPenalties(); scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_PENALTY, p2, null)); } else { penalties.remove(p2); scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_REMOVE_PENALTY, null, p2)); } break; } } } } }</code><technical_language>EVENT_PENALTY is longer individual penalty, reorder other penalties. I event considered more generic pass dpm clearer. This require code changes in xml/json listeners currently replace entire skater</technical_language>

Target:
public void AddPenaltyModel(String id, boolean foulout_explusion, int period, int jam, String code) { synchronized (penaltiesLock) { if (foulout_explusion && code != null) { Penalty prev = foexp_penalty; id = UUID.randomUUID().toString(); if (prev != null) { id = prev.getId(); } foexp_penalty = new DefaultPenaltyModel(id, period, jam, code); scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_PENALTY_FOEXP, foexp_penalty, null)); } else if (foulout_explusion && code == null) { Penalty prev = foexp_penalty; foexp_penalty = null; scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_PENALTY_REMOVE_FOEXP, null, prev)); } else if (id == null ) { id = UUID.randomUUID().toString(); if (penalties.size() < 9) { DefaultPenaltyModel dpm = new DefaultPenaltyModel(id, period, jam, code); penalties.add(dpm); sortPenalties(); scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_PENALTY, getPenalties(), null)); } } else { for (DefaultPenaltyModel p2 : penalties) { if (p2.getId().equals(id)) { if (code != null) { p2.period = period; p2.jam = jam; p2.code = code; sortPenalties(); scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_PENALTY, getPenalties(), null)); } else { penalties.remove(p2); scoreBoardChange(new ScoreBoardEvent(getSkater(), EVENT_REMOVE_PENALTY, null, p2)); } break; } } } } }
Source:
<code>private static void doEvictionConfigChecks(EvictionConfig evictionConfig, boolean isIMap, boolean isNearCache) { if (isIMap) { <START> checkMapMaxSizePolicyConfig(evictionConfig.getMaxSizePolicy()); <END> return; } if (isNearCache) { checkNearCacheEvictionConfig(evictionConfig.getEvictionPolicy(), evictionConfig.getComparatorClassName(), evictionConfig.getComparator()); return; } checkEvictionConfig(evictionConfig); }</code><technical_language>call checkEvictionConfig for IMap well</technical_language>

Target:
private static void doEvictionConfigChecks(EvictionConfig evictionConfig, boolean isIMap, boolean isNearCache) { if (isIMap) { checkMapEvictionConfig(evictionConfig); return; } if (isNearCache) { checkNearCacheEvictionConfig(evictionConfig.getEvictionPolicy(), evictionConfig.getComparatorClassName(), evictionConfig.getComparator()); return; } checkCacheEvictionConfig(evictionConfig); }
Source:
<code>public void select_entity_singleton_by_id_and_apply_field_masks() { final Stand stand = prepareStandWithAggregateRepo(InMemoryStandStorage.newBuilder() .build()); <START> final String customerFqn = Customer.getDescriptor() <END> .getFullName(); final String[] paths = {customerFqn + ".id", customerFqn + ".name"}; final FieldMask fieldMask = FieldMask.newBuilder() .addAllPaths(Arrays.asList(paths)) .build(); final List<Customer> customers = new LinkedList<>(); final int count = 10; for (int i = 0; i < count; i++) { final Customer customer = getSampleCustomer(); customers.add(customer); stand.update(customer.getId(), AnyPacker.pack(customer)); } final Set<CustomerId> ids = Collections.singleton(customers.get(0) .getId()); final Query customerQuery = Queries.readByIds(Customer.class, ids, paths); final MemoizeQueryResponseObserver observer = new MemoizeQueryResponseObserver(); stand.execute(customerQuery, observer); final List<Any> read = observer.responseHandled.getMessagesList(); assertSize(1, read); final Customer customer = AnyPacker.unpack(read.get(0)); assertMatches(customer, fieldMask); assertTrue(ids.contains(customer.getId())); verifyObserver(observer); }</code><technical_language>is Fqn is here</technical_language>

Target:
public void select_entity_singleton_by_id_and_apply_field_masks() { final Stand stand = prepareStandWithAggregateRepo(InMemoryStandStorage.newBuilder() .build()); final String customerDescriptor = Customer.getDescriptor() .getFullName(); final String[] paths = {customerDescriptor + ".id", customerDescriptor + ".name"}; final FieldMask fieldMask = FieldMask.newBuilder() .addAllPaths(Arrays.asList(paths)) .build(); final List<Customer> customers = new LinkedList<>(); final int count = 10; for (int i = 0; i < count; i++) { final Customer customer = getSampleCustomer(); customers.add(customer); stand.update(customer.getId(), AnyPacker.pack(customer)); } final Set<CustomerId> ids = Collections.singleton(customers.get(0) .getId()); final Query customerQuery = Queries.readByIds(Customer.class, ids, paths); final MemoizeQueryResponseObserver observer = new MemoizeQueryResponseObserver(); stand.execute(customerQuery, observer); final List<Any> read = observer.responseHandled.getMessagesList(); assertSize(1, read); final Customer customer = AnyPacker.unpack(read.get(0)); assertMatches(customer, fieldMask); assertTrue(ids.contains(customer.getId())); verifyObserver(observer); }
Source:
<code>protected void rebuild() { setStartTime(Long.MAX_VALUE); setEndTime(Long.MIN_VALUE); refresh(); ITmfTrace viewTrace = fTrace; if (viewTrace == null) { return; } resetView(viewTrace); List<IMarkerEventSource> markerEventSources = new ArrayList<>(); synchronized (fBuildJobMap) { for (ITmfTrace trace : getTracesToBuild(viewTrace)) { if (trace == null) { break; } markerEventSources.addAll(TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class)); Job buildJob = <START> Job.create(getName() + <END> Messages.AbstractTimeGraphView_BuildJob, new BuildRunnable(trace, viewTrace)); fBuildJobMap.put(trace, buildJob); buildJob.schedule(); } } fMarkerEventSourcesMap.put(viewTrace, markerEventSources); }</code><technical_language>shown user in Progress view, getTitle() (view name) instead of getName() (view id)</technical_language>

Target:
protected void rebuild() { setStartTime(Long.MAX_VALUE); setEndTime(Long.MIN_VALUE); refresh(); ITmfTrace viewTrace = fTrace; if (viewTrace == null) { return; } resetView(viewTrace); List<IMarkerEventSource> markerEventSources = new ArrayList<>(); synchronized (fBuildJobMap) { for (ITmfTrace trace : getTracesToBuild(viewTrace)) { if (trace == null) { break; } markerEventSources.addAll(TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class)); Job buildJob = Job.create(getTitle() + Messages.AbstractTimeGraphView_BuildJob, new BuildRunnable(trace, viewTrace)); fBuildJobMap.put(trace, buildJob); buildJob.schedule(); } } fMarkerEventSourcesMap.put(viewTrace, markerEventSources); }
Source:
<code>public HttpRequest sign(String method, String container, String name, @Nullable GetOptions options, long expires, @Nullable Long contentLength, @Nullable String contentType) { <START> boolean isSAS = auth.authSAS(this.credential); <END> HttpRequest request = null; if (isSAS) { request = signSAS(method, container, name, options, expires, contentLength, contentType); } else { request = signKey(method, container, name, options, expires, contentLength, contentType); } return request; }</code><technical_language>Again, this in constructor instead of resolving time</technical_language>

Target:
public HttpRequest sign(String method, String container, String name, @Nullable GetOptions options, long expires, @Nullable Long contentLength, @Nullable String contentType) { if (isSAS) { return signSAS(method, container, name, options, expires, contentLength, contentType); } return signKey(method, container, name, options, expires, contentLength, contentType); }
Source:
<code>private EditableValue createOwnerWidget(ServiceUserInfo info) { EditableValue ownerWidget = new EditableValue(info.username(), info.owner() != null ? info.owner().name() : "") { @Override protected void save(String serviceUser, final String newValue) { new RestApi("config").id("server") .view(Plugin.get().getPluginName(), "serviceusers").id(serviceUser) .view("owner").put(newValue, new AsyncCallback<GroupInfo>() { @Override public void onSuccess(GroupInfo result) { updateValue(result != null ? result.name() : ""); Plugin.get().refresh(); } @Override public void onFailure(Throwable caught) { } }); } }; StringBuilder ownerWarning = new StringBuilder(); ownerWarning.append("If "); <START> ownerWarning.append(info.owner() != null ? "the owner group is changed" : "an owner group is set"); <END> ownerWarning.append(" only members of the "); ownerWarning.append(info.owner() != null ? "new " : ""); ownerWarning.append("owner group can see and administrate the service user."); if (info.owner() != null) { ownerWarning.append(" If the owner group is removed only the creator of the service user " + "can see and administrate the service user."); } else { ownerWarning.append(" The creator of the service user cannot anymore see and " + "administrate the service user if she/he is not member of the owner group."); } ownerWidget.setWarning(ownerWarning.toString()); return ownerWidget; }</code><technical_language>Wrap long lines</technical_language>

Target:
private EditableValue createOwnerWidget(ServiceUserInfo info) { EditableValue ownerWidget = new EditableValue(info.username(), info.owner() != null ? info.owner().name() : "") { @Override protected void save(String serviceUser, final String newValue) { new RestApi("config").id("server") .view(Plugin.get().getPluginName(), "serviceusers").id(serviceUser) .view("owner").put(newValue, new AsyncCallback<GroupInfo>() { @Override public void onSuccess(GroupInfo result) { updateValue(result != null ? result.name() : ""); Plugin.get().refresh(); } @Override public void onFailure(Throwable caught) { } }); } }; StringBuilder ownerWarning = new StringBuilder(); ownerWarning.append("If "); ownerWarning.append(info.owner() != null ? "the owner group is changed" : "an owner group is set"); ownerWarning.append(" only members of the "); ownerWarning.append(info.owner() != null ? "new " : ""); ownerWarning.append("owner group can see and administrate" + " the service user."); if (info.owner() != null) { ownerWarning.append(" If the owner group is removed only the" + " creator of the service user can see and administrate" + " the service user."); } else { ownerWarning.append(" The creator of the service user can no" + " longer see and administrate the service user if she/he" + " is not member of the owner group."); } ownerWidget.setWarning(ownerWarning.toString()); return ownerWidget; }
Source:
<code>private void rewireBundle(ResolverBundle rb, List<ResolverBundle> visited) { if (visited.contains(rb)) return; visited.add(rb); BundleConstraint[] requires = rb.getRequires(); for (BundleConstraint require : requires) { rewireRequire(require, visited); } ResolverImport[] imports = rb.getImportPackages(); for (ResolverImport <START> import1 : <END> imports) { rewireImport(import1, visited); } GenericConstraint[] genericRequires = rb.getGenericRequires(); for (GenericConstraint genericRequire : genericRequires) { rewireGeneric(genericRequire, visited); } }</code><technical_language>rename resolverImport</technical_language>

Target:
private void rewireBundle(ResolverBundle rb, List<ResolverBundle> visited) { if (visited.contains(rb)) return; visited.add(rb); BundleConstraint[] requires = rb.getRequires(); for (BundleConstraint require : requires) { rewireRequire(require, visited); } ResolverImport[] imports = rb.getImportPackages(); for (ResolverImport resolverImport : imports) { rewireImport(resolverImport, visited); } GenericConstraint[] genericRequires = rb.getGenericRequires(); for (GenericConstraint genericRequire : genericRequires) { rewireGeneric(genericRequire, visited); } }
Source:
<code><START> public Position(int line, int column) { <END> this.line = line; this.column = column; }</code><technical_language>check is positive equal UNKNOWN</technical_language>

Target:
public Position(int line, int column) { if (line < Node.ABSOLUTE_END_LINE) { throw new IllegalArgumentException("Can't position at line " + line); } if (column < -1) { throw new IllegalArgumentException("Can't position at column " + column); } this.line = line; this.column = column; }
Source:
<code>public void fetchEntries(final Budget b, final ApiCallback<List<Entry>> callback) { Log.d(TAG, "Fetching entries for budget # " + b.getId()); String requestUrl = entriesUrl + "/" + b.getId() + "/by_budget"; client.get(requestUrl, new JsonHttpResponseHandler() { @Override public void onSuccess(JSONArray entriesJson) { List<Entry> entriesList = new ArrayList<Entry>(); int entriesLen = entriesJson.length(); for (int i = 0; i < entriesLen; ++i) { try { JSONObject entriesObject = entriesJson.getJSONObject(i); long id = entriesObject.getLong("id"); int amount = entriesObject.getInt("amount"); String date = entriesObject.getString("expenditure_date"); String notes = entriesObject.getString("notes"); Entry newEntry = new Entry(id, amount, b, notes, date); b.addEntry(newEntry); } catch (JSONException e) { Log.e(TAG, e.getMessage()); } } <START> callback.onSuccess(entriesList); <END> } @Override public void onFailure(Throwable e, JSONObject obj) { String status = obj.optString("status", "Service Error"); callback.onFailure(status); } }); }</code><technical_language>populating this list. create entriesList pass b.getEntries() callback. unmodifiable list, alright</technical_language>

Target:
public void fetchEntries(final Budget b, final ApiCallback<List<Entry>> callback) { Log.d(TAG, "Fetching entries for budget # " + b.getId()); String requestUrl = entriesUrl + "/" + b.getId() + "/by_budget"; client.get(requestUrl, new JsonHttpResponseHandler() { @Override public void onSuccess(JSONArray entriesJson) { int entriesLen = entriesJson.length(); for (int i = 0; i < entriesLen; ++i) { try { JSONObject entriesObject = entriesJson.getJSONObject(i); long id = entriesObject.getLong("id"); int amount = entriesObject.getInt("amount"); String date = entriesObject.getString("expenditure_date"); String notes = entriesObject.getString("notes"); Entry newEntry = new Entry(id, amount, b, notes, date); b.addEntry(newEntry); } catch (JSONException e) { Log.e(TAG, e.getMessage()); } } callback.onSuccess(b.getEntries()); } @Override public void onFailure(Throwable e, JSONObject obj) { String status = obj.optString("status", "Service Error"); callback.onFailure(status); } }); }
Source:
<code><START> public SWTBotRootMenu <END> contextMenu(final Control control) throws WidgetNotFoundException { waitForEnabled(); Rectangle location = widgetBounds(); return NatTableContextMenuFinder.contextMenu(widget, location.width / 2, location.height / 2); }</code><technical_language>I want leave this protected. user call public contextMenu() in turn call this one</technical_language>

Target:
protected SWTBotRootMenu contextMenu(final Control control) throws WidgetNotFoundException { waitForEnabled(); Rectangle location = widgetBounds(); return NatTableContextMenuFinder.contextMenu(widget, location.width / 2, location.height / 2); }
Source:
<code>public void initialize(URL location, ResourceBundle resources) { Callback<ListView<SelectableResource>, ListCell<SelectableResource>> forListView = CheckBoxListCell.forListView(SelectableResource::selectedProperty); <START> favoritesList.setCellFactory(forListView); <END> updateFavorites(); }</code><technical_language>Considering this long type specifier for callback readable writing this: java favoritesList.setCellFactory( CheckBoxListCell.forListView(SelectableResource::selectedProperty) );</technical_language>

Target:
public void initialize(URL location, ResourceBundle resources) { updateFavorites(); favoritesList.setItems(items); favoritesList.getCheckModel().checkAll(); favoritesList.getCheckModel().getCheckedItems().addListener( (ListChangeListener.Change<? extends ResourceAdapter> l) -> cs.getSelectedTypes().setAll(favoritesList.getCheckModel().getCheckedItems()) ); ps.configProperty().addListener((p, o, n) -> { updateFavorites(); favoritesList.getCheckModel().checkAll(); }); }
Source:
<code>public long getPacketSizeBits() { return <START> 0; <END> }</code><technical_language>this 1 if content size is 1</technical_language>

Target:
public long getPacketSizeBits() { return 3; }
Source:
<code>public void testMultiThreadPull() throws InterruptedException, TimeoutException, ExecutionException { final int numPullThreads = 8; final int numPullPerThread = 1000; final CountDownLatch countDownLatch = new CountDownLatch(numPullThreads); final Runnable[] threads = new Runnable[numPullThreads]; final AtomicBoolean correctResultReturned = new AtomicBoolean(true); for (int index = 0; index < numPullThreads; ++index) { <START> final int key = index % 4; <END> threads[index] = () -> { for (int pull = 0; pull < numPullPerThread; ++pull) { final Integer val = worker.pull(key); if (val == null || !val.equals(key)) { correctResultReturned.set(false); break; } } countDownLatch.countDown(); }; } ThreadUtils.runConcurrently(threads); final boolean allThreadsFinished = countDownLatch.await(60, TimeUnit.SECONDS); worker.close(CLOSE_TIMEOUT); assertTrue(MSG_THREADS_SHOULD_FINISH, allThreadsFinished); assertTrue(MSG_RESULT_ASSERTION, correctResultReturned.get()); }</code><technical_language>numKeys</technical_language>

Target:
public void testMultiThreadPull() throws InterruptedException, TimeoutException, ExecutionException, NetworkException { final int numPullThreads = 8; final int numKeys = 4; final int numPullPerThread = 1000; final CountDownLatch countDownLatch = new CountDownLatch(numPullThreads); final Runnable[] threads = new Runnable[numPullThreads]; final AtomicBoolean correctResultReturned = new AtomicBoolean(true); for (int index = 0; index < numPullThreads; ++index) { final int key = index % numKeys; threads[index] = () -> { for (int pull = 0; pull < numPullPerThread; ++pull) { final Integer val = worker.pull(key); if (val == null || !val.equals(key)) { correctResultReturned.set(false); break; } } countDownLatch.countDown(); }; } ThreadUtils.runConcurrently(threads); final boolean allThreadsFinished = countDownLatch.await(60, TimeUnit.SECONDS); worker.close(CLOSE_TIMEOUT); assertTrue(MSG_THREADS_SHOULD_FINISH, allThreadsFinished); assertTrue(MSG_RESULT_ASSERTION, correctResultReturned.get()); }
Source:
<code>public BsonDocument toBsonDocument() { final BsonDocument asDoc = new BsonDocument(); asDoc.put(Fields.ID_FIELD, id); asDoc.put(Fields.OPERATION_TYPE_FIELD, new BsonString(toRemote(getOperationType()))); final BsonDocument nsDoc = new BsonDocument(); nsDoc.put(Fields.NS_DB_FIELD, new BsonString(ns.getDatabaseName())); nsDoc.put(Fields.NS_COLL_FIELD, new BsonString(getNamespace().getCollectionName())); asDoc.put(Fields.NS_FIELD, nsDoc); asDoc.put(Fields.DOCUMENT_KEY_FIELD, getDocumentKey()); <START> if (getFullDocument() != null && (getFullDocument() instanceof BsonValue) <END> && ((BsonValue) getFullDocument()).isDocument()) { asDoc.put(Fields.FULL_DOCUMENT_FIELD, (BsonValue) getFullDocument()); } if (getUpdateDescription() != null) { asDoc.put(Fields.UPDATE_DESCRIPTION_FIELD, getUpdateDescription().toBsonDocument()); } asDoc.put(Fields.WRITE_PENDING_FIELD, new BsonBoolean(hasUncommittedWrites())); return asDoc; }</code><technical_language>local variables for is retrieved multiple times</technical_language>

Target:
public BsonDocument toBsonDocument() { final BsonDocument asDoc = new BsonDocument(); asDoc.put(Fields.ID_FIELD, id); asDoc.put(Fields.OPERATION_TYPE_FIELD, new BsonString(toRemote(getOperationType()))); final BsonDocument nsDoc = new BsonDocument(); nsDoc.put(Fields.NS_DB_FIELD, new BsonString(ns.getDatabaseName())); nsDoc.put(Fields.NS_COLL_FIELD, new BsonString(getNamespace().getCollectionName())); asDoc.put(Fields.NS_FIELD, nsDoc); asDoc.put(Fields.DOCUMENT_KEY_FIELD, getDocumentKey()); DocumentT fullDocument = getFullDocument(); if ((fullDocument instanceof BsonValue) && ((BsonValue) fullDocument).isDocument()) { asDoc.put(Fields.FULL_DOCUMENT_FIELD, (BsonValue) fullDocument); } UpdateDescription updateDescription = getUpdateDescription(); if (updateDescription != null) { asDoc.put(Fields.UPDATE_DESCRIPTION_FIELD, updateDescription.toBsonDocument()); } asDoc.put(Fields.WRITE_PENDING_FIELD, new BsonBoolean(hasUncommittedWrites())); return asDoc; }
Source:
<code>public String getTableSize( @ApiParam(value = "Table Name with type", required = true) @PathParam("tableName") String tableName) throws WebApplicationException { double memoryConsumed = 0; TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName); if (tableType != TableType.REALTIME) { throw new WebApplicationException("This api cannot be used with non real-time table: " + tableName, Response.Status.BAD_REQUEST); } InstanceDataManager instanceDataManager = serverInstance.getInstanceDataManager(); if (instanceDataManager == null) { throw new WebApplicationException("Invalid server initialization", Response.Status.INTERNAL_SERVER_ERROR); } RealtimeTableDataManager realtimeTableDataManager = (RealtimeTableDataManager) instanceDataManager.getTableDataManager(tableName); if (realtimeTableDataManager == null) { throw new WebApplicationException("Table: " + tableName + " is not found", Response.Status.NOT_FOUND); } <START> memoryConsumed = realtimeTableDataManager.getStatsHistory().getLatestSegmentMemoryConsumed(); <END> return ResourceUtils.convertToJsonString(memoryConsumed); }</code><technical_language>Remove line 71 declare variable here. Also, return long instead of double</technical_language>

Target:
public String getTableSize( @ApiParam(value = "Table Name with type", required = true) @PathParam("tableName") String tableName) throws WebApplicationException { TableType tableType = TableNameBuilder.getTableTypeFromTableName(tableName); if (tableType != TableType.REALTIME) { throw new WebApplicationException("This api cannot be used with non real-time table: " + tableName, Response.Status.BAD_REQUEST); } InstanceDataManager instanceDataManager = _serverInstance.getInstanceDataManager(); if (instanceDataManager == null) { throw new WebApplicationException("Invalid server initialization", Response.Status.INTERNAL_SERVER_ERROR); } RealtimeTableDataManager realtimeTableDataManager = (RealtimeTableDataManager) instanceDataManager.getTableDataManager(tableName); if (realtimeTableDataManager == null) { throw new WebApplicationException("Table: " + tableName + " is not found", Response.Status.NOT_FOUND); } long memoryConsumed = realtimeTableDataManager.getStatsHistory().getLatestSegmentMemoryConsumed(); return ResourceUtils.convertToJsonString(Collections.singletonMap("offheapMemoryConsumed", memoryConsumed)); }