auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ResponseEntity<String> visualizeNetworks(@ProjectIdentifier @PathVariable("projectUnixName") String unixName, @PathVariable("networkId") String networkId, Principal principal, @CheckAccess @InjectProject IProject project, @RequestParam("projectId") String projectId) { ITransformedNetwork transformedNetwork = null; try { transformedNetwork = transformationManager.getTransformedNetwork(networkId); } catch (QuadrigaStorageException qse) { logger.error("Error:" + qse.getMessage()); return new ResponseEntity<String>("", HttpStatus.INTERNAL_SERVER_ERROR); } String json = null; if (transformedNetwork != null) { json = jsonCreator.getJson(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } else { return new ResponseEntity<String>(json, HttpStatus.NOT_FOUND); } return new ResponseEntity<String>(json, HttpStatus.OK); }

Target:
public ResponseEntity<String> visualizeNetworks(@ProjectIdentifier @PathVariable("projectUnixName") String unixName, @PathVariable("networkId") String networkId, Principal principal, @CheckAccess @InjectProject IProject project, @RequestParam("projectId") String projectId) { ITransformedNetwork transformedNetwork = null; try { transformedNetwork = transformationManager.getTransformedNetwork(networkId); } catch (QuadrigaStorageException qse) { logger.error("Error:" + qse); return new ResponseEntity<String>("", HttpStatus.INTERNAL_SERVER_ERROR); } String json = null; if (transformedNetwork != null) { json = jsonCreator.getJson(transformedNetwork.getNodes(), transformedNetwork.getLinks()); } else { return new ResponseEntity<String>(json, HttpStatus.NOT_FOUND); } return new ResponseEntity<String>(json, HttpStatus.OK); }
Source:
public void testBasicLocalDistributedCallable() throws Exception { long taskTimeout = TimeUnit.SECONDS.toMillis(15); EmbeddedCacheManager cacheManager1 = manager(0); final EmbeddedCacheManager cacheManager2 = manager(1); final EmbeddedCacheManager cacheManager3 = manager(2); TestingUtil.killCacheManagers(cacheManager2); TestingUtil.killCacheManagers(cacheManager3); Cache<Object, Object> cache1 = cacheManager1.getCache(); DistributedExecutorService des = null; try { des = new DefaultExecutorService(cache1); SameNodeTaskFailoverPolicy sameNodeTaskFailoverPolicy = new SameNodeTaskFailoverPolicy(2); DistributedTaskBuilder<Void> builder = des .createDistributedTaskBuilder(new TestCallable()) .failoverPolicy(sameNodeTaskFailoverPolicy) .timeout(taskTimeout, TimeUnit.MILLISECONDS); CompletableFuture<Void> future = des.submit(builder.build()); future.whenComplete((aVoid,throwable) -> { Executors.newSingleThreadExecutor().submit((Callable<Void>)() -> { future.get(); AssertJUnit.assertEquals(sameNodeTaskFailoverPolicy.failoverCount, 2); return null; }); }); } catch (Exception ex) { AssertJUnit.fail("Task did not failover properly " + ex); } finally { des.shutdown(); } }

Target:
public void testBasicLocalDistributedCallable() throws Exception { long taskTimeout = TimeUnit.SECONDS.toMillis(15); EmbeddedCacheManager cacheManager1 = manager(0); Cache<Object, Object> cache1 = cacheManager1.getCache(); DistributedExecutorService des = null; try { des = new DefaultExecutorService(cache1); SameNodeTaskFailoverPolicy sameNodeTaskFailoverPolicy = new SameNodeTaskFailoverPolicy(3); DistributedTaskBuilder<Void> builder = des .createDistributedTaskBuilder(new TestCallable()) .failoverPolicy(sameNodeTaskFailoverPolicy) .timeout(taskTimeout, TimeUnit.MILLISECONDS); CompletableFuture<Void> future = des.submit(builder.build()); TriggerFailover(future); eventuallyEquals(3, () -> sameNodeTaskFailoverPolicy.failoverCount.get()); } catch (Exception ex) { AssertJUnit.fail("Task did not failover properly " + ex); } finally { des.shutdown(); } }
Source:
static String guessEntityTypeFromId(String id, boolean returnJsonEntity) { if(id.isEmpty()) { throw new IllegalArgumentException("Entity ids should not be empty."); } switch (id.charAt(0)) { case 'L': if(id.contains("-F")) { return returnJsonEntity ? JSON_ENTITY_TYPE_FORM : DatatypeIdValue.DT_FORM; } else if(id.contains("-S")) { return returnJsonEntity ? JSON_ENTITY_TYPE_SENSE : DatatypeIdValue.DT_SENSE; } else { return returnJsonEntity ? JSON_ENTITY_TYPE_LEXEME : DatatypeIdValue.DT_LEXEME; } case 'M': return JSON_ENTITY_TYPE_MEDIA_INFO; case 'P': return returnJsonEntity ? JSON_ENTITY_TYPE_PROPERTY : DatatypeIdValue.DT_PROPERTY; case 'Q': return returnJsonEntity ? JSON_ENTITY_TYPE_ITEM : DatatypeIdValue.DT_ITEM; default: throw new IllegalArgumentException("Entity id \"" + id + "\" is not supported."); } }

Target:
static String guessEntityTypeFromId(String id, boolean returnJsonEntity) { if(id.isEmpty()) { throw new IllegalArgumentException("Entity ids should not be empty."); } switch (id.charAt(0)) { case 'L': if(id.contains("-F")) { return returnJsonEntity ? JSON_ENTITY_TYPE_FORM : DatatypeIdValue.DT_FORM; } else if(id.contains("-S")) { return returnJsonEntity ? JSON_ENTITY_TYPE_SENSE : DatatypeIdValue.DT_SENSE; } else { return returnJsonEntity ? JSON_ENTITY_TYPE_LEXEME : DatatypeIdValue.DT_LEXEME; } case 'M': return returnJsonEntity ? JSON_ENTITY_TYPE_MEDIA_INFO : DatatypeIdValue.DT_MEDIA_INFO; case 'P': return returnJsonEntity ? JSON_ENTITY_TYPE_PROPERTY : DatatypeIdValue.DT_PROPERTY; case 'Q': return returnJsonEntity ? JSON_ENTITY_TYPE_ITEM : DatatypeIdValue.DT_ITEM; default: throw new IllegalArgumentException("Entity id \"" + id + "\" is not supported."); } }
Source:
protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) { ImageDescriptor res = super.decorateImage(input, element); if (res == null) { return null; } IResource resource = Adapters.adapt(element, IResource.class); if (resource != null && (resource.getType() != IResource.PROJECT || ((IProject) resource).isOpen())) { ImageDescriptor overlay = null; switch (getHighestProblemSeverity(resource)) { case IMarker.SEVERITY_ERROR: overlay = PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR); break; case IMarker.SEVERITY_WARNING: overlay = PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING); break; } if (overlay != null) { res = new DecorationOverlayIcon(res, overlay, IDecoration.BOTTOM_LEFT); } } return res; }

