auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String[] decorateListing( final Transfer transfer, final String[] listing, EventMetadata metadata ) throws IOException { final Location loc = transfer.getLocation(); final boolean allowsSnapshots = loc.allowsSnapshots(); final boolean allowsReleases = loc.allowsReleases(); if ( loc instanceof HttpLocation && ( !allowsSnapshots || !allowsReleases ) ) { final String[] pathElements = transfer.getPath().split( "/" ); final List<String> result = new ArrayList<>( listing.length ); if ( pathElements.length >= 3 ) { final String artifactId = pathElements[ pathElements.length - 2 ]; final String version = pathElements[ pathElements.length - 1 ]; final boolean snapshotVersion = SnapshotUtils.isSnapshotVersion( version ); if ( (allowsSnapshots && snapshotVersion) || (allowsReleases && !snapshotVersion) ) { for ( final String element : listing ) { if ( !isArtifact( element, artifactId, version ) ) { result.add( element ); } } } } else { if ( !allowsSnapshots ) { for ( final String element : listing ) { String version = element; if ( element.endsWith( "/" ) ) { version = element.substring( 0, version.length() - 1 ); } if ( !SnapshotUtils.isSnapshotVersion( version ) ) { result.add( element ); } } return result.toArray( new String[ result.size() ] ); } } } return listing; }

Target:
public String[] decorateListing( final Transfer transfer, final String[] listing, EventMetadata metadata ) throws IOException { final Location loc = transfer.getLocation(); final boolean allowsSnapshots = loc.allowsSnapshots(); final boolean allowsReleases = loc.allowsReleases(); if ( loc instanceof HttpLocation && ( !allowsSnapshots || !allowsReleases ) ) { final String[] pathElements = transfer.getPath().split( "/" ); if ( pathElements.length >= 3 ) { final String artifactId = pathElements[ pathElements.length - 2 ]; final String version = pathElements[ pathElements.length - 1 ]; final boolean snapshotVersion = SnapshotUtils.isSnapshotVersion( version ); if ( (allowsSnapshots && snapshotVersion) || (allowsReleases && !snapshotVersion) ) { return listing; } return new String[0]; } else { if ( !allowsSnapshots ) { final List<String> result = new ArrayList<>( listing.length ); for ( final String element : listing ) { String version = element; if ( element.endsWith( "/" ) ) { version = element.substring( 0, version.length() - 1 ); } if ( !SnapshotUtils.isSnapshotVersion( version ) ) { result.add( element ); } } return result.toArray( new String[0] ); } } } return listing; }
Source:
public void participate(List<AmbryHealthReport> ambryHealthReports) throws IOException { logger.info("Initiating the participation"); StateMachineEngine stateMachineEngine = manager.getStateMachineEngine(); stateMachineEngine.registerStateModelFactory(LeaderStandbySMD.name, new AmbryStateModelFactory()); registerHealthReportTasks(stateMachineEngine, ambryHealthReports); try { helixAdmin.close(); manager.connect(); helixAdmin = manager.getClusterManagmentTool(); } catch (Exception e) { throw new IOException("Exception while connecting to the Helix manager", e); } for (AmbryHealthReport ambryHealthReport : ambryHealthReports) { manager.getHealthReportCollector().addHealthReportProvider((HealthReportProvider) ambryHealthReport); } }

Target:
public void participate(List<AmbryHealthReport> ambryHealthReports) throws IOException { logger.info("Initiating the participation"); StateMachineEngine stateMachineEngine = manager.getStateMachineEngine(); stateMachineEngine.registerStateModelFactory(LeaderStandbySMD.name, new AmbryStateModelFactory()); registerHealthReportTasks(stateMachineEngine, ambryHealthReports); try { synchronized (helixAdministrationLock) { helixAdmin.close(); manager.connect(); helixAdmin = manager.getClusterManagmentTool(); } } catch (Exception e) { throw new IOException("Exception while connecting to the Helix manager", e); } for (AmbryHealthReport ambryHealthReport : ambryHealthReports) { manager.getHealthReportCollector().addHealthReportProvider((HealthReportProvider) ambryHealthReport); } }
Source:
private void updateRepoRemoveList(Menu remove) { remove.getItems().clear(); Set<String> currentlyUsedRepos = ui.getCurrentlyUsedRepos() .stream().map(String::toLowerCase).collect(Collectors.toSet()); Set<String> removableRepos = ui.logic.getStoredRepos() .stream().filter(repoId -> !currentlyUsedRepos.contains(repoId.toLowerCase())) .collect(Collectors.toSet()); for (String repoId : removableRepos) { MenuItem removeItem = new MenuItem(repoId); removeItem.setOnAction(e1 -> onRepoRemove(repoId)); remove.getItems().add(removeItem); } remove.getItems().add(new SeparatorMenuItem()); for (String usedRepoId : ui.getCurrentlyUsedRepos()) { MenuItem disabledRemoveItem = new MenuItem(usedRepoId + " [in use, not removable]"); disabledRemoveItem.setDisable(true); remove.getItems().add(disabledRemoveItem); } }

Target:
private void updateRepoRemoveList(Menu remove) { remove.getItems().clear(); Set<String> currentlyUsedRepos = Utility.convertSetToLowerCase(ui.getCurrentlyUsedRepos()); Set<String> removableRepos = ui.logic.getStoredRepos() .stream().filter(repoId -> !currentlyUsedRepos.contains(repoId.toLowerCase())) .collect(Collectors.toSet()); for (String repoId : removableRepos) { MenuItem removeItem = new MenuItem(repoId); removeItem.setOnAction(e1 -> onRepoRemove(repoId)); remove.getItems().add(removeItem); } remove.getItems().add(new SeparatorMenuItem()); for (String usedRepoId : ui.getCurrentlyUsedRepos()) { MenuItem disabledRemoveItem = new MenuItem(usedRepoId + " [in use, not removable]"); disabledRemoveItem.setDisable(true); remove.getItems().add(disabledRemoveItem); } }
Source:
public AMQPMessage setAddress(SimpleString address) { if (address != null) { return setAddress(address.toString()); } else { return null; } }

