auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void Restart() { Constants constants = ConstantsManager.getInstance().getConstants(); ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(constants.restartHostsTitle()); model.setHashName("restart_host"); model.setMessage(constants.areYouSureYouWantToRestartTheFollowingHostsMsg()); ArrayList<String> items = new ArrayList<String>(); String vdsEntry = "%1$s (%2$d " + constants.runningVms() + ")"; for (Object item : getSelectedItems()) { VDS vds = (VDS) item; int runningVms = vds.getVmCount(); if (runningVms > 0) { items.add(StringFormat.format(vdsEntry, vds.getName(), runningVms)); } else { items.add(vds.getName()); } } model.setItems(items); UICommand tempVar = new UICommand("OnRestart", this); tempVar.setTitle(constants.ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(constants.cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }

Target:
public void Restart() { final Constants constants = ConstantsManager.getInstance().getConstants(); final Messages messages = ConstantsManager.getInstance().getMessages(); ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(constants.restartHostsTitle()); model.setHashName("restart_host"); model.setMessage(constants.areYouSureYouWantToRestartTheFollowingHostsMsg()); ArrayList<String> items = new ArrayList<String>(); for (Object item : getSelectedItems()) { VDS vds = (VDS) item; int runningVms = vds.getVmCount(); if (runningVms > 0) { items.add(messages.hostNumberOfRunningVms(vds.getName(),runningVms)); } else { items.add(vds.getName()); } } model.setItems(items); UICommand tempVar = new UICommand("OnRestart", this); tempVar.setTitle(constants.ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(constants.cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }
Source:
public void asyncReadEntries(long firstEntry, long lastEntry, ReadCallback cb, Object ctx) { if (firstEntry < 0 || firstEntry > lastEntry) { cb.readComplete(BKException.Code.ReadException, this, null, ctx); return; } if (firstEntry > lastAddConfirmed || lastEntry > lastAddConfirmed) { try { readLac(); } catch (BKException | InterruptedException e) { LOG.info("Attempted to Read LAC, but nothing found"); } } if (lastEntry > lastAddConfirmed) { cb.readComplete(BKException.Code.ReadException, this, null, ctx); return; } asyncReadEntriesInternal(firstEntry, lastEntry, cb, ctx); }

Target:
public void asyncReadEntries(long firstEntry, long lastEntry, ReadCallback cb, Object ctx) { if (firstEntry < 0 || firstEntry > lastEntry) { LOG.error("IncorrectParameterException on ledgerId:{} firstEntry:{} lastEntry:{}", new Object[] { ledgerId, firstEntry, lastEntry }); cb.readComplete(BKException.Code.IncorrectParameterException, this, null, ctx); return; } if (lastEntry > lastAddConfirmed) { LOG.error("ReadException on ledgerId:{} firstEntry:{} lastEntry:{}", new Object[] { ledgerId, firstEntry, lastEntry }); cb.readComplete(BKException.Code.ReadException, this, null, ctx); return; } asyncReadEntriesInternal(firstEntry, lastEntry, cb, ctx); }
Source:
private void ensurePreferredNameForLocale(Concept concept) { Set<Locale> checkedLocales = new HashSet<>(); for (ConceptName n : concept.getNames()) { Locale locale = n.getLocale(); if (checkedLocales.contains(locale)) { continue; } ConceptName possiblePreferredName = concept.getPreferredName(locale); if (concept.getFullySpecifiedName(locale) != null) { possiblePreferredName = concept.getFullySpecifiedName(locale); } else if (!CollectionUtils.isEmpty(concept.getSynonyms(locale))) { concept.getSynonyms(locale).iterator().next().setLocalePreferred(true); } if (possiblePreferredName != null) { possiblePreferredName.setLocalePreferred(true); } checkedLocales.add(locale); } }

Target:
private void ensurePreferredNameForLocale(Concept concept) { Set<Locale> checkedLocales = new HashSet<>(); for (ConceptName n : concept.getNames()) { Locale locale = n.getLocale(); if (checkedLocales.contains(locale)) { continue; } ConceptName possiblePreferredName = concept.getPreferredName(locale); if (possiblePreferredName != null) { } else if (concept.getFullySpecifiedName(locale) != null) { possiblePreferredName = concept.getFullySpecifiedName(locale); } else if (!CollectionUtils.isEmpty(concept.getSynonyms(locale))) { concept.getSynonyms(locale).iterator().next().setLocalePreferred(true); } if (possiblePreferredName != null) { possiblePreferredName.setLocalePreferred(true); } checkedLocales.add(locale); } }
Source:
public Link discoverResource(int objectId, AttributeSet objectAttributes, int instanceId, int resourceId) { ReadResponse readResponse = read(resourceId); if (readResponse == null || !readResponse.isSuccess()) { return null; } return DiscoverHelper.resourceLink(objectId, objectAttributes, instanceId, instanceAttributes, resourceId, resourceAttributes.get(resourceId)); }

Target:
public DiscoverResponse discoverResource(int objectId, AttributeSet objectAttributes, int instanceId, int resourceId) { if (!getAvailableResourceIds().contains(resourceId)) { return DiscoverResponse.notFound(); } return DiscoverResponse.success(new Link[] { DiscoverHelper.resourceLink(objectId, objectAttributes, instanceId, instanceAttributes, resourceId, resourceAttributes.get(resourceId)) }); }
Source:
public void scan(@Nullable Tree element) { if (element != null) { currentElement = element; List<ConsumerWrapper> elementConsumers = consumers.get(element.getKind()); if (elementConsumers != null) { for (ConsumerWrapper consumer : elementConsumers) { consumer.execute(); } } } super.scan(element); }

Target:
public void scan(@Nullable Tree element) { if (element != null) { currentElement = element; consumers.getOrDefault(element.getKind(), Collections.emptyList()).forEach(SubscriptionContextImpl::execute); } super.scan(element); }
Source:
public void initializeDefaultPreferences() { super.performDefaults(); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String providerId = ProfileLaunchShortcut .getDefaultLaunchShortcutProviderId(SNAPSHOT); store.setValue(PROVIDER, providerId); }

Target:
public void initializeDefaultPreferences() { super.performDefaults(); String providerId = ProfileLaunchShortcut .getDefaultLaunchShortcutProviderId(TYPE); configScopeInstance.getNode(QUALIFIER).put(KEY, providerId); }
Source:
private static IntList getBitmapIndexList( final BoundDimFilter boundDimFilter, final BitmapIndex bitmapIndex ) { return IntIteratorUtils.toIntList(getBitmapIndexIterator(boundDimFilter, bitmapIndex).iterator()); }

Target:
private static IntList getBitmapIndexList( final BoundDimFilter boundDimFilter, final BitmapIndex bitmapIndex ) { final Pair<Integer, Integer> indexes = getStartEndIndexes(boundDimFilter, bitmapIndex); final int startIndex = indexes.lhs; final int endIndex = indexes.rhs; return IntListUtils.fromTo(startIndex, endIndex); }
Source:
private void sendingMessage(boolean isSending, String message) { streamActv.setEnabled(!isSending); textView.setEnabled(!isSending); messageEt.setEnabled(!isSending); topicActv.setEnabled(!isSending); sendBtn.setEnabled(!isSending); togglePrivateStreamBtn.setEnabled(!isSending); if (isSending) { Log.e("vvvvvvvvvvvvvvvvvv", "visible"); TextView msg = (TextView) composeStatus.getChildAt(1); msg.setText(message); composeStatus.setVisibility(View.VISIBLE); } else composeStatus.setVisibility(View.GONE); }

Target:
private void sendingMessage(boolean isSending, String message) { streamActv.setEnabled(!isSending); textView.setEnabled(!isSending); messageEt.setEnabled(!isSending); topicActv.setEnabled(!isSending); sendBtn.setEnabled(!isSending); togglePrivateStreamBtn.setEnabled(!isSending); if (isSending) { TextView msg = (TextView) composeStatus.findViewById(R.id.sending_message); msg.setText(message); composeStatus.setVisibility(View.VISIBLE); } else composeStatus.setVisibility(View.GONE); }
Source:
private String getRocksDbAbsoluteDir(Map conf) throws MetricException { String storePath = conf.get(DaemonConfig.STORM_ROCKSDB_LOCATION).toString(); if (storePath == null) { throw new MetricException("Not a vaild RocksDB configuration - Missing store location " + DaemonConfig.STORM_ROCKSDB_LOCATION); } else { if (new File(storePath).isAbsolute()) { return storePath; } else { String stormHome = System.getProperty("storm.home"); if (stormHome == null) { throw new MetricException("storm.home not set"); } return (stormHome + File.separator + storePath); } } }

Target:
private String getRocksDbAbsoluteDir(Map conf) throws MetricException { String storePath = (String)conf.get(DaemonConfig.STORM_ROCKSDB_LOCATION); if (storePath == null) { throw new MetricException("Not a vaild RocksDB configuration - Missing store location " + DaemonConfig.STORM_ROCKSDB_LOCATION); } else { if (new File(storePath).isAbsolute()) { return storePath; } else { String stormHome = System.getProperty("storm.home"); if (stormHome == null) { throw new MetricException("storm.home not set"); } return (stormHome + File.separator + storePath); } } }
Source:
public Guid getProfileId() { if (profileId == null) { if (getParameters().getProfileId() != null) { profileId = getParameters().getProfileId(); } else if (getParameters().getProfile() != null) { profileId = getParameters().getProfile().getId(); } } return profileId; }

Target:
public Guid getProfileId() { if (profileId == null) { if (getParameters().getProfileId() != null) { profileId = getParameters().getProfileId(); } else if (getParameters().getProfile() != null) { profileId = getParameters().getProfile().getId(); } else { log.error("couldn't find disk profile id"); } } return profileId; }
Source:
private ColumnSelectorFactory getEmptyColumnSelectorFactory() { return new ColumnSelectorFactory() { @Override public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec) { return DimensionSelector.constant(null); } @Override public ColumnValueSelector makeColumnValueSelector(String s) { return null; } @Override public ColumnCapabilities getColumnCapabilities(String s) { return null; } }; }

Target:
private ColumnSelectorFactory getEmptyColumnSelectorFactory() { return new ColumnSelectorFactory() { @Override public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec) { return DimensionSelector.constant(null); } @Override public ColumnValueSelector makeColumnValueSelector(String s) { return NilColumnValueSelector.instance(); } @Override public ColumnCapabilities getColumnCapabilities(String s) { return null; } }; }
Source:
public void requestTicketOfTypeStringsTypeNull() { User user = persistUser(); String typeString = null; List<String> optionsString = Arrays.asList(CH_MEMBER_OPTION, PICKUP_SERVICE_OPTION); thrown.expect(TicketTypeNotFoundException.class); thrown.expectMessage("TicketType "); ticketService.requestTicketOfType(user, typeString, optionsString); }

Target:
public void requestTicketOfTypeStringsTypeNull() { User user = persistUser(); List<String> optionsString = Arrays.asList(CH_MEMBER_OPTION, PICKUP_SERVICE_OPTION); thrown.expect(TicketTypeNotFoundException.class); thrown.expectMessage("TicketType "); ticketService.requestTicketOfType(user, null, optionsString); }
Source:
public void generateAvroSchema(int numberOfFields) { try { File avroFile = new File(AVRO_FULL_PATH); FieldAssembler<Schema> fieldAssembler = SchemaBuilder.record(RECORD).namespace(NAMESPACE_VALUE).fields(); fieldAssembler.name(USER_ID_VALUE).type().stringType().stringDefault(NULL); for (int i = 0; i < numberOfFields; i++) { fieldAssembler.name(FIELD_PREFIX + i).type().stringType().stringDefault(NULL); } Schema sc = fieldAssembler.endRecord(); String schemaString = sc.toString(); JSONObject avroSchema = new JSONObject(schemaString); OutputStreamWriter avroWriter = new OutputStreamWriter(new FileOutputStream(avroFile), StandardCharsets.UTF_8); avroWriter.write(avroSchema.toString(4)); avroWriter.close(); } catch (FileNotFoundException e) { } catch (IOException e) { } }

Target:
public static void generateAvroSchema(int numberOfFields) { try { File avroFile = new File(Constants.AVRO_FULL_PATH); FieldAssembler<Schema> fieldAssembler = SchemaBuilder.record(Constants.RECORD) .namespace(Constants.NAMESPACE_VALUE).fields(); fieldAssembler.name(Constants.USER_ID_VALUE).type().stringType().stringDefault(Constants.NULL); for (int fieldCount = 0; fieldCount < numberOfFields; fieldCount++) { fieldAssembler.name(Constants.FIELD_PREFIX + fieldCount).type().stringType().stringDefault(Constants.NULL); } Schema sc = fieldAssembler.endRecord(); String schemaString = sc.toString(); JSONObject avroSchema = new JSONObject(schemaString); OutputStreamWriter avroWriter = new OutputStreamWriter(new FileOutputStream(avroFile), StandardCharsets.UTF_8); avroWriter.write(avroSchema.toString(4)); avroWriter.close(); } catch (FileNotFoundException e) { LOG.info("Cannot find file " + Constants.AVRO_FULL_PATH, e.getMessage(), e); } catch (IOException e) { LOG.info("There is a problem generating avro schema", e.getMessage(), e); } }
Source:
private Response make() throws IOException { if (this.zipped.get() == null) { this.zipped.compareAndSet( null, new RsWithHeader( new RsWithBody( this.origin, RsGzip.gzip(this.origin.body()) ), "Content-Encoding", "gzip" ) ); } return this.zipped.get(); }

Target:
private Response make() throws IOException { synchronized (this.zipped) { if (this.zipped.isEmpty()) { this.zipped.add( new RsWithHeader( new RsWithBody( this.origin, RsGzip.gzip(this.origin.body()) ), "Content-Encoding", "gzip" ) ); } } return this.zipped.get(0); }
Source:
public static void broadcast(Set<Team> teams, String msg) { Iterator<Team> it = teams.iterator(); while(it.hasNext()) { sendMsg(it.next(), msg); } }

Target:
public static void broadcast(Set<Team> teams, String msg) { for(Team x : teams) { sendMsg(x, msg); } }
Source:
public static void handle(PacketCubes packet, Level worldIn) { ClientLevel world = (ClientLevel) worldIn; FriendlyByteBuf dataReader = wrapBuffer(packet.packetData); BitSet cubeExists = packet.cubeExists; for (int i = 0; i < packet.cubes.length; i++) { CubePos pos = packet.cubePositions[i]; int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); int[] cubeBiomes = new int[CubeBiomeContainer.CUBE_BIOMES_SIZE]; if (cubeBiomes.length >= 0) System.arraycopy(packet.biomes, i * CubeBiomeContainer.CUBE_BIOMES_SIZE, cubeBiomes, 0, cubeBiomes.length); CubeBiomeContainer cubeBiomeContainer = new CubeBiomeContainer(Minecraft.getInstance().level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), cubeBiomes); ((IClientCubeProvider) world.getChunkSource()).replaceWithPacketData( x, y, z, cubeBiomeContainer, dataReader, new CompoundTag(), cubeExists.get(i)); for (int dx = 0; dx < IBigCube.DIAMETER_IN_SECTIONS; dx++) { for (int dy = 0; dy < IBigCube.DIAMETER_IN_SECTIONS; dy++) { for (int dz = 0; dz < IBigCube.DIAMETER_IN_SECTIONS; dz++) { world.setSectionDirtyWithNeighbors( cubeToSection(x, dx), cubeToSection(y, dy), cubeToSection(z, dz)); } } } for (CompoundTag nbt : packet.tileEntityTags) { BlockPos tePos = new BlockPos(nbt.getInt("x"), nbt.getInt("y"), nbt.getInt("z")); BlockEntity te = world.getBlockEntity(tePos); if (te != null) { te.load(nbt); } } } }

