auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == StageActivity.STAGE_ACTIVITY_FINISH) { SensorHandler.stopSensorListeners(); FaceDetectionHandler.stopFaceDetection(); } if (requestCode != RESULT_OK && SettingsFragment.isCastSharedPreferenceEnabled(this) && ProjectManager.getInstance().getCurrentProject().isCastProject() && !CastManager.getInstance().isConnected()) { CastManager.getInstance().openDeviceSelectorOrDisconnectDialog(this); } Uri uri; switch (requestCode) { case PreStageActivity.REQUEST_RESOURCES_INIT: startStageActivity(); break; case SPRITE_POCKET_PAINT: uri = Uri.fromFile(new File(data.getStringExtra(EXTRA_PICTURE_PATH_POCKET_PAINT))); addSpriteFromUri(uri); break; case SPRITE_LIBRARY: uri = Uri.fromFile(new File(data.getStringExtra(MEDIA_FILE_PATH))); addSpriteFromUri(uri); break; case SPRITE_FILE: uri = data.getData(); addSpriteFromUri(uri); break; case SPRITE_CAMERA: uri = new ImportFromCameraLauncher(this).getCacheCameraUri(); addSpriteFromUri(uri); break; } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == StageActivity.STAGE_ACTIVITY_FINISH) { SensorHandler.stopSensorListeners(); FaceDetectionHandler.stopFaceDetection(); } if (resultCode != RESULT_OK) { if (SettingsFragment.isCastSharedPreferenceEnabled(this) && ProjectManager.getInstance().getCurrentProject().isCastProject() && !CastManager.getInstance().isConnected()) { CastManager.getInstance().openDeviceSelectorOrDisconnectDialog(this); } return; } Uri uri; switch (requestCode) { case PreStageActivity.REQUEST_RESOURCES_INIT: startStageActivity(); break; case SPRITE_POCKET_PAINT: uri = Uri.fromFile(new File(data.getStringExtra(EXTRA_PICTURE_PATH_POCKET_PAINT))); addSpriteFromUri(uri); break; case SPRITE_LIBRARY: uri = Uri.fromFile(new File(data.getStringExtra(MEDIA_FILE_PATH))); addSpriteFromUri(uri); break; case SPRITE_FILE: uri = data.getData(); addSpriteFromUri(uri); break; case SPRITE_CAMERA: uri = new ImportFromCameraLauncher(this).getCacheCameraUri(); addSpriteFromUri(uri); break; } }
Source:
public void testFreestyleWithFalsePublisher() throws Exception { FreeStyleProject p = j.createFreeStyleProject(); p.getPublishersList().add(new TrueFalsePublisher(true)); p.getPublishersList().add(new TrueFalsePublisher(false)); p.getPublishersList().add(new ResultWriterPublisher("result.txt")); p.getPublishersList().add(new ArtifactArchiver("result.txt", "", false)); FreeStyleBuild b = p.scheduleBuild2(0).get(); assertEquals("Build must fail, because we used FalsePublisher", b.getResult(), Result.FAILURE); File file = new File(b.getArtifactsDir(), "result.txt"); assertTrue("ArtifactArchiver is executed even prior publisher fails.", file.exists()); assertTrue("Second publisher must see FAILURE status", FileUtils.readFileToString(file).equals(Result.FAILURE.toString())); }

Target:
public void testFreestyleWithFalsePublisher() throws Exception { FreeStyleProject p = j.createFreeStyleProject(); p.getPublishersList().add(new TrueFalsePublisher(true)); p.getPublishersList().add(new TrueFalsePublisher(false)); p.getPublishersList().add(new ResultWriterPublisher("result.txt")); final ArtifactArchiver artifactArchiver = new ArtifactArchiver("result.txt"); artifactArchiver.setOnlyIfSuccessful(false); p.getPublishersList().add(artifactArchiver); FreeStyleBuild b = p.scheduleBuild2(0).get(); assertEquals("Build must fail, because we used FalsePublisher", b.getResult(), Result.FAILURE); File file = new File(b.getArtifactsDir(), "result.txt"); assertTrue("ArtifactArchiver is executed even prior publisher fails", file.exists()); assertTrue("Publisher, after publisher with return false status, must see FAILURE status", FileUtils.readFileToString(file).equals(Result.FAILURE.toString())); }
Source:
protected boolean isAllowClusterWithVirtGluster() { Boolean allowVirGluster = Config.<Boolean> GetValue(ConfigValues.AllowClusterWithVirtGlusterEnabled); if (allowVirGluster == null) { allowVirGluster = Boolean.TRUE; } return allowVirGluster; }

Target:
protected boolean isAllowClusterWithVirtGluster() { Boolean allowVirGluster = Config.<Boolean> GetValue(ConfigValues.AllowClusterWithVirtGlusterEnabled); return allowVirGluster; }
Source:
public DeleteTaskService deleteTaskService(TaskExplorer taskExplorer, LauncherRepository launcherRepository, TaskDefinitionRepository taskDefinitionRepository, AuditRecordService auditRecordService) { return new DefaultDeleteTaskService(taskExplorer,launcherRepository,taskDefinitionRepository, auditRecordService); }

Target:
public TaskDeleteService deleteTaskService(TaskExplorer taskExplorer, LauncherRepository launcherRepository, TaskDefinitionRepository taskDefinitionRepository, AuditRecordService auditRecordService) { return new DefaultTaskDeleteService(taskExplorer, launcherRepository, taskDefinitionRepository, auditRecordService); }
Source:
public boolean suppressFlingGesture(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return suppressFlingGesture; }