Target:
protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) { ImageDescriptor descriptor = super.decorateImage(input, element); if (descriptor == null) { return null; } IResource resource = Adapters.adapt(element, IResource.class); if (resource != null && (resource.getType() != IResource.PROJECT || ((IProject) resource).isOpen())) { ImageDescriptor overlay = null; switch (getHighestProblemSeverity(resource)) { case IMarker.SEVERITY_ERROR: overlay = PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_ERROR); break; case IMarker.SEVERITY_WARNING: overlay = PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_DEC_FIELD_WARNING); break; } if (overlay != null) { descriptor = new DecorationOverlayIcon(descriptor, overlay, IDecoration.BOTTOM_LEFT); } } return descriptor; }
Source:
private void initLocalizationEditor() { localeBox = new ListBox(); selectedLocale = new Label(); String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName(); String[] localeNames = LocaleInfo.getAvailableLocaleNames(); boolean foundDefaultLocale = false; for (String localeName : localeNames) { if (!DEFAULT_LOCALE.equals(localeName)) { String nativeName = LocaleInfo.getLocaleNativeDisplayName(localeName); localeBox.addItem(nativeName, localeName); if (localeName.equals(currentLocale)) { setSelectedLocale(localeBox.getItemCount() - 1); foundDefaultLocale = true; } } } if (!foundDefaultLocale && localeNames.length > 0) { setSelectedLocale(0); } if (clientAgentType.isIE8OrBelow()) { selectedLocale.getElement().getStyle().setOpacity(0); } localeBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { String localeString = "?locale=" + localeBox.getValue(localeBox.getSelectedIndex()); Window.open(FrontendUrlUtils.getCurrentPageURL() + localeString, "_self", ""); } }); }

Target:
private void initLocalizationEditor() { localeBox = new ListBox(); selectedLocale = new Label(); String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName(); String[] localeNames = LocaleInfo.getAvailableLocaleNames(); boolean foundDefaultLocale = false; for (String localeName : localeNames) { if (!DEFAULT_LOCALE.equals(localeName)) { String nativeName = LocaleInfo.getLocaleNativeDisplayName(localeName); localeBox.addItem(nativeName, localeName); if (localeName.equals(currentLocale)) { setSelectedLocale(localeBox.getItemCount() - 1); foundDefaultLocale = true; } } } if (!foundDefaultLocale && localeNames.length > 0) { setSelectedLocale(0); } if (clientAgentType.isIE8OrBelow()) { selectedLocale.getElement().getStyle().setOpacity(0); } localeBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { String localeQueryParam = LocaleInfo.getLocaleQueryParam(); String localeString = "?" + localeQueryParam + "=" + localeBox.getValue(localeBox.getSelectedIndex()); Window.open(FrontendUrlUtils.getCurrentPageURL() + localeString, "_self", ""); } }); }
Source:
public DefaultControlFlowConfigurator() { GeoServerResourceLoader loader = (GeoServerResourceLoader) GeoServerExtensions.bean( "resourceLoader"); Resource controlflow = loader.get(PROPERTYFILENAME); configFile = new PropertyFileWatcher(controlflow); }

Target:
public DefaultControlFlowConfigurator() { GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); Resource controlflow = loader.get(PROPERTYFILENAME); configFile = new PropertyFileWatcher(controlflow); }
Source:
public void setAccountId(Long accountId) { this.accountId = accountId; }

Target:
void setAccountId(Long accountId) { this.accountId = accountId; }
Source:
public List<Task> getTasks() { return tasks; }

Target:
public List<Task> getTasks() { return Collections.unmodifiableList(tasks); }
Source:
public void testAbortAndRestartOnce() throws Exception { FreeStyleProject testproject = j.createFreeStyleProject(); QuickBuildTimeOutStrategy strategy = new QuickBuildTimeOutStrategy(5000); AbortAndRestartOperation operation = new AbortAndRestartOperation(1); LinkedList<BuildTimeOutOperation> list = new LinkedList<BuildTimeOutOperation>(); list.add(operation); BuildTimeoutWrapper wrapper = new BuildTimeoutWrapper(strategy,list,""); testproject.getBuildWrappersList().add(wrapper); testproject.getBuildersList().add(new SleepBuilder(5*60*1000)); testproject.scheduleBuild(new Cause.UserIdCause()); j.waitUntilNoActivityUpTo(25000); assertTrue(testproject.getFirstBuild() != null); assertFalse(testproject.getFirstBuild().equals(testproject.getLastBuild())); assertEquals(testproject.getBuilds().size(), 2); assertEquals(Result.ABORTED, testproject.getFirstBuild().getResult()); assertEquals(Result.ABORTED, testproject.getLastBuild().getResult()); }

Target:
public void testAbortAndRestartOnce() throws Exception { FreeStyleProject testproject = j.createFreeStyleProject(); QuickBuildTimeOutStrategy strategy = new QuickBuildTimeOutStrategy(5000); AbortAndRestartOperation operation = new AbortAndRestartOperation("1"); LinkedList<BuildTimeOutOperation> list = new LinkedList<BuildTimeOutOperation>(); list.add(operation); BuildTimeoutWrapper wrapper = new BuildTimeoutWrapper(strategy,list,""); testproject.getBuildWrappersList().add(wrapper); testproject.getBuildersList().add(new SleepBuilder(5*60*1000)); testproject.scheduleBuild(new Cause.UserIdCause()); j.waitUntilNoActivityUpTo(25000); assertNotNull(testproject.getFirstBuild()); assertFalse(testproject.getFirstBuild().equals(testproject.getLastBuild())); assertEquals(testproject.getBuilds().size(), 2); assertEquals(Result.ABORTED, testproject.getFirstBuild().getResult()); assertEquals(Result.ABORTED, testproject.getLastBuild().getResult()); }
Source:
protected List<DocumentModel> queryClients() { DirectoryService service = Framework.getService(DirectoryService.class); return Framework.doPrivileged(() -> { try (Session session = service.open(OAUTH2CLIENT_DIRECTORY_NAME)) { return session.query(Collections.emptyMap()); } catch (DirectoryException e) { log.error("Error while fetching provider directory", e); return Collections.emptyList(); } }); }

