auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testUnifyCCWWithHoles() { Geometry result = WindingOrder.unifyWindingOrder(clockWise2, true); assertTrue(result instanceof Polygon); assertFalse(clockWise2.equalsExact(result)); assertTrue(WindingOrder.isCounterClockwise(((Polygon) result).getExteriorRing())); }

Target:
public void testUnifyCCWWithHoles() { Geometry result = WindingOrder.unifyWindingOrder(clockWise2, true); assertTrue(result instanceof Polygon); assertFalse(clockWise2.equalsExact(result)); assertTrue(WindingOrder.isCounterClockwise(((Polygon) result).getExteriorRing())); assertFalse(WindingOrder.isCounterClockwise(((Polygon) result).getInteriorRingN(0))); assertTrue(WindingOrder.isCounterClockwise(clockWise2.getInteriorRingN(0)) != WindingOrder .isCounterClockwise(((Polygon) result).getInteriorRingN(0))); assertFalse( clockWise2.getInteriorRingN(0).equalsExact(((Polygon) result).getInteriorRingN(0))); }
Source:
public Object invoke(ParametersWrapper parameters) { Message<?> message = parameters.getMessage(); if (this.canProcessMessageList) { message = new MutableMessage<>(parameters.getMessages(), parameters.getHeaders()); } try { Object result = this.invocableHandlerMethod.invoke(message); if (result != null && result.getClass().getName().equals("kotlin.Unit")) { result = null; } return result; } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { throw new IllegalStateException("InvocableHandlerMethod invoke error", ex); } }

Target:
public Object invoke(ParametersWrapper parameters) { Message<?> message = parameters.getMessage(); if (this.canProcessMessageList) { message = new MutableMessage<>(parameters.getMessages(), parameters.getHeaders()); } try { Object result = this.invocableHandlerMethod.invoke(message); if (result != null && org.springframework.integration.util.ClassUtils.isKotlinUnit(result.getClass())) { result = null; } return result; } catch (RuntimeException ex) { throw ex; } catch (Exception ex) { throw new IllegalStateException("InvocableHandlerMethod invoke error", ex); } }
Source:
private void validateCustomProperties() { String version = vds.getVdsGroupCompatibilityVersion().getValue(); SimpleCustomPropertiesUtil util = SimpleCustomPropertiesUtil.getInstance(); Map<String, String> validProperties = util.convertProperties(Config.<String> getValue(ConfigValues.PreDefinedNetworkCustomProperties, version)); validProperties.putAll(util.convertProperties(Config.<String> getValue(ConfigValues.UserDefinedNetworkCustomProperties, version))); Map<String, String> validPropertiesNonVm = new HashMap<String, String>(validProperties); validPropertiesNonVm.remove("bridge_opts"); for (VdsNetworkInterface iface : params.getInterfaces()) { String networkName = iface.getNetworkName(); if (iface.hasCustomProperties() && !StringUtils.isEmpty(networkName)) { if (!networkCustomPropertiesSupported) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_NOT_SUPPORTED, networkName); } Network network = existingClusterNetworks.get(networkName); List<ValidationError> errors = util.validateProperties(network == null || network.isVmNetwork() ? validProperties : validPropertiesNonVm, iface.getCustomProperties()); if (!errors.isEmpty()) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_BAD_INPUT, networkName); List<String> messages = new ArrayList<>(); util.handleCustomPropertiesError(errors, messages); log.error(StringUtils.join(translateErrorMessages(messages), ',')); } } } }

Target:
private void validateCustomProperties() { String version = vds.getVdsGroupCompatibilityVersion().getValue(); SimpleCustomPropertiesUtil util = SimpleCustomPropertiesUtil.getInstance(); Map<String, String> validProperties = util.convertProperties(Config.<String> getValue(ConfigValues.PreDefinedNetworkCustomProperties, version)); validProperties.putAll(util.convertProperties(Config.<String> getValue(ConfigValues.UserDefinedNetworkCustomProperties, version))); Map<String, String> validPropertiesNonVm = new HashMap<String, String>(validProperties); validPropertiesNonVm.remove("bridge_opts"); for (VdsNetworkInterface iface : params.getInterfaces()) { String networkName = iface.getNetworkName(); if (iface.hasCustomProperties() && StringUtils.isNotEmpty(networkName)) { if (!networkCustomPropertiesSupported) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_NOT_SUPPORTED, networkName); } Network network = existingClusterNetworks.get(networkName); List<ValidationError> errors = util.validateProperties(network == null || network.isVmNetwork() ? validProperties : validPropertiesNonVm, iface.getCustomProperties()); if (!errors.isEmpty()) { addViolation(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_CUSTOM_PROPERTIES_BAD_INPUT, networkName); List<String> messages = new ArrayList<>(); util.handleCustomPropertiesError(errors, messages); log.error(StringUtils.join(translateErrorMessages(messages), ',')); } } } }
Source:
public void addSong(PlaylistEntry entry) { if (isLocalPlayer) { mPlaylist.add(entry); if (isLocalPlayer) { mDataManager.addToLoadQueue(entry); } new LocalBroadcastIntent(ACTION_SONG_ADDED) .putExtra(EXTRA_SONG, entry) .send(this); new LocalBroadcastIntent(ACTION_PLAYLIST_UPDATED).send(this); getMessagingService().sendPlaylistMessage(mPlaylist.getSongsToPlay()); } else { getMessagingService().sendAddToPlaylistMessage(entry); } }

Target:
public void addSong(PlaylistEntry entry) { entry.setEntryId(++lastEntryId); mPlaylist.add(entry); if (isLocalPlayer) { mDataManager.addToLoadQueue(entry); new LocalBroadcastIntent(ACTION_SONG_ADDED).putExtra(EXTRA_SONG, entry).send(this); new LocalBroadcastIntent(ACTION_PLAYLIST_UPDATED).send(this); getMessagingService().sendPlaylistMessage( mPlaylist.getSongsToPlay()); } else { getMessagingService().sendAddToPlaylistMessage(entry); } }
Source:
public void MercurySEOTest_002_MetaTags_Robots_SectionToMainPage() { SEOUtils seoUtils = new SEOUtils(driver); wikiURL = urlBuilder.getUrlForWiki(MercuryWikis.MERCURY_CC); CuratedContentPageObject section = new CuratedContentPageObject(driver); section.openCuratedContentPage(wikiURL, MercurySubpages.CC_SECTION_CATEGORIES); Assertion.assertTrue(seoUtils.isRobots(ROBOTS_TAG_ATTRIBUTES_NOINDEX)); section.clickOnMainPageLink(); Assertion.assertTrue(seoUtils.isRobots(ROBOTS_TAG_ATTRIBUTES_INDEX)); }

