auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static URI getRelativeOutputPath(URI baseInputDir, URI inputFile, URI outputDir) { URI relativePath = baseInputDir.relativize(inputFile); Preconditions.checkState(relativePath.getPath().length() > 0 && !relativePath.equals(inputFile), "Unable to extract out the relative path based on base input path: " + baseInputDir); String outputDirStr = outputDir.toString(); outputDir = !outputDirStr.endsWith("/") ? URI.create(outputDirStr.concat("/")) : outputDir; URI relativeOutputURI = outputDir.resolve(relativePath).resolve("."); return relativeOutputURI; }

Target:
private static URI getRelativeOutputPath(URI baseInputDir, URI inputFile, URI outputDir) { URI relativePath = baseInputDir.relativize(inputFile); Preconditions.checkState(relativePath.getPath().length() > 0 && !relativePath.equals(inputFile), "Unable to extract out the relative path based on base input path: " + baseInputDir); String outputDirStr = outputDir.toString(); outputDir = !outputDirStr.endsWith("/") ? URI.create(outputDirStr.concat("/")) : outputDir; URI relativeOutputURI = outputDir.resolve(relativePath).resolve("."); return relativeOutputURI; }
Source:
public void deactivate() { logger.debug("Stoppig AKM868 listener..."); if (packetlistener != null) packetlistener.stopListener(); }

Target:
public void deactivate() { logger.debug("Deactivating AKM868 binding..."); stopListener(); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (getClass() != obj.getClass()) return false; GoalDto other = (GoalDto) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (getClass() != obj.getClass()) { return false; } GoalDto that = (GoalDto) obj; if (this.id == that.id) { return true; } if (this.id == null) { return false; } return this.id.equals(that.id); }
Source:
public void thatLoggingIsntBrokenOnCleanup() throws Exception { BadLogApp.runMe(new String[]{"server"}); LOGGER.info("I'm tearDown the test"); Thread.sleep(100); assertThat(new String(out.toByteArray(), UTF_8)) .contains("Mayday we're going down") .contains("I'm tearDown the test"); assertThat(new String(err.toByteArray(), UTF_8)) .contains("I'm a bad app"); }

Target:
public void thatLoggingIsntBrokenOnCleanup() throws Exception { BadLogApp.runMe(new String[]{"server"}); LOGGER.info("I'm after the test"); Thread.sleep(100); assertThat(new String(out.toByteArray(), UTF_8)) .contains("Mayday we're going down") .contains("I'm after the test"); assertThat(new String(err.toByteArray(), UTF_8)) .contains("I'm a bad app"); }
Source:
public String socialLogin(@RequestParam(value = "type", required = false) String type, ModelMap model, Locale locale) { String socialSignInErrorMessage = messageSource.getMessage("social.signin.failed", new String[] {}, locale); SocialSignInStatus socialSignInStatus = SocialSignInStatus.getSocialSignInStatus(type); String socialSignInCompletionStatus = "danger"; if (type != null) { switch (socialSignInStatus) { case REGISTRATION_SUCCESS: socialSignInErrorMessage = messageSource.getMessage("social.registration.success", new String[] {}, locale); socialSignInCompletionStatus = "success"; break; case REGISTRATION_FAILED: socialSignInErrorMessage = messageSource.getMessage("social.registration.failed", new String[] {}, locale); break; } } model.addAttribute("social_signin_message", socialSignInErrorMessage); model.addAttribute("social_signin_completion_status", socialSignInCompletionStatus); return "login"; }

