auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response getSegmentDataSourceSpecificInterval( @PathParam("dataSourceName") String dataSourceName, @PathParam("interval") String interval, @QueryParam("partial") final boolean partial ) { TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline( new TableDataSource(dataSourceName) ); final Interval theInterval = new Interval(interval.replace("_", "/")); if (timeline == null) { log.debug("No timeline found for datasource[%s]", dataSourceName); return Response.noContent().build(); } Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions(theInterval); FunctionalIterable<SegmentLoadInfo> retval = FunctionalIterable .create(lookup).transformCat( new Function<TimelineObjectHolder<String, SegmentLoadInfo>, Iterable<SegmentLoadInfo>>() { @Override public Iterable<SegmentLoadInfo> apply( TimelineObjectHolder<String, SegmentLoadInfo> input ) { return Iterables.transform( input.getObject(), new Function<PartitionChunk<SegmentLoadInfo>, SegmentLoadInfo>() { @Override public SegmentLoadInfo apply( PartitionChunk<SegmentLoadInfo> chunk ) { return chunk.getObject(); } } ); } } ); return Response.ok(retval).build(); }

Target:
public Response getSegmentDataSourceSpecificInterval( @PathParam("dataSourceName") String dataSourceName, @PathParam("interval") String interval, @QueryParam("partial") final boolean partial ) { TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline( new TableDataSource(dataSourceName) ); final Interval theInterval = new Interval(interval.replace("_", "/")); if (timeline == null) { log.debug("No timeline found for datasource[%s]", dataSourceName); return Response.ok(Lists.<ImmutableSegmentLoadInfo>newArrayList()).build(); } Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions(theInterval); FunctionalIterable<ImmutableSegmentLoadInfo> retval = FunctionalIterable .create(lookup).transformCat( new Function<TimelineObjectHolder<String, SegmentLoadInfo>, Iterable<ImmutableSegmentLoadInfo>>() { @Override public Iterable<ImmutableSegmentLoadInfo> apply( TimelineObjectHolder<String, SegmentLoadInfo> input ) { return Iterables.transform( input.getObject(), new Function<PartitionChunk<SegmentLoadInfo>, ImmutableSegmentLoadInfo>() { @Override public ImmutableSegmentLoadInfo apply( PartitionChunk<SegmentLoadInfo> chunk ) { return chunk.getObject().toImmutableSegmentLoadInfo(); } } ); } } ); return Response.ok(retval).build(); }
Source:
public int hashCode() { int result1 = cursor.hashCode(); result1 = 31 * result1 + result.hashCode(); return result1; }

Target:
public int hashCode() { int hashCode = cursor.hashCode(); hashCode = 31 * hashCode + result.hashCode(); return hashCode; }
Source:
public void testScriptRun() throws Exception { serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); manager.startServers(server); CARBON_HOME = server.getCarbonHome(); manager.stopAllServers(); String[] cmdArray; String commandDirectory; if (CarbonCommandToolsUtil.isCurrentOSWindows()) { cmdArray = new String[] {"cmd.exe", "/c", "chpasswd.bat", "--db-url", "jdbc:h2:" + CARBON_HOME + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", "wso2carbon", "--username", "admin", "--new-password", "admin123"}; commandDirectory = CARBON_HOME + File.separator + "bin"; } else { cmdArray = new String[] {"sh", "chpasswd.sh", "--db-url", "jdbc:h2:" + CARBON_HOME + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", "wso2carbon", "--username", "admin", "--new-password", "admin123"}; commandDirectory = CARBON_HOME + "/bin"; } scriptRunStatus = CarbonCommandToolsUtil.isScriptRunSuccessfully(commandDirectory, cmdArray, "Password updated successfully"); log.info("Script running status : " + scriptRunStatus); assertTrue(scriptRunStatus, "Script executed successfully"); manager.startServers(server); }

Target:
public void testScriptRun() throws Exception { serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); carbonHome = server.startServer(); server.stopServer(); String[] cmdArray; String commandDirectory = carbonHome + File.separator + "bin"; if ((CarbonCommandToolsUtil.getCurrentOperatingSystem(). contains(OperatingSystems.WINDOWS.name().toLowerCase()))) { cmdArray = new String[] {"cmd.exe", "/c", "chpasswd.bat", "--db-url", "jdbc:h2:" + carbonHome + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", String.valueOf(dbPassword), "--username", userName, "--new-password", String.valueOf(userNewPassword)}; } else { cmdArray = new String[] {"sh", "chpasswd.sh", "--db-url", "jdbc:h2:" + carbonHome + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", String.valueOf(dbPassword), "--username", userName, "--new-password", String.valueOf(userNewPassword)}; } scriptRunStatus = CarbonCommandToolsUtil.isScriptRunSuccessfully(commandDirectory, cmdArray, "Password updated successfully"); log.info("Script running status : " + scriptRunStatus); assertTrue(scriptRunStatus, "Script executed unsuccessfully"); CarbonCommandToolsUtil.startServerUsingCarbonHome(carbonHome, 1, context, null); }
Source:
public ThemeView() { final Span textSpan = new Span("This is the theme test view"); textSpan.setId(TEST_TEXT_ID); Span subCss = new Span(); subCss.setId(SUB_COMPONENT_ID); Span butterfly = new Span(); butterfly.setId(BUTTERFLY_ID); Span octopuss = new Span(); octopuss.setId(OCTOPUSS_ID); Span faText = new Span("This test is FontAwesome."); faText.setClassName("fab"); faText.setId(FONTAWESOME_ID); Image snowFlake = new Image( "VAADIN/static/fortawesome/icons/snowflake.svg", "snowflake"); snowFlake.setHeight("1em"); snowFlake.setId(SNOWFLAKE_ID); add(textSpan, snowFlake, subCss, butterfly, octopuss, faText); add(new Div()); add(new MyPolymerField().withId(MY_POLYMER_ID)); add(new Div()); add(new MyLitField().withId(MY_LIT_ID)); }

