auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<Interval> getFilterTimeIntervals(FilterQueryTree filterQueryTree) { switch (filterQueryTree.getOperator()) { case AND: List<List<Interval>> andIntervals = new ArrayList<>(); for (FilterQueryTree child : filterQueryTree.getChildren()) { List<Interval> childIntervals = getFilterTimeIntervals(child); if (childIntervals != null) { andIntervals.add(childIntervals); } } return getIntersectionSortedIntervals(andIntervals); case OR: List<List<Interval>> orIntervals = new ArrayList<>(); for (FilterQueryTree child : filterQueryTree.getChildren()) { List<Interval> childIntervals = getFilterTimeIntervals(child); if (childIntervals == null) { return null; } else { orIntervals.add(childIntervals); } } return getUnionSortedIntervals(orIntervals); case EQUALITY: if (filterQueryTree.getColumn().equals(_timeColumn)) { long timeStamp = _timeFormatSpec.fromFormatToMillis(filterQueryTree.getValue().get(0)); return Collections.singletonList(new Interval(timeStamp, timeStamp)); } return null; case RANGE: if (filterQueryTree.getColumn().equals(_timeColumn)) { return parseInterval(filterQueryTree.getValue()); } return null; default: return null; } }

Target:
private List<Interval> getFilterTimeIntervals(FilterQueryTree filterQueryTree) { switch (filterQueryTree.getOperator()) { case AND: List<List<Interval>> andIntervals = new ArrayList<>(); for (FilterQueryTree child : filterQueryTree.getChildren()) { List<Interval> childIntervals = getFilterTimeIntervals(child); if (childIntervals != null) { if (childIntervals.isEmpty()) { return Collections.emptyList(); } andIntervals.add(childIntervals); } } if (andIntervals.isEmpty()) { return null; } return getIntersectionSortedIntervals(andIntervals); case OR: List<List<Interval>> orIntervals = new ArrayList<>(); for (FilterQueryTree child : filterQueryTree.getChildren()) { List<Interval> childIntervals = getFilterTimeIntervals(child); if (childIntervals == null) { return null; } else { orIntervals.add(childIntervals); } } return getUnionSortedIntervals(orIntervals); case EQUALITY: if (filterQueryTree.getColumn().equals(_timeColumn)) { long timeStamp = _timeFormatSpec.fromFormatToMillis(filterQueryTree.getValue().get(0)); return Collections.singletonList(new Interval(timeStamp, timeStamp)); } return null; case RANGE: if (filterQueryTree.getColumn().equals(_timeColumn)) { return parseInterval(filterQueryTree.getValue()); } return null; default: return null; } }
Source:
public PhoneHome(Node node, String baseurl) { hazelcastNode = node; logger = hazelcastNode.getLogger(com.hazelcast.internal.util.phonehome.PhoneHome.class); basePhoneHomeUrl = baseurl; }

Target:
PhoneHome(Node node, String baseurl) { hazelcastNode = node; logger = hazelcastNode.getLogger(com.hazelcast.internal.util.phonehome.PhoneHome.class); basePhoneHomeUrl = baseurl; }
Source:
public @ResponseBody SurveillanceResults getAllPendingSurveillanceForAcbUser() throws AccessDeniedException { if(Util.isUserRoleAdmin()){ throw new AccessDeniedException("Pending surveillances may only be viewed by the ACB Administrators that manage them."); } List<CertificationBodyDTO> acbs = acbManager.getAllForUser(false); List<Surveillance> pendingSurvs = new ArrayList<Surveillance>(); if (acbs != null) { for (CertificationBodyDTO acb : acbs) { try { List<Surveillance> survsOnAcb = survManager.getPendingByAcb(acb.getId()); pendingSurvs.addAll(survsOnAcb); } catch (final AccessDeniedException denied) { LOGGER.warn("Access denied to pending surveillance for acb " + acb.getName() + " and user " + Util.getUsername()); } } } SurveillanceResults results = new SurveillanceResults(); results.setPendingSurveillance(pendingSurvs); return results; }

Target:
public @ResponseBody SurveillanceResults getAllPendingSurveillanceForAcbUser() throws AccessDeniedException { if(!Util.isUserRoleAcbAdmin()){ throw new AccessDeniedException(String .format(messageSource.getMessage( new DefaultMessageSourceResolvable("access.pendingSurveillances"), LocaleContextHolder.getLocale()))); } List<CertificationBodyDTO> acbs = acbManager.getAllForUser(false); List<Surveillance> pendingSurvs = new ArrayList<Surveillance>(); if (acbs != null) { for (CertificationBodyDTO acb : acbs) { try { List<Surveillance> survsOnAcb = survManager.getPendingByAcb(acb.getId()); pendingSurvs.addAll(survsOnAcb); } catch (final AccessDeniedException denied) { LOGGER.warn("Access denied to pending surveillance for acb " + acb.getName() + " and user " + Util.getUsername()); } } } SurveillanceResults results = new SurveillanceResults(); results.setPendingSurveillance(pendingSurvs); return results; }
Source:
Map<String, String> fetchAccountMetadata() { long startTimeMs = System.currentTimeMillis(); logger.trace("Start reading ZNRecord from path={}", znRecordPath); ZNRecord znRecord = helixStore.get(znRecordPath, null, AccessOption.PERSISTENT); logger.trace("Fetched ZNRecord from path={}, took time={} ms", znRecordPath, startTimeMs); if (znRecord == null) { logger.debug("The ZNRecord to read does not exist on path={}", znRecordPath); return null; } return fetchAccountMetadataFromZNRecord(znRecord); }