Target:
public boolean suppressFlingGesture(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return slider.isTrackingTouch(); }
Source:
public void fileFinished(AuditEvent event) { final String fileName = event.getFileName(); final FileMessages errorEvents = fileMessages.get(fileName); synchronized (writerLock) { if (errorEvents != null) { writeFileOpeningTag(fileName); for (AuditEvent errorEvent : errorEvents.errors) { writeFileError(errorEvent); } for (Throwable exception : errorEvents.exceptions) { writeException(exception); } } writeFileClosingTag(); } fileMessages.remove(fileName); }

Target:
public void fileFinished(AuditEvent event) { final String fileName = event.getFileName(); final FileMessages messages = fileMessages.get(fileName); synchronized (writerLock) { writeFileMessages(fileName, messages); } fileMessages.remove(fileName); }
Source:
public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if (orderType == OrderType.BUY) { if ((price*volume) > this.cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money." + " Trader: " + this.name); } for(int i = 0; i < this.ordersPlaced.size(); i++) { if (this.ordersPlaced.get(i).getStockSymbol().equals(symbol)) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader already has" + "an order for this stock. Trader: " + this.name); } } Order order = new BuyOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } if (orderType == OrderType.SELL) { boolean owns = false; int numberStocksOwned = 0; for (int i = 0; i < this.position.size(); i++) { if (this.position.get(i).getStockSymbol() == symbol) { owns = true; numberStocksOwned = this.position.get(i).getSize(); } } if (!owns) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own this stock. Trader: " + this.name); } if (numberStocksOwned < volume){ throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own enough shares of this stock. Trader: " + this.name); } Order order = new SellOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } }

Target:
public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if (orderType == OrderType.BUY) { if ((price*volume) > this.cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money." + " Trader: " + this.name); } for(int i = 0; i < this.ordersPlaced.size(); i++) { if (this.ordersPlaced.get(i).getStockSymbol().equals(symbol)) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader already has" + "an order for this stock. Trader: " + this.name); } } Order order = new BuyOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } if (orderType == OrderType.SELL) { boolean owns = false; int numberStocksOwned = 0; for (int i = 0; i < this.position.size(); i++) { if (this.position.get(i).getStockSymbol() == symbol) { owns = true; numberStocksOwned = this.position.get(i); numberStocksOwned = numbersStockOwned.getSize(); } } if (!owns) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own this stock. Trader: " + this.name); } if (numberStocksOwned < volume){ throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own enough shares of this stock. Trader: " + this.name); } Order order = new SellOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } }
Source:
public Map<String, List<SegmentSizeInfo>> getSegmentSizeInfoFromServers(BiMap<String, String> serverEndPoints, String tableNameWithType, int timeoutMs) { int numServers = serverEndPoints.size(); LOGGER.info("Reading segment sizes from servers for table: with timeout: {}ms", numServers, tableNameWithType, timeoutMs); List<String> serverUrls = new ArrayList<>(numServers); BiMap<String, String> endpointsToServers = serverEndPoints.inverse(); for (String endpoint : endpointsToServers.keySet()) { String tableSizeUri = "http://" + endpoint + "/table/" + tableNameWithType + "/size"; serverUrls.add(tableSizeUri); } CompletionServiceHelper completionServiceHelper = new CompletionServiceHelper(_executor, _connectionManager, endpointsToServers); CompletionServiceHelper.CompletionServiceResponse serviceResponse = completionServiceHelper.doMultiGetRequest(serverUrls, tableNameWithType, timeoutMs); Map<String, List<SegmentSizeInfo>> serverToSegmentSizeInfoListMap = new HashMap<>(); int failedParses = 0; for (Map.Entry<String, String> streamResponse : serviceResponse._httpResponses.entrySet()) { try { TableSizeInfo tableSizeInfo = JsonUtils.stringToObject(streamResponse.getValue(), TableSizeInfo.class); serverToSegmentSizeInfoListMap.put(streamResponse.getKey(), tableSizeInfo.segments); } catch (IOException e) { failedParses++; LOGGER.error("Unable to parse server response due to an error: ", e); } } if (failedParses != 0) { LOGGER.warn("Failed to parse segment size info responses from server.", failedParses); } return serverToSegmentSizeInfoListMap; }

Target:
public Map<String, List<SegmentSizeInfo>> getSegmentSizeInfoFromServers(BiMap<String, String> serverEndPoints, String tableNameWithType, int timeoutMs) { int numServers = serverEndPoints.size(); LOGGER.info("Reading segment sizes from servers for table: with timeout: {}ms", numServers, tableNameWithType, timeoutMs); List<String> serverUrls = new ArrayList<>(numServers); BiMap<String, String> endpointsToServers = serverEndPoints.inverse(); for (String endpoint : endpointsToServers.keySet()) { String tableSizeUri = "http://" + endpoint + "/table/" + tableNameWithType + "/size"; serverUrls.add(tableSizeUri); } CompletionServiceHelper completionServiceHelper = new CompletionServiceHelper(_executor, _connectionManager, endpointsToServers); CompletionServiceHelper.CompletionServiceResponse serviceResponse = completionServiceHelper.doMultiGetRequest(serverUrls, tableNameWithType, timeoutMs); Map<String, List<SegmentSizeInfo>> serverToSegmentSizeInfoListMap = new HashMap<>(); int failedParses = 0; for (Map.Entry<String, String> streamResponse : serviceResponse._httpResponses.entrySet()) { try { TableSizeInfo tableSizeInfo = JsonUtils.stringToObject(streamResponse.getValue(), TableSizeInfo.class); serverToSegmentSizeInfoListMap.put(streamResponse.getKey(), tableSizeInfo.segments); } catch (IOException e) { failedParses++; LOGGER.error("Unable to parse server response due to an error: ", streamResponse.getKey(), e); } } if (failedParses != 0) { LOGGER.warn("Failed to parse / segment size info responses from servers.", failedParses, serverUrls.size()); } return serverToSegmentSizeInfoListMap; }
Source:
public Optional<CatchupServerAddress> find( MemberId upstream ) { Optional<CoreServerInfo> coreAddresses = coreTopology.find( upstream ); Optional<ReadReplicaInfo> readReplicaAddresses = readReplicaTopology.findAddressFor( upstream ); if ( coreAddresses.isPresent() ) { return Optional.of( coreAddresses.get() ); } else if ( readReplicaAddresses.isPresent() ) { return Optional.of( readReplicaAddresses.get() ); } else { return Optional.empty(); } }