Target:
public static void handle(PacketCubes packet, Level worldIn) { ClientLevel world = (ClientLevel) worldIn; FriendlyByteBuf dataReader = wrapBuffer(packet.packetData); BitSet cubeExists = packet.cubeExists; for (int i = 0; i < packet.cubes.length; i++) { CubePos pos = packet.cubePositions[i]; int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); CubeBiomeContainer cubeBiomeContainer = new CubeBiomeContainer(Minecraft.getInstance().level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), packet.biomeDataArrays.get(i)); ((IClientCubeProvider) world.getChunkSource()).replaceWithPacketData( x, y, z, cubeBiomeContainer, dataReader, new CompoundTag(), cubeExists.get(i)); for (int dx = 0; dx < IBigCube.DIAMETER_IN_SECTIONS; dx++) { for (int dy = 0; dy < IBigCube.DIAMETER_IN_SECTIONS; dy++) { for (int dz = 0; dz < IBigCube.DIAMETER_IN_SECTIONS; dz++) { world.setSectionDirtyWithNeighbors( cubeToSection(x, dx), cubeToSection(y, dy), cubeToSection(z, dz)); } } } for (CompoundTag nbt : packet.tileEntityTags) { BlockPos tePos = new BlockPos(nbt.getInt("x"), nbt.getInt("y"), nbt.getInt("z")); BlockEntity te = world.getBlockEntity(tePos); if (te != null) { te.load(nbt); } } } }
Source:
public void testUpdateNotification() { Notification notification = curationApiAdmin.createNotification(testNotification()); long id = notification.getId(); System.out.println(id); Notification update = anotherTestNotification(); System.out.println("here"); update.setId(id); boolean userCanUpdate = true; try { System.out.println(update.getId()); curationApiUser.updateNotification(id, update); } catch (ApiException e) { userCanUpdate = false; } assertFalse(userCanUpdate); System.out.println(id); curationApiAdmin.updateNotification(id, update); System.out.println(id); String message = testingPostgres.runSelectStatement(String.format("select message from notification where id = '%s'", id), String.class); assertEquals(message, "ayy"); }

