auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void close(Throwable error) { if(setClose()) { se.setClientOperations(this); this.getClientsThreadExecutor().execute(new Runnable() { @Override public void run() { synchronized(writerLock) { if(writeFutures.size() > 0) { final ClosedChannelException cce = new ClosedChannelException(); for(final Pair<Long, SettableListenableFuture<Long>> p: writeFutures) { p.getRight().setFailure(cce); } } writeFutures.clear(); writeBuffers.discard(writeBuffers.remaining()); } if(!connectionFuture.isDone()) { connectionFuture.setFailure(error); } if(sslProcessor != null) { sslProcessor.failHandshake(error); } }}); this.callClosers(error); } }

Target:
public void close(Throwable error) { if(setClose()) { se.setClientOperations(this); this.getClientsThreadExecutor().execute(new Runnable() { @Override public void run() { synchronized(writerLock) { if(writeFutures.size() > 0) { final ClosedChannelException cce = new ClosedChannelException(); for(final Pair<Long, SettableListenableFuture<Long>> p: writeFutures) { p.getRight().setFailure(cce); } } writeFutures.clear(); writeBuffers.discard(writeBuffers.remaining()); } connectionFuture.setFailure(error); if(sslProcessor != null) { sslProcessor.failHandshake(error); } }}); this.callClosers(error); } }
Source:
public void testFooNoInterceptors(@Produced("empty") Foo foo) { assertEquals(Foo.class, foo.getClass());; assertEquals("pong", foo.ping()); }

Target:
public void testFooNoInterceptors(@Produced("empty") Foo foo) { assertEquals(Foo.class, foo.getClass()); assertEquals("pong", foo.ping()); }
Source:
private ContentValues ensureAfter() { ContentValues values = mAfterContentValues; if (values == null) { values = new ContentValues(); mAfterContentValues = values; mAfterKeys = new HashSet<>(); } return values; }

Target:
private ContentValues ensureAfter() { ContentValues values = mAfterContentValues; if (values == null) { values = new ContentValues(); mAfterContentValues = values; } return values; }
Source:
public static Client init(@NonNull Context androidContext) { synchronized (lock) { if (client == null) { client = new Client(androidContext); NativeInterface.configureClientObservers(client); } else { logClientInitWarning(); } } return client; }

Target:
public static Client init(@NonNull Context androidContext) { return init(androidContext, null, true); }
Source:
public void shutdown() { synchronized (this) { log.info("Scheduled shutdown for {}", this); stopping = true; notify(); } }

Target:
public synchronized void shutdown() { log.info("Scheduled shutdown for {}", this); stopping = true; notify(); }
Source:
public void testExactMatchBeforeCoercion() { TypeRegistry typeManager = new TypeRegistry(); FunctionManager functionManager = new FunctionManager(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); boolean foundOperator = false; for (SqlFunction function : functionManager.listOperators()) { OperatorType operatorType = tryGetOperatorType(function.getSignature().getName()).get(); if (operatorType == CAST || operatorType == SATURATED_FLOOR_CAST) { continue; } if (!function.getSignature().getTypeVariableConstraints().isEmpty()) { continue; } if (function.getSignature().getArgumentTypes().stream().anyMatch(TypeSignature::isCalculated)) { continue; } BuiltInFunctionHandle exactOperator = (BuiltInFunctionHandle) functionManager.resolveOperator(operatorType, fromTypeSignatures(function.getSignature().getArgumentTypes())); assertEquals(exactOperator.getSignature(), function.getSignature()); foundOperator = true; } assertTrue(foundOperator); }

Target:
public void testExactMatchBeforeCoercion() { TypeRegistry typeManager = new TypeRegistry(); FunctionManager functionManager = createFunctionManager(typeManager); boolean foundOperator = false; for (SqlFunction function : functionManager.listOperators()) { OperatorType operatorType = tryGetOperatorType(function.getSignature().getName()).get(); if (operatorType == CAST || operatorType == SATURATED_FLOOR_CAST) { continue; } if (!function.getSignature().getTypeVariableConstraints().isEmpty()) { continue; } if (function.getSignature().getArgumentTypes().stream().anyMatch(TypeSignature::isCalculated)) { continue; } BuiltInFunctionHandle exactOperator = (BuiltInFunctionHandle) functionManager.resolveOperator(operatorType, fromTypeSignatures(function.getSignature().getArgumentTypes())); assertEquals(exactOperator.getSignature(), function.getSignature()); foundOperator = true; } assertTrue(foundOperator); }
Source:
private Entry<String, org.eclipse.emf.common.command.Command> getCommandToActivateLayerShowingElementAndPArents(DDiagram parentDiagram, final Set<DDiagramElement> elementSet) { CompoundCommand layerCompoundCommand = new CompoundCommand(); Optional<Session> optionalSession = Session.of(parentDiagram); Set<String> layersToActivateList = new HashSet<>(); if (optionalSession.isPresent()) { DiagramMappingsManager mappingManager = DiagramMappingsManagerRegistry.INSTANCE.getDiagramMappingsManager(optionalSession.get(), parentDiagram); for (DDiagramElement dDiagramElement : elementSet) { if (mappingManager.getActiveParentLayers(dDiagramElement.getDiagramElementMapping()).size() <= 0) { Layer layerToActivate = getLayerToActivate(parentDiagram, dDiagramElement, mappingManager); if (layerToActivate != null) { final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(parentDiagram); if (!layersToActivateList.contains(layerToActivate.getName())) { layerCompoundCommand.append(new ChangeLayerActivationCommand(domain, parentDiagram, layerToActivate, new NullProgressMonitor())); layersToActivateList.add(layerToActivate.getName()); } } } } } return layerCompoundCommand.getCommandList().size() > 0 ? new SimpleEntry<String, org.eclipse.emf.common.command.Command>(layersToActivateList.stream().collect(Collectors.joining(", ")), layerCompoundCommand) : null; }