Target:
public void MercurySEOTest_002_MetaTags_Robots_SectionToMainPage() { SEOUtils seoUtils = new SEOUtils(driver); wikiURL = urlBuilder.getUrlForWiki(MercuryWikis.MERCURY_CC); CuratedContentPageObject section = new CuratedContentPageObject(driver); section.openCuratedContentPage(wikiURL, MercurySubpages.CC_SECTION_CATEGORIES); Assertion.assertTrue(seoUtils.isRobotsMetaTagSet(), ROBOTS_META_TAG_NOT_PRESENT_MESSAGE); Assertion.assertTrue(seoUtils.isAttributesListPresentInRobotsMetaTag( ROBOTS_TAG_ATTRIBUTES_NOINDEX_FOLLOW), ROBOTS_META_TAG_DIFFERENT_MESSAGE); section.clickOnMainPageLink(); Assertion.assertFalse(seoUtils.isRobotsMetaTagSet(), ROBOTS_META_TAG_PRESENT_MESSAGE); }
Source:
public void setUp() { RulesDefinition rulesDefinition = new AemRulesRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository htlRepository = context.repository(HtlCheckClasses.REPOSITORY_KEY); List<NewActiveRule> ar = new ArrayList<>(); for (RulesDefinition.Rule rule : htlRepository.rules()) { ar.add(new ActiveRulesBuilder().create(RuleKey.of(HtlCheckClasses.REPOSITORY_KEY, rule.key()))); } ActiveRules activeRules = new DefaultActiveRules(ar); CheckFactory checkFactory = new CheckFactory(activeRules); FileLinesContextFactory fileLinesContextFactory = mock(FileLinesContextFactory.class); when(fileLinesContextFactory.createFor(Mockito.any(InputFile.class))).thenReturn(mock(FileLinesContext.class)); Configuration configuration = mock(Configuration.class); when(configuration.getStringArray(Constants.FILE_EXTENSIONS_PROP_KEY)).thenReturn(Constants.FILE_EXTENSIONS_DEF_VALUE.split(",")); when(configuration.getStringArray(Constants.HTL_FILES_RELATIVE_PATHS_KEY)).thenReturn(new String[]{}); sensor = new HtlSensor(fileLinesContextFactory, configuration, checkFactory); tester = SensorContextTester.create(TEST_DIR); }

Target:
public void setUp() { RulesDefinition rulesDefinition = new AemRulesRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository htlRepository = context.repository(HtlCheckClasses.REPOSITORY_KEY); FileLinesContextFactory fileLinesContextFactory = getMockedFileLinesContextFactory(); Configuration configuration = getMockedConfiguration(); CheckFactory checkFactory = getCheckFactory(htlRepository); sensor = new HtlSensor(fileLinesContextFactory, configuration, checkFactory); tester = SensorContextTester.create(TEST_DIR); }
Source:
public void testJSON() throws Exception { PartitionByPlanNode pn = new PartitionByPlanNode(); addPartitionByExpressions(pn); addSortExpressions(pn); JSONStringer stringer = new JSONStringer(); stringer.object(); try { pn.toJSONString(stringer); stringer.endObject(); } catch (Exception ex) { ex.printStackTrace(); assertTrue(false); } String json = stringer.toString(); JSONObject jobj = new JSONObject(new JSONTokener(json)); PartitionByPlanNode pn2 = new PartitionByPlanNode(); pn2.loadFromJSONObject(jobj, m_voltdb.getDatabase()); assertEquals(pn.numberSortExpressions(), pn2.numberSortExpressions()); for (int idx = 0; idx < pn2.numberSortExpressions(); idx += 1) { assertEquals(pn2.getSortExpression(idx), pn.getSortExpression(idx)); assertEquals(pn2.getSortDirection(idx), pn.getSortDirection(idx)); } assertEquals(SortDirectionType.ASC, pn.getSortDirection(0)); assertEquals(SortDirectionType.DESC, pn.getSortDirection(1)); assertEquals(VoltType.FLOAT, pn.getSortExpression(0).getValueType()); assertEquals(8, pn.getSortExpression(0).getValueSize()); assertEquals(ExpressionType.VALUE_TUPLE, pn.getSortExpression(0).getExpressionType()); assertEquals(VoltType.INTEGER, pn.getSortExpression(1).getValueType()); assertEquals(4, pn.getSortExpression(1).getValueSize()); assertEquals(ExpressionType.VALUE_TUPLE, pn.getSortExpression(1).getExpressionType()); }

Target:
public void testJSON() throws Exception { PartitionByPlanNode pn = new PartitionByPlanNode(); addPartitionByExpressions(pn); addSortExpressions(pn); JSONStringer stringer = new JSONStringer(); stringer.object(); try { pn.toJSONString(stringer); stringer.endObject(); } catch (Exception ex) { ex.printStackTrace(); fail(); } String json = stringer.toString(); JSONObject jobj = new JSONObject(new JSONTokener(json)); PartitionByPlanNode pn2 = new PartitionByPlanNode(); pn2.loadFromJSONObject(jobj, m_voltdb.getDatabase()); assertEquals(pn.numberSortExpressions(), pn2.numberSortExpressions()); for (int idx = 0; idx < pn2.numberSortExpressions(); idx += 1) { assertEquals(pn2.getSortExpression(idx), pn.getSortExpression(idx)); assertEquals(pn2.getSortDirection(idx), pn.getSortDirection(idx)); } assertEquals(SortDirectionType.ASC, pn.getSortDirection(0)); assertEquals(SortDirectionType.DESC, pn.getSortDirection(1)); assertEquals(VoltType.FLOAT, pn.getSortExpression(0).getValueType()); assertEquals(8, pn.getSortExpression(0).getValueSize()); assertEquals(ExpressionType.VALUE_TUPLE, pn.getSortExpression(0).getExpressionType()); assertEquals(VoltType.INTEGER, pn.getSortExpression(1).getValueType()); assertEquals(4, pn.getSortExpression(1).getValueSize()); assertEquals(ExpressionType.VALUE_TUPLE, pn.getSortExpression(1).getExpressionType()); }
Source:
WalkFetchConnection(final WalkTransport t, final WalkRemoteObjectDatabase w) { Transport wt = (Transport)t; local = wt.local; objCheck = wt.getObjectChecker(); inserter = local.newObjectInserter(); reader = local.newObjectReader(); remotes = new ArrayList<WalkRemoteObjectDatabase>(); remotes.add(w); unfetchedPacks = new LinkedList<RemotePack>(); packsConsidered = new HashSet<String>(); noPacksYet = new LinkedList<WalkRemoteObjectDatabase>(); noPacksYet.add(w); noAlternatesYet = new LinkedList<WalkRemoteObjectDatabase>(); noAlternatesYet.add(w); fetchErrors = new HashMap<ObjectId, List<Throwable>>(); packLocks = new ArrayList<PackLock>(4); revWalk = new RevWalk(reader); revWalk.setRetainBody(false); treeWalk = new TreeWalk(local, reader); COMPLETE = revWalk.newFlag("COMPLETE"); IN_WORK_QUEUE = revWalk.newFlag("IN_WORK_QUEUE"); LOCALLY_SEEN = revWalk.newFlag("LOCALLY_SEEN"); localCommitQueue = new DateRevQueue(); workQueue = new LinkedList<ObjectId>(); }