Target:
public ThemeView() { final Span textSpan = new Span("This is the theme test view"); textSpan.setId(TEST_TEXT_ID); Span subCss = new Span(); subCss.setId(SUB_COMPONENT_ID); Span butterfly = new Span(); butterfly.setId(BUTTERFLY_ID); Span octopuss = new Span(); octopuss.setId(OCTOPUSS_ID); Span faText = new Span("This test is FontAwesome."); faText.setClassName("fas fa-coffee"); faText.setId(FONTAWESOME_ID); Image snowFlake = new Image( "VAADIN/static/fortawesome/icons/snowflake.svg", "snowflake"); snowFlake.setHeight("1em"); snowFlake.setId(SNOWFLAKE_ID); add(textSpan, snowFlake, subCss, butterfly, octopuss, faText); add(new Div()); add(new MyPolymerField().withId(MY_POLYMER_ID)); add(new Div()); add(new MyLitField().withId(MY_LIT_ID)); }
Source:
protected EditPart getPartForElement(EditPart context, Object modelElement) { if (modelElement instanceof FBNetwork) { TypedSubAppNetworkEditPart compositeNetEP = new TypedSubAppNetworkEditPart(){ @Override protected void createEditPolicies() { installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new SubAppTypeFBNetworkLayoutEditPolicy()); } }; return compositeNetEP; } if (modelElement instanceof SubApp) { return new SubAppForFBNetworkEditPart(zoomManager); } return super.getPartForElement(context, modelElement); }

Target:
protected EditPart getPartForElement(EditPart context, Object modelElement) { if (modelElement instanceof FBNetwork) { CompositeNetworkEditPart compositeNetEP = new CompositeNetworkEditPart() { @Override protected void createEditPolicies() { installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new SubAppTypeFBNetworkLayoutEditPolicy()); } }; return compositeNetEP; } if (modelElement instanceof SubApp) { return new SubAppForFBNetworkEditPart(zoomManager); } return super.getPartForElement(context, modelElement); }
Source:
private void processCommand() throws IOException { try { FastByteBufferQueueInputStream is = new FastByteBufferQueueInputStream(receiveQueue, readCommandSizes[0]); try { ObjectInputStreamEx ois = new ObjectInputStreamEx(is, channel.baseClassLoader, channel.classFilter); receiver.handle(Command.readFrom(channel, ois)); } catch (IOException e1) { LOGGER.log(Level.WARNING, "Failed to construct Command", e1); } catch (ClassNotFoundException e11) { LOGGER.log(Level.WARNING, "Failed to construct Command", e11); } finally { int available = is.available(); if (available > 0) { is.skip(available); } IOUtils.closeQuietly(is); } } finally { if (readCommandIndex == 1) { if (readCommandSizes.length > 16) { int temp = readCommandSizes[1]; readCommandSizes = new int[16]; readCommandSizes[0] = temp; } else { readCommandSizes[0] = readCommandSizes[1]; } readCommandIndex = 0; } else { System.arraycopy(readCommandSizes, 1, readCommandSizes, 0, readCommandIndex); readCommandIndex--; } } }

Target:
private void processCommand() throws IOException { try { FastByteBufferQueueInputStream is = new FastByteBufferQueueInputStream(receiveQueue, readCommandSizes[0]); try { ObjectInputStreamEx ois = new ObjectInputStreamEx(is, channel.baseClassLoader, channel.classFilter); receiver.handle(Command.readFrom(channel, ois)); } catch (IOException e1) { LOGGER.log(Level.WARNING, "Failed to construct Command", e1); } catch (ClassNotFoundException e11) { LOGGER.log(Level.WARNING, "Failed to construct Command", e11); } finally { int available = is.available(); if (available > 0) { if (is.skip(available) != available) { LOGGER.log(Level.FINE, "Failed to skip remainder of Command"); } } IOUtils.closeQuietly(is); } } finally { if (readCommandIndex == 1) { if (readCommandSizes.length > 16) { int temp = readCommandSizes[1]; readCommandSizes = new int[16]; readCommandSizes[0] = temp; } else { readCommandSizes[0] = readCommandSizes[1]; } readCommandIndex = 0; } else { System.arraycopy(readCommandSizes, 1, readCommandSizes, 0, readCommandIndex); readCommandIndex--; } } }
Source:
public String getVersionPart() { return versioning == null ? "latest" : versioning.toString(); }