Target:
public void testUpdateNotification() { Notification notification = curationApiAdmin.createNotification(testNotification()); long id = notification.getId(); Notification update = anotherTestNotification(); update.setId(id); boolean userCanUpdate = true; try { curationApiUser.updateNotification(id, update); } catch (ApiException e) { userCanUpdate = false; assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), e.getCode()); } assertFalse(userCanUpdate); curationApiAdmin.updateNotification(id, update); String message = testingPostgres.runSelectStatement(String.format("select message from notification where id = '%s'", id), String.class); assertEquals(currentMsg, message); }
Source:
protected boolean isForceRefLog(ReceiveCommand cmd) { return cmd.isForceRefLog() != null ? cmd.isForceRefLog().booleanValue() : isForceRefLog(); }

Target:
protected boolean isForceRefLog(ReceiveCommand cmd) { Boolean isForceRefLog = cmd.isForceRefLog(); return isForceRefLog != null ? isForceRefLog.booleanValue() : isForceRefLog(); }
Source:
VoltPSetOpsRule(RelOptRuleOperand operand, MatchType matchType) { super(operand, "VoltPSetOpsRule_" + matchType.name()); m_matchType = matchType; }

Target:
private VoltPSetOpsRule(RelOptRuleOperand operand, MatchType matchType) { super(operand, "VoltPSetOpsRule_" + matchType.name()); m_matchType = matchType; }
Source:
public void destroy() throws Exception { apiPublisher.deleteAPI("PhoneVerificationAdd", apiVersion, ADMIN_LOGIN_USERNAME); apiPublisher.deleteAPI("APIWildCardApi", apiVersion, ADMIN_LOGIN_USERNAME); userManagementClient1.deleteUser("SubscriberUser"); userManagementClient1.deleteRole("Health-Subscriber"); userManagementClient2.deleteUser("MultipleRoleUser"); userManagementClient2.deleteRole("NewRole1"); userManagementClient2.deleteRole("NewRole2"); }

