auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DocumentModel defaultCreateFolder(CoreSession documentManager, String fullname, String path, String containerTypeName, boolean checkAllowedSubTypes, boolean overwrite) { String title = FileManagerUtils.fetchFileName(fullname); DocumentModel docModel = null; if (overwrite) { docModel = FileManagerUtils.getExistingDocByTitle(documentManager, path, title); if (docModel != null) { return docModel; } } PathRef containerRef = new PathRef(path); if (!documentManager.hasPermission(containerRef, SecurityConstants.READ_PROPERTIES) || !documentManager.hasPermission(containerRef, SecurityConstants.ADD_CHILDREN)) { throw new DocumentSecurityException("Not enough rights to create folder"); } DocumentModel container = documentManager.getDocument(containerRef); if (checkAllowedSubTypes && !getTypeService().isAllowedSubType(containerTypeName, container.getType(), container)) { return null; } PathSegmentService pss = Framework.getService(PathSegmentService.class); docModel = documentManager.createDocumentModel(containerTypeName); docModel.setProperty("dublincore", "title", title); docModel.setPathInfo(path, pss.generatePathSegment(docModel)); docModel = documentManager.createDocument(docModel); documentManager.save(); log.debug("Created container: " + docModel.getName() + " with type " + containerTypeName); return docModel; }

Target:
public DocumentModel defaultCreateFolder(CoreSession documentManager, String fullname, String path, String containerTypeName, boolean checkAllowedSubTypes, boolean overwrite) { String title = FileManagerUtils.fetchFileName(fullname); if (overwrite) { DocumentModel docModel = FileManagerUtils.getExistingDocByTitle(documentManager, path, title); if (docModel != null) { return docModel; } } PathRef containerRef = new PathRef(path); if (!documentManager.hasPermission(containerRef, SecurityConstants.READ_PROPERTIES) || !documentManager.hasPermission(containerRef, SecurityConstants.ADD_CHILDREN)) { throw new DocumentSecurityException("Not enough rights to create folder"); } DocumentModel container = documentManager.getDocument(containerRef); if (checkAllowedSubTypes && !getTypeService().isAllowedSubType(containerTypeName, container.getType(), container)) { return null; } PathSegmentService pss = Framework.getService(PathSegmentService.class); DocumentModel docModel = documentManager.createDocumentModel(containerTypeName); docModel.setProperty("dublincore", "title", title); docModel.setPathInfo(path, pss.generatePathSegment(docModel)); docModel = documentManager.createDocument(docModel); documentManager.save(); log.debug("Created container: " + docModel.getName() + " with type " + containerTypeName); return docModel; }
Source:
protected <T> PagedAsyncCompletionHandler<List<T>> handleIncrementalList(final Class<T> clazz, final String name) { return new PagedAsyncListCompletionHandler<T>(clazz, name) { public void setPagedProperties(JsonNode responseNode, Class<?> clazz) { JsonNode node = responseNode.get(NEXT_PAGE); if (node == null) { throw new NullPointerException(NEXT_PAGE + " property not found, pagination not supported" + (clazz != null ? " for " + clazz.getName() : "")); } JsonNode endTimeNode = responseNode.get(END_TIME); if (endTimeNode == null || endTimeNode.asLong() == 0) { throw new NullPointerException(END_TIME + " property not found, incremental export pagination not supported" + (clazz != null ? " for " + clazz.getName() : "")); } if (endTimeNode.asLong() * 1000 > System.currentTimeMillis() - FIVE_MINUTES_IN_MS) { nextPage = null; } else { nextPage = node.asText(); } } }; }

Target:
protected <T> PagedAsyncCompletionHandler<List<T>> handleIncrementalList(final Class<T> clazz, final String name) { return new PagedAsyncListCompletionHandler<T>(clazz, name) { @Override public void setPagedProperties(JsonNode responseNode, Class<?> clazz) { JsonNode node = responseNode.get(NEXT_PAGE); if (node == null) { throw new NullPointerException(NEXT_PAGE + " property not found, pagination not supported" + (clazz != null ? " for " + clazz.getName() : "")); } JsonNode endTimeNode = responseNode.get(END_TIME); if (endTimeNode == null || endTimeNode.asLong() == 0) { throw new NullPointerException(END_TIME + " property not found, incremental export pagination not supported" + (clazz != null ? " for " + clazz.getName() : "")); } if (TimeUnit.SECONDS.toMillis(endTimeNode.asLong()) > System.currentTimeMillis() - FIVE_MINUTES_IN_MS) { setNextPage(null); } else { setNextPage(node.asText()); } } }; }
Source:
public void testManualToolStayManual() { String gitUrl = "git@github.com:DockstoreTestUser2/dockstore-whalesay-imports.git"; ContainersApi toolsApi = setupWebService(); DockstoreTool tool = getQuayContainer(gitUrl); DockstoreTool toolTest = toolsApi.registerManual(tool); toolsApi.refresh(toolTest.getId()); final CommonTestUtilities.TestingPostgres testingPostgres = getTestingPostgres(); final long count = testingPostgres .runSelectStatement("select count(*) from tool where mode = '" + DockstoreTool.ModeEnum.MANUAL_IMAGE_PATH + "' and giturl = '" + gitUrl + "' and name = 'my-md5sum' and namespace = 'dockstoretestuser2' and toolname = 'altname'", new ScalarHandler<>()); assertTrue("The tool should be manual, there are " + count, count == 1); }

