auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CustomProcessorInfo removeCustomProcessorInfoAsBundle(String name) throws IOException { List<QueryParam> queryParams = new ArrayList<>(); queryParams.add(new QueryParam(CustomProcessorInfo.NAME, name)); Collection<TopologyComponentBundle> result = this.listCustomProcessorBundlesWithFilter(queryParams); if (result.isEmpty() || result.size() != 1) { throw new IOException("Failed to delete custom processor with name:" + name); } TopologyComponentBundle customProcessorBundle = result.iterator().next(); Collection<TopologyProcessor> processors = this.listTopologyProcessors(); if (processors != null && !processors.isEmpty()) { for (TopologyProcessor topologyProcessor: processors) { if (topologyProcessor.getTopologyComponentBundleId().equals(customProcessorBundle.getId())) { throw new IOException("Cannot delete custom processor as it is being used in one of the topologies."); } } } CustomProcessorInfo customProcessorInfo = new CustomProcessorInfo(); this.removeTopologyComponentBundle(customProcessorBundle.getId()); return customProcessorInfo.fromTopologyComponentBundle(customProcessorBundle); }

Target:
public CustomProcessorInfo removeCustomProcessorInfoAsBundle(String name) throws IOException { List<QueryParam> queryParams = new ArrayList<>(); queryParams.add(new QueryParam(CustomProcessorInfo.NAME, name)); Collection<TopologyComponentBundle> result = this.listCustomProcessorBundlesWithFilter(queryParams); if (result.isEmpty() || result.size() != 1) { throw new IOException("Failed to delete custom processor with name:" + name); } TopologyComponentBundle customProcessorBundle = result.iterator().next(); Collection<TopologyProcessor> processors = this.listTopologyProcessors(); if (processors != null && !processors.isEmpty()) { for (TopologyProcessor topologyProcessor: processors) { if (topologyProcessor.getTopologyComponentBundleId().equals(customProcessorBundle.getId())) { throw new IOException("Cannot delete custom processor as it is being used in one of the topologies."); } } } this.removeTopologyComponentBundle(customProcessorBundle.getId()); return new CustomProcessorInfo().fromTopologyComponentBundle(customProcessorBundle); }
Source:
public DataSet createDataset(DataSetDTO dataset, String name, Integer userId) { Date date = new Date(); long time = date.getTime(); Timestamp now = new Timestamp(time); int lastAlias = dataSetDAO.findLastAlias(); int alias = lastAlias + 1; Integer id = dataSetDAO .insertDatasetV2(name, now, userId, dataset.getObjectId(), dataset.getActive(), alias); List<DataSetProperty> propertyList = processDatasetProperties(id, dataset.getProperties()); dataSetDAO.insertDataSetsProperties(propertyList); return getDatasetWithPropertiesById(id); }

Target:
public DataSet createDataset(DataSetDTO dataset, String name, Integer userId) { Timestamp now = new Timestamp(new Date().getTime()); int lastAlias = dataSetDAO.findLastAlias(); int alias = lastAlias + 1; Integer id = dataSetDAO .insertDatasetV2(name, now, userId, dataset.getObjectId(), dataset.getActive(), alias); List<DataSetProperty> propertyList = processDatasetProperties(id, dataset.getProperties()); dataSetDAO.insertDataSetsProperties(propertyList); return getDatasetWithPropertiesById(id); }
Source:
protected boolean isExceedSize(long sizeToCheck) { if (overallHregionFiles) { long sumSize = 0; for (HStore store : region.getStores()) { sumSize += store.getSize(); } if (sumSize > sizeToCheck) { LOG.debug("ShouldSplit because region size is big enough " + "size={}, sizeToCheck={}{}", StringUtils.humanSize(sumSize), StringUtils.humanSize(sizeToCheck)); return true; } } else { for (HStore store : region.getStores()) { long size = store.getSize(); if (size > sizeToCheck) { LOG.debug("ShouldSplit because size={}, sizeToCheck={}{}", store.getColumnFamilyName(), StringUtils.humanSize(size), StringUtils.humanSize(sizeToCheck)); return true; } } } return false; }

Target:
protected final boolean isExceedSize(long sizeToCheck) { if (overallHRegionFiles) { long sumSize = 0; for (HStore store : region.getStores()) { sumSize += store.getSize(); } if (sumSize > sizeToCheck) { LOG.debug("ShouldSplit because region size is big enough " + "size={}, sizeToCheck={}{}", StringUtils.humanSize(sumSize), StringUtils.humanSize(sizeToCheck)); return true; } } else { for (HStore store : region.getStores()) { long size = store.getSize(); if (size > sizeToCheck) { LOG.debug("ShouldSplit because size={}, sizeToCheck={}{}", store.getColumnFamilyName(), StringUtils.humanSize(size), StringUtils.humanSize(sizeToCheck)); return true; } } } return false; }
Source:
protected String scheduleJob() throws Exception { if (schedule.getExecutionTime() != null) { Time convertedTime = GlusterUtil.getInstance() .convertTime(schedule.getExecutionTime(), schedule.getTimeZone()); schedule.setExecutionTime(convertedTime); } Date convertedStartDate = getGlusterUtil().convertDate(schedule.getStartDate(), schedule.getTimeZone()); Date convertedEndByDate = getGlusterUtil().convertDate(schedule.getEndByDate(), schedule.getTimeZone()); String cronExpression = GlusterUtil.getInstance().getCronExpression(schedule); if (cronExpression == null) throw new Exception("Unbale to form cron expression for schedule. Invalid scheduling details."); return getDbSchedulUtil().scheduleACronJob(new GlusterSnapshotScheduleJob(), "onTimer", new Class[] { String.class, String.class, String.class, String.class, Boolean.class }, new Object[] { upServer.getId().toString(), getGlusterVolumeId().toString(), schedule.getSnapshotNamePrefix(), schedule.getSnapshotDescription(), force }, cronExpression, convertedStartDate, convertedEndByDate); }