Target:
public String socialLogin(@RequestParam(value = "type", required = false) String type, ModelMap model, Locale locale) { String socialSignInErrorMessage = messageSource.getMessage("social.signin.failed", new String[] {}, locale); SocialSignInStatus socialSignInStatus = SocialSignInStatus.getSocialSignInStatus(type); String messageType = "danger"; if (type != null) { switch (socialSignInStatus) { case REGISTRATION_SUCCESS: socialSignInErrorMessage = messageSource.getMessage("social.registration.success", new String[] {}, locale); messageType = "success"; break; case REGISTRATION_FAILED: socialSignInErrorMessage = messageSource.getMessage("social.registration.failed", new String[] {}, locale); break; case ACCOUNT_APPROVAL_PENDING: socialSignInErrorMessage = messageSource.getMessage("social.account.approval.pending", new String[] {}, locale); messageType = "info"; break; } } model.addAttribute("social_signin_message", socialSignInErrorMessage); model.addAttribute("message_type", messageType); return "login"; }
Source:
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { String input = variableMap.getString(HRID_TX_WIDGET_NAME); ArrayList<String> hridTxs = new ArrayList<String>(Arrays.asList(input.split("\\r?\\n"))); for (String hridTx : hridTxs) { String[] pairs = hridTx.split("[,\\s]+"); String hridNumber = pairs[0]; TransactionRecord parentTransactionId = TransactionManager.getTransactionId(Integer.valueOf(pairs[1])); try { Artifact art = ArtifactQuery.getArtifactFromId(hridNumber, AtsUtil.getAtsBranch()); if (art.isOfType(AtsArtifactTypes.TeamWorkflow)) { TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) art; if (AtsBranchManagerCore.isCommittedBranchExists(teamArt)) { AWorkbench.popup("Committed branch already exists. Can not create another working branch once changes have been committed."); return; } AtsBranchManagerCore.createWorkingBranch(teamArt, parentTransactionId, true); } else { AWorkbench.popup("ERROR", "Must enter a Team Workflow HRID"); return; } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }

Target:
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { String input = variableMap.getString(HRID_TX_WIDGET_NAME); ArrayList<String> hridTxs = new ArrayList<String>(Arrays.asList(input.split("\\r?\\n"))); for (String hridTx : hridTxs) { String[] pairs = hridTx.split("[,\\s]+"); if (pairs.length == PAIR_SIZE) { String hridNumber = pairs[0]; TransactionRecord parentTransactionId = TransactionManager.getTransactionId(Integer.valueOf(pairs[1])); try { Artifact art = ArtifactQuery.getArtifactFromId(hridNumber, AtsUtil.getAtsBranch()); if (art.isOfType(AtsArtifactTypes.TeamWorkflow)) { TeamWorkFlowArtifact teamArt = (TeamWorkFlowArtifact) art; if (AtsBranchManagerCore.isCommittedBranchExists(teamArt)) { AWorkbench.popup("Committed branch already exists. Can not create another working branch once changes have been committed."); return; } AtsBranchManagerCore.createWorkingBranch(teamArt, parentTransactionId, true); } else { AWorkbench.popup("ERROR", "Must enter a Team Workflow HRID"); return; } } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } else { log(String.format("Skipping Input [%s] - Not in usage format <Team Workflow HRID, TransactionId> \n", Arrays.toString(pairs))); } } }
Source:
public void testIteratorNext() { GridPartitionStateMap map = new GridPartitionStateMap(); initMap(map); Iterator<Map.Entry<Integer, GridDhtPartitionState>> iter = map.entrySet().iterator(); Map.Entry<Integer, GridDhtPartitionState> entry1 = iter.next(); Map.Entry<Integer, GridDhtPartitionState> entry2 = iter.next(); iter.remove(); assertNotNull(entry1.getValue()); assertNotNull(entry2.getValue()); assertNotEquals(entry1.getKey(), entry2.getKey()); assertNotEquals(entry1.getValue(), entry2.getValue()); }

Target:
public void testIteratorNext() { GridPartitionStateMap map = new GridPartitionStateMap(); initMap(map); Iterator<Map.Entry<Integer, GridDhtPartitionState>> iter = map.entrySet().iterator(); for (int i = 0; i < map.size() + 1; i++) assertTrue(iter.hasNext()); Map.Entry<Integer, GridDhtPartitionState> entry1 = iter.next(); for (int i = 0; i < map.size() + 1; i++) assertTrue(iter.hasNext()); Map.Entry<Integer, GridDhtPartitionState> entry2 = iter.next(); iter.remove(); assertNotNull(entry1.getValue()); assertNotNull(entry2.getValue()); assertEquals(Integer.valueOf(0), entry1.getKey()); assertEquals(Integer.valueOf(1), entry2.getKey()); assertEquals(GridDhtPartitionState.MOVING, entry1.getValue()); assertEquals(GridDhtPartitionState.RENTING, entry2.getValue()); }
Source:
public void searchesBouts() throws Exception { final Inbox inbox = NbRule.get().aliases().iterate().iterator().next().inbox(); final Bout first = inbox.bout(inbox.start()); final String firsttitle = "bout1 title"; first.rename(firsttitle); first.messages().post("hello"); final Bout second = inbox.bout(inbox.start()); final String secondtitle = "bout2 title"; second.rename(secondtitle); second.messages().post("message with term"); final String thirdtitle = "bout title with term"; inbox.bout(inbox.start()).rename(thirdtitle); final List<String> titles = new ArrayList<>(16); for (final Bout bout : inbox.search("term")) { titles.add(bout.title()); } MatcherAssert.assertThat( titles, Matchers.hasItem(Matchers.equalTo(secondtitle)) ); MatcherAssert.assertThat( titles, Matchers.hasItem(Matchers.equalTo(thirdtitle)) ); MatcherAssert.assertThat( titles, Matchers.not(Matchers.hasItem(Matchers.equalTo(firsttitle))) ); }

Target:
public void searchesBouts() throws Exception { final Inbox inbox = NbRule.get().aliases().iterate().iterator().next().inbox(); final Bout first = inbox.bout(inbox.start()); final String firsttitle = "bout1 title"; first.rename(firsttitle); first.messages().post("hello"); final Bout second = inbox.bout(inbox.start()); final String secondtitle = "bout2 title"; second.rename(secondtitle); second.messages().post("message with term"); final String thirdtitle = "bout title with term"; inbox.bout(inbox.start()).rename(thirdtitle); final List<String> titles = new LinkedList<>(); for (final Bout bout : inbox.search("term")) { titles.add(bout.title()); } MatcherAssert.assertThat( titles, Matchers.hasItems(secondtitle, thirdtitle) ); MatcherAssert.assertThat( titles, Matchers.not(Matchers.hasItem(firsttitle)) ); }
Source:
private void initSubTabLayoutPanel() { if (subTabLayoutpanel == null) { subTabLayoutpanel = new TabLayoutPanel(20, Unit.PX); subTabLayoutpanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { if (object != null) { object.setActiveDetailModel(object.getDetailModels().get(event.getSelectedItem())); if (event.getSelectedItem() == 2) { generalView.setMainTabSelectedItem((VM) object.getSelectedItem()); } } } }); ScrollPanel generalPanel = new ScrollPanel(); DetailModelProvider<VmListModel, VmGeneralModel> modelProvider = new DetailModelProvider<VmListModel, VmGeneralModel>() { @Override public VmGeneralModel getModel() { return (VmGeneralModel) object.getDetailModels().get(0); } @Override public void onSubTabSelected() { } }; generalView = new ImportVmGeneralSubTabView(modelProvider, constants); generalPanel.add(generalView); subTabLayoutpanel.add(generalPanel, constants.importVmGeneralSubTabLabel()); ScrollPanel nicPanel = new ScrollPanel(); nicPanel.add(nicTable); subTabLayoutpanel.add(nicPanel, constants.importVmNetworkIntefacesSubTabLabel()); ScrollPanel diskPanel = new ScrollPanel(); diskPanel.add(diskTable); subTabLayoutpanel.add(diskPanel, constants.importVmVirualDisksSubTabLabel()); ScrollPanel appPanel = new ScrollPanel(); appPanel.add(appTable); subTabLayoutpanel.add(appPanel, constants.importVmApplicationslSubTabLabel()); } }