Target:
protected List<DocumentModel> queryClients() { DirectoryService service = Framework.getService(DirectoryService.class); return Framework.doPrivileged(() -> { try (Session session = service.open(OAUTH2CLIENT_DIRECTORY_NAME)) { return session.query(Collections.emptyMap()); } catch (DirectoryException e) { throw new NuxeoException("Error while fetching client directory", e); } }); }
Source:
public void performRitual(IMasterRitualStone masterRitualStone) { AxisAlignedBB aabb = getBlockRange(FLIGHT_RANGE).getAABB(masterRitualStone.getBlockPos()).expand(-10, 0, -10); System.out.println(aabb); World world = masterRitualStone.getWorldObj(); int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence(); List<EntityPlayer> entityPlayers = world.getEntitiesWithinAABB(EntityPlayer.class, aabb); int entityCount = entityPlayers.size(); if (currentEssence < getRefreshCost() * entityCount) { masterRitualStone.getOwnerNetwork().causeNausea(); return; } else { entityCount = 0; for (EntityPlayer player : entityPlayers) { player.addPotionEffect(new PotionEffect(RegistrarBloodMagic.FLIGHT, 20, 0)); } } masterRitualStone.getOwnerNetwork().syphon(masterRitualStone.ticket(getRefreshCost() * entityCount)); }

Target:
public void performRitual(IMasterRitualStone masterRitualStone) { AxisAlignedBB aabb = getBlockRange(FLIGHT_RANGE).getAABB(masterRitualStone.getBlockPos()).expand(-10, 0, -10); World world = masterRitualStone.getWorldObj(); int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence(); List<EntityPlayer> entityPlayers = world.getEntitiesWithinAABB(EntityPlayer.class, aabb); int entityCount = entityPlayers.size(); if (currentEssence < getRefreshCost() * entityCount) { masterRitualStone.getOwnerNetwork().causeNausea(); return; } else { entityCount = 0; for (EntityPlayer player : entityPlayers) { player.addPotionEffect(new PotionEffect(RegistrarBloodMagic.FLIGHT, 20, 0)); } } masterRitualStone.getOwnerNetwork().syphon(masterRitualStone.ticket(getRefreshCost() * entityCount)); }
Source:
public EditSession createEditSession(Actor actor) { checkNotNull(actor); World world = null; if (hasWorldOverride()) { world = getWorldOverride(); } else if (actor.isPlayer() && actor instanceof Player) { world = ((Player) actor).getWorld(); } EditSession editSession; if (actor.isPlayer() && actor instanceof Player) { BlockBag blockBag = getBlockBag((Player) actor); editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession( world, getBlockChangeLimit(), blockBag, actor ); } else { editSession = WorldEdit.getInstance().getEditSessionFactory() .getEditSession(world, getBlockChangeLimit()); } Request.request().setEditSession(editSession); editSession.setFastMode(fastMode); editSession.setReorderMode(reorderMode); editSession.setMask(mask); if (editSession.getSurvivalExtent() != null) { editSession.getSurvivalExtent().setStripNbt(!actor.hasPermission("worldedit.setnbt")); } return editSession; }

Target:
public EditSession createEditSession(Actor actor) { checkNotNull(actor); World world = null; if (hasWorldOverride()) { world = getWorldOverride(); } else if (actor instanceof Locatable && ((Locatable) actor).getExtent() instanceof World) { world = (World) ((Locatable) actor).getExtent(); } EditSession editSession; if (actor.isPlayer() && actor instanceof Player) { BlockBag blockBag = getBlockBag((Player) actor); editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession( world, getBlockChangeLimit(), blockBag, actor ); } else { editSession = WorldEdit.getInstance().getEditSessionFactory() .getEditSession(world, getBlockChangeLimit()); } Request.request().setEditSession(editSession); editSession.setFastMode(fastMode); editSession.setReorderMode(reorderMode); editSession.setMask(mask); if (editSession.getSurvivalExtent() != null) { editSession.getSurvivalExtent().setStripNbt(!actor.hasPermission("worldedit.setnbt")); } return editSession; }
Source:
public void parseGeoLocation() { String[] geoParts = StringUtils.split(geolocation, ","); if (geoParts.length == 2) { latitude = toDouble(geoParts[0]); longitude = toDouble(geoParts[1]); } else if (geoParts.length == 3) { latitude = toDouble(geoParts[0]); longitude = toDouble(geoParts[1]); altitude = Integer.parseInt(geoParts[2]); } }

Target:
public void parseGeoLocation() { String[] geoParts = StringUtils.split(geolocation, ","); if (geoParts.length == 2) { latitude = toDouble(geoParts[0]); longitude = toDouble(geoParts[1]); } else if (geoParts.length == 3) { latitude = toDouble(geoParts[0]); longitude = toDouble(geoParts[1]); altitude = toDouble(geoParts[2]); } }
Source:
public void testSchemaStoreRetrieval() { Assert.assertNotNull(Framework.getService(SchemaStore.class)); }

Target:
public void testSchemaStoreRetrieval() { assertNotNull(Framework.getService(SchemaStore.class)); assertNotNull(Framework.getService(AvroSchemaStoreService.class)); }
Source:
public void setRange(final int minRow, final int maxRow) { this.minRow = minRow; this.maxRow = maxRow; Preconditions.checkArgument(maxRow > 0); Preconditions.checkState(minRow < maxRow, "minRow >= maxRow. (minRow=%s, ,maxRow=%s)", minRow, maxRow); }

Target:
public void setRange(final int minRow, final int maxRow) { this.minRow = minRow; this.maxRow = maxRow; Preconditions.checkArgument(maxRow > 0, "maxRow: %s", maxRow); Preconditions.checkState(minRow < maxRow, "minRow >= maxRow. (minRow=%s, ,maxRow=%s)", minRow, maxRow); }
Source:
static StatsDEmitter of(StatsDEmitterConfig config, ObjectMapper mapper) { NonBlockingStatsDClient client = new NonBlockingStatsDClient( config.getPrefix(), config.getHostname(), config.getPort(), config.getDogstatsd() ? config.getDogstatsdConstantTags().toArray(new String[0]) : EMPTY_ARRAY, new StatsDClientErrorHandler() { private int exceptionCount = 0; @Override public void handle(Exception exception) { if (exceptionCount % 1000 == 0) { log.error(exception, "Error sending metric to StatsD."); } exceptionCount += 1; } } ); return new StatsDEmitter(config, mapper, client); }