Target:
private Entry<String, org.eclipse.emf.common.command.Command> getCommandToActivateLayerShowingElementAndPArents(DDiagram parentDiagram, final Set<DDiagramElement> elementSet) { CompoundCommand layerCompoundCommand = new CompoundCommand(); Optional<Session> optionalSession = Session.of(parentDiagram); Collection<String> layersToActivate = new LinkedHashSet<>(); if (optionalSession.isPresent()) { DiagramMappingsManager mappingManager = DiagramMappingsManagerRegistry.INSTANCE.getDiagramMappingsManager(optionalSession.get(), parentDiagram); for (DDiagramElement dDiagramElement : elementSet) { if (mappingManager.getActiveParentLayers(dDiagramElement.getDiagramElementMapping()).size() <= 0) { Layer layerToActivate = getLayerToActivate(parentDiagram, dDiagramElement, mappingManager); if (layerToActivate != null) { final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(parentDiagram); if (!layersToActivate.contains(layerToActivate.getName())) { layerCompoundCommand.append(new ChangeLayerActivationCommand(domain, parentDiagram, layerToActivate, new NullProgressMonitor())); layersToActivate.add(layerToActivate.getName()); } } } } } return layerCompoundCommand.getCommandList().size() > 0 ? new SimpleEntry<String, org.eclipse.emf.common.command.Command>(layersToActivate.stream().collect(Collectors.joining(", ")), layerCompoundCommand) : null; }
Source:
private void editNodeSourceAndCheckOutput(String nodeSourceName) { String nodeSourceInfrastructureClass = "org.ow2.proactive.resourcemanager.nodesource.infrastructure.LocalInfrastructure"; String nodeSourcePolicyClass = "org.ow2.proactive.resourcemanager.nodesource.policy.StaticPolicy"; System.out.println(LOG_HEADER + " Test editns command"); this.clearAndTypeLine("editns( '" + nodeSourceName + "', ['" + nodeSourceInfrastructureClass + "', '" + rmCredentialPath + "', " + MODIFIED_NB_NODES + ", 60000, ''], ['" + nodeSourcePolicyClass + "', 'ALL', 'ALL'], 'false')"); this.runCli(); String out = this.capturedOutput.toString(); System.setOut(this.stdOut); System.out.println(out); assertThat(out).contains("Node source successfully edited."); }

Target:
private void editNodeSourceAndCheckOutput(String nodeSourceName) { System.out.println(LOG_HEADER + " Test editns command"); this.clearAndTypeLine("editns( '" + nodeSourceName + "', " + modifiedInfrastructureParametersString + ", " + policyParametersString + ", 'false')"); this.runCli(); String out = this.capturedOutput.toString(); System.setOut(this.stdOut); System.out.println(out); assertThat(out).contains("Node source successfully edited."); }
Source:
private Module bindAutoBindSingletons(BootstrapBinder binder) { List<Module> modules = Lists.newArrayList(); for (final Class<?> clazz : classpathScanner.getClasses()) { if (ignoreClasses.contains(clazz) || !clazz.isAnnotationPresent(AutoBindSingleton.class)) { continue; } AutoBindSingleton annotation = clazz.getAnnotation(AutoBindSingleton.class); if (Module.class.isAssignableFrom(clazz)) { Preconditions.checkState( annotation.value() == AutoBindSingleton.class, "@AutoBindSingleton value cannot be set for Modules"); Preconditions.checkState( annotation.baseClass() == AutoBindSingleton.class, "@AutoBindSingleton value cannot be set for Modules"); Preconditions.checkState( !annotation.multiple(), "@AutoBindSingleton(multiple=true) value cannot be set for Modules"); LOG.info("Found @AutoBindSingleton annotated module : ", clazz.getName()); LOG.info("***** @AutoBindSingleton for module is deprecated as of 10/10/2015. Modules should be added directly to the injector or via install({}.class). See <LINK_0>", clazz.getName(), clazz.getSimpleName()); binder.include((Class<? extends Module>) clazz); } } return Modules.combine(modules); }

Target:
private Module bindAutoBindSingletons(BootstrapBinder binder) { List<Module> modules = Lists.newArrayList(); for (final Class<?> clazz : classpathScanner.getClasses()) { if (ignoreClasses.contains(clazz) || !clazz.isAnnotationPresent(AutoBindSingleton.class)) { continue; } AutoBindSingleton annotation = clazz.getAnnotation(AutoBindSingleton.class); if (Module.class.isAssignableFrom(clazz)) { Preconditions.checkState( annotation.value() == AutoBindSingleton.class, "@AutoBindSingleton value cannot be set for Modules"); Preconditions.checkState( annotation.baseClass() == AutoBindSingleton.class, "@AutoBindSingleton value cannot be set for Modules"); Preconditions.checkState( !annotation.multiple(), "@AutoBindSingleton(multiple=true) value cannot be set for Modules"); LOG.info("Found @AutoBindSingleton annotated module : ", clazz.getName()); LOG.info("***** @AutoBindSingleton use for module is deprecated as of 2015-10-10. Modules should be added directly to the injector or via install({}.class). See <LINK_0>", clazz.getName(), clazz.getSimpleName()); binder.include((Class<? extends Module>) clazz); } } return Modules.combine(modules); }
Source:
public void testGetResponseInvalidAction() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME); groupRequest.setNesting(Arrays.asList("os", "device", "version")); AsyncDataToken dataToken = getQueryExecutor().executeAsync(groupRequest); Thread.sleep(1000); try { resources.client().target(String.format("/foxtrot/v1/async/distinct/%s", dataToken.getKey())).request().get(GroupResponse.class); } catch (WebApplicationException ex) { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), ex.getResponse().getStatus()); } }

Target:
public void testGetResponseInvalidAction() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME); groupRequest.setNesting(Arrays.asList("os", "device", "version")); AsyncDataToken dataToken = getQueryExecutor().executeAsync(groupRequest); Thread.sleep(1000); GroupResponse response = resources.client().target(String.format("/foxtrot/v1/async/distinct/%s", dataToken.getKey())).request().get(GroupResponse.class); assertNull(response); }
Source:
byte[] getPrototypeClassBytecode() throws IOException { if (prototypeClassBytecode == null) { ClassLoader cl = prototypeClass.getClassLoader(); InputStream prototypeClassBytecodeStream = cl.getResourceAsStream(prototypeClassBytecodeName + ".class"); prototypeClassBytecode = ByteStreams.toByteArray(prototypeClassBytecodeStream); } return prototypeClassBytecode; }