Target:
WalkFetchConnection(final WalkTransport t, final WalkRemoteObjectDatabase w) { Transport wt = (Transport)t; local = wt.local; objCheck = wt.getObjectChecker(); inserter = local.newObjectInserter(); reader = local.newObjectReader(); remotes = new ArrayList<WalkRemoteObjectDatabase>(); remotes.add(w); unfetchedPacks = new LinkedList<RemotePack>(); packsConsidered = new HashSet<String>(); noPacksYet = new LinkedList<WalkRemoteObjectDatabase>(); noPacksYet.add(w); noAlternatesYet = new LinkedList<WalkRemoteObjectDatabase>(); noAlternatesYet.add(w); fetchErrors = new HashMap<ObjectId, List<Throwable>>(); packLocks = new ArrayList<PackLock>(4); revWalk = new RevWalk(reader); revWalk.setRetainBody(false); treeWalk = new TreeWalk(reader); COMPLETE = revWalk.newFlag("COMPLETE"); IN_WORK_QUEUE = revWalk.newFlag("IN_WORK_QUEUE"); LOCALLY_SEEN = revWalk.newFlag("LOCALLY_SEEN"); localCommitQueue = new DateRevQueue(); workQueue = new LinkedList<ObjectId>(); }
Source:
public void start(Stage stage) throws Exception { final VBox pane = new VBox(); pane.setSpacing(30); pane.setStyle("-fx-background-color:#EEE; -fx-padding: 40;"); ToggleButton button = new ToggleButton("JavaFx Toggle"); pane.getChildren().add(button); JFXToggleButton toggleButton = new JFXToggleButton(); toggleButton.setText("New Skin"); pane.getChildren().add(toggleButton); JFXToggleNode node = new JFXToggleNode(); node.setGraphic(new FontIcon(FontAwesomeSolid.HEART)); pane.getChildren().add(node); final Scene scene = new Scene(pane, 600, 400, Color.valueOf("#EEE")); stage.setTitle("JFX Toggle Button Demo "); scene.getStylesheets() .add(ToggleButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setScene(scene); stage.setResizable(false); stage.show(); }

Target:
public void start(Stage stage) throws Exception { final VBox pane = new VBox(); pane.setSpacing(30); pane.setStyle("-fx-background-color:#EEE; -fx-padding: 40;"); ToggleButton button = new ToggleButton("JavaFx Toggle"); pane.getChildren().add(button); JFXToggleButton toggleButton = new JFXToggleButton(); toggleButton.setText("New Skin"); pane.getChildren().add(toggleButton); JFXToggleNode node = new JFXToggleNode(); node.setStyle("-fx-padding: 10"); node.setGraphic(new FontIcon(FontAwesomeSolid.HEART)); pane.getChildren().add(node); final Scene scene = new Scene(pane, 600, 400, Color.valueOf("#EEE")); stage.setTitle("JFX Toggle Button Demo "); scene.getStylesheets() .add(ToggleButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm()); stage.setScene(scene); stage.setResizable(false); stage.show(); }
Source:
public void onTraversalStart() { final VCFHeader inputHeader = getHeaderForVariants(); final String tumorSample = inputHeader.getMetaDataLine(Mutect2Engine.TUMOR_SAMPLE_KEY_IN_VCF_HEADER).getValue(); final Set<VCFHeaderLine> headerLines = new HashSet<>(inputHeader.getMetaDataInSortedOrder()); Mutect2FilteringEngine.M_2_FILTER_NAMES.stream().map(GATKVCFHeaderLines::getFilterLine).forEach(headerLines::add); headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.ARTIFACT_IN_NORMAL_FILTER_NAME, "artifact_in_normal")); headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.CONTAMINATION_FILTER_NAME, "contamination")); final VCFHeader vcfHeader = new VCFHeader(headerLines, inputHeader.getGenotypeSamples()); vcfWriter = createVCFWriter(new File(outputVcf)); vcfWriter.writeHeader(vcfHeader); }