Target:
static StatsDEmitter of(StatsDEmitterConfig config, ObjectMapper mapper) { NonBlockingStatsDClient client = new NonBlockingStatsDClient( config.getPrefix(), config.getHostname(), config.getPort(), config.isDogstatsd() ? config.getDogstatsdConstantTags().toArray(new String[0]) : EMPTY_ARRAY, new StatsDClientErrorHandler() { private int exceptionCount = 0; @Override public void handle(Exception exception) { if (exceptionCount % 1000 == 0) { log.error(exception, "Error sending metric to StatsD."); } exceptionCount += 1; } } ); return new StatsDEmitter(config, mapper, client); }
Source:
public void testGetActiveNotifications() throws Exception { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return; } notificationManager.notify(1, notification1); notificationManager.notify(31, notification2); StatusBarNotification[] statusBarNotifications = shadowOf(notificationManager).getActiveNotifications(); assertEquals(2, statusBarNotifications.length); boolean hasNotification1 = false; boolean hasNotification2 = false; for (StatusBarNotification notification : statusBarNotifications) { if (notification.getId() == 1) { hasNotification1 = true; assertEquals(notification1, notification.getNotification()); } else if (notification.getId() == 31) { hasNotification2 = true; assertEquals(notification2, notification.getNotification()); } else { fail("Unexpected notification id " + notification.getId()); } } assertTrue(hasNotification1 && hasNotification2); }

Target:
public void testGetActiveNotifications() throws Exception { notificationManager.notify(1, notification1); notificationManager.notify(31, notification2); StatusBarNotification[] statusBarNotifications = shadowOf(notificationManager).getActiveNotifications(); assertThat(statusBarNotifications) .extractingResultOf("getNotification", Notification.class) .containsOnly(notification1, notification2); }
Source:
private ConnectorSession sampleSize(int sampleSize) { return new TestingConnectorSession(new HiveSessionProperties(getHiveClientConfig().setPartitionStatisticsSampleSize(sampleSize), new OrcFileWriterConfig()).getSessionProperties()); }

Target:
private ConnectorSession sampleSize(int sampleSize) { HiveSessionProperties properties = new HiveSessionProperties( getHiveClientConfig().setPartitionStatisticsSampleSize(sampleSize), new OrcFileWriterConfig()); return new TestingConnectorSession(properties.getSessionProperties()); }
Source:
public void testBedTabixIndex( final File inputBed, final List<Interval> queryIntervals ) throws Exception { final File tmpBed = new File(IOUtil.createTempDir("testBedTabixIndex", null), inputBed.getName()); Files.copy(inputBed, tmpBed); final TabixIndex tabixIndexGz = IndexFactory.createTabixIndex(tmpBed, new BEDCodec(), null); tabixIndexGz.writeBasedOnFeatureFile(tmpBed); try(final FeatureReader<BEDFeature> originalReader = AbstractFeatureReader.getFeatureReader(inputBed.getAbsolutePath(), new BEDCodec()); final FeatureReader<BEDFeature> createdReader = AbstractFeatureReader.getFeatureReader(tmpBed.getAbsolutePath(), new BEDCodec())) { for (final Interval interval: queryIntervals) { Iterator<BEDFeature> originalIt = originalReader.query(interval.getContig(), interval.getStart(), interval.getEnd()); Iterator<BEDFeature> createdIt = createdReader.query(interval.getContig(), interval.getStart(), interval.getEnd()); while(originalIt.hasNext()) { Assert.assertTrue(createdIt.hasNext(), "some features not returned from query"); BEDFeature bedOrig = originalIt.next(); BEDFeature bedTmp = createdIt.next(); Assert.assertEquals(bedOrig.getContig(), bedTmp.getContig()); Assert.assertEquals(bedOrig.getStart(), bedTmp.getStart()); Assert.assertEquals(bedOrig.getEnd(), bedTmp.getEnd()); } } } }

Target:
public void testBedTabixIndex( final File inputBed, final List<Interval> queryIntervals ) throws Exception { final File tempDir = IOUtil.createTempDir("testBedTabixIndex", null); tempDir.deleteOnExit(); final File tmpBed = new File(tempDir, inputBed.getName()); Files.copy(inputBed, tmpBed); tmpBed.deleteOnExit(); final TabixIndex tabixIndexGz = IndexFactory.createTabixIndex(tmpBed, new BEDCodec(), null); tabixIndexGz.writeBasedOnFeatureFile(tmpBed); final File tmpIndex = Tribble.tabixIndexFile(tmpBed); tmpIndex.deleteOnExit(); try(final FeatureReader<BEDFeature> originalReader = AbstractFeatureReader.getFeatureReader(inputBed.getAbsolutePath(), new BEDCodec()); final FeatureReader<BEDFeature> createdReader = AbstractFeatureReader.getFeatureReader(tmpBed.getAbsolutePath(), new BEDCodec())) { for (final Interval interval: queryIntervals) { final Iterator<BEDFeature> originalIt = originalReader.query(interval.getContig(), interval.getStart(), interval.getEnd()); final Iterator<BEDFeature> createdIt = createdReader.query(interval.getContig(), interval.getStart(), interval.getEnd()); while(originalIt.hasNext()) { Assert.assertTrue(createdIt.hasNext(), "some features not returned from query"); BEDFeature bedOrig = originalIt.next(); BEDFeature bedTmp = createdIt.next(); Assert.assertEquals(bedOrig.getContig(), bedTmp.getContig()); Assert.assertEquals(bedOrig.getStart(), bedTmp.getStart()); Assert.assertEquals(bedOrig.getEnd(), bedTmp.getEnd()); } } } }
Source:
private void loadPreviousTimings() { processes.fetchProcess(processId) .ifPresent(process -> process.getPerformanceCounters().data().keySet().forEach(key -> { int counter = process.getPerformanceCounters().get(key).orElse(0); int timing = process.getTimings().get(key).orElse(0); Average average = new Average(); average.addValues(counter, (double) counter * timing); timings.put(key, average); })); }