Target:
public AMQPMessage setAddress(SimpleString address) { if (address != null) { return setAddress(address.toString()); } else { return setAddress((String) null); } }
Source:
public void handleEvent(ITmfEvent event) { if (fScenarioInfo.getActiveState().equals(fFsm.getInitialStateId()) && fCurrEvent == null) { fHistoryBuilder.updatePatternNbScenarios(event, fContainer); fHistoryBuilder.updatePatternDiscoveryStartTime(event, fContainer, fScenarioInfo); } fCurrEvent = event; Pair<String, String[]> out = fFsm.next(event, fPatternHandler.getTransitionInputMap(), fScenarioInfo); final String[] actions = out.getSecond(); for (int i = 0; i < actions.length; i++) { ISingleAction action = fPatternHandler.getActionMap().get(actions[i]); if (action != null) { action.execute(event, fScenarioInfo); } } if (fScenarioInfo.getActiveState().equals(fFsm.getInitialStateId()) && !out.getFirst().equals(fFsm.getInitialStateId())) { fFsm.decrementPendingScenariosCount(); fScenarioInfo.setStatus(ScenarioStatusType.IN_PROGRESS); fHistoryBuilder.updatePatternDiscoveryStartTime(event, fContainer, fScenarioInfo); } else if (out.getFirst().equals(fFsm.getAbandonStateId())) { fScenarioInfo.setStatus(ScenarioStatusType.ABANDONED); fHistoryBuilder.updatePatternDiscoveryEndTime(event, fContainer, fScenarioInfo); } else if (out.getFirst().equals(fFsm.getFinalStateId())) { fScenarioInfo.setStatus(ScenarioStatusType.MATCHED); fHistoryBuilder.updatePatternDiscoveryEndTime(fCurrEvent, fContainer, fScenarioInfo); fHistoryBuilder.updatePatternMatchedCount(event, fContainer, fFsm.getId()); } fNextStateAutomatic = (fScenarioInfo.getActiveState() != out.getFirst() && !fScenarioInfo.getActiveState().equals(fFsm.getFinalStateId())) ? true : false; fScenarioInfo.setActiveState(out.getFirst()); if (NonNullUtils.checkNotNull(fFsm.getStatesMap().get(fScenarioInfo.getActiveState())).isAutomatic() && fNextStateAutomatic) { fNextStateAutomatic = false; handleEvent(event); } }

Target:
public void handleEvent(ITmfEvent event) { Pair<String, List<String>> out = fFsm.next(event, fPatternHandler.getTestMap(), fScenarioInfo); if (out == null) { return; } final List<String> actions = out.getSecond(); for (String actionId : actions) { ITmfXmlAction action = fPatternHandler.getActionMap().get(actionId); if (action != null) { action.execute(event, fScenarioInfo); } else { throw new IllegalStateException("Action " + actionId + " cannot be found."); } } final @NonNull String nextState = NonNullUtils.checkNotNull(out.getFirst()); if (fScenarioInfo.getStatus().equals(ScenarioStatusType.PENDING)) { fScenarioInfo.setStatus(ScenarioStatusType.IN_PROGRESS); fHistoryBuilder.updateStartTime(fContainer, fScenarioInfo, event); } else if (nextState.equals(fFsm.getAbandonStateId())) { fScenarioInfo.setStatus(ScenarioStatusType.ABANDONED); fHistoryBuilder.updateEndTime(fContainer, fScenarioInfo, event); } else if (nextState.equals(fFsm.getFinalStateId())) { fScenarioInfo.setStatus(ScenarioStatusType.MATCHED); fHistoryBuilder.updateEndTime(fContainer, fScenarioInfo, event); fHistoryBuilder.updateMatchedScenariosCount(fContainer, fFsm.getId(), event); } fScenarioInfo.setActiveState(nextState); }
Source:
protected void serviceStart() throws Exception { super.serviceStart(); Configuration conf = getConfig(); YarnRPC rpc = YarnRPC.create(conf); this.server = rpc.getServer( ResourceTracker.class, this, resourceTrackerAddress, conf, null, conf.getInt(YarnConfiguration.RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT, YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT)); if (conf.getBoolean( CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) { InputStream inputStream = this.rmContext.getConfigurationProvider() .getConfigurationInputStream(conf, YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE); if (inputStream != null) { conf.addResource(inputStream); } refreshServiceAcls(conf, RMPolicyProvider.getInstance()); } this.server.start(); conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST, YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS, YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS, server.getListenerAddress()); clusterId = conf.get(YarnConfiguration.RM_CLUSTER_ID, "default-cluster"); }

Target:
protected void serviceStart() throws Exception { super.serviceStart(); Configuration conf = getConfig(); YarnRPC rpc = YarnRPC.create(conf); this.server = rpc.getServer( ResourceTracker.class, this, resourceTrackerAddress, conf, null, conf.getInt(YarnConfiguration.RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT, YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT)); if (conf.getBoolean( CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION, false)) { InputStream inputStream = this.rmContext.getConfigurationProvider() .getConfigurationInputStream(conf, YarnConfiguration.HADOOP_POLICY_CONFIGURATION_FILE); if (inputStream != null) { conf.addResource(inputStream); } refreshServiceAcls(conf, RMPolicyProvider.getInstance()); } this.server.start(); conf.updateConnectAddr(YarnConfiguration.RM_BIND_HOST, YarnConfiguration.RM_RESOURCE_TRACKER_ADDRESS, YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_ADDRESS, server.getListenerAddress()); clusterId = conf.get(YarnConfiguration.RM_CLUSTER_ID, YarnConfiguration.DEFAULT_RM_CLUSTER_ID); }
Source:
public void testCreateSchema() throws Exception { long ts = nextTimestamp(); Properties props = new Properties(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); Connection conn = DriverManager.getConnection(getUrl(), props); HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), TestUtil.TEST_PROPERTIES).getAdmin(); String ddl = "CREATE SCHEMA TEST_SCHEMA"; conn.createStatement().execute(ddl); assertNotEquals(null, admin.getNamespaceDescriptor("TEST_SCHEMA")); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); conn = DriverManager.getConnection(getUrl(), props); try { conn.createStatement().execute(ddl); fail(); } catch (SchemaAlreadyExistsException e) { } props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts - 20)); conn = DriverManager.getConnection(getUrl(), props); try { conn.createStatement().execute(ddl); fail(); } catch (NewerSchemaAlreadyExistsException e) { } admin.close(); conn.close(); }