Target:
public void testManualToolStayManual() { String gitUrl = "git@github.com:DockstoreTestUser2/dockstore-whalesay-imports.git"; ContainersApi toolsApi = setupWebService(); DockstoreTool tool = getQuayContainer(gitUrl); DockstoreTool toolTest = toolsApi.registerManual(tool); toolsApi.refresh(toolTest.getId()); final CommonTestUtilities.TestingPostgres testingPostgres = getTestingPostgres(); final long count = testingPostgres .runSelectStatement("select count(*) from tool where mode = '" + DockstoreTool.ModeEnum.MANUAL_IMAGE_PATH + "' and giturl = '" + gitUrl + "' and name = 'my-md5sum' and namespace = 'dockstoretestuser2' and toolname = 'altname'", new ScalarHandler<>()); assertEquals("The tool should be manual, there are " + count, 1, count); }
Source:
public void testTemplateScheduledPushPayloadSerializer() throws Exception { TemplateSelector mergeData = TemplateSelector.newBuilder() .setTemplateId("id123") .addSubstitution("FIRST_NAME", "Prince") .addSubstitution("LAST_NAME", "") .build(); Schedule schedule = Schedule.newBuilder().setScheduledTimestamp(DateTime.now()).build(); TemplateScheduledPushPayload payload = TemplateScheduledPushPayload.newBuilder() .setAudience(Selectors.all()) .setDeviceTypes(DeviceTypeData.of(DeviceType.IOS, DeviceType.ANDROID)) .setMergeData(mergeData) .build(); String templateScheduledPushPayloadSerialized = MAPPER.writeValueAsString(payload); String templateScheduledPushPayloadString = "{" + "\"audience\":\"ALL\"," + "\"device_types\":[\"ios\",\"android\"]," + "\"merge_data\":{" + "\"template_id\":\"id123\"," + "\"substitutions\":{" + "\"FIRST_NAME\":\"Prince\"," + "\"LAST_NAME\":\"\"" + "}" + "}," +"\"schedule\":null"+ "}"; JsonNode jsonFromObject = MAPPER.readTree(templateScheduledPushPayloadSerialized); JsonNode jsonFromString = MAPPER.readTree(templateScheduledPushPayloadString); assertEquals(jsonFromObject, jsonFromString); }

Target:
public void testTemplateScheduledPushPayloadSerializer() throws Exception { TemplateSelector mergeData = TemplateSelector.newBuilder() .setTemplateId("id123") .addSubstitution("FIRST_NAME", "Prince") .addSubstitution("LAST_NAME", "") .build(); Schedule schedule = Schedule.newBuilder().setScheduledTimestamp(DateTime.parse("2019-05-30T07:53:13Z")).build(); TemplateScheduledPushPayload payload = TemplateScheduledPushPayload.newBuilder() .setAudience(Selectors.all()) .setDeviceTypes(DeviceTypeData.of(DeviceType.IOS, DeviceType.ANDROID)) .setMergeData(mergeData) .setSchedule(schedule) .setName("Prince") .build(); String templateScheduledPushPayloadSerialized = MAPPER.writeValueAsString(payload); String templateScheduledPushPayloadString = "{" + "\"audience\":\"ALL\"," + "\"name\":\"Prince\"," + "\"device_types\":[\"ios\",\"android\"]," + "\"merge_data\":{" + "\"template_id\":\"id123\"," + "\"substitutions\":{" + "\"FIRST_NAME\":\"Prince\"," + "\"LAST_NAME\":\"\"" + "}" + "}," +"\"schedule\":{\"scheduled_time\":\"2019-05-30T07:53:13\"}"+ "}"; JsonNode jsonFromObject = MAPPER.readTree(templateScheduledPushPayloadSerialized); JsonNode jsonFromString = MAPPER.readTree(templateScheduledPushPayloadString); assertEquals(jsonFromObject, jsonFromString); }
Source:
void postConstruct() { metrics.registerAll(namespace("bufpool", new BufferPoolMetricSet(mbs))); metrics.register(base + ".fd", new FileDescriptorMetricSet()); metrics.registerAll(namespace("gc", new GarbageCollectorMetricSet())); metrics.registerAll(namespace("mem", new MemoryUsageGaugeSet())); metrics.registerAll(namespace("class", new ClassLoadingGaugeSet())); metrics.registerAll(namespace("thread", new ThreadStatesGaugeSet())); metrics.register(base + ".cpu.load", new CpuLoadGauge()); nmtMetrics.register(); }

Target:
void postConstruct() { metrics.registerAll(namespace("bufpool", new BufferPoolMetricSet(mbs))); metrics.registerAll(namespace("fd", new FileDescriptorMetricSet())); metrics.registerAll(namespace("gc", new GarbageCollectorMetricSet())); metrics.registerAll(namespace("mem", new MemoryUsageGaugeSet())); metrics.registerAll(namespace("class", new ClassLoadingGaugeSet())); metrics.registerAll(namespace("thread", new ThreadStatesGaugeSet())); metrics.register(BASE + ".cpu.load", new CpuLoadGauge()); nmtMetrics.register(); }
Source:
public synchronized void authenticate() throws PortalSecurityException { this.isauth = false; if (this.myPrincipal.UID != null && this.myOpaqueCredentials.credentialstring != null) { StringBuilder msg = new StringBuilder(); msg.append("An attempt to log into the local login has occurred. "); msg.append("user=" + this.myPrincipal.UID); if (log.isWarnEnabled()) log.warn(msg.toString()); try { ILocalAccountDao accountStore = LocalAccountDaoLocator.getLocalAccountDao(); IPortalPasswordService passwordService = PortalPasswordServiceLocator.getPortalPasswordService(); ILocalAccountPerson account = accountStore.getPerson(this.myPrincipal.UID); if (account != null) { String loginPassword = new String(this.myOpaqueCredentials.credentialstring, UTF_8); if (passwordService.validatePassword(loginPassword, account.getPassword())) { String fullName = (String) account.getAttributeValue("displayName"); this.myPrincipal.FullName = fullName; if (log.isInfoEnabled()) log.info("User " + this.myPrincipal.UID + " is authenticated"); this.isauth = true; } else { log.info("Password Invalid"); } } else { if (log.isInfoEnabled()) log.info("No such user: " + this.myPrincipal.UID); } } catch (Exception e) { log.error("Error authenticating user", e); throw new RuntimeException("Error authenticating user", e); } } else { log.info("Principal or OpaqueCredentials not initialized prior to authenticate"); } super.authenticate(); return; }

Target:
public synchronized void authenticate() throws PortalSecurityException { this.isauth = false; if (this.myPrincipal.UID != null && this.myOpaqueCredentials.credentialstring != null) { if (log.isWarnEnabled()) log.warn( "An attempt to log into the local login has occurred. user=" + this.myPrincipal.UID); try { ILocalAccountDao accountStore = LocalAccountDaoLocator.getLocalAccountDao(); IPortalPasswordService passwordService = PortalPasswordServiceLocator.getPortalPasswordService(); ILocalAccountPerson account = accountStore.getPerson(this.myPrincipal.UID); if (account != null) { String loginPassword = new String(this.myOpaqueCredentials.credentialstring, UTF_8); if (passwordService.validatePassword(loginPassword, account.getPassword())) { String fullName = (String) account.getAttributeValue("displayName"); this.myPrincipal.FullName = fullName; if (log.isInfoEnabled()) log.info("User " + this.myPrincipal.UID + " is authenticated"); this.isauth = true; } else { log.info("Password Invalid"); } } else { if (log.isInfoEnabled()) log.info("No such user: " + this.myPrincipal.UID); } } catch (Exception e) { log.error("Error authenticating user", e); throw new RuntimeException("Error authenticating user", e); } } else { log.info("Principal or OpaqueCredentials not initialized prior to authenticate"); } super.authenticate(); return; }
Source:
public boolean matchPod(String podName) { try { return machines .getMachines(identity) .values() .stream() .filter(m -> m.getPodName() != null) .anyMatch(m -> m.getPodName().equals(podName)); } catch (InfrastructureException e) { LOG.error( "Failed to get the machines when checking whether LogHandler do care about pod [{}]. Not much to do here.", podName, e); return false; } }