Target:
protected String scheduleJob() { if (schedule.getExecutionTime() != null) { Time convertedTime = GlusterUtil.getInstance() .convertTime(schedule.getExecutionTime(), schedule.getTimeZone()); schedule.setExecutionTime(convertedTime); } Date convertedStartDate = getGlusterUtil().convertDate(schedule.getStartDate(), schedule.getTimeZone()); Date convertedEndByDate = getGlusterUtil().convertDate(schedule.getEndByDate(), schedule.getTimeZone()); String cronExpression = GlusterUtil.getInstance().getCronExpression(schedule); if (cronExpression == null) throw new RuntimeException("Unable to form cron expression for schedule. Invalid scheduling details."); return getDbSchedulUtil().scheduleACronJob(new GlusterSnapshotScheduleJob(), "onTimer", new Class[] { String.class, String.class, String.class, String.class, Boolean.class }, new Object[] { upServer.getId().toString(), getGlusterVolumeId().toString(), schedule.getSnapshotNamePrefix(), schedule.getSnapshotDescription(), force }, cronExpression, convertedStartDate, convertedEndByDate); }
Source:
private SocketProtocol negotiateProtocol() throws IOException { logger.debug( "[HANDSHAKE] [1, 0, 0, 0]." ); ByteBuffer buf = ByteBuffer.wrap( new byte[]{ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ); while ( buf.remaining() > 0 ) { channel.write( buf ); logger.trace( "C: " + BytePrinter.hex( buf ) ); } buf.clear(); buf.limit( 4 ); while ( buf.remaining() > 0 ) { int start = buf.position(); channel.read( buf ); logger.trace( "S: " + BytePrinter.hex( buf, start, buf.position() ) ); } buf.flip(); final int proposal = buf.getInt(); switch ( proposal ) { case 1: logger.debug( "[HANDSHAKE] 1" ); return new SocketProtocolV1( channel, logger ); case 0: throw new ClientException( "The server does not support any of the protocol versions supported by " + "this driver. Ensure that you are using driver and server versions that " + "are compatible with one another." ); default: throw new ClientException( "Protocol error, server suggested unexpected protocol version: " + proposal ); } }

Target:
private SocketProtocol negotiateProtocol() throws IOException { logger.debug( "~~ [HANDSHAKE] [1, 0, 0, 0]." ); ByteBuffer buf = ByteBuffer.wrap( new byte[]{ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ); channel.write( buf ); buf.clear(); buf.limit( 4 ); channel.read( buf ); buf.flip(); final int proposal = buf.getInt(); switch ( proposal ) { case 1: logger.debug( "~~ [HANDSHAKE] 1" ); return new SocketProtocolV1( channel ); case 0: throw new ClientException( "The server does not support any of the protocol versions supported by " + "this driver. Ensure that you are using driver and server versions that " + "are compatible with one another." ); default: throw new ClientException( "Protocol error, server suggested unexpected protocol version: " + proposal ); } }
Source:
static ChannelStateByteBuffer wrap(byte[] bytes) { int written = 0; return new ChannelStateByteBuffer() { @Override public boolean isWritable() { return written < bytes.length; } @Override public int writableBytes() { return bytes.length - written; } @Override public int writeBytes(InputStream input, int bytesToRead) throws IOException { return input.read(bytes, written, writableBytes()); } }; }

Target:
static ChannelStateByteBuffer wrap(byte[] bytes) { return new ChannelStateByteBuffer() { private int written = 0; @Override public boolean isWritable() { return written < bytes.length; } @Override public int writeBytes(InputStream input, int bytesToRead) throws IOException { final int bytesRead = input.read(bytes, written, bytes.length - written); written += bytesRead; return bytesRead; } }; }
Source:
public void testAbortedParentProcessAndChildProcessInProcessInstanceListWithNotIndenpendentSubProcess() { assertNotNull(deploymentService); KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION); deploymentService.deploy(deploymentUnit); units.add(deploymentUnit); assertNotNull(processService); boolean isDeployed = deploymentService.isDeployed(deploymentUnit.getIdentifier()); assertTrue(isDeployed); assertNotNull(processService); long parentProcessInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "testone.parentWithNotIndepententSubProcess"); assertNotNull(parentProcessInstanceId); ProcessInstance pi = processService.getProcessInstance(parentProcessInstanceId); assertNotNull(pi); ProcessInstance subPiOne = processService.getProcessInstance(2l); ProcessInstance subPiTwo = processService.getProcessInstance(3l); assertNotNull(subPiOne); assertNotNull(subPiTwo); assertEquals(parentProcessInstanceId, subPiOne.getParentProcessInstanceId()); assertEquals(parentProcessInstanceId, subPiTwo.getParentProcessInstanceId()); List<Long> processInstanceList = Arrays.asList(new Long[]{parentProcessInstanceId, 2l, 3l}); processService.abortProcessInstances(processInstanceList); ProcessInstance parent = processService.getProcessInstance(parentProcessInstanceId); assertNull(parent); ProcessInstance childOne = processService.getProcessInstance(2l); ProcessInstance childTwo = processService.getProcessInstance(3l); assertNull(childOne); assertNull(childTwo); }

Target:
public void testAbortedParentProcessAndChildProcessInProcessInstanceListWithNotIndenpendentSubProcess() { assertNotNull(deploymentService); KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(GROUP_ID, ARTIFACT_ID, VERSION); deploymentService.deploy(deploymentUnit); units.add(deploymentUnit); assertNotNull(processService); boolean isDeployed = deploymentService.isDeployed(deploymentUnit.getIdentifier()); assertTrue(isDeployed); assertNotNull(processService); long parentProcessInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "testone.parentWithNotIndepententSubProcess"); assertNotNull(parentProcessInstanceId); ProcessInstance pi = processService.getProcessInstance(parentProcessInstanceId); assertNotNull(pi); testResultForAbortedParentProcessAndChildProcessInProcessInstanceList(parentProcessInstanceId); }
Source:
LocalDateTime extractExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { LocalDateTime expiry = null; if (args.containsKey(HttpHeaders.EXPIRES.toLowerCase())) { expiry = extractV2ExpiryDate(args, effectiveTimeZone); } else if (args.containsKey(SignerConstants.X_AMZ_EXPIRES.toLowerCase()) && (args.containsKey(SignerConstants.X_AMZ_DATE.toLowerCase()))) { expiry = extractV4ExpiryDate(args, effectiveTimeZone); } else { log.error("Could not identify expected date parameters in request: {}", flattenMap(args)); throw new IllegalArgumentException( String.format("Could not parse presigned URL - missing expected expiry date parameters")); } System.out.printf("Expiry DateTime (Local): %s%n", expiry); return expiry; }