Target:
public void onTraversalStart() { final VCFHeader inputHeader = getHeaderForVariants(); final Set<VCFHeaderLine> headerLines = new HashSet<>(inputHeader.getMetaDataInSortedOrder()); Mutect2FilteringEngine.M_2_FILTER_NAMES.stream().map(GATKVCFHeaderLines::getFilterLine).forEach(headerLines::add); headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.ARTIFACT_IN_NORMAL_FILTER_NAME, "artifact_in_normal")); headerLines.add(new VCFFilterHeaderLine(Mutect2FilteringEngine.CONTAMINATION_FILTER_NAME, "contamination")); final VCFHeader vcfHeader = new VCFHeader(headerLines, inputHeader.getGenotypeSamples()); vcfWriter = createVCFWriter(new File(outputVcf)); vcfWriter.writeHeader(vcfHeader); }
Source:
public FactoryDto createFactory(@NotNull final Map<String, String> factoryParameters) throws BadRequestException, ServerException { final GithubUrl githubUrl = githubUrlParser.parse(factoryParameters.get(URL_PARAMETER_NAME)); FactoryDto factory = urlFactoryBuilder .createFactoryFromDevfile( githubUrl, fileName -> urlFetcher.fetch(githubUrl.rawFileLocation(fileName)), extractOverrideParams(factoryParameters)) .orElseGet( () -> urlFactoryBuilder .createFactoryFromJson(githubUrl) .orElseGet( () -> newDto(FactoryDto.class) .withV(CURRENT_VERSION) .withSource("repo"))); if (factory.getWorkspace() != null) { return projectConfigDtoMerger.merge( factory, () -> { return newDto(ProjectConfigDto.class) .withSource(githubSourceStorageBuilder.buildWorkspaceConfigSource(githubUrl)) .withName(githubUrl.getRepository()) .withPath("/".concat(githubUrl.getRepository())); }); } else if (factory.getDevfile() == null) { factory.setDevfile(urlFactoryBuilder.buildDefaultDevfile(githubUrl.getRepository())); } List<ProjectDto> projects = factory.getDevfile().getProjects(); if (projects.isEmpty()) { factory .getDevfile() .setProjects( Collections.singletonList( newDto(ProjectDto.class) .withSource(githubSourceStorageBuilder.buildDevfileSource(githubUrl)) .withName(githubUrl.getRepository()))); } else { projects.forEach( project -> { if (project.getSource().getLocation().equals(githubUrl.repositoryLocation() + ".git")) { project.getSource().setBranch(githubUrl.getBranch()); } }); } return factory; }

Target:
public FactoryDto createFactory(@NotNull final Map<String, String> factoryParameters) throws BadRequestException, ServerException { final GithubUrl githubUrl = githubUrlParser.parse(factoryParameters.get(URL_PARAMETER_NAME)); FactoryDto factory = urlFactoryBuilder .createFactoryFromDevfile( githubUrl, fileName -> urlFetcher.fetch(githubUrl.rawFileLocation(fileName)), extractOverrideParams(factoryParameters)) .orElseGet( () -> urlFactoryBuilder .createFactoryFromJson(githubUrl) .orElseGet( () -> newDto(FactoryDto.class) .withV(CURRENT_VERSION) .withSource("repo"))); if (factory.getWorkspace() != null) { return projectConfigDtoMerger.merge( factory, () -> { return newDto(ProjectConfigDto.class) .withSource(githubSourceStorageBuilder.buildWorkspaceConfigSource(githubUrl)) .withName(githubUrl.getRepository()) .withPath("/".concat(githubUrl.getRepository())); }); } else if (factory.getDevfile() == null) { factory.setDevfile(urlFactoryBuilder.buildDefaultDevfile(githubUrl.getRepository())); } List<ProjectDto> projects = factory.getDevfile().getProjects(); if (projects.isEmpty()) { factory .getDevfile() .setProjects( Collections.singletonList( newDto(ProjectDto.class) .withSource(githubSourceStorageBuilder.buildDevfileSource(githubUrl)) .withName(githubUrl.getRepository()))); } else { projects.forEach( project -> { final String location = project.getSource().getLocation(); if (location.equals(githubUrl.repositoryLocation()) || location.equals(githubUrl.repositoryLocation() + ".git")) { project.getSource().setBranch(githubUrl.getBranch()); } }); } return factory; }
Source:
public ByteBuffer getUserMetadata(BlobId blobId, ClusterMap map, boolean expiredBlobs) throws MessageFormatException, IOException { List<ReplicaId> replicas = blobId.getPartition().getReplicaIds(); ByteBuffer userMetadata = null; for (ReplicaId replicaId : replicas) { try { userMetadata = getUserMetadata(blobId, map, replicaId, expiredBlobs); break; } catch (Exception e) { } } return userMetadata; }

Target:
public ByteBuffer getUserMetadata(BlobId blobId, ClusterMap map, boolean expiredBlobs) throws MessageFormatException, IOException { List<ReplicaId> replicas = blobId.getPartition().getReplicaIds(); ByteBuffer userMetadata = null; for (ReplicaId replicaId : replicas) { try { userMetadata = getUserMetadata(blobId, map, replicaId, expiredBlobs); break; } catch (Exception e) { System.out.println("Get user metadata error "); e.printStackTrace(); } } return userMetadata; }
Source:
public Builder setStrokeDashArray(final String strokeDashArray) { String[] tempStrokeDashArray = strokeDashArray.split(","); int i = 0; this.strokeDashArray = new Double[tempStrokeDashArray.length]; while (i < tempStrokeDashArray.length) { this.strokeDashArray[i] = Double.valueOf(tempStrokeDashArray[i].trim()); i++; } return this; }

Target:
public Builder setStrokeDashArray(final String strokeDashArray) { String[] tempStrokeDashArray = strokeDashArray.split(","); this.strokeDashArray = Stream.of(tempStrokeDashArray).map(Double::valueOf).toArray(Double[]::new); return this; }
Source:
protected SecondaryToolbar createSecondaryToolbar() { SecondaryToolbar replaceToolbar = new SecondaryToolbar("Replace"); replaceMode_ = true; replaceTextBox_ = new TextBox(); replaceTextBox_.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { displayPreview_.nudge(); } }); FormLabel replaceLabel = new FormLabel("Replace with: ", replaceTextBox_); replaceToolbar.addLeftWidget(replaceLabel); replaceToolbar.addLeftWidget(replaceTextBox_); Roles.getButtonRole().setAriaLabelProperty(replaceTextBox_.getElement(), "Replace with"); stopReplace_ = new ToolbarButton( ToolbarButton.NoText, "Stop replace", commands_.interruptR().getImageResource()); stopReplace_.setVisible(false); replaceToolbar.addRightWidget(stopReplace_); replaceAllButton_ = new ToolbarButton("Replace All", "Replace All", null); replaceToolbar.addRightWidget(replaceAllButton_); replaceProgress_ = new ProgressBar(); replaceProgress_.setHeight("10px"); replaceProgress_.setWidth("195px"); replaceProgress_.setVisible(false); replaceToolbar.addLeftWidget(replaceProgress_); return replaceToolbar; }