Target:
public void destroy() throws Exception { apiPublisher.deleteAPI("PhoneVerificationAdd", apiVersion, ADMIN_LOGIN_USERNAME); apiPublisher.deleteAPI("APIWildCardApi", apiVersion, ADMIN_LOGIN_USERNAME); userManagementClient.deleteUser("SubscriberUser"); userManagementClient.deleteRole("Health-Subscriber"); userManagementClient.deleteUser("MultipleRoleUser"); userManagementClient.deleteRole("NewRole1"); userManagementClient.deleteRole("NewRole2"); }
Source:
public void deleteItemVariant(@PathParam("id") long id) { ItemVariant itemVariant = stockService.findItemVariantById(id); activeStateChecker.checkState(itemVariant, true); itemVariant.setActive(Boolean.FALSE); stockService.saveItemVariant(itemVariant); }

Target:
public void deleteItemVariant(@PathParam("id") long id) { ItemVariant itemVariant = stockService.findItemVariantById(id); activeStateChecker.checkState(itemVariant, true); itemVariant.setActive(false); stockService.saveItemVariant(itemVariant); }
Source:
public CalculationFunctions composedWith(DerivedCalculationFunction<?, ?>... derivedFunctions) { Map<Class<?>, List<DerivedCalculationFunction<?, ?>>> functionsByTargetType = Arrays.stream(derivedFunctions).collect(groupingBy(fn -> fn.targetType())); List<CalculationFunction<?>> wrappedFunctions = MapStream.of(functionsByTargetType) .map((targetType, fns) -> wrap(targetType, fns)) .collect(toList()); Map<Class<?>, CalculationFunction<?>> allFunctions = new HashMap<>(functions); wrappedFunctions.forEach(fn -> allFunctions.put(fn.targetType(), fn)); return DefaultCalculationFunctions.of(allFunctions); }

Target:
public CalculationFunctions composedWith(DerivedCalculationFunction<?, ?>... derivedFunctions) { Map<Class<?>, List<DerivedCalculationFunction<?, ?>>> functionsByTargetType = Arrays.stream(derivedFunctions).collect(groupingBy(fn -> fn.targetType())); List<CalculationFunction<?>> wrappedFunctions = MapStream.of(functionsByTargetType) .map((targetType, fns) -> wrap(targetType, fns)) .collect(toList()); Map<Class<?>, CalculationFunction<?>> allFunctions = new HashMap<>(functions); wrappedFunctions.forEach(fn -> allFunctions.put(fn.targetType(), fn)); return CalculationFunctions.of(allFunctions); }
Source:
public CdpElement findByGlobalDeviceId(String deviceId) { List<CdpElement> elements = find("from CdpElement rec where rec.cdpGlobalDeviceId = ? ", deviceId); if (elements.size() > 1) { LoggerFactory.getLogger(getClass()).warn("Expected one CdpElement for device with id but found {}. Using CdpElement and ignoring others.", deviceId, elements.size(), elements.get(0)); } return elements.isEmpty() ? null : elements.get(0); }

Target:
public CdpElement findByGlobalDeviceId(String deviceId) { List<CdpElement> elements = find("from CdpElement rec where rec.cdpGlobalDeviceId = ? order by rec.id", deviceId); if (elements.size() > 1) { LoggerFactory.getLogger(getClass()).warn("Expected 1 CdpElement for device with id '{}' but found {}. Using CdpElement and ignoring others.", deviceId, elements.size(), elements.get(0)); } return elements.isEmpty() ? null : elements.get(0); }
Source:
public static void main(String[] args) throws InterruptedException { SpringApplication.run(JdbcSinkApplication.class, args); }

Target:
public static void main(String[] args) { SpringApplication.run(JdbcSinkApplication.class, args); }
Source:
public void init() { get( "/forms/query", (req, res) -> util.getMetacardsByFilter(QUERY_TEMPLATE_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFormTemplate) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); get( "/forms/result", (req, res) -> util.getMetacardsByFilter(ATTRIBUTE_GROUP_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFieldFilter) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); delete( "/forms/:id", APPLICATION_JSON, (req, res) -> { String id = req.params(":id"); Subject subject = ThreadContext.getSubject(); String currentUser = SubjectUtils.getName(subject); Map<String, Object> originalMetacardOwner = JsonFactory.create().parser().parseMap(util.safeGetBody(req)); if (!originalMetacardOwner.get(Core.METACARD_OWNER).equals(currentUser)) { res.status(500); LOGGER.debug("Failed to Delete Form {}", id); return ImmutableMap.of("message", "Failed to delete."); } DeleteResponse deleteResponse = catalogFramework.delete(new DeleteRequestImpl(id)); if (!deleteResponse.getProcessingErrors().isEmpty()) { res.status(500); LOGGER.debug("Failed to Delete Form {}", id); return ImmutableMap.of("message", "Failed to delete."); } return ImmutableMap.of("message", "Successfully deleted."); }, util::getJson); }