Target:
LocalDateTime extractExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { LocalDateTime expiry = null; if (args.containsKey(HttpHeaders.EXPIRES.toLowerCase())) { expiry = extractV2ExpiryDate(args, effectiveTimeZone); } else if (args.containsKey(SignerConstants.X_AMZ_EXPIRES.toLowerCase()) && (args.containsKey(SignerConstants.X_AMZ_DATE.toLowerCase()))) { expiry = extractV4ExpiryDate(args, effectiveTimeZone); } else { log.error("Could not identify expected date parameters in request: {}", flattenMap(args)); throw new IllegalArgumentException("Could not parse presigned URL - missing expected expiry date parameters"); } log.debug("Expiry DateTime (Local): {}\n", expiry); return expiry; }
Source:
public static File writeOffsetFile(File storeBaseDir, String storeName, TaskName taskName, Map<SystemStreamPartition, String> offsets) throws IOException { File offsetFile = new File(getStorePartitionDir(storeBaseDir, storeName, taskName), OFFSET_FILE_NAME); String fileContents = OBJECT_WRITER.writeValueAsString(offsets); FileUtil.writeWithChecksum(offsetFile, fileContents); return offsetFile; }

Target:
public static void writeOffsetFile(File storeBaseDir, String storeName, TaskName taskName, Map<SystemStreamPartition, String> offsets) throws IOException { File offsetFile = new File(getStorePartitionDir(storeBaseDir, storeName, taskName), OFFSET_FILE_NAME); String fileContents = OBJECT_WRITER.writeValueAsString(offsets); FileUtil.writeWithChecksum(offsetFile, fileContents); }
Source:
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length > 0 && (args[0].contains("rem") || args[0].contains("off") || args[0].equalsIgnoreCase("0"))) { final PlayerInventory inv = user.getBase().getInventory(); final ItemStack head = inv.getHelmet(); if (head == null || head.getType() == Material.AIR) { user.sendMessage(tl("hatEmpty")); } else { final ItemStack air = new ItemStack(Material.AIR); inv.setHelmet(air); InventoryWorkaround.addItems(user.getBase().getInventory(), head); user.sendMessage(tl("hatRemoved")); } } else { final ItemStack hand = user.getItemInHand(); if (hand != null && hand.getType() != Material.AIR) { if (user.isAuthorized("essentials.hat.exempt." + hand.getType().name())) { user.sendMessage(tl("hatFail")); return; } if (hand.getType().getMaxDurability() == 0) { final PlayerInventory inv = user.getBase().getInventory(); final ItemStack head = inv.getHelmet(); inv.setHelmet(hand); inv.setItemInHand(head); user.sendMessage(tl("hatPlaced")); } else { user.sendMessage(tl("hatArmor")); } } else { user.sendMessage(tl("hatFail")); } } }

Target:
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { if (args.length > 0 && (args[0].contains("rem") || args[0].contains("off") || args[0].equalsIgnoreCase("0"))) { final PlayerInventory inv = user.getBase().getInventory(); final ItemStack head = inv.getHelmet(); if (head == null || head.getType() == Material.AIR) { user.sendMessage(tl("hatEmpty")); } else { final ItemStack air = new ItemStack(Material.AIR); inv.setHelmet(air); InventoryWorkaround.addItems(user.getBase().getInventory(), head); user.sendMessage(tl("hatRemoved")); } } else { final ItemStack hand = user.getItemInHand(); if (hand != null && hand.getType() != Material.AIR) { if (user.isAuthorized("essentials.hat.prevent-type." + hand.getType().name().toLowerCase())) { user.sendMessage(tl("hatFail")); return; } if (hand.getType().getMaxDurability() == 0) { final PlayerInventory inv = user.getBase().getInventory(); final ItemStack head = inv.getHelmet(); inv.setHelmet(hand); inv.setItemInHand(head); user.sendMessage(tl("hatPlaced")); } else { user.sendMessage(tl("hatArmor")); } } else { user.sendMessage(tl("hatFail")); } } }
Source:
private static boolean isLookExist(String lookName) { try { String selectedLook = lookSettings.getString(lookName); SettingBundle look = ResourceLocator.getSettingBundle(selectedLook); return look.exists(); } catch (MissingResourceException e) { return false; } }

Target:
private static boolean isLookExist(String lookName) { try { String selectedLook = lookSettings.getString(lookName); SettingBundle look = ResourceLocator.getSettingBundle(selectedLook); return look.exists(); } catch (MissingResourceException e) { SilverLogger.getLogger(GraphicElementFactory.class) .warn("Look named '"+lookName+" not found", e); return false; } }
Source:
protected void updateParametersVmFromInstanceType() { InstanceType instanceType = getInstanceType(); VmStatic vmStatic = getParameters().getVmStaticData(); if (instanceType != null && vmStatic != null) { vmStatic.setMemSizeMb(instanceType.getMemSizeMb()); vmStatic.setNumOfSockets(instanceType.getNumOfSockets()); vmStatic.setCpuPerSocket(instanceType.getCpuPerSocket()); vmStatic.setDefaultBootSequence(instanceType.getDefaultBootSequence()); vmStatic.setDefaultDisplayType(instanceType.getDefaultDisplayType()); vmStatic.setPriority(instanceType.getPriority()); vmStatic.setMinAllocatedMem(instanceType.getMinAllocatedMem()); vmStatic.setTunnelMigration(instanceType.getTunnelMigration()); getParameters().setSoundDeviceEnabled(!VmDeviceUtils.getSoundDevices(instanceType.getId()).isEmpty()); getParameters().setVirtioScsiEnabled(!VmDeviceUtils.getVirtioScsiControllers(instanceType.getId()).isEmpty()); getParameters().setUpdateWatchdog(true); List<VmDevice> vmDevices = VmDeviceUtils.getWatchdogs(instanceType.getId()); if (!vmDevices.isEmpty()) { vmDevices.get(0).setVmId(getVmId()); getParameters().setWatchdog(new VmWatchdog(vmDevices.get(0))); } getParameters().setUpdateRngDevice(true); vmDevices = getVmDeviceDao().getVmDeviceByVmIdAndType(instanceType.getId(), VmDeviceGeneralType.RNG); if (!vmDevices.isEmpty()) { vmDevices.get(0).setVmId(getVmId()); getParameters().setRngDevice(new VmRngDevice(vmDevices.get(0))); } } }