Target:
protected SecondaryToolbar createSecondaryToolbar() { SecondaryToolbar replaceToolbar = new SecondaryToolbar("Replace"); replaceMode_ = true; replaceTextBox_ = new TextBox(); replaceTextBox_.addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent event) { displayPreview_.nudge(); } }); FormLabel replaceLabel = new FormLabel("Replace with: ", replaceTextBox_); replaceToolbar.addLeftWidget(replaceLabel); replaceToolbar.addLeftWidget(replaceTextBox_); stopReplace_ = new ToolbarButton( ToolbarButton.NoText, "Stop replace", commands_.interruptR().getImageResource()); stopReplace_.setVisible(false); replaceToolbar.addRightWidget(stopReplace_); replaceAllButton_ = new ToolbarButton("Replace All", "Replace All", null); replaceToolbar.addRightWidget(replaceAllButton_); replaceProgress_ = new ProgressBar(); replaceProgress_.setHeight("10px"); replaceProgress_.setWidth("195px"); replaceProgress_.setVisible(false); replaceToolbar.addLeftWidget(replaceProgress_); return replaceToolbar; }
Source:
public float readFloat() { try { gatherElementDataFromStreams(valueByteBuffer); int b1 = valueByteBuffer[0] & 0xFF; int b2 = valueByteBuffer[1] & 0xFF; int b3 = valueByteBuffer[2] & 0xFF; int b4 = valueByteBuffer[3] & 0xFF; int value = b1 | (b2 << 8) | (b3 << 16) | (b4 << 24); return Float.intBitsToFloat(value); } catch (IOException | ArrayIndexOutOfBoundsException ex) { throw new ParquetDecodingException("Could not read float."); } }

Target:
public float readFloat() { gatherElementDataFromStreams(valueByteBuffer); return Float.intBitsToFloat(BytesUtils.bytesToInt(valueByteBuffer)); }
Source:
protected CacheConfiguration<?, ?> getCacheDefinitionFrom(String resourcePath, String cacheName) throws SAXException, JAXBException, ParserConfigurationException, IOException, ClassNotFoundException { final URL resource = this.getClass().getResource(resourcePath); ConfigurationParser rootParser = new ConfigurationParser(resource.toExternalForm()); CacheDefinition cacheDefinition = StreamSupport.stream(rootParser.getCacheElements().spliterator(), true) .filter(def -> def.id().equals(cacheName)).findAny().get(); return parser.parseServiceConfiguration(cacheDefinition, classLoader, cacheConfigurationBuilder).build(); }

Target:
protected CacheConfiguration<?, ?> getCacheDefinitionFrom(String resourcePath, String cacheName) throws SAXException, JAXBException, ParserConfigurationException, IOException, ClassNotFoundException { final URL resource = this.getClass().getResource(resourcePath); ConfigurationParser rootParser = new ConfigurationParser(resource.toExternalForm()); CacheDefinition cacheDefinition = StreamSupport.stream(rootParser.getCacheElements().spliterator(), false) .filter(def -> def.id().equals(cacheName)).findAny().get(); return parser.parseServiceConfiguration(cacheDefinition, classLoader, cacheConfigurationBuilder).build(); }
Source:
public static InetAddress getCurrentIp() { int bestScore = -1; InetAddress bestAddr = null; try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface iface = (NetworkInterface) networkInterfaces.nextElement(); Enumeration<InetAddress> addrs = iface.getInetAddresses(); while (addrs.hasMoreElements()) { InetAddress addr = (InetAddress) addrs.nextElement(); int score = scoreAddr(iface, addr); if (score >= bestScore) { bestScore = score; bestAddr = addr; } } } } catch (IOException e) { ; } return bestAddr; }

Target:
public static InetAddress getCurrentIp() { int bestScore = -1; InetAddress bestAddr = null; try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface iface = (NetworkInterface) networkInterfaces.nextElement(); Enumeration<InetAddress> addrs = iface.getInetAddresses(); while (addrs.hasMoreElements()) { InetAddress addr = (InetAddress) addrs.nextElement(); int score = scoreAddr(iface, addr); if (score >= bestScore) { bestScore = score; bestAddr = addr; } } } } catch (IOException e) { logger.error("Problem getting local IP", e); } return bestAddr; }
Source:
private IllegalReferenceCountException handleIllegalReferenceCountException(IllegalReferenceCountException e) { String accessRecord = leak.toString(); if (StringUtil.isNullOrEmpty(accessRecord)) { return e; } return new TrackedIllegalReferenceCountException(e.getMessage(), accessRecord); }

Target:
private IllegalReferenceCountException handleIllegalReferenceCountException(IllegalReferenceCountException e) { String accessRecord = leak.toString(); if (StringUtil.isNullOrEmpty(accessRecord)) { return e; } return new TrackedIllegalReferenceCountException(accessRecord, e); }
Source:
private static Comparable<?> encodeDecimal(Type type, BigDecimal value) { BigInteger unscaled = Decimals.rescale(value, (DecimalType) type).unscaledValue(); if (Decimals.isShortDecimal(type)) { return unscaled.longValueExact(); } else { return Decimals.encodeUnscaledValue(unscaled); } }

Target:
private static Comparable<?> encodeDecimal(Type type, BigDecimal value) { BigInteger unscaled = Decimals.rescale(value, (DecimalType) type).unscaledValue(); if (Decimals.isShortDecimal(type)) { return unscaled.longValueExact(); } return Decimals.encodeUnscaledValue(unscaled); }
Source:
public Workflow getWorkflow(String repositoryId, Optional<Workflow> existingWorkflow) { Workflow workflow = initializeWorkflow(repositoryId); if (!existingWorkflow.isPresent()){ workflow.setDescriptorType("cwl"); return workflow; } if (existingWorkflow.get().getMode() == WorkflowMode.STUB){ return workflow; } workflow.setMode(WorkflowMode.FULL); Map<String, String> existingDefaults = new HashMap<>(); if (existingWorkflow.isPresent()){ existingWorkflow.get().getWorkflowVersions().forEach(existingVersion -> existingDefaults.put(existingVersion.getReference(), existingVersion.getWorkflowPath())); copyWorkflow(existingWorkflow.get(), workflow); } setupWorkflowVersions(repositoryId, workflow, existingWorkflow, existingDefaults); if (workflow.getDescriptorType().equals("cwl")) { updateEntryMetadata(workflow, AbstractEntryClient.Type.CWL); } else { updateEntryMetadata(workflow, AbstractEntryClient.Type.WDL); } return workflow; }

