auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onNewHead(FlowNode flowNode) { DatadogClient client = ClientFactory.getClient(); if (client == null){ return; } client.sendPipelineTrace(runFor(flowNode.getExecution()), flowNode); if (!isMonitored(flowNode)) { return; } StepEndNode endNode = (StepEndNode) flowNode; StepStartNode startNode = endNode.getStartNode(); int stageDepth = 0; String directParentName = null; for (BlockStartNode node : startNode.iterateEnclosingBlocks()) { if (DatadogUtilities.isStageNode(node)) { if(directParentName == null){ directParentName = getStageName(node); } stageDepth++; } } if(directParentName == null){ directParentName = "root"; } WorkflowRun run = getRun(flowNode); if(run == null){ return; } try { String result = DatadogUtilities.getResultTag(endNode); BuildData buildData = new BuildData(run, flowNode.getExecution().getOwner().getListener()); String hostname = buildData.getHostname(""); Map<String, Set<String>> tags = buildData.getTags(); TagsUtil.addTagToTags(tags, "stage_name", getStageName(startNode)); TagsUtil.addTagToTags(tags, "parent_stage_name", directParentName); TagsUtil.addTagToTags(tags, "stage_depth", String.valueOf(stageDepth)); TagsUtil.addTagToTags(tags, "result", result); client.gauge("jenkins.job.stage_duration", getTime(startNode, endNode), hostname, tags); client.gauge("jenkins.job.stage_completed", 1, hostname, tags); } catch (IOException | InterruptedException e) { DatadogUtilities.severe(logger, e, "Unable to submit the stage duration metric for " + getStageName(startNode)); } }

Target:
public void onNewHead(FlowNode flowNode) { DatadogClient client = ClientFactory.getClient(); if (client == null){ return; } client.sendPipelineTrace(runFor(flowNode.getExecution()), flowNode); if (!isMonitored(flowNode)) { return; } StepEndNode endNode = (StepEndNode) flowNode; StepStartNode startNode = endNode.getStartNode(); int stageDepth = 0; String directParentName = null; for (BlockStartNode node : startNode.iterateEnclosingBlocks()) { if (DatadogUtilities.isStageNode(node)) { if(directParentName == null){ directParentName = getStageName(node); } stageDepth++; } } if(directParentName == null){ directParentName = "root"; } WorkflowRun run = getRun(flowNode); if(run == null){ return; } try { String result = DatadogUtilities.getResultTag(endNode); BuildData buildData = new BuildData(run, flowNode.getExecution().getOwner().getListener()); String hostname = buildData.getHostname(""); Map<String, Set<String>> tags = buildData.getTags(); TagsUtil.addTagToTags(tags, "stage_name", getStageName(startNode)); TagsUtil.addTagToTags(tags, "parent_stage_name", directParentName); TagsUtil.addTagToTags(tags, "stage_depth", String.valueOf(stageDepth)); TagsUtil.addTagToTags(tags, "result", result); client.gauge("jenkins.job.stage_duration", getTime(startNode, endNode), hostname, tags); client.incrementCounter("jenkins.job.stage_completed", hostname, tags); } catch (IOException | InterruptedException e) { DatadogUtilities.severe(logger, e, "Unable to submit the stage duration metric for " + getStageName(startNode)); } }
Source:
public String toString() { return "TtyDev [portName=" + this.portName + ", interfaceNumber=" + this.interfaceNumber + "]"; }

Target:
public String toString() { String number = this.interfaceNumber != null ? this.interfaceNumber.toString() : "null"; return "TtyDev [portName=" + this.portName + ", interfaceNumber=" + number + "]"; }
Source:
private static String getParamDisplayString( List<org.parosproxy.paros.core.scanner.NameValuePair> list, int type) { StringBuilder sb = new StringBuilder(); list.stream() .sorted() .filter(entry -> entry.getType() == type) .forEach( entry -> { String name = entry.getName(); if (name != null) { if (sb.length() > 0) { sb.append(','); } if (name.length() > 40) { name = name.substring(0, 40); } sb.append(name); } }); String result = ""; if (sb.length() > 0) { result = sb.insert(0, '(').append(')').toString(); } return result; }

Target:
private static String getParamDisplayString( List<org.parosproxy.paros.core.scanner.NameValuePair> list, int type) { StringBuilder sb = new StringBuilder(); list.stream() .sorted() .filter(entry -> entry.getType() == type) .forEach( entry -> { String name = entry.getName(); if (name != null) { if (sb.length() > 0) { sb.append(','); } if (name.length() > 40) { name = name.substring(0, 40) + "..."; } sb.append(name); } }); return sb.length() > 0 ? sb.insert(0, '(').append(')').toString() : ""; }
Source:
public boolean apply(Game game, Ability source) { Player controller = null; boolean countered = false; UUID targetId = this.getTargetPointer().getFirst(game, source); if (targetId != null) { controller = game.getPlayer(game.getControllerId(targetId)); } if (targetId != null && game.getStack().counter(targetId, source.getSourceId(), game)) { countered = true; } if (controller != null) { Effect effect = new DrawCardTargetEffect(new StaticValue(1), false); effect.setTargetPointer(new FixedTarget(controller.getId())); effect.setText("That player draws a card"); DelayedTriggeredAbility ability = new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(effect); game.addDelayedTriggeredAbility(ability, source); } return countered; }

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Player chosenPlayer = null; UUID targetId = this.getTargetPointer().getFirst(game, source); if (targetId == null) { TargetPlayer target = new TargetPlayer(1, 1, true); controller.chooseTarget(outcome, target, source, game); chosenPlayer = game.getPlayer(target.getFirstTarget()); } if (targetId != null) { chosenPlayer = game.getPlayer(game.getControllerId(targetId)); } if (chosenPlayer != null) { Effect effect = new DrawCardTargetEffect(1); effect.setTargetPointer(new FixedTarget(chosenPlayer.getId())); effect.setText("That player draws a card"); DelayedTriggeredAbility ability = new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(effect); game.addDelayedTriggeredAbility(ability, source); } return true; }
Source:
public void weProxyPrepareRequests() { when(components.acceptor(CLIENT_1).prepare(1, PROPOSAL_ID_1)).thenReturn(paxosPromise(PROPOSAL_ID_1)); when(components.acceptor(CLIENT_2).prepare(1, PROPOSAL_ID_1)).thenReturn(paxosPromise(PROPOSAL_ID_1)); when(components.acceptor(CLIENT_2).prepare(2, PROPOSAL_ID_2)).thenReturn(paxosPromise(PROPOSAL_ID_2)); when(components.acceptor(CLIENT_1).getLatestSequencePreparedOrAccepted()).thenReturn(1L); when(components.acceptor(CLIENT_2).getLatestSequencePreparedOrAccepted()).thenReturn(2L); SetMultimap<Client, WithSeq<PaxosProposalId>> request = ImmutableSetMultimap .<Client, WithSeq<PaxosProposalId>>builder() .put(CLIENT_1, WithSeq.of(1, PROPOSAL_ID_1)) .putAll(CLIENT_2, WithSeq.of(1, PROPOSAL_ID_1), WithSeq.of(2, PROPOSAL_ID_2)) .build(); SetMultimap<Client, WithSeq<PaxosPromise>> expected = ImmutableSetMultimap .<Client, WithSeq<PaxosPromise>>builder() .put(CLIENT_1, WithSeq.of(1, paxosPromise(PROPOSAL_ID_1))) .put(CLIENT_2, WithSeq.of(1, paxosPromise(PROPOSAL_ID_1))) .put(CLIENT_2, WithSeq.of(2, paxosPromise(PROPOSAL_ID_2))) .build(); assertThat(resource.prepare(request)) .isEqualTo(expected); verify(cache).updateSequenceNumbers(ImmutableSet.of( WithSeq.of(1, CLIENT_1), WithSeq.of(2, CLIENT_2))); }