Target:
protected void updateParametersVmFromInstanceType() { InstanceType instanceType = getInstanceType(); VmStatic vmStatic = getParameters().getVmStaticData(); if (instanceType != null) { vmStatic.setMemSizeMb(instanceType.getMemSizeMb()); vmStatic.setNumOfSockets(instanceType.getNumOfSockets()); vmStatic.setCpuPerSocket(instanceType.getCpuPerSocket()); vmStatic.setDefaultBootSequence(instanceType.getDefaultBootSequence()); vmStatic.setDefaultDisplayType(instanceType.getDefaultDisplayType()); vmStatic.setPriority(instanceType.getPriority()); vmStatic.setMinAllocatedMem(instanceType.getMinAllocatedMem()); vmStatic.setTunnelMigration(instanceType.getTunnelMigration()); getParameters().setSoundDeviceEnabled(!VmDeviceUtils.getSoundDevices(instanceType.getId()).isEmpty()); getParameters().setVirtioScsiEnabled(!VmDeviceUtils.getVirtioScsiControllers(instanceType.getId()).isEmpty()); getParameters().setUpdateWatchdog(true); List<VmDevice> vmDevices = VmDeviceUtils.getWatchdogs(instanceType.getId()); if (!vmDevices.isEmpty()) { vmDevices.get(0).setVmId(getVmId()); getParameters().setWatchdog(new VmWatchdog(vmDevices.get(0))); } getParameters().setUpdateRngDevice(true); vmDevices = getVmDeviceDao().getVmDeviceByVmIdAndType(instanceType.getId(), VmDeviceGeneralType.RNG); if (!vmDevices.isEmpty()) { vmDevices.get(0).setVmId(getVmId()); getParameters().setRngDevice(new VmRngDevice(vmDevices.get(0))); } } }
Source:
public static Collection<CidrAddress> getAllInterfaceAddresses() { Collection<CidrAddress> interfaceIPs = new ArrayList<>(); Enumeration<NetworkInterface> en; try { en = NetworkInterface.getNetworkInterfaces(); } catch (SocketException ex) { LOGGER.error("Could not find interface IP addresses: {}", ex.getMessage(), ex); return interfaceIPs; } while (en.hasMoreElements()) { NetworkInterface networkInterface = en.nextElement(); try { if (!networkInterface.isUp() || networkInterface.isLoopback()) { continue; } } catch (SocketException ignored) { continue; } for (InterfaceAddress cidr : networkInterface.getInterfaceAddresses()) { interfaceIPs.add(new CidrAddress(cidr.getAddress(), cidr.getNetworkPrefixLength())); } } return interfaceIPs; }

Target:
public static Collection<CidrAddress> getAllInterfaceAddresses() { Collection<CidrAddress> interfaceIPs = new ArrayList<>(); Enumeration<NetworkInterface> en; try { en = NetworkInterface.getNetworkInterfaces(); } catch (SocketException ex) { LOGGER.error("Could not find interface IP addresses: {}", ex.getMessage(), ex); return interfaceIPs; } while (en.hasMoreElements()) { NetworkInterface networkInterface = en.nextElement(); try { if (!networkInterface.isUp() || networkInterface.isLoopback()) { continue; } } catch (SocketException ignored) { continue; } for (InterfaceAddress cidr : networkInterface.getInterfaceAddresses()) { final InetAddress address = cidr.getAddress(); assert address != null; interfaceIPs.add(new CidrAddress(address, cidr.getNetworkPrefixLength())); } } return interfaceIPs; }
Source:
public String getFirstIndexForAlias(String aliasName) { ImmutableOpenMap<String, List<AliasMetaData>> aliases = client.admin().indices().prepareGetAliases(aliasName).get().getAliases(); for(Iterator<String> it = aliases.keysIt(); it.hasNext(); ) { String indexName = it.next(); if (aliases.get(indexName).isEmpty()) { continue; } return indexName; } return null; }

Target:
public String getFirstIndexForAlias(String aliasName) { ImmutableOpenMap<String, List<AliasMetaData>> aliases = client.admin() .indices() .prepareGetAliases(aliasName) .get() .getAliases(); for (Iterator<String> it = aliases.keysIt(); it.hasNext();) { String indexName = it.next(); if (!aliases.get(indexName).isEmpty()) { return indexName; } } return null; }
Source:
private void syncFromStorage() { giant.lock(); try { if (active) { final List<Task> newTasks = taskStorage.getActiveTasks(); List<Task> addedTasks = Lists.newArrayList(Sets.difference(Sets.newHashSet(newTasks), Sets.newHashSet(tasks))); List<Task> removedTasks = Lists.newArrayList(Sets.difference(Sets.newHashSet(tasks), Sets.newHashSet(newTasks))); for(Task task : removedTasks){ shutdown(task.getId()); } for(Task task : addedTasks){ addTaskInternal(task); } log.info( "Synced %d tasks from storage (%d tasks added, %d tasks removed).", newTasks.size(), addedTasks.size(), removedTasks.size() ); managementMayBeNecessary.signalAll(); } else { log.info("Not active. Skipping storage sync."); } } catch (Exception e) { log.warn(e, "Failed to sync tasks from storage!"); throw Throwables.propagate(e); } finally { giant.unlock(); } }

Target:
private void syncFromStorage() { giant.lock(); try { if (active) { final Map<String,Task> newTasks = toTaskIDMap(taskStorage.getActiveTasks()); final int tasksSynced = newTasks.size(); final Map<String,Task> oldTasks = toTaskIDMap(tasks); Set<String> commonIds = Sets.newHashSet(Sets.intersection(newTasks.keySet(), oldTasks.keySet())); for(String taskID : commonIds){ newTasks.remove(taskID); oldTasks.remove(taskID); } Collection<Task> addedTasks = newTasks.values(); Collection<Task> removedTasks = oldTasks.values(); for(Task task : removedTasks){ removeTaskInternal(task); } for(Task task : addedTasks){ addTaskInternal(task); } log.info( "Synced %d tasks from storage (%d tasks added, %d tasks removed).", tasksSynced, addedTasks.size(), removedTasks.size() ); managementMayBeNecessary.signalAll(); } else { log.info("Not active. Skipping storage sync."); } } catch (Exception e) { log.warn(e, "Failed to sync tasks from storage!"); throw Throwables.propagate(e); } finally { giant.unlock(); } }
Source:
private void edit(ListModel model, final boolean topTableIsEdited) { EntityModelCellTable<ListModel> table = getTable(topTableIsEdited); IEventListener listener = topTableIsEdited ? topItemsChangedListener : bottomItemsChangedListener; if (listener != null) { table.asEditor().flush().getItemsChangedEvent().removeListener(listener); } listener = new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { getSelectionModel(topTableIsEdited).clear(); } }; if (topTableIsEdited) { topItemsChangedListener = listener; } else { bottomItemsChangedListener = listener; } model.getItemsChangedEvent().addListener(listener); table.asEditor().edit(model); }