Target:
byte[] getPrototypeClassBytecode() throws IOException { if (prototypeClassBytecode == null) { ClassLoader cl = prototypeClass.getClassLoader(); try (InputStream prototypeClassBytecodeStream = cl.getResourceAsStream(prototypeClassBytecodeName + ".class")) { prototypeClassBytecode = ByteStreams.toByteArray(prototypeClassBytecodeStream); } } return prototypeClassBytecode; }
Source:
public boolean isValid() { if (getOperationMode() == OperationModeType.STANDBY) { return true; } if (itemName == null || source == null || itemName.equals("") || source.equals("")) { return false; } else { return true; } }

Target:
public boolean isValid() { if (getOperationMode() == OperationModeType.STANDBY) { return true; } if (itemName == null || source == null || itemName.isEmpty() || source.isEmpty()) { return false; } else { return true; } }
Source:
private CepSink(final CepSinkType cepSinkType, final Map<String, Object> sinkConfigs, final String separator) { this.cepSinkType = cepSinkType; this.sinkConfigs = sinkConfigs; if(separator == null) { this.separator = ","; } else { this.separator = separator; } }

Target:
private CepSink(final CepSinkType cepSinkType, final Map<String, Object> sinkConfigs, final String separator) { this.cepSinkType = cepSinkType; this.sinkConfigs = sinkConfigs; this.separator = separator; }
Source:
public String getLog() { switch (typeValue) { case DATA: return condition.getLog(value) + ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp; case EVENT: default: return condition.getLog(event) + ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp; } }

Target:
public String getLog() { if (value != null) { return condition.getLog(value) + ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp; } else { return condition.getLog(event) + ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp; } }
Source:
private void gatherItemsFromBarrel(Location l, BlockMenu blockMenu, List<ItemStackAndInteger> items) { try { Config cfg = BlockStorage.getLocationInfo(blockMenu.getLocation()); String data = cfg.getString("storedItems"); if (data == null) { return; } int stored = Integer.parseInt(data); for (int slot : blockMenu.getPreset().getSlotsAccessedByItemTransport((DirtyChestMenu) blockMenu, ItemTransportFlow.WITHDRAW, null)) { ItemStack is = blockMenu.getItemInSlot(slot); if (is != null && CargoUtils.matchesFilter(this, l.getBlock(), is)) { boolean add = true; for (ItemStackAndInteger item : items) { if (SlimefunUtils.isItemSimilar(is, item.getItemStackWrapper(), true, false)) { add = false; item.add(is.getAmount() + stored); } } if (add) { items.add(new ItemStackAndInteger(is, is.getAmount() + stored)); } } } } catch (Exception x) { Slimefun.getLogger().log(Level.SEVERE, "An Exception occurred while trying to read data from a Barrel", x); } }

Target:
private void gatherItemsFromBarrel(Location l, BlockMenu blockMenu, List<ItemStackAndInteger> items) { try { Config cfg = BlockStorage.getLocationInfo(blockMenu.getLocation()); String data = cfg.getString("storedItems"); if (data == null) { return; } int stored = Integer.parseInt(data); for (int slot : blockMenu.getPreset().getSlotsAccessedByItemTransport((DirtyChestMenu) blockMenu, ItemTransportFlow.WITHDRAW, null)) { ItemStack stack = blockMenu.getItemInSlot(slot); if (stack != null && CargoUtils.matchesFilter(this, l.getBlock(), stack)) { boolean add = true; for (ItemStackAndInteger item : items) { if (SlimefunUtils.isItemSimilar(stack, item.getItemStackWrapper(), true, false)) { add = false; item.add(stack.getAmount() + stored); } } if (add) { items.add(new ItemStackAndInteger(stack, stack.getAmount() + stored)); } } } } catch (Exception x) { Slimefun.getLogger().log(Level.SEVERE, "An Exception occurred while trying to read data from a Barrel", x); } }
Source:
public static void onTossEvent(ItemTossEvent event) { PlayerInventory inventory = event.getPlayer().inventory; if(!event.getEntity().world.isRemote && getData(event.getPlayer()) != null) { EditData data = getData(event.getPlayer()); ItemStack stack = event.getEntityItem().getItem(); DeployEntry entry = DeployList.getEntryForItem(stack, data.connection, event.getEntity().world); if(entry != null && !isBlockItem(stack.getItem())) { GristSet cost = entry.getCurrentCost(data.connection); if(GristHelper.canAfford(PlayerSavedData.getData(data.connection.getClientIdentifier(), event.getPlayer().world).getGristCache(), cost)) { GristHelper.decrease(event.getPlayer().world, data.connection.getClientIdentifier(), cost); GristHelper.notify(event.getPlayer().world.getServer(), data.connection.getClientIdentifier(), cost, false); data.connection.setHasGivenItem(entry); if(!data.connection.isMain()) SkaianetHandler.get(event.getPlayer().getServer()).giveItems(data.connection.getClientIdentifier()); } else event.setCanceled(true); } else { event.setCanceled(true); } if(event.isCanceled()) { event.getEntityItem().remove(); if(!inventory.getItemStack().isEmpty()) inventory.setItemStack(ItemStack.EMPTY); else inventory.setInventorySlotContents(inventory.currentItem, ItemStack.EMPTY); } } }

Target:
public static void onTossEvent(ItemTossEvent event) { PlayerInventory inventory = event.getPlayer().inventory; if(!event.getEntity().world.isRemote && getData(event.getPlayer()) != null) { EditData data = getData(event.getPlayer()); ItemStack stack = event.getEntityItem().getItem(); DeployEntry entry = DeployList.getEntryForItem(stack, data.connection, event.getEntity().world); if(entry != null && !isBlockItem(stack.getItem())) { GristSet cost = entry.getCurrentCost(data.connection); if(GristHelper.canAfford(PlayerSavedData.getData(data.connection.getClientIdentifier(), event.getPlayer().world).getGristCache(), cost)) { GristHelper.decrease(event.getPlayer().world, data.connection.getClientIdentifier(), cost); GristHelper.notifyEditPlayer(event.getPlayer().world.getServer(), data.connection.getClientIdentifier(), cost, false); data.connection.setHasGivenItem(entry); if(!data.connection.isMain()) SkaianetHandler.get(event.getPlayer().getServer()).giveItems(data.connection.getClientIdentifier()); } else event.setCanceled(true); } else { event.setCanceled(true); } if(event.isCanceled()) { event.getEntityItem().remove(); if(!inventory.getItemStack().isEmpty()) inventory.setItemStack(ItemStack.EMPTY); else inventory.setInventorySlotContents(inventory.currentItem, ItemStack.EMPTY); } } }
Source:
public void commit() { ExecutionStatistics.get().begin("GraphService.commit"); this.context.getGraph().getBaseGraph().commit(); ExecutionStatistics.get().end("GraphService.commit"); }