Target:
public Optional<CatchupServerAddress> find( MemberId upstream ) { Optional<CatchupServerAddress> coreCatchupAddress = coreTopology.find( upstream ).map( a -> (CatchupServerAddress) a ); Optional<CatchupServerAddress> readCatchupAddress = readReplicaTopology.find( upstream ).map( a -> (CatchupServerAddress) a ); return coreCatchupAddress.map( Optional::of ).orElse( readCatchupAddress ); }
Source:
public MessageChannel getDiscardChannel() { if (this.discardChannelName != null) { this.discardChannel = getChannelResolver().resolveDestination(this.discardChannelName); this.discardChannelName = null; } return this.discardChannel; }

Target:
public MessageChannel getDiscardChannel() { String channelName = this.discardChannelName; if (channelName != null) { this.discardChannel = getChannelResolver().resolveDestination(channelName); this.discardChannelName = null; } return this.discardChannel; }
Source:
public void init(Shell splash) { super.init(splash); String progressString = null; IProduct product = Platform.getProduct(); if (product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); } Rectangle progressRect = StringConverter.asRectangle(progressString, PROCESS_BAR_RECTANGLE); setProgressRect(progressRect); try { setForeground(getSplash().getDisplay().getSystemColor(SWT.COLOR_WHITE).getRGB()); } catch (IllegalArgumentException e) { } getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText( NLS.bind(Messages.SplahScreen_VersionString, TracingRcpPlugin.getDefault().getBundle().getVersion().toString()), VERSION_LOCATION.x, VERSION_LOCATION.y, true); } }); }

Target:
public void init(Shell splash) { super.init(splash); String progressString = null; IProduct product = Platform.getProduct(); if (product != null) { progressString = product.getProperty(IProductConstants.STARTUP_PROGRESS_RECT); } Rectangle progressRect = StringConverter.asRectangle(progressString, PROCESS_BAR_RECTANGLE); setProgressRect(progressRect); setForeground(FOREGROUND_COLOR); getContent().addPaintListener(new PaintListener() { @Override public void paintControl(PaintEvent e) { e.gc.setForeground(getForeground()); e.gc.drawText( NLS.bind(Messages.SplahScreen_VersionString, TracingRcpPlugin.getDefault().getBundle().getVersion().toString()), VERSION_LOCATION.x, VERSION_LOCATION.y, true); } }); }
Source:
public RequestCreator memoryPolicy(MemoryPolicy policy, MemoryPolicy... additional) { if (policy == null) { throw new IllegalArgumentException("Memory policy cannot be null"); } this.memoryPolicy |= policy.index; if (additional != null && additional.length > 0) { for (MemoryPolicy memoryPolicy : additional) { if (memoryPolicy != null) { this.memoryPolicy |= memoryPolicy.index; } } } return this; }

Target:
public RequestCreator memoryPolicy(MemoryPolicy policy, MemoryPolicy... additional) { if (policy == null) { throw new IllegalArgumentException("Memory policy cannot be null."); } this.memoryPolicy |= policy.index; if (additional == null) { throw new IllegalArgumentException("Memory policy cannot be null."); } if (additional.length > 0) { for (MemoryPolicy memoryPolicy : additional) { if (memoryPolicy == null) { throw new IllegalArgumentException("Memory policy cannot be null."); } this.memoryPolicy |= memoryPolicy.index; } } return this; }
Source:
public boolean tunnelAuthInProgress() { if (!zooKeeper.getClientConfig().isSaslClientEnabled()) { return false; } if (saslLoginFailed == true) { return false; } if (zooKeeperSaslClient == null) { return true; } return zooKeeperSaslClient.clientTunneledAuthenticationInProgress(); }

Target:
public boolean tunnelAuthInProgress() { if (!clientConfig.isSaslClientEnabled()) { return false; } if (saslLoginFailed == true) { return false; } if (zooKeeperSaslClient == null) { return true; } return zooKeeperSaslClient.clientTunneledAuthenticationInProgress(); }
Source:
public Set<String> getSessionIdsFull() { Set<String> sessionsId = null; try { String[] keys = this.store.keys(); sessionsId = new HashSet<>(Arrays.asList(keys)); } catch (IOException e) { log.error("An error occurred while listing active session: " + e); } return sessionsId; }

Target:
public Set<String> getSessionIdsFull() { Set<String> sessionsId = null; try { String[] keys = this.store.keys(); sessionsId = new HashSet<>(Arrays.asList(keys)); } catch (IOException e) { log.error("An error occurred while listing active sessions: ", e); } return sessionsId; }
Source:
public void debugClearMessagesLocally(final List<MessageReference> messages) { if (!K9.DEVELOPER_MODE) { throw new AssertionError("method must only be used in debug build!"); } actOnMessagesGroupedByAccountAndFolder(messages, new MessageActor() { @Override public void act(final Account account, final LocalFolder messageFolder, final List<LocalMessage> accountMessages) { putBackground("debugClearLocalMessages", null, new Runnable() { @Override public void run() { for (LocalMessage message : accountMessages) { try { message.debugClearLocalData(); } catch (MessagingException e) { throw new AssertionError("clearing local message content failed!", e); } } } }); } }); }

