auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public AutoPullResponseHandler(Query query, RunResponseHandler runResponseHandler, Connection connection, MetadataExtractor metadataExtractor, PullResponseCompletionListener completionListener, long fetchSize ) { super(query, runResponseHandler, connection, metadataExtractor, completionListener ); this.fetchSize = fetchSize; if ( fetchSize == UNLIMITED_FETCH_SIZE ) { this.HIGH_RECORD_WATERMARK = Long.MAX_VALUE; this.LOW_RECORD_WATERMARK = Long.MAX_VALUE; } else { this.HIGH_RECORD_WATERMARK = (long) (fetchSize * 0.7); this.LOW_RECORD_WATERMARK = (long) (fetchSize * 0.3); } installRecordAndSummaryConsumers(); }

Target:
public AutoPullResponseHandler(Query query, RunResponseHandler runResponseHandler, Connection connection, MetadataExtractor metadataExtractor, PullResponseCompletionListener completionListener, long fetchSize ) { super(query, runResponseHandler, connection, metadataExtractor, completionListener ); this.fetchSize = fetchSize; if ( fetchSize == UNLIMITED_FETCH_SIZE ) { this.highRecordWatermark = Long.MAX_VALUE; this.lowRecordWatermark = Long.MAX_VALUE; } else { this.highRecordWatermark = (long) (fetchSize * 0.7); this.lowRecordWatermark = (long) (fetchSize * 0.3); } installRecordAndSummaryConsumers(); }
Source:
public void testSearch() throws Exception { String[] searchTerms = {Constants.NEWS, "structuretype = 2", " And structure.inode='" + Constants.NEWS + "'"}; int totalCount = contentTypeApi.count(); List<ContentType> types = contentTypeApi.search(null, BaseContentType.ANY, "name", -1, 0); assertThat("we have at least 40 content types", types.size() > 20); types = contentTypeApi.search(null, BaseContentType.ANY, "name", -1, 0); assertThat("limit works and we have max five content types", types.size() < 6); for (int x = 0; x < totalCount; x = x + 5) { types = contentTypeApi.search(null, BaseContentType.ANY, "name asc", -1, 0); assertThat("we have max five content types", types.size() < 6); } for (int i = 0; i < BaseContentType.values().length; i++) { types = contentTypeApi.search(null, BaseContentType.getBaseContentType(i), "name", -1, 0); assertThat("we have content types of" + BaseContentType.getBaseContentType(i), types.size() > 0); int count = contentTypeApi.count(null, BaseContentType.getBaseContentType(i)); assertThat("Count works as well", types.size() == count); } for (int i = 0; i < searchTerms.length; i++) { types = contentTypeApi.search(searchTerms[i], BaseContentType.ANY, "mod_date desc", -1, 0); assertThat("we can search content types:" + searchTerms[i], types.size() > 0); int count = contentTypeApi.count(searchTerms[i], BaseContentType.ANY); assertThat("Count works as well", types.size() == count); } }

Target:
public void testSearch() throws Exception { String[] searchTerms = {Constants.NEWS, "structuretype = 2", " And structure.inode='" + Constants.NEWS + "'"}; int totalCount = contentTypeApi.count(); List<ContentType> types = contentTypeApi.search(null, BaseContentType.ANY, "name", -1, 0); assertThat("we have at least 40 content types", types.size() > 20); types = contentTypeApi.search(null, BaseContentType.ANY, "name", 5, 0); assertThat("limit works and we have max five content types", types.size() < 6); for (int x = 0; x < totalCount; x = x + 5) { types = contentTypeApi.search(null, BaseContentType.ANY, "name asc", 5, 0); assertThat("we have max five content types", types.size() < 6); } for (int i = 0; i < BaseContentType.values().length; i++) { types = contentTypeApi.search(null, BaseContentType.getBaseContentType(i), "name", -1, 0); assertThat("we have content types of" + BaseContentType.getBaseContentType(i), types.size() > 0); int count = contentTypeApi.count(null, BaseContentType.getBaseContentType(i)); assertThat("Count works as well", types.size() == count); } for (int i = 0; i < searchTerms.length; i++) { types = contentTypeApi.search(searchTerms[i], BaseContentType.ANY, "mod_date desc", -1, 0); assertThat("we can search content types:" + searchTerms[i], types.size() > 0); int count = contentTypeApi.count(searchTerms[i], BaseContentType.ANY); assertThat("Count works as well", types.size() == count); } }
Source:
private ISchedulingRule calculateSchedulingRule() { Set<IContainer> containers = new HashSet<IContainer>(); for (IPath path : paths) { IResource resource = ResourceUtil.getResourceForLocation(path); if (resource != null) { containers.add(resource.getParent()); } } return new MultiRule(containers.toArray(new IResource[containers.size()])); }

Target:
private ISchedulingRule calculateSchedulingRule() { Set<IContainer> containers = new HashSet<IContainer>(); for (IPath path : paths) { IResource resource = ResourceUtil.getResourceForLocation(path); if (resource != null) containers.add(resource.getParent()); } return new MultiRule(containers.toArray(new IResource[containers.size()])); }
Source:
public String getContextTemplate() { if (isAPIProduct) { return apiProduct.getContextTemplate(); } else { return api.getContextTemplate(); } }

Target:
public String getContextTemplate() { return isAPIProduct ? apiProduct.getContextTemplate() : api.getContextTemplate(); }
Source:
public void testLockForConfigChange() { LlapRegistryService client1 = new LlapRegistryService(false); client1.init(conf); client1.start(); LlapRegistryService client2 = new LlapRegistryService(false); client2.init(conf); client2.start(); ConfigChangeLockResult result = null; assertTrue(client1.lockForConfigChange(10000).success); assertTrue(client2.lockForConfigChange(30000).success); result = client1.lockForConfigChange(20000); assertFalse(result.success); assertEquals(result.nextConfigChangeTime, 30000); result = client1.lockForConfigChange(30000); assertFalse(result.success); assertEquals(result.nextConfigChangeTime, 30000); result = client1.lockForConfigChange(40000); assertTrue(result.success); assertEquals(result.nextConfigChangeTime, 40000); }