Target:
public boolean matchPod(String podName) { return podNames.contains(podName); }
Source:
public boolean isFinished() { if (!finishing) { return false; } if (joinPagesNotNeeded.isPresent() && !joinPagesNotNeeded.get().isDone()) { return false; } return true; }

Target:
public boolean isFinished() { return probeDoneWithPages.map(Future::isDone).orElse(false); }
Source:
public PatientProgram savePatientProgram(PatientProgram patientProgram) throws APIException { if (patientProgram.getPatient() == null || patientProgram.getProgram() == null) { throw new APIException("PatientProgram.requires", (Object[]) null); } for (PatientState state : patientProgram.getStates()) { if (state.getState() == null) { throw new APIException("PatientState.requires", (Object[]) null); } if (state.getPatientProgram() == null) { state.setPatientProgram(patientProgram); } else if (!state.getPatientProgram().equals(patientProgram)) { throw new APIException("PatientProgram.already.assigned", new Object[] { state.getPatientProgram() }); } if (patientProgram.getVoided() || state.getVoided()) { state.setVoided(true); if (state.getVoidReason() == null && patientProgram.getVoidReason() != null) { state.setVoidReason(patientProgram.getVoidReason()); } } } for (PatientState state : patientProgram.getMostRecentStateInEachWorkflow()) { state.setEndDate(patientProgram.getDateCompleted()); } return dao.savePatientProgram(patientProgram); }

Target:
public PatientProgram savePatientProgram(PatientProgram patientProgram) throws APIException { if (patientProgram.getPatient() == null || patientProgram.getProgram() == null) { throw new APIException("PatientProgram.requires", (Object[]) null); } for (PatientState state : patientProgram.getStates()) { if (state.getState() == null) { throw new APIException("PatientState.requires", (Object[]) null); } if (state.getPatientProgram() == null) { state.setPatientProgram(patientProgram); } else if (!state.getPatientProgram().equals(patientProgram)) { throw new APIException("PatientProgram.already.assigned", new Object[] { state.getPatientProgram() }); } if (patientProgram.getVoided() || state.getVoided()) { state.setVoided(true); if (state.getVoidReason() == null && patientProgram.getVoidReason() != null) { state.setVoidReason(patientProgram.getVoidReason()); } } } if (patientProgram.getDateCompleted() != null) { for (PatientState state : patientProgram.getMostRecentStateInEachWorkflow()) { if (state.getEndDate() == null) { state.setEndDate(patientProgram.getDateCompleted()); } } } return dao.savePatientProgram(patientProgram); }
Source:
public boolean next(K key, V value) throws IOException { if (eof) { return false; } if (firstRecord) { firstRecord = false; return true; } if (realReader instanceof MapredInputFormatCompatible) { ((MapredInputFormatCompatible) realReader).setKeyValue(key, value); } try { if (realReader.nextKeyValue()) { if (key != realReader.getCurrentKey()) { if (realReader instanceof MapredInputFormatCompatible) { throw new IOException("The RecordReader returned a key and value that do not match " + "the key and value sent to it. This means the RecordReader did not properly implement " + "com.twitter.elephantbird.mapred.input.MapredInputFormatCompatible. " + "Current reader class : " + realReader.getClass()); } else { throw new IOException("DeprecatedInputFormatWrapper only " + "supports RecordReaders that return the same key & value " + "objects or implement com.twitter.elephantbird.mapred.input.MapredInputFormatCompatible. " + "Current reader class : " + realReader.getClass()); } } if (value != realReader.getCurrentValue()) { if (null != valueCopier) valueCopier.copyValue(value, realReader.getCurrentValue()); else { throw new IOException("DeprecatedInputFormatWrapper - value is different " + "and no value copier provided. " + "Current reader class : " + realReader.getClass()); } } return true; } } catch (InterruptedException e) { throw new IOException(e); } eof = true; return false; }

Target:
public boolean next(K key, V value) throws IOException { if (eof) { return false; } if (firstRecord) { firstRecord = false; return true; } if (mifcReader != null) { mifcReader.setKeyValue(key, value); } try { if (realReader.nextKeyValue()) { if (key != realReader.getCurrentKey()) { if (mifcReader != null) { throw new IOException("The RecordReader returned a key and value that do not match " + "the key and value sent to it. This means the RecordReader did not properly implement " + "com.twitter.elephantbird.mapred.input.MapredInputFormatCompatible. " + "Current reader class : " + realReader.getClass()); } else { throw new IOException("DeprecatedInputFormatWrapper only " + "supports RecordReaders that return the same key & value " + "objects or implement com.twitter.elephantbird.mapred.input.MapredInputFormatCompatible. " + "Current reader class : " + realReader.getClass()); } } if (value != realReader.getCurrentValue()) { if (null != valueCopier) valueCopier.copyValue(value, realReader.getCurrentValue()); else { throw new IOException("DeprecatedInputFormatWrapper - value is different " + "and no value copier provided. " + "Current reader class : " + realReader.getClass()); } } return true; } } catch (InterruptedException e) { throw new IOException(e); } eof = true; return false; }
Source:
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { return "Alrighty!"; }

Target:
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) { return null; }
Source:
public WorkspaceConfigDto buildDefaultWorkspaceConfig(String name) { Map<String, String> attributes = new HashMap<>(); attributes.put(WORKSPACE_TOOLING_EDITOR_ATTRIBUTE, "org.eclipse.che.editor.theia:1.0.0"); attributes.put(WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE, "che-machine-exec-plugin:0.0.1"); return newDto(WorkspaceConfigDto.class).withName(name).withAttributes(attributes); }