Target:
private void edit(ListModel model, final boolean topTableIsEdited) { EntityModelCellTable<ListModel> table = getTable(topTableIsEdited); IEventListener listener = topTableIsEdited ? topItemsChangedListener : bottomItemsChangedListener; if (listener != null) { table.asEditor().flush().getItemsChangedEvent().removeListener(listener); } model.getItemsChangedEvent().addListener(listener); table.asEditor().edit(model); }
Source:
public void shouldGenerateIdentifiers() throws Exception { MockHttpServletRequest getRequest = newGetRequest(getURI()); getRequest.addParameter("generateIdentifiers", "true"); getRequest.addParameter("comment", "new seq ids"); getRequest.addParameter("numberToGenerate", "5"); getRequest.addParameter("sourceUuid", SEQUENTIAL_IDENTIFIER_SOURCE_UUID); SimpleObject getResult = deserialize(handle(getRequest)); System.out.println(getResult); assertEquals("[G-0, H-8, I-5, J-3, K-1]", getResult.toString()); }

Target:
public void shouldGenerateIdentifiers() throws Exception { String generateIdentifiers = "{"+ "\"generateIdentifiers\": \"true\"," + "\"comment\": \"new seq ids\"," + "\"numberToGenerate\": \"5\"," + "\"sourceUuid\": \""+SEQUENTIAL_IDENTIFIER_SOURCE_UUID+"\"" + "}"; MockHttpServletRequest getRequest = newPostRequest(getURI(), generateIdentifiers); SimpleObject getResult = deserialize(handle(getRequest)); assertEquals("[G-0, H-8, I-5, J-3, K-1]", getResult.get("identifiers").toString()); }
Source:
public GraphDatabaseService create() { final String dbLocationAbsolutePath = dbLocation.getAbsolutePath(); AtomicBoolean isNew = new AtomicBoolean( false ); FactoryHolder factoryHolder = GRAPH_DATABASE_SERVICE_MAP.computeIfAbsent( dbLocationAbsolutePath, ( String dbPath ) -> { LOG.infof( " Create new service instance for dbPath %s", dbLocationAbsolutePath ); GraphDatabaseFacade service = buildGraphDatabaseService(); FactoryHolder holder = new FactoryHolder(); holder.setCounter( 1 ); holder.setGraphDatabaseFacade( service ); isNew.set( true ); return holder; } ); if ( !isNew.get() ) { synchronized (GRAPH_DATABASE_SERVICE_MAP) { factoryHolder.getGraphDatabaseFacade(); boolean isAvailable = factoryHolder.getGraphDatabaseFacade().isAvailable( 100 ); if ( isAvailable ) { factoryHolder.setCounter( factoryHolder.getCounter() + 1 ); } else { LOG.infof( " Recreate service instance for dbPath %s", dbLocationAbsolutePath ); factoryHolder.setCounter( 1 ); factoryHolder.setGraphDatabaseFacade( buildGraphDatabaseService() ); } LOG.debugf( " Counter : %s for path %s", factoryHolder.getCounter(), dbLocationAbsolutePath ); } } return factoryHolder.getGraphDatabaseFacade(); }

Target:
public GraphDatabaseService create() { final String dbLocationAbsolutePath = dbLocation.getAbsolutePath(); AtomicBoolean isNew = new AtomicBoolean( false ); FactoryHolder factoryHolder = GRAPH_DATABASE_SERVICE_MAP.computeIfAbsent( dbLocationAbsolutePath, ( String dbPath ) -> { LOG.infof( " Create new service instance for dbPath %s", dbLocationAbsolutePath ); GraphDatabaseFacade service = buildGraphDatabaseService(); FactoryHolder holder = new FactoryHolder(); holder.setCounter( 1 ); holder.setGraphDatabaseFacade( service ); isNew.set( true ); return holder; } ); if ( !isNew.get() ) { synchronized (GRAPH_DATABASE_SERVICE_MAP) { factoryHolder.getGraphDatabaseFacade(); boolean isAvailable = factoryHolder.getGraphDatabaseFacade().isAvailable( WAITING_TIME_MS ); if ( isAvailable ) { factoryHolder.setCounter( factoryHolder.getCounter() + 1 ); } else { LOG.infof( " Recreate service instance for dbPath %s", dbLocationAbsolutePath ); factoryHolder.setCounter( 1 ); factoryHolder.setGraphDatabaseFacade( buildGraphDatabaseService() ); } LOG.debugf( " Counter : %s for path %s", factoryHolder.getCounter(), dbLocationAbsolutePath ); } } return factoryHolder.getGraphDatabaseFacade(); }
Source:
private void startServer() { Map<String, Object> opts = new Docopt(USAGE) .withVersion(GitRepositoryState.getRepositoryState().describe) .parse(args); printStartupMsg(opts); configureLogger(opts); log.info("Started with arguments: {}", opts); final ServerContext serverContext = new ServerContext(opts); if (opts.get("--network-interface") != null) { opts.put("--address", getAddressFromInterfaceName((String) opts.get("--network-interface"))); opts.put("--bind-to-all-interfaces", false); } else if (opts.get("--address") == null) { opts.put("--bind-to-all-interfaces", true); opts.put("--address", "localhost"); } else { opts.put("--bind-to-all-interfaces", false); } Thread shutdownThread = new Thread(new CleanupRunnable(this)); shutdownThread.setName("ShutdownThread"); Runtime.getRuntime().addShutdownHook(shutdownThread); while (!shutdownServer) { try { CompletableFuture<LogReplicationContext> discoveryServiceCallback = startDiscoveryService(serverContext); log.info("Wait for Discovery Service to provide a view of the topology..."); LogReplicationContext context = discoveryServiceCallback.get(); activeServer = new CorfuInterClusterReplicationServerNode(serverContext, context); activeServer.startAndListen(); } catch (Throwable th) { if (!test) { log.error("CorfuServer: Server exiting due to unrecoverable error: ", th); System.exit(EXIT_ERROR_CODE); } else { cleanShutdown(); } } if (cleanupServer) { cleanupServer = false; } if (!shutdownServer) { log.info("main: Server restarting."); } } log.info("main: Server exiting due to shutdown"); }