Target:
Map<String, String> fetchAccountMetadata() { long startTimeMs = System.currentTimeMillis(); logger.trace("Start reading ZNRecord from path={}", znRecordPath); ZNRecord znRecord = helixStore.get(znRecordPath, null, AccessOption.PERSISTENT); logger.trace("Fetched ZNRecord from path={}, took time={} ms", znRecordPath, startTimeMs); if (znRecord == null) { logger.info("The ZNRecord to read does not exist on path={}", znRecordPath); return null; } return fetchAccountMetadataFromZNRecord(znRecord); }
Source:
public ActionForward chooseCycleForViewRegistrationCurriculum(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { final RegistrationCurriculumBean registrationCurriculumBean = getRegistrationCurriculumBeanFromViewState(); request.setAttribute("registrationCurriculumBean", registrationCurriculumBean); request.setAttribute("registration", registrationCurriculumBean.getRegistration()); final Person studentPerson = registrationCurriculumBean.getStudent().getPerson(); request.setAttribute("studentPerson", studentPerson); final EctsGraduationGradeConversionTable ectsGraduationGradeConversionTable = EctsTableIndex.getGraduationGradeConversionTable(registrationCurriculumBean.getRegistration().getDegree(), registrationCurriculumBean.getRegistration().getCycleType(ExecutionYear.readCurrentExecutionYear()), ExecutionYear.readCurrentExecutionYear().getAcademicInterval(), new DateTime()); request.setAttribute("ectsGradeConversionTable", ectsGraduationGradeConversionTable.getEctsTable().toString().split("")); request.setAttribute("ectsGradePercentagesTable", ectsGraduationGradeConversionTable.getPercentages().toString().split(":")); return mapping.findForward("view-registration-curriculum"); }

Target:
public ActionForward chooseCycleForViewRegistrationCurriculum(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { final RegistrationCurriculumBean registrationCurriculumBean = getRegistrationCurriculumBeanFromViewState(); request.setAttribute("registrationCurriculumBean", registrationCurriculumBean); request.setAttribute("registration", registrationCurriculumBean.getRegistration()); final Person studentPerson = registrationCurriculumBean.getStudent().getPerson(); request.setAttribute("studentPerson", studentPerson); setEctsGradeAttributes(request, registrationCurriculumBean); return mapping.findForward("view-registration-curriculum"); }
Source:
private DataDependentEDDPAlgorithm(SolutionSpace space, TransformationChecker checker, boolean deterministic, int steps, double epsilonSearch) { super(space, checker); this.checker.getHistory().setStorageStrategy(StorageStrategy.ALL); this.propertyChecked = space.getPropertyChecked(); this.solutionSpace.setAnonymityPropertyPredictable(false); this.steps = steps; double epsilonPerStep; IntervalArithmeticDouble arithmetic = new IntervalArithmeticDouble(); try { epsilonPerStep = arithmetic.div(arithmetic.createInterval(epsilonSearch), arithmetic.createInterval(steps)).lower; exponentialMechanism = new ExponentialMechanismReliable<Long>(epsilonPerStep, deterministic); } catch (IntervalArithmeticException e) { throw new RuntimeException(e); } }

Target:
private DataDependentEDDPAlgorithm(SolutionSpace space, TransformationChecker checker, boolean deterministic, int steps, double epsilonSearch) { super(space, checker); this.checker.getHistory().setStorageStrategy(StorageStrategy.ALL); this.propertyChecked = space.getPropertyChecked(); this.solutionSpace.setAnonymityPropertyPredictable(false); this.steps = steps; double epsilonPerStep; IntervalArithmeticDouble arithmetic = new IntervalArithmeticDouble(); try { epsilonPerStep = arithmetic.div(arithmetic.createInterval(epsilonSearch), arithmetic.createInterval(steps)).lower; exponentialMechanism = new ExponentialMechanism<Long>(epsilonPerStep, deterministic); } catch (IntervalArithmeticException e) { throw new RuntimeException(e); } }
Source:
public void updateViewerInput() { if (session != null && treeViewer != null && treeViewer.getTree() != null && !treeViewer.getTree().isDisposed()) { Object[] children = siriusCommonContentModelProvider.getChildren(session); List<Object> childrenList = new ArrayList<>(); Resource sessionResource = session.getSessionResource(); IFile file = WorkspaceSynchronizer.getFile(sessionResource); ProjectDependenciesItem projectDependenciesItem = new NoDynamicProjectDependencies(file.getProject(), session); childrenList.add(projectDependenciesItem); childrenList.addAll(Arrays.stream(children).collect(Collectors.toList())); List<Object> directChildOfProjectDependency = Arrays.asList(siriusCommonContentModelProvider.getChildren(projectDependenciesItem)); treeViewer.setInput(childrenList.stream().filter(input -> !(input instanceof ViewpointsFolderItemImpl) && !directChildOfProjectDependency.contains(input)).collect(Collectors.toList())); treeViewer.expandToLevel(2); treeViewer.expandToLevel(projectDependenciesItem, 2); } }

Target:
public void updateViewerInput() { if (session != null && treeViewer != null && treeViewer.getTree() != null && !treeViewer.getTree().isDisposed()) { Object[] children = siriusCommonContentModelProvider.getChildren(session); List<Object> childrenList = new ArrayList<>(); Resource sessionResource = session.getSessionResource(); IFile file = WorkspaceSynchronizer.getFile(sessionResource); ProjectDependenciesItem projectDependenciesItem = new NoDynamicProjectDependencies(file.getProject(), session); childrenList.add(projectDependenciesItem); childrenList.addAll(Arrays.asList(children)); List<Object> directChildOfProjectDependency = Arrays.asList(siriusCommonContentModelProvider.getChildren(projectDependenciesItem)); treeViewer.setInput(childrenList.stream().filter(input -> !(input instanceof ViewpointsFolderItemImpl) && !directChildOfProjectDependency.contains(input)).collect(Collectors.toList())); treeViewer.expandToLevel(2); treeViewer.expandToLevel(projectDependenciesItem, 2); } }
Source:
void togglePlayer(final CommandSource sender, final User user, Boolean enabled) { if (enabled == null) { enabled = !user.isVanished(); } final VanishStatusChangeEvent vanishEvent = new VanishStatusChangeEvent(sender.isPlayer() ? ess.getUser(sender.getPlayer()) : null, user, enabled); ess.getServer().getPluginManager().callEvent(vanishEvent); if (vanishEvent.isCancelled()) { return; } user.setVanished(enabled); user.sendMessage(tl("vanish", user.getDisplayName(), enabled ? tl("enabled") : tl("disabled"))); if (enabled) { user.sendMessage(tl("vanished")); } if (ess.getSettings().isFakeMessageOnVanish()) { final Player player = user.getBase(); String msg; if (enabled) { if (ess.getSettings().isCustomQuitMessage()) { msg = ess.getSettings().getCustomQuitMessage(); } else { msg = "&e{USERNAME} left the game."; } } else { if (ess.getSettings().isCustomJoinMessage()) { msg = ess.getSettings().getCustomJoinMessage(); } else { msg = "&e{USERNAME} joined the game."; } } msg = msg.replace("{PLAYER}", player.getDisplayName()) .replace("{USERNAME}", player.getName()) .replace("{ONLINE}", NumberFormat.getInstance().format(ess.getOnlinePlayers().size())) .replace("{UPTIME}", DateUtil.formatDateDiff(ManagementFactory.getRuntimeMXBean().getStartTime())); ess.getServer().broadcastMessage(msg); } if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase())) { sender.sendMessage(tl("vanish", user.getDisplayName(), enabled ? tl("enabled") : tl("disabled"))); } }