Target:
private void loadPreviousTimings() { processes.fetchProcess(processId).ifPresent(process -> { process.getPerformanceCounters().data().keySet().forEach(key -> { int counter = process.getPerformanceCounters().get(key).orElse(0); int timing = process.getTimings().get(key).orElse(0); Average average = new Average(); average.addValues(counter, (double) counter * timing); timings.put(key, average); }); }); }
Source:
protected void saveData(String filename) { IPath newDataLoc = getNewDataLocation(filename, DATA_EXT); StatData statData = PerfPlugin.getDefault().getStatData(); File statsData = new File(newDataLoc.toOSString()); if (verifyFile(statsData)) { BufferedWriter bw = null; try { statsData.createNewFile(); FileWriter fw = new FileWriter(statsData.getAbsoluteFile()); bw = new BufferedWriter(fw); bw.write(statData.getPerfData()); bw.close(); } catch (IOException e) { String errorMsg = MessageFormat.format( Messages.PerfSaveStat_error_msg, new Object[] { statsData.getName() }); MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.PerfSaveStat_error_title, errorMsg); } } }

Target:
protected void saveData(String filename) { IPath newDataLoc = getNewDataLocation(filename, DATA_EXT); StatData statData = PerfPlugin.getDefault().getStatData(); File statsData = new File(newDataLoc.toOSString()); if (canSave(statsData)) { BufferedWriter bw = null; try { statsData.createNewFile(); FileWriter fw = new FileWriter(statsData.getAbsoluteFile()); bw = new BufferedWriter(fw); bw.write(statData.getPerfData()); } catch (IOException e) { String errorMsg = MessageFormat.format( Messages.PerfSaveStat_error_msg, new Object[] { statsData.getName() }); MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.PerfSaveStat_error_title, errorMsg); } finally { if (bw != null) { try { bw.close(); } catch (IOException ex) { ex.printStackTrace(); } } } } }
Source:
public TableStatistics(Schema schema) { this.schema = schema; minValues = new VTuple(schema.size()); maxValues = new VTuple(schema.size()); numNulls = new long[schema.size()]; comparable = new boolean[schema.size()]; DataType type; for (int i = 0; i < schema.size(); i++) { type = schema.getColumn(i).getDataType(); if (type.getType() == Type.PROTOBUF) { comparable[i] = false; } else { comparable[i] = true; } } stat = new TableStats(); }

Target:
public TableStatistics(Schema schema) { this.schema = schema; minValues = new VTuple(schema.size()); maxValues = new VTuple(schema.size()); numNulls = new long[schema.size()]; comparable = new boolean[schema.size()]; DataType type; for (int i = 0; i < schema.size(); i++) { type = schema.getColumn(i).getDataType(); if (type.getType() == Type.PROTOBUF) { comparable[i] = false; } else { comparable[i] = true; } } }
Source:
public CacheManager createCacheManager(CacheConfig cacheConfig, CacheStats cacheStats) { return cacheConfig.getBaseDirectory() == null ? new NoOpCacheManager() : new LocalRangeCacheManager( cacheConfig, cacheStats, newScheduledThreadPool(5, daemonThreadsNamed("hdfs-cache-flusher-%s")), newScheduledThreadPool(1, daemonThreadsNamed("hdfs-cache-remover-%s"))); }

Target:
public CacheManager createCacheManager(CacheConfig cacheConfig, CacheStats cacheStats) { return cacheConfig.getBaseDirectory() == null ? new NoOpCacheManager() : new LocalRangeCacheManager( cacheConfig, cacheStats, newScheduledThreadPool(5, daemonThreadsNamed("raptor-cache-flusher-%s")), newScheduledThreadPool(1, daemonThreadsNamed("raptor-cache-remover-%s"))); }
Source:
private String getRootPath(String rootRamlFileUrl) { List<String> urlSegments = Lists.newArrayList(rootRamlFileUrl.split("/")); if (urlSegments.isEmpty()) { return ""; } urlSegments.remove(urlSegments.size() - 1); return StringUtils.join(urlSegments, "/"); }

Target:
private String getRootPath(String rootRamlFileUrl) { final List<String> urlSegments = Splitter.on("/").splitToList(rootRamlFileUrl); if (urlSegments.isEmpty()) { return ""; } return Joiner.on("/").join(limit(urlSegments, urlSegments.size() - 1)); }
Source:
public void launch() { entity.setAttribute(HazelcastNode.PID_FILE, Os.mergePathsUnix(getRunDir(), PID_FILENAME)); StringBuilder commandBuilder = new StringBuilder() .append(format("nohup java -cp ./lib/hazelcast-%s.jar", getVersion())); if (entity.getConfig(HazelcastNode.TEMPLATE_CONFIGURATION_URL) != null) { commandBuilder.append(" -Dhazelcast.config=" + Os.mergePaths(getRunDir(), "conf", getConfigFile())); } commandBuilder.append(" com.hazelcast.core.server.StartServer >> ./log/out.log 2>&1 </dev/null &"); newScript(MutableMap.of(USE_PID_FILE, true), LAUNCHING) .updateTaskAndFailOnNonZeroResultCode() .body.append(commandBuilder.toString()) .execute(); }

Target:
public void launch() { entity.setAttribute(HazelcastNode.PID_FILE, Os.mergePathsUnix(getRunDir(), PID_FILENAME)); String maxHeapMemorySize = getHeapMemorySize(); if (LOG.isInfoEnabled()) { LOG.info("Launching with heap memory of {}", entity, maxHeapMemorySize); } String initialHeapMemorySize = maxHeapMemorySize; StringBuilder commandBuilder = new StringBuilder() .append(format("nohup java -cp ./lib/%s", resolver.getFilename())) .append(format(" -Xmx%s -Xms%s", maxHeapMemorySize, initialHeapMemorySize)) .append(format(" -Dhazelcast.config=./conf/%s", getConfigFileName())) .append(format(" com.hazelcast.core.server.StartServer >> %s 2>&1 </dev/null &", getLogFileLocation())); newScript(MutableMap.of(USE_PID_FILE, true), LAUNCHING) .updateTaskAndFailOnNonZeroResultCode() .body.append(commandBuilder.toString()) .execute(); }
Source:
void printGitProperties() { if (gitPropertiesPrinted) { return; } gitPropertiesPrinted = true; try (InputStream in = getClass().getResourceAsStream("/git.properties"); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); ) { String line; while ((line = reader.readLine()) != null) { System.out.println(line); } } catch (IOException e) { System.out.println("IOException while reading git.properties: " + e.getMessage()); } }