Target:
private void initSubTabLayoutPanel() { if (subTabLayoutpanel == null) { subTabLayoutpanel = new TabLayoutPanel(20, Unit.PX); subTabLayoutpanel.addSelectionHandler(new SelectionHandler<Integer>() { @Override public void onSelection(SelectionEvent<Integer> event) { if (object != null) { object.setActiveDetailModel(object.getDetailModels().get(event.getSelectedItem())); if (event.getSelectedItem() == 0) { generalView.setMainTabSelectedItem((VM) object.getSelectedItem()); } } } }); ScrollPanel generalPanel = new ScrollPanel(); DetailModelProvider<VmListModel, VmGeneralModel> modelProvider = new DetailModelProvider<VmListModel, VmGeneralModel>() { @Override public VmGeneralModel getModel() { return (VmGeneralModel) object.getDetailModels().get(0); } @Override public void onSubTabSelected() { } }; generalView = new ImportVmGeneralSubTabView(modelProvider, constants); generalPanel.add(generalView); subTabLayoutpanel.add(generalPanel, constants.importVmGeneralSubTabLabel()); ScrollPanel nicPanel = new ScrollPanel(); nicPanel.add(nicTable); subTabLayoutpanel.add(nicPanel, constants.importVmNetworkIntefacesSubTabLabel()); ScrollPanel diskPanel = new ScrollPanel(); diskPanel.add(diskTable); subTabLayoutpanel.add(diskPanel, constants.importVmVirualDisksSubTabLabel()); ScrollPanel appPanel = new ScrollPanel(); appPanel.add(appTable); subTabLayoutpanel.add(appPanel, constants.importVmApplicationslSubTabLabel()); } }
Source:
public void customWithUriVars() throws Exception { MockHttpServletRequest request = formLogin().loginProcessingUrl("/uri-login/{var1}/{var2}", "val1", "val2") .user("username", "admin").password("password", "secret").buildRequest(this.servletContext); CsrfToken token = (CsrfToken) request .getAttribute(CsrfRequestPostProcessor.TestCsrfTokenRepository.TOKEN_ATTR_NAME); assertThat(request.getParameter("username")).isEqualTo("admin"); assertThat(request.getParameter("password")).isEqualTo("secret"); assertThat(request.getMethod()).isEqualTo("POST"); assertThat(request.getParameter(token.getParameterName())) .isEqualTo(token.getToken()); assertThat(request.getRequestURI()).isEqualTo("/uri-login/val1/val2"); }

Target:
public void customWithUriVars() { MockHttpServletRequest request = formLogin().loginProcessingUrl("/uri-login/{var1}/{var2}", "val1", "val2") .user("username", "admin").password("password", "secret").buildRequest(this.servletContext); CsrfToken token = (CsrfToken) request .getAttribute(CsrfRequestPostProcessor.TestCsrfTokenRepository.TOKEN_ATTR_NAME); assertThat(request.getParameter("username")).isEqualTo("admin"); assertThat(request.getParameter("password")).isEqualTo("secret"); assertThat(request.getMethod()).isEqualTo("POST"); assertThat(request.getParameter(token.getParameterName())) .isEqualTo(token.getToken()); assertThat(request.getRequestURI()).isEqualTo("/uri-login/val1/val2"); }
Source:
public IBorderItemLocator getNewBorderItemLocator(IFigure mainFigure) { ParameterPositionLocator locator = new ParameterPositionLocator(mainFigure, PositionConstants.NONE); return locator; }

Target:
public IBorderItemLocator getNewBorderItemLocator(IFigure mainFigure) { return new ParameterPositionLocator(mainFigure, PositionConstants.NONE); }
Source:
public static void checkRInstallation(final boolean has_chart_output) { if(has_chart_output) { try { RExecutor.executeFromClasspath("picard/analysis/checkRInstallation.R"); } catch (htsjdk.samtools.SAMException e) { throw new PicardException("R is not installed on this machine. It is required for creating the chart."); } } }

Target:
public static boolean checkRInstallation(final boolean has_chart_output) { if (has_chart_output) { try { RExecutor.executeFromClasspath("picard/analysis/checkRInstallation.R"); } catch (htsjdk.samtools.SAMException e) { return false; } } return true; }
Source:
public void testNormalizerCannotMergeNonAdjacentRegions() { final TableName tableName = TableName.valueOf(name.getMethodName()); final byte[][] keys = { null, Bytes.toBytes("aa"), Bytes.toBytes("aa1"), Bytes.toBytes("aa1!"), Bytes.toBytes("aa2"), null, }; final List<RegionInfo> regionInfos = createRegionInfos(tableName, keys); final Map<byte[], Integer> regionSizes = createRegionSizesMap(regionInfos, 3, 1, 3, 1, 5); setupMocksForNormalizer(regionSizes, regionInfos); List<NormalizationPlan> plans = normalizer.computePlansForTable(tableName); assertThat(plans, empty()); }

Target:
public void testNormalizerCannotMergeNonAdjacentRegions() { final TableName tableName = TableName.valueOf(name.getMethodName()); final byte[][] keys = { null, Bytes.toBytes("aa"), Bytes.toBytes("aa1!"), Bytes.toBytes("aa1"), Bytes.toBytes("aa2"), null, }; final List<RegionInfo> regionInfos = createRegionInfos(tableName, keys); final Map<byte[], Integer> regionSizes = createRegionSizesMap(regionInfos, 3, 1, 1, 3, 5); setupMocksForNormalizer(regionSizes, regionInfos); List<NormalizationPlan> plans = normalizer.computePlansForTable(tableName); assertThat(plans, empty()); }
Source:
private String getTypeString(ColumnSelectorFactory metricFactory) { String type = inputType; if (type == null) { ColumnCapabilities capabilities = metricFactory.getColumnCapabilities(fieldName); if (capabilities != null) { type = StringUtils.toLowerCase(capabilities.getType().name()); } else { type = "float"; } } return type; }