Target:
public void weProxyPrepareRequests() { when(components.acceptor(CLIENT_1).prepare(1, PROPOSAL_ID_1)).thenReturn(promise(PROPOSAL_ID_1)); when(components.acceptor(CLIENT_2).prepare(1, PROPOSAL_ID_1)).thenReturn(promise(PROPOSAL_ID_1)); when(components.acceptor(CLIENT_2).prepare(2, PROPOSAL_ID_2)).thenReturn(promise(PROPOSAL_ID_2)); when(components.acceptor(CLIENT_1).getLatestSequencePreparedOrAccepted()).thenReturn(1L); when(components.acceptor(CLIENT_2).getLatestSequencePreparedOrAccepted()).thenReturn(2L); SetMultimap<Client, WithSeq<PaxosProposalId>> request = ImmutableSetMultimap .<Client, WithSeq<PaxosProposalId>>builder() .put(CLIENT_1, WithSeq.of(1, PROPOSAL_ID_1)) .putAll(CLIENT_2, WithSeq.of(1, PROPOSAL_ID_1), WithSeq.of(2, PROPOSAL_ID_2)) .build(); SetMultimap<Client, WithSeq<PaxosPromise>> expected = ImmutableSetMultimap .<Client, WithSeq<PaxosPromise>>builder() .put(CLIENT_1, WithSeq.of(1, promise(PROPOSAL_ID_1))) .putAll(CLIENT_2, WithSeq.of(1, promise(PROPOSAL_ID_1)), WithSeq.of(2, promise(PROPOSAL_ID_2))) .build(); assertThat(resource.prepare(request)) .isEqualTo(expected); verify(cache).updateSequenceNumbers(ImmutableSet.of( WithSeq.of(1, CLIENT_1), WithSeq.of(2, CLIENT_2))); }
Source:
public void newLimitedEntryActionRetractFact() { final LimitedEntryActionRetractFactCol52 column = new LimitedEntryActionRetractFactCol52(); column.setValue( new DTCellValue52( "" ) ); final ActionRetractFactPopup popup = new ActionRetractFactPopup( model, presenter, new ActionColumnCommand() { public void execute( final ActionCol52 column ) { presenter.appendColumn( column ); } }, column, true, !access.isEditable() ); popup.show(); }

Target:
public void newLimitedEntryActionRetractFact() { final LimitedEntryActionRetractFactCol52 column = new LimitedEntryActionRetractFactCol52(); column.setValue( new DTCellValue52( "" ) ); doNewActionRetractFactColumn( column ); }
Source:
public TableViewerColumn getTableViewerColumn() { return tlc; }

Target:
public TableViewerColumn getTableViewerColumn() { return tableViewerColumn; }
Source:
public void JERSEY_2643() { String result = target("test3").request().get(String.class); assertEquals("test ok", result); }

Target:
public void JERSEY_2643() { String result = target("JERSEY-2643").request().get(String.class); assertEquals("test ok", result); }
Source:
public @ResponseBody boolean updateGame( @PathVariable int id, @RequestParam(value = "location") String location, @RequestParam(value = "addOfficial") String addOfficial, @RequestParam(value = "removeOfficial") String removeOfficial, HttpSession session) { Member member = (Member) session.getAttribute("member"); if(MemberUtils.atLeastCoordinator(member)) { return false; } GameDao gameDao = new GameDao(); MemberDao memberDao = new MemberDao(); Game game = gameDao.getGameById(id, true); if(location!="") { game.setGameLocation(location); } game.removeOfficial(memberDao.getMemberByUsername(removeOfficial)); game.addOfficial(memberDao.getMemberByUsername(addOfficial)); gameDao.saveGame(game); return true; }