Target:
private void printGitProperties() { if (gitPropertiesPrinted) { return; } gitPropertiesPrinted = true; try (InputStream in = getClass().getResourceAsStream("/git.properties"); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); ) { String line; while ((line = reader.readLine()) != null) { System.out.println(line); } } catch (IOException e) { System.out.println("IOException while reading git.properties: " + e.getMessage()); } }
Source:
protected synchronized void modified(Map<String, Object> config) { final String language = toStringOrNull(config.get(LANGUAGE)); final String script = toStringOrNull(config.get(SCRIPT)); final String region = toStringOrNull(config.get(REGION)); final String variant = toStringOrNull(config.get(VARIANT)); final String location = toStringOrNull(config.get(LOCATION)); final String zoneId = toStringOrNull(config.get(TIMEZONE)); final String measurementSystem = toStringOrNull(config.get(MEASUREMENT_SYSTEM)); setTimeZone(zoneId); setLocation(location); setLocale(language, script, region, variant); setMeasurementSystem(measurementSystem); logger.info("Locale set to {}, Location set to {}, Time zone set to {}", locale, this.location, this.timeZone); }

Target:
protected synchronized void modified(Map<String, Object> config) { final String language = toStringOrNull(config.get(LANGUAGE)); final String script = toStringOrNull(config.get(SCRIPT)); final String region = toStringOrNull(config.get(REGION)); final String variant = toStringOrNull(config.get(VARIANT)); final String location = toStringOrNull(config.get(LOCATION)); final String zoneId = toStringOrNull(config.get(TIMEZONE)); final String measurementSystem = toStringOrNull(config.get(MEASUREMENT_SYSTEM)); setTimeZone(zoneId); setLocation(location); setLocale(language, script, region, variant); setMeasurementSystem(measurementSystem); }
Source:
private void parseProperties() { for(String arg : getPrefixArguments()) { Argument argument = new Argument(); argument.setName( getArgAttrValue(arg, "name") ); if (argument.getName() == null) { throw new IllegalArgumentException( String.format("Invalid configuration. Parameter '%1$s' has no name", arg) ); } argument.setMetavar( getArgAttrValue(arg, "metavar") ); argument.setHelp( getArgAttrValue(arg, "help") ); argument.setDefaultValue( getArgAttrValue(arg, "default") ); argument.setValue( getArgAttrValue(arg, "value") ); argument.setMultivalue( Boolean.parseBoolean( getArgAttrValue(arg, "multivalue") ) ); argument.setMandatory( Boolean.parseBoolean( getArgAttrValue(arg, "mandatory") ) ); argument.setType( Argument.Type.valueOfIgnoreCase( getArgAttrValue(arg, "type") ) ); argument.setMatcher( Pattern.compile( getArgAttrValue(arg, "matcher") ) ); try { argument.setValueType( Class.forName( getArgAttrValue(arg, "valuetype"), true, Thread.currentThread().getContextClassLoader() ) ); } catch (ClassNotFoundException ex) { throw new IllegalArgumentException( String.format("Can't convert argument: '%1$s'. Please check valuetype in properties file.", arg) ); } for(Map.Entry<String, String> constant : constants.entrySet()) { if(argument.getDefaultValue() != null) { argument.setDefaultValue( argument.getDefaultValue().replace(constant.getKey(), constant.getValue()) ); } } if (argument.isMandatory()) { mandatory.add(argument.getName()); } arguments.put(argument.getName(), argument); } }

Target:
private void parseProperties() { for(String arg : getPrefixArguments()) { Argument argument = new Argument(); argument.setName( getArgAttrValue(arg, "name") ); if (argument.getName() == null) { throw new IllegalArgumentException( String.format("Invalid configuration. Parameter '%1$s' has no name", arg) ); } argument.setMetavar( getArgAttrValue(arg, "metavar") ); argument.setHelp( getArgAttrValue(arg, "help") ); argument.setDefaultValue( getArgAttrValue(arg, "default") ); argument.setValue( getArgAttrValue(arg, "value") ); argument.setMultivalue( Boolean.parseBoolean( getArgAttrValue(arg, "multivalue") ) ); argument.setMandatory( Boolean.parseBoolean( getArgAttrValue(arg, "mandatory") ) ); argument.setType( Argument.Type.valueOfIgnoreCase( getArgAttrValue(arg, "type") ) ); argument.setMatcher( Pattern.compile( getArgAttrValue(arg, "matcher") ) ); try { argument.setValueType( Class.forName( getArgAttrValue(arg, "valuetype"), true, Thread.currentThread().getContextClassLoader() ) ); } catch (ClassNotFoundException ex) { throw new IllegalArgumentException( String.format("Can't convert argument: '%1$s'. Please check valuetype in properties file.", arg) ); } if (argument.isMandatory()) { mandatory.add(argument.getName()); } arguments.put(argument.getName(), argument); } }
Source:
protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http .authorizeRequests() .antMatchers("/admin resources/**").permitAll() .antMatchers("/js/toggle.js").permitAll() .anyRequest().authenticated() .and() .formLogin() .loginPage("/pages/Main.jsf") .loginProcessingUrl("/login") .defaultSuccessUrl("/pages/Main.jsf") .permitAll() .and() .logout() .logoutUrl("/logout") .logoutSuccessUrl("/pages/Main.jsf"); }

Target:
protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http .authorizeRequests() .antMatchers("/admin resources/**").permitAll() .antMatchers("/js/toggle.js").permitAll() .antMatchers("/pages/aktiveNutzer.jsf").permitAll() .anyRequest().authenticated() .and() .formLogin() .loginPage("/pages/Main.jsf") .loginProcessingUrl("/login") .defaultSuccessUrl("/pages/Main.jsf") .permitAll() .and() .logout() .logoutUrl("/logout") .logoutSuccessUrl("/pages/Main.jsf"); }
Source:
public void setVisible(boolean visible) { if (!removed_ && visible != visible_) { visible_ = visible; handlers_.fireEvent(new VisibleChangedEvent(this)); } if (Desktop.isDesktop()) DesktopMenuCallback.setCommandVisible(id_, visible_); }