Target:
private String getTypeString(ColumnSelectorFactory metricFactory) { String type = inputType; if (type == null) { ColumnCapabilities capabilities = metricFactory.getColumnCapabilities(fieldName); if (capabilities != null) { type = StringUtils.toLowerCase(capabilities.getType().name()); } else { type = StringUtils.toLowerCase(ValueType.FLOAT.name()); } } return type; }
Source:
@Override public Enumerable<Object[]> scan(final DataContext root) { final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root); return new AbstractEnumerable<Object[]>() { public Enumerator<Object[]> enumerator() { Properties consumerConfig = new Properties(); consumerConfig.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, tableOptions.getBootstrapServers()); consumerConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer"); consumerConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer"); if (tableOptions.getConsumerParams() != null) { consumerConfig.putAll(tableOptions.getConsumerParams()); } Consumer consumer; if (tableOptions.getConsumer() != null) { consumer = tableOptions.getConsumer(); } else { consumer = new KafkaConsumer<>(consumerConfig); } if (tableOptions.getTimestamp() != -1) { consumer.subscribe(Collections.singletonList(tableOptions.getTopicName()), new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { seekOnTimestamp(consumer, tableOptions.getTopicName(), tableOptions.getTimestamp()); } }); } else { consumer.subscribe(Collections.singletonList(tableOptions.getTopicName())); } return new KafkaMessageEnumerator(consumer, tableOptions.getRowConverter(), cancelFlag); } }; }

Target:
@Override public Enumerable<Object[]> scan(final DataContext root) { final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root); return new AbstractEnumerable<Object[]>() { public Enumerator<Object[]> enumerator() { Properties consumerConfig = new Properties(); consumerConfig.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, tableOptions.getBootstrapServers()); consumerConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer"); consumerConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.ByteArrayDeserializer"); if (tableOptions.getConsumerParams() != null) { consumerConfig.putAll(tableOptions.getConsumerParams()); } Consumer consumer; if (tableOptions.getConsumer() != null) { consumer = tableOptions.getConsumer(); } else { consumer = new KafkaConsumer<>(consumerConfig); } if (tableOptions.getTimestamp() != -1) { consumer.subscribe(Collections.singletonList(tableOptions.getTopicName()), new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { seekToTimestamp(consumer, tableOptions.getTopicName(), tableOptions.getTimestamp()); } }); } else { consumer.subscribe(Collections.singletonList(tableOptions.getTopicName())); } return new KafkaMessageEnumerator(consumer, tableOptions.getRowConverter(), cancelFlag); } }; }
Source:
private void checkForCredentialUri(LiteralTree literal) { String possibleUrl = CheckUtils.trimQuotes(literal.value()); URI uri = null; try { uri = new URI(possibleUrl); } catch (URISyntaxException e) { return; } if (uri.getUserInfo() != null) { Matcher m = Pattern.compile("(\\S+):(\\S+)").matcher(uri.getUserInfo()); if (m.find() && !m.group(1).equals(m.group(2)) && !DEFAULT_CREDENTIAL_URI_PATTERN.matcher(uri.getUserInfo()).find()) { context().newIssue(this, literal, MESSAGE_URI); } } }

Target:
private void checkForCredentialUri(LiteralTree literal) { String possibleUrl = CheckUtils.trimQuotes(literal.value()); URI uri = null; try { uri = new URI(possibleUrl); } catch (URISyntaxException e) { return; } if (uri.getUserInfo() != null) { String userInfo = uri.getUserInfo(); Matcher m = Pattern.compile("(\\S+):(\\S+)").matcher(userInfo); if (m.find() && !m.group(1).equals(m.group(2)) && !userInfo.equals("user:password") && !userInfo.equals("username:password")) { context().newIssue(this, literal, MESSAGE_URI); } } }
Source:
public void persistMethodToSession( Session session, int contextId, SessionManagementMethod method) throws DatabaseException { if (!(method instanceof ScriptBasedSessionManagementMethod)) { throw new UnsupportedSessionManagementMethodException( "Script based session management type only supports: " + ScriptBasedSessionManagementMethod.class.getName()); } ScriptBasedSessionManagementMethod scriptMethod = (ScriptBasedSessionManagementMethod) method; session.setContextData( contextId, RecordContext.TYPE_SESSION_MANAGEMENT_FIELD_1, scriptMethod.script.getName()); session.setContextData( contextId, RecordContext.TYPE_SESSION_MANAGEMENT_FIELD_2, EncodingUtils.mapToString(scriptMethod.paramValues)); }

Target:
public void persistMethodToSession( Session session, int contextId, SessionManagementMethod method) throws DatabaseException { if (!(method instanceof ScriptBasedSessionManagementMethod)) { throw new UnsupportedSessionManagementMethodException( "Script based session management type only supports: " + ScriptBasedSessionManagementMethod.class.getName()); } ScriptBasedSessionManagementMethod scriptMethod = (ScriptBasedSessionManagementMethod) method; if (scriptMethod.script != null) { session.setContextData( contextId, RecordContext.TYPE_SESSION_MANAGEMENT_FIELD_1, scriptMethod.script.getName()); } session.setContextData( contextId, RecordContext.TYPE_SESSION_MANAGEMENT_FIELD_2, EncodingUtils.mapToString(scriptMethod.paramValues)); }
Source:
private static boolean isDateOrCollection(VariableTree variableTree) { return variableTree.symbol().type().is("java.util.Date") || (variableTree.symbol().type().isSubtypeOf("java.util.Collection") && !variableTree.symbol().type().isSubtypeOf("com.google.common.collect.ImmutableCollection")); }

Target:
private static boolean isDateOrCollection(VariableTree variableTree) { Type type = variableTree.symbol().type(); return type.is("java.util.Date") || (type.isSubtypeOf("java.util.Collection") && !type.isSubtypeOf("com.google.common.collect.ImmutableCollection")); }
Source:
private int handleSystemPropertiesIntegerValue(String property, int defaultValue) { int value = defaultValue; try { value = Integer.parseInt(System.getProperty(property)); } catch (NumberFormatException exception) { IStatus status = new Status(IStatus.WARNING, SiriusServerPlugin.PLUGIN_ID, Messages.SiriusServerConfigurator_wrongPropertyTypeWarning, exception); SiriusServerPlugin.getPlugin().getLog().log(status); } return value; }