Target:
public @ResponseBody boolean updateGame( @PathVariable int id, @RequestParam(value = "location") String location, @RequestParam(value = "addOfficial") String addOfficial, @RequestParam(value = "removeOfficial") String removeOfficial, HttpSession session) { Member member = (Member) session.getAttribute("member"); if(!MemberUtils.atLeastCoordinator(member)) { return false; } GameDao gameDao = new GameDao(); MemberDao memberDao = new MemberDao(); Game game = gameDao.getGameById(id, true); if(location!="") { game.setGameLocation(location); } game.removeOfficial(memberDao.getMemberByUsername(removeOfficial)); game.addOfficial(memberDao.getMemberByUsername(addOfficial)); gameDao.saveGame(game); return true; }
Source:
public static long arrayPosition( @TypeParameter("T") Type type, @OperatorDependency(operator = EQUAL, argumentTypes = {"T", "T"}) MethodHandle equalMethodHandle, @SqlType("array(T)") Block array, @SqlType("T") Slice element) { int size = array.getPositionCount(); for (int i = 0; i < size; i++) { if (!array.isNull(i)) { Slice arrayValue = type.getSlice(array, i); try { Boolean result = (Boolean) equalMethodHandle.invokeExact(arrayValue, element); checkArgument(result != null, "Array element should not be nulll"); if (result) { return i + 1; } } catch (Throwable t) { throw internalError(t); } } } return 0; }

Target:
public static long arrayPosition( @TypeParameter("T") Type type, @OperatorDependency(operator = EQUAL, argumentTypes = {"T", "T"}) MethodHandle equalMethodHandle, @SqlType("array(T)") Block array, @SqlType("T") Slice element) { int size = array.getPositionCount(); for (int i = 0; i < size; i++) { if (!array.isNull(i)) { Slice arrayValue = type.getSlice(array, i); try { Boolean result = (Boolean) equalMethodHandle.invokeExact(arrayValue, element); verify(result != null, "Array element should not be nul"); if (result) { return i + 1; } } catch (Throwable t) { throw internalError(t); } } } return 0; }
Source:
public static String fromIssuePriority(Issue.Priority priority) { switch (priority) { case IMMEDIATE: return "1"; case HIGH: return "2"; case URGEND: return "3"; case NONE: return "4"; case LOW: return "5"; default: return "4"; } }