Target:
private void startServer() { Map<String, Object> opts = new Docopt(USAGE) .withVersion(GitRepositoryState.getRepositoryState().describe) .parse(args); printStartupMsg(opts); configureLogger(opts); log.info("Started with arguments: {}", opts); ServerContext serverContext = getServerContext(opts); Thread shutdownThread = new Thread(this::cleanShutdown); shutdownThread.setName("ShutdownThread"); Runtime.getRuntime().addShutdownHook(shutdownThread); while (!shutdownServer) { try { CompletableFuture<CorfuInterClusterReplicationServerNode> discoveryServiceCallback = startDiscoveryService(serverContext); log.info("Wait for Discovery Service to provide a view of the topology..."); activeServer = discoveryServiceCallback.get(); log.info("Discovery Service completed. Start Log Replication Service..."); activeServer.startAndListen(); } catch (Throwable th) { log.error("CorfuServer: Server exiting due to unrecoverable error: ", th); System.exit(EXIT_ERROR_CODE); } if (cleanupServer) { cleanupServer = false; } if (!shutdownServer) { log.info("main: Server restarting."); } } log.info("main: Server exiting due to shutdown"); }
Source:
static Statsd getInstance(String contextPath, String hostName) { final String statsdAddress = Parameter.STATSD_ADDRESS.getValue(); if (statsdAddress != null) { assert contextPath != null; assert hostName != null; final String address; final int port; final int index = statsdAddress.lastIndexOf(':'); if (index != -1) { address = statsdAddress.substring(0, index); port = Integer.parseInt(statsdAddress.substring(index + 1)); } else { address = statsdAddress; port = DEFAULT_STATSD_PORT; } String statsdPrefix = Parameter.STATSD_PREFIX.getValueOrDefault("javamelody.${context}.${host}."); statsdPrefix = statsdPrefix.replace("${context}", contextPath.replace("/", "")). replace("${host}", hostName); try { return new Statsd(InetAddress.getByName(address), port, statsdPrefix); } catch (final UnknownHostException e) { throw new IllegalArgumentException("Invalid host: " + address, e); } } return null; }

Target:
static Statsd getInstance(String contextPath, String hostName) { final String statsdAddress = Parameter.STATSD_ADDRESS.getValue(); if (statsdAddress != null) { assert contextPath != null; assert hostName != null; final String address; final int port; final int index = statsdAddress.lastIndexOf(':'); if (index != -1) { address = statsdAddress.substring(0, index); port = Integer.parseInt(statsdAddress.substring(index + 1)); } else { address = statsdAddress; port = DEFAULT_STATSD_PORT; } String statsdPrefix = Parameter.STATSD_PREFIX.getValue(); if (statsdPrefix == null) { statsdPrefix = "javamelody." + contextPath.replace("/", "") + "." + hostName + "."; } try { return new Statsd(InetAddress.getByName(address), port, statsdPrefix); } catch (final UnknownHostException e) { throw new IllegalArgumentException("Invalid host: " + address, e); } } return null; }
Source:
public String convertMemberName(Member member) { if (Modifier.isTransient(member.getModifiers())) { return null; } VisibilityChecker<?> visibilityChecker = mapper.getVisibilityChecker(); if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class) || !visibilityChecker.isFieldVisible(f)) { return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? f.getName() : propertyName; } return f.getName(); } if (member instanceof Method) { Method m = (Method) member; if (!verifyGetter(m) || m.isAnnotationPresent(JsonIgnore.class) || !visibilityChecker.isGetterVisible(m)) { return null; } String methodNameWithoutJavaBeans = removePrefix(m); if (m.isAnnotationPresent(JsonGetter.class)) { String propertyName = m.getDeclaredAnnotation(JsonGetter.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? methodNameWithoutJavaBeans : propertyName; } if (m.isAnnotationPresent(JsonProperty.class)) { String propertyName = m.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? methodNameWithoutJavaBeans : propertyName; } return methodNameWithoutJavaBeans; } return null; }

Target:
public String convertMemberName(Member member) { if (Modifier.isTransient(member.getModifiers())) { return null; } VisibilityChecker<?> visibilityChecker = mapper.getVisibilityChecker(); if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class) || !visibilityChecker.isFieldVisible(f)) { if (f.isAnnotationPresent(JsonProperty.class)) { logger.info("Field is annotated with JsonProperty but isn't accessible to " + "JacksonJsonSerializer.", f.getName()); } return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? f.getName() : propertyName; } return f.getName(); } if (member instanceof Method) { Method m = (Method) member; if (!verifyGetter(m) || m.isAnnotationPresent(JsonIgnore.class) || !visibilityChecker.isGetterVisible(m)) { if (m.isAnnotationPresent(JsonGetter.class) || m.isAnnotationPresent(JsonProperty.class)) { logger.info("Method is annotated with either JsonGetter or JsonProperty but isn't accessible " + "to JacksonJsonSerializer.", m.getName()); } return null; } String methodNameWithoutJavaBeans = removePrefix(m); if (m.isAnnotationPresent(JsonGetter.class)) { String propertyName = m.getDeclaredAnnotation(JsonGetter.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? methodNameWithoutJavaBeans : propertyName; } if (m.isAnnotationPresent(JsonProperty.class)) { String propertyName = m.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? methodNameWithoutJavaBeans : propertyName; } return methodNameWithoutJavaBeans; } return null; }
Source:
private boolean isVariableHeight(int lineIndex) { if (styledText.wordWrap || styledText.visualWrap) { return true; } StyleRange[] styles = getStylesForLine(lineIndex); if (styles != null) { for (StyleRange style : styles) { if (style.isVariableHeight(styledText.isWordWrap())) { return true; } } } return false; }

Target:
private boolean isVariableHeight(int lineIndex) { if (styledText.isWordWrap()) { return true; } StyleRange[] styles = getStylesForLine(lineIndex); if (styles != null) { for (StyleRange style : styles) { if (style.isVariableHeight(false)) { return true; } } } return false; }
Source:
private void assertInvalidPath(String path) { SubfieldTokenizer tokenizer = new SubfieldTokenizer(path); try { ImmutableList<PathElement> pathElements = Streams.stream(tokenizer).collect(toImmutableList()); fail("Expected failure"); } catch (PrestoException e) { assertTrue(e.getMessage().startsWith("Invalid subfield path: ")); } }

Target:
private void assertInvalidPath(String path) { SubfieldTokenizer tokenizer = new SubfieldTokenizer(path); try { Streams.stream(tokenizer).collect(toImmutableList()); fail("Expected failure"); } catch (PrestoException e) { assertTrue(e.getMessage().startsWith("Invalid subfield path: ")); } }
Source:
protected Function<Object, IterableWithMarker<Discount>> markerToNextForArgs(List<Object> args) { return new Function<Object, IterableWithMarker<Discount>>() { @Override public IterableWithMarker<Discount> apply(@Nullable Object input) { PaginationOptions paginationOptions = PaginationOptions.class.cast(input); return api.listDiscounts(paginationOptions); } }; }