Target:
private int handleSystemPropertiesIntegerValue(String property, int defaultValue) { int value = defaultValue; String propertyValue = System.getProperty(property); try { value = Integer.parseInt(propertyValue); } catch (NumberFormatException exception) { String message = String.format(Messages.SiriusServerConfigurator_wrongPropertyTypeWarning, propertyValue); IStatus status = new Status(IStatus.ERROR, SiriusServerPlugin.PLUGIN_ID, message, exception); SiriusServerPlugin.getPlugin().getLog().log(status); } return value; }
Source:
private KdumpDetectionResult detectHostKdumping() { VdsKdumpStatus kdumpStatus; long messageInterval = TimeUnit.SECONDS.toMillis( Config.<Integer>getValue(ConfigValues.FenceKdumpMessageInterval)); Calendar cal = Calendar.getInstance(); cal.add(Calendar.SECOND, Config.<Integer>getValue(ConfigValues.KdumpStartedTimeout)); long timeout = cal.getTimeInMillis(); boolean kdumpDetected = false; while (true) { if (!isListenerAlive()) { return KdumpDetectionResult.LISTENER_NOT_ALIVE; } kdumpStatus = vdsKdumpStatusDao.get(getVdsId()); if (kdumpStatus == null) { if (timeout < System.currentTimeMillis()) { return KdumpDetectionResult.KDUMP_NOT_DETECTED; } } else { if (!kdumpDetected) { kdumpDetected = true; auditLogDirector.log(this, AuditLogType.KDUMP_FLOW_DETECTED_ON_VDS); setVdsStatus(VDSStatus.Kdumping); restartVdsVms(); executeFenceVdsManuallyAction(); } if (kdumpStatus.getStatus() == KdumpFlowStatus.FINISHED) { auditLogDirector.log(this, AuditLogType.KDUMP_FLOW_FINISHED_ON_VDS); setVdsStatus(VDSStatus.NonResponsive); return KdumpDetectionResult.KDUMP_FINISHED; } } ThreadUtils.sleep(messageInterval); } }

Target:
private KdumpDetectionResult detectHostKdumping() { VdsKdumpStatus kdumpStatus; long messageInterval = TimeUnit.SECONDS.toMillis( Config.<Integer>getValue(ConfigValues.FenceKdumpMessageInterval)); Calendar cal = Calendar.getInstance(); cal.add(Calendar.SECOND, Config.<Integer>getValue(ConfigValues.KdumpStartedTimeout)); long timeout = cal.getTimeInMillis(); boolean kdumpDetected = false; while (true) { if (!isListenerAlive()) { return KdumpDetectionResult.LISTENER_NOT_ALIVE; } kdumpStatus = vdsKdumpStatusDao.get(getVdsId()); if (kdumpStatus == null) { if (timeout < System.currentTimeMillis()) { return KdumpDetectionResult.KDUMP_NOT_DETECTED; } } else { if (!kdumpDetected) { kdumpDetected = true; auditLogDirector.log(this, AuditLogType.KDUMP_FLOW_DETECTED_ON_VDS); setVdsStatus(VDSStatus.Kdumping); restartVdsVms(); executeFenceVdsManuallyAction(); } if (kdumpStatus.getStatus() == KdumpFlowStatus.FINISHED) { setVdsStatus(VDSStatus.NonResponsive); return KdumpDetectionResult.KDUMP_FINISHED; } } ThreadUtils.sleep(messageInterval); } }
Source:
public String generateReplacementToken(String token, int len){ StringBuffer newToken = new StringBuffer(); int passes = 1; if(len > 32){ passes = (len/32) + 1; } for(int i = 0; i < passes; i++){ newToken.append( ("" + (UUID.nameUUIDFromBytes(token.getBytes())).toString()) .replaceAll("-", "") ); } String replacement = newToken.toString().substring(0, len); return replacement; }

Target:
public String generateReplacementToken(String token, int len){ StringBuilder newToken = new StringBuilder(); int passes = 1; if(len > 32){ passes = (len/32) + 1; } for(int i = 0; i < passes; i++){ newToken.append( UUID.nameUUIDFromBytes(token.getBytes()).toString() .replaceAll("-", "") ); } String replacement = newToken.toString().substring(0, len); return replacement; }
Source:
public synchronized void flush() throws IOException { flushRotatedLogs(); flushCurrentLog(); }

Target:
public void flush() throws IOException { flushRotatedLogs(); flushCurrentLog(); }
Source:
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (loading) { if (totalItemCount > previousTotal) { loading = false; previousTotal = totalItemCount; currentPage++; } } if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) { processLoadRegisteredUsers(); loading = true; } }

Target:
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (loading && ((alCustomizationSettings.isRegisteredUserContactListCall() || ApplozicSetting.getInstance(getActivity()).isRegisteredUsersContactCall()) && Utils.isInternetAvailable(getActivity().getApplicationContext()) && TextUtils.isEmpty(userPreference.getContactsGroupId())) && (totalItemCount > previousTotal)) { loading = false; previousTotal = totalItemCount; currentPage++; } if ((!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) && (!MobiComKitPeopleActivity.isSearching)) { processLoadRegisteredUsers(); loading = true; } }
Source:
int deliver(String urlString, JsonStream.Streamable streamable, Map<String, String> headers) throws DeliveryFailureException { checkHasNetworkConnection(); HttpURLConnection conn = null; try { URL url = new URL(urlString); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setChunkedStreamingMode(0); conn.addRequestProperty("Content-Type", "application/json"); for (Map.Entry<String, String> entry : headers.entrySet()) { conn.addRequestProperty(entry.getKey(), entry.getValue()); } JsonStream stream = null; try { OutputStream out = conn.getOutputStream(); Charset charset = Charset.forName("UTF-8"); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, charset)); stream = new JsonStream(writer); streamable.toStream(stream); } finally { IOUtils.closeQuietly(stream); } return conn.getResponseCode(); } catch (IOException exception) { throw new DeliveryFailureException("IOException encountered in request", exception); } catch (Exception exception) { Logger.warn("Unexpected error delivering payload", exception); return 400; } finally { IOUtils.close(conn); } }