Target:
public static String fromIssuePriority(Issue.Priority priority) { if (fieldMap == null) { initMap(); } return fieldMap.get(priority); }
Source:
protected static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) { if(extension == null) { extension = ""; } if(containerFullPath == null) { containerFullPath = new Path(""); } if(fileName == null || fileName.trim().length() == 0) { fileName = DEFAULT_NAME; } if(fileName.contains(".")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")); } List<String> extensionPrefixes = new ArrayList<String>(); for (DiagramCategoryDescriptor diagramCategoryDescriptor : DiagramCategoryRegistry.getInstance().getDiagramCategories()) { String extensionPrefix = diagramCategoryDescriptor.getExtensionPrefix(); if (extensionPrefix == null) continue; extensionPrefixes.add(extensionPrefix); } String[] segments = fileName.split("\\."); for (int i = segments.length-1; i >= 0; i--) { String segment = segments[i]; if (extensionPrefixes.contains(segment)) { fileName = fileName.substring(0, fileName.lastIndexOf("."+segment)); } } IPath filePath = containerFullPath.append(fileName); filePath = filePath.addFileExtension(extension); int i = 1; while(ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) { i++; filePath = containerFullPath.append(fileName + i); if(extension != null) { filePath = filePath.addFileExtension(extension); } } return filePath.lastSegment(); }

Target:
protected static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) { if(extension == null) { extension = ""; } if(containerFullPath == null) { containerFullPath = new Path(""); } if(fileName == null || fileName.trim().length() == 0) { fileName = DEFAULT_NAME; } if(fileName.contains(".")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")); } Set<String> extensionPrefixes = new HashSet<String>(); extensionPrefixes.add(extension); for(DiagramCategoryDescriptor diagramCategoryDescriptor : DiagramCategoryRegistry.getInstance().getDiagramCategories()) { String extensionPrefix = diagramCategoryDescriptor.getExtensionPrefix(); if(extensionPrefix == null) { continue; } extensionPrefixes.add(extensionPrefix); } String[] segments = fileName.split("\\."); for(int i = segments.length - 1; i > 0; i--) { String segment = segments[i]; if(extensionPrefixes.contains(segment)) { int index = fileName.lastIndexOf("." + segment); if(index >= 0) { fileName = fileName.substring(0, index); } } else { break; } } IPath filePath = containerFullPath.append(fileName); filePath = filePath.addFileExtension(extension); int i = 1; while(ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) { i++; filePath = containerFullPath.append(fileName + i); if(extension != null) { filePath = filePath.addFileExtension(extension); } } return filePath.lastSegment(); }
Source:
private List<String> getServices( String serviceName ) throws SQLException { List<String> serviceNames = new ArrayList<String>(); try { StringBuilder serviceArguments = new StringBuilder().append( "/listServices" ); if ( StringUtils.isNotBlank( serviceName ) ) { serviceArguments.append( "?serviceName=" ); serviceArguments.append( serviceName ); } String result = execService( serviceArguments.toString() ); Document doc = XMLHandler.loadXMLString( createDocumentBuilder(), result ); Node servicesNode = XMLHandler.getSubNode( doc, "services" ); List<Node> serviceNodes = XMLHandler.getNodes( servicesNode, "service" ); for ( Node serviceNode : serviceNodes ) { serviceNames.add( XMLHandler.getTagValue( serviceNode, "name" ) ); } } catch ( Exception e ) { throw serverException( e ); } return serviceNames; }

Target:
private List<String> getServices( String serviceName ) throws SQLException { List<String> serviceNames = new ArrayList<String>(); try { List<Node> serviceNodes = getServiceNodes( serviceName ); for ( Node serviceNode : serviceNodes ) { serviceNames.add( XMLHandler.getTagValue( serviceNode, "name" ) ); } } catch ( Exception e ) { throw serverException( e ); } return serviceNames; }
Source:
public String encryptSecret(String plainText) { if (plainText.length() > MAX_PLAINTEXT_LENGTH) { throw new IllegalArgumentException("Too long text"); } byte[] nonce = generateNonce(); Cipher cipher = cipher(ENCRYPT_MODE, sharedSecret, nonce); byte[] plainTextBytes = plainText.getBytes(UTF_8); if (plainTextBytes.length > MAX_PLAINTEXT_LENGTH) { throw new IllegalArgumentException("Too long text"); } int recordContentsLength = LENGTH_SIZE + plainTextBytes.length; int recordLength = RECORD_SIZE_ALIGNMENT * ((recordContentsLength + RECORD_SIZE_ALIGNMENT - 1) / RECORD_SIZE_ALIGNMENT) + GCM_TAG_LENGTH; byte[] recordBytes = new byte[recordLength]; ByteBuffer recordBuffer = ByteBuffer.wrap(recordBytes); recordBuffer.putInt(plainTextBytes.length); recordBuffer.put(plainTextBytes); byte[] cipherText; try { cipherText = cipher.doFinal(recordBytes); } catch (IllegalBlockSizeException | BadPaddingException e) { throw Throwables.propagate(e); } byte[] opaque = new byte[WRAPPING_SIZE + cipherText.length]; ByteBuffer output = ByteBuffer.wrap(opaque); output.put(NAME_BYTES); output.putInt(VERSION_2); output.putInt(TERM); output.put(nonce); output.put(cipherText); assert output.remaining() == 0; return Base64.getEncoder().encodeToString(opaque); }

Target:
public String encryptSecret(String plainText) { if (plainText.length() > MAX_PLAINTEXT_LENGTH) { throw new IllegalArgumentException("Too long text"); } byte[] nonce = generateNonce(); Cipher cipher = cipher(ENCRYPT_MODE, sharedSecret, nonce); byte[] plainTextBytes = plainText.getBytes(UTF_8); if (plainTextBytes.length > MAX_PLAINTEXT_LENGTH) { throw new IllegalArgumentException("Too long text"); } int recordContentsLength = LENGTH_SIZE + plainTextBytes.length; int recordLength = RECORD_SIZE_ALIGNMENT * ((recordContentsLength + RECORD_SIZE_ALIGNMENT - 1) / RECORD_SIZE_ALIGNMENT); byte[] recordBytes = new byte[recordLength]; ByteBuffer recordBuffer = ByteBuffer.wrap(recordBytes); recordBuffer.putInt(plainTextBytes.length); recordBuffer.put(plainTextBytes); byte[] cipherText; try { cipherText = cipher.doFinal(recordBytes); } catch (IllegalBlockSizeException | BadPaddingException e) { throw Throwables.propagate(e); } byte[] opaque = new byte[WRAPPING_SIZE + cipherText.length]; ByteBuffer output = ByteBuffer.wrap(opaque); output.put(NAME_BYTES); output.putInt(VERSION_2); output.putInt(TERM); output.put(nonce); output.put(cipherText); assert output.remaining() == 0; return Base64.getEncoder().encodeToString(opaque); }
Source:
public void testScoresV3WithParam() { final int age = 23; final int durThreshold = 480; final List<Integer> sleepDurationMinutes = Lists.newArrayList(80, 299, 360, 510, 780); final List<Integer> correct = Lists.newArrayList(0, 27, 44, 93, 78); for (int i = 0; i < sleepDurationMinutes.size(); i++) { final int score = SleepScoreUtils.getSleepScoreDurationV3(age, durThreshold, sleepDurationMinutes.get(i)); LOGGER.trace("value -> {}", sleepDurationMinutes.get(i), score); assertThat(score, is(correct.get(i))); } }

Target:
public void testScoresV3WithParam() { final int age = 23; final int durThreshold = 480; final List<Integer> sleepDurationMinutes = Lists.newArrayList(80, 299, 360, 510, 780); final List<Integer> correct = Lists.newArrayList(0, 27, 44, 93, 78); for (int i = 0; i < sleepDurationMinutes.size(); i++) { final int score = SleepScoreUtils.getSleepScoreDurationV3(1001L, age, durThreshold, sleepDurationMinutes.get(i)); LOGGER.info("value -> {}", sleepDurationMinutes.get(i), score); assertThat(score, is(correct.get(i))); } }
Source:
private static String guessRemote(GitHubSCMSource source) { String apiUri = StringUtils.removeEnd(source.getApiUri(), "/"); if (StringUtils.isBlank(apiUri) || GitHubServerConfig.GITHUB_URL.equals(apiUri)) { apiUri = "<LINK_0>"; } else { apiUri = StringUtils.removeEnd(apiUri, "/"+API_V3); } GitHubSCMSourceHelper helper = GitHubSCMSourceHelper.build(source); return apiUri + "/" + helper.repo + ".git"; }

Target:
private static String guessRemote(GitHubSCMSource source) { String apiUri = StringUtils.removeEnd(source.getApiUri(), "/"); if (StringUtils.isBlank(apiUri) || GitHubServerConfig.GITHUB_URL.equals(apiUri)) { apiUri = "<LINK_0>"; } else { apiUri = StringUtils.removeEnd(apiUri, "/"+API_V3); } return apiUri + "/" + source.getRepoOwner() + "/" + source.getRepository() + ".git"; }
Source:
public static SessionWork<Integer> getTotalNumberOfTasks(final DBTaskDataParameters params) { return new SessionWork<Integer>() { @Override public Integer executeWork(Session session) { Set<TaskStatus> taskStatuses = params.getStatuses(); if (taskStatuses.isEmpty()) { return 0; } boolean hasUser = params.hasUser(); boolean hasTag = params.hasTag(); boolean hasDateFrom = params.hasDateFrom(); boolean hasDateTo = params.hasDateTo(); String queryPrefix = "select count(*) from TaskData T where "; Query query = getQuery(session, params, taskStatuses, hasUser, hasTag, hasDateFrom, hasDateTo, null, queryPrefix); Long count = (Long) query.uniqueResult(); return count.intValue(); } }; }

Target:
public static SessionWork<Integer> getTotalNumberOfTasks(final DBTaskDataParameters params) { return new SessionWork<Integer>() { @Override public Integer executeWork(Session session) { Set<TaskStatus> taskStatuses = params.getStatuses(); if (taskStatuses.isEmpty()) { return 0; } boolean hasUser = params.hasUser(); boolean hasTag = params.hasTag(); boolean hasDateFrom = params.hasDateFrom(); boolean hasDateTo = params.hasDateTo(); String queryPrefix = "select count(*) from TaskData T where "; Query query = getQuery(session, params, taskStatuses, hasUser, hasTag, hasDateFrom, hasDateTo, SortSpecifierContainer.EMPTY_CONTAINER, queryPrefix); Long count = (Long) query.uniqueResult(); return count.intValue(); } }; }
Source:
public void testSignatureMaskOnExceptionMessage() { final AzureBlobFileSystem fs; String msg = null; try { fs = getFileSystem(); AbfsRestOperation abfsHttpRestOperation = fs.getAbfsClient() .renamePath("testABC/test.xt", "testABC/abc.txt", null); } catch (IOException e) { msg = e.getMessage(); } Assertions.assertThat(msg.substring(msg.indexOf("sig="))) .describedAs("Signature query param should be masked") .startsWith("sig=XXXX"); }

Target:
public void testSignatureMaskOnExceptionMessage() throws Exception { intercept(IOException.class, "sig=XXXX", () -> getFileSystem().getAbfsClient() .renamePath("testABC/test.xt", "testABC/abc.txt", null)); }
Source:
public byte[] evaluateInitialResponse(OAuth2InitialClientMessage initialClientMessage) throws AuthenticationMechanismException, SaslException { if (initialClientMessage.isBearerToken()) { String auth = initialClientMessage.getAuth(); String token = auth.substring(auth.indexOf(" ") + 1); BearerTokenEvidence evidence = new BearerTokenEvidence(token); EvidenceVerifyCallback evidenceVerifyCallback = new EvidenceVerifyCallback(evidence); try { MechanismUtil.handleCallbacks(this.mechanismName, this.callbackHandler, evidenceVerifyCallback); } catch (UnsupportedCallbackException e) { throw log.mechAuthorizationUnsupported(this.mechanismName, e); } if (evidenceVerifyCallback.isVerified()) { AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, null); try { MechanismUtil.handleCallbacks(this.mechanismName, this.callbackHandler, authorizeCallback); } catch (UnsupportedCallbackException e) { throw log.mechAuthorizationUnsupported(this.mechanismName, e); } if (authorizeCallback.isAuthorized()) { return new byte[0]; } } return createErrorMessage(); } throw log.mechInvalidClientMessage(this.mechanismName); }

Target:
public byte[] evaluateInitialResponse(OAuth2InitialClientMessage initialClientMessage) throws AuthenticationMechanismException { if (initialClientMessage.isBearerToken()) { String auth = initialClientMessage.getAuth(); String token = auth.substring(auth.indexOf(" ") + 1); BearerTokenEvidence evidence = new BearerTokenEvidence(token); EvidenceVerifyCallback evidenceVerifyCallback = new EvidenceVerifyCallback(evidence); try { MechanismUtil.handleCallbacks(this.mechanismName, this.callbackHandler, evidenceVerifyCallback); } catch (UnsupportedCallbackException e) { throw log.mechAuthorizationUnsupported(this.mechanismName, e); } if (evidenceVerifyCallback.isVerified()) { AuthorizeCallback authorizeCallback = new AuthorizeCallback(null, null); try { MechanismUtil.handleCallbacks(this.mechanismName, this.callbackHandler, authorizeCallback); } catch (UnsupportedCallbackException e) { throw log.mechAuthorizationUnsupported(this.mechanismName, e); } if (authorizeCallback.isAuthorized()) { return new byte[0]; } } return createErrorMessage(); } throw log.mechInvalidClientMessage(this.mechanismName); }
Source:
public NewTableConfiguration attachIterator(IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException { checkArgument(setting != null, "setting is null"); checkArgument(scopes != null, "scopes is null"); if (iteratorProps.isEmpty()) iteratorProps = new HashMap<>(); TableOperationsHelper.checkIteratorConflicts(iteratorProps, setting, scopes); for (IteratorScope scope : scopes) { String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), setting.getName()); for (Entry<String,String> prop : setting.getOptions().entrySet()) { iteratorProps.put(root + ".opt." + prop.getKey(), prop.getValue()); } iteratorProps.put(root, setting.getPriority() + "," + setting.getIteratorClass()); } return this; }

Target:
public NewTableConfiguration attachIterator(IteratorSetting setting, EnumSet<IteratorScope> scopes) { Objects.requireNonNull(setting, "setting cannot be null!"); Objects.requireNonNull(scopes, "scopes cannot be null!"); try { TableOperationsHelper.checkIteratorConflicts(iteratorProps, setting, scopes); } catch (AccumuloException e) { throw new IllegalArgumentException("The specified IteratorSetting conflicts with an iterator already defined on this NewTableConfiguration", e); } for (IteratorScope scope : scopes) { String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), setting.getName()); for (Entry<String,String> prop : setting.getOptions().entrySet()) { iteratorProps.put(root + ".opt." + prop.getKey(), prop.getValue()); } iteratorProps.put(root, setting.getPriority() + "," + setting.getIteratorClass()); checkDisjoint(properties, iteratorProps, "iterator"); } return this; }
Source:
private void createZip(SourceResponse upstreamResponse, String filePath) throws CatalogTransformerException { try (FileOutputStream fileOutputStream = new FileOutputStream(filePath); ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream)) { List<Result> resultList = upstreamResponse.getResults(); Map<String, Resource> resourceMap = new HashMap<>(); resultList .stream() .map(Result::getMetacard) .forEach( metacard -> { writeMetacardToZip(zipOutputStream, metacard); if (hasLocalResources(metacard)) { resourceMap.putAll(getAllMetacardContent(metacard)); } }); resourceMap.forEach( (filename, resource) -> writeResourceToZip(zipOutputStream, filename, resource)); } catch (IOException e) { LOGGER.debug( "Error occurred when initializing/closing ZipOutputStream with path {}.", filePath, e); throw new CatalogTransformerException( String.format( "Error occurred when initializing/closing ZipOutputStream with path %s.", filePath), e); } }