Target:
public String getVersionPart() { return versioning.toString(); }
Source:
private void executePrivateParentMethod(String method) throws IOException { try { Method m = this.parent.getDeclaredMethod(method); m.setAccessible(true); m.invoke(this); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { logger.severe("Error trying to abort JmDNS: " + e.getMessage()); throw new IOException(e); } }

Target:
private void executePrivateParentMethod(String method) throws IOException { try { Method m = this.parent.getDeclaredMethod(method); m.setAccessible(true); m.invoke(this); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { logger.log(Level.SEVERE, "Error trying to abort JmDNS", e); throw new IOException(e); } }
Source:
public Token<AbstractS3ATokenIdentifier> getDelegationToken(String renewer) throws IOException { entryPoint(Statistic.INVOCATION_GET_DELEGATION_TOKEN); LOG.debug("Delegation token requested"); if (delegationTokens.isPresent()) { return delegationTokens.get().getBoundOrNewDT(encryptionSecrets, (renewer!=null ? new Text(renewer) : null)); } else { LOG.debug("Token support is not enabled"); return null; } }

Target:
public Token<AbstractS3ATokenIdentifier> getDelegationToken(String renewer) throws IOException { entryPoint(Statistic.INVOCATION_GET_DELEGATION_TOKEN); LOG.debug("Delegation token requested"); if (delegationTokens.isPresent()) { return delegationTokens.get().getBoundOrNewDT(encryptionSecrets, (renewer != null ? new Text(renewer) : new Text())); } else { LOG.debug("Token support is not enabled"); return null; } }
Source:
public void setup() throws Exception { MockitoAnnotations.initMocks(this); internalRuntimeSpy = spy(new OpenShiftInternalRuntime( 13, new URLRewriter.NoOpURLRewriter(), eventService, bootstrapperFactory, serverCheckerFactory, context, project)); when(context.getOpenShiftEnvironment()).thenReturn(osEnv); when(serverCheckerFactory.create(any(), anyString(), any())).thenReturn(serversChecker); when(context.getIdentity()).thenReturn(IDENTITY); doNothing().when(project).cleanUp(); when(project.services()).thenReturn(services); when(project.routes()).thenReturn(routes); when(project.pods()).thenReturn(pods); when(bootstrapperFactory.create(any(), anyListOf(Installer.class), any())) .thenReturn(bootstrapper); when(context.getEnvironment()).thenReturn(environment); doReturn(ImmutableMap.of(M1_NAME, mockMachine(), M2_NAME, mockMachine())) .when(environment) .getMachines(); final Map<String, Service> allServices = ImmutableMap.of(SERVICE_NAME, mockService()); final Map<String, Route> allRoutes = ImmutableMap.of(SERVICE_NAME, mockRoute()); final Container container = mockContainer(CONTAINER_NAME_1, EXPOSED_PORT_1, INTERNAL_PORT); final ImmutableMap<String, Pod> allPods = ImmutableMap.of(POD_NAME, mockPod(ImmutableList.of(container))); when(services.create(any())).thenAnswer(a -> a.getArguments()[0]); when(routes.create(any())).thenAnswer(a -> a.getArguments()[0]); when(pods.create(any())).thenAnswer(a -> a.getArguments()[0]); when(osEnv.getServices()).thenReturn(allServices); when(osEnv.getRoutes()).thenReturn(allRoutes); when(osEnv.getPods()).thenReturn(allPods); }

Target:
public void setup() throws Exception { MockitoAnnotations.initMocks(this); internalRuntime = new OpenShiftInternalRuntime( 13, new URLRewriter.NoOpURLRewriter(), eventService, bootstrapperFactory, serverCheckerFactory, context, project); when(context.getOpenShiftEnvironment()).thenReturn(osEnv); when(serverCheckerFactory.create(any(), anyString(), any())).thenReturn(serversChecker); when(context.getIdentity()).thenReturn(IDENTITY); doNothing().when(project).cleanUp(); when(project.services()).thenReturn(services); when(project.routes()).thenReturn(routes); when(project.pods()).thenReturn(pods); when(bootstrapperFactory.create(any(), anyListOf(Installer.class), any())) .thenReturn(bootstrapper); when(context.getEnvironment()).thenReturn(environment); doReturn(ImmutableMap.of(M1_NAME, mockMachine(), M2_NAME, mockMachine())) .when(environment) .getMachines(); allServices = ImmutableMap.of(SERVICE_NAME, mockService()); allRoutes = ImmutableMap.of(SERVICE_NAME, mockRoute()); final Container container = mockContainer(CONTAINER_NAME_1, EXPOSED_PORT_1, INTERNAL_PORT); final ImmutableMap<String, Pod> allPods = ImmutableMap.of(POD_NAME, mockPod(ImmutableList.of(container))); when(services.create(any())).thenAnswer(a -> a.getArguments()[0]); when(routes.create(any())).thenAnswer(a -> a.getArguments()[0]); when(pods.create(any())).thenAnswer(a -> a.getArguments()[0]); when(osEnv.getServices()).thenReturn(allServices); when(osEnv.getRoutes()).thenReturn(allRoutes); when(osEnv.getPods()).thenReturn(allPods); }
Source:
private synchronized void stopEmitterThread() { if (emitterThread != null) { emitterThread.quit(); emitterThread = null; } }

Target:
private synchronized void stopEmitterThread() { if (emitterThread != null) { emitterThread.shutdown(); emitterThread = null; } }
Source:
protected ClientDMNType createDMNType(final Map<String, JSITItemDefinition> allDefinitions, final JSITItemDefinition itemDefinition, final String namespace, final Map<String, ClientDMNType> dmnTypesDataMap) { ClientDMNType itemDefinitionDMNType = new ClientDMNType(namespace, itemDefinition.getName(), itemDefinition.getId(), itemDefinition.getIsCollection(), itemDefinition.getItemComponent() != null && !itemDefinition.getItemComponent().isEmpty()); if (allDefinitions.containsKey(itemDefinition.getName())) { dmnTypesDataMap.put(itemDefinition.getName(), itemDefinitionDMNType); } String typeRef = itemDefinition.getTypeRef(); if (typeRef != null) { final ClientDMNType superDmnType = getOrCreateDMNType(allDefinitions, typeRef, namespace, dmnTypesDataMap); if (superDmnType != null) { itemDefinitionDMNType.addFields(superDmnType.getFields()); itemDefinitionDMNType.setCollection(superDmnType.isCollection() || itemDefinitionDMNType.isCollection()); itemDefinitionDMNType.setIsComposite(superDmnType.isComposite() || itemDefinitionDMNType.isComposite()); itemDefinitionDMNType.setFeelType(superDmnType.getFeelType() != null ? superDmnType.getFeelType() : null); } else { throw new IllegalStateException( "Item: " + itemDefinition.getName() + " refers to typeRef: " + itemDefinition.getTypeRef() + " which can't be found."); } } else { populateItemDefinitionFields(allDefinitions, itemDefinition, namespace, dmnTypesDataMap, itemDefinitionDMNType); } return itemDefinitionDMNType; }

Target:
protected ClientDMNType createDMNType(final Map<String, JSITItemDefinition> allDefinitions, final JSITItemDefinition itemDefinition, final String namespace, final Map<String, ClientDMNType> dmnTypesDataMap) { ClientDMNType itemDefinitionDMNType = new ClientDMNType(namespace, itemDefinition.getName(), itemDefinition.getId(), itemDefinition.getIsCollection(), itemDefinition.getItemComponent() != null && !itemDefinition.getItemComponent().isEmpty()); if (allDefinitions.containsKey(itemDefinition.getName())) { dmnTypesDataMap.put(itemDefinition.getName(), itemDefinitionDMNType); } String typeRef = itemDefinition.getTypeRef(); if (typeRef != null) { final ClientDMNType superDmnType = getOrCreateDMNType(allDefinitions, typeRef, namespace, dmnTypesDataMap); if (superDmnType != null) { itemDefinitionDMNType.addFields(superDmnType.getFields()); itemDefinitionDMNType.setCollection(superDmnType.isCollection() || itemDefinitionDMNType.isCollection()); itemDefinitionDMNType.setIsComposite(superDmnType.isComposite() || itemDefinitionDMNType.isComposite()); itemDefinitionDMNType.setFeelType(superDmnType.getFeelType() != null ? superDmnType.getFeelType() : null); } else { throw new IllegalStateException( "Item: " + itemDefinition.getName() + " refers to typeRef: " + itemDefinition.getTypeRef() + " which can't be found."); } } populateItemDefinitionFields(allDefinitions, itemDefinition, namespace, dmnTypesDataMap, itemDefinitionDMNType); return itemDefinitionDMNType; }
Source:
public static IborInterpolatedRateObservation of(IborIndex index1, IborIndex index2, LocalDate fixingDate) { ArgChecker.notNull(index1, "index1"); ArgChecker.notNull(index2, "index2"); ArgChecker.notNull(fixingDate, "fixingDate"); if (fixingDate.plus(index1.getTenor()).isAfter(fixingDate.plus(index2.getTenor()))) { return IborInterpolatedRateObservation.builder() .shortIndex(index2) .longIndex(index1) .fixingDate(fixingDate) .build(); } else { return IborInterpolatedRateObservation.builder() .shortIndex(index1) .longIndex(index2) .fixingDate(fixingDate) .build(); } }

Target:
public static IborInterpolatedRateObservation of(IborIndex index1, IborIndex index2, LocalDate fixingDate) { ArgChecker.notNull(index1, "index1"); ArgChecker.notNull(index2, "index2"); ArgChecker.notNull(fixingDate, "fixingDate"); boolean inOrder = indicesInOrder(index1, index2, fixingDate); return IborInterpolatedRateObservation.builder() .shortIndex(inOrder ? index1 : index2) .longIndex(inOrder ? index2 : index1) .fixingDate(fixingDate) .build(); }
Source:
public String toHeader() { StringBuilder builder = new StringBuilder() .append(traceId.getTraceId().toString(16)) .append('/') .append(spanId.getSpanId()) .append(";o=") .append(traceOptions.getOptionsMask()); return builder.toString(); }

Target:
public String toHeader() { StringBuilder builder = new StringBuilder() .append(traceId.getApiString()) .append('/') .append(spanId.getSpanId()) .append(";o=") .append(traceOptions.getOptionsMask()); return builder.toString(); }
Source:
@VisibleForTesting ResourceConfiguration getMaxChildResources(String queue) { return maxChildQueueResources.get(queue); }

Target:
@VisibleForTesting ConfigurableResource getMaxChildResources(String queue) { return maxChildQueueResources.get(queue); }
Source:
public InputStream getAttachmentData(String attachmentId, IProgressMonitor monitor) throws IOException, CoreException { String url = repositoryUrl + IBugzillaConstants.URL_GET_ATTACHMENT_DOWNLOAD + attachmentId; GetMethod method = getConnect(url, monitor); Status status = null; try { if (method.getStatusCode() == HttpStatus.SC_OK) { Header contentDisposition = method.getResponseHeader("Content-disposition"); if (contentDisposition == null) { status = parseHtmlError(method.getResponseBodyAsStream()); } else { return method.getResponseBodyAsStream(); } } else { status = parseHtmlError(method.getResponseBodyAsStream()); } } catch (Exception e) { status = new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, "Unable to retrieve attachment", e); } finally { WebUtil.releaseConnection(method, monitor); if (status != null) { throw new CoreException(status); } } return null; }

Target:
public InputStream getAttachmentData(String attachmentId, IProgressMonitor monitor) throws IOException, CoreException { String url = repositoryUrl + IBugzillaConstants.URL_GET_ATTACHMENT_DOWNLOAD + attachmentId; GetMethod method = getConnect(url, monitor); Status status = null; try { if (method.getStatusCode() == HttpStatus.SC_OK) { Header contentDisposition = method.getResponseHeader("Content-disposition"); if (contentDisposition == null) { status = parseHtmlError(method.getResponseBodyAsStream()); } else { return method.getResponseBodyAsStream(); } } else { status = parseHtmlError(method.getResponseBodyAsStream()); } } catch (Exception e) { status = new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, "Unable to retrieve attachment", e); } finally { if (status != null) { WebUtil.releaseConnection(method, monitor); throw new CoreException(status); } } throw new CoreException(status); }
Source:
public void testIdMissingPrices() { ProductItem item = ProductItem.builder().build(); assertEquals(item.getId() + "", imageId().apply(item)); }