Target:
public Workflow getWorkflow(String repositoryId, Optional<Workflow> existingWorkflow) { Workflow workflow = initializeWorkflow(repositoryId); if (!existingWorkflow.isPresent()){ workflow.setDescriptorType(AbstractEntryClient.Type.CWL.toString()); return workflow; } if (existingWorkflow.get().getMode() == WorkflowMode.STUB){ return workflow; } workflow.setMode(WorkflowMode.FULL); Map<String, String> existingDefaults = new HashMap<>(); if (existingWorkflow.isPresent()){ existingWorkflow.get().getWorkflowVersions().forEach(existingVersion -> existingDefaults.put(existingVersion.getReference(), existingVersion.getWorkflowPath())); copyWorkflow(existingWorkflow.get(), workflow); } setupWorkflowVersions(repositoryId, workflow, existingWorkflow, existingDefaults); if (workflow.getDescriptorType().equals(AbstractEntryClient.Type.CWL.toString())) { updateEntryMetadata(workflow, AbstractEntryClient.Type.CWL); } else { updateEntryMetadata(workflow, AbstractEntryClient.Type.WDL); } return workflow; }
Source:
private LogQuery buildQuery(String offset, boolean includeAppLogs, List<String> versions) { LogQuery query = LogQuery.Builder.withDefaults(); query.includeAppLogs(includeAppLogs); query.batchSize(1000); if(versions != null && !versions.isEmpty()){ try{ query.majorVersionIds(versions); } catch (Exception e){ isError = true; statusToUser.add(e.getMessage()); } }else{ String currentVersion = Config.inst().getAppVersion(); List<String> appVersions = new ArrayList<String>(); if (currentVersion.matches(".*[A-z.*]")) { appVersions.add(currentVersion.replace(".", "-")); } else { double versionDouble = Double.parseDouble(currentVersion); String curVer = ("" + versionDouble).replace(".", "-"); String[] preVer = { null, null, null }; preVer[0] = (versionDouble - 0.01) >= 0 ? (String.format("%.2f", (versionDouble - 0.01)).replace(".", "-")) : null; preVer[1] = (versionDouble - 0.02) >= 0 ? (String.format("%.2f", (versionDouble - 0.02)).replace(".", "-")) : null; preVer[2] = (versionDouble - 0.03) >= 0 ? (String.format("%.2f", (versionDouble - 0.03)).replace(".", "-")) : null; appVersions.add(curVer); for (int i = 0; i < 3; i++) { if (preVer[i] != null) { appVersions.add(preVer[i]); } } } query.majorVersionIds(appVersions); } if (offset != null && !offset.equals("null")) { query.offset(offset); } return query; }

Target:
private LogQuery buildQuery(String offset, boolean includeAppLogs, List<String> versions) { LogQuery query = LogQuery.Builder.withDefaults(); query.includeAppLogs(includeAppLogs); query.batchSize(1000); try { query.majorVersionIds(getVersionIdsForQuery(versions)); } catch (Exception e) { isError = true; statusToUser.add(e.getMessage()); } if (offset != null && !offset.equals("null")) { query.offset(offset); } return query; }
Source:
public void checkConvertToProjectWithPomFile() throws Exception { createNewFolder(PROJECT_NAME, NEW_FOLDER_NAME); projectExplorer.selectVisibleItem(NEW_FOLDER_NAME); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/" + NEW_FOLDER_NAME); projectExplorer.clickOnItemInContextMenu(CONVERT_TO_PROJECT); wizard.waitOpenProjectConfigForm(); wizard.waitTextParentDirectoryName("/" + PROJECT_NAME); wizard.waitTextProjectNameInput(NEW_FOLDER_NAME); wizard.selectSample(Wizard.TypeProject.MAVEN); informationDialog.acceptInformDialogWithText("pom.xml does not exist."); wizard.selectSample(Wizard.TypeProject.BLANK); loader.waitOnClosed(); wizard.clickSaveButton(); wizard.waitCloseProjectConfigForm(); createNewFolder(PROJECT_NAME, NEW_MODULE_NAME); createNewFile("pom", PATH_TO_POM_FILE, XML_FILE); projectExplorer.waitItemInVisibleArea("pom.xml"); projectExplorer.openItemByPath(PATH_TO_POM_FILE + "/pom.xml"); editor.waitActive(); editor.waitTabIsPresent("pom.xml"); editor.deleteAllContent(); actionsFactory.createAction(seleniumWebDriver).sendKeys(EXPECTED_TEXT).perform(); editor.waitTextIntoEditor(EXPECTED_TEXT); WaitUtils.sleepQuietly(5); editor.waitTabIsPresent("pom.xml"); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PATH_TO_POM_FILE, "simpleFolder"); editor.closeAllTabs(); seleniumWebDriver.navigate().refresh(); projectExplorer.waitProjectExplorer(); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PATH_TO_POM_FILE, "simpleFolder"); }

Target:
public void checkConvertToProjectWithPomFile() throws Exception { createNewFolder(PROJECT_NAME, NEW_FOLDER_NAME); projectExplorer.selectVisibleItem(NEW_FOLDER_NAME); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME + "/" + NEW_FOLDER_NAME); projectExplorer.clickOnItemInContextMenu(CONVERT_TO_PROJECT); wizard.waitOpenProjectConfigForm(); wizard.waitTextParentDirectoryName("/" + PROJECT_NAME); wizard.waitTextProjectNameInput(NEW_FOLDER_NAME); wizard.selectSample(Wizard.TypeProject.MAVEN); informationDialog.acceptInformDialogWithText("pom.xml does not exist."); wizard.selectSample(Wizard.TypeProject.BLANK); loader.waitOnClosed(); wizard.clickSaveButton(); wizard.waitCloseProjectConfigForm(); createNewFolder(PROJECT_NAME, NEW_MODULE_NAME); createNewFile("pom", PATH_TO_POM_FILE, XML_FILE); editor.waitActive(); editor.waitTabIsPresent("pom.xml"); editor.deleteAllContent(); actionsFactory.createAction(seleniumWebDriver).sendKeys(EXPECTED_TEXT).perform(); editor.waitTextIntoEditor(EXPECTED_TEXT); WaitUtils.sleepQuietly(5); editor.waitTabIsPresent("pom.xml"); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PATH_TO_POM_FILE, "simpleFolder"); editor.closeAllTabs(); seleniumWebDriver.navigate().refresh(); projectExplorer.waitProjectExplorer(); projectExplorer.waitFolderDefinedTypeOfFolderByPath(PATH_TO_POM_FILE, "simpleFolder"); }
Source:
public VDSInfoReturn getVdsStats(BrokerCommandCallback callback) { JsonRpcRequest request = new RequestBuilder("Host.getStats").build(); Map<String, Object> response = new FutureMap(this.client, request, ResourceManager.getInstance().getExecutor(), callback) .withResponseKey("info"); return new VDSInfoReturn(response); }