Target:
private void createZip(SourceResponse upstreamResponse, String filePath) throws CatalogTransformerException { try (FileOutputStream fileOutputStream = new FileOutputStream(filePath); ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream)) { List<Result> resultList = upstreamResponse.getResults(); Map<String, Resource> resourceMap = new HashMap<>(); resultList .stream() .map(Result::getMetacard) .forEach( metacard -> { writeMetacardToZip(zipOutputStream, metacard); if (hasLocalResources(metacard)) { resourceMap.putAll(getAllMetacardContent(metacard)); } }); resourceMap.forEach( (filename, resource) -> writeResourceToZip(zipOutputStream, filename, resource)); } catch (IOException e) { throw new CatalogTransformerException( String.format( "Error occurred when initializing/closing ZipOutputStream with path %s.", filePath), e); } }
Source:
public String edit() { try { savedId.clear(); ResourceInterface resource = this.loadResource(this.getResourceId()); this.setResourceTypeCode(resource.getType()); List fileDescr = new ArrayList<String>(); fileDescr.add(resource.getDescription()); setFileDescriptions(fileDescr); List<Category> resCategories = resource.getCategories(); for (int i = 0; i < resCategories.size(); i++) { Category resCat = resCategories.get(i); this.getCategoryCodes().add(resCat.getCode()); } this.setMainGroup(resource.getMainGroup()); this.setStrutsAction(ApsAdminSystemConstants.EDIT); } catch (Throwable t) { logger.error("error in edit", t); return FAILURE; } return SUCCESS; }