Target:
public void testCreateSchema() throws Exception { long ts = nextTimestamp(); Properties props = new Properties(); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts)); props.setProperty(QueryServices.IS_NAMESPACE_MAPPING_ENABLED, Boolean.toString(true)); String ddl = "CREATE SCHEMA TEST_SCHEMA"; try (Connection conn = DriverManager.getConnection(getUrl(), props); HBaseAdmin admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin();) { conn.createStatement().execute(ddl); assertNotNull(admin.getNamespaceDescriptor("TEST_SCHEMA")); } props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10)); try (Connection conn = DriverManager.getConnection(getUrl(), props);) { conn.createStatement().execute(ddl); fail(); } catch (SchemaAlreadyExistsException e) { } props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts - 20)); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute(ddl); fail(); } catch (NewerSchemaAlreadyExistsException e) { } props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 100)); Connection conn = DriverManager.getConnection(getUrl(), props); try { conn.createStatement().execute("CREATE SCHEMA " + SchemaUtil.SCHEMA_FOR_DEFAULT_NAMESPACE); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.SCHEMA_NOT_ALLOWED.getErrorCode(), e.getErrorCode()); } try { conn.createStatement().execute("CREATE SCHEMA " + SchemaUtil.HBASE_NAMESPACE); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.SCHEMA_NOT_ALLOWED.getErrorCode(), e.getErrorCode()); } conn.close(); }
Source:
private static Ds3ApiSpec toSpec(final RawSpec contract) { Ds3ApiSpec ds3ApiSpec = new Ds3ApiSpec(contract.getContract().getDs3Requests(), null); return ds3ApiSpec; }

Target:
private static Ds3ApiSpec toSpec(final RawSpec contract) { final Ds3ApiSpec ds3ApiSpec = new Ds3ApiSpec(contract.getContract().getDs3Requests(), null); return ds3ApiSpec; }
Source:
protected void fit(DataSet dataSet) { try { if (replicatedModel instanceof MultiLayerNetwork) { if (lastEtlTime == null) lastEtlTime = new AtomicLong(0); ((MultiLayerNetwork) replicatedModel).setLastEtlTime(lastEtlTime.get()); ((MultiLayerNetwork) replicatedModel).fit(dataSet); } else if (replicatedModel instanceof ComputationGraph) { ((ComputationGraph) replicatedModel).setLastEtlTime(lastEtlTime.get()); ((ComputationGraph) replicatedModel).fit(dataSet); } } catch (Exception e) { e.printStackTrace(); } }

Target:
protected void fit(DataSet dataSet) { if (replicatedModel instanceof MultiLayerNetwork) { if (lastEtlTime == null) lastEtlTime = new AtomicLong(0); ((MultiLayerNetwork) replicatedModel).setLastEtlTime(lastEtlTime.get()); ((MultiLayerNetwork) replicatedModel).fit(dataSet); } else if (replicatedModel instanceof ComputationGraph) { if (lastEtlTime == null) lastEtlTime = new AtomicLong(0); ((ComputationGraph) replicatedModel).setLastEtlTime(lastEtlTime.get()); ((ComputationGraph) replicatedModel).fit(dataSet); } }
Source:
public void test_andorra() { Network network = new SupersonicOsmNetworkReader.Builder() .setCoordinateTransformation(coordinateTransformation) .build() .read(Paths.get(utils.getPackageInputDirectory()).resolve("andorra-latest.osm.pbf")); NetworkUtils.writeNetwork(network, "expected.xml.gz"); Network expectedResult = NetworkUtils.readNetwork(Paths.get(utils.getInputDirectory()).resolve("expected-result.xml.gz").toString()); log.info("expected result contains: " + expectedResult.getLinks().size() + " links and " + expectedResult.getNodes().size() + " nodes"); log.info("result contains: " + network.getLinks().size() + " links and " + network.getNodes().size() + " nodes"); Utils.assertEquals(expectedResult, network); }

Target:
public void test_andorra() { Network network = new SupersonicOsmNetworkReader.Builder() .setCoordinateTransformation(coordinateTransformation) .setFreeSpeedFactor(LinkProperties.DEFAULT_FREESPEED_FACTOR) .build() .read(Paths.get(utils.getPackageInputDirectory()).resolve("andorra-latest.osm.pbf")); Network expectedResult = NetworkUtils.readNetwork(Paths.get(utils.getInputDirectory()).resolve("expected-result.xml.gz").toString()); log.info("expected result contains: " + expectedResult.getLinks().size() + " links and " + expectedResult.getNodes().size() + " nodes"); log.info("result contains: " + network.getLinks().size() + " links and " + network.getNodes().size() + " nodes"); Utils.assertEquals(expectedResult, network); Network alternative = new SupersonicOsmNetworkReader.Builder() .setCoordinateTransformation(coordinateTransformation) .setFreeSpeedFactor(1.0) .setAfterLinkCreated(SupersonicOsmNetworkReader.adjustFreespeed(LinkProperties.DEFAULT_FREESPEED_FACTOR)) .build() .read(Paths.get(utils.getPackageInputDirectory()).resolve("andorra-latest.osm.pbf")); Utils.assertEquals(alternative, network); }
Source:
public void setWireframe(boolean val) { if(chart.isSetWireframe()) chart.getWireframe().setVal(val); else chart.addNewWireframe().setVal(val); }

Target:
public void setWireframe(boolean val) { if (chart.isSetWireframe()) { chart.getWireframe().setVal(val); } else { chart.addNewWireframe().setVal(val); } }
Source:
public T newInstanceFromHash(RMap<String, Object> map, String[] fields) throws GoraException, IOException { fields = getFieldsToQuery(fields); T persistent = newPersistent(); for (String f : fields) { Schema.Field field = fieldMap.get(f); Object val = map.get(mapping.getFields().get(field.name())); if (val == null) { continue; } Object fieldValue = handler.deserializeFieldValue(field, field.schema(), val, persistent); persistent.put(field.pos(), fieldValue); persistent.setDirty(field.pos()); } return persistent; }