Target:
void togglePlayer(final CommandSource sender, final User user, Boolean enabled) { if (enabled == null) { enabled = !user.isVanished(); } final VanishStatusChangeEvent vanishEvent = new VanishStatusChangeEvent(sender.isPlayer() ? ess.getUser(sender.getPlayer()) : null, user, enabled); ess.getServer().getPluginManager().callEvent(vanishEvent); if (vanishEvent.isCancelled()) { return; } user.setVanished(enabled); user.sendMessage(tl("vanish", user.getDisplayName(), enabled ? tl("enabled") : tl("disabled"))); if (enabled) { user.sendMessage(tl("vanished")); } if (ess.getSettings().isFakeMessageOnVanish()) { final Player player = user.getBase(); String msg; if (enabled) { if (ess.getSettings().isCustomQuitMessage()) { msg = ess.getSettings().getCustomQuitMessage(); } else { msg = "&e{USERNAME} left the game"; } } else { if (ess.getSettings().isCustomJoinMessage()) { msg = ess.getSettings().getCustomJoinMessage(); } else { msg = "&e{USERNAME} joined the game"; } } msg = msg.replace("{PLAYER}", player.getDisplayName()) .replace("{USERNAME}", player.getName()) .replace("{ONLINE}", NumberFormat.getInstance().format(ess.getOnlinePlayers().size())) .replace("{UPTIME}", DateUtil.formatDateDiff(ManagementFactory.getRuntimeMXBean().getStartTime())); ess.getServer().broadcastMessage(msg); } if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase())) { sender.sendMessage(tl("vanish", user.getDisplayName(), enabled ? tl("enabled") : tl("disabled"))); } }
Source:
public void testXpathSuppressions() throws Exception { final String fn = getPath("suppressions_xpath_correct.xml"); final Set<TreeWalkerFilter> filterSet = SuppressionsLoader.loadXpathSuppressions(fn); assertEquals("Invalid number of filters", 1, filterSet.size()); }

Target:
public void testXpathSuppressions() throws Exception { final String fn = getPath("InputSuppressionsLoaderXpathCorrect.xml"); final Set<TreeWalkerFilter> filterSet = SuppressionsLoader.loadXpathSuppressions(fn); assertEquals("Invalid number of filters", 1, filterSet.size()); }
Source:
private String getProxyHostEnvironment() { if (getProtocol() == Protocol.HTTPS) { if (getHttpsProxyUrlFromEnvironment() != null) { return getHttpsProxyUrlFromEnvironment().getHost(); } } else { if (getHttpProxyUrlFromEnvironment() != null) { return getHttpProxyUrlFromEnvironment().getHost(); } } return null; }

Target:
private String getProxyHostEnvironment() { try { return getProtocol() == Protocol.HTTPS ? new URL(getEnvironmentVariableCaseInsensitive("HTTPS_PROXY")).getHost() : new URL(getEnvironmentVariableCaseInsensitive("HTTP_PROXY")).getHost(); } catch (MalformedURLException e) { return null; } }
Source:
public Pipeline createReplicationPipeline(HddsProtos.ReplicationType type, HddsProtos.ReplicationFactor factor, HddsProtos.NodePool nodePool) throws IOException { AUDIT.logReadSuccess( buildAuditMessageForSuccess(SCMAction.CREATE_PIPELINE, null)); return scm.getPipelineManager().createPipeline(type, factor); }

Target:
public Pipeline createReplicationPipeline(HddsProtos.ReplicationType type, HddsProtos.ReplicationFactor factor, HddsProtos.NodePool nodePool) throws IOException { Pipeline result = scm.getPipelineManager().createPipeline(type, factor); AUDIT.logWriteSuccess( buildAuditMessageForSuccess(SCMAction.CREATE_PIPELINE, null)); return result; }
Source:
public RemoteFile readFileWithMode(String uri, String ref, String path) throws GitAPIException, IOException { Repository repo = uriRepoMap.get(uri); ObjectId refCommitId = sha1(uri, ref); RevCommit commit = repo.parseCommit(refCommitId); TreeWalk tw = TreeWalk.forPath(repo, path, commit.getTree()); tw.setRecursive(true); return new RemoteFile( readContent(repo, ref, path), tw.getFileMode(0)); }

Target:
public RemoteFile readFileWithMode(String uri, String ref, String path) throws GitAPIException, IOException { Repository repo = uriRepoMap.get(uri); ObjectId refCommitId = sha1(uri, ref); RevCommit commit = repo.parseCommit(refCommitId); TreeWalk tw = TreeWalk.forPath(repo, path, commit.getTree()); return new RemoteFile( tw.getObjectReader().open(tw.getObjectId(0)) .getCachedBytes(), tw.getFileMode(0)); }
Source:
public void testdecompressCompressPointer() { byte[] compressionPointer = { 5, 'n', 'e', 't', 't', 'y', 2, 'i', 'o', 0, (byte) 0xC0, 0 }; ByteBuf buffer = Unpooled.wrappedBuffer(compressionPointer); ByteBuf uncomporessed = null; try { uncomporessed = DnsCodecUtil.decompressDomainName(buffer.duplicate().setIndex(10, 12)); assertEquals(0, ByteBufUtil.compare(buffer.duplicate().setIndex(0, 10), uncomporessed)); } finally { buffer.release(); if (uncomporessed != null) { uncomporessed.release(); } } }

Target:
public void testdecompressCompressPointer() { byte[] compressionPointer = { 5, 'n', 'e', 't', 't', 'y', 2, 'i', 'o', 0, (byte) 0xC0, 0 }; ByteBuf buffer = Unpooled.wrappedBuffer(compressionPointer); ByteBuf uncompressed = null; try { uncompressed = DnsCodecUtil.decompressDomainName(buffer.duplicate().setIndex(10, 12)); assertEquals(0, ByteBufUtil.compare(buffer.duplicate().setIndex(0, 10), uncompressed)); } finally { buffer.release(); if (uncompressed != null) { uncompressed.release(); } } }
Source:
public ValueMatcher makeValueMatcher(String dimension, final Comparable value) { if (dimension.equals(Column.TIME_COLUMN_NAME)) { final LongColumnSelector longSelector = cursor.makeLongColumnSelector(dimension); try { if (value == null) { return new BooleanValueMatcher(false); } final long longValue = Long.parseLong(value.toString()); return new ValueMatcher() { @Override public boolean matches() { long ts = longSelector.get(); return ts == longValue; } }; } catch (NumberFormatException nfe) { throw new ParseException("Cannot parse value [%s] as long: ", value); } } final DimensionSelector selector = cursor.makeDimensionSelector( new DefaultDimensionSpec(dimension, dimension) ); final boolean matchNull = isComparableNullOrEmpty(value); final int id = selector.lookupId((String) value); if (id < 0) { return new BooleanValueMatcher(false); } else { return new ValueMatcher() { @Override public boolean matches() { IndexedInts row = selector.getRow(); if (row.size() == 0) { return matchNull; } for (int i = 0; i < row.size(); i++) { if (row.get(i) == id) { return true; } } return false; } }; } }