Target:
public String edit() { try { savedId.clear(); ResourceInterface resource = this.loadResource(this.getResourceId()); this.setResourceTypeCode(resource.getType()); List fileDescr = new ArrayList<String>(); fileDescr.add(resource.getDescription()); setFileDescriptions(fileDescr); List<Category> resCategories = resource.getCategories(); for (Category cat : resCategories) { this.getCategoryCodes().add(cat.getCode()); } this.setMainGroup(resource.getMainGroup()); this.setStrutsAction(ApsAdminSystemConstants.EDIT); } catch (Throwable t) { logger.error("error in edit", t); return FAILURE; } return SUCCESS; }
Source:
public PlanNode visitSort(SortNode node, RewriteContext<LimitContext> context) { LimitContext limit = context.get(); PlanNode rewrittenSource = context.rewrite(node.getSource()); if (limit != null) { return new TopNNode(node.getId(), rewrittenSource, limit.getCount(), node.getOrderingScheme(), TopNNode.Step.SINGLE); } else if (rewrittenSource != node.getSource()) { return new SortNode(node.getId(), rewrittenSource, node.getOrderingScheme(), false); } return node; }

Target:
public PlanNode visitSort(SortNode node, RewriteContext<LimitContext> context) { LimitContext limit = context.get(); PlanNode rewrittenSource = context.rewrite(node.getSource()); if (limit != null) { return new TopNNode(node.getId(), rewrittenSource, limit.getCount(), node.getOrderingScheme(), TopNNode.Step.SINGLE); } else if (rewrittenSource != node.getSource()) { return new SortNode(node.getId(), rewrittenSource, node.getOrderingScheme(), node.isPartial()); } return node; }
Source:
protected Response getIncomingPhoneNumber(final String accountSid, final String sid, final MediaType responseType) { try{ Account operatedAccount = accountsDao.getAccount(accountSid); secure(operatedAccount, "RestComm:Read:IncomingPhoneNumbers"); final IncomingPhoneNumber incomingPhoneNumber = dao.getIncomingPhoneNumber(new Sid(sid)); if (incomingPhoneNumber == null) { return status(NOT_FOUND).build(); } else { if (operatedAccount == null) { return status(BAD_REQUEST).build(); } secure(operatedAccount, incomingPhoneNumber.getAccountSid(), SecuredType.SECURED_STANDARD); if (APPLICATION_JSON_TYPE == responseType) { return ok(gson.toJson(incomingPhoneNumber), APPLICATION_JSON).build(); } else if (APPLICATION_XML_TYPE == responseType) { final RestCommResponse response = new RestCommResponse(incomingPhoneNumber); return ok(xstream.toXML(response), APPLICATION_XML).build(); } else { return null; } } }catch(Exception e){ logger.error("", e); return status(INTERNAL_SERVER_ERROR).build(); } }

Target:
protected Response getIncomingPhoneNumber(final String accountSid, final String sid, final MediaType responseType) { Account operatedAccount = accountsDao.getAccount(accountSid); secure(operatedAccount, "RestComm:Read:IncomingPhoneNumbers"); try{ final IncomingPhoneNumber incomingPhoneNumber = dao.getIncomingPhoneNumber(new Sid(sid)); if (incomingPhoneNumber == null) { return status(NOT_FOUND).build(); } else { if (operatedAccount == null) { return status(BAD_REQUEST).build(); } secure(operatedAccount, incomingPhoneNumber.getAccountSid(), SecuredType.SECURED_STANDARD); if (APPLICATION_JSON_TYPE == responseType) { return ok(gson.toJson(incomingPhoneNumber), APPLICATION_JSON).build(); } else if (APPLICATION_XML_TYPE == responseType) { final RestCommResponse response = new RestCommResponse(incomingPhoneNumber); return ok(xstream.toXML(response), APPLICATION_XML).build(); } else { return null; } } }catch(Exception e){ logger.error("Exception while performing getIncomingPhoneNumber: ", e); return status(INTERNAL_SERVER_ERROR).build(); } }
Source:
public List<BalanceResult> balance(Cluster cluster, List<VDS> hosts, Map<String, String> parameters) { final List<BalanceResult> migrationRule = super.balance(cluster, hosts, parameters); List<VDS> allHosts = vdsDao.getAllForCluster(cluster.getId()); List<VDS> emptyHosts = new ArrayList<>(); List<VDS> maintenanceHosts = new ArrayList<>(); List<VDS> downHosts = new ArrayList<>(); List<VDS> maintenanceHostsWithOkExteranlStatus = new ArrayList<>(); getHostLists(allHosts, emptyHosts, maintenanceHosts, downHosts, maintenanceHostsWithOkExteranlStatus); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( cluster, downHosts, maintenanceHosts, maintenanceHostsWithOkExteranlStatus, emptyHosts, parameters); if (action != null) { processPmAction(action); } return migrationRule; }

