auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void removeDeletedBricks(GlusterVolumeEntity existingVolume, List<GlusterBrickEntity> fetchedBricks) { List<Guid> idsToRemove = new ArrayList<Guid>(); for (final GlusterBrickEntity existingBrick : existingVolume.getBricks()) { if (!GlusterCoreUtil.containsBrick(fetchedBricks, existingBrick)) { idsToRemove.add(existingBrick.getId()); log.info("Detected brick '{}' removed from volume '{}'. Removing it from engine DB as well.", existingBrick.getQualifiedName(), existingVolume.getName()); logUtil.logAuditMessage(existingVolume.getClusterId(), existingVolume, null, AuditLogType.GLUSTER_VOLUME_BRICK_REMOVED_FROM_CLI, new HashMap<String, String>() { { put(GlusterConstants.BRICK, existingBrick.getQualifiedName()); } }); } } if (!idsToRemove.isEmpty()) { try { getBrickDao().removeAll(idsToRemove); } catch (Exception e) { log.error("Error while removing bricks from database!", e); } } }

Target:
private void removeDeletedBricks(GlusterVolumeEntity existingVolume, List<GlusterBrickEntity> fetchedBricks) { List<Guid> idsToRemove = new ArrayList<Guid>(); for (final GlusterBrickEntity existingBrick : existingVolume.getBricks()) { if (!GlusterCoreUtil.containsBrick(fetchedBricks, existingBrick)) { idsToRemove.add(existingBrick.getId()); log.info("Detected brick '{}' removed from volume '{}'. Removing it from engine DB as well.", existingBrick.getQualifiedName(), existingVolume.getName()); logUtil.logAuditMessage(existingVolume.getClusterId(), existingVolume, null, AuditLogType.GLUSTER_VOLUME_BRICK_REMOVED_FROM_CLI, new HashMap<String, String>() { { put(GlusterConstants.BRICK, existingBrick.getQualifiedName()); } }); } } if (!idsToRemove.isEmpty()) { try { getBrickDao().removeAll(idsToRemove); } catch (Exception e) { log.error("Error while removing bricks from database: {}", e.getMessage()); log.debug("Exception", e); } } }
Source:
private static void refreshBorderFigure(final BorderedStyle borderedStyle, final StyledFigure styledFigure) { LineBorder lineBorder = null; if (styledFigure.getBorder() instanceof LineBorder) { lineBorder = (LineBorder) styledFigure.getBorder(); } else { lineBorder = new LineBorder(); if (styledFigure instanceof Shape) { styledFigure.setBorder(null); } else { styledFigure.setBorder(lineBorder); } } int borderSize = 0; if (borderedStyle.getBorderSize() != null) { borderSize = borderedStyle.getBorderSize().intValue(); } lineBorder.setWidth(borderSize); final RGBValues borderColor = borderedStyle.getBorderColor(); if (borderColor != null) { lineBorder.setColor(VisualBindingManager.getDefault().getColorFromRGBValues(borderColor)); } if (borderedStyle.getBorderSize() == null || borderedStyle.getBorderSize().intValue() == 0) { if (!(styledFigure instanceof NoteFigure)) { styledFigure.setBorder(null); } } }

Target:
private static void refreshBorderFigure(final BorderedStyle borderedStyle, final StyledFigure styledFigure) { LineBorder lineBorder = null; if (styledFigure.getBorder() instanceof LineBorder) { lineBorder = (LineBorder) styledFigure.getBorder(); } else { lineBorder = new LineBorder(); if (styledFigure instanceof Shape) { styledFigure.setBorder(null); } else { styledFigure.setBorder(lineBorder); } } int borderSize = 0; if (borderedStyle.getBorderSize() != null) { borderSize = borderedStyle.getBorderSize().intValue(); } lineBorder.setWidth(borderSize); final RGBValues borderColor = borderedStyle.getBorderColor(); if (borderColor != null) { lineBorder.setColor(VisualBindingManager.getDefault().getColorFromRGBValues(borderColor)); } if (borderedStyle.getBorderSize() == null || borderSize == 0) { if (!(styledFigure instanceof NoteFigure)) { styledFigure.setBorder(null); } } }
Source:
private void performSolrCloudRestore(SolrClient client) { LOGGER.debug("Restoring collection from / {}.", coreName, backupLocation, backupName); printInfoMessage( String.format( "Restoring collection [%s] from [%s] / [%s].", coreName, backupLocation, backupName)); try { if (asyncRestore) { String requestId = restoreAsync(client, coreName, backupLocation, backupName); printInfoMessage("Restore request Id: " + requestId); } else { boolean isSuccess = restore(client, coreName, backupLocation, backupName); if (isSuccess) { printInfoMessage("Restore complete."); } } } catch (Exception e) { String message = e.getMessage() != null ? e.getMessage() : ""; printErrorMessage(String.format("Restore failed. %s", message)); LOGGER.debug("Restore failed for core: {}.", coreName, e); } }

Target:
private void performSolrCloudRestore(SolrClient client) { LOGGER.debug("Restoring collection from / {}.", coreName, backupLocation, backupName); printInfoMessage( String.format( "Restoring collection [%s] from [%s] / [%s].", coreName, backupLocation, backupName)); try { if (asyncRestore) { String requestId = restoreAsync(client, coreName, backupLocation, backupName); printInfoMessage("Restore request Id: " + requestId); } else { boolean isSuccess = restore(client, coreName, backupLocation, backupName); if (isSuccess) { printInfoMessage("Restore complete."); } } } catch (InterruptedException | InterruptedIOException ie) { printErrorMessage("Restore was interrupted"); LOGGER.debug("Solr cloud restore was interrupted", ie); Thread.currentThread().interrupt(); } catch (Exception e) { printErrorMessage("Restore failed."); LOGGER.debug("Restore failed for core: {}.", coreName, e); } }
Source:
public void onDisconnect() { if (player == null) { return; } player.remove(); Message userListMessage = UserListItemMessage.removeOne(player.getUniqueId()); for (GlowPlayer player : server.getOnlinePlayers()) { if (player.canSee(this.player)) { player.getSession().send(userListMessage); } else { player.stopHidingDisconnectedPlayer(this.player); } } GlowServer.logger.info(player.getName() + " [" + address + "] lost connection"); final String text = EventFactory.onPlayerQuit(player).getQuitMessage(); if (online) { if (text != null && !text.isEmpty()) { server.broadcastMessage(text); } } player = null; }