Target:
public void testLockForConfigChange() throws IOException { LlapRegistryService client1 = null; LlapRegistryService client2 = null; ConfigChangeLockResult result; try { client1 = new LlapRegistryService(false); client1.init(conf); client1.start(); client2 = new LlapRegistryService(false); client2.init(conf); client2.start(); assertTrue(client1.lockForConfigChange(10000, 20000).isSuccess()); assertTrue(client2.lockForConfigChange(30000, 40000).isSuccess()); result = client1.lockForConfigChange(20000, 30000); assertFalse(result.isSuccess()); assertEquals(result.getNextConfigChangeTime(), 40000); result = client1.lockForConfigChange(30000, 40000); assertFalse(result.isSuccess()); assertEquals(result.getNextConfigChangeTime(), 40000); result = client1.lockForConfigChange(35000, 45000); assertFalse(result.isSuccess()); assertEquals(result.getNextConfigChangeTime(), 40000); result = client1.lockForConfigChange(40000, 50000); assertTrue(result.isSuccess()); assertEquals(result.getNextConfigChangeTime(), 50000); } finally { if (client1 != null) { client1.close(); } if (client2 != null) { client2.close(); } } }
Source:
protected void processArguments(LinkedList<PathData> args) throws IOException { if (args.size() < 1) { throw new IOException("Target path not specified."); } if (args.size() < 3) { throw new IOException("The number of source paths is less than 2."); } PathData target = args.removeFirst(); LinkedList<PathData> srcList = args; if (!target.exists || !target.stat.isFile()) { throw new IOException(String.format("Target path %s does not exist or is" + " not file.", target.path)); } Path[] srcArray = new Path[srcList.size()]; for (int i = 0; i < args.size(); i++) { PathData src = srcList.get(i); if (!src.exists || !src.stat.isFile()) { throw new IOException( String.format("%s does not exist or is not file.", src.path)); } srcArray[i] = src.path; } FileSystem fs = target.fs; if (tstFs != null) { fs = tstFs; } try { fs.concat(target.path, srcArray); } catch (UnsupportedOperationException exception) { throw new IOException("Dest filesystem '" + fs.getUri().getScheme() + "' doesn't support concat."); } }

Target:
protected void processArguments(LinkedList<PathData> args) throws IOException { if (args.size() < 1) { throw new IOException("Target path not specified. " + USAGE); } if (args.size() < 3) { throw new IOException( "The number of source paths is less than 2. " + USAGE); } PathData target = args.removeFirst(); LinkedList<PathData> srcList = args; if (!target.exists || !target.stat.isFile()) { throw new FileNotFoundException(String .format("Target path %s does not exist or is" + " not file.", target.path)); } Path[] srcArray = new Path[srcList.size()]; for (int i = 0; i < args.size(); i++) { PathData src = srcList.get(i); if (!src.exists || !src.stat.isFile()) { throw new FileNotFoundException( String.format("%s does not exist or is not file.", src.path)); } srcArray[i] = src.path; } FileSystem fs = target.fs; if (testFs != null) { fs = testFs; } try { fs.concat(target.path, srcArray); } catch (UnsupportedOperationException exception) { throw new PathIOException("Dest filesystem '" + fs.getUri().getScheme() + "' doesn't support concat.", exception); } }
Source:
private void runNextPushRequest() { LogIndex committedIndex = leader.getCommitted(); if (equals(txnAccepted, committedIndex) && !equals(txnCommitted, committedIndex)) { pushCommitAsync(committedIndex, leader.isIdle()); } if (queued.isEmpty() || !running.isEmpty() || waitingForRetry()) { return; } Map<String, ReceiveCommand> cmdMap = new HashMap<>(); for (ReplicaPushRequest req : queued) { for (ReceiveCommand cmd : req.getCommands()) { String name = cmd.getRefName(); ReceiveCommand old = cmdMap.remove(name); if (old != null) { cmd = new ReceiveCommand( old.getOldId(), cmd.getNewId(), name); } cmdMap.put(name, cmd); } } queued.clear(); waiting.clear(); List<ReceiveCommand> next = new ArrayList<>(cmdMap.values()); for (ReceiveCommand cmd : next) { running.put(cmd.getRefName(), cmd); } startPush(new ReplicaPushRequest(this, next)); }

Target:
private void runNextPushRequest() { LogIndex committed = leader.getCommitted(); if (!equals(txnCommitted, committed) && shouldPushUnbatchedCommit(committed, leader.isIdle())) { pushCommitAsync(committed); } if (queued.isEmpty() || !running.isEmpty() || waitingForRetry()) { return; } Map<String, ReceiveCommand> cmdMap = new HashMap<>(); for (ReplicaPushRequest req : queued) { for (ReceiveCommand cmd : req.getCommands()) { String name = cmd.getRefName(); ReceiveCommand old = cmdMap.remove(name); if (old != null) { cmd = new ReceiveCommand( old.getOldId(), cmd.getNewId(), name); } cmdMap.put(name, cmd); } } queued.clear(); waiting.clear(); List<ReceiveCommand> next = new ArrayList<>(cmdMap.values()); for (ReceiveCommand cmd : next) { running.put(cmd.getRefName(), cmd); } startPush(new ReplicaPushRequest(this, next)); }
Source:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("application/json"); response.setStatus(HttpServletResponse.SC_OK); LocalityModel localityModel = localityManager.readLocality(); if (request.getParameterMap().size() == 1) { String processorId = request.getParameter(PROCESSOR_ID_PARAM); HostLocality hostLocality = Optional.ofNullable(localityModel.getHostLocality(processorId)) .orElse(new HostLocality(processorId, "")); mapper.writeValue(response.getWriter(), hostLocality); } else { mapper.writeValue(response.getWriter(), localityModel); } }