Target:
public List<BalanceResult> balance(Cluster cluster, List<VDS> hosts, Map<String, String> parameters) { final List<BalanceResult> migrationRule = super.balance(cluster, hosts, parameters); List<VDS> allHosts = vdsDao.getAllForCluster(cluster.getId()); List<VDS> emptyHosts = new ArrayList<>(); List<VDS> maintenanceHosts = new ArrayList<>(); List<VDS> downHosts = new ArrayList<>(); List<VDS> maintenanceHostsWithOkExternalStatus = new ArrayList<>(); getHostLists(allHosts, emptyHosts, maintenanceHosts, downHosts, maintenanceHostsWithOkExternalStatus); Pair<VDS, VDSStatus> action = evaluatePowerManagementSituation( cluster, downHosts, maintenanceHosts, maintenanceHostsWithOkExternalStatus, emptyHosts, parameters); if (action != null) { processPmAction(action); } return migrationRule; }
Source:
public int handleCommand(final Namespace ns, final Manager m) { if (!m.isRegistered()) { System.err.println("User is not registered."); return 1; } String number = ns.getString("number"); String name = ns.getString("name"); try { m.setContactName(number, name); int expiration = 0; if (ns.getInt("expiration") != null) { expiration = ns.getInt("expiration"); m.setExpirationTimer(number, expiration); } } catch (InvalidNumberException e) { System.out.println("Invalid contact number: " + e.getMessage()); } return 0; }

Target:
public int handleCommand(final Namespace ns, final Manager m) { if (!m.isRegistered()) { System.err.println("User is not registered."); return 1; } String number = ns.getString("number"); String name = ns.getString("name"); try { m.setContactName(number, name); Integer expiration = ns.getInt("expiration"); if (expiration != null) { m.setExpirationTimer(number, expiration); } } catch (InvalidNumberException e) { System.out.println("Invalid contact number: " + e.getMessage()); } catch (IOException e) { System.err.println("Update contact error: " + e.getMessage()); return 3; } return 0; }
Source:
public boolean removeAttributeWithoutCheck(PerunSession sess, Resource resource, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, NS_RESOURCE_ATTR); if (getAttributesManagerImpl().isCoreAttribute(sess, attribute)) throw new WrongAttributeAssignmentException(attribute); boolean changed; try { if (this.isVirtAttribute(sess, attribute)) { changed = getAttributesManagerImpl().removeVirtualAttribute(sess, resource, attribute); } else { changed = getAttributesManagerImpl().removeAttribute(sess, resource, attribute); } if (changed) getAttributesManagerImpl().changedAttributeHook(sess, resource, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } if (changed) log.info("{} removed attribute({}) from esource. Id resource = {}",sess.getPerunClient().getId(), attribute.getName(), resource.getId()); getPerunBl().getAuditer().log(sess, "{} removed for {}.", new AttributeDefinition(attribute), resource); return changed; }

Target:
public boolean removeAttributeWithoutCheck(PerunSession sess, Resource resource, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, NS_RESOURCE_ATTR); if (getAttributesManagerImpl().isCoreAttribute(sess, attribute)) throw new WrongAttributeAssignmentException(attribute); boolean changed; try { if (this.isVirtAttribute(sess, attribute)) { changed = getAttributesManagerImpl().removeVirtualAttribute(sess, resource, attribute); } else { changed = getAttributesManagerImpl().removeAttribute(sess, resource, attribute); } if (changed) getAttributesManagerImpl().changedAttributeHook(sess, resource, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } if (changed) log.info("{} removed attribute from resource {}.",sess.getLogId(), attribute.getName(), resource.getId()); getPerunBl().getAuditer().log(sess, "{} removed for {}.", new AttributeDefinition(attribute), resource); return changed; }
Source:
public ContextAction(StandardActions command, LinkedFileViewModel linkedFile, PreferencesService preferencesService) { this.command = command; this.linkedFile = linkedFile; this.executable.bind( switch (command) { case RENAME_FILE_TO_PATTERN -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent() && !linkedFile.isGeneratedNameSameAsOriginal(), linkedFile.getFile().linkProperty()); case MOVE_FILE_TO_FOLDER_AND_RENAME, MOVE_FILE_TO_FOLDER -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent() && !linkedFile.isGeneratedPathSameAsOriginal(), linkedFile.getFile().linkProperty()); case DOWNLOAD_FILE -> Bindings.createBooleanBinding( () -> linkedFile.getFile().isOnlineLink(), linkedFile.getFile().linkProperty()); case OPEN_FILE, OPEN_FOLDER, RENAME_FILE_TO_NAME, DELETE_FILE -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent(), linkedFile.getFile().linkProperty()); default -> BindingsHelper.constantOf(true); }); }