Target:
protected Function<Object, IterableWithMarker<Discount>> markerToNextForArgs(List<Object> args) { return new Function<Object, IterableWithMarker<Discount>>() { @Override public IterableWithMarker<Discount> apply(Object input) { PaginationOptions paginationOptions = PaginationOptions.class.cast(input); return api.listDiscounts(paginationOptions); } }; }
Source:
public void testContainsPolyline3Intervals() { String test = "LINESTRING (56.836 60.6126, 56.8393 60.6114, 56.83887 60.60811, 56.83782 60.5988)"; try { GeofenceGeometry geofenceGeometry = new GeofencePolyline(test, 15); Assert.assertTrue(geofenceGeometry.containsPoint(56.83847, 60.60458)); Assert.assertTrue(!geofenceGeometry.containsPoint(56.83764, 60.59725)); Assert.assertTrue(!geofenceGeometry.containsPoint(56.83861, 60.60822)); } catch (ParseException e){ Assert.assertTrue("ParseExceprion: " + e.getMessage(), true); } }

Target:
public void testContainsPolyline3Intervals() throws ParseException { String test = "LINESTRING (56.836 60.6126, 56.8393 60.6114, 56.83887 60.60811, 56.83782 60.5988)"; GeofenceGeometry geofenceGeometry = new GeofencePolyline(test, 15); Assert.assertTrue(geofenceGeometry.containsPoint(56.83847, 60.60458)); Assert.assertTrue(!geofenceGeometry.containsPoint(56.83764, 60.59725)); Assert.assertTrue(!geofenceGeometry.containsPoint(56.83861, 60.60822)); }
Source:
private void lock(String key) throws InterruptedException { synchronized (lockedKeys) { while (!lockedKeys.add(key)) { LOG.debug(String.format("%s waits for %s", Thread.currentThread().getName(), key)); lockedKeys.wait(); } } }

Target:
private void lock(String key) throws InterruptedException { synchronized (lockedKeys) { if (lockedKeys.contains(key)) { LOG.debug(String.format("%s waits for %s", Thread.currentThread().getName(), key)); lockedKeys.wait(); } LOG.debug(String.format("%s acquired key %s", Thread.currentThread().getName(), key)); lockedKeys.add(key); } }
Source:
public synchronized void send(final EventualMessage msg) { assert msg.getTarget() == this; if (message == null) { message = msg; if (VmSettings.MESSAGE_TIMESTAMPS) { sendTimeStamp = System.currentTimeMillis(); } } else { sendMoreMessages(msg); } logMessageAddedToMailbox(msg); if (!isExecuting) { isExecuting = true; executeOnPool(); } }

Target:
public synchronized void send(final EventualMessage msg) { assert msg.getTarget() == this; if (firstMessage == null) { firstMessage = msg; if (VmSettings.MESSAGE_TIMESTAMPS) { firstMessageTimeStamp = System.currentTimeMillis(); } } else { appendToMailbox(msg); } logMessageAddedToMailbox(msg); if (!isExecuting) { isExecuting = true; executeOnPool(); } }
Source:
public Mono<Void> sendOne(Frame frame) { ByteBuf content = frame.content().skipBytes(3); return out.sendObject(new BinaryWebSocketFrame(content)).then(); }

Target:
public Mono<Void> sendOne(Frame frame) { return out.sendObject(new BinaryWebSocketFrame(frame.content().skipBytes(FRAME_LENGTH_SIZE))).then(); }
Source:
public List<BranchStatistics> searchBranchStatistics(String projectUuid, List<String> branchUuids) { if (branchUuids.isEmpty()) { return Collections.emptyList(); } SearchRequestBuilder request = client.prepareSearch(IssueIndexDefinition.INDEX_TYPE_ISSUE) .setRouting(projectUuid) .setQuery( boolQuery() .must(termsQuery(IssueIndexDefinition.FIELD_ISSUE_BRANCH_UUID, branchUuids)) .must(termQuery(IssueIndexDefinition.FIELD_ISSUE_IS_MAIN_BRANCH, Boolean.toString(false)))) .setSize(0) .addAggregation(AggregationBuilders.terms("branchUuids") .field(IssueIndexDefinition.FIELD_ISSUE_BRANCH_UUID) .size(branchUuids.size()) .subAggregation(AggregationBuilders.terms("types") .field(IssueIndexDefinition.FIELD_ISSUE_TYPE))); SearchResponse response = request.get(); return ((StringTerms) response.getAggregations().get("branchUuids")).getBuckets().stream() .map(bucket -> new BranchStatistics(bucket.getKeyAsString(), ((StringTerms) bucket.getAggregations().get("types")).getBuckets() .stream() .collect(uniqueIndex(StringTerms.Bucket::getKeyAsString, InternalTerms.Bucket::getDocCount)))) .collect(MoreCollectors.toList(branchUuids.size())); }

Target:
public List<BranchStatistics> searchBranchStatistics(String projectUuid, List<String> branchUuids) { if (branchUuids.isEmpty()) { return Collections.emptyList(); } SearchRequestBuilder request = client.prepareSearch(IssueIndexDefinition.INDEX_TYPE_ISSUE) .setRouting(projectUuid) .setQuery( boolQuery() .must(termsQuery(IssueIndexDefinition.FIELD_ISSUE_BRANCH_UUID, branchUuids)) .mustNot(existsQuery(IssueIndexDefinition.FIELD_ISSUE_RESOLUTION)) .must(termQuery(IssueIndexDefinition.FIELD_ISSUE_IS_MAIN_BRANCH, Boolean.toString(false)))) .setSize(0) .addAggregation(AggregationBuilders.terms("branchUuids") .field(IssueIndexDefinition.FIELD_ISSUE_BRANCH_UUID) .size(branchUuids.size()) .subAggregation(AggregationBuilders.terms("types") .field(IssueIndexDefinition.FIELD_ISSUE_TYPE))); SearchResponse response = request.get(); return ((StringTerms) response.getAggregations().get("branchUuids")).getBuckets().stream() .map(bucket -> new BranchStatistics(bucket.getKeyAsString(), ((StringTerms) bucket.getAggregations().get("types")).getBuckets() .stream() .collect(uniqueIndex(StringTerms.Bucket::getKeyAsString, InternalTerms.Bucket::getDocCount)))) .collect(MoreCollectors.toList(branchUuids.size())); }
Source:
private void refreshStates() { mSwitchActive.setChecked(mPlugin.isActive()); mSwitchAutoupdates.setChecked(mPlugin.isAutoUpdateEnabled()); }