Target:
int deliver(String urlString, JsonStream.Streamable streamable, Map<String, String> headers) throws DeliveryFailureException { checkHasNetworkConnection(); HttpURLConnection conn = null; try { URL url = new URL(urlString); conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setChunkedStreamingMode(0); conn.addRequestProperty("Content-Type", "application/json"); for (Map.Entry<String, String> entry : headers.entrySet()) { conn.addRequestProperty(entry.getKey(), entry.getValue()); } JsonStream stream = null; try { OutputStream out = conn.getOutputStream(); Charset charset = Charset.forName("UTF-8"); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, charset)); stream = new JsonStream(writer); streamable.toStream(stream); } finally { IOUtils.closeQuietly(stream); } return conn.getResponseCode(); } catch (IOException exception) { throw new DeliveryFailureException("IOException encountered in request", exception); } catch (Exception exception) { Logger.warn("Unexpected error delivering payload", exception); return HTTP_BAD_REQUEST; } finally { IOUtils.close(conn); } }
Source:
public static GridClient startClient(GridClientConfiguration clientCfg) throws Exception { GridClient client = GridClientFactory.start(clientCfg); if (!client.connected()) { GridClientException lastErr = client.checkLastError(); client.close(); throw lastErr; } return client; }

Target:
public static GridClient startClient(GridClientConfiguration clientCfg) throws Exception { GridClient client = GridClientFactory.start(clientCfg); if (!client.connected()) { GridClientException lastErr = client.checkLastError(); try { client.close(); } catch (Throwable e) { lastErr.addSuppressed(e); } throw lastErr; } return client; }
Source:
public boolean allowsScriptWithNonce(@Nonnull String nonce) { if (this.allowsUnsafeInlineScript()) { return true; } ScriptSrcElemDirective scriptSrcElemDirective = this.getDirectiveByType(ScriptSrcElemDirective.class); if (scriptSrcElemDirective == null) { ScriptSrcDirective scriptSrcDirective = this.getDirectiveByType(ScriptSrcDirective.class); if (scriptSrcDirective == null) { return this.defaultsAllowNonce(nonce); } return scriptSrcDirective.matchesNonce(nonce); } return scriptSrcElemDirective.matchesNonce(nonce); }

Target:
public boolean allowsScriptWithNonce(@Nonnull String nonce) { if (this.allowsUnsafeInlineScript()) { return true; } ScriptSrcElemDirective scriptSrcElemDirective = this.getDirectiveByType(ScriptSrcElemDirective.class); if (scriptSrcElemDirective != null) { return scriptSrcElemDirective.matchesNonce(nonce); } ScriptSrcDirective scriptSrcDirective = this.getDirectiveByType(ScriptSrcDirective.class); if (scriptSrcDirective != null) { return scriptSrcDirective.matchesNonce(nonce); } return this.defaultsAllowNonce(nonce); }
Source:
public static Drawable getBuildImage(String state) { Context context = TravisApp.getAppContext(); switch (state) { case STATE_CREATED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_created_16dp); case STATE_STARTED: AnimatedVectorDrawableCompat drawable = AnimatedVectorDrawableCompat .create(context, R.drawable.ic_build_state_started_16dp); drawable.start(); return drawable; case STATE_PASSED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_passed_16dp); case STATE_CANCELED: case STATE_ERRORED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_errored_16dp); case STATE_FAILED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_failed_16dp); default: return null; } }

Target:
public static Drawable getBuildImage(String state) { Context context = TravisApp.getAppContext(); switch (state) { case STATE_CREATED: case STATE_STARTED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_created_16dp); case STATE_PASSED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_passed_16dp); case STATE_CANCELED: case STATE_ERRORED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_errored_16dp); case STATE_FAILED: return ContextCompat.getDrawable(context, R.drawable.ic_build_state_failed_16dp); default: return null; } }
Source:
public T getLens() { return lens; }

Target:
public T getLens() { return this.lens; }
Source:
private void parseChildren(JsonNode root, InventoryStructure.AbstractBuilder<?> bld, DeserializationContext mapper) throws IOException { JsonNode children = root.get("children"); if (children == null) { return; } if (!children.isObject()) { throw new JsonParseException("The 'children' is supposed to be an object.", JsonLocation.NA); } else { Iterator<Map.Entry<String, JsonNode>> fields = children.fields(); while (fields.hasNext()) { Map.Entry<String, JsonNode> e = fields.next(); String typeName = e.getKey(); JsonNode childrenNode = e.getValue(); if (!childrenNode.isArray()) { continue; } InventoryStructure.EntityType type = InventoryStructure.EntityType.valueOf(typeName); Iterator<JsonNode> childrenNodes = childrenNode.elements(); while (childrenNodes.hasNext()) { JsonNode childNode = childrenNodes.next(); Entity.Blueprint bl = mapper.readValue(prepareTraverse(childNode.get("data")), type.blueprintType); InventoryStructure.ChildBuilder<?> childBld = bld.startChild(bl); parseChildren(childNode, childBld, mapper); childBld.end(); } } } }