Target:
public WorkspaceConfigDto buildDefaultWorkspaceConfig(String name) { Map<String, String> attributes = new HashMap<>(); attributes.put(WORKSPACE_TOOLING_EDITOR_ATTRIBUTE, defaultCheEditor); attributes.put(WORKSPACE_TOOLING_PLUGINS_ATTRIBUTE, defaultChePlugins); return newDto(WorkspaceConfigDto.class).withName(name).withAttributes(attributes); }
Source:
private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) { if (validationStatus.isOK()) { return; } final IStatus rootStatus = validationStatus; List allStatuses = new ArrayList(); collectTargetElements(rootStatus, new HashSet(), allStatuses); for (Iterator it = allStatuses.iterator(); it.hasNext();) { IConstraintStatus nextStatus = (IConstraintStatus) it.next(); DSemanticDecorator dSemanticDecorator = getDSemanticDecorator(nextStatus.getTarget(), diagramEditPart); if (dSemanticDecorator != null) { View view = SiriusGMFHelper.getGmfView(dSemanticDecorator); String qualifiedName = EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true); if (nextStatus instanceof RuleWrappingStatus) { createValidationRuleMarker((RuleWrappingStatus) nextStatus, diagramEditPart.getViewer(), target, view, qualifiedName, nextStatus.getMessage(), nextStatus.getSeverity()); } else { addMarker(diagramEditPart.getViewer(), target, view, qualifiedName, nextStatus.getMessage(), nextStatus.getSeverity()); } } } }

Target:
private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) { if (validationStatus.isOK()) { return; } final IStatus rootStatus = validationStatus; List allStatuses = new ArrayList(); collectTargetElements(rootStatus, new HashSet(), allStatuses); for (Iterator it = allStatuses.iterator(); it.hasNext();) { IConstraintStatus nextStatus = (IConstraintStatus) it.next(); DSemanticDecorator dSemanticDecorator = getDSemanticDecorator(nextStatus.getTarget(), diagramEditPart); View view = null; if (dSemanticDecorator != null) { view = SiriusGMFHelper.getGmfView(dSemanticDecorator); } if (view == null) { view = diagramEditPart.getDiagramView(); } String qualifiedName = EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true); if (nextStatus instanceof RuleWrappingStatus) { createValidationRuleMarker((RuleWrappingStatus) nextStatus, diagramEditPart.getViewer(), target, view, qualifiedName, nextStatus.getMessage(), nextStatus.getSeverity()); } else { addMarker(diagramEditPart.getViewer(), target, view, qualifiedName, nextStatus.getMessage(), nextStatus.getSeverity()); } } }
Source:
public void testSetWithUTF8Key(Method m) throws InterruptedException, ExecutionException, TimeoutException { OperationFuture<Boolean> f = client.set(k(m, "你好-"), 0, v(m)); assertTrue(f.get(timeout, TimeUnit.SECONDS)); assertEquals(v(m), client.get(k(m, "你好-"))); }

Target:
public void testSetWithUTF8Key(Method m) throws InterruptedException, ExecutionException, TimeoutException { String key = "\u4f60\u597d-"; OperationFuture<Boolean> f = client.set(k(m, key), 0, v(m)); assertTrue(f.get(timeout, TimeUnit.SECONDS)); assertEquals(v(m), client.get(k(m, key))); }
Source:
public void run() { LOG.info("Kill signal recieved, trying to shutdown tailer gracefully"); manager.stopPipes(); }

Target:
public void run() { manager.stopAsync(); }
Source:
public void putWithMerge(REF_DO refDo, AR_DO arDo) { ChannelAccess channelAccess = mapArDo2ChannelAccess(arDo); putWithMerge(refDo, channelAccess); }

Target:
public void putWithMerge(REF_DO refDo, AR_DO arDo) { if (refDo.isCarrierPrivilegeRefDo()) { return; } ChannelAccess channelAccess = mapArDo2ChannelAccess(arDo); putWithMerge(refDo, channelAccess); }
Source:
public void validateConnectionTest() throws Exception { TestUtils.assertException(IllegalArgumentException.class, () -> serverSecurityService.validateConnection(null).get(), null); EmbeddedChannel channel = new EmbeddedChannel(); ChannelHandlerContext ctx = new MockChannelHandlerContext(channel); try { serverSecurityService.validateConnection(ctx, (r, e) -> { Assert.assertNull("result not null", r); Assert.assertNull("exception not null", e); }); } catch (Exception e) { Assert.fail("unexpected exception happened" + e); } serverSecurityService.close(); ThrowingConsumer<ExecutionException> errorAction = e -> { Assert.assertTrue("Exception should have been an instance of RestServiceException", e.getCause() instanceof RestServiceException); RestServiceException re = (RestServiceException) e.getCause(); Assert.assertEquals("Unexpected RestServerErrorCode (Future)", RestServiceErrorCode.ServiceUnavailable, re.getErrorCode()); }; TestUtils.assertException(ExecutionException.class, () -> serverSecurityService.validateConnection(ctx).get(), errorAction); }

Target:
public void validateConnectionTest() throws Exception { TestUtils.assertException(IllegalArgumentException.class, () -> serverSecurityService.validateConnection(null).get(), null); SSLSession sslSession = Mockito.mock(SSLSession.class); serverSecurityService.validateConnection(sslSession, (r, e) -> { Assert.assertNull("result not null", r); Assert.assertNull("exception not null", e); }); serverSecurityService.close(); ThrowingConsumer<ExecutionException> errorAction = e -> { Assert.assertTrue("Exception should have been an instance of RestServiceException", e.getCause() instanceof RestServiceException); RestServiceException re = (RestServiceException) e.getCause(); Assert.assertEquals("Unexpected RestServerErrorCode (Future)", RestServiceErrorCode.ServiceUnavailable, re.getErrorCode()); }; TestUtils.assertException(ExecutionException.class, () -> serverSecurityService.validateConnection(sslSession).get(), errorAction); }
Source:
public void testIsStringLiteral() { Set<ASTLiteral> literals = getNodes(ASTLiteral.class, TEST1); ASTLiteral literal = literals.iterator().next(); assertTrue(literal.isStringLiteral()); assertEquals("String", literal.getTypeImage()); }