Target:
public ValueMatcher makeValueMatcher(String dimension, final Comparable value) { if (getTypeForDimension(dimension) == ValueType.LONG) { return Filters.getLongValueMatcher( cursor.makeLongColumnSelector(dimension), value ); } final DimensionSelector selector = cursor.makeDimensionSelector( new DefaultDimensionSpec(dimension, dimension) ); final boolean matchNull = isComparableNullOrEmpty(value); final int id = selector.lookupId((String) value); if (id < 0) { return new BooleanValueMatcher(false); } else { return new ValueMatcher() { @Override public boolean matches() { IndexedInts row = selector.getRow(); if (row.size() == 0) { return matchNull; } for (int i = 0; i < row.size(); i++) { if (row.get(i) == id) { return true; } } return false; } }; } }
Source:
public AuthConfigs getCredentials() { try { String encodedCredentials; String credentials; encodedCredentials = preferenceDao.getPreferences(EnvironmentContext.getCurrent() .getSubject() .getUserId(), DOCKER_REGISTRY_CREDENTIALS_KEY) .get(DOCKER_REGISTRY_CREDENTIALS_KEY); credentials = new String(Base64.getDecoder().decode(encodedCredentials), "UTF-8"); return DtoFactory.newDto(AuthConfigs.class).withConfigs( DtoFactory.getInstance().createMapDtoFromJson(credentials, AuthConfig.class)); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return null; } }

Target:
public AuthConfigs getCredentials() { try { String encodedCredentials = preferenceDao.getPreferences(EnvironmentContext.getCurrent() .getSubject() .getUserId(), DOCKER_REGISTRY_CREDENTIALS_KEY) .get(DOCKER_REGISTRY_CREDENTIALS_KEY); String credentials = encodedCredentials != null ? new String(Base64.getDecoder().decode(encodedCredentials), "UTF-8") : "{}"; return DtoFactory.newDto(AuthConfigs.class).withConfigs( DtoFactory.getInstance().createMapDtoFromJson(credentials, AuthConfig.class)); } catch (Exception e) { LOG.warn(e.getLocalizedMessage()); return null; } }
Source:
public String findStatementsWithConcepts(List<String> conceptUris) throws AsyncExecutionException { Map<String, String> parameters = null; parameters = new HashMap<String, String>(); if(conceptUris.size() == 0) return null; StringBuffer termsBelongingToSameRelation = new StringBuffer(""); StringBuffer termInterpretations = new StringBuffer(""); int numberOfSearchedConcepts = conceptUris.size(); for(int i = 0; i < numberOfSearchedConcepts; i++){ termsBelongingToSameRelation.append("(r:Relation)-[*]->(t"+i+":Term)"); termInterpretations.append("t"+i+".interpretation = '"+conceptUris.get(i)+"'"); if(i != (numberOfSearchedConcepts-1)){ termsBelongingToSameRelation.append(","); termInterpretations.append(" and "); } } parameters.put("terms_belonging_to_same_relation", termsBelongingToSameRelation.toString()); parameters.put("term_interpretations", termInterpretations.toString()); return executeNeo4jQuery("concepts.belonging.to.same.statement", parameters, RELATION_EVENT); }

Target:
public String findStatementsWithConcepts(List<String> conceptUris) throws AsyncExecutionException { if(conceptUris.size() == 0){ return null; } Map<String, String> parameters = new HashMap<String, String>(); StringBuffer termsBelongingToSameRelation = new StringBuffer(); StringBuffer termInterpretations = new StringBuffer(); int numberOfSearchedConcepts = conceptUris.size(); for(int i = 0; i < numberOfSearchedConcepts; i++){ termsBelongingToSameRelation.append("(r:Relation)-[*]->(t"+i+":Term)"); termInterpretations.append("t"+i+".interpretation = '"+conceptUris.get(i)+"'"); if(i != (numberOfSearchedConcepts-1)){ termsBelongingToSameRelation.append(","); termInterpretations.append(" and "); } } parameters.put("terms_belonging_to_same_relation", termsBelongingToSameRelation.toString()); parameters.put("term_interpretations", termInterpretations.toString()); return executeNeo4jQuery("concepts.belonging.to.same.statement", parameters, RELATION_EVENT); }
Source:
public void equalsSignInRedirectUrl() { testAppUrl = authServerContextRootPage.toString().replace("localhost", NIP_IO_URL) + JAVASCRIPT_URL + "/index.html?test=bla=bla&super=man"; jsDriver.navigate().to(testAppUrl); JSObjectBuilder arguments = defaultArguments(); testExecutor.init(arguments, this::assertInitNotAuth) .login(this::assertOnLoginPage) .loginForm(testUser, this::assertOnTestAppUrl) .init(arguments, (driver1, output1, events2) -> { assertTrue(testAppUrl.contains("bla=bla")); assertSuccessfullyLoggedIn(driver1, output1, events2); }); }

Target:
public void equalsSignInRedirectUrl() { testAppUrl = authServerContextRootPage.toString().replace("localhost", NIP_IO_URL) + JAVASCRIPT_URL + "/index.html?test=bla=bla&super=man"; jsDriver.navigate().to(testAppUrl); JSObjectBuilder arguments = defaultArguments(); testExecutor.init(arguments, this::assertInitNotAuth) .login(this::assertOnLoginPage) .loginForm(testUser, this::assertOnTestAppUrl) .init(arguments, (driver1, output1, events2) -> { assertTrue(driver1.getCurrentUrl().contains("bla=bla")); assertSuccessfullyLoggedIn(driver1, output1, events2); }); }
Source:
public void oncePerClassSetUp() throws Exception { synchronized ( AbstractNexusIntegrationTest.class ) { if ( NEEDS_INIT ) { TestContainer.getInstance().startPlexusContainer(); String logMessage = "Running Test: " + getTestId() + " - Class: " + this.getClass().getSimpleName(); staticLog.info( String.format( "%1$-" + logMessage.length() + "s", " " ).replaceAll( " ", "*" ) ); staticLog.info( logMessage ); staticLog.info( String.format( "%1$-" + logMessage.length() + "s", " " ).replaceAll( " ", "*" ) ); beforeStartClean(); copyTestResources(); this.copyConfigFiles(); startNexus(); final boolean testRequiresSecurityEnabled = TestContainer.getInstance().getTestContext().isSecureTest() || Boolean.valueOf( System.getProperty( "secure.test" ) ); TestContainer.getInstance().invokeAsAdministrator( new Callable<Object>() { @Override public Object call() throws Exception { final GlobalConfigurationResource globalConfig = SettingsMessageUtil.getCurrentSettings(); globalConfig.setSecurityEnabled( testRequiresSecurityEnabled ); SettingsMessageUtil.save( globalConfig ); return null; } } ); deployArtifacts(); runOnce(); NEEDS_INIT = false; } getEventInspectorsUtil().waitForCalmPeriod(); } }