Target:
public void testIdMissingPrices() { ProductItem item = ProductItem.builder().build(); imageId().apply(item); }
Source:
public void recalculateIncludedValues(TableReader tableReader) { final SymbolMapReaderImpl symbolMapReader = (SymbolMapReaderImpl) tableReader.getSymbolMapReader(columnIndex); for (int i = 0; i < symbolMapReader.size(); i++) { final CharSequence symbol = symbolMapReader.valueOf(i); if (keyExcludedValues.indexOf(symbol) < 0 && includedValues.indexOf(symbol) < 0) { final RowCursorFactory rowCursorFactory; int symbolKey = symbolMapReader.keyOf(symbol); if (filter == null) { rowCursorFactory = new SymbolIndexRowCursorFactory(columnIndex, symbolKey, cursorFactories.size() == 0, indexDirection); } else { rowCursorFactory = new SymbolIndexFilteredRowCursorFactory(columnIndex, symbolKey, filter, cursorFactories.size() == 0, indexDirection); } includedValues.add(symbol); cursorFactories.add(rowCursorFactory); } } }

Target:
public void recalculateIncludedValues(TableReader tableReader) { final SymbolMapReaderImpl symbolMapReader = (SymbolMapReaderImpl) tableReader.getSymbolMapReader(columnIndex); for (int i = 0; i < symbolMapReader.size(); i++) { final CharSequence symbol = symbolMapReader.valueOf(i); if (keyExcludedValues.indexOf(symbol) < 0 && includedValues.indexOf(symbol) < 0) { final RowCursorFactory rowCursorFactory; int symbolKey = symbolMapReader.keyOf(symbol); if (filter == null) { rowCursorFactory = new SymbolIndexRowCursorFactory(columnIndex, symbolKey, cursorFactories.size() == 0, indexDirection); } else { rowCursorFactory = new SymbolIndexFilteredRowCursorFactory(columnIndex, symbolKey, filter, cursorFactories.size() == 0, indexDirection); } includedValues.add(Chars.toString(symbol)); cursorFactories.add(rowCursorFactory); } } }
Source:
private PointSensitivityBuilder calculateRateSensitivity() { pastAccumulation(); valuationDateAccumulation(); PointSensitivityBuilder combinedPointSensitivity = PointSensitivityBuilder.none(); PointSensitivityBuilder approximatedForwardAccumulationSensitivity = approximatedForwardAccumulationSensitivity(); PointSensitivityBuilder cutOffAccumulationSensitivity = cutOffAccumulationSensitivity(); combinedPointSensitivity = combinedPointSensitivity.combinedWith(approximatedForwardAccumulationSensitivity); combinedPointSensitivity = combinedPointSensitivity.combinedWith(cutOffAccumulationSensitivity); combinedPointSensitivity = combinedPointSensitivity.multipliedBy(1.0d / accrualFactorTotal); return combinedPointSensitivity; }