Target:
public VDSInfoReturn getVdsStats(BrokerCommandCallback callback) { JsonRpcRequest request = new RequestBuilder("Host.getStats").build(); Map<String, Object> response = new FutureMap(this.client, request, callback) .withResponseKey("info"); return new VDSInfoReturn(response, true); }
Source:
public TimestampRange incrementBy(long delta) { if (delta <= 0) { throw new IllegalArgumentException("Timestamp must be increased by a positive number. Found " + delta); } long upperBound = value.addAndGet(delta); long lowerBound = upperBound - delta + 1L; return TimestampRange.createInclusiveRange(lowerBound, upperBound); }

Target:
public TimestampRange incrementBy(long delta) { long upperBound = value.addAndGet(delta); long lowerBound = upperBound - delta + 1L; return TimestampRange.createInclusiveRange(lowerBound, upperBound); }
Source:
public void sendFile(Path path) { try { long startTime = System.currentTimeMillis(); byte[] name = path.getFileName().toString().getBytes("UTF-8"); byte[] data = Files.readAllBytes(path); byte[] array = BigInteger.valueOf(1).toByteArray(); byte[] array2 = BigInteger.valueOf(name.length).toByteArray(); int bufferSize = (array.length + array2.length + name.length + data.length) * 2; ByteBuffer buffer = ByteBuffer.allocate(bufferSize); buffer.put(array); buffer.put(array2); buffer.put(name); buffer.put(data); buffer.flip(); System.out.println("Last Session Binary size >> " + wsOutbound.getMaxBinaryMessageBufferSize()); System.out.println("Last Session Text size >> " + wsOutbound.getMaxTextMessageBufferSize()); synchronized(wsOutbound) { if (wsOutbound.isOpen()) { wsOutbound.getBasicRemote().sendBinary(buffer); } } String debug = ((long) System.currentTimeMillis() - startTime) + "ms were spent sending a file of " + bufferSize / 1024 + "KB to the client"; logger.info(debug); } catch(Exception e) { logger.warn("Failed to send file, " + path, e); notifyListeners(MessageSenderEvent.Type.MESSAGE_SEND_FAILED); } }

Target:
public void sendFile(Path path) { try { long startTime = System.currentTimeMillis(); byte[] name = path.getFileName().toString().getBytes("UTF-8"); byte[] data = Files.readAllBytes(path); byte[] array = BigInteger.valueOf(1).toByteArray(); byte[] array2 = BigInteger.valueOf(name.length).toByteArray(); int bufferSize = (array.length + array2.length + name.length + data.length) * 2; ByteBuffer buffer = ByteBuffer.allocate(bufferSize); buffer.put(array); buffer.put(array2); buffer.put(name); buffer.put(data); buffer.flip(); System.out.println("Last Session Binary size >> " + wsOutbound.getMaxBinaryMessageBufferSize()); System.out.println("Last Session Text size >> " + wsOutbound.getMaxTextMessageBufferSize()); synchronized(wsOutbound) { if (wsOutbound.isOpen()) { wsOutbound.getBasicRemote().sendBinary(buffer); } } String debug = ((long) System.currentTimeMillis() - startTime) + "ms were spent sending a file of " + bufferSize / 1024 + "KB to the client"; logger.info(debug); } catch(IOException e) { logger.warn("Failed to send file, " + path, e); notifyListeners(MessageSenderEvent.Type.MESSAGE_SEND_FAILED); } }
Source:
public TableReference createLockTable() throws TException { TableReference lockTable = TableReference.createWithEmptyNamespace(LOCK_TABLE_PREFIX); log.info("Creating lock table {}", SafeArg.of("schemaMutationTableName", lockTable)); createTableWithCustomId(lockTable); return lockTable; }

Target:
public TableReference createLockTable() throws TException { TableReference lockTable = TableReference.createWithEmptyNamespace(LOCK_TABLE_PREFIX); try { log.info("Creating lock table {}", SafeArg.of("schemaMutationTableName", lockTable.getQualifiedName())); createTableWithCustomId(lockTable); return lockTable; } catch (InvalidRequestException ire) { Set<TableReference> lockTables = getAllLockTables(); if (lockTables.size() == 1) { log.info("Lock table was created by another node - returning it."); return Iterables.getOnlyElement(lockTables); } else { throw new IllegalStateException(String.format("Expected 1 locks table to exist, but found %d", lockTables.size())); } } }
Source:
public CharacterSprite(int width, int height, boolean[] shape) { this.width = width; this.height = height; this.shape = shape; if (shape.length != width*height) { throw new IllegalArgumentException("Shape for a character must match it's dimensions"); } }

Target:
public CharacterSprite(int width, int height, boolean[] shape) { checkState(shape.length == width * height, "Shape for a character must match it's dimensions"); this.width = width; this.height = height; this.shape = new boolean[shape.length]; System.arraycopy(shape, 0, this.shape, 0, shape.length); }
Source:
public void allTests() throws Exception { testPersistenceCheck(); testLogin(); testContent(); testAjaxCourseTableLoad(); testShowFeedbackStatsLink(); testHelpLink(); testCourseLinks(); testSearchAction(); testSortAction(); testRemindActions(); testPublishUnpublishResendLinksActions(); testArchiveCourseAction(); testCopyToFsAction(); testDeleteCourseAction(); }

Target:
public void allTests() throws Exception { testPersistenceCheck(); testLogin(); testContent(); testAjaxCourseTableLoad(); testShowFeedbackStatsLink(); testHelpLink(); testCourseLinks(); testSearchAction(); testSortAction(); testRemindActions(); testPublishUnpublishResendLinkActions(); testArchiveCourseAction(); testCopyToFsAction(); testDeleteCourseAction(); }
Source:
public void testUnauthorizedSetTableStateInMeta() throws Exception { AccessTestAction action = new AccessTestAction() { @Override public Object run() throws Exception { Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()) ; Hbck hbck = conn.getHbck(); hbck.setTableStateInMeta(new TableState(TEST_TABLE, TableState.State.DISABLED)); return null; } }; verifyDenied(action, USER_CREATE, USER_OWNER, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE, USER_GROUP_CREATE); }