Target:
public void oncePerClassSetUp() throws Exception { synchronized ( AbstractNexusIntegrationTest.class ) { if ( NEEDS_INIT ) { String logMessage = "Running Test: " + getTestId() + " - Class: " + this.getClass().getSimpleName(); staticLog.info( String.format( "%1$-" + logMessage.length() + "s", " " ).replaceAll( " ", "*" ) ); staticLog.info( logMessage ); staticLog.info( String.format( "%1$-" + logMessage.length() + "s", " " ).replaceAll( " ", "*" ) ); beforeStartClean(); copyTestResources(); this.copyConfigFiles(); startNexus(); final boolean testRequiresSecurityEnabled = TestContainer.getInstance().getTestContext().isSecureTest() || Boolean.valueOf( System.getProperty( "secure.test" ) ); TestContainer.getInstance().invokeAsAdministrator( new Callable<Object>() { @Override public Object call() throws Exception { final GlobalConfigurationResource globalConfig = SettingsMessageUtil.getCurrentSettings(); globalConfig.setSecurityEnabled( testRequiresSecurityEnabled ); SettingsMessageUtil.save( globalConfig ); return null; } } ); deployArtifacts(); runOnce(); NEEDS_INIT = false; } getEventInspectorsUtil().waitForCalmPeriod(); } }
Source:
public ChangeDetailX getChangeDetail(int reviewId, IProgressMonitor monitor) throws GerritException { ChangeDetailX changeDetail = super.getChangeDetail(reviewId, monitor); setParentCommit28OrLater(reviewId, changeDetail, monitor); return changeDetail; }

Target:
public ChangeDetailX getChangeDetail(int reviewId, IProgressMonitor monitor) throws GerritException { ChangeDetailX changeDetail = super.getChangeDetail(reviewId, monitor); ChangeInfo28 changeInfo = getAdditionalChangeInfo(reviewId, monitor); if (changeInfo != null) { setRevisionParentCommit(changeInfo, changeDetail); } return changeDetail; }
Source:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (divBy != 0 && children.get(0).evaluate(tuple, ptr)) { Timestamp ts = (Timestamp)PDataType.TIMESTAMP.toObject(ptr, children.get(0).getColumnModifier()); Timestamp roundedTs; if(divBy == 1 && ts.getNanos() > 0) { roundedTs = new Timestamp(roundTime(ts.getTime() + 1)); } else { roundedTs = new Timestamp(roundTime(ts.getTime())); } byte[] byteValue = getDataType().toBytes(roundedTs); ptr.set(byteValue); return true; } return false; }

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { if (children.get(0).evaluate(tuple, ptr)) { ColumnModifier columnModifier = children.get(0).getColumnModifier(); PDataType dataType = getDataType(); int nanos = dataType.getNanos(ptr, columnModifier); if (nanos > 0) { long millis = dataType.getMillis(ptr, columnModifier); Timestamp roundedTs = new Timestamp(millis + 1); byte[] byteValue = dataType.toBytes(roundedTs); ptr.set(byteValue); } return true; } return false; }
Source:
public void onDismissByOutsideTouch(@NotNull String instanceTag) { switch (instanceTag) { case TAG_ADD_SITE_ICON_DIALOG: showQuickStartNoticeIfNecessary(); break; default: AppLog.e(T.EDITOR, "Dialog instanceTag is not recognized"); throw new UnsupportedOperationException("Dialog instanceTag is not recognized"); } }

Target:
public void onDismissByOutsideTouch(@NotNull String instanceTag) { switch (instanceTag) { case TAG_ADD_SITE_ICON_DIALOG: showQuickStartNoticeIfNecessary(); break; case TAG_CHANGE_SITE_ICON_DIALOG: case TAG_EDIT_SITE_ICON_PERMISSIONS_DIALOG: case TAG_QUICK_START_DIALOG: case TAG_QUICK_START_MIGRATION_DIALOG: case TAG_REMOVE_NEXT_STEPS_DIALOG: break; default: AppLog.e(T.EDITOR, "Dialog instanceTag '" + instanceTag + "' is not recognized"); throw new UnsupportedOperationException("Dialog instanceTag is not recognized"); } }
Source:
private String cnameResolveFromCacheLoop(DnsCnameCache cnameCache, String first, String mapping) { String otherMapping = first; boolean advance = false; String name = mapping; while ((mapping = cnameCache.get(hostnameWithDot(name))) != null) { if (otherMapping.equals(mapping)) { break; } name = mapping; if (advance) { otherMapping = mapping; advance = false; } else { advance = true; } } return name; }

Target:
static String cnameResolveFromCacheLoop(DnsCnameCache cnameCache, String first, String mapping) { boolean advance = false; String name = mapping; while ((mapping = cnameCache.get(hostnameWithDot(name))) != null) { if (first.equals(mapping)) { break; } name = mapping; if (advance) { first = cnameCache.get(first); } advance = !advance; } return name; }
Source:
private boolean autoConnectA2dp(BluetoothDevice device) { final A2dpService a2dpService = mFactory.getA2dpService(); if (a2dpService == null) { warnLog("autoConnectA2dp: service is null, failed to connect to " + device); return false; } int a2dpConnectionPolicy = a2dpService.getConnectionPolicy(device); if (a2dpConnectionPolicy == BluetoothProfile.CONNECTION_POLICY_ALLOWED) { debugLog("autoConnectA2dp: connecting A2DP with " + device); return a2dpService.connect(device); } else { debugLog("autoConnectA2dp: skipped auto-connect A2DP with device " + device + " connectionPolicy " + a2dpConnectionPolicy); return false; } }