Target:
public void debugClearMessagesLocally(final List<MessageReference> messages) { if (!K9.DEVELOPER_MODE) { throw new AssertionError("method must only be used in developer mode!"); } actOnMessagesGroupedByAccountAndFolder(messages, new MessageActor() { @Override public void act(final Account account, final LocalFolder messageFolder, final List<LocalMessage> accountMessages) { putBackground("debugClearLocalMessages", null, new Runnable() { @Override public void run() { for (LocalMessage message : accountMessages) { try { message.debugClearLocalData(); } catch (MessagingException e) { throw new AssertionError("clearing local message content failed!", e); } } } }); } }); }
Source:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_EDGES_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptyEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_CANCELLING, ""); }

Target:
public void testUnmarshallTopLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateConditionalEvent emptyEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_EDGES_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertConditionalEventExecutionSet(emptyEvent.getExecutionSet(), CONDITION_EXPRESSION_SCRIPT_DEFAULT_VALUE, CONDITION_EXPRESSION_LANGUAGE, CONDITION_ERPRESSION_TYPE, NON_CANCELLING, EMPTY_VALUE); }
Source:
public void markChargeAsCaptureApproved_shouldThrowAnExceptionWhenChargeIsNotFound() { String nonExistingChargeExternalId = "non-existing-id"; when(mockedChargeDao.findByExternalId(nonExistingChargeExternalId)).thenReturn(Optional.empty()); try { cardCaptureService.markChargeAsCaptureApproved(nonExistingChargeExternalId); fail("expecting ChargeNotFoundRuntimeException"); } catch (ChargeNotFoundRuntimeException e) { } verify(mockedChargeDao).findByExternalId(nonExistingChargeExternalId); verifyNoMoreInteractions(mockedChargeDao); }

Target:
public void markChargeAsCaptureApproved_shouldThrowAnExceptionWhenChargeIsNotFound() { String nonExistingChargeExternalId = "non-existing-id"; when(mockedChargeDao.findByExternalId(nonExistingChargeExternalId)).thenReturn(Optional.empty()); try { cardCaptureService.markChargeAsCaptureApproved(nonExistingChargeExternalId); fail("expecting ChargeNotFoundRuntimeException"); } catch (ChargeNotFoundRuntimeException e) { } verify(mockedChargeDao, never()).mergeAndNotifyStatusHasChanged(any(), any()); }
Source:
protected List<ProgramState> copyConstraint(SymbolicValue from, SymbolicValue to, ProgramState programState, BooleanConstraint booleanConstraint) { Constraint constraintLeft = programState.getConstraint(from); if (constraintLeft instanceof BooleanConstraint) { BooleanConstraint boolConstraint = (BooleanConstraint) constraintLeft; return to.setConstraint(programState, shouldNotInverse().equals(booleanConstraint) ? boolConstraint : boolConstraint.inverse()); } else if (constraintLeft instanceof ObjectConstraint) { ObjectConstraint nullConstraint = (ObjectConstraint) constraintLeft; if (nullConstraint.isNull() || nullConstraint.isInversible()) { return to.setConstraint(programState, shouldNotInverse().equals(booleanConstraint) ? nullConstraint : nullConstraint.inverse()); } else if (shouldNotInverse().equals(booleanConstraint)) { return to.setConstraint(programState, nullConstraint); } } return ImmutableList.of(programState); }

Target:
protected List<ProgramState> copyConstraint(SymbolicValue from, SymbolicValue to, ProgramState programState, BooleanConstraint booleanConstraint) { Constraint constraintLeft = programState.getConstraint(from); if (constraintLeft instanceof BooleanConstraint) { BooleanConstraint boolConstraint = (BooleanConstraint) constraintLeft; return to.setConstraint(programState, shouldNotInverse().equals(booleanConstraint) ? boolConstraint : boolConstraint.inverse()); } else if (constraintLeft instanceof ObjectConstraint) { ObjectConstraint objectConstraint = (ObjectConstraint) constraintLeft; if (objectConstraint.isInversible()) { return to.setConstraint(programState, shouldNotInverse().equals(booleanConstraint) ? objectConstraint : objectConstraint.inverse()); } else if (shouldNotInverse().equals(booleanConstraint)) { return to.setConstraint(programState, objectConstraint); } } return ImmutableList.of(programState); }
Source:
public void searchSingle(ThreadState state) { String predicate = "id = '" + generatedIds[state.random.nextInt(generatedIds.length)] + "'"; System.out.println( map.values(new SqlPredicate(predicate))); }

Target:
public Collection<Transaction> searchSingle(ThreadState state) { String predicate = "id = '" + map.get(state.random.nextInt(keyCount)).getUniversalId() + "'"; return map.values(new SqlPredicate(predicate)); }
Source:
public boolean isSameTarget(TransportConfiguration... configs) { boolean yes = false; for (TransportConfiguration cfg : configs) { if (cfg == null) { continue; } if (NettyConnectorFactory.class.getName().equals(cfg.getFactoryClassName())) { if (configuration.get(TransportConstants.PORT_PROP_NAME).equals(cfg.getParams().get(TransportConstants.PORT_PROP_NAME))) { Object hostParam = configuration.get(TransportConstants.HOST_PROP_NAME); if (hostParam != null) { if (hostParam.equals(cfg.getParams().get(TransportConstants.HOST_PROP_NAME))) { yes = true; break; } else { if (isLocalhost((String) configuration.get(TransportConstants.HOST_PROP_NAME)) && isLocalhost((String) cfg.getParams().get(TransportConstants.HOST_PROP_NAME))) { yes = true; break; } } } else if (cfg.getParams().get(TransportConstants.HOST_PROP_NAME) == null) { yes = true; break; } } } } return yes; }