Target:
public void init() { get( "/forms/query", (req, res) -> util.getMetacardsByFilter(QUERY_TEMPLATE_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFormTemplate) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); get( "/forms/result", (req, res) -> util.getMetacardsByFilter(ATTRIBUTE_GROUP_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFieldFilter) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); delete( "/forms/:id", APPLICATION_JSON, (req, res) -> { String id = req.params(":id"); Subject subject = SecurityUtils.getSubject(); String currentUser = SubjectUtils.getName(subject); Map<String, Object> originalMetacardOwner = JsonFactory.create().parser().parseMap(util.safeGetBody(req)); if (!originalMetacardOwner.get(Core.METACARD_OWNER).equals(currentUser)) { res.status(500); LOGGER.debug("Failed to Delete Form {}", id); return ImmutableMap.of(RESP_MSG, "Failed to delete."); } DeleteResponse deleteResponse = catalogFramework.delete(new DeleteRequestImpl(id)); if (!deleteResponse.getProcessingErrors().isEmpty()) { res.status(500); LOGGER.debug("Failed to Delete Form {}", id); return ImmutableMap.of(RESP_MSG, "Failed to delete."); } return ImmutableMap.of(RESP_MSG, "Successfully deleted."); }, util::getJson); }
Source:
public RuntimeWorkspace getRuntimeWorkspaceByName(@PathParam("name") String name) { return asRuntimeWorkspaceDto(workspaceManager.getRuntimeWorkspace(name, getCurrentUserId())); }

Target:
public RuntimeWorkspace getRuntimeWorkspaceByName(@PathParam("name") String name) { return asDto(workspaceManager.getRuntimeWorkspace(name, getCurrentUserId())); }
Source:
public void testQueryConsistencyOnFailover() throws Exception { int CLUSTER_SIZE = 2; try (LocalIgniteCluster cluster = LocalIgniteCluster.start(CLUSTER_SIZE); IgniteClient client = Ignition.startClient(new ClientConfiguration() .setAddresses(cluster.clientAddresses().toArray(new String[CLUSTER_SIZE]))) ) { ClientCache<Integer, Integer> cache = client.createCache("cache"); cache.put(0, 0); cache.put(1, 1); Query<Cache.Entry<Integer, String>> qry = new ScanQuery<Integer, String>().setPageSize(1); try (QueryCursor<Cache.Entry<Integer, String>> cur = cache.query(qry)) { int cnt = 0; for (Iterator<Cache.Entry<Integer, String>> it = cur.iterator(); it.hasNext(); it.next()) { cnt++; if (cnt == 1) dropAllThinClientConnections(Ignition.allGrids().get(0)); } assertEquals(2, cnt); } catch (ClientReconnectedException expected) { } } }

Target:
public void testQueryConsistencyOnFailover() throws Exception { int CLUSTER_SIZE = 2; try (LocalIgniteCluster cluster = LocalIgniteCluster.start(CLUSTER_SIZE); IgniteClient client = Ignition.startClient(new ClientConfiguration() .setAddresses(cluster.clientAddresses().toArray(new String[CLUSTER_SIZE]))) ) { ClientCache<Integer, Integer> cache = client.createCache("cache"); cache.put(0, 0); cache.put(1, 1); Query<Cache.Entry<Integer, String>> qry = new ScanQuery<Integer, String>().setPageSize(1); try (QueryCursor<Cache.Entry<Integer, String>> cur = cache.query(qry)) { int cnt = 0; for (Iterator<Cache.Entry<Integer, String>> it = cur.iterator(); it.hasNext(); it.next()) { cnt++; if (cnt == 1) { for (int i = 0; i < CLUSTER_SIZE; i++) dropAllThinClientConnections(Ignition.allGrids().get(i)); } } fail("ClientReconnectedException must be thrown"); } catch (ClientReconnectedException expected) { } } }
Source:
public int setCloseTime(int childSequenceNumber, long endTime) { int index = -1; for (int i = 0; i < nbChildren; i++) { if (childSequenceNumber == this.children[i]) { childEnd[i] = endTime; index = i; } } return index; }

Target:
public int setCloseTime(int childSequenceNumber, long endTime) { for (int i = 0; i < nbChildren; i++) { if (childSequenceNumber == this.children[i]) { childEnd[i] = endTime; return i; } } return -1; }
Source:
public String analyze() { long min = Long.MAX_VALUE; long max = Long.MIN_VALUE; long sum = 0L; for (long current : measurements) { if (current < min) { min = current; } if (current > max) { max = current; } sum += current; } String res = nanoToMillisString(sum / measurements.size()); if (measurements.size() > 1) { res += "(n: " + measurements.size() + "; min: " + nanoToMillisString(min) + "; max: " + nanoToMillisString(max) + ")"; } return res; }

Target:
public String analyze() { long min = Long.MAX_VALUE; long max = Long.MIN_VALUE; long sum = 0L; if (measurements.isEmpty()) { return "No measurements to analyze"; } for (long current : measurements) { if (current < min) { min = current; } if (current > max) { max = current; } sum += current; } String res = toMillisecondString(sum / measurements.size()); res += "(n: " + measurements.size() + "; min: " + toMillisecondString(min) + "; max: " + toMillisecondString(max) + ")"; return res; }
Source:
private boolean fillBuffer() { boolean status = false; try { enqueuePermits.acquire(); Bundle p = source.next(); if (p == null) { log.info("exiting on null bundle from {}", source); } else { totalBundles++; mapperPool.submit(new MapperTask(p)); status = true; } } catch (NoSuchElementException ignored) { log.info("exiting on premature stream termination"); } catch (InterruptedException ignored) { Thread.currentThread().interrupt(); status = true; } return status; }

Target:
private boolean fillBuffer() { boolean status = false; try { enqueuePermits.acquire(); Bundle p = source.next(); if (p == null) { log.info("exiting on null bundle from {}", source); } else { totalBundles++; CompletableFuture<Void> future = CompletableFuture.runAsync(() -> task.process(p), mapperPool); future.whenComplete((v, e) -> enqueuePermits.release()); status = true; } } catch (NoSuchElementException ignored) { log.info("exiting on premature stream termination"); } catch (InterruptedException ignored) { Thread.currentThread().interrupt(); status = true; } return status; }
Source:
public Object visit(ASTFieldDeclaration node, Object data) { if (!node.isStatic()) { return data; } ASTClassOrInterfaceType cit = node.getFirstDescendantOfType(ASTClassOrInterfaceType.class); if (cit == null || !TypeHelper.isA(cit, formatterClassToCheck)) { return data; } ASTVariableDeclaratorId var = node.getFirstDescendantOfType(ASTVariableDeclaratorId.class); if (var.getType() != null && Arrays.asList(threadSafeFormatter).contains(var.getType().getName())) { return data; } for (NameOccurrence occ : var.getUsages()) { Node n = occ.getLocation(); if (n.getFirstParentOfType(ASTSynchronizedStatement.class) != null) { continue; } if (!n.getImage().contains(".")) { continue; } ASTMethodDeclaration method = n.getFirstParentOfType(ASTMethodDeclaration.class); if (method != null && !method.isSynchronized()) { addViolation(data, n); } } return data; }