Target:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("application/json"); response.setStatus(HttpServletResponse.SC_OK); LocalityModel localityModel = localityManager.readLocality(); if (request.getParameterMap().size() == 1) { String processorId = request.getParameter(PROCESSOR_ID_PARAM); ProcessorLocality processorLocality = Optional.ofNullable(localityModel.getProcessorLocality(processorId)) .orElse(new ProcessorLocality(processorId, "")); mapper.writeValue(response.getWriter(), processorLocality); } else { mapper.writeValue(response.getWriter(), localityModel); } }
Source:
public int hashCode() { int result = (_success ? 1 : 0); result = 31 * result + (_nuageVspCmsId != null ? _nuageVspCmsId.hashCode() : 0); result = 31 * result + (_syncType != null ? _syncType.hashCode() : 0); return result; }

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + (_success ? 1 : 0); result = 31 * result + (_nuageVspCmsId != null ? _nuageVspCmsId.hashCode() : 0); result = 31 * result + (_syncType != null ? _syncType.hashCode() : 0); return result; }
Source:
public static void enableKeyserverSync(Context context) {] Account account = KeychainApplication.createAccountIfNecessary(context); if (account == null) { return; } ContentResolver.setIsSyncable(account, Constants.PROVIDER_AUTHORITY, 1); ContentResolver.setSyncAutomatically(account, Constants.PROVIDER_AUTHORITY, true); ContentResolver.addPeriodicSync( account, Constants.PROVIDER_AUTHORITY, new Bundle(), SYNC_INTERVAL ); }

Target:
public static void enableKeyserverSync(Context context) { Account account = KeychainApplication.createAccountIfNecessary(context); if (account == null) { return; } ContentResolver.setIsSyncable(account, Constants.PROVIDER_AUTHORITY, 1); ContentResolver.setSyncAutomatically(account, Constants.PROVIDER_AUTHORITY, true); ContentResolver.addPeriodicSync( account, Constants.PROVIDER_AUTHORITY, new Bundle(), SYNC_INTERVAL ); }
Source:
public static void testEventsTable(SWTWorkbenchBot bot, String editorName, long nbEvents, String firstEventStr) { SWTBotEditor editor = SWTBotUtils.activeEventsEditor(bot, editorName); bot.waitUntil(ConditionHelpers.numberOfEventsInTrace(TmfTraceManager.getInstance().getActiveTrace(), nbEvents)); if (nbEvents == 0 || firstEventStr == null || firstEventStr.isEmpty()) { return; } SWTBotTable table = editor.bot().table(); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return table.rowCount() > 1; } @Override public String getFailureMessage() { return "No items in table"; } }); table.getTableItem(1).select(); editor.bot().waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { SWTBotTable curTable = editor.bot().table(); boolean ret = curTable.selection().rowCount() == 1 && curTable.selection().get(0).toString().contains(firstEventStr); if (!ret) { curTable.getTableItem(1).select(); } return ret; } @Override public String getFailureMessage() { return "First event not selected."; } }); }

Target:
public static void testEventsTable(SWTWorkbenchBot bot, String editorName, long nbEvents, String firstEventStr) { SWTBotEditor editor = SWTBotUtils.activeEventsEditor(bot, editorName); bot.waitUntil(ConditionHelpers.numberOfEventsInTrace(TmfTraceManager.getInstance().getActiveTrace(), nbEvents)); if (nbEvents == 0 || firstEventStr == null || firstEventStr.isEmpty()) { return; } bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { SWTBotTable table = editor.bot().table(); return table.rowCount() > 1; } @Override public String getFailureMessage() { return "No items in table"; } }); SWTBotTable table = editor.bot().table(); table.getTableItem(1).select(); editor.bot().waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { SWTBotTable curTable = editor.bot().table(); boolean ret = curTable.selection().rowCount() == 1 && curTable.selection().get(0).toString().contains(firstEventStr); if (!ret) { curTable.getTableItem(1).select(); } return ret; } @Override public String getFailureMessage() { return "First event not selected."; } }); }
Source:
public Channel createChannel(String id) throws Exception { JGroupsLogger.ROOT_LOGGER.debugf("Creating fork channel %s from channel %s", id, this.channel.getClusterName()); String stackName = this.protocols.isEmpty() ? this.channel.getClusterName() : id; return new ForkChannel(this.channel, stackName, id, this.protocols.stream().map(protocolConfiguration -> { Protocol protocol = protocolConfiguration.createProtocol(); protocol.enableStats(protocolConfiguration.isStatisticsEnabled() != null ? protocolConfiguration.isStatisticsEnabled() : this.parentFactory.getProtocolStackConfiguration().isStatisticsEnabled()); return protocol; }).toArray(Protocol[]::new)); }

Target:
public Channel createChannel(String id) throws Exception { JGroupsLogger.ROOT_LOGGER.debugf("Creating fork channel %s from channel %s", id, this.channel.getClusterName()); String stackName = this.protocols.isEmpty() ? this.channel.getClusterName() : id; return new ForkChannel(this.channel, stackName, id, this.protocols.stream().map(pc -> pc.createProtocol(this.parentFactory.getProtocolStackConfiguration())).toArray(Protocol[]::new)); }
Source:
public void addServiceEventListener(Object listener, Filter filter) { assert getExecutor().isInExecutorThread(); ListenerEntry entry = new ListenerEntry(listener, filter); if (DsfDebugOptions.DEBUG && DsfDebugOptions.DEBUG_SESSION && DsfDebugOptions.DEBUG_SESSION_LISTENERS) { String msg = new Formatter().format( "%s %s added as a service listener to %s (id=%s)", DsfPlugin.getDebugTime(), LoggingUtils.toString(listener), LoggingUtils.toString(this), getId() ).toString(); DsfDebugOptions.trace(msg); } fListeners.put(entry, getEventHandlerMethods(listener)); }