Target:
public void commit() { ExecutionStatistics.performBenchmarked("GraphService.commit", new Task<Void>() { @Override public Void execute() { getGraphContext().getGraph().getBaseGraph().commit(); return null; } }); }
Source:
public void execute(SensorContext sensorContext) { final PageLexer pageLexer = new PageLexer(); final VueLexer vueLexer = new VueLexer(); FileSystem fileSystem = sensorContext.fileSystem(); final HtmlAstScanner scanner = setupScanner(sensorContext); FilePredicates predicates = fileSystem.predicates(); Iterable<InputFile> inputFiles = fileSystem.inputFiles( predicates.and( predicates.hasType(InputFile.Type.MAIN), predicates.or( predicates.hasLanguages(HtmlConstants.LANGUAGE_KEY, HtmlConstants.JSP_LANGUAGE_KEY), predicates.or(Stream.of(OTHER_FILE_SUFFIXES).map(predicates::hasExtension).toArray(FilePredicate[]::new)) ) )); for (InputFile inputFile : inputFiles) { if (sensorContext.isCancelled()) { return; } HtmlSourceCode sourceCode = new HtmlSourceCode(inputFile); try (Reader reader = new InputStreamReader(inputFile.inputStream(), inputFile.charset())) { PageLexer lexer = inputFile.filename().endsWith(".vue") ? vueLexer : pageLexer; scanner.scan(lexer.parse(reader), sourceCode); saveMetrics(sensorContext, sourceCode); saveLineLevelMeasures(inputFile, sourceCode); } catch (Exception e) { LOG.error("Cannot analyze file " + inputFile, e); sensorContext.newAnalysisError() .onFile(inputFile) .message(e.getMessage()) .save(); } } }

Target:
public void execute(SensorContext sensorContext) { FileSystem fileSystem = sensorContext.fileSystem(); final HtmlAstScanner scanner = setupScanner(sensorContext); FilePredicates predicates = fileSystem.predicates(); Iterable<InputFile> inputFiles = fileSystem.inputFiles( predicates.and( predicates.hasType(InputFile.Type.MAIN), predicates.or( predicates.hasLanguages(HtmlConstants.LANGUAGE_KEY, HtmlConstants.JSP_LANGUAGE_KEY), predicates.or(Stream.of(OTHER_FILE_SUFFIXES).map(predicates::hasExtension).toArray(FilePredicate[]::new)) ) )); for (InputFile inputFile : inputFiles) { if (sensorContext.isCancelled()) { return; } HtmlSourceCode sourceCode = new HtmlSourceCode(inputFile); try (Reader reader = new InputStreamReader(inputFile.inputStream(), inputFile.charset())) { PageLexer lexer = inputFile.filename().endsWith(".vue") ? new VueLexer() : new PageLexer(); scanner.scan(lexer.parse(reader), sourceCode); saveMetrics(sensorContext, sourceCode); saveLineLevelMeasures(inputFile, sourceCode); } catch (Exception e) { LOG.error("Cannot analyze file " + inputFile, e); sensorContext.newAnalysisError() .onFile(inputFile) .message(e.getMessage()) .save(); } } }
Source:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Map<UUID, Cards> cardsToDiscard = new HashMap<>(); if (controller == null) { return true; } for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player == null) { continue; } int numberOfCardsToDiscard = Math.min(1, player.getHand().size()); Cards cards = new CardsImpl(); Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, StaticFilters.FILTER_CARD, playerId); player.chooseTarget(outcome, target, source, game); cards.addAll(target.getTargets()); cardsToDiscard.put(playerId, cards); } for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player == null) { continue; } int amountDiscarded = player.discard(cardsToDiscard.get(playerId), source, game).size(); if (!playerId.equals(controller.getId()) && amountDiscarded == 0) { player.loseLife(3, game, false); } } return true; }

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Map<UUID, Cards> cardsToDiscard = new HashMap<>(); if (controller == null) { return true; } for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player == null) { continue; } int numberOfCardsToDiscard = Math.min(1, player.getHand().size()); Cards cards = new CardsImpl(); Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, StaticFilters.FILTER_CARD, playerId); player.chooseTarget(outcome, target, source, game); cards.addAll(target.getTargets()); cardsToDiscard.put(playerId, cards); } for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player == null) { continue; } int amountDiscarded = player.discard(cardsToDiscard.get(playerId), source, game).size(); if (controller.hasOpponent(playerId, game) && amountDiscarded == 0) { player.loseLife(3, game, false); } } return true; }
Source:
private void auditHost(HostVO host) { _hostDao.loadDetails(host); boolean validateDomains = true; List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByHost(host.getId()); if (!CollectionUtils.isEmpty(nuageVspDevices)) { for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { ConfigurationVO cmsIdConfig = _configDao.findByName("nuagevsp.cms.id"); String nuageVspCmsId = findNuageVspCmsIdForDevice(nuageVspDevice.getId(), cmsIdConfig); SyncNuageVspCmsIdCommand syncCmd = new SyncNuageVspCmsIdCommand(SyncType.AUDIT, nuageVspCmsId); SyncNuageVspCmsIdAnswer answer = (SyncNuageVspCmsIdAnswer) _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd); if (answer != null && !answer.getSuccess()) { s_logger.fatal("Nuage VSP Device with ID " + nuageVspDevice.getId() + " is configured with an unknown CMS ID!"); validateDomains = false; } else if (answer != null && answer.getSyncType() == SyncType.REGISTER) { registerNewNuageVspDevice(cmsIdConfig, nuageVspDevice.getId() + ":" + answer.getNuageVspCmsId()); } } } if (validateDomains) { auditDomainsOnVsp(host, true, false); } }