Target:
public Object visit(ASTFieldDeclaration node, Object data) { if (!node.isStatic()) { return data; } ASTClassOrInterfaceType cit = node.getFirstDescendantOfType(ASTClassOrInterfaceType.class); if (cit == null || !TypeHelper.isA(cit, formatterClassToCheck)) { return data; } ASTVariableDeclaratorId var = node.getFirstDescendantOfType(ASTVariableDeclaratorId.class); for (String formatter: THREAD_SAFE_FORMATTER) { if (TypeHelper.isA(var, formatter)) { return data; } } for (NameOccurrence occ : var.getUsages()) { Node n = occ.getLocation(); if (n.getFirstParentOfType(ASTSynchronizedStatement.class) != null) { continue; } if (!n.getImage().contains(".")) { continue; } ASTMethodDeclaration method = n.getFirstParentOfType(ASTMethodDeclaration.class); if (method != null && !method.isSynchronized()) { addViolation(data, n); } } return data; }
Source:
private void asyncFetch() { if (pointer != null && lastEndTimestamp.get() < query.getEndTimestamp()) { if (pointer.get() > Math.round((FETCH_PERCENTAGE * (lastEndTimestamp.get() - lastStartTimestamp.get()))) + lastStartTimestamp.get()) { fetch(); } } else { if (!query.getEndTimestamp().equals(lastEndTimestamp.get())) { fetch(); } } }

Target:
private void asyncFetch() { lock.readLock().lock(); Long point = null; Long lastEnd = null; Long lastStart = null; boolean fetch = true; try { point = pointer == null ? null : pointer.get(); lastEnd = lastEndTimestamp.get(); lastStart = lastStartTimestamp.get(); fetch = fetching.get(); } finally { lock.readLock().unlock(); } if (point != null && lastEnd < query.getEndTimestamp()) { if (point > Math.round((FETCH_PERCENTAGE * (lastEnd - lastStart))) + lastStart) { if (!fetch) { _startScheduledExecutorService(); } } } else { if (!query.getEndTimestamp().equals(lastEnd)) { if (!fetch) { _startScheduledExecutorService(); } } } }
Source:
public static OkHttpClient getClientPinnedIfAvailable(URL url, Proxy proxy) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.followRedirects(false) .followSslRedirects(false); if (proxy != null) { builder.proxy(proxy); builder.connectTimeout(30000, TimeUnit.MILLISECONDS) .readTimeout(45000, TimeUnit.MILLISECONDS); } else { builder.connectTimeout(5000, TimeUnit.MILLISECONDS) .readTimeout(25000, TimeUnit.MILLISECONDS); } TlsCertificatePinning tlsCertificatePinning = new TlsCertificatePinning(url); boolean isHttpsProtocol = url.getProtocol().equals("https"); boolean isPinAvailable = tlsCertificatePinning.isPinAvailable(); if (isHttpsProtocol && isPinAvailable) { tlsCertificatePinning.pinCertificate(builder); } return builder.build(); }

Target:
public static OkHttpClient getClientPinnedIfAvailable(URL url, Proxy proxy) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.followRedirects(false) .followSslRedirects(false); if (proxy != null) { builder.proxy(proxy); builder.connectTimeout(30000, TimeUnit.MILLISECONDS) .readTimeout(45000, TimeUnit.MILLISECONDS); } else { builder.connectTimeout(5000, TimeUnit.MILLISECONDS) .readTimeout(25000, TimeUnit.MILLISECONDS); } TlsCertificatePinning tlsCertificatePinning = new TlsCertificatePinning(url); boolean isHttpsProtocol = "https".equals(url.getProtocol()); boolean isPinAvailable = tlsCertificatePinning.isPinAvailable(); if (isHttpsProtocol && isPinAvailable) { tlsCertificatePinning.pinCertificate(builder); } return builder.build(); }
Source:
public DataAccountFetchesPage() { initWidget(uiBinder.createAndBindUi(this)); BootstrapGwtDatePicker.INSTANCE.styles().ensureInjected(); addColumns(); dataAccountFetchTable.setLoadingIndicator(new Image(Images.INSTANCE.preloader())); dataAccountFetchTable.setEmptyTableWidget(new HTMLPanel("<h6>No Data Account Fetches</h6>")); DataAccountFetchController.get().addDataDisplay(dataAccountFetchTable); simplePager.setDisplay(dataAccountFetchTable); List<PresetDateRange> dateSelectorPresetRanges = new ArrayList<PresetDateRange>(); dateSelectorPresetRanges.add(new PresetDateRange() { @Override public String getName() { return "1 day"; } @Override public DateRange getDateRange() { return FilterHelper.createRange(FilterHelper.getDaysAgo(1), FilterHelper.getToday()); } }); dateSelectorPresetRanges.add(new PresetDateRange() { @Override public String getName() { return "1 wk"; } @Override public DateRange getDateRange() { return FilterHelper.createRange(FilterHelper.getWeeksAgo(1), FilterHelper.getToday()); } }); dateSelectorPresetRanges.add(new PresetDateRange() { @Override public String getName() { return "2 wks"; } @Override public DateRange getDateRange() { return FilterHelper.createRange(FilterHelper.getWeeksAgo(2), FilterHelper.getToday()); } }); dateSelectorPresetRanges.add(new PresetDateRange() { @Override public String getName() { return "30 days"; } @Override public DateRange getDateRange() { return FilterHelper.createRange(FilterHelper.getDaysAgo(30), FilterHelper.getToday()); } }); dateSelector.addFixedRanges(dateSelectorPresetRanges); updateFromFilter(); }

Target:
public DataAccountFetchesPage() { initWidget(uiBinder.createAndBindUi(this)); BootstrapGwtDatePicker.INSTANCE.styles().ensureInjected(); addColumns(); dataAccountFetchTable.setLoadingIndicator(new Image(Images.INSTANCE.preloader())); dataAccountFetchTable.setEmptyTableWidget(new HTMLPanel("<h6>No Data Account Fetches</h6>")); DataAccountFetchController.get().addDataDisplay(dataAccountFetchTable); simplePager.setDisplay(dataAccountFetchTable); dateSelector.addFixedRanges(FilterHelper.getAdminDateRanges()); updateFromFilter(); }
Source:
public SelectedCounterQueryFilter(long start, long end, int n, Collection<Long> ids, boolean isCumulative) { super(start, end, n, ImmutableList.copyOf(ids)); fIsCumulative = isCumulative; }