Target:
public void onDisconnect() { if (player == null) { return; } player.remove(); Message userListMessage = UserListItemMessage.removeOne(player.getUniqueId()); for (GlowPlayer player : server.getOnlinePlayers()) { if (player.canSee(this.player)) { player.getSession().send(userListMessage); } else { player.stopHidingDisconnectedPlayer(this.player); } } GlowServer.logger.info(player.getName() + " [" + address + "] lost connection"); final String text = EventFactory.onPlayerQuit(player).getQuitMessage(); if (online && text != null && !text.isEmpty()) { server.broadcastMessage(text); } player = null; }
Source:
public void check_login() { onView(withId(R.id.buttonOK)) .check(matches(not(isEnabled()))); onView(withId(R.id.hostUrlInput)) .perform(typeText(BuildConfig.TEST_SERVER_URL), closeSoftKeyboard()); onView(withId(R.id.account_username)).perform(click()); onView(withId(R.id.account_username)) .perform(typeText(BuildConfig.TEST_USER), closeSoftKeyboard()); onView(withId(R.id.account_password)) .perform(typeText(BuildConfig.TEST_PASSWORD), closeSoftKeyboard()); onView(withId(R.id.buttonOK)).perform(click()); try { Thread.sleep(WAIT_LOGIN); Field f = Activity.class.getDeclaredField("mResultCode"); f.setAccessible(true); mResultCode = f.getInt(mActivityRule.getActivity()); } catch (Exception e){ e.printStackTrace(); } assertTrue(errorMessage, mResultCode == Activity.RESULT_OK); }

Target:
public void check_login() throws InterruptedException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { onView(withId(R.id.buttonOK)) .check(matches(not(isEnabled()))); onView(withId(R.id.hostUrlInput)) .perform(typeText(BuildConfig.TEST_SERVER_URL), closeSoftKeyboard()); onView(withId(R.id.account_username)).perform(click()); onView(withId(R.id.account_username)) .perform(typeText(BuildConfig.TEST_USER), closeSoftKeyboard()); onView(withId(R.id.account_password)) .perform(typeText(BuildConfig.TEST_PASSWORD), closeSoftKeyboard()); onView(withId(R.id.buttonOK)).perform(click()); Thread.sleep(WAIT_LOGIN); Field f = Activity.class.getDeclaredField(RESULT_CODE); f.setAccessible(true); int mResultCode = f.getInt(mActivityRule.getActivity()); assertTrue(ERROR_MESSAGE, mResultCode == Activity.RESULT_OK); }
Source:
protected Control createPageControls(Composite parent) { getShell().setText(Messages.Reviews_AddCommentDialog_Title); setTitle(Messages.Reviews_AddCommentDialog_Title); setMessage(NLS.bind(Messages.Reviews_AddCommentDialog_Message, location.getIndex())); Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); commentEditor = createRichTextEditor(composite, ""); GridDataFactory.fillDefaults().grab(true, true).applyTo(commentEditor.getControl()); return composite; }

Target:
protected Control createPageControls(Composite parent) { getShell().setText(Messages.Reviews_AddCommentDialog_Title); setTitle(Messages.Reviews_AddCommentDialog_Title); setMessage(NLS.bind(Messages.Reviews_AddCommentDialog_Message, new Path(item.getName()).lastSegment(), location.getIndex())); Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); commentEditor = createRichTextEditor(composite, ""); GridDataFactory.fillDefaults().grab(true, true).applyTo(commentEditor.getControl()); return composite; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); try { FeatureFinishOperation operation = new FeatureFinishOperation(gfRepo); JobUtil.scheduleUserWorkspaceJob(operation, UIText.FeatureFinishHandler_finishingFeature, JobFamilies.GITFLOW_FAMILY); IJobManager jobMan = Job.getJobManager(); jobMan.join(JobFamilies.GITFLOW_FAMILY, null); MergeStatus mergeResult = operation.getMergeResult(); if (MergeStatus.CONFLICTING.equals(mergeResult)) { MessageDialog.openWarning(null, UIText.FeatureFinishHandler_Conflicts, UIText.FeatureFinishHandler_featureFinishConflicts); } } catch (WrongGitFlowStateException | CoreException | IOException | OperationCanceledException | InterruptedException e) { return error(e.getMessage(), e); } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event); try { FeatureFinishOperation operation = new FeatureFinishOperation(gfRepo); String featureBranch = gfRepo.getRepository().getBranch(); String develop = gfRepo.getConfig().getDevelop(); JobUtil.scheduleUserWorkspaceJob(operation, UIText.FeatureFinishHandler_finishingFeature, JobFamilies.GITFLOW_FAMILY); IJobManager jobMan = Job.getJobManager(); jobMan.join(JobFamilies.GITFLOW_FAMILY, null); MergeResult mergeResult = operation.getMergeResult(); MergeStatus mergeStatus = mergeResult.getMergeStatus(); if (MergeStatus.CONFLICTING.equals(mergeStatus)) { MultiStatus warning = createConflictWarning(develop, featureBranch, mergeResult); ErrorDialog.openError(null, UIText.FeatureFinishHandler_Conflicts, null, warning); } } catch (WrongGitFlowStateException | CoreException | IOException | OperationCanceledException | InterruptedException e) { return error(e.getMessage(), e); } return null; }
Source:
NumaValidator(VdsNumaNodeDao vdsNumaNodeDao) { Objects.requireNonNull(vdsNumaNodeDao); this.vdsNumaNodeDao = vdsNumaNodeDao; }

Target:
NumaValidator(VdsNumaNodeDao vdsNumaNodeDao) { this.vdsNumaNodeDao = Objects.requireNonNull(vdsNumaNodeDao); }
Source:
public void testAddRetrieveRules() { RuleEngine ruleEngine = createRuleEngine(); Rule rule0 = ruleEngine.initRuleId(new Rule()); ruleEngine.addRule(rule0, true); Collection<RuntimeRule> rules = ruleEngine.rules.values(); Assert.assertNotNull("null returned instead of rules list", rules); Assert.assertEquals("empty rules list is returned", 1, rules.size()); Assert.assertEquals("Returned rule with wrong UID", "rule_1", rules.iterator().next().getUID()); Rule rule1 = createRule(); ruleEngine.addRule(rule1, true); Assert.assertEquals("rules list should contain 2 rules", 2, rules.size()); RuntimeRule rule1Get = ruleEngine.getRuntimeRule("rule1"); Assert.assertEquals("Returned rule with wrong UID", "rule1", rule1Get.getUID()); Rule rule2 = createRule(); ruleEngine.addRule(rule2, true); Assert.assertEquals("rules list should contain 2 rules", 2, rules.size()); Assert.assertEquals("rules list should contain 2 rules", rule1Get, ruleEngine.getRuntimeRule("rule1")); }