Target:
public boolean isSameTarget(TransportConfiguration... configs) { boolean result = false; for (TransportConfiguration cfg : configs) { if (cfg == null) { continue; } if (NettyConnectorFactory.class.getName().equals(cfg.getFactoryClassName())) { if (configuration.get(TransportConstants.PORT_PROP_NAME).equals(cfg.getParams().get(TransportConstants.PORT_PROP_NAME))) { Object hostParam = configuration.get(TransportConstants.HOST_PROP_NAME); if (hostParam != null) { if (hostParam.equals(cfg.getParams().get(TransportConstants.HOST_PROP_NAME))) { result = true; break; } else { if (isLocalhost((String) configuration.get(TransportConstants.HOST_PROP_NAME)) && isLocalhost((String) cfg.getParams().get(TransportConstants.HOST_PROP_NAME))) { result = true; break; } } } else if (cfg.getParams().get(TransportConstants.HOST_PROP_NAME) == null) { result = true; break; } } } } return result; }
Source:
public static void main(String[] args) throws Exception { InetSocketAddress addr = SocketUtils.socketAddress(DNS_SERVER_HOST, DNS_SERVER_PORT); final CountDownLatch latch = new CountDownLatch(1); EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(NioDatagramChannel.class) .handler(new ChannelInitializer<DatagramChannel>() { @Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new DatagramDnsQueryEncoder()) .addLast(new DatagramDnsResponseDecoder()) .addLast(new SimpleChannelInboundHandler<DatagramDnsResponse>() { @Override protected void channelRead0(ChannelHandlerContext ctx, DatagramDnsResponse msg) throws Exception { try { handleQueryResp(msg); } finally { latch.countDown(); } } }); } }); Channel ch = b.bind(0).sync().channel(); DnsQuery query = new DatagramDnsQuery(null, addr, 1).setRecord( DnsSection.QUESTION, new DefaultDnsQuestion(QUERY_DOMAIN, DnsRecordType.A)); ch.writeAndFlush(query); latch.await(10L, TimeUnit.SECONDS); ch.close().sync(); } finally { group.shutdownGracefully(); } }

Target:
public static void main(String[] args) throws Exception { InetSocketAddress addr = new InetSocketAddress(DNS_SERVER_HOST, DNS_SERVER_PORT); EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(NioDatagramChannel.class) .handler(new ChannelInitializer<DatagramChannel>() { @Override protected void initChannel(DatagramChannel ch) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast(new DatagramDnsQueryEncoder()) .addLast(new DatagramDnsResponseDecoder()) .addLast(new SimpleChannelInboundHandler<DatagramDnsResponse>() { @Override protected void channelRead0(ChannelHandlerContext ctx, DatagramDnsResponse msg) { try { handleQueryResp(msg); } finally { ctx.close(); } } }); } }); final Channel ch = b.bind(0).sync().channel(); DnsQuery query = new DatagramDnsQuery(null, addr, 1).setRecord( DnsSection.QUESTION, new DefaultDnsQuestion(QUERY_DOMAIN, DnsRecordType.A)); ch.writeAndFlush(query).sync(); boolean succ = ch.closeFuture().await(10, TimeUnit.SECONDS); if (!succ) { System.err.println("dns query timeout!"); ch.close().sync(); } } finally { group.shutdownGracefully(); } }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } boolean isCompositeChange= refactoringWizard.checkCompositeChange(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), false); RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); if (isCompositeChange) { try { op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } catch (InterruptedException e) { } } } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } RefactoringProcessor processor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); Change change= getChange(refactoringWizard); RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); try { if (isCompositeChange(change) || !(processor instanceof RenameResourceProcessor)) { op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { change.perform(new NullProgressMonitor()); } } catch (InterruptedException | CoreException e) { RefactoringUIPlugin.log(e); } } } return null; }
Source:
public Optional<BPMNSignalReceivedEvent> from(ActivitiSignalEvent internalEvent) { BPMNSignalReceivedEventImpl event = new BPMNSignalReceivedEventImpl(toSignalConverter.from(internalEvent)); if (event!=null) { event.setProcessInstanceId(internalEvent.getProcessInstanceId()); event.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); } return Optional.of(event); }

Target:
public Optional<BPMNSignalReceivedEvent> from(ActivitiSignalEvent internalEvent) { BPMNSignalReceivedEventImpl event = new BPMNSignalReceivedEventImpl(toSignalConverter.from(internalEvent)); event.setProcessInstanceId(internalEvent.getProcessInstanceId()); event.setProcessDefinitionId(internalEvent.getProcessDefinitionId()); return Optional.of(event); }
Source:
private static void reassignDelayedInitParams() { appContext = delayedInitParams.context; googleProjectNumber = delayedInitParams.googleProjectNumber; appId = delayedInitParams.appId; notificationWillShowInForegroundHandler = delayedInitParams.notificationWillShowInForegroundHandler; notificationOpenedHandler = delayedInitParams.notificationOpenedHandler; delayedInitParams = null; if (appContext != null) setAppContext(appContext); }

Target:
private static void reassignDelayedInitParams() { appContext = delayedInitParams.context; googleProjectNumber = delayedInitParams.googleProjectNumber; appId = delayedInitParams.appId; notificationWillShowInForegroundHandler = delayedInitParams.notificationWillShowInForegroundHandler; notificationOpenedHandler = delayedInitParams.notificationOpenedHandler; delayedInitParams = null; if (appId != null && appContext != null) { setupPrivacyConsent(appContext); init(); } }
Source:
public void testStatementPeriodYEARLY() { Calendar date = Calendar.getInstance(); Calendar aCalendar = Calendar.getInstance(); date = Calendar.getInstance(); date.set(Calendar.MONTH, Calendar.JANUARY); date.set(Calendar.DATE, 1); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.YEARLY); assertTrue("period != null", period != null); assertTrue("period[0].before(period[1])" + period[0].toString(), period[0].before(period[1])); assertTrue("period[0].get(Calendar.DATE) == 1" + period[0].toString(), period[0].get(Calendar.DATE) == 1); assertTrue("period[0].get(Calendar.MONTH) == Calendar.JANUARY" + period[0].toString(), period[0].get(Calendar.MONTH) == Calendar.JANUARY); aCalendar = Calendar.getInstance(); aCalendar.set(Calendar.MONTH, Calendar.DECEMBER); aCalendar.set(Calendar.DATE, aCalendar.getActualMaximum(Calendar.DAY_OF_MONTH) + 1); assertTrue(" period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)" + period[1].toString(), period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)); assertTrue("period[1].get(Calendar.MONTH) == aCalendar.get(Calendar.MONTH)" + period[1].toString(), period[1].get(Calendar.MONTH) == aCalendar.get(Calendar.MONTH)); }