Target:
public SelectedCounterQueryFilter(long start, long end, int n, Collection<Long> ids, boolean isCumulative) { super(start, end, n, ids); fIsCumulative = isCumulative; }
Source:
public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException { RestPage<TaskStateData> page = null; SortSpecifierRestContainer sortContainer = new SortSpecifierRestContainer(sortParams.toString()); try { page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit, sortContainer); } catch (NotConnectedRestException e) { throw new NotConnectedException(e); } catch (PermissionRestException e) { throw new PermissionException(e); } List<TaskState> lTaskStates = new ArrayList<TaskState>(page.getList().size()); for (TaskStateData taskStateData : page.getList()) { lTaskStates.add(new TaskStateImpl(taskStateData)); } return new Page<TaskState>(lTaskStates, page.getSize()); }

Target:
public Page<TaskState> getTaskStates(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit, SortSpecifierContainer sortParams) throws NotConnectedException, PermissionException { RestPage<TaskStateData> page = null; SortSpecifierContainer sortContainer = new SortSpecifierContainer(sortParams.toString()); try { page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit, sortContainer); } catch (NotConnectedRestException e) { throw new NotConnectedException(e); } catch (PermissionRestException e) { throw new PermissionException(e); } List<TaskState> lTaskStates = new ArrayList<TaskState>(page.getList().size()); for (TaskStateData taskStateData : page.getList()) { lTaskStates.add(new TaskStateImpl(taskStateData)); } return new Page<TaskState>(lTaskStates, page.getSize()); }
Source:
public static void deployArtifacts() { KieServerDeployer.buildAndDeployCommonMavenParent(); KieServerDeployer.buildAndDeployMavenProject(ClassLoader.class.getResource("/kjars-sources/cloudbalance").getFile()); kieContainer = KieServices.Factory.get().newKieContainer(kjar1); KieServicesClient client = createDefaultStaticClient(EXTENDED_TIMEOUT); ServiceResponse<KieContainerResource> reply = client.createContainer(CONTAINER_1_ID, new KieContainerResource(CONTAINER_1_ID, kjar1)); Assume.assumeTrue(reply.getType().equals(ServiceResponse.ResponseType.SUCCESS)); }

Target:
public static void deployArtifacts() { KieServerDeployer.buildAndDeployCommonMavenParent(); KieServerDeployer.buildAndDeployMavenProject(ClassLoader.class.getResource("/kjars-sources/cloudbalance").getFile()); kieContainer = KieServices.Factory.get().newKieContainer(kjar1); KieServicesClient client = createDefaultStaticClient(EXTENDED_TIMEOUT); ServiceResponse<KieContainerResource> reply = client.createContainer(CONTAINER_1_ID, new KieContainerResource(CONTAINER_1_ID, kjar1)); KieServerAssert.assertSuccess(reply); }
Source:
private LocationEntity createDemoLocationEntity(Long id, String uuid, String name, String description, String display) { LocationEntity entity = new LocationEntity(""); entity.setId(id); entity.setDisplay(display); entity.setUuid(uuid); entity.setName(name); entity.setDescription(description); entity.setAddress_1("address 1"); entity.setAddress_2("address2"); entity.setCity("city"); entity.setState("state"); entity.setCountry("country"); entity.setPostalCode("postal code"); entity.setParentLocationuuid("location"); return entity; }

Target:
private LocationEntity createDemoLocationEntity(Long id, String uuid, String name, String description, String display) { LocationEntity entity = new LocationEntity(ApplicationConstants.EMPTY_STRING); entity.setId(id); entity.setDisplay(display); entity.setUuid(uuid); entity.setName(name); entity.setDescription(description); entity.setAddress_1("address 1"); entity.setAddress_2("address2"); entity.setCity("city"); entity.setState("state"); entity.setCountry("country"); entity.setPostalCode("postal code"); entity.setParentLocationuuid("location"); return entity; }
Source:
public void onNext(final Message<ShuffleControlMessage> message) { final ShuffleControlMessage controlMessage = message.getData().iterator().next(); final String endPointId = message.getSrcId().toString(); switch (controlMessage.getCode()) { case PushShuffleCode.SENDER_INITIALIZED: stateManager.onSenderInitialized(endPointId); break; case PushShuffleCode.SENDER_FINISHED: stateManager.onSenderFinished(endPointId); break; case PushShuffleCode.RECEIVER_INITIALIZED: stateManager.onReceiverInitialized(endPointId); break; case PushShuffleCode.RECEIVER_COMPLETED: stateManager.onReceiverCompleted(endPointId); break; case PushShuffleCode.RECEIVER_READY: stateManager.onReceiverReady(endPointId); break; case PushShuffleCode.RECEIVER_FINISHED: stateManager.onReceiverFinished(endPointId); break; default: throw new IllegalStateException("Unknown code " + controlMessage.getCode() + " from " + endPointId); } }

Target:
public void onNext(final Message<ShuffleControlMessage> message) { final ShuffleControlMessage controlMessage = message.getData().iterator().next(); final String endPointId = message.getSrcId().toString(); switch (controlMessage.getCode()) { case PushShuffleCode.SENDER_INITIALIZED: stateManager.onSenderInitialized(endPointId); break; case PushShuffleCode.SENDER_FINISHED: stateManager.onSenderFinished(endPointId); break; case PushShuffleCode.RECEIVER_INITIALIZED: stateManager.onReceiverInitialized(endPointId); break; case PushShuffleCode.RECEIVER_COMPLETED: stateManager.onReceiverCompleted(endPointId); break; case PushShuffleCode.RECEIVER_READIED: stateManager.onReceiverReadied(endPointId); break; case PushShuffleCode.RECEIVER_FINISHED: stateManager.onReceiverFinished(endPointId); break; default: throw new IllegalStateException("Unknown code " + controlMessage.getCode() + " from " + endPointId); } }
Source:
private static RepositoryPath rebase(RepositoryPath source, RepositoryPath targetBase) { FileSystem sourceFileSystem = source.getTarget().getFileSystem(); FileSystem targetFileSystem = targetBase.getTarget().getFileSystem(); String sourceRelative = source.getRoot() .relativize(source.getTarget()) .toString(); String sTargetPath = sourceRelative.replaceAll(sourceFileSystem.getSeparator(), targetFileSystem.getSeparator()); RepositoryPath target = targetBase.resolve(sTargetPath); return target; }