Target:
private void parseChildren(JsonNode root, InventoryStructure.AbstractBuilder<?> bld, DeserializationContext mapper) throws IOException { JsonNode children = root.get("children"); if (children == null) { return; } if (!children.isObject()) { throw new JsonParseException("The 'children' is supposed to be an object.", JsonLocation.NA); } else { Iterator<Map.Entry<String, JsonNode>> fields = children.fields(); while (fields.hasNext()) { Map.Entry<String, JsonNode> e = fields.next(); String typeName = e.getKey(); JsonNode childrenNode = e.getValue(); if (!childrenNode.isArray()) { continue; } InventoryStructure.EntityType type; try { type = InventoryStructure.EntityType.valueOf(typeName); } catch (IllegalArgumentException ex) { throw new JsonParseException("Unrecognized value of 'type'. Supported values are " + LEGAL_ENTITY_TYPES + " but got '" + typeName + "'.", JsonLocation.NA); } Iterator<JsonNode> childrenNodes = childrenNode.elements(); while (childrenNodes.hasNext()) { JsonNode childNode = childrenNodes.next(); Entity.Blueprint bl = mapper.readValue(prepareTraverse(childNode.get("data")), type.blueprintType); InventoryStructure.ChildBuilder<?> childBld = bld.startChild(bl); parseChildren(childNode, childBld, mapper); childBld.end(); } } } }
Source:
public RequestBuilder buildRequest(Api api) { return api.action("zeroconfig").param("type", "message"); }

Target:
public RequestBuilder buildRequest(Api api) { return api.action("zeroconfig") .param("type", "message") .param("agent", ((WikipediaApp)ctx.getApplicationContext()).getUserAgent()); }
Source:
public void before() throws IOException, OperationException { if (operations.invoke("list-changes", serviceAddress).isFailed()) { operations.add(serviceAddress, Values.of("max-history", 100)).assertSuccess(); } page.navigate(); }

Target:
public void before() throws IOException, OperationException { final int MAX_HISTORY = 100; if (!operations.exists(serviceAddress)) { operations.add(serviceAddress, Values.of("max-history", MAX_HISTORY)).assertSuccess(); } else { operations.writeAttribute(serviceAddress, "max-history", MAX_HISTORY); } page.navigate(); }
Source:
public void activate(String processorName) throws AxisFault { SynapseConfiguration configuration = getSynapseConfiguration(); try { assert configuration != null; if (configuration.getMessageProcessors().containsKey(processorName)) { MessageProcessor processor = configuration.getMessageProcessors().get(processorName); CAppArtifactDataService cAppArtifactDataService = ConfigHolder.getInstance(). getcAppArtifactDataService(); if (processor instanceof ScheduledMessageForwardingProcessor) { MessageForwardingProcessorView view = ((ScheduledMessageForwardingProcessor) processor).getView(); if (!view.isActive()) { view.activate(); if (!cAppArtifactDataService.isArtifactDeployedFromCApp(getTenantId(), ServiceBusConstants.MESSAGE_PROCESSOR_TYPE + File.separator + processorName)) { getMediationPersistenceManager() .saveItem(processor.getName(), ServiceBusConstants.ITEM_TYPE_MESSAGE_PROCESSOR); } } else { log.warn("Scheduled Message Forwarding Processor is already active"); } } else if (processor instanceof SamplingProcessor) { SamplingProcessorView view = ((SamplingProcessor) processor).getView(); if (!view.isActive()) { view.activate(); if (!cAppArtifactDataService.isArtifactDeployedFromCApp(getTenantId(), ServiceBusConstants.MESSAGE_PROCESSOR_TYPE + File.separator + processorName)) { getMediationPersistenceManager() .saveItem(processor.getName(), ServiceBusConstants.ITEM_TYPE_MESSAGE_PROCESSOR); } } else { log.warn("Sampling Processor is already active"); } } } } catch (Exception e) { log.error("Error While accessing MessageProcessor view "); throw new AxisFault(e.getMessage()); } }

Target:
public void activate(String processorName) throws AxisFault { SynapseConfiguration configuration = getSynapseConfiguration(); try { assert configuration != null; if (configuration.getMessageProcessors().containsKey(processorName)) { MessageProcessor processor = configuration.getMessageProcessors().get(processorName); CAppArtifactDataService cAppArtifactDataService = ConfigHolder.getInstance(). getcAppArtifactDataService(); String artifactName = getArtifactName(artifactType, processorName); if (processor instanceof ScheduledMessageForwardingProcessor) { MessageForwardingProcessorView view = ((ScheduledMessageForwardingProcessor) processor).getView(); if (!view.isActive()) { view.activate(); if (!cAppArtifactDataService.isArtifactDeployedFromCApp(getTenantId(), artifactName)) { getMediationPersistenceManager() .saveItem(processor.getName(), ServiceBusConstants.ITEM_TYPE_MESSAGE_PROCESSOR); } } else { log.warn("Scheduled Message Forwarding Processor is already active"); } } else if (processor instanceof SamplingProcessor) { SamplingProcessorView view = ((SamplingProcessor) processor).getView(); if (!view.isActive()) { view.activate(); if (!cAppArtifactDataService.isArtifactDeployedFromCApp(getTenantId(), artifactName)) { getMediationPersistenceManager() .saveItem(processor.getName(), ServiceBusConstants.ITEM_TYPE_MESSAGE_PROCESSOR); } } else { log.warn("Sampling Processor is already active"); } } } } catch (Exception e) { log.error("Error While accessing MessageProcessor view "); throw new AxisFault(e.getMessage()); } }
Source:
public void noStrings003() throws Exception { MultiStringMatcher m = MultiStringMatcher.builder().add((String[]) null).build(); List<Match> matches = m.find("dddhiheddd", 0); assertEquals("Expected no match", 0, matches.size()); }