Target:
public T newInstanceFromHash(RMap<String, Object> map, String[] fields) throws GoraException, IOException { fields = getFieldsToQuery(fields); T persistent = newPersistent(); for (String fieldName : fields) { Schema.Field field = fieldMap.get(fieldName); Object fValue = map.get(mapping.getFields().get(field.name())); if (fValue == null) { continue; } Object fieldValue = handler.deserializeFieldValue(field, field.schema(), fValue, persistent); persistent.put(field.pos(), fieldValue); persistent.setDirty(field.pos()); } return persistent; }
Source:
public void createMavenArchetypeStartProjectByWizard() throws Exception { Stream<String> expectedItems = Stream.of( NAME_OF_ARTIFACT + "/src/main/java/" + NAME_OF_ARTIFACT + "/App.java", NAME_OF_ARTIFACT + "/src/test/java/" + NAME_OF_ARTIFACT + "/AppTest.java", NAME_OF_ARTIFACT + "/pom.xml"); ide.open(workspace); menu.runCommand( TestMenuCommandsConstants.Workspace.WORKSPACE, TestMenuCommandsConstants.Workspace.CREATE_PROJECT); projectWizard.selectTypeProject(Wizard.TypeProject.MAVEN); projectWizard.typeProjectNameOnWizard(NAME_OF_ARTIFACT); projectWizard.clickNextButton(); projectWizard.waitOpenProjectConfigForm(); projectWizard.selectArcheTypeFromList(Wizard.Archetypes.QUICK_START); projectWizard.checkArtifactIdOnWizardContainsText(NAME_OF_ARTIFACT); projectWizard.checkGroupIdOnWizardContainsText(NAME_OF_ARTIFACT); projectWizard.checkVersionOnWizardContainsText("1.0-SNAPSHOT"); projectWizard.clickCreateButton(); projectExplorer.waitItem(NAME_OF_ARTIFACT); console.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS); projectExplorer.quickExpandWithJavaScript(); expectedItems.forEach(projectExplorer::waitItem); projectExplorer.openItemByPath(NAME_OF_ARTIFACT + "/pom.xml"); File file = new File( CheckGeneratingMavenArchetypeTest.class .getResource("pom-quick-start-archetype-context") .getFile()); editor.waitTextIntoEditor(FileUtils.readFileToString(file)); }

Target:
public void createMavenArchetypeStartProjectByWizard() throws Exception { Stream<String> expectedItems = Stream.of( NAME_OF_ARTIFACT + "/src/main/java/" + NAME_OF_ARTIFACT + "/App.java", NAME_OF_ARTIFACT + "/src/test/java/" + NAME_OF_ARTIFACT + "/AppTest.java", NAME_OF_ARTIFACT + "/pom.xml"); ide.open(workspace); menu.runCommand( TestMenuCommandsConstants.Workspace.WORKSPACE, TestMenuCommandsConstants.Workspace.CREATE_PROJECT); projectWizard.selectTypeProject(Wizard.TypeProject.MAVEN); projectWizard.typeProjectNameOnWizard(NAME_OF_ARTIFACT); projectWizard.clickNextButton(); projectWizard.waitOpenProjectConfigForm(); projectWizard.selectArcheTypeFromList(Wizard.Archetypes.QUICK_START); projectWizard.checkArtifactIdOnWizardContainsText(NAME_OF_ARTIFACT); projectWizard.checkGroupIdOnWizardContainsText(NAME_OF_ARTIFACT); projectWizard.checkVersionOnWizardContainsText("1.0-SNAPSHOT"); projectWizard.clickCreateButton(); projectExplorer.waitItem(NAME_OF_ARTIFACT); console.waitExpectedTextIntoConsole(TestBuildConstants.BUILD_SUCCESS); projectExplorer.quickExpandWithJavaScript(); expectedItems.forEach(projectExplorer::waitItem); projectExplorer.openItemByPath(NAME_OF_ARTIFACT + "/pom.xml"); String pathToExpectedContentOfPom = CheckGeneratingMavenArchetypeTest.class .getResource("pom-quick-start-archetype-context") .getFile(); editor.waitTextIntoEditor( IoUtil.readAndCloseQuietly(IoUtil.getResource(pathToExpectedContentOfPom))); }
Source:
private boolean isUserSecurityAdmin(User user, SecurityTeam securityTeam) throws InternalErrorException { try { int number = jdbc.queryForInt("select 1 from authz " + " left outer join groups_members on groups_members.group_id=authz.authorized_group_id " + " left outer join members on members.id=groups_members.member_id " + " where (user_id=? or members.user_id=?) and security_team_id=? limit 1", user.getId(), user.getId(), securityTeam.getId()); if (number > 0) { return true; } return false; } catch(EmptyResultDataAccessException ex) { return false; } catch(RuntimeException e) { throw new InternalErrorException(e); } }

Target:
private boolean isUserSecurityAdmin(User user, SecurityTeam securityTeam) throws InternalErrorException { try { int number = jdbc.queryForInt("select count(1) from authz " + " left outer join groups_members on groups_members.group_id=authz.authorized_group_id " + " left outer join members on members.id=groups_members.member_id " + " where (user_id=? or members.user_id=?) and security_team_id=? ", user.getId(), user.getId(), securityTeam.getId()); if (number > 0) { return true; } return false; } catch(EmptyResultDataAccessException ex) { return false; } catch(RuntimeException e) { throw new InternalErrorException(e); } }
Source:
private List<BakedQuad> getQuadsForFrequency( final short frequency, final boolean active ) { final AEColor[] colors = Platform.p2p().toColors( frequency ); final CubeBuilder cb = new CubeBuilder( this.format ); cb.setTexture( this.texture ); cb.useStandardUV(); cb.setRenderFullBright( active ); for( int i = 0; i < 4; ++i ) { final int[] offs = QUAD_OFFSETS[i]; for( int j = 0; j < 4; ++j ) { final AEColor c = colors[j]; if( active ) { cb.setColorRGB( c.dye.getColorValue() ); } else { final float cv[] = c.dye.getColorComponentValues(); cb.setColorRGB( cv[0] * 0.5f, cv[1] * 0.5f, cv[2] * 0.5f ); } final int startx = j % 2; final int starty = j / 2; cb.addCube( offs[0] + startx, offs[1] + starty, offs[2], offs[0] + startx + 1, offs[1] + starty + 1, offs[2] + 1 ); } } return cb.getOutput(); }