Target:
public void setVisible(boolean visible) { if (!removed_ && visible != visible_) { visible_ = visible; handlers_.fireEvent(new VisibleChangedEvent(this)); } }
Source:
private SafeHtml navigateDiff() { SafeHtmlBuilder b = new SafeHtmlBuilder(); if (Gerrit.isSignedIn() && DiffView.UNIFIED_DIFF.equals(Gerrit.getUserAccount() .getGeneralPreferences().getDiffView())) { b.openAnchor().setAttribute("title", "Switch to Side-By-Side view") .append("Side-by-Side").closeAnchor(); } else if (Gerrit.isSignedIn() && DiffView.SIDE_BY_SIDE.equals(Gerrit.getUserAccount() .getGeneralPreferences().getDiffView())) { b.openAnchor().setAttribute("title", "Switch to Unified view") .append("Unified").closeAnchor(); } return b; }

Target:
private SafeHtml navigateDiff() { SafeHtmlBuilder b = new SafeHtmlBuilder(); if (Gerrit.isSignedIn()) { if (DiffView.UNIFIED_DIFF.equals(Gerrit.getUserAccount() .getGeneralPreferences().getDiffView())) { b.openAnchor().setAttribute("title", Util.C.sideBySideView()) .append("Side-by-Side").closeAnchor(); } else if (DiffView.SIDE_BY_SIDE.equals(Gerrit.getUserAccount() .getGeneralPreferences().getDiffView())) { b.openAnchor().setAttribute("title", Util.C.unifiedView()) .append("Unified").closeAnchor(); } } return b; }
Source:
public void getExperimentAsUser(final String userId, final String problemId, final String sessionInfo, final MultiConnectionManager internalConnections) throws DatabaseAccessException { LOG.info("Getting experiment for user: ", userId); LOG.error("Problem: ", problemId); SubmissionManager.mongoGetExperiment(getInstance().database, userId, problemId, sessionInfo, internalConnections); }

Target:
public void getExperimentAsUser(final String userId, final String problemId, final String sessionInfo, final MultiConnectionManager internalConnections) throws DatabaseAccessException { LOG.debug("Getting experiment for user: {}", userId); LOG.info("Problem: {}", problemId); SubmissionManager.mongoGetExperiment(getInstance().database, userId, problemId, sessionInfo, internalConnections); }
Source:
public boolean canConvert(final Class aClass) { return aClass.equals(DMNExternalLink.class) || aClass.equals(TDMNExternalLink.class); }

Target:
public boolean canConvert(final Class aClass) { return Objects.equals(aClass, DMNExternalLink.class) || Objects.equals(aClass, TDMNExternalLink.class); }
Source:
public RealmObjectSchema setClassName(String className) { checkEmpty(className); if (57 < className.length()) { throw new IllegalArgumentException("Class name length exceeds 57 characters."); } String internalTableName = Table.TABLE_PREFIX + className; if (transaction.hasTable(internalTableName)) { throw new IllegalArgumentException("Class already exists: " + className); } String oldTableName = null; String pkField = null; if (table.hasPrimaryKey()) { oldTableName = table.getName(); pkField = getPrimaryKey(); table.setPrimaryKey(null); } transaction.renameTable(table.getName(), internalTableName); if (pkField != null && !pkField.isEmpty()) { try { table.setPrimaryKey(pkField); } catch (Exception e) { transaction.renameTable(table.getName(), oldTableName); throw e; } } return this; }

Target:
public RealmObjectSchema setClassName(String className) { checkEmpty(className); String internalTableName = Table.TABLE_PREFIX + className; if (internalTableName.length() > Table.TABLE_MAX_LENGTH) { throw new IllegalArgumentException("Class name is to long. Limit is 56 characters: \'" + className + "\' (" + Integer.toString(className.length()) + ")"); } if (transaction.hasTable(internalTableName)) { throw new IllegalArgumentException("Class already exists: " + className); } String oldTableName = null; String pkField = null; if (table.hasPrimaryKey()) { oldTableName = table.getName(); pkField = getPrimaryKey(); table.setPrimaryKey(null); } transaction.renameTable(table.getName(), internalTableName); if (pkField != null && !pkField.isEmpty()) { try { table.setPrimaryKey(pkField); } catch (Exception e) { transaction.renameTable(table.getName(), oldTableName); throw e; } } return this; }
Source:
protected Mono<Void> handleMessageInternal(Message<?> message) { initStreamOperations(); if (!StringUtils.hasText(this.streamKey)) { this.streamKey = this.streamKeyExpression.getValue(this.evaluationContext, message, String.class); } Object value = message; if (this.extractPayload) { value = message.getPayload(); } ObjectRecord<String, Object> record = StreamRecords .<String, Object>objectBacked(value) .withStreamKey(this.streamKey); return this.reactiveStreamOperations.add(record); }

Target:
protected Mono<Void> handleMessageInternal(Message<?> message) { String streamKey = this.streamKeyExpression.getValue(this.evaluationContext, message, String.class); Assert.notNull(streamKey, "'streamKey' must not be null"); Object value = message; if (this.extractPayload) { value = message.getPayload(); } ObjectRecord record = StreamRecords .objectBacked(value) .withStreamKey(streamKey); return this.reactiveStreamOperations.add(record); }
Source:
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { ITypedRegion partition = null; IDocument document = viewer.getDocument(); try { partition = document.getPartition(offset); } catch (BadLocationException e1) { e1.printStackTrace(); } String prefix = ""; String prePrefix = ""; try { prefix = getPrefix(document, offset); prePrefix = getPrecedingToken(document, prefix, offset); } catch (BadLocationException e) { return NO_COMPLETIONS; } if (prePrefix.startsWith("probe")){ return getProbeCompletionList(prefix, offset); } if (partition.getType() == IDocument.DEFAULT_CONTENT_TYPE ){ return getGlobalKeywordCompletion(prefix, offset); } return NO_COMPLETIONS; }

Target:
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { return computeCompletionProposals(viewer.getDocument(), offset); }
Source:
public void verifyCorrectService() { assertNotNull(homeDir); assertTrue(new Path(homeDir).toFile().exists()); String rtType = ParameterUtils.serverHomeToRuntimeType.get(homeDir); assertNotNull(rtType); IJBoss7ManagerService service = AS7ManagerTestUtils.findService(rtType); assertNotNull("Management Service for runtime type " + rtType + " not found.", service); IJBoss7ManagerService service2 = JBoss7ManagerUtil.getService(rtType); assertNotNull("Management Service for runtime type " + rtType + " not found.", service); assertTrue(service instanceof JBoss7ManagerServiceProxy); assertTrue(service instanceof ServiceTracker); Object o = ((ServiceTracker)service).getService(); assertNotNull(o); }