Target:
public void testAddRetrieveRules() { RuleEngine ruleEngine = createRuleEngine(); Rule rule0 = new Rule(ruleEngine.getUniqueId()); ruleEngine.addRule(rule0, true); Collection<RuntimeRule> rules = ruleEngine.getRuntimeRules(); Assert.assertNotNull("null returned instead of rules list", rules); Assert.assertEquals("empty rules list is returned", 1, rules.size()); Assert.assertEquals("Returned rule with wrong UID", "rule_1", rules.iterator().next().getUID()); Rule rule1 = createRule(); ruleEngine.addRule(rule1, true); rules = ruleEngine.getRuntimeRules(); Assert.assertEquals("rules list should contain 2 rules", 2, rules.size()); RuntimeRule rule1Get = ruleEngine.getRuntimeRule("rule1"); Assert.assertEquals("Returned rule with wrong UID", "rule1", rule1Get.getUID()); Rule rule2 = createRule(); ruleEngine.addRule(rule2, true); rules = ruleEngine.getRuntimeRules(); Assert.assertEquals("rules list should contain 2 rules", 2, rules.size()); Assert.assertEquals("rules list should contain 2 rules", rule1Get, ruleEngine.getRuntimeRule("rule1")); }
Source:
boolean needsToBeStubbed() { return globalSets == 0 && localSets > 0 && localSetsWithNoCollapse <= 0; }

Target:
boolean needsToBeStubbed() { return globalSets == 0 && localSets > 0 && localSetsWithNoCollapse == 0 && !isCollapsingExplicitlyDenied(); }
Source:
public static void setRole(PerunSession sess, User user, PerunBean complementaryObject, String role) throws InternalErrorException, PrivilegeException, UserNotExistsException, AlreadyAdminException { Utils.notNull(role, "role"); ((PerunBl) sess.getPerun()).getUsersManagerBl().checkUserExists(sess, user); if(!isAuthorizedToManageRole(sess, complementaryObject, role)) { throw new PrivilegeException("You are not privileged to use this method setRole."); } AuthzResolverBlImpl.setRole(sess, user,complementaryObject, role); }

Target:
public static void setRole(PerunSession sess, User user, PerunBean complementaryObject, String role) throws InternalErrorException, PrivilegeException, UserNotExistsException, AlreadyAdminException { Utils.notNull(role, "role"); if (!roleExists(role)) { throw new InternalErrorException("Role: "+ role +" does not exists."); } ((PerunBl) sess.getPerun()).getUsersManagerBl().checkUserExists(sess, user); if(!isAuthorizedToManageRole(sess, complementaryObject, role)) { throw new PrivilegeException("You are not privileged to use this method setRole."); } AuthzResolverBlImpl.setRole(sess, user,complementaryObject, role); }
Source:
public static ArrayList<Guid> getGuidListFromString(String str) { if (StringHelper.isNullOrEmpty(str)) { return new ArrayList<Guid>(); } return getGuidListFromStringArray(Arrays.asList(str.split(SEPARATOR))); }

Target:
public static ArrayList<Guid> getGuidListFromString(String str) { if (StringUtils.isEmpty(str)) { return new ArrayList<Guid>(); } return getGuidListFromStringArray(Arrays.asList(str.split(SEPARATOR))); }
Source:
protected void executeQueryCommand() { final List<Volume> allVolumes = getVolumeProviderProxy().getVolumes(); final List<Disk> registeredDisks = getDbFacade().getDiskDao().getAllWithQuery(String.format("SELECT * FROM all_disks where disk_storage_type = '%d'", DiskStorageType.CINDER.getValue())); List<Volume> unregisteredVolumes = LinqUtils.filter(allVolumes, new Predicate<Volume>() { @Override public boolean eval(Volume volume) { for (Disk registeredDisk : registeredDisks) { if (volume.getId().equals(registeredDisk.getId().toString())) { return false; } } return true; } }); Guid storageDomainId = getParameters().getId(); List<CinderDisk> unregisteredDisks = CinderBroker.volumesToCinderDisks(unregisteredVolumes, storageDomainId); getQueryReturnValue().setReturnValue(unregisteredDisks); }

Target:
protected void executeQueryCommand() { final List<Volume> allVolumes = getVolumeProviderProxy().getVolumes(); final List<Disk> registeredDisks = getDbFacade().getDiskDao().getAllFromDisksByDiskStorageType(DiskStorageType.CINDER, getUserID(), getParameters().isFiltered()); List<Volume> unregisteredVolumes = LinqUtils.filter(allVolumes, new Predicate<Volume>() { @Override public boolean eval(Volume volume) { for (Disk registeredDisk : registeredDisks) { if (volume.getId().equals(registeredDisk.getId().toString())) { return false; } } return true; } }); Guid storageDomainId = getParameters().getId(); List<CinderDisk> unregisteredDisks = CinderBroker.volumesToCinderDisks(unregisteredVolumes, storageDomainId); getQueryReturnValue().setReturnValue(unregisteredDisks); }
Source:
public void testCreatePullRequest() { PullRequestView view = openLoginScreen() .login(NET_ID, PASSWORD) .toCoursesView() .listMyProjects() .get(0).click() .listBranches() .get(1).click() .openCreatePullRequestView(); }

Target:
public void testCreatePullRequest() throws InterruptedException { Branch newBranch = openLoginScreen() .login(NET_ID, PASSWORD) .toCoursesView() .listMyProjects() .get(0).click() .listBranches() .get(1); assertEquals(BRANCH_NAME, newBranch.getName()); PullRequestOverViewView pullRequestOverViewView = newBranch.click().openCreatePullRequestView(); waitForCondition(3, x -> pullRequestOverViewView.isOpen()); PullRequest pullRequest = getPullRequest(BRANCH_NAME); assertEquals(pullRequest.isOpen(), pullRequestOverViewView.isOpen()); String author = pullRequest.getDestination().getAuthor(); assertEquals(author, pullRequestOverViewView.getAuthorHeader()); assertEquals(COMMIT_MESSAGE, pullRequestOverViewView.getMessageHeader()); }
Source:
public static ObjectId findObject(AnyObjectId tree, String path, ObjectReader or) throws MissingObjectException, CorruptObjectException, IOException { TreeWalk tw = new TreeWalk(or); tw.addTree(tree); PathTokenizer tokenizer = tw.new PathTokenizer( path.getBytes(Constants.CHARSET)); if (!tokenizer.findNextToken()) { return null; } while (true) { if (!tw.next()) { return null; } if (tokenizer.compareCurrentToken()) { if (!tokenizer.findNextToken()) { return tw.getObjectId(0); } else { try { tw.enterSubtree(); } catch (IncorrectObjectTypeException e) { return null; } } } } }