Target:
private void auditHost(HostVO host) { _hostDao.loadDetails(host); boolean validateDomains = true; List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByHost(host.getId()); if (!CollectionUtils.isEmpty(nuageVspDevices)) { for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { ConfigurationVO cmsIdConfig = _configDao.findByName("nuagevsp.cms.id"); String nuageVspCmsId = findNuageVspCmsIdForDevice(nuageVspDevice.getId(), cmsIdConfig); SyncNuageVspCmsIdCommand syncCmd = new SyncNuageVspCmsIdCommand(SyncType.AUDIT, nuageVspCmsId); SyncNuageVspCmsIdAnswer answer = (SyncNuageVspCmsIdAnswer) _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd); if (answer != null && !answer.getSuccess()) { s_logger.error("Nuage VSP Device with ID " + nuageVspDevice.getId() + " is configured with an unknown CMS ID!"); validateDomains = false; } else if (answer != null && answer.getSyncType() == SyncType.REGISTER) { registerNewNuageVspDevice(cmsIdConfig, nuageVspDevice.getId() + ":" + answer.getNuageVspCmsId()); } } } if (validateDomains) { auditDomainsOnVsp(host, true, false); } }
Source:
private void createFilteredTreeViewer(Composite parent) { PatternFilter filter = new ViewPatternFilter(context); int styleBits = SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; filteredTree = new FilteredTree(parent, styleBits, filter, true); filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); TreeViewer treeViewer = filteredTree.getViewer(); Control treeControl = treeViewer.getControl(); RGB dimmedRGB = blend(treeControl.getForeground().getRGB(), treeControl.getBackground() .getRGB(), 60); dimmedForeground = new Color(treeControl.getDisplay(), dimmedRGB); treeControl.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { dimmedForeground.dispose(); } }); treeViewer.setLabelProvider(new ViewLabelProvider(context, modelService, window, dimmedForeground)); treeViewer.setContentProvider(new ViewContentProvider(application)); treeViewer.setComparator(new ViewComparator()); treeViewer.setInput(application); treeViewer.addSelectionChangedListener(this); treeViewer.addDoubleClickListener(this); treeViewer.getControl().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { handleTreeViewerKeyPressed(e); } }); if (hasAtMostOneView(filteredTree.getViewer())) { Text filterText = filteredTree.getFilterControl(); if (filterText != null) { filterText.setEnabled(false); } } }

Target:
private void createFilteredTreeViewer(Composite parent) { PatternFilter filter = new ViewPatternFilter(context); int styleBits = SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; filteredTree = new FilteredTree(parent, styleBits, filter, true); filteredTree.setQuickSelectionMode(true); filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); TreeViewer treeViewer = filteredTree.getViewer(); Control treeControl = treeViewer.getControl(); RGB dimmedRGB = blend(treeControl.getForeground().getRGB(), treeControl.getBackground() .getRGB(), 60); dimmedForeground = new Color(treeControl.getDisplay(), dimmedRGB); treeControl.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { dimmedForeground.dispose(); } }); treeViewer.setLabelProvider(new ViewLabelProvider(context, modelService, window, dimmedForeground)); treeViewer.setContentProvider(new ViewContentProvider(application)); treeViewer.setComparator(new ViewComparator()); treeViewer.setInput(application); treeViewer.addSelectionChangedListener(this); treeViewer.addDoubleClickListener(this); treeViewer.getControl().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { handleTreeViewerKeyPressed(e); } }); if (hasAtMostOneView(filteredTree.getViewer())) { Text filterText = filteredTree.getFilterControl(); if (filterText != null) { filterText.setEnabled(false); } } }
Source:
public void setPercentiles(List<Double> percentiles) { percentilesArray.set(getGroupId(), requireNonNull(percentiles, "percentiles is null")); }

Target:
public void setPercentiles(List<Double> percentiles) { if (percentiles == null) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Percentiles is null"); } if (percentilesList != null && !percentilesList.equals(percentiles)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Percentiles must be constant"); } percentilesList = percentiles; }
Source:
public void reset() throws TimeoutException, XBeeException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); if (!isRemote()) logger.info(toString() + "Resetting the local module..."); else logger.info(toString() + "Resetting the remote module ({})...", get64BitAddress()); ATCommandResponse response = null; try { response = sendATCommand(new ATCommand("FR")); } catch (IOException e) { throw new XBeeException("Error writing in the communication interface.", e); } checkATCommandResponseIsValid(response); if (!waitForModemStatusPacket()) throw new TimeoutException("Timeout waiting for the Modem Status packet."); logger.info(toString() + "Module reset successfully."); }

Target:
public void reset() throws TimeoutException, XBeeException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); if (!isRemote()) logger.info(toString() + "Resetting the local module..."); else logger.info(toString() + "Resetting the remote module ({})...", get64BitAddress()); ATCommandResponse response = null; try { response = sendATCommand(new ATCommand("FR")); } catch (IOException e) { throw new XBeeException("Error writing in the communication interface.", e); } checkATCommandResponseIsValid(response); if (!isRemote()) { if (!waitForModemStatusPacket()) throw new TimeoutException("Timeout waiting for the Modem Status packet."); logger.info(toString() + "Module reset successfully."); } }
Source:
private ThreadPoolExecutor createBoundedExecutor(int poolSize) { return PTExecutors.newThreadPoolExecutor( poolSize, poolSize, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<>(1)); }