Target:
private void autoConnectA2dp(BluetoothDevice device) { final A2dpService a2dpService = mFactory.getA2dpService(); if (a2dpService == null) { warnLog("autoConnectA2dp: service is null, failed to connect to " + device); return; } int a2dpConnectionPolicy = a2dpService.getConnectionPolicy(device); if (a2dpConnectionPolicy == BluetoothProfile.CONNECTION_POLICY_ALLOWED) { debugLog("autoConnectA2dp: connecting A2DP with " + device); a2dpService.connect(device); } else { debugLog("autoConnectA2dp: skipped auto-connect A2DP with device " + device + " connectionPolicy " + a2dpConnectionPolicy); } }
Source:
private static TmfTreeViewerEntry createTraceEntry(ITmfTrace trace) { TmfTreeViewerEntry traceEntry = new TmfTreeViewerEntry(trace.getName()); Iterable<ITmfAnalysisModuleWithStateSystems> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class); for (ITmfAnalysisModuleWithStateSystems module : modules) { module.schedule(); if (!module.waitForInitialization()) { return traceEntry; } for (ITmfStateSystem ss : module.getStateSystems()) { traceEntry.addChild(new StateSystemEntry(ss)); } } return traceEntry; }

Target:
private static TmfTreeViewerEntry createTraceEntry(ITmfTrace trace) { TmfTreeViewerEntry traceEntry = new TmfTreeViewerEntry(trace.getName()); Iterable<ITmfAnalysisModuleWithStateSystems> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, ITmfAnalysisModuleWithStateSystems.class); for (ITmfAnalysisModuleWithStateSystems module : modules) { module.schedule(); if (!module.waitForInitialization()) { continue; } for (ITmfStateSystem ss : module.getStateSystems()) { traceEntry.addChild(new StateSystemEntry(ss)); } } return traceEntry; }
Source:
protected V putInternal(long ttl, TimeUnit ttlUnit, Long maxIdle, TimeUnit maxIdleUnit, Object key, Object value) { Data keyData = toData(key); Data valueData = toData(value); long ttlMillis = getTimeInMillis(ttl, ttlUnit); ClientMessage request; if (maxIdle != null) { request = MapPutCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis, getTimeInMillis(maxIdle, maxIdleUnit)); } else { request = MapPutCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis); } ClientMessage response = invoke(request, keyData); MapPutCodec.ResponseParameters resultParameters = MapPutCodec.decodeResponse(response); return toObject(resultParameters.response); }

Target:
protected V putInternal(long ttl, TimeUnit ttlUnit, Long maxIdle, TimeUnit maxIdleUnit, Object key, Object value) { Data keyData = toData(key); Data valueData = toData(value); long ttlMillis = timeInMsOrOneIfResultIsZero(ttl, ttlUnit); ClientMessage request; if (maxIdle != null) { request = MapPutCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis, timeInMsOrOneIfResultIsZero(maxIdle, maxIdleUnit)); } else { request = MapPutCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis); } ClientMessage response = invoke(request, keyData); MapPutCodec.ResponseParameters resultParameters = MapPutCodec.decodeResponse(response); return toObject(resultParameters.response); }
Source:
private static GoogleApiClient createClient(Context context, boolean withSignIn) { GoogleApiClient.Builder builder = new GoogleApiClient.Builder(context) .addApi(AppIndex.API); if (withSignIn) { builder.addApi(Plus.API).addScope(Plus.SCOPE_PLUS_PROFILE) .addApi(Drive.API).addScope(Drive.SCOPE_APPFOLDER); } return builder.build(); }

Target:
private static GoogleApiClient createClient(Context context, boolean withSignIn) { GoogleApiClient.Builder builder = new GoogleApiClient.Builder(context) .addApi(AppIndex.API); if (withSignIn) { builder.addApi(Plus.API).addScope(Plus.SCOPE_PLUS_PROFILE); } return builder.build(); }
Source:
public FluentWait<WebDriver> get( int timeoutInSec, Class<? extends Throwable> ignoredExceptionType) { return new FluentWait<WebDriver>(seleniumWebDriver) .withTimeout(timeoutInSec, TimeUnit.SECONDS) .pollingEvery(200, TimeUnit.MILLISECONDS) .ignoring(ignoredExceptionType); }

Target:
public FluentWait<WebDriver> get( int timeoutInSec, Class<? extends Throwable> ignoredExceptionType) { return new WebDriverWait(seleniumWebDriver, timeoutInSec).ignoring(ignoredExceptionType); }
Source:
protected String initNodeName() { String nodeName = globalConfig.transport().nodeName(); if (nodeName == null || nodeName.isEmpty()) { nodeName = java.util.UUID.randomUUID().toString(); } return nodeName.replaceAll("[^\\w]+", "_"); }

Target:
protected String initNodeName() { String nodeName = globalConfig.transport().nodeName(); if (nodeName == null || nodeName.isEmpty()) { nodeName = java.util.UUID.randomUUID().toString(); } return NameUtils.filterIllegalChars(nodeName); }
Source:
public static <E> ReadableSource<E> asSource(URI uri, Class<E> type) { View<E> view = Datasets.<E, View<E>>view(uri); return new DatasetSourceTarget<E>(view, type); }

Target:
public static <E> ReadableSource<E> asSource(URI uri, Class<E> type) { return new DatasetSourceTarget<E>(uri, type); }
Source:
public ObjectStat(String bucketName, String name, ResponseHeader header) { this.bucketName = bucketName; this.name = name; this.contentType = header.contentType(); this.createdTime = (Date) header.lastModified().clone(); this.length = header.contentLength(); if (header.etag() != null) { this.etag = header.etag().replaceAll("\"", ""); } else { this.etag = ""; } this.key = header.xamzMetaKey(); this.iv = header.xamzMetaIv(); this.matDesc = header.xamzMetaMatdesc(); }

Target:
public ObjectStat(String bucketName, String name, ResponseHeader header) { this.bucketName = bucketName; this.name = name; this.contentType = header.contentType(); this.createdTime = (Date) header.lastModified().clone(); this.length = header.contentLength(); if (header.etag() != null) { this.etag = header.etag().replaceAll("\"", ""); } else { this.etag = ""; } this.contentKey = header.xamzMetaKey(); this.encryptionIV = header.xamzMetaIv(); this.matDesc = header.xamzMetaMatdesc(); }
Source:
public static AutoCloseable startMetricsReporters(Map<String, Object> topoConf) { final List<PreparableReporter> preparableReporters = MetricsUtils.getPreparableReporters(topoConf); for (PreparableReporter reporter : preparableReporters) { reporter.prepare(StormMetricsRegistry.REGISTRY, topoConf); reporter.start(); LOG.info("Started statistics report plugin..."); } return () -> preparableReporters.forEach(PreparableReporter::stop); }