Target:
private PointSensitivityBuilder calculateRateSensitivity() { pastAccumulation(); valuationDateAccumulation(); PointSensitivityBuilder combinedPointSensitivity = approximatedForwardAccumulationSensitivity(); PointSensitivityBuilder cutOffAccumulationSensitivity = cutOffAccumulationSensitivity(); combinedPointSensitivity = combinedPointSensitivity.combinedWith(cutOffAccumulationSensitivity); combinedPointSensitivity = combinedPointSensitivity.multipliedBy(1.0d / accrualFactorTotal); return combinedPointSensitivity; }
Source:
public ResponseEntity<?> listSubscriptions( @Nullable @RequestParam(value = "owning_application", required = false) final String owningApplication, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } try { final List<Subscription> subscriptions = owningApplication == null ? subscriptionRepository.listSubscriptions() : subscriptionRepository.listSubscriptionsForOwningApplication(owningApplication); return status(OK).body(subscriptions); } catch (final ServiceUnavailableException e) { LOG.error("Error occurred during listing of subscriptions", e); return create(e.asProblem(), request); } }

Target:
public ResponseEntity<?> listSubscriptions( @Nullable @RequestParam(value = "owning_application", required = false) final String owningApplication, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } try { final List<Subscription> subscriptions = owningApplication == null ? subscriptionRepository.listSubscriptions() : subscriptionRepository.listSubscriptionsForOwningApplication(owningApplication); return status(OK).body(new SubscriptionListWrapper(subscriptions)); } catch (final ServiceUnavailableException e) { LOG.error("Error occurred during listing of subscriptions", e); return create(e.asProblem(), request); } }
Source:
public void createLabelAndProperty() throws Exception { TokenWriteOperations tokenWrites = tokenWriteOperationsInNewTransaction(); labelId = tokenWrites.labelGetOrCreateForName( LABEL ); propertyKeyId = tokenWrites.propertyKeyGetOrCreateForName( PROPERTY_KEY ); final int labelId1 = labelId; final int[] propertyKeyIds = new int[]{propertyKeyId}; descriptor = SchemaDescriptorFactory.forLabel( labelId1, propertyKeyIds ); commit(); }

Target:
public void createLabelAndProperty() throws Exception { TokenWriteOperations tokenWrites = tokenWriteOperationsInNewTransaction(); labelId = tokenWrites.labelGetOrCreateForName( LABEL ); propertyKeyId = tokenWrites.propertyKeyGetOrCreateForName( PROPERTY_KEY ); descriptor = SchemaDescriptorFactory.forLabel( labelId, propertyKeyId ); commit(); }
Source:
public List<OrderedPartitionableRecord<String, String>> poll(long timeout) { checkIfClosed(); if (checkPartitionsStarted) { partitionResources.values().forEach(PartitionResource::start); checkPartitionsStarted = false; } try { List<OrderedPartitionableRecord<String, String>> polledRecords = new ArrayList<>(); Queues.drain( records, polledRecords, Math.min(Math.max(records.size(), 1), maxRecordsPerPoll), timeout, TimeUnit.MILLISECONDS ); polledRecords = polledRecords.stream() .filter(x -> partitionResources.containsKey(x.getStreamPartition())) .collect(Collectors.toList()); return polledRecords; } catch (InterruptedException e) { log.warn(e, "Interrupted while polling"); return Collections.emptyList(); } }

Target:
public List<OrderedPartitionableRecord<String, String>> poll(long timeout) { checkIfClosed(); if (checkPartitionsStarted) { partitionResources.values().forEach(PartitionResource::startBackgroundFetch); checkPartitionsStarted = false; } try { int expectedSize = Math.min(Math.max(records.size(), 1), maxRecordsPerPoll); List<OrderedPartitionableRecord<String, String>> polledRecords = new ArrayList<>(expectedSize); Queues.drain( records, polledRecords, expectedSize, timeout, TimeUnit.MILLISECONDS ); polledRecords = polledRecords.stream() .filter(x -> partitionResources.containsKey(x.getStreamPartition())) .collect(Collectors.toList()); return polledRecords; } catch (InterruptedException e) { log.warn(e, "Interrupted while polling"); return Collections.emptyList(); } }
Source:
public static List<Object> getListofOptions(String appModel) { Yaml yamlApp = new Yaml(); if (log.isDebugEnabled()) { log.debug("Loading String to a YAML using sknakeyaml.Yaml"); } return (List<Object>) yamlApp.load(appModel); }

Target:
public static List<Object> getListofOptions(String appModel) { Yaml yamlApp = new Yaml(); log.debug("Loading String to a YAML using sknakeyaml.Yaml"); return (List<Object>) yamlApp.load(appModel); }
Source:
private void stopGlusterServices(VDS vds) { boolean succeeded = false; if (vds.getVdsGroupSupportsGlusterService()) { succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "stop")).getSucceeded(); if (succeeded) { succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.StopGlusterProcesses, new VdsIdVDSCommandParametersBase(vds.getId())).getSucceeded(); if (succeeded) { List<GlusterBrickEntity> bricks = glusterBrickDao.getGlusterVolumeBricksByServerId(vds.getId()); for (GlusterBrickEntity brick : bricks) { brick.setStatus(GlusterStatus.DOWN); } glusterBrickDao.updateBrickStatuses(bricks); } } if(!succeeded){ log.info("Failed to stop gluster services while moving the host '{}' to maintenance", vds.getName()); } } }