Target:
public void verifyCorrectService() { assertNotNull(homeDir); assertTrue(new Path(homeDir).toFile().exists()); String rtType = ParameterUtils.serverHomeToRuntimeType.get(homeDir); assertNotNull(rtType); IJBoss7ManagerService service = AS7ManagerTestUtils.findService(rtType); assertNotNull("Management Service for runtime type " + rtType + " not found.", service); IJBoss7ManagerService service2 = JBoss7ManagerUtil.getService(rtType); assertNotNull("Management Service for runtime type " + rtType + " not found.", service2); assertTrue(service instanceof JBoss7ManagerServiceProxy); assertTrue(service instanceof ServiceTracker); Object o = ((ServiceTracker)service).getService(); assertNotNull(o); }
Source:
public void onReceive(Context context, Intent intent) { Intent service = new Intent(context, SwrveWakefulService.class); if(intent.hasExtra(SwrveWakefulService.EXTRA_EVENTS)) { ArrayList<String> events = intent.getExtras().getStringArrayList(SwrveWakefulService.EXTRA_EVENTS); SwrveLogger.i(LOG_TAG, "SwrveWakefulReceiver. Events: " + events); service.putExtras(intent); } if(intent.hasExtra(SwrveWakefulService.EXTRA_LOCATIONS_IMPRESSION_IDS)) { ArrayList<Integer> events = intent.getExtras().getIntegerArrayList(SwrveWakefulService.EXTRA_LOCATIONS_IMPRESSION_IDS); SwrveLogger.i(LOG_TAG, "SwrveWakefulReceiver. Location impression events: " + events); service.putExtras(intent); } if(intent.hasExtra(SwrveWakefulService.EXTRA_LOCATIONS_ENGAGED_IDS)) { ArrayList<Integer> events = intent.getExtras().getIntegerArrayList(SwrveWakefulService.EXTRA_LOCATIONS_ENGAGED_IDS); SwrveLogger.i(LOG_TAG, "SwrveWakefulReceiver. Location engagement events: " + events); service.putExtras(intent); } startWakefulService(context, service); }

Target:
public void onReceive(Context context, Intent intent) { Intent service = new Intent(context, SwrveWakefulService.class); if(intent.hasExtra(SwrveWakefulService.EXTRA_EVENTS)) { ArrayList<String> events = intent.getExtras().getStringArrayList(SwrveWakefulService.EXTRA_EVENTS); SwrveLogger.i(LOG_TAG, "SwrveWakefulReceiver. Events: " + events); service.putExtras(intent); } startWakefulService(context, service); }
Source:
public void updateContext(JexlContext context, CollectionResource resource) { try { ObjectName oname = new ObjectName(resource.getUnmodifiedInstance()); context.set("ObjectName", oname); context.set("domain", oname.getDomain() == null ? "" : oname.getDomain()); oname.getKeyPropertyList().entrySet().forEach((entry) -> { final String value = entry.getValue(); if (value.startsWith(QUOTE) && value.endsWith(QUOTE)) { context.set(entry.getKey(), ObjectName.unquote(entry.getValue())); } else { context.set(entry.getKey(), entry.getValue()); } }); } catch (javax.management.MalformedObjectNameException e) { LOG.debug("getResourceNameFromIndex(): malformed object name: {}", resource.getInstance(), e); } }

Target:
public void updateContext(JexlContext context, CollectionResource resource) throws IllegalArgumentException { try { ObjectName oname = new ObjectName(resource.getUnmodifiedInstance()); context.set("ObjectName", oname); context.set("domain", oname.getDomain() == null ? "" : oname.getDomain()); oname.getKeyPropertyList().entrySet().forEach((entry) -> { final String value = entry.getValue(); if (value.startsWith(QUOTE) && value.endsWith(QUOTE)) { context.set(entry.getKey(), ObjectName.unquote(entry.getValue())); } else { context.set(entry.getKey(), entry.getValue()); } }); } catch (javax.management.MalformedObjectNameException e) { final String msg = "Malformed ObjectName: " + resource.getUnmodifiedInstance(); LOG.error("getResourceNameFromIndex(): {}", msg, e); throw new IllegalArgumentException(msg); } }
Source:
public Set<? extends Volume> findNonremovedVolumesWithNoOtherMounts(long instanceId) { List<VolumeRecord> vols = create() .selectDistinct(VOLUME.fields()) .from(MOUNT) .join(VOLUME) .on(VOLUME.ID.eq(MOUNT.VOLUME_ID).and(VOLUME.REMOVED.isNull())) .where(MOUNT.VOLUME_ID.in( create().select(MOUNT.VOLUME_ID).from(MOUNT).where(MOUNT.INSTANCE_ID.eq(instanceId)))) .groupBy(MOUNT.VOLUME_ID) .having(count(MOUNT.VOLUME_ID).eq(1).or(countDistinct(MOUNT.INSTANCE_ID).eq(1))) .fetchInto(VolumeRecord.class); Set<? extends Volume> volumes = new HashSet<Volume>(vols); return volumes; }

Target:
public Set<? extends Volume> findNonremovedVolumesWithNoOtherMounts(long instanceId) { List<Long> instanceVolumeIds = create() .select(MOUNT.VOLUME_ID) .from(MOUNT) .where(MOUNT.INSTANCE_ID.eq(instanceId)) .fetchInto(Long.class); List<Long> inelligibleVolumeIds = create() .select(MOUNT.VOLUME_ID) .from(MOUNT) .where(MOUNT.VOLUME_ID.in(instanceVolumeIds) .and(MOUNT.INSTANCE_ID.ne(instanceId)) .and(MOUNT.STATE.in(INELLIGIBLE_STATES))) .fetchInto(Long.class); Set<Long> volumeIds = new HashSet<Long>(instanceVolumeIds); volumeIds.removeAll(inelligibleVolumeIds); List<VolumeRecord> vols = create() .select(VOLUME.fields()) .from(VOLUME) .where(VOLUME.ID.in(volumeIds)) .and(VOLUME.REMOVED.isNull()) .fetchInto(VolumeRecord.class); Set<? extends Volume> volumes = new HashSet<Volume>(vols); return volumes; }
Source:
private void updateCache(final Request req, final Response rsp) { if (rsp.headers().containsKey(this.scvh)) { this.cache.put(req, rsp); } else { this.cache.remove(req); } }

Target:
private void updateCache(final Request req, final Response rsp) { if (rsp.headers().containsKey(this.scvh)) { this.cache.put(req, rsp); } else if (rsp.status() == HttpURLConnection.HTTP_OK) { this.cache.remove(req); } }