Target:
public void addServiceEventListener(Object listener, Filter filter) { assert getExecutor().isInExecutorThread(); ListenerEntry entry = new ListenerEntry(listener, filter); if (DsfDebugOptions.DEBUG_SESSION_LISTENERS) { String msg = new Formatter().format( "%s %s added as a service listener to %s (id=%s)", DsfPlugin.getDebugTime(), LoggingUtils.toString(listener), LoggingUtils.toString(this), getId() ).toString(); DsfDebugOptions.trace(msg); } fListeners.put(entry, getEventHandlerMethods(listener)); }
Source:
public boolean handleRequest(MessageContext messageContext) { logger.debug("Validating the API request Body content.."); org.apache.axis2.context.MessageContext axis2MC = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); String contentType; Object objContentType = axis2MC.getProperty(APIMgtGatewayConstants.REST_CONTENT_TYPE); if (objContentType == null) { return true; } contentType = objContentType.toString(); if (logger.isDebugEnabled()) { logger.debug("Content type of the request message :" + contentType); } try { RelayUtils.buildMessage(axis2MC); logger.debug("Successfully built the request message"); if (!APIMgtGatewayConstants.APPLICATION_JSON.equals(contentType)) { return true; } swagger = messageContext.getProperty(APIMgtGatewayConstants.OPEN_API_STRING).toString(); if (swagger == null) { return true; } ObjectMapper objectMapper = new ObjectMapper(); rootNode = objectMapper.readTree(swagger.getBytes()); requestMethod = messageContext.getProperty(APIMgtGatewayConstants. ELECTED_REQUEST_METHOD).toString(); JSONObject payloadObject = getMessageContent(messageContext); if (!APIConstants.SupportedHTTPVerbs.GET.name().equals(requestMethod) && payloadObject != null && !APIMgtGatewayConstants.EMPTY_ARRAY.equals(payloadObject)) { validateRequest(messageContext); } } catch (IOException | XMLStreamException e) { logger.error("Error occurred while building the API request", e); } catch (APIManagementException e) { logger.error("Error occurred while validating the API request", e); } return true; }

Target:
public boolean handleRequest(MessageContext messageContext) { logger.debug("Validating the API request Body content.."); org.apache.axis2.context.MessageContext axis2MC = ((Axis2MessageContext) messageContext).getAxis2MessageContext(); String contentType; Object objContentType = axis2MC.getProperty(APIMgtGatewayConstants.REST_CONTENT_TYPE); if (objContentType == null) { return true; } contentType = objContentType.toString(); if (logger.isDebugEnabled()) { logger.debug("Content type of the request message: " + contentType); } try { RelayUtils.buildMessage(axis2MC); logger.debug("Successfully built the request message"); if (!APIMgtGatewayConstants.APPLICATION_JSON.equals(contentType)) { return true; } swagger = messageContext.getProperty(APIMgtGatewayConstants.OPEN_API_STRING).toString(); if (swagger == null) { return true; } ObjectMapper objectMapper = new ObjectMapper(); rootNode = objectMapper.readTree(swagger.getBytes()); requestMethod = messageContext.getProperty(APIMgtGatewayConstants. ELECTED_REQUEST_METHOD).toString(); JSONObject payloadObject = getMessageContent(messageContext); if (!APIConstants.SupportedHTTPVerbs.GET.name().equals(requestMethod) && payloadObject != null && !APIMgtGatewayConstants.EMPTY_ARRAY.equals(payloadObject)) { validateRequest(messageContext); } } catch (IOException | XMLStreamException e) { logger.error("Error occurred while building the API request", e); return false; } catch (APIManagementException e) { logger.error("Error occurred while validating the API request", e); return false; } return true; }
Source:
public InterceptorHandler handlerFor(Class<?> type) { if (type.isAnnotationPresent(Lazy.class)) { InterceptorHandler handler = cachedHandlers.get(type); if (handler == null) { LazyInterceptorHandler value = new LazyInterceptorHandler(container, type); cachedHandlers.putIfAbsent(type, value); return value; } else { return handler; } } else{ List<Class<?>> interfaces = Arrays.asList(type.getInterfaces()); boolean isInterceptorWithInterface = false; for (Class<?> interfacee : interfaces) { if(Interceptor.class.isAssignableFrom(interfacee)){ isInterceptorWithInterface = true; break; } } if(type.isAnnotationPresent(Intercepts.class) && !isInterceptorWithInterface){ System.out.println("AspectStyle => "+type); return new AspectStyleInterceptorHandler(type, new StepInvoker(), container); } } return new ToInstantiateInterceptorHandler(container, type); }

Target:
public InterceptorHandler handlerFor(Class<?> type) { if (type.isAnnotationPresent(Lazy.class)) { InterceptorHandler handler = cachedHandlers.get(type); if (handler == null) { LazyInterceptorHandler value = new LazyInterceptorHandler(container, type); cachedHandlers.putIfAbsent(type, value); return value; } else { return handler; } } else{ if(type.isAnnotationPresent(Intercepts.class) && !Interceptor.class.isAssignableFrom(type)){ return new AspectStyleInterceptorHandler(type, new StepInvoker(), container); } } return new ToInstantiateInterceptorHandler(container, type); }
Source:
private void writeTarget() throws TransferException { OutputStream out = null; if ( response != null ) { InputStream in = null; try { final HttpEntity entity = response.getEntity(); in = entity.getContent(); out = target.openOutputStream( TransferOperation.DOWNLOAD, true, eventMetadata, deleteFilesOnPath ); copy( in, out ); logger.info( "Ensuring all HTTP data is consumed..." ); EntityUtils.consume( entity ); logger.info( "All HTTP data was consumed." ); } catch ( final IOException e ) { ConcreteResource resource = null; if ( target.exists() ) { try { resource = target.getResource(); target.delete(); } catch ( IOException e1 ) { throw new TransferException( "Failed to write to local proxy store: {}\nOriginal URL: {}. Reason: {}", e1, target, url, e1.getMessage() ); } } throw new TransferContentException( resource, "Failed to write to local proxy store: {}\nOriginal URL: {}. Reason: {}", e, target, url, e.getMessage() ); } finally { closeQuietly( in ); logger.info( "Closing output stream: {}", out ); closeQuietly( out ); } } }

Target:
private void writeTarget() throws TransferException { OutputStream out = null; if ( response != null ) { InputStream in = null; try { final HttpEntity entity = response.getEntity(); in = entity.getContent(); out = target.openOutputStream( TransferOperation.DOWNLOAD, true, eventMetadata, deleteFilesOnPath ); copy( in, out ); logger.info( "Ensuring all HTTP data is consumed..." ); EntityUtils.consume( entity ); logger.info( "All HTTP data was consumed." ); } catch ( final IOException e ) { closeQuietly( in ); closeQuietly( out ); ConcreteResource resource = target.getResource(); try { logger.debug( "Failed to write to local proxy store :{} so delete target:{}",e,target.getPath() ); target.delete(); } catch ( IOException e1 ) { logger.error( "Failed to delete target file: {}\nOriginal URL: {}. Reason: {}", e1, target, url, e1.getMessage() ); throw new TransferException( "Failed to delete target file: {}\nOriginal URL: {}. Reason: {}", e1, target, url, e1.getMessage() ); } logger.error( "Failed to write to local proxy store: {}\nOriginal URL: {}. Reason: {}", e, target, url, e.getMessage() ); throw new TransferContentException( resource, "Failed to write to local proxy store: {}\nOriginal URL: {}. Reason: {}", e, target, url, e.getMessage() ); } finally { closeQuietly( in ); logger.info( "Closing output stream: {}", out ); closeQuietly( out ); } } }
Source:
public void make() { size = ScreenSize.getInstance(); size.calculate(); MenuBarView menuBarView = new MenuBarView(this); setMenuBar(menuBarView.getPanel()); WindowController windowController = new WindowController(this); addWindowListener(windowController); loadingObservers.add(new LoadingMouse(this)); this.setMinimumSize(new Dimension(800, 600)); this.setFocusable(true); this.setVisible(true); }