Target:
public void testIsStringLiteral() { Set<ASTLiteral> literals = getNodes(ASTLiteral.class, TEST1); assertTrue((literals.iterator().next()).isStringLiteral()); }
Source:
public String handleCallBack(HttpMessage msg) throws ApiException { try { String query = msg.getRequestHeader().getURI().getQuery(); if (query == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "action"); } Map<String, String> parameters = Stream.of(query.split("&")) .map(paramAndValue -> paramAndValue.split("=")) .collect(Collectors.toMap( e -> e[0], e -> e[1] )); String action = parameters.get("action"); if (action == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "action"); } LOGGER.debug("action = " + action); switch (action) { case "getFile": return getFileFromParameters(msg, parameters); case "createAlert": return createAlertFromMessage(msg); default: throw new ApiException (ApiException.Type.ILLEGAL_PARAMETER, "action"); } } catch (ApiException e) { throw e; } catch (Exception e) { throw new ApiException (ApiException.Type.URL_NOT_FOUND, msg.getRequestHeader().getURI().toString()); } }

Target:
public String handleCallBack(HttpMessage msg) throws ApiException { try { String query = msg.getRequestHeader().getURI().getQuery(); if (query == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "action"); } Map<String, String> parameters = parameterParser .getParams(msg, HtmlParameter.Type.url); String action = parameters.get("action"); if (action == null) { throw new ApiException (ApiException.Type.MISSING_PARAMETER, "action"); } LOGGER.debug("action = " + action); switch (action) { case "getFile": return getFileFromParameters(msg, parameters); case "createAlert": return createAlertFromMessage(msg); default: throw new ApiException (ApiException.Type.ILLEGAL_PARAMETER, "action"); } } catch (ApiException e) { throw e; } catch (Exception e) { throw new ApiException (ApiException.Type.URL_NOT_FOUND, msg.getRequestHeader().getURI().toString()); } }
Source:
public long intern(String string, int quark) throws IndexOutOfBoundsException, TimeRangeException, StateSystemDisposedException { Map<String, Long> stringPool = fStringPools.computeIfAbsent(quark, unused -> HashBiMap.<String, Long> create()); Long index = stringPool.get(string); if (index == null) { long size = stringPool.size() + getStartTime(); stringPool.put(string, size); modifyAttribute(size, string, quark); return size; } return index; }

Target:
public long intern(String string, int quark) throws IndexOutOfBoundsException, TimeRangeException, StateSystemDisposedException { Map<String, Long> stringPool = fStringPools.computeIfAbsent(quark, unused -> HashBiMap.<String, Long> create()); Long index = stringPool.get(string); if (index == null) { long internValue = stringPool.size() + getStartTime(); stringPool.put(string, internValue); modifyAttribute(internValue, string, quark); return size; } return index; }
Source:
private void createLdapContext() throws NamingException { Hashtable<Object, Object> connProp = getConnectionProperties(ldapConfig); if (!LDAPConstants.AUTH_TYPE_NONE.equals(ldapConfig.getAuthType())) { vaultCharSecret = getVaultSecret(); if (vaultCharSecret != null && !ldapConfig.isStartTls()) { connProp.put(SECURITY_CREDENTIALS, vaultCharSecret.getAsArray() .orElse(ldapConfig.getBindCredential().toCharArray())); } } ldapContext = new InitialLdapContext(connProp, null); if (ldapConfig.isStartTls()) { SSLSocketFactory sslSocketFactory = null; String useTruststoreSpi = ldapConfig.getUseTruststoreSpi(); if (useTruststoreSpi != null && useTruststoreSpi.equals(LDAPConstants.USE_TRUSTSTORE_ALWAYS)) { TruststoreProviderFactory truststoreFactory = (TruststoreProviderFactory) session.getKeycloakSessionFactory().getProviderFactory(TruststoreProvider.class, "file"); TruststoreProvider provider = truststoreFactory.create(session); sslSocketFactory = provider.getSSLSocketFactory(); } tlsResponse = startTLS(ldapContext, ldapConfig.getAuthType(), ldapConfig.getBindDN(), vaultCharSecret.getAsArray().orElse(ldapConfig.getBindCredential().toCharArray()), sslSocketFactory); if (tlsResponse == null) { throw new NamingException("Wasn't able to establish LDAP connection through StartTLS"); } } }

Target:
private void createLdapContext() throws NamingException { Hashtable<Object, Object> connProp = getConnectionProperties(ldapConfig); if (!LDAPConstants.AUTH_TYPE_NONE.equals(ldapConfig.getAuthType())) { vaultCharSecret = getVaultSecret(); if (vaultCharSecret != null && !ldapConfig.isStartTls()) { connProp.put(SECURITY_CREDENTIALS, vaultCharSecret.getAsArray() .orElse(ldapConfig.getBindCredential().toCharArray())); } } ldapContext = new InitialLdapContext(connProp, null); if (ldapConfig.isStartTls()) { SSLSocketFactory sslSocketFactory = null; String useTruststoreSpi = ldapConfig.getUseTruststoreSpi(); if (useTruststoreSpi != null && useTruststoreSpi.equals(LDAPConstants.USE_TRUSTSTORE_ALWAYS)) { TruststoreProvider provider = session.getProvider(TruststoreProvider.class); sslSocketFactory = provider.getSSLSocketFactory(); } tlsResponse = startTLS(ldapContext, ldapConfig.getAuthType(), ldapConfig.getBindDN(), vaultCharSecret.getAsArray().orElse(ldapConfig.getBindCredential().toCharArray()), sslSocketFactory); if (tlsResponse == null) { throw new NamingException("Wasn't able to establish LDAP connection through StartTLS"); } } }
Source:
private void checkUnreadyConnectionsStatus() { Iterator<Map.Entry<String, Long>> iterator = connectionPendingHandshakeTimer.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, Long> entry = iterator.next(); if (isChannelReady(entry.getKey())) { connected.add(entry.getKey()); metrics.selectorConnectionCreated.inc(); metrics.selectorPerceivedSslHandshakeTime.update(System.currentTimeMillis() - entry.getValue()); iterator.remove(); connectionsPendingHandshakeCount.decrementAndGet(); } } }

Target:
private void checkUnreadyConnectionsStatus() { Iterator<String> iterator = unreadyConnections.iterator(); while (iterator.hasNext()) { String connId = iterator.next(); if (isChannelReady(connId)) { connected.add(connId); iterator.remove(); metrics.selectorConnectionCreated.inc(); } } }
Source:
public HiOrgServerProfile extractUserProfile(String body) { final HiOrgServerProfile profile = newProfile(); final JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { logger.debug("Extracting user profile from JSON node " + json); profile.setId(ProfileHelper.sanitizeIdentifier(profile, JsonHelper.getElement(json, USER_ID))); for (final String attribute : getPrimaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(json, attribute)); } } else { logger.debug("No JSON node to extract user profile was created"); } extractRoles(profile); return profile; }