Target:
private void stopGlusterServices(VDS vds) { if (vds.getVdsGroupSupportsGlusterService()) { boolean succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "stop")).getSucceeded(); if (succeeded) { succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.StopGlusterProcesses, new VdsIdVDSCommandParametersBase(vds.getId())).getSucceeded(); if (succeeded) { List<GlusterBrickEntity> bricks = glusterBrickDao.getGlusterVolumeBricksByServerId(vds.getId()); for (GlusterBrickEntity brick : bricks) { brick.setStatus(GlusterStatus.DOWN); } glusterBrickDao.updateBrickStatuses(bricks); } } if(!succeeded){ log.info("Failed to stop gluster services while moving the host '{}' to maintenance", vds.getName()); } } }
Source:
public EditionLimiter(TextViewer viewer) { this.textViewer = viewer; textViewer.getTextWidget().addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { if (((e.stateMask & SWT.CTRL) == SWT.CTRL) && (e.keyCode == 'd')) { triggeredFromWidget = true; StyledText txt = (StyledText) e.getSource(); int lineLength = 0; int lineNo = 0; int caretOffset = txt.getCaretOffset(); if (document == null) { initialize(); } try { lineNo = document.getLineOfOffset(caretOffset); lineLength = document.getLineLength(lineNo); } catch (BadLocationException e1) { logger.debug("Exception inserting " + "Could not obtain line info", e1); } try { if (!isEditableLine(document.getLineOffset(lineNo), 1)) { return; } } catch (BadLocationException e2) { logger.debug("Exception inserting " + "Could not check if editable", e2); } isDeleteLine = true; doit(caretOffset, lineLength, "", false, true); try { document.replace(document.getLineOffset(lineNo), lineLength, ""); } catch (BadLocationException e1) { logger.debug("Exception inserting " + "Could not replace text", e1); } isDeleteLine = false; lastTextForShortCircuiting = null; triggeredFromWidget = false; } } @Override public void keyReleased(KeyEvent e) { } }); }

Target:
public EditionLimiter(TextViewer viewer) { this.textViewer = viewer; textViewer.getTextWidget().addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { if (((e.stateMask & SWT.CTRL) == SWT.CTRL) && (e.keyCode == 'd')) { triggeredFromWidget = true; StyledText txt = (StyledText) e.getSource(); int lineLength = 0; int lineNo = 0; int caretOffset = txt.getCaretOffset(); if (document == null) { initialize(); } try { lineNo = document.getLineOfOffset(caretOffset); lineLength = document.getLineLength(lineNo); if (!isEditableLine(document.getLineOffset(lineNo), 1)) { return; } doit(caretOffset, lineLength, "", false, true); document.replace(document.getLineOffset(lineNo), lineLength, ""); } catch (BadLocationException e1) { logger.debug("Exception while performing Ctrl-D", e1); return; } finally { lastTextForShortCircuiting = null; triggeredFromWidget = false; } } } @Override public void keyReleased(KeyEvent e) { } }); }
Source:
private void createMenuItemMultiple(Menu menu, Repository[] repositories, String shortName) { MenuItem item = new MenuItem(menu, SWT.PUSH); item.setText(shortName); boolean allRepositoriesCheckedOut = Stream.of(repositories) .allMatch(r -> shortName.equals(getBranch(r))); if (allRepositoriesCheckedOut) { item.setImage(checkedOutImage); } else { item.setImage(branchImage); } item.setEnabled(!allRepositoriesCheckedOut); item.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Repository[] reposToSwitch = Stream.of(repositories) .filter(r -> !shortName.equals(getBranch(r))) .toArray(Repository[]::new); BranchOperationUI.checkout(reposToSwitch, shortName).start(); } }); }

Target:
private void createMenuItemMultiple(Menu menu, Repository[] repositories, String shortName) { MenuItem item = new MenuItem(menu, SWT.PUSH); item.setText(shortName); boolean allRepositoriesCheckedOut = Stream.of(repositories) .allMatch(r -> shortName.equals(getBranch(r))); if (allRepositoriesCheckedOut) { item.setImage(checkedOutImage); } else { item.setImage(branchImage); } item.setEnabled(!allRepositoriesCheckedOut); item.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { BranchOperationUI.checkout(repositories, shortName).start(); } }); }
Source:
private static void enterMethod(JoinPoint joinPoint) { CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature(); Class<?> cls = codeSignature.getDeclaringType(); String methodName = codeSignature.getName(); String[] parameterNames = codeSignature.getParameterNames(); Object[] parameterValues = joinPoint.getArgs(); StringBuilder builder = new StringBuilder("\u21E2 "); builder.append(methodName).append('('); for (int i = 0; i < parameterValues.length; i++) { if (i > 0) { builder.append(", "); } builder.append(parameterNames[i]).append('='); builder.append(Strings.toString(parameterValues[i])); } builder.append(')'); final String logtag = asTag(cls); if (android.os.Build.VERSION.SDK_INT >= 18) { final String section = builder.toString().substring(2); Trace.beginSection(section); } Log.v(logtag, builder.toString()); if (Looper.myLooper() != Looper.getMainLooper()) { builder.append(" [Thread:\"").append(Thread.currentThread().getName()).append("\"]"); } Log.v(asTag(cls), builder.toString()); }