Target:
public static Session startMetricsReporters(Map<String, Object> topoConf) { final List<PreparableReporter> preparableReporters = MetricsUtils.getPreparableReporters(topoConf); for (PreparableReporter reporter : preparableReporters) { reporter.prepare(StormMetricsRegistry.REGISTRY, topoConf); reporter.start(); LOG.info("Started statistics report plugin..."); } return () -> preparableReporters.forEach(PreparableReporter::stop); }
Source:
private StringBuffer checkHeaders(ContentSecurityPolicyEnforcer cspListener) { StringBuffer headerErrors = new StringBuffer(); wicketTester.getRequestCycle().getListeners().add(cspListener); wicketTester.executeUrl("/"); String cspHeaderValue = wicketTester.getLastResponse().getHeader(HEADER_CSP); String cspReportingHeaderValue = wicketTester.getLastResponse().getHeader(HEADER_CSP_REPORT); if (cspHeaderValue == null) { headerErrors.append( String.format("Header %s expected but either not present or empty", HEADER_CSP)); } if (cspReportingHeaderValue == null) { headerErrors.append(String.format("Header %s expected but either not present or empty", HEADER_CSP_REPORT)); } if (headerErrors.length() > 0) { return headerErrors; } StringBuffer headerValueErrors = new StringBuffer(); List<String> blockingHeaderValueErrors = checkCSPHeaderValues(cspHeaderValue); List<String> reportingHeaderValueErrors = checkCSPHeaderValues(cspReportingHeaderValue); if (!blockingHeaderValueErrors.isEmpty()) { headerValueErrors.append("Blocking-mode CSP header value issues: "); headerValueErrors .append(blockingHeaderValueErrors.stream().collect(Collectors.joining("; "))); headerValueErrors.append(". "); } if (!reportingHeaderValueErrors.isEmpty()) { headerValueErrors.append("Reporting-mode CSP header value issues: "); headerValueErrors .append(reportingHeaderValueErrors.stream().collect(Collectors.joining("; "))); headerValueErrors.append(". "); } return headerValueErrors; }

Target:
private List<String> checkHeaders(ContentSecurityPolicyEnforcer cspListener) { List<String> headerErrors = new ArrayList<>(); wicketTester.getRequestCycle().getListeners().add(cspListener); wicketTester.executeUrl("/"); String cspHeaderValue = wicketTester.getLastResponse().getHeader(CSPHeaderMode.BLOCKING.getHeader()); String cspReportingHeaderValue = wicketTester.getLastResponse().getHeader(CSPHeaderMode.REPORT_ONLY.getHeader()); if (cspHeaderValue == null) { headerErrors.add(String.format("Header %s expected but either not present or empty", CSPHeaderMode.BLOCKING.getHeader())); } if (cspReportingHeaderValue == null) { headerErrors.add(String.format("Header %s expected but either not present or empty", CSPHeaderMode.REPORT_ONLY.getHeader())); } if (!headerErrors.isEmpty()) { return headerErrors; } List<String> headerValueErrors = new ArrayList<>(); List<String> blockingHeaderValueErrors = checkCSPHeaderValues(cspHeaderValue); List<String> reportingHeaderValueErrors = checkCSPHeaderValues(cspReportingHeaderValue); if (!blockingHeaderValueErrors.isEmpty()) { headerValueErrors.add("Blocking-mode CSP header value issues: " + blockingHeaderValueErrors.stream().collect(Collectors.joining("; ")) + "."); } if (!reportingHeaderValueErrors.isEmpty()) { headerValueErrors.add("Reporting-mode CSP header value issues: " + reportingHeaderValueErrors.stream().collect(Collectors.joining("; ")) + "."); } return headerValueErrors; }
Source:
public void testDownstreamTopicRenaming() { MirrorCheckpointTask mirrorCheckpointTask = new MirrorCheckpointTask("source1", "target2", new DefaultReplicationPolicy(), null, new HashMap<>(), new HashMap<>()); assertEquals(new TopicPartition("source1.topic3", 4), mirrorCheckpointTask.renameTopicPartition(new TopicPartition("topic3", 4))); assertEquals(new TopicPartition("topic3", 5), mirrorCheckpointTask.renameTopicPartition(new TopicPartition("target2.topic3", 5))); assertEquals(new TopicPartition("source1.source6.topic7", 8), mirrorCheckpointTask.renameTopicPartition(new TopicPartition("source6.topic7", 8))); }

Target:
public void testDownstreamTopicRenaming() { MirrorCheckpointTask mirrorCheckpointTask = new MirrorCheckpointTask("source1", "target2", new DefaultReplicationPolicy(), null, Collections.emptyMap(), Collections.emptyMap()); assertEquals(new TopicPartition("source1.topic3", 4), mirrorCheckpointTask.renameTopicPartition(new TopicPartition("topic3", 4))); assertEquals(new TopicPartition("topic3", 5), mirrorCheckpointTask.renameTopicPartition(new TopicPartition("target2.topic3", 5))); assertEquals(new TopicPartition("source1.source6.topic7", 8), mirrorCheckpointTask.renameTopicPartition(new TopicPartition("source6.topic7", 8))); }
Source:
public synchronized boolean sendWebRequest() { try { checkIfUrlIsValid(); } catch (RuntimeException e) { return false; } Request request = new Request.Builder() .url(url) .header("User-Agent", USER_AGENT) .build(); call = okHttpClient.newCall(request); call.enqueue(getCallback()); return true; }

Target:
public synchronized void sendWebRequest() { try { new URL(url); } catch (MalformedURLException e) { WebRequestListener listener = weakListenerReference.get(); if (listener != null) { listener.onRequestFinished(ERROR_BAD_REQUEST.toString()); } return; } Request request = new Request.Builder() .url(url) .header("User-Agent", USER_AGENT) .build(); call = okHttpClient.newCall(request); call.enqueue(createCallback()); }
Source:
private SplitBrainJoinMessage sendSplitBrainJoinMessage(Address target, SplitBrainJoinMessage request) { if (logger.isFineEnabled()) { logger.fine("Sending SplitBrainJoinMessage to " + target); } Connection conn = node.server.getConnectionManager(MEMBER).getOrConnect(target, true); long timeout = SPLIT_BRAIN_CONN_TIMEOUT_MILLIS; while (conn == null) { timeout -= SPLIT_BRAIN_SLEEP_TIME_MILLIS; if (timeout < 0) { logger.fine("Returning null timeout<0, " + timeout); return null; } try { Thread.sleep(SPLIT_BRAIN_SLEEP_TIME_MILLIS); } catch (InterruptedException e) { currentThread().interrupt(); return null; } conn = node.server.getConnectionManager(MEMBER).get(target); } NodeEngine nodeEngine = node.nodeEngine; Future future = nodeEngine.getOperationService().createInvocationBuilder(ClusterServiceImpl.SERVICE_NAME, new SplitBrainMergeValidationOp(request), target) .setTryCount(1).invoke(); try { return (SplitBrainJoinMessage) future.get(SPLIT_BRAIN_JOIN_CHECK_TIMEOUT_SECONDS, TimeUnit.SECONDS); } catch (TimeoutException e) { logger.fine("Timeout during join check!", e); } catch (Exception e) { logger.warning("Error during join check!", e); } return null; }