Target:
public HiOrgServerProfile extractUserProfile(String body) { final HiOrgServerProfile profile = newProfile(); final JsonNode json = JsonHelper.getFirstNode(body); if (json != null) { logger.debug("Extracting user profile from JSON node " + json); profile.setId(ProfileHelper.sanitizeIdentifier(profile, JsonHelper.getElement(json, USER_ID))); for (final String attribute : getPrimaryAttributes()) { convertAndAdd(profile, PROFILE_ATTRIBUTE, attribute, JsonHelper.getElement(json, attribute)); } } else { logger.error("Unable to extract user profile as no JSON node was found in body: {}", body); throw new TechnicalException("No JSON node to extract user profile from"); } extractRoles(profile); return profile; }
Source:
public void getMostRecentElementsIncludeDeleted() { when(mockMapper.batchLoad(any(List.class))).thenReturn(appConfigElementMapId1And2()); List<AppConfigElement> returned = dao.getMostRecentElements(TestConstants.TEST_STUDY, true); assertEquals(2, returned.size()); assertIdAndRevision(returned.get(0), ID_1, 3L); assertIdAndRevision(returned.get(1), ID_2, 3L); }

Target:
public void getMostRecentElementsIncludeDeleted() { when(mockMapper.batchLoad(any(List.class))).thenReturn(appConfigElementMapId1And2()); List<AppConfigElement> returned = dao.getMostRecentElements(TestConstants.TEST_STUDY, true); assertEquals(2, returned.size()); assertIdAndRevision(returned.get(0), ID_1, 3L); assertIdAndRevision(returned.get(1), ID_2, 3L); verify(mockMapper).query(eq(DynamoAppConfigElement.class), queryCaptor.capture()); DynamoDBQueryExpression<DynamoAppConfigElement> query = queryCaptor.getValue(); assertEquals(DynamoAppConfigElementDao.STUDY_ID_INDEX_NAME, query.getIndexName()); assertFalse(query.isConsistentRead()); assertFalse(query.isScanIndexForward()); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, query.getHashKeyValues().getStudyId()); assertNull(query.getHashKeyValues().getId()); }
Source:
public Polygon(double[] lat, double[] lon) { if (lat.length != lon.length) { throw new IllegalArgumentException("Points must be of equal length but was " + lat.length + " vs. " + lon.length); } if (lat.length == 0) { throw new IllegalArgumentException("Points must not be empty"); } this.lat = lat; this.lon = lon; for (int i = 0; i < lat.length; i++) { if (i == 0) { minLat = lat[i]; maxLat = lat[i]; minLon = lon[i]; maxLon = lon[i]; } else { if (lat[i] < minLat) { minLat = lat[i]; } else if (lat[i] > maxLat) { maxLat = lat[i]; } if (lon[i] < minLon) { minLon = lon[i]; } else if (lon[i] > maxLon) { maxLon = lon[i]; } } } minLat -= GROWN_FACTOR; minLon -= GROWN_FACTOR; maxLat += GROWN_FACTOR; maxLon += GROWN_FACTOR; epsilon = (maxLat - minLat) / 10; }

Target:
public Polygon(double[] lat, double[] lon) { this(lat, lon, 0); }
Source:
public Optional<UsernamePasswordCredentials> extract(WebContext context) { final Optional<TokenCredentials> credentials = this.extractor.extract(context); return credentials.flatMap( c -> { final byte[] decoded = Base64.getDecoder().decode(c.getToken()); String token; try { token = new String(decoded, "UTF-8"); } catch (final UnsupportedEncodingException e) { throw new CredentialsException("Bad format of the basic auth header"); } final int delim = token.indexOf(":"); if (delim < 0) { throw new CredentialsException("Bad format of the basic auth header"); } return Optional.of( new UsernamePasswordCredentials( token.substring(0, delim), token.substring(delim + 1) ) ); }); }

Target:
public Optional<UsernamePasswordCredentials> extract(WebContext context) { final Optional<TokenCredentials> credentials = this.extractor.extract(context); return credentials.map(c -> { final byte[] decoded = Base64.getDecoder().decode(c.getToken()); String token; try { token = new String(decoded, "UTF-8"); } catch (final UnsupportedEncodingException e) { throw new CredentialsException("Bad format of the basic auth header"); } final int delim = token.indexOf(":"); if (delim < 0) { throw new CredentialsException("Bad format of the basic auth header"); } return new UsernamePasswordCredentials( token.substring(0, delim), token.substring(delim + 1) ); }); }
Source:
public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException { IResource[] toScan = resources; for (IResource resource : resources) { if (resource.getType() == IResource.ROOT) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, monitor); cache.merge(newCache); super.refresh(resources, depth, monitor); return; } } List<String> paths = new ArrayList<String>(); for (IResource resource : toScan) { IProject project = resource.getProject(); if (gsds.contains(project)) { GitSynchronizeData data = gsds.getData(project); if (data != null) { paths.add(RepositoryMapping.getMapping(project) .getRepoRelativePath(resource)); } } } if (!paths.isEmpty()) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, paths, monitor); cache.merge(newCache); } super.refresh(resources, depth, monitor); }