Target:
public static ObjectId findObject(AnyObjectId tree, String path, ObjectReader or) throws MissingObjectException, CorruptObjectException, IOException { TreeWalk tw = new TreeWalk(or); tw.addTree(tree); PathTokenizer tokenizer = tw.new PathTokenizer( path.getBytes(Constants.CHARSET)); if (!tokenizer.findNextToken()) return null; for (;;) { if (!tw.next()) return null; if (tokenizer.compareCurrentToken()) { if (!tokenizer.findNextToken()) { return tw.getObjectId(0); } else { try { tw.enterSubtree(); } catch (IncorrectObjectTypeException e) { return null; } } } } }
Source:
public void playSound(Location location, Sound sound, float volume, float pitch) { if (location == null || sound == null) return; final double radiusSquared = Math.pow(volume > 1 ? volume * 16 : 16, 2); for (Player player : getRawPlayers()) { if (player.getLocation().distanceSquared(location) <= radiusSquared) { player.playSound(location, sound, volume, pitch); } } }

Target:
public void playSound(Location location, Sound sound, float volume, float pitch) { if (location == null || sound == null) return; final double radiusSquared = Math.pow(volume * 16, 2); for (Player player : getRawPlayers()) { if (player.getLocation().distanceSquared(location) <= radiusSquared) { player.playSound(location, sound, volume, pitch); } } }
Source:
public DatePickerFieldDefinition getDefaultField() { DatePickerFieldDefinition result = new DatePickerFieldDefinition(); result.setStandaloneClassName(Date.class.getName()); return result; }

Target:
public DatePickerFieldDefinition getDefaultField() { return new DatePickerFieldDefinition(); }
Source:
public final Object accessField(Field field, Object object) { try { if (field.isAccessible()) { return field.get(object); } else { Optional<Method> getter = TypeExtractionUtils.getGetter(field); if (!getter.isPresent()) { throw new IllegalStateException("This should not happen. The field should either be accessible or" + " we should have a getter. Field: " + field + " obj: " + object); } return getter.get().invoke(object); } } catch (NullPointerException npex) { throw new NullKeyFieldException("Unable to access field "+field+" on object "+object); } catch (IllegalAccessException iaex) { throw new RuntimeException("This should not happen since we call setAccessible(true) in PojoTypeInfo." + " fields: " + field + " obj: " + object); } catch (InvocationTargetException e) { throw new WrappingRuntimeException(e); } }

Target:
public final Object accessField(Field field, Object object) { try { object = field.get(object); } catch (NullPointerException npex) { throw new NullKeyFieldException("Unable to access field "+field+" on object "+object); } catch (IllegalAccessException iaex) { throw new RuntimeException("This should not happen since we call setAccesssible(true) in the ctor." + " fields: " + field + " obj: " + object); } return object; }
Source:
default Map<String,Object> executeCdpCommand(String command, @Nullable Map<String, Object> params) { Map<String, Object> data = new HashMap<>(); data.put("cmd",checkNotNull(command)); if(params != null){ data.put("params",params); }else{ params = new HashMap<>(); data.put("params",params); } Response response = execute(EXECUTE_CDP_COMMAND, data); Map<String, Object> value = (Map<String, Object>) response.getValue(); return value; }

Target:
default Map<String, Object> executeCdpCommand(String command, @Nullable Map<String, Object> params) { Map<String, Object> data = new HashMap<>(); data.put("cmd", checkNotNull(command)); data.put("params", params == null ? Collections.emptyMap() : params); Response response = execute(EXECUTE_GOOGLE_CDP_COMMAND, data); return ImmutableMap.copyOf((Map<String, Object>) response.getValue()); }
Source:
public void materialize() { this.queryableName = storeName; if (tableProcessorNode != null) { tableProcessorNode.setStoreNeeded(true); } }

Target:
public void materialize() { this.queryableName = storeName; }
Source:
public void testTrimTrippleByteChar() throws SQLException { char unicodeChar = 0xffff; String resultString = "ABC"; byte[] resultBytes = resultString.getBytes(); while(unicodeChar > 0x07ff) { String dataString = unicodeChar+resultString+unicodeChar; byte[] dataBytes = dataString.getBytes(); byte[] trimBytes = Character.toString(unicodeChar).getBytes(); testTrimb(dataBytes, trimBytes, PBinary.INSTANCE, resultBytes); testTrimb(dataBytes, trimBytes, PVarbinary.INSTANCE, resultBytes); unicodeChar--; } }

Target:
public void testTrimTrippleByteChar() throws SQLException { char unicodeChar = HIGHEST_UNICODE_3BYTE_CHAR; byte[] resultBytes = ABC.getBytes(); while(unicodeChar > HIGHEST_UNICODE_2BYTE_CHAR) { String dataString = unicodeChar+ABC+unicodeChar; byte[] dataBytes = dataString.getBytes(); byte[] trimBytes = Character.toString(unicodeChar).getBytes(); testTrimb(dataBytes, trimBytes, PBinary.INSTANCE, resultBytes); testTrimb(dataBytes, trimBytes, PVarbinary.INSTANCE, resultBytes); unicodeChar--; } }
Source:
public ListBoxModel doFillReleaseDefinitionNameItems(@QueryParameter String collectionUrl, @QueryParameter String credentialsId, @QueryParameter String projectName) { StandardListBoxModel listBoxModel = new StandardListBoxModel(); listBoxModel.withEmptySelection(); if (StringUtils.isBlank(collectionUrl) || StringUtils.isBlank(credentialsId) || StringUtils.isBlank(projectName)) { return listBoxModel; } String username = TeamCollectionConfiguration.findCredentialsById(credentialsId).getUsername(); Secret password = TeamCollectionConfiguration.findCredentialsById(credentialsId).getPassword(); ReleaseManagementHttpClient releaseManagementHttpClient = new ReleaseManagementHttpClient( collectionUrl.toLowerCase().replaceFirst(".visualstudio.com", ".vsrm.visualstudio.com"), username, password); try { List<ReleaseDefinition> releaseDefinitions = releaseManagementHttpClient.GetReleaseDefinitions(projectName); for (ReleaseDefinition releaseDefinition : releaseDefinitions) { listBoxModel.add(releaseDefinition.getName()); } } catch (ReleaseManagementException ignore) { } return listBoxModel; }