Target:
private static ThreadPoolExecutor createBoundedExecutor(int poolSize) { return PTExecutors.newThreadPoolExecutor( poolSize, poolSize, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<>(1)); }
Source:
private void deleteAPI(API api) throws APIManagementException { APIIdentifier apiIdentifier = api.getId(); int tenantId = APIUtil.getTenantId(APIUtil.replaceEmailDomainBack(apiIdentifier.getProviderName())); String tenantDomain = APIUtil.getTenantDomainFromTenantId(tenantId); Set<String> localScopeKeysToDelete = apiMgtDAO.getUnversionedLocalScopeKeysForAPI(apiIdentifier, tenantId); Set<URITemplate> uriTemplates = apiMgtDAO.getURITemplatesOfAPI(apiIdentifier); Map<String, KeyManagerDto> tenantKeyManagers = KeyManagerHolder.getTenantKeyManagers(tenantDomain); for (Map.Entry<String, KeyManagerDto> keyManagerDtoEntry : tenantKeyManagers.entrySet()) { KeyManager keyManager = keyManagerDtoEntry.getValue().getKeyManager(); if (keyManager != null) { try{ keyManager.detachResourceScopes(api, uriTemplates); if (log.isDebugEnabled()) { log.debug("Resource scopes are successfully detached for the API : " + apiIdentifier + " from KeyManager :" + keyManagerDtoEntry.getKey() + "."); } for (String localScope : localScopeKeysToDelete) { keyManager.deleteScope(localScope); } if (log.isDebugEnabled()) { log.debug("Local scopes are successfully deleted for the API : " + apiIdentifier + " from KeyManager : " + keyManagerDtoEntry.getKey() + "."); } }catch (APIManagementException e){ log.error("Error while Detach and Delete Scope from KeyManager "+ keyManagerDtoEntry.getKey()); } } } apiMgtDAO.deleteAPI(apiIdentifier); if (log.isDebugEnabled()) { log.debug("API : " + apiIdentifier + " is successfully deleted from the database and KeyManager."); } }

Target:
private void deleteAPI(API api) throws APIManagementException { APIIdentifier apiIdentifier = api.getId(); int tenantId = APIUtil.getTenantId(APIUtil.replaceEmailDomainBack(apiIdentifier.getProviderName())); String tenantDomain = APIUtil.getTenantDomainFromTenantId(tenantId); Set<String> localScopeKeysToDelete = apiMgtDAO.getUnversionedLocalScopeKeysForAPI(apiIdentifier, tenantId); Set<URITemplate> uriTemplates = apiMgtDAO.getURITemplatesOfAPI(apiIdentifier); Map<String, KeyManagerDto> tenantKeyManagers = KeyManagerHolder.getTenantKeyManagers(tenantDomain); for (Map.Entry<String, KeyManagerDto> keyManagerDtoEntry : tenantKeyManagers.entrySet()) { KeyManager keyManager = keyManagerDtoEntry.getValue().getKeyManager(); if (keyManager != null) { try { keyManager.detachResourceScopes(api, uriTemplates); if (log.isDebugEnabled()) { log.debug("Resource scopes are successfully detached for the API : " + apiIdentifier + " from Key Manager :" + keyManagerDtoEntry.getKey() + "."); } for (String localScope : localScopeKeysToDelete) { keyManager.deleteScope(localScope); } if (log.isDebugEnabled()) { log.debug("Local scopes are successfully deleted for the API : " + apiIdentifier + " from Key Manager : " + keyManagerDtoEntry.getKey() + "."); } } catch (APIManagementException e) { log.error("Error while Detach and Delete Scope from Key Manager " + keyManagerDtoEntry.getKey()); } } } deleteScopes(localScopeKeysToDelete, tenantId); apiMgtDAO.deleteAPI(apiIdentifier); if (log.isDebugEnabled()) { log.debug("API : " + apiIdentifier + " is successfully deleted from the database and Key Manager."); } }
Source:
private DiskVmElement createDiskVmElementUsingScsiReserevation() { DiskVmElement dve = new DiskVmElement(); dve.setUsingScsiReservation(true); return dve; }

Target:
private static DiskVmElement createDiskVmElementUsingScsiReserevation() { DiskVmElement dve = new DiskVmElement(); dve.setUsingScsiReservation(true); return dve; }
Source:
private VmPoolType getVmPoolType() { if (getVm().getVmPoolId() == null) { return null; } VmPool pool = getVmPoolDao().get(getVm().getVmPoolId()); if (pool == null) { return null; } else { return pool.getVmPoolType(); } }

Target:
private VmPoolType getVmPoolType() { VmPool pool = getVmPoolCached(); return (pool != null) ? pool.getVmPoolType() : null; }
Source:
public boolean canParseResource(HttpMessage message, String path, boolean wasAlreadyConsumed) { try { String contentType = message.getResponseHeader().getHeader(HttpHeader.CONTENT_TYPE); if (contentType.toLowerCase().startsWith("application/vnd.oai.openapi")) { return true; } else if ((contentType.toLowerCase().contains("json") || contentType.toLowerCase().contains("yaml")) && (message.getResponseBody().toString().toLowerCase().startsWith("swagger:") || message.getResponseBody() .toString() .toLowerCase() .startsWith("openapi:"))) { return true; } } catch (Exception e) { return false; } log.debug("Cant parse " + message.getRequestHeader().getURI()); return false; }

Target:
public boolean canParseResource(HttpMessage message, String path, boolean wasAlreadyConsumed) { try { String contentType = message.getResponseHeader() .getHeader(HttpHeader.CONTENT_TYPE) .toLowerCase(Locale.ROOT); String responseBodyStart = StringUtils.left(message.getResponseBody().toString(), 250) .toLowerCase(Locale.ROOT); if (contentType.startsWith("application/vnd.oai.openapi")) { return true; } else if ((contentType.contains("json") || contentType.contains("yaml")) && (responseBodyStart.contains("swagger") || responseBodyStart.contains("openapi"))) { return true; } } catch (Exception e) { return false; } log.debug("Cant parse " + message.getRequestHeader().getURI()); return false; }
Source:
private Authentication doAuthenticate(PreAuthenticatedAuthenticationToken preAuthToken) { String pluginId = preAuthToken.getPluginId(); AuthenticationResponse response = authenticateUser(pluginId, preAuthToken); if(authenticationFailed(response)) { return null; } UserDetails userDetails = getUserDetails(response.getUser()); userService.addUserIfDoesNotExist(toDomainUser(response.getUser())); assignRoles(pluginId, userDetails.getUsername(), response.getRoles()); PreAuthenticatedAuthenticationToken result = new PreAuthenticatedAuthenticationToken(userDetails, preAuthToken.getCredentials(), pluginId, userDetails.getAuthorities()); result.setAuthenticated(true); return result; }