Target:
public void make() { size = ScreenSize.getInstance(); size.calculate(); MenuBarView menuBarView = new MenuBarView(this); setMenuBar(menuBarView.getPanel()); WindowController windowController = new WindowController(this); addWindowListener(windowController); loadingObservers.add(new LoadingMouse(this)); this.setMinimumSize(new Dimension(size.getMinimumWidth(), size.getMinimumHeight())); this.setFocusable(true); this.setVisible(true); }
Source:
private void safeCopyExternalAssetsToPluginAssetRoot(final String pluginAssetsRoot) { Path externalAssetsPath = Paths.get(systemEnvironment.get(SystemEnvironment.GO_ANALYTICS_PLUGIN_EXTERNAL_ASSETS)); if (externalAssetsPath == null || !Files.exists(externalAssetsPath) || !Files.isDirectory(externalAssetsPath)) { LOGGER.debug("Analytics plugin external assets path ({}) does not exist or is not a directory. Not loading any assets.", externalAssetsPath); return; } try { Files.list(externalAssetsPath).forEach(path -> { try { Files.copy(path, Paths.get(pluginAssetsRoot, path.getFileName().toString())); } catch (Exception e) { LOGGER.error("Unable to copy analytics plugin external asset ({}) to plugin assets root.", path, e); } }); } catch (Exception e) { LOGGER.error("Unable to list files in analytics plugin external assets location ({}).", externalAssetsPath, e); } }

Target:
private void safeCopyExternalAssetsToPluginAssetRoot(final String pluginAssetsRoot) { Path externalAssetsPath = Paths.get(systemEnvironment.get(SystemEnvironment.GO_ANALYTICS_PLUGIN_EXTERNAL_ASSETS)); if (externalAssetsPath == null || !Files.exists(externalAssetsPath) || !Files.isDirectory(externalAssetsPath)) { LOGGER.debug("Analytics plugin external assets path ({}) does not exist or is not a directory. Not loading any assets.", externalAssetsPath); return; } try { Files.list(externalAssetsPath).forEach(path -> { try { Files.copy(path, Paths.get(pluginAssetsRoot, path.getFileName().toString())); } catch (Exception e) { LOGGER.error("Unable to copy analytics plugin external asset ({}) to plugin assets root.", path, e); throw new RuntimeException(e); } }); } catch (Exception e) { LOGGER.error("Unable to list files in analytics plugin external assets location ({}).", externalAssetsPath, e); throw new RuntimeException(e); } }
Source:
public CorfuRuntime addLayoutServer(String layoutServer) { bootstrapLayoutServers.add(layoutServer); return this; }

Target:
public CorfuRuntime addLayoutServer(String layoutServer) { bootstrapLayoutServers.add(layoutServer); layoutServers.add(layoutServer); return this; }
Source:
private Map<String, String> searchProjectsKeysByUuids(DbSession dbSession, List<ComponentDto> components) { Map<String, String> projectsKeysByUuid = components.stream() .filter(c -> c.uuid().equals(c.projectUuid())) .collect(toMap(ComponentDto::uuid, ComponentDto::key)); Predicate<String> alreadyKnowProjectKey = projectsKeysByUuid::containsKey; Set<String> projectUuidsToSearch = components.stream() .map(ComponentDto::projectUuid) .filter(alreadyKnowProjectKey.negate()) .collect(toHashSet()); List<ComponentDto> projects = dbClient.componentDao().selectByUuids(dbSession, projectUuidsToSearch); projectsKeysByUuid.putAll(projects.stream().collect(toMap(ComponentDto::uuid, ComponentDto::key))); return projectsKeysByUuid; }

Target:
private Map<String, String> searchProjectsKeysByUuids(DbSession dbSession, List<ComponentDto> components) { Set<String> projectUuidsToSearch = components.stream() .map(ComponentDto::projectUuid) .collect(toHashSet()); List<ComponentDto> projects = dbClient.componentDao().selectByUuids(dbSession, projectUuidsToSearch); return projects.stream().collect(toMap(ComponentDto::uuid, ComponentDto::key)); }
Source:
private static void setKafkaPropsForProcessingGuarantee(Builder<?, ?> builder) { if (builder.kafkaProps.containsKey(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG)) { throw new IllegalStateException("The KafkaConsumer " + ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG + " setting is not supported. You can configure similar behavior through KafkaSpoutConfig.Builder.setProcessingGuarantee"); } String autoOffsetResetPolicy = (String) builder.kafkaProps.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG); if (builder.processingGuarantee == ProcessingGuarantee.AT_LEAST_ONCE) { if (autoOffsetResetPolicy == null) { builder.kafkaProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); } else if (!autoOffsetResetPolicy.equals("earliest") && !autoOffsetResetPolicy.equals("none")) { LOG.warn("Cannot guarantee at-least-once processing with auto.offset.reset.policy other than 'earliest' or 'none'." + " Some messages may be skipped."); } } else if (builder.processingGuarantee == ProcessingGuarantee.AT_MOST_ONCE) { if (autoOffsetResetPolicy != null && (!autoOffsetResetPolicy.equals("latest") && !autoOffsetResetPolicy.equals("none"))) { LOG.warn("Cannot guarantee at-most-once processing with auto.offset.reset.policy other than 'latest' or 'none'." + " Some messages may be processed more than once."); } } builder.kafkaProps.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false); }