Target:
private SplitBrainJoinMessage sendSplitBrainJoinMessage(Address target, SplitBrainJoinMessage request) { if (logger.isFineEnabled()) { logger.fine("Sending SplitBrainJoinMessage to " + target); } Connection conn = node.getServer().getConnectionManager(MEMBER).getOrConnect(target, true); long timeout = SPLIT_BRAIN_CONN_TIMEOUT_MILLIS; while (conn == null) { timeout -= SPLIT_BRAIN_SLEEP_TIME_MILLIS; if (timeout < 0) { logger.fine("Returning null timeout<0, " + timeout); return null; } try { Thread.sleep(SPLIT_BRAIN_SLEEP_TIME_MILLIS); } catch (InterruptedException e) { currentThread().interrupt(); return null; } conn = node.getServer().getConnectionManager(MEMBER).get(target); } NodeEngine nodeEngine = node.nodeEngine; Future future = nodeEngine.getOperationService().createInvocationBuilder(ClusterServiceImpl.SERVICE_NAME, new SplitBrainMergeValidationOp(request), target) .setTryCount(1).invoke(); try { return (SplitBrainJoinMessage) future.get(SPLIT_BRAIN_JOIN_CHECK_TIMEOUT_SECONDS, TimeUnit.SECONDS); } catch (TimeoutException e) { logger.fine("Timeout during join check!", e); } catch (Exception e) { logger.warning("Error during join check!", e); } return null; }
Source:
public void deleteOrganization(String id) { ValidateArgument.required(id, "id"); int count = jdbcTemplate.update( "DELETE FROM " + TABLE_ORGANIZATION + " WHERE " + COL_ORGANIZATION_ID + " = ?", id); if (count < 1) { throw new NotFoundException("Orgnaization with id: '" + id + "' not found"); } }

Target:
public void deleteOrganization(String id) { ValidateArgument.required(id, "id"); int count = jdbcTemplate.update( "DELETE FROM " + TABLE_ORGANIZATION + " WHERE " + COL_ORGANIZATION_ID + " = ?", id); if (count < 1) { throw new NotFoundException("Organization with id: '" + id + "' not found"); } }
Source:
public <T> void read(Response response, Callback<T> callback, TypeReference<T> type) throws IOException { final int sc = response.getStatus(); switch(sc) { case 201: case 204: LOG.debug("Return code is %d, finishing.", response.getStatus()); return; case 200: try (final JsonParser jp = mapper.getFactory().createParser(response.readEntity(InputStream.class))) { expect(jp, jp.nextToken(), JsonToken.START_OBJECT); expect(jp, jp.nextToken(), JsonToken.FIELD_NAME); if (!"results".equals(jp.getCurrentName())) { throw new JsonParseException("expecting results field", jp.getCurrentLocation()); } expect(jp, jp.nextToken(), JsonToken.START_ARRAY); jp.clearCurrentToken(); Iterator<T> iter = jp.readValuesAs(type); while (iter.hasNext()) { try { callback.call(iter.next()); } catch (CallbackRefusedException e) { LOG.debug(e, "callback refused execution, finishing."); return; } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("Callback interrupted", e); } catch (Exception e) { Throwables.propagateIfPossible(e, IOException.class); throw new IOException("Callback failure", e); } } if (jp.nextValue() != JsonToken.VALUE_TRUE || !jp.getCurrentName().equals("success")) { throw new IOException("Streamed receive did not terminate normally; inspect server logs for cause."); } return; } default: if (sc >= 400 && sc < 500) { throw new ClientErrorException(response); } throw new ServerErrorException(response); } }

Target:
public <T> void read(Response response, Callback<T> callback, TypeReference<T> type) throws IOException { final int sc = response.getStatus(); switch(sc) { case 201: case 204: LOG.debug("Return code is %d, finishing.", response.getStatus()); return; case 200: try (final JsonParser jp = mapper.getFactory().createParser(response.readEntity(InputStream.class))) { doRead(callback, type, jp); } return; default: if (sc >= 400 && sc < 500) { throw new ClientErrorException(response); } throw new ServerErrorException(response); } }
Source:
public void analyzeClass(final byte[] buffer, final String location) throws IOException { try { analyzeClass(new ClassReader(buffer)); } catch (final Exception cause) { throw analyzerError(location, cause); } }

Target:
public void analyzeClass(final byte[] buffer, final String location) throws IOException { try { analyzeClass(new ClassReader(buffer)); } catch (final RuntimeException cause) { throw analyzerError(location, cause); } }
Source:
private void initTree(TmfTreeViewerEntry rootBranch, CounterAnalysis analysis) { Runnable initialize = new Runnable() { @Override public void run() { analysis.schedule(); analysis.waitForCompletion(); ITmfStateSystem stateSystem = analysis.getStateSystem(); if (stateSystem != null) { addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.GROUPED_COUNTER_ASPECTS_ATTRIB); addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.UNGROUPED_COUNTER_ASPECTS_ATTRIB); Display.getDefault().syncExec(() -> { fTriStateFilteredCheckboxTree.getViewer().expandAll(); for (Object element : fTriStateFilteredCheckboxTree.getCheckedElements()) { fTriStateFilteredCheckboxTree.setSubtreeChecked(element, true); } }); } } }; Thread thread = new Thread(initialize, "Initialize Counter Tree"); thread.start(); }

Target:
private void initTree(TmfTreeViewerEntry rootBranch, CounterAnalysis analysis) { Runnable initialize = () -> { analysis.schedule(); analysis.waitForCompletion(); ITmfStateSystem stateSystem = analysis.getStateSystem(); if (stateSystem != null) { addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.GROUPED_COUNTER_ASPECTS_ATTRIB); addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.UNGROUPED_COUNTER_ASPECTS_ATTRIB); Display.getDefault().syncExec(() -> { fCheckboxTree.getViewer().expandAll(); for (Object element : fCheckboxTree.getCheckedElements()) { fCheckboxTree.setSubtreeChecked(element, true); } fListener.handleCheckStateChangedEvent(getCheckedCounterEntries()); }); } }; Thread thread = new Thread(initialize, "Initialize Counter Tree"); thread.start(); }