Target:
private List<BakedQuad> getQuadsForFrequency( final short frequency, final boolean active ) { final AEColor[] colors = Platform.p2p().toColors( frequency ); final CubeBuilder cb = new CubeBuilder( this.format ); cb.setTexture( this.texture ); cb.useStandardUV(); cb.setRenderFullBright( active ); for( int i = 0; i < 4; ++i ) { final int[] offs = QUAD_OFFSETS[i]; for( int j = 0; j < 4; ++j ) { final AEColor c = colors[j]; if( active ) { cb.setColorRGB( c.dye.getColorValue() ); } else { final float cv[] = c.dye.getColorComponentValues(); cb.setColorRGB( cv[0] * 0.5f, cv[1] * 0.5f, cv[2] * 0.5f ); } final int startx = j % 2; final int starty = 1 - j / 2; cb.addCube( offs[0] + startx, offs[1] + starty, offs[2], offs[0] + startx + 1, offs[1] + starty + 1, offs[2] + 1 ); } } return cb.getOutput(); }
Source:
public String getPluginPublisherAndName(String pluginId) throws DevfileException { try { ExtendedPluginFQN meta = fqnParser.parsePluginFQN(pluginId); if (!isNullOrEmpty(meta.getReference())) { return meta.getReference(); } return meta.getPublisherAndName(); } catch (InfrastructureException e) { throw new DevfileException(e.getMessage(), e); } }

Target:
public String getPluginPublisherAndName(String pluginId) throws DevfileException { try { ExtendedPluginFQN meta = fqnParser.parsePluginFQN(pluginId); return meta.getPublisherAndName(); } catch (InfrastructureException e) { throw new DevfileException(e.getMessage(), e); } }
Source:
public BlockBreakHandler getItemHandler() { return new BlockBreakHandler() { @Override public boolean isPrivate() { return false; } @Override public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) { if (isItem(item)) { Player p = e.getPlayer(); if (Slimefun.hasUnlocked(p, ExplosiveTool.this, true)) { Block b = e.getBlock(); b.getWorld().createExplosion(b.getLocation(), 0.0F); b.getWorld().playSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.2F, 1F); List<Block> blocks = findBlocks(b); if (callExplosionEvent.getValue().booleanValue()) { BlockExplodeEvent blockExplodeEvent = new BlockExplodeEvent(b, blocks, 0); Bukkit.getServer().getPluginManager().callEvent(blockExplodeEvent); if (!blockExplodeEvent.isCancelled()) { blockExplodeEvent.blockList().forEach(block -> breakBlock(p, item, block, fortune, drops)); } } else { for (Block block : blocks) { breakBlock(p, item, block, fortune, drops); } } } return true; } else { return false; } } }; }

Target:
public BlockBreakHandler getItemHandler() { return new BlockBreakHandler() { @Override public boolean isPrivate() { return false; } @Override public boolean onBlockBreak(BlockBreakEvent e, ItemStack item, int fortune, List<ItemStack> drops) { if (isItem(item)) { Player p = e.getPlayer(); if (Slimefun.hasUnlocked(p, ExplosiveTool.this, true)) { Block b = e.getBlock(); b.getWorld().createExplosion(b.getLocation(), 0.0F); b.getWorld().playSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.2F, 1F); List<Block> blocks = findBlocks(b); if (callExplosionEvent.getValue().booleanValue()) { BlockExplodeEvent blockExplodeEvent = new BlockExplodeEvent(b, blocks, 0); Bukkit.getServer().getPluginManager().callEvent(blockExplodeEvent); if (!blockExplodeEvent.isCancelled()) { for (Block block : blockExplodeEvent.blockList()) { breakBlock(p, item, block, fortune, drops); } } } else { for (Block block : blocks) { breakBlock(p, item, block, fortune, drops); } } } return true; } else { return false; } } }; }
Source:
private void downloadFormList() { if (!connectivityProvider.isDeviceOnline()) { ToastUtils.showShortToast(R.string.no_connection); if (viewModel.isDownloadOnlyMode()) { setReturnResult(false, getString(R.string.no_connection), viewModel.getFormResults()); finish(); } } else { viewModel.clearFormDetailsByFormId(); refreshFormListDialogFragment = new RefreshFormListDialogFragment(); refreshFormListDialogFragment.show(getSupportFragmentManager(), ProgressDialogFragment.COLLECT_PROGRESS_DIALOG_TAG); if (downloadFormListTask != null && downloadFormListTask.getStatus() != AsyncTask.Status.FINISHED) { return; } else if (downloadFormListTask != null) { downloadFormListTask.setDownloaderListener(null); downloadFormListTask.cancel(true); downloadFormListTask = null; } downloadFormListTask = new DownloadFormListTask(formListDownloader); downloadFormListTask.setDownloaderListener(this); if (viewModel.isDownloadOnlyMode()) { downloadFormListTask.setAlternateCredentials(viewModel.getUrl(), viewModel.getUsername(), viewModel.getPassword()); } downloadFormListTask.execute(); } }