Target:
private Authentication doAuthenticate(PreAuthenticatedAuthenticationToken preAuthToken) { String pluginId = preAuthToken.getPluginId(); AuthenticationResponse response = authenticateUser(preAuthToken); if (!isAuthenticated(response)) { return null; } UserDetails userDetails = getUserDetails(response.getUser()); userService.addUserIfDoesNotExist(toDomainUser(response.getUser())); assignRoles(pluginId, userDetails.getUsername(), response.getRoles()); PreAuthenticatedAuthenticationToken result = new PreAuthenticatedAuthenticationToken(userDetails, preAuthToken.getCredentials(), pluginId, userDetails.getAuthorities()); result.setAuthenticated(true); return result; }
Source:
private void setRequestIdInNodeConfig(Map<String, Object> nodeConfig, String acquireRequestId) { String nodeTags = (String) nodeConfig.getOrDefault(NODE_CONFIG_TAGS_KEY, ""); if (!nodeTags.isEmpty()) { nodeTags += "," + acquireRequestId; } else { nodeTags = acquireRequestId; } nodeConfig.put(NODE_CONFIG_TAGS_KEY, nodeTags); }

Target:
private void setRequestIdInNodeConfig(Map<String, Object> nodeConfig, String acquireRequestId) { String nodeTags; try { nodeTags = (String) nodeConfig.getOrDefault(NODE_CONFIG_TAGS_KEY, ""); } catch (ClassCastException e) { throw new IllegalArgumentException(String.format("The value of node configuration [%s] can't be casted to String", NODE_CONFIG_TAGS_KEY), e); } if (!nodeTags.isEmpty()) { nodeTags += "," + acquireRequestId; } else { nodeTags = acquireRequestId; } nodeConfig.put(NODE_CONFIG_TAGS_KEY, nodeTags); }
Source:
private void openBranch() throws MergeException { alreadyAccepted = new HashSet<RevCommit>(); try { branchUpdate = repo.updateRef(destBranch.get()); if (branchUpdate.getOldObjectId() != null) { branchTip = (CodeReviewCommit) rw.parseCommit(branchUpdate.getOldObjectId()); alreadyAccepted.add(branchTip); } else { branchTip = null; } try { final Ref destRef = repo.getRef(destBranch.get()); if (destRef == null) { throw new MergeException("Destination branch \"" + branchUpdate.getRef().getName() + "\" does not exist"); } branchUpdate.setExpectedOldObjectId(destRef.getObjectId()); } catch (IOException e) { throw new MergeException( "Failed to check existence of destination branch", e); } for (final Ref r : repo.getAllRefs().values()) { if (r.getName().startsWith(Constants.R_HEADS) || r.getName().startsWith(Constants.R_TAGS)) { try { alreadyAccepted.add(rw.parseCommit(r.getObjectId())); } catch (IncorrectObjectTypeException iote) { } } } } catch (IOException e) { throw new MergeException("Cannot open branch", e); } }

Target:
private void openBranch() throws MergeException { alreadyAccepted = new HashSet<RevCommit>(); try { branchUpdate = repo.updateRef(destBranch.get()); if (branchUpdate.getOldObjectId() != null) { branchTip = (CodeReviewCommit) rw.parseCommit(branchUpdate.getOldObjectId()); alreadyAccepted.add(branchTip); } else { branchTip = null; } try { final Ref destRef = repo.getRef(destBranch.get()); if (destRef != null) { branchUpdate.setExpectedOldObjectId(destRef.getObjectId()); } else if (repo.getFullBranch().equals(destBranch.get())) { branchUpdate.setExpectedOldObjectId(ObjectId.zeroId()); } else { throw new MergeException("Destination branch \"" + branchUpdate.getRef().getName() + "\" does not exist"); } } catch (IOException e) { throw new MergeException( "Failed to check existence of destination branch", e); } for (final Ref r : repo.getAllRefs().values()) { if (r.getName().startsWith(Constants.R_HEADS) || r.getName().startsWith(Constants.R_TAGS)) { try { alreadyAccepted.add(rw.parseCommit(r.getObjectId())); } catch (IncorrectObjectTypeException iote) { } } } } catch (IOException e) { throw new MergeException("Cannot open branch", e); } }
Source:
protected List<Image> execute(ListImagesCmd command) { WebTarget webResource = getBaseResource().path("/images/json").queryParam("all", command.hasShowAllEnabled() ? "1" : "0"); if (command.getFilters() != null) webResource = webResource.queryParam("filters", urlPathSegmentEscaper().escape(command.getFilters())); if (command.getImageNameFilter() != null) webResource = webResource.queryParam("filter", urlPathSegmentEscaper().escape(command.getImageNameFilter())); LOGGER.trace("GET: {}", webResource); List<Image> images = webResource.request().accept(MediaType.APPLICATION_JSON) .get(new GenericType<List<Image>>() { }); LOGGER.trace("Response: {}", images); return images; }

Target:
protected List<Image> execute(ListImagesCmd command) { WebTarget webTarget = getBaseResource().path("/images/json"); webTarget = booleanQueryParam(webTarget, "all", command.hasShowAllEnabled()); if (command.getFilters() != null) { webTarget = webTarget.queryParam("filters", urlPathSegmentEscaper().escape(command.getFilters())); } if (command.getImageNameFilter() != null) { webTarget = webTarget.queryParam("filter", urlPathSegmentEscaper().escape(command.getImageNameFilter())); } LOGGER.trace("GET: {}", webTarget); List<Image> images = webTarget.request().accept(MediaType.APPLICATION_JSON).get(new GenericType<List<Image>>() { }); LOGGER.trace("Response: {}", images); return images; }
Source:
public Saveable[] getActiveSaveables() { if (!hasSaveablesProvider()) { IEditorPart saveablePart = getSite().getPage().getActiveEditor(); return saveablePart instanceof ISaveablesSource ? ((ISaveablesSource) saveablePart).getActiveSaveables() : new Saveable[] { new DefaultSaveable(saveablePart) }; } return super.getActiveSaveables(); }