Target:
public void testStatementPeriodYEARLY() { Calendar date = Calendar.getInstance(); Calendar aCalendar = Calendar.getInstance(); date = Calendar.getInstance(); date.set(Calendar.MONTH, Calendar.JANUARY); date.set(Calendar.DATE, 1); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.YEARLY); assertTrue("period != null", period != null); assertTrue(period.length == 2); assertTrue("period[0].before(period[1])" + period[0].toString(), period[0].before(period[1])); assertTrue("period[0].get(Calendar.DATE) == 1" + period[0].toString(), period[0].get(Calendar.DATE) == 1); assertTrue("period[0].get(Calendar.MONTH) == Calendar.JANUARY" + period[0].toString(), period[0].get(Calendar.MONTH) == Calendar.JANUARY); aCalendar = Calendar.getInstance(); aCalendar.set(Calendar.MONTH, Calendar.DECEMBER); aCalendar.set(Calendar.DATE, aCalendar.getActualMaximum(Calendar.DAY_OF_MONTH) + 1); assertTrue(" period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)" + period[1].toString(), period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)); assertTrue("period[1].get(Calendar.MONTH) == aCalendar.get(Calendar.MONTH)" + period[1].toString(), period[1].get(Calendar.MONTH) == aCalendar.get(Calendar.MONTH)); }
Source:
public static String getJavaSqliteDescription( Database database, String name ) { String s_javasqlite_description = ""; try { s_javasqlite_description = "sqlite[" + getSqliteVersion(database) + "],"; s_javasqlite_description += "spatialite[" + getSpatialiteVersion(database) + "],"; s_javasqlite_description += "proj4[" + getProj4Version(database) + "],"; s_javasqlite_description += "geos[" + getGeosVersion(database) + "],"; s_javasqlite_description += "spatialite_properties[" + getSpatialiteProperties(database) + "],"; s_javasqlite_description += "rasterlite2_properties[" + getRaster2Version(database) + "]]"; } catch (Exception e) { if (i_SpatialiteVersion > 3) { s_javasqlite_description += "rasterlite2_properties[none]]"; } else { s_javasqlite_description += "exception[? not a spatialite database, or spatialite < 4 ?]]"; } GPLog.androidLog(4, "DaoSpatialite[" + name + "].getJavaSqliteDescription[" + s_javasqlite_description + "]", e); } return s_javasqlite_description; }

Target:
public static String getJavaSqliteDescription( Database database, String name ) { if (JavaSqliteDescription.equals("")) { try { JavaSqliteDescription = "sqlite[" + getSqliteVersion(database) + "],"; JavaSqliteDescription += "spatialite[" + getspatialiteVersion(database) + "],"; JavaSqliteDescription += "proj4[" + getProj4Version(database) + "],"; JavaSqliteDescription += "geos[" + getGeosVersion(database) + "],"; JavaSqliteDescription += "spatialite_properties[" + getSpatialiteProperties(database) + "],"; JavaSqliteDescription += "rasterlite2_properties[" + getRaster2Version(database) + "]]"; } catch (Exception e) { if (i_SpatialiteVersion > 3) { JavaSqliteDescription += "rasterlite2_properties[none]]"; } else { JavaSqliteDescription += "exception[? not a spatialite database, or spatialite < 4 ?]]"; GPLog.androidLog(4, "DaoSpatialite[" + name + "].getJavaSqliteDescription[" + JavaSqliteDescription + "]", e); } } } return JavaSqliteDescription; }
Source:
public ListBoxModel doFillCloudItems() { ListBoxModel result = new ListBoxModel(); result.add("-- any --", ""); Jenkins.get().clouds .getAll(KubernetesCloud.class) .forEach(cloud -> result.add(cloud.name)); return result; }

Target:
public ListBoxModel doFillCloudItems() { ListBoxModel result = new ListBoxModel(); result.add("—any—", ""); Jenkins.get().clouds .getAll(KubernetesCloud.class) .forEach(cloud -> result.add(cloud.name)); return result; }
Source:
public Set<String> assaysAnalyzedForThisDataColumn() { return null; }

Target:
public Set<String> assaysAnalyzedForThisDataColumn() { return ImmutableSet.of(id); }
Source:
private void add( NodeUpdates updates ) { for ( IndexEntryUpdate indexUpdate : updates.forIndexes( populations.keySet(), NO_UNCHANGED_PROPERTIES ) ) { IndexPopulation population = populations.get( indexUpdate.descriptor() ); try { population.onUpdate( indexUpdate ); } catch ( Throwable failure ) { fail( population, failure ); } } }