Target:
private void downloadFormList() { if (!connectivityProvider.isDeviceOnline()) { ToastUtils.showShortToast(R.string.no_connection); if (viewModel.isDownloadOnlyMode()) { setReturnResult(false, getString(R.string.no_connection), viewModel.getFormResults()); finish(); } } else { viewModel.clearFormDetailsByFormId(); DialogUtils.showIfNotShowing(RefreshFormListDialogFragment.class, getSupportFragmentManager()); if (downloadFormListTask != null && downloadFormListTask.getStatus() != AsyncTask.Status.FINISHED) { return; } else if (downloadFormListTask != null) { downloadFormListTask.setDownloaderListener(null); downloadFormListTask.cancel(true); downloadFormListTask = null; } downloadFormListTask = new DownloadFormListTask(formListDownloader); downloadFormListTask.setDownloaderListener(this); if (viewModel.isDownloadOnlyMode()) { downloadFormListTask.setAlternateCredentials(viewModel.getUrl(), viewModel.getUsername(), viewModel.getPassword()); } downloadFormListTask.execute(); } }
Source:
protected IStatus run(IProgressMonitor monitor) { try { this.isRootANewProject = projectAlreadyExistsInWorkspace(this.rootDirectory) != null; this.rootProject = toExistingOrNewProject( this.rootDirectory, monitor); if (this.recursiveConfigure) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription description = workspace.getDescription(); boolean isAutoBuilding = workspace.isAutoBuilding(); if (isAutoBuilding) { description.setAutoBuilding(false); workspace.setDescription(description); } importProjectAndChildrenRecursively(this.rootProject, true, monitor); if (isAutoBuilding) { description.setAutoBuilding(true); workspace.setDescription(description); } if (this.isRootANewProject && (this.report.get(this.rootProject).isEmpty() || (this.report.get(this.rootProject).size() == 1 && this.report.get(this.rootProject).get(0) instanceof EclipseProjectConfigurator))) { if (MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.discardRootProject_title, Messages.discardRootProject_description)) { this.rootProject.delete(true, monitor); this.report.remove(this.rootProject); } } } } catch (Exception ex) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex); } return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { try { this.isRootANewProject = projectAlreadyExistsInWorkspace(this.rootDirectory) == null; this.rootProject = toExistingOrNewProject( this.rootDirectory, monitor); if (this.recursiveConfigure) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspaceDescription description = workspace.getDescription(); boolean isAutoBuilding = workspace.isAutoBuilding(); if (isAutoBuilding) { description.setAutoBuilding(false); workspace.setDescription(description); } importProjectAndChildrenRecursively(this.rootProject, true, monitor); if (isAutoBuilding) { description.setAutoBuilding(true); workspace.setDescription(description); } if (this.isRootANewProject && this.report.size() > 1 && (this.report.get(this.rootProject).isEmpty() || (this.report.get(this.rootProject).size() == 1 && this.report.get(this.rootProject).get(0) instanceof EclipseProjectConfigurator))) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { discardRootProject = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.discardRootProject_title, Messages.discardRootProject_description); } }); if (this.discardRootProject) { this.rootProject.delete(false, true, monitor); this.report.remove(this.rootProject); } } } } catch (Exception ex) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, ex.getMessage(), ex); } return Status.OK_STATUS; }
Source:
public Graph importJob(JobInstance job, final String baseUri) throws GoIntegrationException { LOGGER.debug("Attempting to import job " + job); JobXmlViewModel xmlModel = new JobXmlViewModel(job); Graph jobGraph = rdfizer.importURIUsingGRDDL(xmlModel, baseUri); URIReference jobURI = jobGraph.getURIReference(xmlModel.httpUrl(baseUri)); importArtifactsForJob(jobURI, jobGraph); LOGGER.debug("Done building jobs graph with " + jobGraph.size() + " triples"); return jobGraph; }

Target:
public Graph importJob(JobInstance job, final String baseUri) throws GoIntegrationException { LOGGER.debug("Attempting to import job {}", job); JobXmlViewModel xmlModel = new JobXmlViewModel(job); Graph jobGraph = rdfizer.importURIUsingGRDDL(xmlModel, baseUri); URIReference jobURI = jobGraph.getURIReference(xmlModel.httpUrl(baseUri)); importArtifactsForJob(jobURI, jobGraph); LOGGER.debug("Done building jobs graph with triples", jobGraph.size()); return jobGraph; }
Source:
private void logValue(final Bytes key, final BufferKey bufferKey, final BufferValue value) { final byte[] serializedBufferValue = value.serialize(); final int sizeOfBufferTime = Long.BYTES; final int sizeOfBufferValue = serializedBufferValue.length; final byte[] timeAndBufferValue = ByteBuffer.wrap(new byte[sizeOfBufferTime + sizeOfBufferValue]) .putLong(bufferKey.time()) .put(serializedBufferValue) .array(); collector.send( changelogTopic, key, timeAndBufferValue, V_2_CHANGELOG_HEADERS, partition, null, KEY_SERIALIZER, VALUE_SERIALIZER ); }

Target:
private void logValue(final Bytes key, final BufferKey bufferKey, final BufferValue value) { final int sizeOfBufferTime = Long.BYTES; final ByteBuffer buffer = value.serialize(sizeOfBufferTime); buffer.putLong(bufferKey.time()); collector.send( changelogTopic, key, buffer.array(), V_2_CHANGELOG_HEADERS, partition, null, KEY_SERIALIZER, VALUE_SERIALIZER ); }
Source:
private void addPresentationMetaProperties() { StaticListClass displayTypeClass = new StaticListClass(this); displayTypeClass.setName("displayType"); displayTypeClass.setPrettyName("Display Type"); displayTypeClass.setValues("input|select|radio|checkbox"); safeput(displayTypeClass.getName(), displayTypeClass); BooleanClass multiSelectClass = newCheckBox(false); multiSelectClass.setName("multiSelect"); multiSelectClass.setPrettyName("Multiple Select"); safeput(multiSelectClass.getName(), multiSelectClass); BooleanClass pickerClass = newCheckBox(true); pickerClass.setName("picker"); pickerClass.setPrettyName("Use Suggest"); safeput(pickerClass.getName(), pickerClass); NumberClass sizeClass = new NumberClass(this); sizeClass.setName("size"); sizeClass.setPrettyName("Size"); sizeClass.setSize(5); sizeClass.setNumberType("integer"); safeput(sizeClass.getName(), sizeClass); addValueSeparatorMetaProperties(); StaticListClass sortClass = new StaticListClass(this); sortClass.setName("sort"); sortClass.setPrettyName("Sort"); sortClass.setValues("none|id|value"); safeput(sortClass.getName(), sortClass); StaticListClass freeTextClass = new StaticListClass(this); freeTextClass.setName("freeText"); freeTextClass.setPrettyName("Free text"); freeTextClass.setValues("forbidden|discouraged|allowed"); safeput(freeTextClass.getName(), freeTextClass); }