Target:
public void noStrings003() throws Exception { MultiStringMatcher m = MultiStringMatcher.builder().add((String[]) null).build(); assertNull("Expected no match", m.indexOf("dhihedd", 0)); List<Match> matches = m.find("dddhiheddd", 0); assertEquals("Expected no match", 0, matches.size()); }
Source:
public void shouldGetMismatchingJobPlansInCaseOfPipelineHasUpdated() { StageConfig second = StageConfigMother.stageConfig("second"); second.getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); PipelineConfig pipeline = PipelineConfigMother.pipelineConfig(UUID.randomUUID().toString()); pipeline.get(0).getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); pipeline.add(second); PipelineConfig irrelevantPipeline = PipelineConfigMother.pipelineConfig(UUID.randomUUID().toString()); irrelevantPipeline.get(0).getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); JobPlan jobPlan1 = getJobPlan(pipeline.getName(), pipeline.get(0).name(), pipeline.get(0).getJobs().last()); JobPlan jobPlan2 = getJobPlan(pipeline.getName(), pipeline.get(1).name(), pipeline.get(1).getJobs().first()); JobPlan jobPlan3 = getJobPlan(irrelevantPipeline.getName(), irrelevantPipeline.get(0).name(), irrelevantPipeline.get(0).getJobs().first()); jobPlans.add(jobPlan1); jobPlans.add(jobPlan2); jobPlans.add(jobPlan3); pipeline.remove(1); List<JobPlan> jobsToRemove = buildAssignmentService.getMismatchingJobPlansFromUpdatedPipeline(pipeline, jobPlans); assertThat(jobsToRemove.size(), is(1)); assertThat(jobsToRemove.get(0), is(jobPlan2)); }

Target:
public void shouldGetMismatchingJobPlansInCaseOfPipelineHasUpdated() { StageConfig second = StageConfigMother.stageConfig("second"); second.getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); PipelineConfig pipeline = PipelineConfigMother.pipelineConfig(UUID.randomUUID().toString()); pipeline.get(0).getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); pipeline.add(second); PipelineConfig irrelevantPipeline = PipelineConfigMother.pipelineConfig(UUID.randomUUID().toString()); irrelevantPipeline.get(0).getJobs().add(JobConfigMother.jobWithNoResourceRequirement()); JobPlan jobPlan1 = getJobPlan(pipeline.getName(), pipeline.get(0).name(), pipeline.get(0).getJobs().last()); JobPlan jobPlan2 = getJobPlan(pipeline.getName(), pipeline.get(1).name(), pipeline.get(1).getJobs().first()); JobPlan jobPlan3 = getJobPlan(irrelevantPipeline.getName(), irrelevantPipeline.get(0).name(), irrelevantPipeline.get(0).getJobs().first()); jobPlans = (ArrayList<JobPlan>) buildAssignmentService.jobPlans(); jobPlans.add(jobPlan1); jobPlans.add(jobPlan2); jobPlans.add(jobPlan3); pipeline.remove(1); assertThat(jobPlans.size(), is(3)); when(goConfigService.hasPipelineNamed(pipeline.getName())).thenReturn(true); buildAssignmentService.pipelineConfigChangedListener().onEntityConfigChange(pipeline); assertThat(jobPlans.size(), is(2)); assertThat(jobPlans.get(0), is(jobPlan1)); assertThat(jobPlans.get(1), is(jobPlan3)); }
Source:
private static void checkLxmlParseCall(SubscriptionContext ctx) { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); if (checkCallExpressionFqn(callExpression, LXML_PARSE)) { CallExpression parserCall = getParserCall( getArgValueAsCallExpression( TreeUtils.nthArgumentOrKeyword(1, "parser", callExpression.arguments()))); if (parserCall != null && isUnsafeParserUsage(parserCall)) { ctx.addIssue(parserCall, MESSAGE).secondary(callExpression, MESSAGE); } } }

Target:
private static void checkLxmlParseCall(SubscriptionContext ctx) { CallExpression callExpression = (CallExpression) ctx.syntaxNode(); if (checkCallExpressionFqn(callExpression, LXML_PARSE)) { CallExpression parserCall = getParserCall( getArgValueAsCallExpression( TreeUtils.nthArgumentOrKeyword(1, "parser", callExpression.arguments()))); if (parserCall != null && isUnsafeParserUsage(parserCall)) { ctx.addIssue(parserCall, MESSAGE).secondary(callExpression, null); } } }
Source:
private X509TrustManager trustManagerForCertificates(InputStream in) throws GeneralSecurityException { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(in); if (certificates.isEmpty()) { throw new IllegalArgumentException("expected non-empty set of trusted certificates"); } char[] password = "password".toCharArray(); KeyStore keyStore = newEmptyKeyStore(password); int index = 0; for (Certificate certificate : certificates) { String certificateAlias = Integer.toString(index++); keyStore.setCertificateEntry(certificateAlias, certificate); } KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance( KeyManagerFactory.getDefaultAlgorithm()); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) { throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers)); } return (X509TrustManager) trustManagers[0]; }

Target:
private X509TrustManager trustManagerForCertificates(InputStream in) throws GeneralSecurityException { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(in); if (certificates.isEmpty()) { throw new IllegalArgumentException("expected non-empty set of trusted certificates"); } char[] password = "password".toCharArray(); KeyStore keyStore = newEmptyKeyStore(password); int index = 0; for (Certificate certificate : certificates) { String certificateAlias = Integer.toString(index++); keyStore.setCertificateEntry(certificateAlias, certificate); } TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) { throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers)); } return (X509TrustManager) trustManagers[0]; }
Source:
public QuarkIterator(ITmfStateSystem ss, int quark, long initialTime) { this (ss, quark, initialTime, Long.MAX_VALUE, 0); }

Target:
public QuarkIterator(ITmfStateSystem ss, int quark, long initialTime) { this (ss, quark, initialTime, Long.MAX_VALUE, 1); }
Source:
public ValidationResult isOsSupportedForVirtIoScsi(VM vm) { List<DiskInterface> supportedDiskInterfaces = getSupportedDiskInterfaces(vm.getOs(), vm.getVdsGroupCompatibilityVersion()); if (!supportedDiskInterfaces.contains(DiskInterface.VirtIO_SCSI)) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return ValidationResult.VALID; }

Target:
public ValidationResult isOsSupportedForVirtIoScsi(VM vm) { if (!isDiskInterfaceSupportedByOs(DiskInterface.VirtIO_SCSI, vm.getOs(), vm.getVdsGroupCompatibilityVersion())) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return ValidationResult.VALID; }