Target:
private void add( NodeUpdates updates ) { for ( IndexEntryUpdate<IndexPopulation> indexUpdate : updates.forIndexKeys( populations ) ) { try { indexUpdate.indexKey().onUpdate( indexUpdate ); } catch ( Throwable failure ) { fail( indexUpdate.indexKey(), failure ); } } }
Source:
protected void configure() { bind(PathBuilder.class) .toInstance( new PathBuilder(config.getString("zookeeper.root_key"))); bind(InterfaceDataUpdater.class) .to(DefaultInterfaceDataUpdater.class); bind(InterfaceScanner.class) .to(MockInterfaceScanner.class); bind(MidolmanConfig.class) .toInstance(new MidolmanConfig(config, ConfigFactory.empty())); bind(MidonetBackend.class) .to(MidonetTestBackend.class).asEagerSingleton(); bind(MidonetBackendConfig.class) .toInstance( new MidonetBackendConfig(config.withFallback( MidoTestConfigurator.forAgents()))); bind(HostService.class) .to(TestableHostService.class).asEagerSingleton(); }

Target:
protected void configure() { bind(InterfaceDataUpdater.class) .to(DefaultInterfaceDataUpdater.class); bind(InterfaceScanner.class) .to(MockInterfaceScanner.class) .asEagerSingleton(); bind(MidolmanConfig.class) .toInstance(new MidolmanConfig(config, ConfigFactory.empty())); bind(MidonetBackend.class) .to(MidonetTestBackend.class).asEagerSingleton(); bind(MidonetBackendConfig.class) .toInstance( new MidonetBackendConfig(config.withFallback( MidoTestConfigurator.forAgents()))); bind(HostService.class) .to(TestableHostService.class).asEagerSingleton(); }
Source:
protected void endSuccessfully() { setVmTemplateId(getParameters().getVmTemplateId()); setVmId(getVmIdFromImageParameters()); isVmInDb = getVm() != null; getVmStaticDAO().incrementDbGeneration(getVmTemplateId()); for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Backend.getInstance().endAction(VdcActionType.CreateImageTemplate, p, getContext().duplicate().resetCompensationContext().resetExecutionContext().resetLock()); } if (reloadVmTemplateFromDB() != null) { endDefaultOperations(); } checkTrustedService(); setSucceeded(true); }

Target:
protected void endSuccessfully() { setVmTemplateId(getParameters().getVmTemplateId()); setVmId(getVmIdFromImageParameters()); isVmInDb = getVm() != null; getVmStaticDAO().incrementDbGeneration(getVmTemplateId()); for (VdcActionParametersBase p : getParameters().getImagesParameters()) { Backend.getInstance().endAction(VdcActionType.CreateImageTemplate, p, getContext().duplicate().withoutCompensationContext().withoutExecutionContext().withoutLock()); } if (reloadVmTemplateFromDB() != null) { endDefaultOperations(); } checkTrustedService(); setSucceeded(true); }
Source:
public void handleDebugEvents(DebugEvent[] events) { for (DebugEvent event : events) { if (event.getSource() instanceof IThread) { handleDebugEvent(event); } else if (event.getSource() instanceof IWatchExpression) { handleWatchExpressionEvent(event); } else if (event.getSource() instanceof IVariable && event.getKind() == DebugEvent.CHANGE && event.getDetail() == DebugEvent.CONTENT) { eventManager.addEvent(new DebugEventBase( EventType.MODIFY_VARIABLE_VALUE, new Date())); } } }

Target:
public void handleDebugEvents(DebugEvent[] events) { for (DebugEvent event : events) { if (isThread(event.getSource())) { handleDebugEvent(event); } else if (isWatchExpression(event.getSource())) { handleWatchExpressionEvent(event); } else if (isVariableModificationEvent(event)) { debugEventManager.addEvent(new DebugEventBase( DebugEventType.MODIFY_VARIABLE_VALUE, new Date())); } } }
Source:
public void setListener() { jTree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); jTree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged( TreeSelectionEvent treeSelectionEvent) { TreePath[] treePath = jTree.getSelectionPaths(); for (TreePath path : treePath) { DefaultMutableTreeNode select = (DefaultMutableTreeNode) path .getLastPathComponent(); String selectName = select.toString(); if (selectName.equals("Common ancestor") || selectName.equals("Phylogentic tree")) { selected.addAll(getChildsOfAncestor(select)); } else { selected.add(select.toString()); } } } }); }

Target:
public void setListener() { jTree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); jTree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent treeSelectionEvent) { TreePath[] treePath = jTree.getSelectionPaths(); if (treePath != null) { for (TreePath path : treePath) { DefaultMutableTreeNode select = (DefaultMutableTreeNode) path .getLastPathComponent(); String selectName = select.toString(); if (selectName.equals(PhyloController.LABEL_COMMON_ANCESTOR) || selectName.equals(PhyloController.LABEL_PHYLOGENETIC_TREE)) { selected.addAll(getChildsOfAncestor(select)); } else { selected.add(select.toString()); } } } } }); }
Source:
public void testStopDuringProcess() throws ExecutionException, InterruptedException, TimeoutException { PersistenceManager persistenceManager = extractComponent(cache, PersistenceManager.class); StreamingMarshaller marshaller = extractComponent(cache, StreamingMarshaller.class); persistenceManager.writeToAllNonTxStores(marshalledEntry("k1", "v1", marshaller), BOTH); persistenceManager.writeToAllNonTxStores(marshalledEntry("k2", "v2", marshaller), BOTH); persistenceManager.writeToAllNonTxStores(marshalledEntry("k3", "v3", marshaller), BOTH); final CountDownLatch before = new CountDownLatch(1); final CountDownLatch after = new CountDownLatch(1); final AtomicInteger count = new AtomicInteger(0); Future<Void> c = fork(() -> persistenceManager.processOnAllStores(new WithinThreadExecutor(), null, (marshalledEntry, taskContext) -> { before.countDown(); after.await(); count.incrementAndGet(); }, true, true)); before.await(30, TimeUnit.SECONDS); Future<Void> stopFuture = fork(persistenceManager::stop); Exceptions.expectException(TimeoutException.class, () -> stopFuture.get(15, TimeUnit.SECONDS)); after.countDown(); c.get(30, TimeUnit.SECONDS); stopFuture.get(30, TimeUnit.SECONDS); assertEquals(3, count.get()); }