Target:
public void testUnauthorizedSetTableStateInMeta() throws Exception { AccessTestAction action = () -> { try(Connection conn = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); Hbck hbck = conn.getHbck()){ hbck.setTableStateInMeta(new TableState(TEST_TABLE, TableState.State.DISABLED)); } return null; }; verifyDenied(action, USER_CREATE, USER_OWNER, USER_RW, USER_RO, USER_NONE, USER_GROUP_READ, USER_GROUP_WRITE, USER_GROUP_CREATE); }
Source:
void claimSlot( int slot, long[] key ) { int offset = slot * width; System.arraycopy( key, 0, keys, offset, width ); numberOfEntries++; }

Target:
void claimSlot( int slot, long[] key ) { int offset = slot * width; assert keys[offset] == NOT_IN_USE : "Tried overwriting an already used slot"; System.arraycopy( key, 0, keys, offset, width ); numberOfEntries++; }
Source:
private void initOpenAL(Config config) { if (config.getAudio().isDisableSound()) { audioManager = new NullAudioManager(); } else { try { audioManager = new OpenALManager(config.getAudio()); } catch (Exception e) { audioManager = new NullAudioManager(); } } CoreRegistry.putPermanently(AudioManager.class, audioManager); AssetManager assetManager = CoreRegistry.get(AssetManager.class); assetManager.setAssetFactory(AssetType.SOUND, audioManager.getStaticSoundFactory()); assetManager.setAssetFactory(AssetType.MUSIC, audioManager.getStreamingSoundFactory()); }

Target:
private void initOpenAL(Config config) { if (config.getAudio().isDisableSound()) { audioManager = new NullAudioManager(); } else { try { audioManager = new OpenALManager(config.getAudio()); } catch (LWJGLException | OpenALException e) { logger.warn("Could not load OpenAL manager - sound is disabled", e); audioManager = new NullAudioManager(); } } CoreRegistry.putPermanently(AudioManager.class, audioManager); AssetManager assetManager = CoreRegistry.get(AssetManager.class); assetManager.setAssetFactory(AssetType.SOUND, audioManager.getStaticSoundFactory()); assetManager.setAssetFactory(AssetType.MUSIC, audioManager.getStreamingSoundFactory()); }
Source:
public void setHeader(HttpRequest request, String name, String value) { if (StringUtils.hasText(value) && !request.getHeaders().containsKey(name) && this.accessor.isTracing()) { request.getHeaders().add(name, value); } }

Target:
private void setHeader(HttpRequest request, String name, String value) { if (StringUtils.hasText(value) && !request.getHeaders().containsKey(name) && this.accessor.isTracing()) { request.getHeaders().add(name, value); } }
Source:
public Roles decodeRoles(AuthorizationIdentity identity) { Attributes attributes = identity.getAttributes(); Entry realmAccess = attributes.get(CLAIM_REALM_ACCESS); Set<String> roleSet = new HashSet<>(); if (realmAccess != null) { String realmAccessValue = realmAccess.get(0); try { Map<String, List<String>> jsonNode = mapper.readValue(realmAccessValue, Map.class); List<String> roles = jsonNode.get(CLAIM_ROLES); if (roles != null) { roleSet.addAll(roles); } } catch (IOException cause) { throw new RuntimeException("Failed to decode realm access roles", cause); } } Entry resourceAccess = attributes.get(CLAIM_RESOURCE_ACCESS); if (resourceAccess != null) { Iterator<String> iterator = resourceAccess.iterator(); while (iterator.hasNext()) { try { Map<String, Map<String, List<String>>> resources = mapper.readValue(iterator.next(), Map.class); for (String resourceKey : resources.keySet()) { List<String> roles = resources.get(resourceKey).get("roles"); if (roles != null) { roleSet.addAll(roles); } } } catch (IOException cause) { throw new RuntimeException("Failed to decode resource access roles", cause); } } } return Roles.fromSet(roleSet); }

Target:
public Roles decodeRoles(AuthorizationIdentity identity) { Attributes attributes = identity.getAttributes(); Entry realmAccess = attributes.get(CLAIM_REALM_ACCESS); Set<String> roleSet = new HashSet<>(); if (realmAccess != null) { String realmAccessValue = realmAccess.get(0); try { Map<String, List<String>> jsonNode = mapper.readValue(realmAccessValue, Map.class); List<String> roles = jsonNode.get(CLAIM_ROLES); if (roles != null) { roleSet.addAll(roles); } } catch (IOException cause) { throw new RuntimeException("Failed to decode realm access roles", cause); } } Entry resourceAccess = attributes.get(CLAIM_RESOURCE_ACCESS); if (resourceAccess != null) { for(String resource : resourceAccess) { try { Map<String, Map<String, List<String>>> resources = mapper.readValue(resource, Map.class); for (String resourceKey : resources.keySet()) { List<String> roles = resources.get(resourceKey).get("roles"); if (roles != null) { roleSet.addAll(roles); } } } catch (IOException cause) { throw new RuntimeException("Failed to decode resource access roles", cause); } } } return Roles.fromSet(roleSet); }
Source:
public STGroup getTemplates() { STGroup templates = getTarget().getTemplates(); ST version = templates.getInstanceOf("VERSION"); if ( version==null || !version.render().equals(Tool.VERSION) ) { tool.errMgr.toolError(ErrorType.INCOMPATIBLE_TOOL_AND_TEMPLATES, version, Tool.VERSION, language); } return templates; }

Target:
public STGroup getTemplates() { return getTarget().getTemplates(); }
Source:
private PaymentWorksVendor getPaymentWorksVendorByDocumentNumber(String documentNumber) { Map criteria = new HashMap(); criteria.put(PaymentWorksPropertiesConstants.PaymentWorksVendor.KFS_VENDOR_DOCUMENT_NUMBER, documentNumber); Collection<PaymentWorksVendor> newVendors = getBusinessObjectService().findMatching(PaymentWorksVendor.class, criteria); if (newVendors.isEmpty()) { return null; } else { return newVendors.iterator().next(); } }

Target:
private PaymentWorksVendor getPaymentWorksVendorByDocumentNumber(String documentNumber) { Map criteria = new HashMap(); criteria.put(PaymentWorksPropertiesConstants.PaymentWorksVendor.KFS_VENDOR_DOCUMENT_NUMBER, documentNumber); Collection<PaymentWorksVendor> newVendors = getBusinessObjectService().findMatching(PaymentWorksVendor.class, criteria); if (ObjectUtils.isNull(newVendors) || newVendors.isEmpty()) { return null; } else { return newVendors.iterator().next(); } }