Target:
private static void setKafkaPropsForProcessingGuarantee(Builder<?, ?> builder) { if (builder.kafkaProps.containsKey(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG)) { throw new IllegalStateException("The KafkaConsumer " + ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG + " setting is not supported. You can configure similar behavior through KafkaSpoutConfig.Builder.setProcessingGuarantee"); } String autoOffsetResetPolicy = (String) builder.kafkaProps.get(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG); if (builder.processingGuarantee == ProcessingGuarantee.AT_LEAST_ONCE) { if (autoOffsetResetPolicy == null) { LOG.info("Setting consumer property '{}' to 'earliest' to ensure at-least-once processing", ConsumerConfig.AUTO_OFFSET_RESET_CONFIG); builder.kafkaProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); } else if (!autoOffsetResetPolicy.equals("earliest") && !autoOffsetResetPolicy.equals("none")) { LOG.warn("Cannot guarantee at-least-once processing with auto.offset.reset.policy other than 'earliest' or 'none'." + " Some messages may be skipped."); } } else if (builder.processingGuarantee == ProcessingGuarantee.AT_MOST_ONCE) { if (autoOffsetResetPolicy != null && (!autoOffsetResetPolicy.equals("latest") && !autoOffsetResetPolicy.equals("none"))) { LOG.warn("Cannot guarantee at-most-once processing with auto.offset.reset.policy other than 'latest' or 'none'." + " Some messages may be processed more than once."); } } LOG.info("Setting consumer property '{}' to 'false', because the spout does not support auto-commit", ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG); builder.kafkaProps.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false); }
Source:
public void traverseList() { Node currentNode = head; if (head != null) { do { System.out.print(currentNode.value + " "); currentNode = currentNode.nextNode; } while (currentNode != head); } }

Target:
public void traverseList() { Node currentNode = head; if (head != null) { do { LOGGER.info(currentNode.value + " "); currentNode = currentNode.nextNode; } while (currentNode != head); } }
Source:
public static void main(String[] args) { try { EngineStarter engineStarter = new EngineStarter(); engineStarter.springCtx.registerShutdownHook(); log.debug("Gonna start Messaging."); engineStarter.engineManager.startMessaging(); log.debug("Starting the runners."); engineStarter.engineManager.startRunnerThreads(); log.debug("Done. Perun-Engine has started."); System.out.println("Done. Perun-Engine has started."); if (SplashScreen.getSplashScreen() != null) { SplashScreen.getSplashScreen().close(); } } catch (HeadlessException e) { } catch (Exception e) { System.out.println("Can't start Perun-Engine: " + e); log.error("Can't start Perun-Engine: {}" , e); } }

Target:
public static void main(String[] args) { try { EngineStarter engineStarter = new EngineStarter(); engineStarter.springCtx.registerShutdownHook(); log.debug("Gonna start Messaging."); engineStarter.engineManager.startMessaging(); log.debug("Starting the runners."); engineStarter.engineManager.startRunnerThreads(); log.info("Done. Perun-Engine has started."); System.out.println("Done. Perun-Engine has started."); if (SplashScreen.getSplashScreen() != null) { SplashScreen.getSplashScreen().close(); } } catch (HeadlessException e) { } catch (Exception e) { System.out.println("Can't start Perun-Engine: " + e); log.error("Can't start Perun-Engine: {}" , e); } }
Source:
public void deleteEntriesUsingCachePolicy(int numRowsToDelete) { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); if (numRowsToDelete >= indexEventHolder.size()) { indexEventHolder.deleteAll(); } else { Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); Map<Long, Object> toDelete = new TreeMap<>(); for (Object key : keys) { if (toDelete.size() < numRowsToDelete) { toDelete.put((Long) indexEventHolder.getEvent(key).getOutputData()[cachePolicyAttributePosition], key); } else { Long timestamp = (Long) indexEventHolder.getEvent(key). getOutputData()[cachePolicyAttributePosition]; Long firstKey = (Long) ((TreeMap) toDelete).firstKey(); if (timestamp < firstKey) { toDelete.remove(firstKey); toDelete.put(timestamp, key); } } } for (Object deleteKey : toDelete.values()) { if (deleteKey != null) { indexEventHolder.deleteEvent(deleteKey); } } } }

Target:
public void deleteEntriesUsingCachePolicy(int numRowsToDelete) { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); if (numRowsToDelete >= indexEventHolder.size()) { indexEventHolder.deleteAll(); } else { Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); TreeMap<Long, Object> toDelete = new TreeMap<>(); for (Object key : keys) { if (toDelete.size() < numRowsToDelete) { toDelete.put((Long) indexEventHolder.getEvent(key).getOutputData()[cachePolicyAttributePosition], key); } else { Long timestamp = (Long) indexEventHolder.getEvent(key). getOutputData()[cachePolicyAttributePosition]; Long firstKey = toDelete.firstKey(); if (timestamp < firstKey) { toDelete.remove(firstKey); toDelete.put(timestamp, key); } } } for (Object deleteKey : toDelete.values()) { if (deleteKey != null) { indexEventHolder.deleteEvent(deleteKey); } } } }
Source:
public void put(List<Metric> metrics) { requireNotDisposed(); SystemAssert.requireArgument(metrics != null, "Metric list cannot be null."); List<Metric> metricsToPut = new ArrayList<>(metrics.size()); Set<String> scopesToPut = new HashSet<>(metrics.size()); Set<Pair<String, String>> scopesAndMetricsNamesToPut = new HashSet<>(metrics.size()); Map<String, MetatagsRecord> metatagsToPut = new HashMap<>(); for(Metric metric : metrics) { if(metric.getTags().isEmpty()) { String key = constructKey(metric, null); boolean found = bloomFilter.mightContain(key); if(!found) { metricsToPut.add(metric); } } else { boolean newTags = false; for(Entry<String, String> tagEntry : metric.getTags().entrySet()) { String key = constructKey(metric, tagEntry); boolean found = bloomFilter.mightContain(key); if(!found) { newTags = true; } } if(newTags) { metricsToPut.add(metric); } } String scopeName = metric.getScope(); String metricName = metric.getMetric(); String key = constructScopeOnlyKey(scopeName); boolean found = bloomFilterScopeOnly.mightContain(key); if(!found) { scopesToPut.add(scopeName); } key = constructScopeAndMetricOnlyKey(scopeName, metricName); found = bloomFilterScopeAndMetricOnly.mightContain(key); if(!found) { scopesAndMetricsNamesToPut.add(Pair.of(scopeName, metricName)); } MetatagsRecord mtags = metric.getMetatagsRecord(); if(mtags != null) { key = mtags.getKey(); found = bloomFilterMetatags.mightContain(key); if(!found) { metatagsToPut.put(key, mtags); } } } implementationSpecificPut(metricsToPut, scopesToPut, scopesAndMetricsNamesToPut, metatagsToPut); }