Target:
public ContextAction(StandardActions command, LinkedFileViewModel linkedFile, PreferencesService preferencesService) { this.command = command; this.linkedFile = linkedFile; this.executable.bind( switch (command) { case RENAME_FILE_TO_PATTERN, MOVE_FILE_TO_FOLDER_AND_RENAME -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent() && !linkedFile.isGeneratedNameSameAsOriginal(), linkedFile.getFile().linkProperty()); case MOVE_FILE_TO_FOLDER -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent() && !linkedFile.isGeneratedPathSameAsOriginal(), linkedFile.getFile().linkProperty()); case DOWNLOAD_FILE -> Bindings.createBooleanBinding( () -> linkedFile.getFile().isOnlineLink(), linkedFile.getFile().linkProperty()); case OPEN_FILE, OPEN_FOLDER, RENAME_FILE_TO_NAME, DELETE_FILE -> Bindings.createBooleanBinding( () -> !linkedFile.getFile().isOnlineLink() && linkedFile.getFile().findIn(databaseContext, preferencesService.getFilePreferences()).isPresent(), linkedFile.getFile().linkProperty()); default -> BindingsHelper.constantOf(true); }); }
Source:
private void _setVdsmId(String vdsmid) { if (vdsmid == null) { throw new SoftError("Cannot acquire node id"); } log.infoFormat( "Host {0} reports unique id {1}", _vds.gethost_name(), vdsmid ); final List<VDS> list = LinqUtils.filter( DbFacade.getInstance().getVdsDao().getAllWithUniqueId(vdsmid), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return !vds.getId().equals(_vds.getId()); } } ); if (!list.isEmpty()) { final StringBuilder hosts = new StringBuilder(1024); for (VDS v : list) { if (hosts.length() > 0) { hosts.append(", "); } hosts.append(v.getvds_name()); } log.errorFormat( "Host {0} reports duplicate unique id {1} of following hosts {2}", _vds.gethost_name(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", _vds.gethost_name(), hosts ) ); } log.infoFormat("Assigning unique id {0} to Host {1}", _vds.gethost_name(), vdsmid); _vds.setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); return null; } }); }

Target:
private void _setVdsmId(String vdsmid) { if (vdsmid == null) { throw new SoftError("Cannot acquire node id"); } log.infoFormat( "Host {0} reports unique id {1}", _vds.gethost_name(), vdsmid ); final List<VDS> list = LinqUtils.filter( DbFacade.getInstance().getVdsDao().getAllWithUniqueId(vdsmid), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return !vds.getId().equals(_vds.getId()); } } ); if (!list.isEmpty()) { final StringBuilder hosts = new StringBuilder(1024); for (VDS v : list) { if (hosts.length() > 0) { hosts.append(", "); } hosts.append(v.getvds_name()); } log.errorFormat( "Host {0} reports duplicate unique id {1} of following hosts {2}", _vds.gethost_name(), vdsmid, hosts ); throw new SoftError( String.format( "Host %1$s reports unique id which already registered for %2$s", _vds.gethost_name(), hosts ) ); } log.infoFormat("Assigning unique id {0} to Host {1}", vdsmid, _vds.gethost_name()); _vds.setUniqueId(vdsmid); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { DbFacade.getInstance().getVdsStaticDao().update(_vds.getStaticData()); return null; } }); }
Source:
public ParsedToken decode(String tokenString) throws InvalidTokenException { ValidToken token; try { token = restToken.checkToken(tokenString, null); } catch (XsrfException err) { throw new InvalidTokenException(err); } if (token == null || token.getData() == null || token.getData().isEmpty()) { throw new InvalidTokenException(); } String payload; try { payload = new String(Base64.decode(token.getData()), "UTF-8"); } catch (UnsupportedEncodingException err) { throw new InvalidTokenException(err); } int colonPos = payload.indexOf(':'); if (colonPos == -1) { throw new InvalidTokenException(); } String user; try { user = payload.substring(0, colonPos); } catch (IllegalArgumentException err) { throw new InvalidTokenException(err); } String url = payload.substring(colonPos+1); return new ParsedToken(user, url); }

Target:
public ParsedToken decode(String tokenString) throws InvalidTokenException { ValidToken token; try { token = restToken.checkToken(tokenString, null); } catch (XsrfException err) { throw new InvalidTokenException(err); } if (token == null || token.getData() == null || token.getData().isEmpty()) { throw new InvalidTokenException(); } String payload; try { payload = new String(Base64.decode(token.getData()), "UTF-8"); } catch (UnsupportedEncodingException err) { throw new InvalidTokenException(err); } int colonPos = payload.indexOf(':'); if (colonPos == -1) { throw new InvalidTokenException(); } Account.Id user; try { user = Account.Id.parse(payload.substring(0, colonPos)); } catch (IllegalArgumentException err) { throw new InvalidTokenException(err); } String url = payload.substring(colonPos+1); return new ParsedToken(user, url); }
Source:
public String handleGeneralExceptions(Exception e){ return ("500: General Unhandled Exception<br>"+e.getMessage()); }

Target:
public String handleGeneralExceptions(Exception e){ LogSystem.LogEvent("Unhandled Exception - "+e.getMessage()); return ("500: General Unhandled Exception"); }
Source:
private Set<File> getSiteFeaturesAndPlugins(File basedir) throws MojoExecutionException { try { Set<File> result = new LinkedHashSet<File>(); UpdateSite site; File siteFile = new File(basedir, "site.xml"); File categoryFile = new File(basedir, "category.xml"); if (siteFile.exists()) { site = UpdateSite.read(siteFile); } else { site = UpdateSite.read(categoryFile); } for (FeatureRef feature : site.getFeatures()) { addFeature(result, feature.getId()); } return result; } catch (Exception e) { throw new MojoExecutionException("Could not collect update site features and plugins", e); } }

Target:
private Set<File> getSiteFeaturesAndPlugins(File basedir) throws MojoExecutionException { try { Set<File> result = new LinkedHashSet<File>(); UpdateSite site; File siteFile = new File(basedir, "site.xml"); if (siteFile.exists()) { site = UpdateSite.read(siteFile); for (FeatureRef feature : site.getFeatures()) { addFeature(result, feature.getId()); } } return result; } catch (Exception e) { throw new MojoExecutionException("Could not collect update site features and plugins", e); } }
Source:
private String getDefaultOrigins() { List<VDS> allVds = vdsDao.getAll(getUserID(), getParameters().isFiltered()); StringBuilder sb = new StringBuilder(); for (VDS vds : allVds) { if (sb.length() > 0) { sb.append(','); } sb.append(HTTPS); sb.append(vds.getHostName()); } String result = sb.toString(); log.debug("Default list of origins refreshed to: {}" , result); return result; }

Target:
private Set<String> getDefaultOrigins() { log.debug("getDefaultOrigins() called"); List<VDS> allVds = vdsDao.getAll(getUserID(), getParameters().isFiltered()); Set<String> result = new HashSet<>(); for (VDS vds : allVds) { if (getParameters().getSuffixes().size() > 0) { for (String suffix : getParameters().getSuffixes()) { result.add(HTTPS + vds.getHostName() + suffix); } } else { result.add(HTTPS + vds.getHostName()); } } log.debug("Default list of origins refreshed to: {}" , StringUtils.join(result, ',')); return result; }