Target:
private void addPresentationMetaProperties() { StaticListClass displayTypeClass = new StaticListClass(this); displayTypeClass.setName("displayType"); displayTypeClass.setPrettyName("Display Type"); displayTypeClass.setValues("input|select|radio|checkbox"); safeput(displayTypeClass.getName(), displayTypeClass); BooleanClass multiSelectClass = newCheckBox(false); multiSelectClass.setName("multiSelect"); multiSelectClass.setPrettyName("Multiple Select"); safeput(multiSelectClass.getName(), multiSelectClass); BooleanClass pickerClass = newCheckBox(true); pickerClass.setName("picker"); pickerClass.setPrettyName("Use Suggest"); safeput(pickerClass.getName(), pickerClass); NumberClass sizeClass = new NumberClass(this); sizeClass.setName("size"); sizeClass.setPrettyName("Size"); sizeClass.setSize(5); sizeClass.setNumberType("integer"); safeput(sizeClass.getName(), sizeClass); addValueSeparatorMetaProperties(); StaticListClass sortClass = new StaticListClass(this); sortClass.setName("sort"); sortClass.setPrettyName("Sort"); sortClass.setValues("none|id|value"); safeput(sortClass.getName(), sortClass); StaticListClass freeTextClass = new StaticListClass(this); freeTextClass.setName("freeText"); freeTextClass.setPrettyName("Free text"); freeTextClass.setValues("discouraged|forbidden|allowed"); safeput(freeTextClass.getName(), freeTextClass); }
Source:
private void refreshToplevelIcons() { findPreference("shareapp_package").setSummary(getPreferenceManager().getSharedPreferences().getString("shareapp_package", "")); findPreference("pref_category_ui").setIcon(Utils.IconicsIcon(getActivity(), "cmd_monitor")); findPreference("pref_category_interaction").setIcon(Utils.IconicsIcon(getContext(), "cmd_gesture_tap")); findPreference("pref_category_player").setIcon(Utils.IconicsIcon(getContext(), "cmd_play")); findPreference("pref_category_alarm").setIcon(Utils.IconicsIcon(getContext(), "cmd_clock_outline")); findPreference("pref_category_connectivity").setIcon(Utils.IconicsIcon(getContext(), "gmd_import_export")); findPreference("pref_category_recordings").setIcon(Utils.IconicsIcon(getContext(), "cmd_record_rec")); findPreference("pref_category_mpd").setIcon(Utils.IconicsIcon(getContext(), "cmd_speaker_wireless")); findPreference("pref_category_other").setIcon(Utils.IconicsIcon(getContext(), "cmd_information_outline")); }

Target:
private void refreshToplevelIcons() { findPreference("shareapp_package").setSummary(getPreferenceManager().getSharedPreferences().getString("shareapp_package", "")); findPreference("pref_category_ui").setIcon(Utils.IconicsIcon(getContext(), CommunityMaterial.Icon2.cmd_monitor)); findPreference("pref_category_interaction").setIcon(Utils.IconicsIcon(getContext(), CommunityMaterial.Icon.cmd_gesture_tap)); findPreference("pref_category_player").setIcon(Utils.IconicsIcon(getContext(), CommunityMaterial.Icon2.cmd_play)); findPreference("pref_category_alarm").setIcon(Utils.IconicsIcon(getContext(), CommunityMaterial.Icon.cmd_clock_outline)); findPreference("pref_category_connectivity").setIcon(Utils.IconicsIcon(getContext(), GoogleMaterial.Icon.gmd_import_export)); findPreference("pref_category_recordings").setIcon(Utils.IconicsIcon(getContext(), CommunityMaterial.Icon2.cmd_record_rec)); findPreference("pref_category_mpd").setIcon(Utils.IconicsIcon(getContext(), CommunityMaterial.Icon2.cmd_speaker_wireless)); findPreference("pref_category_other").setIcon(Utils.IconicsIcon(getContext(), CommunityMaterial.Icon2.cmd_information_outline)); }
Source:
public synchronized boolean hasNext() { if (cachedNext != null) { return true; } if (!pageStore.isPagingDirtyRead()) { return false; } cachedNext = next(); return cachedNext != null; }

Target:
public synchronized boolean hasNext() { if (cachedNext != null) { return true; } if (!pageStore.isPaging()) { return false; } cachedNext = next(); return cachedNext != null; }
Source:
private GraphicsDevice getCompatibleGraphics(VmDeviceType videoDeviceType) { if (videoDeviceType == null) { return null; } GraphicsDevice graphicsDevice = null; GraphicsType compatibleType = null; for (Pair<GraphicsType, DisplayType> graphicsDisplayPair : osRepository.getGraphicsAndDisplays().get(getVm().getStaticData().getOsId()).get(getVdsGroup().getcompatibility_version())) { if (graphicsDisplayPair.getSecond().getDefaultVmDeviceType() == videoDeviceType) { compatibleType = graphicsDisplayPair.getFirst(); } } if (compatibleType != null) { graphicsDevice = new GraphicsDevice(compatibleType.getCorrespondingDeviceType()); graphicsDevice.setId(new VmDeviceId(Guid.newGuid(), getVmId())); } return graphicsDevice; }

Target:
private GraphicsDevice getCompatibleGraphics(VmDeviceType videoDeviceType) { if (videoDeviceType == null || getVdsGroup() == null) { return null; } GraphicsDevice graphicsDevice = null; GraphicsType compatibleType = null; for (Pair<GraphicsType, DisplayType> graphicsDisplayPair : osRepository.getGraphicsAndDisplays().get(getVm().getStaticData().getOsId()).get(getVdsGroup().getcompatibility_version())) { if (graphicsDisplayPair.getSecond().getDefaultVmDeviceType() == videoDeviceType) { compatibleType = graphicsDisplayPair.getFirst(); } } if (compatibleType != null) { graphicsDevice = new GraphicsDevice(compatibleType.getCorrespondingDeviceType()); graphicsDevice.setId(new VmDeviceId(Guid.newGuid(), getVmId())); } return graphicsDevice; }
Source:
private StatementStats execute(ClientSession session, String query, Consumer<QueryData> queryDataConsumer, Consumer<QueryError> queryErrorConsumer) { StatementClient client = new StatementClient(okHttpClient, session, query); while (client.isValid() && client.advance()) { QueryData queryData = client.currentData(); if (queryData != null) { queryDataConsumer.accept(queryData); } } if (client.isClosed()) { throw new IllegalStateException("Query aborted by user"); } if (client.isGone()) { throw new IllegalStateException("Query is gone (server restarted?)"); } QueryError resultsError = client.finalStatusInfo().getError(); if (resultsError != null) { queryErrorConsumer.accept(resultsError); } return client.finalStatusInfo().getStats(); }

Target:
private StatementStats execute(ClientSession session, String query, Consumer<QueryData> queryDataConsumer, Consumer<QueryError> queryErrorConsumer) { try (StatementClient client = new StatementClient(okHttpClient, session, query)) { while (client.isValid() && client.advance()) { queryDataConsumer.accept(client.currentData()); } if (client.isClosed()) { throw new IllegalStateException("Query aborted by user"); } if (client.isGone()) { throw new IllegalStateException("Query is gone (server restarted?)"); } QueryError resultsError = client.finalStatusInfo().getError(); if (resultsError != null) { queryErrorConsumer.accept(resultsError); } return client.finalStatusInfo().getStats(); } }
Source:
public String toString() { return "(" + profile + "," + authz + ")"; }