Target:
private static void enterMethod(JoinPoint joinPoint) { CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature(); Class<?> cls = codeSignature.getDeclaringType(); String methodName = codeSignature.getName(); String[] parameterNames = codeSignature.getParameterNames(); Object[] parameterValues = joinPoint.getArgs(); StringBuilder builder = new StringBuilder("\u21E2 "); builder.append(methodName).append('('); for (int i = 0; i < parameterValues.length; i++) { if (i > 0) { builder.append(", "); } builder.append(parameterNames[i]).append('='); builder.append(Strings.toString(parameterValues[i])); } builder.append(')'); if (Looper.myLooper() != Looper.getMainLooper()) { builder.append(" [Thread:\"").append(Thread.currentThread().getName()).append("\"]"); } Log.v(asTag(cls), builder.toString()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { final String section = builder.toString().substring(2); Trace.beginSection(section); } }
Source:
public void start() { if (!sarosSession.isHost()) { return; } sarosSession.addListener(sessionListener); resourceActivityFilter.initialize(); }

Target:
public void start() { sarosSession.addListener(sessionListener); resourceActivityFilter.initialize(); }
Source:
public int getConsumersNumber(SubscriptionName subscriptionName) { final int requiredConsumers = getSubscriptionConstraints(subscriptionName) .map(Constraints::getConsumersNumber) .orElse(0); if (requiredConsumers > 0) { if (requiredConsumers <= availableConsumers) { return requiredConsumers; } else { return availableConsumers; } } final int requiredConsumersForTopic = getTopicConstraints(subscriptionName.getTopicName()) .map(Constraints::getConsumersNumber) .orElse(0); if (requiredConsumersForTopic > 0) { if (requiredConsumersForTopic <= availableConsumers) { return requiredConsumersForTopic; } else { return availableConsumers; } } return consumersPerSubscription; }

Target:
public int getConsumersNumber(SubscriptionName subscriptionName) { final int requiredConsumers = subscriptionConstraints .getOrDefault(subscriptionName, topicConstraints.getOrDefault(subscriptionName.getTopicName(), new Constraints(consumersPerSubscription))) .getConsumersNumber(); if (requiredConsumers > 0) { if (requiredConsumers <= availableConsumers) { return requiredConsumers; } else { return availableConsumers; } } return consumersPerSubscription; }
Source:
public Tuple exec(final Tuple input) throws IOException { if ((input == null) || (input.size() != 2)) { return null; } final DataByteArray dbaA = (DataByteArray) input.get(0); final DataByteArray dbaB = (DataByteArray) input.get(1); final ArrayOfDoublesSketch sketchA = ArrayOfDoublesSketches.wrapSketch(Memory.wrap(dbaA.get())); final ArrayOfDoublesSketch sketchB = ArrayOfDoublesSketches.wrapSketch(Memory.wrap(dbaB.get())); if (sketchA.getNumValues() != sketchB.getNumValues()) { throw new IllegalArgumentException("Both sketches must have the same number of values"); } int numMetrics = sketchA.getNumValues(); if (sketchA.isEmpty() || sketchB.isEmpty()) { return null; } if (sketchA.getRetainedEntries() < 2 || sketchB.getRetainedEntries() < 2) { return null; } SummaryStatistics[] summaryA = sketchToSummaryStatistics(sketchA, numMetrics); SummaryStatistics[] summaryB = sketchToSummaryStatistics(sketchB, numMetrics); double[] pValues = new double[numMetrics]; TTest tTest = new TTest(); for (int i = 0; i < numMetrics; i++) { pValues[i] = tTest.tTest(summaryA[i], summaryB[i]); } return Util.doubleArrayToTuple(pValues); }

Target:
public Tuple exec(final Tuple input) throws IOException { if ((input == null) || (input.size() != 2)) { return null; } final DataByteArray dbaA = (DataByteArray) input.get(0); final DataByteArray dbaB = (DataByteArray) input.get(1); final ArrayOfDoublesSketch sketchA = ArrayOfDoublesSketches.wrapSketch(Memory.wrap(dbaA.get())); final ArrayOfDoublesSketch sketchB = ArrayOfDoublesSketches.wrapSketch(Memory.wrap(dbaB.get())); if (sketchA.getNumValues() != sketchB.getNumValues()) { throw new IllegalArgumentException("Both sketches must have the same number of values"); } int numMetrics = sketchA.getNumValues(); if (sketchA.getRetainedEntries() < 2 || sketchB.getRetainedEntries() < 2) { return null; } SummaryStatistics[] summaryA = sketchToSummaryStatistics(sketchA, numMetrics); SummaryStatistics[] summaryB = sketchToSummaryStatistics(sketchB, numMetrics); double[] pValues = new double[numMetrics]; TTest tTest = new TTest(); for (int i = 0; i < numMetrics; i++) { pValues[i] = tTest.tTest(summaryA[i], summaryB[i]); } return Util.doubleArrayToTuple(pValues); }
Source:
EntityAnnotation(Class<?> clazz) { this.clazz = clazz; Field tmpIdField = null; ImmutableMap.Builder<String, Field> builder = ImmutableMap.builder(); Set<String> lowerCaseColumnNames = Sets.newHashSet(); for (Field field : clazz.getDeclaredFields()) { Id idAnnotation = field.getAnnotation(Id.class); Column columnAnnotation = field.getAnnotation(Column.class); if ((idAnnotation != null) && (columnAnnotation != null)) { throw new IllegalArgumentException("field cannot be marked as both an Id and a Column: " + field.getName()); } if(idAnnotation != null) { Preconditions.checkArgument(tmpIdField == null, "there are multiple fields with @Id annotation"); field.setAccessible(true); tmpIdField = field; } if ((columnAnnotation != null)) { String columnName = getColumnName(columnAnnotation, field); Preconditions.checkArgument(!lowerCaseColumnNames.contains(columnName.toLowerCase()), String.format("duplicate case-insensitive column name: %s", columnName)); lowerCaseColumnNames.add(columnName.toLowerCase()); field.setAccessible(true); builder.put(columnName, field); } } Preconditions.checkNotNull(tmpIdField, "there are no field with @Id annotation"); idField = tmpIdField; this.columns = builder.build(); }

Target:
EntityAnnotation(Class<?> clazz) { this.clazz = clazz; Field tmpIdField = null; ImmutableMap.Builder<String, ColumnMapper> builder = ImmutableMap.builder(); Set<String> usedColumnNames = Sets.newHashSet(); for (Field field : clazz.getDeclaredFields()) { Id idAnnotation = field.getAnnotation(Id.class); Column columnAnnotation = field.getAnnotation(Column.class); if ((idAnnotation != null) && (columnAnnotation != null)) { throw new IllegalArgumentException("field cannot be marked as both an Id and a Column: " + field.getName()); } if(idAnnotation != null) { Preconditions.checkArgument(tmpIdField == null, "there are multiple fields with @Id annotation"); field.setAccessible(true); tmpIdField = field; } if ((columnAnnotation != null)) { String columnName = getColumnName(columnAnnotation, field); Preconditions.checkArgument(!usedColumnNames.contains(columnName), String.format("duplicate case-insensitive column name: %s", columnName)); usedColumnNames.add(columnName); field.setAccessible(true); Serializer<?> serializer = SerializerTypeInferer.getSerializer(field.getType()); builder.put(columnName, new ColumnMapper(field, serializer)); } } Preconditions.checkNotNull(tmpIdField, "there are no field with @Id annotation"); idField = tmpIdField; this.columnMappers = builder.build(); }
Source:
public void testAddNull() { registry.add(null); assertTrue(registry.getItemDescriptors().isEmpty()); }

Target:
public void testAddNull() { registry.add(null); }
Source:
static private Map<String, List<String>> parseAttributes(final String attributesString) throws UnsupportedEncodingException { final Map<String, List<String>> attributes = new LinkedHashMap<>(); final List<String> splitLine = ParsingUtils.split(attributesString,ATTRIBUTE_DELIMITER); for(String attribute : splitLine) { final List<String> key_value = ParsingUtils.split(attribute,KEY_VALUE_SEPARATOR); if (key_value.size()<2) { continue; } attributes.put(URLDecoder.decode(key_value.get(0).trim(), "UTF-8"), decodeAttributeValue(key_value.get(1).trim())); } return attributes; }

Target:
static private Map<String, List<String>> parseAttributes(final String attributesString) throws UnsupportedEncodingException { if (attributesString.equals(Gff3Constants.UNDEFINED_FIELD_VALUE)) { return Collections.emptyMap(); } final Map<String, List<String>> attributes = new LinkedHashMap<>(); final List<String> splitLine = ParsingUtils.split(attributesString,Gff3Constants.ATTRIBUTE_DELIMITER); for(String attribute : splitLine) { final List<String> key_value = ParsingUtils.split(attribute,Gff3Constants.KEY_VALUE_SEPARATOR); if (key_value.size() != 2) { throw new TribbleException("Attribute string " + attributesString + " is invalid"); } attributes.put(URLDecoder.decode(key_value.get(0).trim(), "UTF-8"), decodeAttributeValue(key_value.get(1).trim())); } return attributes; }
Source:
public ModelNode execute(ModelNode modelNode) throws IOException { initialize(); try { AuthCache authCache = new BasicAuthCache(); authCache.put(target, getDigestScheme()); localContext.setAuthCache(authCache); CloseableHttpResponse response = httpClient.execute(target, buildRequest(modelNode), localContext); ModelNode m = ModelNode.fromJSONStream(response.getEntity().getContent()); response.close(); return m; } catch (MalformedChallengeException e) { e.printStackTrace(); } return null; }

Target:
public ModelNode execute(ModelNode modelNode) throws IOException { ModelNode result; CloseableHttpResponse response = client.execute(buildRequest(modelNode)); try { result = parseResponse(response); } finally { response.close(); } return result; }
Source:
public void setParams(Map<Object, Double> map) { if (map != null) { if (map.size() == 0) { throw new IllegalArgumentException( "no elements within map for categorical distribution"); } double sum = 0.0; for (Object key : map.keySet()) { double prob = map.get(key); if (prob < 0) { throw new IllegalArgumentException("Probability " + prob + " for key " + key.toString() + " is negative"); } sum += prob; } if (sum < 1e-9) { throw new IllegalArgumentException( "probabilities sum to approximately zero"); } this.map = new HashMap<Object, Double>(); this.logMap = new HashMap<Object, Double>(); this.objects = new Object[map.size()]; this.cdfObjects = new double[map.size()]; int count = 0; double cdf = 0.0; for (Object key : map.keySet()) { this.objects[count] = key; double prob = map.get(key) / sum; cdf += prob; this.cdfObjects[count] = cdf; this.map.put(key, prob); this.logMap.put(key, Math.log(prob)); count += 1; } this.hasMap = true; } }

Target:
public void setParams(Map<Object, Double> map) { if (map != null) { if (map.size() == 0) { throw new IllegalArgumentException( "no elements within map for categorical distribution"); } double sum = 0.0; for (Map.Entry<Object, Double> entry : map.entrySet()) { double prob = entry.getValue(); if (prob < 0) { throw new IllegalArgumentException("Probability " + prob + " for key " + entry.getKey().toString() + " is negative"); } sum += prob; } if (sum < 1e-9) { throw new IllegalArgumentException( "probabilities sum to approximately zero"); } this.map = new HashMap<Object, Double>(); this.logMap = new HashMap<Object, Double>(); this.objects = new Object[map.size()]; this.cdfObjects = new double[map.size()]; int count = 0; double cdf = 0.0; for (Map.Entry<Object, Double> entry : map.entrySet()) { Object key = entry.getKey(); Double value = entry.getValue(); this.objects[count] = key; double prob = value / sum; cdf += prob; this.cdfObjects[count] = cdf; this.map.put(key, prob); this.logMap.put(key, Math.log(prob)); count += 1; } this.hasMap = true; } }
Source:
public String getXRegistryConfigHeaderValue(@Nullable AuthConfigs paramAuthConfigs) { Map<String, AuthConfig> authConfigs = new HashMap<>(); authConfigs.putAll(initialAuthConfig.getAuthConfigs().getConfigs()); if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) { authConfigs.putAll(paramAuthConfigs.getConfigs()); } authConfigs.putAll(dynamicAuthResolver.getDynamicXRegistryConfig()); authConfigs = normalizeDockerHubRegistryUrl(authConfigs); return Base64.getEncoder().encodeToString(JsonHelper.toJson(authConfigs).getBytes()); }

Target:
public String getXRegistryConfigHeaderValue(@Nullable AuthConfigs paramAuthConfigs) { Map<String, AuthConfig> authConfigs = new HashMap<>(); authConfigs.putAll(initialAuthConfig.getAuthConfigs().getConfigs()); if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) { authConfigs.putAll(paramAuthConfigs.getConfigs()); } authConfigs.putAll(dynamicAuthResolver.getXRegistryConfig()); authConfigs = normalizeDockerHubRegistryUrl(authConfigs); return Base64.getEncoder().encodeToString(JsonHelper.toJson(authConfigs).getBytes()); }