Target:
public ListBoxModel doFillReleaseDefinitionNameItems(@QueryParameter String collectionUrl, @QueryParameter String credentialsId, @QueryParameter String projectName) { StandardListBoxModel listBoxModel = new StandardListBoxModel(); listBoxModel.withEmptySelection(); if (StringUtils.isBlank(collectionUrl) || StringUtils.isBlank(credentialsId) || StringUtils.isBlank(projectName)) { return listBoxModel; } StandardUsernamePasswordCredentials credential = TeamCollectionConfiguration.findCredentialsById(credentialsId); if (credential == null) { return listBoxModel; } String username = credential.getUsername(); Secret password = credential.getPassword(); try { ReleaseManagementHttpClient releaseManagementHttpClient = new ReleaseManagementHttpClient( collectionUrl.toLowerCase().replaceFirst(".visualstudio.com", ".vsrm.visualstudio.com"), username, password); List<ReleaseDefinition> releaseDefinitions = releaseManagementHttpClient.GetReleaseDefinitions(projectName); for (ReleaseDefinition releaseDefinition : releaseDefinitions) { listBoxModel.add(releaseDefinition.getName()); } } catch (ReleaseManagementException ex) { logger.log(Level.WARNING, String.format("Get release definition for project: %s failed.", projectName), ex); } return listBoxModel; }
Source:
private boolean validatePrincipalLogin() { InstancedConfiguration conf = InstancedConfiguration.defaults(); String principal = conf.get(mPrincipalProperty); Matcher matchPrincipal = PRINCIPAL_PATTERN.matcher(principal); if (!matchPrincipal.matches()) { System.err.format("Principal %s is not in the right format.%n", principal); return false; } String primary = matchPrincipal.group("primary"); String instance = matchPrincipal.group("instance"); String realm = matchPrincipal.group("realm"); String keytab = conf.get(mKeytabProperty); CommandReturn cr; String[] command = new String[] {"kinit", "-kt", keytab, principal}; try { cr = ShellUtils.execCommandWithOutput(command); if (cr.getExitCode() != 0) { System.err.format("Kerberos login failed for %s with keytab %s with exit value %d.%n", principal, keytab, cr.getExitCode()); System.err.format("Primary is %s, instance is %s and realm is %s.%n", primary, instance, realm); return false; } } catch (IOException e) { System.err.format("Failed to execute %s with exception: %s%n", Arrays.toString(command), e); } return true; }

Target:
private boolean validatePrincipalLogin() { String principal = mConf.get(mPrincipalProperty); Matcher matchPrincipal = PRINCIPAL_PATTERN.matcher(principal); if (!matchPrincipal.matches()) { System.err.format("Principal %s is not in the right format.%n", principal); return false; } String primary = matchPrincipal.group("primary"); String instance = matchPrincipal.group("instance"); String realm = matchPrincipal.group("realm"); String keytab = mConf.get(mKeytabProperty); CommandReturn cr; String[] command = new String[] {"kinit", "-kt", keytab, principal}; try { cr = ShellUtils.execCommandWithOutput(command); if (cr.getExitCode() != 0) { System.err.format("Kerberos login failed for %s with keytab %s with exit value %d.%n", principal, keytab, cr.getExitCode()); System.err.format("Primary is %s, instance is %s and realm is %s.%n", primary, instance, realm); return false; } } catch (IOException e) { System.err.format("Failed to execute %s with exception: %s%n", Arrays.toString(command), e); } return true; }
Source:
public void start(Collection<? extends Location> locations) { if (!getChildren().isEmpty()) { throw new RuntimeException(String.format("The entity [%s] cannot have child entities", getClass().getName())); } ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING); final String url = getConfig(TARGET_URL); final Map assertions = getConfig(ASSERTIONS); final Duration timeout = getConfig(TIMEOUT); try { checkAssertions(url, ImmutableMap.of("timeout", timeout), assertions); sensors().set(SERVICE_UP, true); ServiceStateLogic.setExpectedState(this, Lifecycle.RUNNING); } catch (Throwable t) { LOG.debug("Url test failed", url); sensors().set(SERVICE_UP, false); ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE); throw Exceptions.propagate(t); } }

Target:
public void start(Collection<? extends Location> locations) { if (!getChildren().isEmpty()) { throw new RuntimeException(String.format("The entity [%s] cannot have child entities", getClass().getName())); } ServiceStateLogic.setExpectedState(this, Lifecycle.STARTING); final String url = getConfig(TARGET_URL); final List<Map<String, Object>> assertions = getConfig(ASSERTIONS); final Duration timeout = getConfig(TIMEOUT); final HttpAssertionTarget httpAssertionTarget = getConfig(ASSERTION_TARGET); try { TestFrameworkAssertions.checkAssertions(buildDataSupplier(httpAssertionTarget, url), ImmutableMap.of("timeout", timeout), assertions); sensors().set(SERVICE_UP, true); ServiceStateLogic.setExpectedState(this, Lifecycle.RUNNING); } catch (Throwable t) { LOG.info("{} Url test failed", this, url); sensors().set(SERVICE_UP, false); ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE); throw Exceptions.propagate(t); } }
Source:
public static boolean delete(File file, final boolean recursive) throws IOException { Assert.notNull(file, "File to delete must not be null."); boolean result = false; if (recursive) { try { java.nio.file.Files.walkFileTree(file.toPath(), new DeleteVisitor()); result = true; } catch(NoSuchFileException e) { result = true; } catch (IOException e) { throw new IOException("Failed to delete recursive '" + file + "'"); } } else { if ((file.listFiles() != null) && (file.listFiles().length != 0)) { throw new RuntimeException("directory not empty"); } if (OperatingSystemUtils.isWindows()) { System.gc(); } result = file.delete(); } return result; }