Target:
public void put(List<Metric> metrics) { requireNotDisposed(); SystemAssert.requireArgument(metrics != null, "Metric list cannot be null."); List<Metric> metricsToPut = new ArrayList<>(metrics.size()); Set<String> scopesToPut = new HashSet<>(metrics.size()); Set<Pair<String, String>> scopesAndMetricsNamesToPut = new HashSet<>(metrics.size()); Map<String, MetatagsRecord> metatagsToPut = new HashMap<>(); for(Metric metric : metrics) { if(metric.getTags().isEmpty()) { String key = constructKey(metric, null); boolean found = bloomFilter.mightContain(key); if(!found) { metricsToPut.add(metric); } } else { boolean newTags = false; for(Entry<String, String> tagEntry : metric.getTags().entrySet()) { String key = constructKey(metric, tagEntry); boolean found = bloomFilter.mightContain(key); if(!found) { newTags = true; } } if(newTags) { metricsToPut.add(metric); } } String scopeName = metric.getScope(); String metricName = metric.getMetric(); String key = constructScopeOnlyKey(scopeName); boolean found = bloomFilterScopeOnly.mightContain(key); if(!found) { scopesToPut.add(scopeName); } key = constructScopeAndMetricOnlyKey(scopeName, metricName); found = bloomFilterScopeAndMetricOnly.mightContain(key); if(!found) { scopesAndMetricsNamesToPut.add(Pair.of(scopeName, metricName)); } MetatagsRecord mtags = metric.getMetatagsRecord(); if(mtags != null) { key = mtags.getKey(); if(key != null) { found = bloomFilterMetatags.mightContain(key); if(!found) { metatagsToPut.put(key, mtags); } } } } implementationSpecificPut(metricsToPut, scopesToPut, scopesAndMetricsNamesToPut, metatagsToPut); }
Source:
public Paginable<T> getPaginableEntries() { PageProviderDefinition ppDefinition = getPageProviderDefinition(); if (ppDefinition == null) { throw new NuxeoException("Page provider given not found"); } PageProviderService pps = Framework.getService(PageProviderService.class); Map<String, Serializable> props = new HashMap<>(); props.put(CoreQueryDocumentPageProvider.CORE_SESSION_PROPERTY, (Serializable) ctx.getCoreSession()); List<SortInfo> sortersInfos = null; if (!StringUtils.isBlank(sortBy)) { String[] sorts = sortBy.split(","); String[] orders = null; if (!StringUtils.isBlank(sortOrder)) { orders = sortOrder.split(","); } if (ArrayUtils.isNotEmpty(sorts)) { sortersInfos = new ArrayList<>(sorts.length); for (int i = 0; i < sorts.length; i++) { String sort = sorts[i]; boolean sortAscending = orders != null && orders.length > i && "asc".equals(orders[i].toLowerCase()); sortersInfos.add(new SortInfo(sort, sortAscending)); } } } PageProvider<T> pp = (PageProvider<T>) pps.getPageProvider("", ppDefinition, getSearchDocument(), sortersInfos, pageSize, currentPageIndex, props, getParams()); return getPaginableEntries(pp); }

Target:
public Paginable<T> getPaginableEntries() { PageProviderDefinition ppDefinition = getPageProviderDefinition(); if (ppDefinition == null) { throw new NuxeoException("Page provider given not found"); } PageProviderService pps = Framework.getService(PageProviderService.class); Map<String, Serializable> props = new HashMap<>(); props.put(CoreQueryDocumentPageProvider.CORE_SESSION_PROPERTY, (Serializable) ctx.getCoreSession()); List<SortInfo> sortInfos = null; if (!StringUtils.isBlank(sortBy)) { String[] sorts = sortBy.split(","); String[] orders = null; if (!StringUtils.isBlank(sortOrder)) { orders = sortOrder.split(","); } sortInfos = new ArrayList<>(sorts.length); for (int i = 0; i < sorts.length; i++) { String sort = sorts[i]; boolean sortAscending = orders != null && orders.length > i && "asc".equals(orders[i].toLowerCase()); sortInfos.add(new SortInfo(sort, sortAscending)); } } PageProvider<T> pp = (PageProvider<T>) pps.getPageProvider("", ppDefinition, getSearchDocument(), sortInfos, pageSize, currentPageIndex, props, getParams()); return getPaginableEntries(pp); }
Source:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { if (args.length < 1) { throw new ConfigRuntimeException("bit_xor requires at least one argument", ExceptionType.InsufficientArgumentsException, t); } long val = Static.getInt(args[0], t); for (int i = 1; i < args.length; i++) { val = val ^ Static.getInt(args[i], t); } return new CInt(val, t); }

Target:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { long val = Static.getInt(args[0], t); for (int i = 1; i < args.length; i++) { val = val ^ Static.getInt(args[i], t); } return new CInt(val, t); }
Source:
public int setErrorParameter(BeforeEnterEvent event, ErrorParameter<NotFoundException> parameter) { int retval = super.setErrorParameter(event, parameter); if (!event.getUI().getSession().getConfiguration().isProductionMode()) { String springBootVersion = SpringBootVersion.getVersion(); final String[] numbers = springBootVersion == null ? null : springBootVersion.split("\\."); if (numbers != null && numbers.length > 1 && "2".equals(numbers[0]) && 4 > Integer.parseInt(numbers[1])) { String customMessage = "<span>When using Spring Boot Devtools with " + "automatic reload, please note that routes can sometimes be " + "lost due to a <a href ='<LINK_0>'>" + "compilation race condition</a>. See " + "<a href='<LINK_1>'>" + "the documentation</a> for further workarounds and other " + "live reload alternatives."; getElement().appendChild(new Html(customMessage).getElement()); } } return retval; }