Target:
public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException { for (IResource resource : resources) { if (resource.getType() == IResource.ROOT) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, monitor); cache.merge(newCache); super.refresh(resources, depth, monitor); return; } } List<String> paths = new ArrayList<String>(); for (IResource resource : resources) { IProject project = resource.getProject(); if (gsds.contains(project)) { String path = RepositoryMapping.getMapping(project) .getRepoRelativePath(resource); if (!path.equals("")) { paths.add(path); } } } if (!paths.isEmpty()) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, paths, monitor); cache.merge(newCache); } super.refresh(resources, depth, monitor); }
Source:
public PushSetupSms execute(final LnClientConnection conn, final DlmsDevice device, final Void useless) throws IOException, TimeoutException, ProtocolAdapterException { LOGGER.info("Retrieving Push Setup Alarm"); final List<GetResult> getResultList = this.dlmsHelperService.getWithList(conn, device, ATTRIBUTE_ADDRESSES); checkResultList(getResultList, ATTRIBUTE_ADDRESSES); final PushSetupSms.Builder pushSetupSmsBuilder = new PushSetupSms.Builder(); pushSetupSmsBuilder.logicalName(new CosemObisCode(OBIS_CODE.bytes())); pushSetupSmsBuilder.pushObjectList(this.dlmsHelperService.readListOfObjectDefinition( getResultList.get(INDEX_PUSH_OBJECT_LIST), "Push Object List")); pushSetupSmsBuilder.sendDestinationAndMethod(this.dlmsHelperService.readSendDestinationAndMethod( getResultList.get(INDEX_SEND_DESTINATION_AND_METHOD), "Send Destination And Method")); pushSetupSmsBuilder.communicationWindow(this.dlmsHelperService.readListOfWindowElement( getResultList.get(INDEX_COMMUNICATION_WINDOW), "Communication Window")); pushSetupSmsBuilder.randomisationStartInterval(this.dlmsHelperService.readLongNotNull( getResultList.get(INDEX_RANDOMISATION_START_INTERVAL), "Randomisation Start Interval").intValue()); pushSetupSmsBuilder.numberOfRetries(this.dlmsHelperService.readLongNotNull( getResultList.get(INDEX_NUMBER_OF_RETRIES), "Number of Retries").intValue()); pushSetupSmsBuilder.repetitionDelay(this.dlmsHelperService.readLongNotNull( getResultList.get(INDEX_REPETITION_DELAY), "Repetition Delay").intValue()); return pushSetupSmsBuilder.build(); }

Target:
public PushSetupSms execute(final LnClientConnection conn, final DlmsDevice device, final Void useless) throws ProtocolAdapterException { LOGGER.info("Retrieving Push Setup Alarm"); final List<GetResult> getResultList = this.dlmsHelperService.getWithList(conn, device, ATTRIBUTE_ADDRESSES); GetPushSetupCommandExecutor.checkResultList(getResultList, ATTRIBUTE_ADDRESSES); final PushSetupSms.Builder pushSetupSmsBuilder = new PushSetupSms.Builder(); pushSetupSmsBuilder.logicalName(new CosemObisCode(OBIS_CODE.bytes())); pushSetupSmsBuilder.pushObjectList(this.dlmsHelperService.readListOfObjectDefinition( getResultList.get(INDEX_PUSH_OBJECT_LIST), "Push Object List")); pushSetupSmsBuilder.sendDestinationAndMethod(this.dlmsHelperService.readSendDestinationAndMethod( getResultList.get(INDEX_SEND_DESTINATION_AND_METHOD), "Send Destination And Method")); pushSetupSmsBuilder.communicationWindow(this.dlmsHelperService.readListOfWindowElement( getResultList.get(INDEX_COMMUNICATION_WINDOW), "Communication Window")); pushSetupSmsBuilder.randomisationStartInterval(this.dlmsHelperService.readLongNotNull( getResultList.get(INDEX_RANDOMISATION_START_INTERVAL), "Randomisation Start Interval").intValue()); pushSetupSmsBuilder.numberOfRetries(this.dlmsHelperService.readLongNotNull( getResultList.get(INDEX_NUMBER_OF_RETRIES), "Number of Retries").intValue()); pushSetupSmsBuilder.repetitionDelay(this.dlmsHelperService.readLongNotNull( getResultList.get(INDEX_REPETITION_DELAY), "Repetition Delay").intValue()); return pushSetupSmsBuilder.build(); }
Source:
public String process(String input, Class<?> scope, String name) { RequestCycle cycle = RequestCycle.get(); Url cssUrl = Url.parse(name); Matcher matcher = URL_PATTERN.matcher(input); StringBuffer output = new StringBuffer(); while (matcher.find()) { Url imageCandidateUrl = Url.parse(matcher.group(1)); CharSequence processedUrl; boolean embedded = false; if (imageCandidateUrl.isFull()) { processedUrl = imageCandidateUrl.toString(Url.StringMode.FULL); } else if (imageCandidateUrl.isContextAbsolute()) { processedUrl = imageCandidateUrl.toString(); } else { Url cssUrlCopy = new Url(cssUrl); cssUrlCopy.resolveRelative(imageCandidateUrl); if (cssUrlCopy.getQueryString() != null && cssUrlCopy.getQueryString().contains(EMBED_BASE64)) { embedded = true; PackageResourceReference imageReference = new PackageResourceReference(scope, cssUrlCopy.toString().replace("?" + EMBED_BASE64, "")); try { processedUrl = createBase64EncodedImage(imageReference); } catch (Exception e) { throw new WicketRuntimeException( "Error while embedding an image into the css: " + imageReference.toString(), e); } } else { PackageResourceReference imageReference = new PackageResourceReference(scope, cssUrlCopy.toString()); processedUrl = cycle.urlFor(imageReference, null); } } matcher.appendReplacement(output, embedded ? "url(" + processedUrl + ")" : "url('" + processedUrl + "')"); } matcher.appendTail(output); return output.toString(); }

Target:
public String process(String input, Class<?> scope, String name) { RequestCycle cycle = RequestCycle.get(); Url cssUrl = Url.parse(name); Matcher matcher = URL_PATTERN.matcher(input); StringBuffer output = new StringBuffer(); while (matcher.find()) { Url imageCandidateUrl = Url.parse(matcher.group(1)); CharSequence processedUrl; boolean embedded = false; if (imageCandidateUrl.isFull()) { processedUrl = imageCandidateUrl.toString(Url.StringMode.FULL); } else if (imageCandidateUrl.isContextAbsolute()) { processedUrl = imageCandidateUrl.toString(); } else { Url cssUrlCopy = new Url(cssUrl); cssUrlCopy.resolveRelative(imageCandidateUrl); if (cssUrlCopy.getQueryString() != null && cssUrlCopy.getQueryString().contains(EMBED_BASE64)) { embedded = true; PackageResourceReference imageReference = new PackageResourceReference(scope, cssUrlCopy.toString().replace("?" + EMBED_BASE64, "")); try { processedUrl = createBase64EncodedImage(imageReference); } catch (Exception e) { throw new WicketRuntimeException( "Error while embedding an image into the css: " + imageReference, e); } } else { PackageResourceReference imageReference = new PackageResourceReference(scope, cssUrlCopy.toString()); processedUrl = cycle.urlFor(imageReference, null); } } matcher.appendReplacement(output, embedded ? "url(" + processedUrl + ")" : "url('" + processedUrl + "')"); } matcher.appendTail(output); return output.toString(); }
Source:
public void checkIncrementalCompilationWithMultipleKieBases() throws Exception { String rule = "package org.kie.scanner\n" + "rule R1 when\n" + "then\n" + "end\n"; String invalidRule = "package org.kie.scanner\n" + "rule R2 when\n" + " Cheese" + "then\n" + "end\n"; KieServices ks = KieServices.Factory.get(); KieFileSystem kfs = createKieFileSystemWithTwoKBases(ks); kfs.write("src/main/resources/org/kie/scanner/rule.drl", rule); KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll(); assertEquals(0, kieBuilder.getResults().getMessages().size()); kfs.write("src/main/resources/org/kie/scanner/invalidRule.drl", invalidRule); IncrementalResults addResults = ((InternalKieBuilder) kieBuilder).createFileSet("src/main/resources/org/kie/scanner/invalidRule.drl").build(); assertFalse(addResults.getAddedMessages().isEmpty()); addResults .getAddedMessages() .stream() .map(m -> (MessageImpl) m ) .forEach(m -> assertNotNull(m.getKieBaseName())); }