Target:
private void refreshStates() { if (isFinishing()) { return; } mSwitchActive.setChecked(mPlugin.isActive()); mSwitchAutoupdates.setChecked(mPlugin.isAutoUpdateEnabled()); }
Source:
public void unvoidDiagnosis_shouldUnvoidDiagnosisSuccessfully(){ String uuid = "77009cce-8804-17e4-8804-a68804d22fb7"; Diagnosis voidedDiagnosis = diagnosisService.getDiagnosisByUuid(uuid); Assert.assertTrue(voidedDiagnosis.getVoided()); Assert.assertNotNull(voidedDiagnosis.getVoidReason()); Assert.assertNotNull(voidedDiagnosis.getDateVoided()); Assert.assertNotNull(voidedDiagnosis.getVoidedBy()); Diagnosis unVoidedDiagnosis= diagnosisService.unvoidDiagnosis(voidedDiagnosis); Assert.assertEquals(ConditionVerificationStatus.PROVISIONAL, unVoidedDiagnosis.getCertainty()); Assert.assertEquals(uuid, unVoidedDiagnosis.getUuid()); Assert.assertFalse(unVoidedDiagnosis.getVoided()); Assert.assertNull(unVoidedDiagnosis.getVoidReason()); Assert.assertNull(unVoidedDiagnosis.getDateVoided()); Assert.assertNull(unVoidedDiagnosis.getVoidedBy()); }

Target:
public void unvoidDiagnosis_shouldUnvoidDiagnosisSuccessfully(){ String uuid = "77009cce-8804-17e4-8804-a68804d22fb7"; Diagnosis voidedDiagnosis = diagnosisService.getDiagnosisByUuid(uuid); Assert.assertTrue(voidedDiagnosis.getVoided()); Assert.assertNotNull(voidedDiagnosis.getVoidReason()); Assert.assertNotNull(voidedDiagnosis.getDateVoided()); Assert.assertNotNull(voidedDiagnosis.getVoidedBy()); diagnosisService.unvoidDiagnosis(voidedDiagnosis); Diagnosis unVoidedDiagnosis= diagnosisService.getDiagnosisByUuid(uuid); Assert.assertEquals(ConditionVerificationStatus.PROVISIONAL, unVoidedDiagnosis.getCertainty()); Assert.assertEquals(uuid, unVoidedDiagnosis.getUuid()); Assert.assertFalse(unVoidedDiagnosis.getVoided()); Assert.assertNull(unVoidedDiagnosis.getVoidReason()); Assert.assertNull(unVoidedDiagnosis.getDateVoided()); Assert.assertNull(unVoidedDiagnosis.getVoidedBy()); }
Source:
private static boolean isCandidateForReferenceView(TmfView tmfView, TmfTimeViewAlignmentInfo alignmentInfo, int lowestTimeAxisOffset) { ITmfTimeAligned alignedView = (ITmfTimeAligned) tmfView; TmfTimeViewAlignmentInfo timeViewAlignmentInfo = alignedView.getTimeViewAlignmentInfo(); System.out.println(); System.out.println(); Composite parentComposite = tmfView.getParentComposite(); if (parentComposite != null && parentComposite.isVisible() && timeViewAlignmentInfo != null && isViewLocationNear(alignmentInfo.getViewLocation(), getViewLocation(tmfView)) && getClampedTimeAxisOffset(timeViewAlignmentInfo) < lowestTimeAxisOffset) { int availableWidth = alignedView.getAvailableWidth(getClampedTimeAxisOffset(timeViewAlignmentInfo)); availableWidth = getClampedTimeAxisWidth(timeViewAlignmentInfo, availableWidth); if (availableWidth > 0) { return true; } } return false; }

Target:
private static boolean isCandidateForReferenceView(TmfView tmfView, TmfTimeViewAlignmentInfo alignmentInfo, int lowestTimeAxisOffset) { ITmfTimeAligned alignedView = (ITmfTimeAligned) tmfView; TmfTimeViewAlignmentInfo timeViewAlignmentInfo = alignedView.getTimeViewAlignmentInfo(); Composite parentComposite = tmfView.getParentComposite(); if (parentComposite != null && parentComposite.isVisible() && timeViewAlignmentInfo != null && isViewLocationNear(alignmentInfo.getViewLocation(), getViewLocation(tmfView)) && getClampedTimeAxisOffset(timeViewAlignmentInfo) < lowestTimeAxisOffset) { int availableWidth = alignedView.getAvailableWidth(getClampedTimeAxisOffset(timeViewAlignmentInfo)); availableWidth = getClampedTimeAxisWidth(timeViewAlignmentInfo, availableWidth); if (availableWidth > 0) { return true; } } return false; }
Source:
public String getLabel() { String result = ""; if (containedObject instanceof ITargetDefinition) { result = "Plugins"; } else if (containedObject instanceof ZipFile) { result = ((ZipFile) containedObject).getName(); int startPosition = result.lastIndexOf(folderSeparator) + folderSeparator.length(); int endPosition = result.lastIndexOf("_"); if (endPosition == -1) { endPosition = result.length() - 4; } result = result.substring(startPosition, endPosition); } else if (containedObject instanceof ZipEntry) { result = ((ZipEntry) containedObject).getName(); } return result; }

Target:
public String getLabel() { String result = ""; if (containedObject instanceof ITargetDefinition) { result = "Plugins"; } else if (containedObject instanceof ZipFile) { result = ((ZipFile) containedObject).getName(); int startPosition = result.lastIndexOf(File.separator) + File.separator.length(); int endPosition = result.lastIndexOf("_"); if (endPosition <= startPosition) { endPosition = result.length() - 4; } result = result.substring(startPosition, endPosition); } else if (containedObject instanceof ZipEntry) { result = ((ZipEntry) containedObject).getName(); } return result; }
Source:
@Override public CacheQuery<T> timeout(long timeout) { if (timeout >= 0) this.timeout = timeout; else this.timeout = cctx.gridConfig().getDefaultQueryTimeout(); return this; }

Target:
@Override public CacheQuery<T> timeout(long timeout) { A.ensure(timeout >= 0, "timeout >= 0"); this.timeout = timeout; return this; }