Target:
public String toString() { return "profile (" + authz + ")"; }
Source:
private IMethod[] getAllRippleMethods(IProgressMonitor pm, WorkingCopyOwner owner) throws CoreException { IMethod[] rippleMethods= findAllRippleMethods(pm, owner); if (fDeclarationToMatch == null) return rippleMethods; List<IMethod> rippleMethodsList= Arrays.asList(rippleMethods); List<IMethod> filteredMethods= new ArrayList<>(rippleMethodsList.size()); for (Iterator<IMethod> iter= rippleMethodsList.iterator(); iter.hasNext(); ) { IMethod currentMethod= iter.next(); Object match= fDeclarationToMatch.get(currentMethod); if (match != null) { fBinaryRefs.add((SearchMatch) match); } else { filteredMethods.add(currentMethod); } } fDeclarationToMatch= null; return filteredMethods.toArray(new IMethod[filteredMethods.size()]); }

Target:
private IMethod[] getAllRippleMethods(IProgressMonitor pm, WorkingCopyOwner owner) throws CoreException { IMethod[] rippleMethods= findAllRippleMethods(pm, owner); if (fDeclarationToMatch == null) return rippleMethods; List<IMethod> filteredMethods= new ArrayList<>(rippleMethods.length / 2); for (IMethod currentMethod : rippleMethods) { Object match= fDeclarationToMatch.get(currentMethod); if (match != null) { fBinaryRefs.add((SearchMatch) match); } else { filteredMethods.add(currentMethod); } } fDeclarationToMatch= null; return filteredMethods.toArray(new IMethod[filteredMethods.size()]); }
Source:
public void triggerMatchingJobs(String user, String url, String scm) { if ("git".equals(scm)) { SecurityContext old = Jenkins.getInstance().getACL().impersonate(ACL.SYSTEM); try { URIish remote = new URIish(url); for (Job<?,?> job : Hudson.getInstance().getAllItems(Job.class)) { BitBucketTrigger bTrigger = null; LOGGER.info("considering candidate job " + job.getName()); ParameterizedJobMixIn.ParameterizedJob pJob = (ParameterizedJobMixIn.ParameterizedJob) job; if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { for (Trigger trigger : pJob.getTriggers().values()) { if (trigger instanceof BitBucketTrigger) { bTrigger = (BitBucketTrigger) trigger; break; } } } if (bTrigger != null) { LOGGER.info("Considering to poke " + job.getFullDisplayName()); SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job); for (SCM scmTrigger : item.getSCMs()) { if (match(scmTrigger, remote)) bTrigger.onPost(user); else LOGGER.info("job SCM doesn't match remote repo"); } } else LOGGER.info("job hasn't BitBucketTrigger set"); } } catch (URISyntaxException e) { LOGGER.warning("invalid repository URL " + url); } finally { SecurityContextHolder.setContext(old); } } else { throw new UnsupportedOperationException("unsupported SCM type " + scm); } }

Target:
public void triggerMatchingJobs(String user, String url, String scm) { if ("git".equals(scm)) { SecurityContext old = Jenkins.getInstance().getACL().impersonate(ACL.SYSTEM); try { URIish remote = new URIish(url); for (Job<?,?> job : Jenkins.getInstance().getAllItems(Job.class)) { BitBucketTrigger bTrigger = null; LOGGER.log(Level.FINE, "Considering candidate job {0}", job.getName()); if (job instanceof ParameterizedJobMixIn.ParameterizedJob) { ParameterizedJobMixIn.ParameterizedJob pJob = (ParameterizedJobMixIn.ParameterizedJob) job; for (Trigger trigger : pJob.getTriggers().values()) { if (trigger instanceof BitBucketTrigger) { bTrigger = (BitBucketTrigger) trigger; break; } } } if (bTrigger != null) { LOGGER.log(Level.FINE, "Considering to poke {0}", job.getFullDisplayName()); SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job); for (SCM scmTrigger : item.getSCMs()) { if (match(scmTrigger, remote)) { LOGGER.log(Level.INFO, "Triggering BitBucket job {0}", job.getName()); bTrigger.onPost(user); } else LOGGER.log(Level.FINE, "{0} SCM doesn't match remote repo {1}", new Object[]{job.getName(), remote}); } } else LOGGER.log(Level.FINE, "{0} hasn't BitBucketTrigger set", job.getName()); } } catch (URISyntaxException e) { LOGGER.log(Level.WARNING, "Invalid repository URL {0}", url); } finally { SecurityContextHolder.setContext(old); } } else { throw new UnsupportedOperationException("Unsupported SCM type " + scm); } }
Source:
public boolean equals(Object obj){ boolean result; if (obj == null) { result = false; } else { User other = (User) obj; result = macAddress.equals(other.getMacAddress()) && bluetoothID.equals(other.getBluetoothID()); } return result; }

Target:
public boolean equals(Object obj){ boolean result; if ((obj == null) || !(obj instanceof User)) { result = false; } else { User other = (User) obj; result = macAddress.equals(other.getMacAddress()) && bluetoothID.equals(other.getBluetoothID()); } return result; }
Source:
private String extractBaseIdFromUri(Channel channel) { return channel.getUri() .replace(uriPrefix, "") .trim(); }

Target:
String extractBaseIdFromUri(Channel channel) { return channel.getUri() .replace(uriPrefix, "") .trim(); }
Source:
public void sendTemplateToRecipientUrl(String url, String template) { PostMethod post = new PostMethod(url); try { post.setParameter("content-type", "application/xml"); HttpClient client = new HttpClient(); LOGGER.info("Sending template to URL: {}", url); int responseCode = client.executeMethod(post); LOGGER.info("Response code: {}", responseCode); LOGGER.info("Response body: {}", post.getResponseBodyAsString()); } catch (ConnectException | HttpException e) { LOGGER.error("Cannot connect with URL: {}", url); } catch (IOException e) { LOGGER.error("Cannot get body from response message. URL: {}", url); } }

Target:
public void sendTemplateToRecipientUrl(String url, String template) throws IOException { PostMethod post = new PostMethod(url); post.setRequestEntity(new StringRequestEntity(template, "application/xml", "utf-8")); HttpClient client = new HttpClient(); LOGGER.info("Sending template to URL: {}", url); int responseCode = client.executeMethod(post); LOGGER.info("Response code: {}", responseCode); }