Target:
private static RepositoryPath rebase(RepositoryPath source, RepositoryPath targetBase) { FileSystem sourceFileSystem = source.getTarget().getFileSystem(); FileSystem targetFileSystem = targetBase.getTarget().getFileSystem(); String sourceRelative = source.getRoot() .relativize(source.getTarget()) .toString(); String sTargetPath = sourceRelative.replaceAll(sourceFileSystem.getSeparator(), targetFileSystem.getSeparator()); return targetBase.resolve(sTargetPath); }
Source:
@Override public ClientResponse process(ClientConnectionContext ctx) { ClientComputeTask task = new ClientComputeTask(ctx); ctx.incrementActiveTasksCount(); long taskId = ctx.resources().put(task); try { Object arg0 = arg; if ((flags & ClientComputeTask.KEEP_BINARY_FLAG_MASK) == 0 && arg instanceof BinaryObject) { arg0 = ((BinaryObject)arg).deserialize(); } task.execute(taskId, taskName, arg0, nodeIds, flags, timeout); } catch (Exception e) { ctx.resources().release(taskId); throw e; } return new ClientExecuteTaskResponse(requestId(), task); }

Target:
@Override public ClientResponse process(ClientConnectionContext ctx) { ClientComputeTask task = new ClientComputeTask(ctx); ctx.incrementActiveTasksCount(); long taskId = ctx.resources().put(task); try { Object arg0 = arg; if ((flags & ClientComputeTask.KEEP_BINARY_FLAG_MASK) == 0 && arg instanceof BinaryObject) arg0 = ((BinaryObject) arg).deserialize(); task.execute(taskId, taskName, arg0, nodeIds, flags, timeout); } catch (Exception e) { ctx.resources().release(taskId); throw e; } return new ClientExecuteTaskResponse(requestId(), task); }
Source:
public FarObject toFarObject() { FarObject farObject = new FarObject() { @Override public boolean shouldBeRemoved(SolGame game) { return false; } @Override public SolObject toObject(SolGame game) { for(Waypoint waypoint : game.getHero().getWaypoints()) if(waypoint.position.x == position.x && waypoint.position.y == position.y) return waypoint; System.out.println("RETURNDED NUL L"); return null; } @Override public void update(SolGame game) { } @Override public float getRadius() { return 0; } @Override public Vector2 getPosition() { return position; } @Override public String toDebugString() { return "Waypoint"; } @Override public boolean hasBody() { return false; } }; return farObject; }

Target:
public FarObject toFarObject() { FarObject farObject = new FarObject() { @Override public boolean shouldBeRemoved(SolGame game) { return false; } @Override public SolObject toObject(SolGame game) { for (Waypoint waypoint : game.getHero().getWaypoints()) if (waypoint.position.equals(position)) { return waypoint; } return null; } @Override public void update(SolGame game) { } @Override public float getRadius() { return 0; } @Override public Vector2 getPosition() { return position; } @Override public String toDebugString() { return "Waypoint"; } @Override public boolean hasBody() { return false; } }; return farObject; }
Source:
public void buildGraph( Graph graph, HashMap<Class<?>, Object> extra, DataImportIssueStore issueStore ) { LOG.info("Linking transit stops to tagged bus stops..."); index = new StreetVertexIndex(graph); ArrayList<Vertex> vertices = new ArrayList<>(); vertices.addAll(graph.getVertices()); for (TransitStopVertex ts : Iterables.filter(vertices, TransitStopVertex.class)) { boolean alreadyLinked = false; for(Edge e:ts.getOutgoing()){ if(e instanceof StreetTransitLink) { alreadyLinked = true; break; } } if(alreadyLinked) continue; if (!ts.isStreetLinkable()) { boolean wheelchairAccessible = ts.hasWheelchairEntrance(); if (!connectVertexToStop(ts, wheelchairAccessible)) { LOG.debug("Could not connect " + ts.getStop().getCode() + " at " + ts.getCoordinate().toString()); } } } }

Target:
public void buildGraph( Graph graph, HashMap<Class<?>, Object> extra, DataImportIssueStore issueStore ) { LOG.info("Linking transit stops to tagged bus stops..."); index = new StreetVertexIndex(graph); ArrayList<Vertex> vertices = new ArrayList<>(); vertices.addAll(graph.getVertices()); for (TransitStopVertex ts : Iterables.filter(vertices, TransitStopVertex.class)) { boolean alreadyLinked = false; for(Edge e:ts.getOutgoing()){ if(e instanceof StreetTransitLink) { alreadyLinked = true; break; } } if(alreadyLinked) continue; if (!ts.hasPathways()) { boolean wheelchairAccessible = ts.hasWheelchairEntrance(); if (!connectVertexToStop(ts, wheelchairAccessible)) { LOG.debug("Could not connect " + ts.getStop().getCode() + " at " + ts.getCoordinate().toString()); } } } }
Source:
public void doAction() throws Exception { logger.info("ready to do action " + getDescription()); FlowRunnerManager flowRunnerManager = ServiceProvider.SERVICE_PROVIDER.getInstance(FlowRunnerManager.class); flowRunnerManager.cancelJobBySLA(execId, jobId); }

Target:
public void doAction() throws Exception { logger.info("ready to do action " + getDescription()); final FlowRunnerManager flowRunnerManager = ServiceProvider.SERVICE_PROVIDER .getInstance(FlowRunnerManager.class); flowRunnerManager.cancelJobBySLA(this.execId, this.jobId); }
Source:
static void checkType(Object obj) { if (obj instanceof String || obj instanceof Integer || obj instanceof Long || obj instanceof Boolean || obj instanceof Double || obj instanceof Float || obj instanceof Short || obj instanceof Byte || obj instanceof Character || obj instanceof byte[] || obj instanceof JsonObject || obj instanceof JsonArray || obj instanceof Shareable) { } else { throw new IllegalArgumentException("Invalid type for shareddata data structure: " + obj.getClass().getName()); } }

Target:
static void checkType(Object obj) { if (obj instanceof String || obj instanceof Integer || obj instanceof Long || obj instanceof Boolean || obj instanceof Double || obj instanceof Float || obj instanceof Short || obj instanceof Byte || obj instanceof Character || obj instanceof byte[] || obj instanceof Shareable) { } else { throw new IllegalArgumentException("Invalid type for shareddata data structure: " + obj.getClass().getName()); } }