Target:
public Saveable[] getActiveSaveables() { if (!hasSaveablesProvider()) { IEditorPart saveablePart = getSite().getPage().getActiveEditor(); return saveablePart != null ? saveablePart instanceof ISaveablesSource ? ((ISaveablesSource) saveablePart).getActiveSaveables() : new Saveable[] { new DefaultSaveable(saveablePart) } : new Saveable[] {}; } return super.getActiveSaveables(); }
Source:
private JsonNode getMetric(String query, String ... params) { query = String.format(query, params); if (promUrl == null) { return new LongNode(0); } HttpResponse<String> response = request(query); if (response == null) { return new LongNode(0); } if (response.statusCode() >= 300) { throw new RuntimeException(String.format("Error fetching metric: %s", response.body())); } try { JsonNode node = mapper.readTree(response.body().getBytes()); if (node.has("status")) { if (node.get("status").asText().equals("success")) { JsonNode result = node.get("data").get("result"); if (result.size() > 0) { JsonNode value = result.get(0).get("value"); return value.get(1); } } else { log.warn("Query '{}' failed to execute: - {}", query, node.get("status"), node.get("error")); } } } catch (JsonProcessingException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } return new LongNode(0); }

Target:
private NumericNode getMetric(String query, String ... params) { NumericNode retVal = new IntNode(0); query = String.format(query, params); if (promUrl == null) { return retVal; } HttpResponse<String> response = request(query); if (response == null) { return retVal; } if (response.statusCode() >= 300) { log.warn("Failed to fetch metric {}: {}", query, response.body()); return retVal; } try { JsonNode node = mapper.readTree(response.body().getBytes()); if (node.has("status")) { if (node.get("status").asText().equals("success")) { JsonNode result = node.get("data").get("result"); if (result.size() > 0) { JsonNode value = result.get(0).get("value"); return (NumericNode)value.get(1); } } else { log.warn("Query '{}' failed to execute: - {}", query, node.get("status"), node.get("error")); } } } catch (JsonProcessingException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } return retVal; }
Source:
public InputStream getContents() throws CoreException { return fileRevision.getStorage(null).getContents(); }

Target:
public InputStream getContents() throws CoreException { return fileRevision.getStorage(new NullProgressMonitor()).getContents(); }
Source:
public void scrollToSlot(String slotName) { if (slotName.equals(AdsContent.BOTTOM_LB)) { triggerComments(); } if (slotName.equals(AdsContent.MOBILE_BOTTOM_LB)) { scrollToFooter(); } scrollToPosition("#" + slotName); }

Target:
public void scrollToSlot(String slotName) { if (slotName.equals(AdsContent.BOTTOM_LB)) { triggerComments(); } else if (slotName.equals(AdsContent.MOBILE_BOTTOM_LB)) { scrollToFooter(); } scrollToPosition("#" + slotName); }
Source:
public <S extends T> Mono<S> findOne(Example<S> example) { Assert.notNull(example, "Sample must not be null!"); Query q = new Query(new Criteria().alike(example)); q.limit(2); return mongoOperations.find(q, example.getProbeType(), entityInformation.getCollectionName()).buffer(2) .flatMap(vals -> { if (vals.size() > 1) { return Mono.error(new IncorrectResultSizeDataAccessException(1)); } return Mono.just(vals.iterator().next()); }).singleOrEmpty(); }

Target:
public <S extends T> Mono<S> findOne(Example<S> example) { Assert.notNull(example, "Sample must not be null!"); Query q = new Query(new Criteria().alike(example)); q.limit(2); return mongoOperations.find(q, example.getProbeType(), entityInformation.getCollectionName()).buffer(2) .flatMap(vals -> { if (vals.size() > 1) { return Mono.error(new IncorrectResultSizeDataAccessException(1)); } return Mono.just(vals.iterator().next()); }).next(); }
Source:
public ObjQualifier getObjQualifier() { return getObjQualifiers().stream() .findFirst() .orElseThrow(() -> new IllegalStateException("The `item` of the object has not been set!")); }

Target:
public ObjQualifier getObjQualifier() { return getObjQualifiers().stream() .findFirst() .orElse(null); }
Source:
public SqlConsecutiveJoinBenchmark(LocalQueryRunner localQueryRunner) { super(localQueryRunner, "sql_consecutive_join", 4, 5, "SELECT * FROM\n" + "(\n" + " SELECT t1.orderkey AS key, t1.quantity, t2.orderkey, t2.quantity FROM\n" + " (SELECT orderkey, quantity FROM lineitem) t1\n" + " JOIN\n" + " (SELECT orderkey, quantity FROM lineitem) t2\n" + " ON t1.orderkey = t2.orderkey\n" + ") t3\n" + "JOIN\n" + "(\n" + " SELECT t4.orderkey AS key, t4.quantity, t5.orderkey, t5.quantity FROM\n" + " (SELECT orderkey, quantity FROM lineitem) t4\n" + " JOIN\n" + " (SELECT orderkey, quantity FROM lineitem) t5\n" + " ON t4.orderkey = t5.orderkey\n" + ") t6\n" + "ON t3.key = t6.key"); }

Target:
public SqlConsecutiveJoinBenchmark(LocalQueryRunner localQueryRunner) { super(localQueryRunner, "sql_consecutive_join", 4, 5, "SELECT * FROM " + "( " + " SELECT orders.orderkey as key, * FROM " + " customer JOIN orders " + " ON customer.custkey = orders.custkey " + ") t1 " + "JOIN " + "( " + " SELECT lineitem.orderkey as key, * FROM " + " part JOIN lineitem " + " ON part.partkey = lineitem.partkey " + ") t2 " + "ON t1.key = t2.key"); }
Source:
public static String getEtcDirectory() { final String basedir = System.getenv("STRONGBOX_ETC") != null ? System.getenv("STRONGBOX_ETC") : System.getProperty("strongbox.etc"); if (basedir != null) { return new File(basedir).getAbsolutePath(); } else { return new File("./etc").getAbsolutePath(); } }

Target:
public static String getEtcDirectory() { final String basedir = System.getenv("STRONGBOX_ETC") != null ? System.getenv("STRONGBOX_ETC") : System.getProperty("strongbox.etc"); if (basedir != null) { return new File(basedir).getAbsolutePath(); } else { return new File("etc").getAbsolutePath(); } }