Target:
public void testStopDuringProcess() throws ExecutionException, InterruptedException, TimeoutException { PersistenceManager persistenceManager = extractComponent(cache, PersistenceManager.class); StreamingMarshaller marshaller = extractComponent(cache, StreamingMarshaller.class); persistenceManager.writeToAllNonTxStores(marshalledEntry("k1", "v1", marshaller), BOTH); persistenceManager.writeToAllNonTxStores(marshalledEntry("k2", "v2", marshaller), BOTH); persistenceManager.writeToAllNonTxStores(marshalledEntry("k3", "v3", marshaller), BOTH); final CountDownLatch before = new CountDownLatch(1); final CountDownLatch after = new CountDownLatch(1); final AtomicInteger count = new AtomicInteger(0); Future<Void> c = fork(() -> persistenceManager.processOnAllStores(new WithinThreadExecutor(), null, (marshalledEntry, taskContext) -> { before.countDown(); after.await(); count.incrementAndGet(); }, true, true)); before.await(30, TimeUnit.SECONDS); Future<Void> stopFuture = fork(persistenceManager::stop); expectException(TimeoutException.class, () -> stopFuture.get(1, TimeUnit.SECONDS)); after.countDown(); c.get(30, TimeUnit.SECONDS); stopFuture.get(30, TimeUnit.SECONDS); assertEquals(3, count.get()); }
Source:
public CassandraFrameworkProtos.RackDc getDefaultRackDc() { CassandraFrameworkProtos.RackDc rackDc = get().getDefaultRackDc(); if (rackDc == null) rackDc = CassandraFrameworkProtos.RackDc.newBuilder().setRack("RACK0").setDc("DC0").build(); return rackDc; }

Target:
public CassandraFrameworkProtos.RackDc getDefaultRackDc() { CassandraFrameworkProtos.RackDc rackDc = getDefaultConfigRole().getRackDc(); if (rackDc == null) rackDc = CassandraFrameworkProtos.RackDc.newBuilder().setRack("RACK0").setDc("DC0").build(); return rackDc; }
Source:
protected long indexCount(final String query, final long timeoutMillis) { final String queryStringQuery = findAndReplaceQueryDates(translateQuery(query, null).getQuery()); IndiciesInfo info; try { info = this.indiciesAPI.loadIndicies(); } catch(DotDataException ee) { Logger.fatal(this, "Can't get indicies information",ee); return 0; } final Client client = new ESClient().getClient(); final QueryStringQueryBuilder queryStringQueryBuilder = QueryBuilders.queryStringQuery(queryStringQuery); final SearchRequestBuilder searchRequestBuilder = client.prepareSearch().setSize(0); searchRequestBuilder.setTimeout(TimeValue.timeValueMillis(timeoutMillis)); searchRequestBuilder.setQuery(queryStringQueryBuilder); searchRequestBuilder.setIndices( query.contains("+live:true") && !query.contains("+deleted:true")? info.live: info.working); return searchRequestBuilder.execute().actionGet().getHits().getTotalHits(); }

Target:
protected long indexCount(final String query, final long timeoutMillis) { final String queryStringQuery = findAndReplaceQueryDates(translateQuery(query, null).getQuery()); IndiciesInfo info; try { info = this.indiciesAPI.loadIndicies(); } catch(DotDataException ee) { Logger.fatal(this, "Can't get indicies information",ee); return 0; } final Client client = this.client.getClient(); final QueryStringQueryBuilder queryStringQueryBuilder = QueryBuilders.queryStringQuery(queryStringQuery); final SearchRequestBuilder searchRequestBuilder = client.prepareSearch().setSize(0); searchRequestBuilder.setTimeout(TimeValue.timeValueMillis(timeoutMillis)); searchRequestBuilder.setQuery(queryStringQueryBuilder); searchRequestBuilder.setIndices( query.contains("+live:true") && !query.contains("+deleted:true")? info.live: info.working); return searchRequestBuilder.execute().actionGet().getHits().getTotalHits(); }
Source:
private void initValues() { if (networkAttachment == null) { return; } boolean newAttachment = networkAttachment.getId() == null; boolean attachmentNotReportedByTheEngine = networkAttachment.getReportedConfigurations() == null; boolean syncedNetwork = attachmentNotReportedByTheEngine || networkAttachment.getReportedConfigurations().isNetworkInSync(); boolean syncRequestedByUser = !syncedNetwork && Boolean.TRUE.equals(getIsToSync().getEntity()); if (newAttachment || syncedNetwork || syncRequestedByUser) { syncWith(new InterfacePropertiesAccessor.FromNetworkAttachmentForModel(networkAttachment, networkQos, nic)); } else { syncWith(new InterfacePropertiesAccessor.FromNic(nic)); getDnsConfigurationModel().setEntity(reportedDnsResolverConfiguration); } }

Target:
private void initValues() { if (networkAttachment == null) { return; } boolean newAttachment = networkAttachment.getId() == null; boolean attachmentNotReportedByTheEngine = networkAttachment.getReportedConfigurations() == null; boolean syncedNetwork = attachmentNotReportedByTheEngine || networkAttachment.getReportedConfigurations().isNetworkInSync(); boolean syncRequestedByUser = !syncedNetwork && Boolean.TRUE.equals(getIsToSync().getEntity()); if (newAttachment || syncedNetwork || syncRequestedByUser) { syncWith(new InterfacePropertiesAccessor.FromNetworkAttachmentForModel(networkAttachment, networkQos, nic)); } else { syncWith(new InterfacePropertiesAccessor.FromNic(nic, reportedDnsResolverConfiguration)); } }