Target:
public int setErrorParameter(BeforeEnterEvent event, ErrorParameter<NotFoundException> parameter) { int retval = super.setErrorParameter(event, parameter); if (!event.getUI().getSession().getConfiguration().isProductionMode()) { String springBootVersion = SpringBootVersion.getVersion(); if (springBootVersion == null || springBootVersion.isEmpty()) { return retval; } FrontendVersion version = new FrontendVersion(springBootVersion); if (version.isOlderThan(new FrontendVersion(2, 4, 0))) { String customMessage = "<span>When using Spring Boot Devtools with " + "automatic reload, please note that routes can sometimes be " + "lost due to a <a href ='<LINK_0>'>" + "compilation race condition</a>. See " + "<a href='<LINK_1>'>" + "the documentation</a> for further workarounds and other " + "live reload alternatives."; getElement().appendChild(new Html(customMessage).getElement()); } } return retval; }
Source:
protected void addVmDynamicToList(VmDynamic vmDynamic) { if (vdsManager.shouldUpdateVmStatus(vmDynamic)) { vmDynamicToSave.put(vmDynamic.getId(), vmDynamic); } }

Target:
protected void addVmDynamicToList(VmDynamic vmDynamic) { vmDynamicToSave.put(vmDynamic.getId(), vmDynamic); }
Source:
public static void updateTimeZone() { final TimeZone timeZone = TmfTimePreferences.getTimeZone(); synchronized (formats) { for (SimpleDateFormat sdf : formats) { sdf.setTimeZone(timeZone); } } }

Target:
public static void updateTimeZone() { final TimeZone timeZone = TmfTimePreferences.getTimeZone(); for (SimpleDateFormat sdf : formats) { synchronized (sdf) { sdf.setTimeZone(timeZone); } } }
Source:
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { CreateCinderSnapshotCommand createCinderSnapshotCommand = (CreateCinderSnapshotCommand) command; CreateCinderSnapshotParameters parameters = (CreateCinderSnapshotParameters) createCinderSnapshotCommand.getParameters(); Guid diskId = parameters.getDestinationImageId(); ImageStatus imageStatus; if (parameters.getSnapshotType().equals(Snapshot.SnapshotType.STATELESS)) { imageStatus = createCinderSnapshotCommand.getCinderBroker().getDiskStatus(diskId); } else { imageStatus = createCinderSnapshotCommand.getCinderBroker().getSnapshotStatus(diskId); } DiskImage disk = DbFacade.getInstance().getDiskImageDao().getSnapshotById(diskId); if (imageStatus != null && imageStatus != disk.getImageStatus()) { switch (imageStatus) { case OK: setCommandEndStatus(command, false, status, childCmdIds); break; case ILLEGAL: setCommandEndStatus(command, true, status, childCmdIds); break; } } }

Target:
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { CreateCinderSnapshotCommand createCinderSnapshotCommand = (CreateCinderSnapshotCommand) command; CreateCinderSnapshotParameters parameters = (CreateCinderSnapshotParameters) createCinderSnapshotCommand.getParameters(); Guid diskId = parameters.getDestinationImageId(); ImageStatus imageStatus; if (parameters.getSnapshotType().equals(Snapshot.SnapshotType.STATELESS)) { imageStatus = createCinderSnapshotCommand.getCinderBroker().getDiskStatus(diskId); } else { imageStatus = createCinderSnapshotCommand.getCinderBroker().getSnapshotStatus(diskId); } DiskImage disk = diskImageDao.getSnapshotById(diskId); if (imageStatus != null && imageStatus != disk.getImageStatus()) { switch (imageStatus) { case OK: setCommandEndStatus(command, false, status, childCmdIds); break; case ILLEGAL: setCommandEndStatus(command, true, status, childCmdIds); break; } } }
Source:
private void setMeasurementSystem(String measurementSystem) { if (StringUtils.isBlank(measurementSystem)) { this.measurementSystem = null; return; } try { this.measurementSystem = MeasurementSystem.valueOf(measurementSystem); } catch (RuntimeException e) { this.measurementSystem = null; } }

Target:
private void setMeasurementSystem(String measurementSystem) { SystemOfUnits oldMeasurementSystem = this.measurementSystem; String ms = StringUtils.isBlank(measurementSystem) ? "" : measurementSystem; switch (ms) { case "SI": this.measurementSystem = SIUnits.getInstance(); break; case "US": this.measurementSystem = ImperialUnits.getInstance(); break; default: logger.debug("Error setting measurement system for value '{}'.", measurementSystem); this.measurementSystem = null; } if (oldMeasurementSystem != null && this.measurementSystem == null) { logger.info("Measurement system is not set, falling back to locale based system."); } else if (this.measurementSystem != null && !this.measurementSystem.equals(oldMeasurementSystem)) { logger.info("Measurement system set to '{}'.", this.measurementSystem.getName()); } }
Source:
public SerializedPage serialize(Slice slice, int positionCount) { checkArgument(slice.isCompact(), "slice is not compact"); int uncompressedSize = slice.length(); byte markers = PageCodecMarker.none(); if (compressor.isPresent()) { int maxCompressedSize = compressor.get().maxCompressedLength(uncompressedSize); ensureCompressionBufferCapacity(maxCompressedSize); int compressedSize = compressor.get().compress((byte[]) slice.getBase(), 0, uncompressedSize, compressionBuffer, 0, maxCompressedSize); if ((((double) compressedSize) / uncompressedSize) <= MINIMUM_COMPRESSION_RATIO) { slice = Slices.copyOf(Slices.wrappedBuffer(compressionBuffer, 0, compressedSize)); markers = COMPRESSED.set(markers); } } if (spillCipher.isPresent()) { slice = Slices.wrappedBuffer(spillCipher.get().encrypt(slice.toByteBuffer())); markers = ENCRYPTED.set(markers); } return new SerializedPage(slice, markers, positionCount, uncompressedSize); }

Target:
public SerializedPage serialize(Slice slice, int positionCount) { checkArgument(slice.isCompact(), "slice is not compact"); return wrapSlice(slice, positionCount); }