Target:
public void checkIncrementalCompilationWithMultipleKieBases() throws Exception { String rule = "package org.kie.scanner\n" + "rule R1 when\n" + "then\n" + "end\n"; String invalidRule = "package org.kie.scanner\n" + "rule R2 when\n" + " Cheese()\n" + "then\n" + "end\n"; KieServices ks = KieServices.Factory.get(); KieFileSystem kfs = createKieFileSystemWithTwoKBases(ks); kfs.write("src/main/resources/org/kie/scanner/rule.drl", rule); KieBuilder kieBuilder = ks.newKieBuilder(kfs).buildAll(); assertEquals(0, kieBuilder.getResults().getMessages().size()); kfs.write("src/main/resources/org/kie/scanner/invalidRule.drl", invalidRule); IncrementalResults addResults = ((InternalKieBuilder) kieBuilder).createFileSet("src/main/resources/org/kie/scanner/invalidRule.drl").build(); assertEquals(2, addResults.getAddedMessages().size()); addResults .getAddedMessages() .stream() .map(m -> (MessageImpl) m ) .forEach(m -> assertNotNull(m.getKieBaseName())); }
Source:
public void before() throws UnknownHostException { db = fongo.getDB(); identityManager = new IdentityManager(db); try { AuthenticationHelper.setMockPermissions(authChecker, null, null, null, null, Authentication.AuthResponse.PermissionLevel.NO_PERMISSION); when(optionChecker.authenticateDate(any(AuthenticationDataCreator.class), anyLong())) .thenReturn(false); when(optionChecker.isItemPublished(any(AuthenticationDataCreator.class))) .thenReturn(false); when(optionChecker.isItemRegistrationRequired(any(AuthenticationDataCreator.class))) .thenReturn(true); } catch (DatabaseAccessException e) { e.printStackTrace(); } catch (AuthenticationException e) { e.printStackTrace(); } dbAuthChecker = new Authenticator(authChecker, optionChecker); }

Target:
public void before() throws UnknownHostException { db = fongo.getDB(); identityManager = new IdentityManager(db); try { AuthenticationHelper.setMockPermissions(authChecker, null, null, null, null, Authentication.AuthResponse.PermissionLevel.NO_PERMISSION); when(optionChecker.authenticateDate(any(AuthenticationDataCreator.class), anyLong())) .thenReturn(false); when(optionChecker.isItemPublished(any(AuthenticationDataCreator.class))) .thenReturn(false); when(optionChecker.isItemRegistrationRequired(any(AuthenticationDataCreator.class))) .thenReturn(true); } catch (DatabaseAccessException | AuthenticationException e) { e.printStackTrace(); } dbAuthChecker = new Authenticator(authChecker, optionChecker); }
Source:
public Page deserialize(SerializedPage serializedPage) { checkArgument(serializedPage != null, "serializedPage is null"); if (!decompressor.isPresent() || !PageCodecMarker.COMPRESSED.check(serializedPage.getPageCodecMarkings())) { return readRawPage(serializedPage.getPositionCount(), serializedPage.getSlice().getInput(), blockEncodingSerde); } int uncompressedSize = serializedPage.getUncompressedSizeInBytes(); byte[] decompressed = new byte[uncompressedSize]; int actualUncompressedSize = decompressor.get().decompress(serializedPage.getSlice().getBytes(), 0, serializedPage.getSlice().length(), decompressed, 0, uncompressedSize); checkState(uncompressedSize == actualUncompressedSize); return readRawPage(serializedPage.getPositionCount(), Slices.wrappedBuffer(decompressed, 0, uncompressedSize).getInput(), blockEncodingSerde); }

Target:
public Page deserialize(SerializedPage serializedPage) { checkArgument(serializedPage != null, "serializedPage is null"); Slice slice = serializedPage.getSlice(); if (ENCRYPTED.isSet(serializedPage.getPageCodecMarkers())) { checkState(spillCipher.isPresent(), "Page is encrypted, but spill cipher is missing"); slice = Slices.wrappedBuffer(spillCipher.get().decrypt(slice.toByteBuffer())); } if (COMPRESSED.isSet(serializedPage.getPageCodecMarkers())) { checkState(decompressor.isPresent(), "Page is compressed, but decompressor is missing"); int uncompressedSize = serializedPage.getUncompressedSizeInBytes(); ByteBuffer decompressionBuffer = ByteBuffer.allocate(uncompressedSize); decompressor.get().decompress(slice.toByteBuffer(), decompressionBuffer); decompressionBuffer.flip(); checkState(decompressionBuffer.remaining() == uncompressedSize); slice = Slices.wrappedBuffer(decompressionBuffer); } return readRawPage(serializedPage.getPositionCount(), slice.getInput(), blockEncodingSerde); }
Source:
public static CVSTag[] fetchTagsFor(ICVSFile file, IProgressMonitor monitor) throws TeamException { Set<CVSTag> tagSet = new HashSet<>(); for (ILogEntry entrie : file.getLogEntries(monitor)) { for (CVSTag tag : entrie.getTags()) { tagSet.add(tag); } } return tagSet.toArray(new CVSTag[tagSet.size()]); }

Target:
public static CVSTag[] fetchTagsFor(ICVSFile file, IProgressMonitor monitor) throws TeamException { Set<CVSTag> tagSet = new HashSet<>(); for (ILogEntry entry : file.getLogEntries(monitor)) { for (CVSTag tag : entry.getTags()) { tagSet.add(tag); } } return tagSet.toArray(new CVSTag[tagSet.size()]); }