Target:
public static boolean delete(File file, final boolean recursive) throws IOException { Assert.notNull(file, "File to delete must not be null."); boolean result = false; if (recursive) { try { java.nio.file.Files.walkFileTree(file.toPath(), new DeleteVisitor()); result = true; } catch(NoSuchFileException e) { result = true; } catch (IOException e) { throw new IOException("Failed to delete recursive '" + file + "' Cause: " + e.getMessage()); } } else { if ((file.listFiles() != null) && (file.listFiles().length != 0)) { throw new RuntimeException("directory not empty"); } if (OperatingSystemUtils.isWindows()) { System.gc(); } result = file.delete(); } return result; }
Source:
public void setupRoutes() { path(controllerBasePath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", mimeType, this.apiAuthenticationHelper::checkUserAnd403); before(InternalPipelineStructure.WITH_SUGGESTIONS, mimeType, this.apiAuthenticationHelper::checkUserAnd403); get("", mimeType, this::index); get(InternalPipelineStructure.WITH_SUGGESTIONS, mimeType, this::indexWithSuggestions); }); }

Target:
public void setupRoutes() { path(controllerBasePath(), () -> { before("", mimeType, this::setContentType); before("/*", mimeType, this::setContentType); before("", mimeType, this::verifyContentType); before("/*", mimeType, this::verifyContentType); before("", mimeType, this.apiAuthenticationHelper::checkUserAnd403); before(InternalPipelineStructure.WITH_SUGGESTIONS, mimeType, this.apiAuthenticationHelper::checkUserAnd403); get("", mimeType, this::index); get(InternalPipelineStructure.WITH_SUGGESTIONS, mimeType, this::indexWithSuggestions); }); }
Source:
public Node[] createContent() { final Button backButton = createButton("BACK", 5, 24); String soundtrToggle = INIT_TOGGLE; if (State.isSoundtrackEnabled()) { soundtrToggle = "ON"; } final Button soundtrButton = createButton("Soundtrack: " + soundtrToggle, 5, 14); soundtrButton.setFont(Style.getFont(TOGGLE_TEXT_SIZE)); soundtrButton.setPrefWidth(TOGGLE_WIDTH); String soundEfToggle = INIT_TOGGLE; if (State.isSoundEffectsEnabled()) { soundEfToggle = "ON"; } final Button soundEfButton = createButton("Sound effects: " + soundEfToggle, 5, 17); soundEfButton.setFont(Style.getFont(TOGGLE_TEXT_SIZE)); soundEfButton.setPrefWidth(TOGGLE_WIDTH); setButtonFunction(backButton, BType.SETTINGS_BACK); setButtonFunction(soundtrButton, BType.SETTING_SOUNDTRACK); setButtonFunction(soundEfButton, BType.SETTING_SOUNDEFFECTS); soundtrButton.setTooltip(new Tooltip("Enable/disable soundtrack")); soundEfButton.setTooltip(new Tooltip("Enable/disable sound effects")); backButton.setTooltip(new Tooltip("Back to main menu")); return new Node[]{backButton, soundtrButton, soundEfButton}; }

Target:
public Node[] createContent() { final Button backButton = createButton("BACK", 5, 24); String soundtrToggle = INIT_TOGGLE; if (State.isSoundtrackEnabled()) { soundtrToggle = ACTIVE_TOGGLE; } final Button soundtrButton = createButton("Soundtrack: " + soundtrToggle, 5, 14); soundtrButton.setFont(Style.getFont(TOGGLE_TEXT_SIZE)); soundtrButton.setPrefWidth(TOGGLE_WIDTH); String soundEfToggle = INIT_TOGGLE; if (State.isSoundEffectsEnabled()) { soundEfToggle = ACTIVE_TOGGLE; } final Button soundEfButton = createButton("Sound effects: " + soundEfToggle, 5, 17); soundEfButton.setFont(Style.getFont(TOGGLE_TEXT_SIZE)); soundEfButton.setPrefWidth(TOGGLE_WIDTH); setButtonFunction(backButton, BType.SETTINGS_BACK); setButtonFunction(soundtrButton, BType.SETTING_SOUNDTRACK); setButtonFunction(soundEfButton, BType.SETTING_SOUNDEFFECTS); soundtrButton.setTooltip(new Tooltip("Enable/disable soundtrack")); soundEfButton.setTooltip(new Tooltip("Enable/disable sound effects")); backButton.setTooltip(new Tooltip("Back to main menu")); return new Node[]{backButton, soundtrButton, soundEfButton}; }
Source:
private void postRequest(Map<String, Object> request, Runnable completeHandler) { try { logger.debug("Write JSON: " + writeJson(request)); ListenableFuture<Response> future = client.preparePost(uri).setBody(writeJson(request)) .setHeader("content-type", "application/json").setHeader("accept", "application/json") .execute(new AsyncCompletionHandler<Response>() { @Override public Response onCompleted(Response response) throws Exception { logger.debug("Read JSON: " + response.getResponseBody()); Map<String, Object> json = readJson(response.getResponseBody()); if (json.containsKey("error")) { throw new RpcException(json.get("error").toString()); } processResponse(json); return response; } @Override public void onThrowable(Throwable t) { logger.error("Error handling POST response from XBMC", t); } }); if (completeHandler != null) { future.addListener(completeHandler, client.getConfig().executorService()); } } catch (Exception e) { logger.error("Failed sending POST request to XBMC", e); } }

Target:
private void postRequest(Map<String, Object> request, Runnable completeHandler) { try { String resultWrite = writeJson(request); logger.debug("Write JSON: {}", resultWrite ); ListenableFuture<Response> future = client.preparePost(uri).setBody(resultWrite) .setHeader("content-type", "application/json").setHeader("accept", "application/json") .execute(new AsyncCompletionHandler<Response>() { @Override public Response onCompleted(Response response) throws Exception { logger.debug("Read JSON: {}", response.getResponseBody()); Map<String, Object> json = readJson(response.getResponseBody()); if (json.containsKey("error")) { throw new RpcException(json.get("error").toString()); } processResponse(json); return response; } @Override public void onThrowable(Throwable t) { logger.error("Error handling POST response from XBMC", t); } }); if (completeHandler != null) { future.addListener(completeHandler, client.getConfig().executorService()); } } catch (Exception e) { logger.error("Failed sending POST request to XBMC", e); } }
Source:
private Boolean doAbandonChange(final String message, final Change change, final PatchSet.Id psid, final ChangeMessage cm, final ReviewDb db, final Transaction txn) throws OrmException { if (change.getStatus() == Change.Status.NEW && change.currentPatchSetId().equals(psid)) { change.setStatus(Change.Status.ABANDONED); db.changeMessages().insert(Collections.singleton(cm), txn); db.changes().update(Collections.singleton(change), txn); return Boolean.TRUE; } return Boolean.FALSE; }

Target:
private Boolean doAbandonChange(final String message, final Change change, final PatchSet.Id psid, final ChangeMessage cm, final ReviewDb db, final Transaction txn) throws OrmException { if (change.getStatus() == Change.Status.NEW && change.currentPatchSetId().equals(psid)) { change.setStatus(Change.Status.ABANDONED); ChangeUtil.updated(change); final ReviewDb schema = Common.getSchemaFactory().open(); final List<ChangeApproval> approvals = schema.changeApprovals().byChange(change.getId()).toList(); for (ChangeApproval a : approvals) { a.cache(change); } schema.changeApprovals().update(approvals, txn); db.changeMessages().insert(Collections.singleton(cm), txn); db.changes().update(Collections.singleton(change), txn); return Boolean.TRUE; } return Boolean.FALSE; }
Source:
private synchronized void handleFileRequest( final String streamId, final String relativePath, final int startOffset, final int endOffset ) { log.info( "Server is requesting file (range: [{}, {}, streamId: {})", relativePath, startOffset, endOffset, streamId ); if (!this.started.get()) { log.warn("Ignoring file request, service shutting down"); return; } final Path absolutePath = this.jobDirectoryPath.resolve(relativePath); if (!Files.exists(absolutePath)) { log.warn("Ignoring request for a file that does not exist: {}", absolutePath); return; } final boolean permitAcquired = this.concurrentTransfersSemaphore.tryAcquire(); System.out.println("<<< " + this.concurrentTransfersSemaphore.availablePermits()); if (!permitAcquired) { log.warn("Ignoring file request, too many transfers already in progress"); return; } final FileTransfer fileTransfer = new FileTransfer(this, streamId, absolutePath, startOffset, endOffset); this.activeFileTransfers.add(fileTransfer); fileTransfer.start(); }

Target:
private synchronized void handleFileRequest( final String streamId, final String relativePath, final int startOffset, final int endOffset ) { log.info( "Server is requesting file (range: [{}, {}), streamId: {})", relativePath, startOffset, endOffset, streamId ); if (!this.started.get()) { log.warn("Ignoring file request, service shutting down"); return; } final Path absolutePath = this.jobDirectoryPath.resolve(relativePath); if (!Files.exists(absolutePath)) { log.warn("Ignoring request for a file that does not exist: {}", absolutePath); return; } final boolean permitAcquired = this.concurrentTransfersSemaphore.tryAcquire(); if (!permitAcquired) { log.warn("Ignoring file request, too many transfers already in progress"); return; } final FileTransfer fileTransfer = new FileTransfer(this, streamId, absolutePath, startOffset, endOffset); this.activeFileTransfers.add(fileTransfer); fileTransfer.start(); }
Source:
private Collection<MultifactorAuthenticationProvider> getSatisfiedAuthenticationProviders(final Authentication authentication, final Collection<MultifactorAuthenticationProvider> providers) { final Collection<Object> contexts = CollectionUtils.toCollection(authentication.getAttributes().get(this.authenticationContextAttribute)); if (contexts == null || contexts.isEmpty()) { LOGGER.debug("No authentication context could be determined based on authentication attribute [{}]", this.authenticationContextAttribute); return null; } return providers.stream() .filter(p -> contexts.contains(p.getId())) .collect(Collectors.toCollection(HashSet::new)); }

Target:
private Collection<MultifactorAuthenticationProvider> getSatisfiedAuthenticationProviders(final Authentication authentication, final Collection<MultifactorAuthenticationProvider> providers) { final Collection<Object> contexts = CollectionUtils.toCollection(authentication.getAttributes().get(this.authenticationContextAttribute)); if (contexts == null || contexts.isEmpty()) { LOGGER.debug("No authentication context could be determined based on authentication attribute [{}]", this.authenticationContextAttribute); return null; } return providers.stream() .filter(p -> contexts.contains(p.getId())) .collect(Collectors.toCollection(LinkedHashSet::new)); }
Source:
void downloadParcels(Set<ClouderaManagerProduct> products, ParcelResourceApi parcelResourceApi, Stack stack, ApiClient apiClient) throws ApiException, CloudbreakException { for (ClouderaManagerProduct product : products) { LOGGER.info("Downloading parcel.", product.getName()); ApiCommand apiCommand = parcelResourceApi.startDownloadCommand(stack.getName(), product.getName(), product.getVersion()); PollingResult pollingResult = clouderaManagerPollingServiceProvider.startPollingCdpRuntimeParcelDownload( stack, apiClient, apiCommand.getId(), new ParcelResource(stack.getName(), product.getName(), product.getVersion())); if (isExited(pollingResult)) { throw new CancellationException("Cluster was terminated while waiting for CDP Runtime Parcel to be downloaded"); } else if (isTimeout(pollingResult)) { throw new CloudbreakException("Timeout during the updated CDP Runtime Parcel download."); } } }

Target:
void downloadParcels(Set<ClouderaManagerProduct> products, ParcelResourceApi parcelResourceApi, Stack stack, ApiClient apiClient) throws ApiException, CloudbreakException { for (ClouderaManagerProduct product : products) { LOGGER.info("Downloading parcel.", product.getName()); ApiCommand apiCommand = parcelResourceApi.startDownloadCommand(stack.getName(), product.getName(), product.getVersion()); PollingResult pollingResult = clouderaManagerPollingServiceProvider.startPollingCdpRuntimeParcelDownload( stack, apiClient, apiCommand.getId(), new ParcelResource(stack.getName(), product.getName(), product.getVersion())); handlePollingResult(pollingResult, "Cluster was terminated while waiting for CDP Runtime Parcel to be downloaded", "Timeout during the updated CDP Runtime Parcel download."); } }
Source:
public void onScrolledToBottom() { if(currentPage < totalPages) { Toast.makeText(getActivity(), "get more data", Toast.LENGTH_SHORT).show(); ReportBackListTask task = new ReportBackListTask(position, StringUtils.join(sampleIdsSubset, ","), currentPage + 1); TaskQueue.loadQueueDefault(getActivity()).execute(task); } }

Target:
public void onScrolledToBottom() { if(currentPage < totalPages) { if(BuildConfig.DEBUG) { Toast.makeText(getActivity(), "get more data", Toast.LENGTH_SHORT).show(); } ReportBackListTask task = new ReportBackListTask(position, StringUtils.join(sampleIdsSubset, ","), currentPage + 1); TaskQueue.loadQueueDefault(getActivity()).execute(task); } }
Source:
public Iterable<Fork> iterate(final String sort) { return new MkIterable<Fork>( this.storage, String.format("%s/fork", this.xpath()), new MkIterable.Mapping<Fork>() { @Override public Fork map(final XML xml) { return MkForks.this.get("Test"); } } ); }

Target:
public Iterable<Fork> iterate(final String sort) { return new MkIterable<Fork>( this.storage, String.format("%s/fork", this.xpath()), new MkIterable.Mapping<Fork>() { @Override public Fork map(final XML xml) { return MkForks.this.get( Integer.parseInt(xml.xpath("id/text()").get(0)) ); } } ); }
Source:
private void verifyResultsInReplica(List<String> selectStmtList, List<String[]> expectedValues) throws Throwable { for (int idx = 0; idx > selectStmtList.size(); idx++) { replica.run("use " + replicatedDbName) .run(selectStmtList.get(idx)) .verifyResults(expectedValues.get(idx)); } }

Target:
private void verifyResultsInReplica(List<String> selectStmtList, List<String[]> expectedValues) throws Throwable { for (int idx = 0; idx < selectStmtList.size(); idx++) { replica.run("use " + replicatedDbName) .run(selectStmtList.get(idx)) .verifyResults(expectedValues.get(idx)); } }
Source:
public List<PaymentWorksVendorUpdatesDTO> getPendingCompanyVendorUpdatesFromPaymentWorks() { PaymentWorksVendorUpdatesRootDTO updateVendorsRoot = null; List<PaymentWorksVendorUpdatesDTO> vendorUpdates = new ArrayList<PaymentWorksVendorUpdatesDTO>(); boolean moreRecords = true; Client client = buildClient(); ClientResponse response = client.handle(buildClientRequest(buildPendingCompanyVendorUpdatesFromPaymentWorksURL())); while (moreRecords) { updateVendorsRoot = response.getEntity(PaymentWorksVendorUpdatesRootDTO.class); LOG.debug("getPendingCompanyVendorUpdatesFromPaymentWorks, Status: " + response.getStatus()); if (response.getStatus() == 200) { if (ObjectUtils.isNotNull(updateVendorsRoot)) { LOG.info("getPendingCompanyVendorUpdatesFromPaymentWorks Vendor Updates retrieved: " + updateVendorsRoot.getCount()); } if (updateVendorsRoot.getCount() > 0) { vendorUpdates.addAll(updateVendorsRoot.getVendorUpdates().getNewVendorList()); } if (StringUtils.isNotEmpty(updateVendorsRoot.getNext())) { response = client.handle(buildClientRequest(updateVendorsRoot.getNext())); } else { moreRecords = false; } } else { LOG.error("getPendingCompanyVendorUpdatesFromPaymentWorks, Failed to retrieve Pending Vendor Updates: " + response.getEntity(String.class)); moreRecords = false; } } return vendorUpdates; }

Target:
public List<PaymentWorksVendorUpdatesDTO> getPendingCompanyVendorUpdatesFromPaymentWorks() { PaymentWorksVendorUpdatesRootDTO updateVendorsRoot = null; List<PaymentWorksVendorUpdatesDTO> vendorUpdates = new ArrayList<PaymentWorksVendorUpdatesDTO>(); processVendorUpdates(vendorUpdates, buildPendingCompanyVendorUpdatesFromPaymentWorksURL()); return vendorUpdates; }
Source:
public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; logger.debug("CORSFilter HTTP Request: ", request.getMethod()); ((HttpServletResponse) servletResponse).addHeader("Access-Control-Allow-Origin", "*"); ((HttpServletResponse) servletResponse) .addHeader("Access-Control-Allow-Methods", "GET, OPTIONS, HEAD, PUT, POST"); HttpServletResponse resp = (HttpServletResponse) servletResponse; if (request.getMethod().equals("OPTIONS")) { resp.setStatus(HttpServletResponse.SC_ACCEPTED); return; } filterChain.doFilter(request, servletResponse); }

Target:
public void doFilter( ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; logger.debug("CORSFilter HTTP Request: {}", request.getMethod()); ((HttpServletResponse) servletResponse).addHeader("Access-Control-Allow-Origin", "*"); ((HttpServletResponse) servletResponse) .addHeader("Access-Control-Allow-Methods", "GET, OPTIONS, HEAD, PUT, POST"); HttpServletResponse resp = (HttpServletResponse) servletResponse; if (request.getMethod().equals("OPTIONS")) { resp.setStatus(HttpServletResponse.SC_ACCEPTED); return; } filterChain.doFilter(request, servletResponse); }
Source:
public DocumentFile(Resource path) throws JDOMException, IOException { if (!Resources.exists(path)) { throw new IllegalArgumentException("Unable to locate the file path: \'" + path + "\'"); } this.path = path; InputStream in = path.in(); try { this.body = IOUtils.toString(in); } finally { in.close(); } }

Target:
public DocumentFile(Resource path) throws JDOMException, IOException { if (!Resources.exists(path)) { throw new IllegalArgumentException("Unable to locate the file path: \'" + path + "\'"); } this.path = path; try (InputStream in = path.in()) { this.body = IOUtils.toString(in); } }
Source:
private Matcher getHostnameComponents() { String canonicalHostName = currentHostnameSupplier.get(); log.info("Using hostname.", SafeArg.of("hostname", canonicalHostName)); Matcher matcher = POD_HOSTNAME_TEMPLATE_REGEX.matcher(canonicalHostName); Preconditions.checkState(matcher.matches(), "Not running in a k8s stateful set."); log.info("Hostname matcher results.", SafeArg.of("matcher", matcher)); return matcher; }

Target:
private Matcher getHostnameComponents() { String canonicalHostName = currentHostnameSupplier.get(); log.info("Using hostname.", SafeArg.of("hostname", canonicalHostName)); Matcher matcher = POD_HOSTNAME_TEMPLATE_REGEX.matcher(canonicalHostName); Preconditions.checkState(matcher.matches(), "Not running in a k8s stateful set."); return matcher; }