auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Void execute() throws GitException { remote = remote == null ? "origin" : remote; reset(); commandLine.add("pull"); if (remote != null) { commandLine.add(remote); } if (refSpec != null) { commandLine.add(refSpec); } if (author != null) { Map<String, String> environment = new HashMap<>(); environment.put("GIT_AUTHOR_NAME", author.getName()); environment.put("GIT_AUTHOR_EMAIL", author.getEmail()); environment.put("GIT_COMMITTER_NAME", author.getName()); environment.put("GIT_COMMITTER_EMAIL", author.getEmail()); setCommandEnvironment(environment); } start(); pullResponse = DtoFactory.getInstance().createDto(PullResponse.class); if (lines.getLast().startsWith("Already")) { pullResponse.setAlreadyUpToDate(true); pullResponse.setCommandOutput(lines.getLast()); } else { pullResponse.setAlreadyUpToDate(false); Joiner joiner = Joiner.on("\n"); pullResponse.setCommandOutput(joiner.join(lines.listIterator())); } return null; }

Target:
public Void execute() throws GitException { remote = remote == null ? "origin" : remote; reset(); commandLine.add("pull"); if (remote != null) { commandLine.add(remote); } if (refSpec != null) { commandLine.add(refSpec); } if (author != null) { Map<String, String> environment = new HashMap<>(); environment.put("GIT_AUTHOR_NAME", author.getName()); environment.put("GIT_AUTHOR_EMAIL", author.getEmail()); environment.put("GIT_COMMITTER_NAME", author.getName()); environment.put("GIT_COMMITTER_EMAIL", author.getEmail()); setCommandEnvironment(environment); } start(); pullResponse = newDto(PullResponse.class).withCommandOutput(Joiner.on("\n").join(lines)); return null; }
Source:
public Object clone( ClassLoader target ) { try { Class<?> cls = target.loadClass( getClass().getName() ); Object clone = cls.newInstance(); cls.getMethod( "setDisable", boolean.class ) .invoke( clone, isDisable() ); cls.getMethod( "setVersion", String.class ) .invoke( clone, getVersion() ); return clone; } catch ( ReflectiveOperationException e ) { throw new IllegalStateException( e.getLocalizedMessage() ); } }

Target:
public Object clone( ClassLoader target ) { try { Class<?> cls = ReflectionUtils.reloadClass( target, this ); Object clone = cls.newInstance(); cls.getMethod( "setDisable", boolean.class ) .invoke( clone, isDisable() ); cls.getMethod( "setVersion", String.class ) .invoke( clone, getVersion() ); return clone; } catch ( ReflectiveOperationException e ) { throw new IllegalStateException( e.getLocalizedMessage() ); } }
Source:
public void afterRefreshTreatment(boolean succeeded) { if (!succeeded) { lockManager.releaseLock(monitoringLock); return; } Guid storagePoolId = null; ArrayList<VDSDomainsData> domainsList = null; try { synchronized (this) { unrespondedAttempts.set(0); setLastUpdate(); try { hostMonitoring.afterRefreshTreatment(); if (cachedVds != null && cachedVds.getStatus() != VDSStatus.Maintenance) { storagePoolId = cachedVds.getStoragePoolId(); domainsList = cachedVds.getDomains(); } hostMonitoring = null; } catch (IRSErrorException ex) { logAfterRefreshFailureMessage(ex); if (log.isDebugEnabled()) { logException(ex); } } catch (RuntimeException ex) { logAfterRefreshFailureMessage(ex); logException(ex); } } } catch (Exception e) { log.error("Timer update runtime info failed. Exception:", ExceptionUtils.getRootCauseMessage(e)); log.debug("Exception:", e); } finally { lockManager.releaseLock(monitoringLock); if (domainsList != null) { updateVdsDomainsData(cachedVds, storagePoolId, domainsList); } } }

Target:
public void afterRefreshTreatment(boolean succeeded) { if (!succeeded) { lockManager.releaseLock(monitoringLock); return; } try { Guid storagePoolId = null; ArrayList<VDSDomainsData> domainsList = null; synchronized (this) { unrespondedAttempts.set(0); setLastUpdate(); try { hostMonitoring.afterRefreshTreatment(); if (cachedVds != null && cachedVds.getStatus() != VDSStatus.Maintenance) { storagePoolId = cachedVds.getStoragePoolId(); domainsList = cachedVds.getDomains(); } hostMonitoring = null; } catch (IRSErrorException ex) { logAfterRefreshFailureMessage(ex); if (log.isDebugEnabled()) { logException(ex); } } catch (RuntimeException ex) { logAfterRefreshFailureMessage(ex); logException(ex); } } if (domainsList != null) { updateVdsDomainsData(cachedVds, storagePoolId, domainsList); } } catch (Exception e) { log.error("Timer update runtime info failed. Exception:", ExceptionUtils.getRootCauseMessage(e)); log.debug("Exception:", e); } finally { lockManager.releaseLock(monitoringLock); } }
Source:
private void killInstances(SchedulerDriver driver, int toKill) { if (toKill == 0) return; if (toKill == crateInstances.size()) { markForceShutdown(driver); } int killed = 0; LOGGER.debug("Too many instances running. Killing tasks", toKill); for (CrateInstance crateInstance : crateInstances) { if (killed == toKill) { break; } LOGGER.info("Kill task {}", crateInstance.taskId()); stateStore.state().addSlaveWithInstance(crateInstance.slaveID()); driver.killTask(taskID(crateInstance.taskId())); killed++; } }

Target:
private void killInstances(SchedulerDriver driver, int toKill) { if (toKill == 0) return; if (toKill == crateInstances.size()) { markForceShutdown(driver); } int killed = 0; LOGGER.debug("Too many instances running. Killing tasks", toKill); for (CrateInstance crateInstance : crateInstances) { if (killed == toKill) { break; } LOGGER.info("Kill task {}", crateInstance.taskId()); driver.killTask(taskID(crateInstance.taskId())); killed++; } }
Source:
@Before public void setUp() throws IOException { file = File.createTempFile("test.foq", null); file.delete(); queue = new FileObjectQueue<String>(file, new SerializedConverter<String>()); queue.add("one"); queue.add("two"); queue.add("three"); }

Target:
@Before public void setUp() throws IOException { File parent = folder.getRoot(); File file = new File(parent, "queue-file"); queue = new FileObjectQueue<String>(file, new SerializedConverter<String>()); queue.add("one"); queue.add("two"); queue.add("three"); }
Source:
public List<Block> execute(Object unusedParameters, String content, MacroTransformationContext context) throws MacroExecutionException { List<Block> result = Collections.emptyList(); Block figureBlock = context.getCurrentMacroBlock().getFirstBlock(new BlockMatcher() { @Override public boolean match(Block block) { return block instanceof FigureBlock; } }, Block.Axes.ANCESTOR); if (figureBlock != null) { XDOM xdom = this.contentParser.parse(content, context, false, false); List<Block> figureCaptionChildren = xdom.getChildren(); this.parserUtils.removeTopLevelParagraph(figureCaptionChildren); List<Block> contentBlock = Collections.singletonList(new FigureCaptionBlock(figureCaptionChildren)); result = Collections.singletonList(new MetaDataBlock(contentBlock, this.getUnchangedContentMetaData())); } return result; }

Target:
public List<Block> execute(Object unusedParameters, String content, MacroTransformationContext context) throws MacroExecutionException { List<Block> result = Collections.emptyList(); Block parent = context.getCurrentMacroBlock().getParent(); if (parent instanceof FigureBlock) { XDOM xdom = this.contentParser.parse(content, context, false, false); List<Block> figureCaptionChildren = xdom.getChildren(); this.parserUtils.removeTopLevelParagraph(figureCaptionChildren); figureCaptionChildren = Collections.singletonList(new FigureCaptionBlock(figureCaptionChildren)); result = Collections.singletonList(new MetaDataBlock(figureCaptionChildren, getUnchangedContentMetaData())); } return result; }
Source:
private static PrintStream printTime(long start, long end) { return System.out.format(", %.3f", 0.000000001 * (end - start)); }

Target:
private static void printTime(long start, long end) { System.out.format(", %.3f", 0.000000001 * (end - start)); }
Source:
public static Configuration configurePythonDependencies( List<Tuple2<String, DistributedCache.DistributedCacheEntry>> cachedFiles, Configuration config) { PythonDependencyManager pythonDependencyManager = new PythonDependencyManager(cachedFiles, config); pythonDependencyManager.configure(config); return pythonDependencyManager.getConfigWithPythonDependencyOptions(); }

Target:
public static Configuration configurePythonDependencies( List<Tuple2<String, DistributedCache.DistributedCacheEntry>> cachedFiles, Configuration config) { PythonDependencyManager pythonDependencyManager = new PythonDependencyManager(cachedFiles, config); return pythonDependencyManager.getConfigWithPythonDependencyOptions(); }
Source:
private ClusterConfig.Builder clusterConfigBuilder(ServiceDiscoveryConfig config) { Builder builder = ClusterConfig.builder(); if (config.seeds() != null) { builder.seedMembers( Arrays.stream(config.seeds()) .map(address -> Address.create(address.host(), address.port())) .toArray(Address[]::new)); } if (config.port() != null) { builder.port(config.port()); } if (config.tags() != null) { builder.metadata(config.tags()); } if (config.memberHost() != null) { builder.memberHost(config.memberHost()); } if (config.memberPort() != null) { builder.memberPort(config.memberPort()); } return builder; }

Target:
private ClusterConfig.Builder clusterConfigBuilder(ServiceDiscoveryConfig config) { Builder builder = ClusterConfig.builder(); if (config.seeds() != null) { builder.seedMembers( Arrays.stream(config.seeds()) .map(address -> io.scalecube.transport.Address.create(address.host(), address.port())) .toArray(io.scalecube.transport.Address[]::new)); } if (config.port() != null) { builder.port(config.port()); } if (config.tags() != null) { builder.metadata(config.tags()); } if (config.memberHost() != null) { builder.memberHost(config.memberHost()); } if (config.memberPort() != null) { builder.memberPort(config.memberPort()); } return builder; }
Source:
private List<IRecord> remove(BrowserAction action) { List<IRecord> records = new LinkedList<IRecord>(); ElementRecord element = getElement(action.getID()); if (element == null) return new LinkedList<IRecord>(); records.add(element.getRemoveRecord()); return records; }

Target:
private List<IRecord> remove(BrowserAction action) { ElementRecord element = getElement(action.getID()); if (element == null) return Collections.emptyList(); List<IRecord> records = new ArrayList<IRecord>(); records.add(element.getRemoveRecord()); return records; }
Source:
public Workflow getWorkflow(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "workflow ID", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "Comma-delimited list of fields to include: validations") @QueryParam("include") String include) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkCanRead(user, workflow); Hibernate.initialize(workflow.getUsers()); if (checkIncludes(include, "validations")) { workflow.getVersions().forEach(workflowVersion -> Hibernate.initialize(workflowVersion.getValidations())); } return workflow; }

Target:
public Workflow getWorkflow(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "workflow ID", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "Comma-delimited list of fields to include: validations") @QueryParam("include") String include) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkCanRead(user, workflow); Hibernate.initialize(workflow.getUsers()); initializeValidations(include, workflow); return workflow; }
Source:
public void getSystemInfo(final OnReceiveSystemInfoListener listener) { new GetTask(mHttpsCertPath) { @Override protected void onPostExecute(String s) { if (s == null) return; try { JSONObject system = new JSONObject(s); SystemInfo si = new SystemInfo(); si.alloc = system.getLong("alloc"); si.cpuPercent = system.getDouble("cpuPercent"); if system.has("discoveryEnabled") { si.extAnnounceTotal = system.getInt("discoveryMethods"); si.extAnnounceConnected = si.extAnnounceTotal - system.getJSONObject("discoveryErrors").length(); } else { si.extAnnounceTotal = 0; si.extAnnounceConnected = 0; } si.goroutines = system.getInt("goroutines"); si.myID = system.getString("myID"); si.sys = system.getLong("sys"); listener.onReceiveSystemInfo(si); } catch (JSONException e) { Log.w(TAG, "Failed to read system info", e); } } }.execute(mUrl, GetTask.URI_SYSTEM, mApiKey); }

Target:
public void getSystemInfo(final OnReceiveSystemInfoListener listener) { new GetTask(mHttpsCertPath) { @Override protected void onPostExecute(String s) { if (s == null) return; try { JSONObject system = new JSONObject(s); SystemInfo si = new SystemInfo(); si.alloc = system.getLong("alloc"); si.cpuPercent = system.getDouble("cpuPercent"); if (system.has("discoveryEnabled")) { si.extAnnounceTotal = system.getInt("discoveryMethods"); si.extAnnounceConnected = si.extAnnounceTotal - system.getJSONObject("discoveryErrors").length(); } else { si.extAnnounceTotal = 0; si.extAnnounceConnected = 0; } si.goroutines = system.getInt("goroutines"); si.myID = system.getString("myID"); si.sys = system.getLong("sys"); listener.onReceiveSystemInfo(si); } catch (JSONException e) { Log.w(TAG, "Failed to read system info", e); } } }.execute(mUrl, GetTask.URI_SYSTEM, mApiKey); }
Source:
public static RetryOptions getDefaultOptions() { return new Builder().build(); }

Target:
public static RetryOptions getDefaultOptions() { return builder().build(); }
Source:
Node(final String name, final NodeProcessor nodeProcessor, final Dag dag) { requireNonNull(nodeProcessor, "The nodeProcessor parameter can't be null."); this.nodeProcessor = nodeProcessor; requireNonNull(name, "The name of the node can't be null"); this.name = name; requireNonNull(name, "The dag of the node can't be null"); this.dag = dag; }

Target:
Node(final String name, final NodeProcessor nodeProcessor, final Dag dag) { requireNonNull(nodeProcessor, "The nodeProcessor parameter can't be null."); this.nodeProcessor = nodeProcessor; requireNonNull(name, "The name of the node can't be null"); this.name = name; requireNonNull(dag, "The dag of the node can't be null"); this.dag = dag; }
Source:
public String getHadoopVersion() { return hadoopVersion; }

Target:
public HadoopVersion getHadoopVersion() { return hadoopVersion; }
Source:
private static boolean checkPolicyProviderRemoved(OperationContext context, String defaultPolicy, ModelNode newValue, ModelNode oldValue) throws OperationFailedException { List<String> newPolicies = getPoliciesNames(context, newValue); List<String> oldPolicies = getPoliciesNames(context, oldValue); return oldPolicies.contains(defaultPolicy) && !newPolicies.contains(defaultPolicy); }

Target:
private static boolean checkPolicyProviderRemoved(OperationContext context, String defaultPolicy, ModelNode newValue, ModelNode oldValue) throws OperationFailedException { if (getPoliciesNames(context, oldValue).contains(defaultPolicy)) { return !getPoliciesNames(context, newValue).contains(defaultPolicy); } return false; }
Source:
private boolean saveFileToExternalStorage() { mArcGISTempFolderPath = Environment.getExternalStorageDirectory() + File.separator + this.getResources() .getString(R.string.pin_blank_orange_folder_name); mPinBlankOrangeFilePath = mArcGISTempFolderPath + File.separator + this.getResources().getString(R.string.pin_blank_orange_file_name); Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.pin_blank_orange); File folder = new File(mArcGISTempFolderPath); folder.mkdirs(); File file = new File(mPinBlankOrangeFilePath); try { OutputStream outStream = new FileOutputStream(file); bm.compress(Bitmap.CompressFormat.PNG, 100, outStream); outStream.flush(); outStream.close(); return true; } catch (Exception e) { Log.e("picture-marker-symbol", "Failed to write image to external directory: message = " + e.getMessage()); return false; } }

Target:
private boolean saveFileToExternalStorage() { mArcGISTempFolderPath = Environment.getExternalStorageDirectory() + File.separator + this.getResources() .getString(R.string.pin_blank_orange_folder_name); mPinBlankOrangeFilePath = mArcGISTempFolderPath + File.separator + this.getResources().getString(R.string.pin_blank_orange_file_name); Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.pin_blank_orange); File folder = new File(mArcGISTempFolderPath); if(folder.mkdirs()){ Log.d(TAG, "Temp folder created"); }else{ Toast.makeText(MainActivity.this, "Could not create temp folder", Toast.LENGTH_LONG).show(); } File file = new File(mPinBlankOrangeFilePath); try { OutputStream outStream = new FileOutputStream(file); bm.compress(Bitmap.CompressFormat.PNG, 100, outStream); outStream.flush(); outStream.close(); return true; } catch (Exception e) { Log.e("picture-marker-symbol", "Failed to write image to external directory: message = " + e.getMessage()); return false; } }
Source:
private void doTaskStart() { if(!started) { List<String> args = new ArrayList<>(0); if(this.applicationArguments != null) { args = Arrays.asList(this.applicationArguments.getSourceArgs()); } this.taskExecution = this.taskRepository.createTaskExecution(this.taskRepository.getNextExecutionId(), this.taskNameResolver.getTaskName(), new Date(), args); } else { logger.error("Multiple start events have been received. The first one was " + "recorded."); } taskExecution.setExitMessage(invokeOnTaskStartup(taskExecution).getExitMessage()); }

Target:
private void doTaskStart() { if(!started) { List<String> args = new ArrayList<>(0); if(this.applicationArguments != null) { args = Arrays.asList(this.applicationArguments.getSourceArgs()); } this.taskExecution = this.taskRepository.createTaskExecution( this.taskNameResolver.getTaskName(), new Date(), args); } else { logger.error("Multiple start events have been received. The first one was " + "recorded."); } taskExecution.setExitMessage(invokeOnTaskStartup(taskExecution).getExitMessage()); }
Source:
private void execute(Callable<Void> task) throws IOException { try { copier.submit(task).get(); } catch (InterruptedException e) { throw interrupted(e); } catch (RejectedExecutionException e) { throw new IOException(e); } catch (ExecutionException e) { throw new IOException(e.getCause()); } }

Target:
private void execute(Callable<Void> task) throws IOException { if (pending != null) { checkedGet(pending); } try { pending = copier.submit(task); } catch (RejectedExecutionException e) { throw new IOException(e); } checkedGet(pending); pending = null; }
Source:
private void closeWindowAction() { Window window = windowClose.getScene().getWindow(); if (window instanceof Stage) { Stage stage = (Stage) window; stage.close(); } }

Target:
private void closeWindowAction() { getStage(windowClose.getScene().getWindow()).close(); }
Source:
public void start() { try { String hostName = "localhost"; log.debug("Opening a Stomp server " + hostName + ":" + jsonPort); Reactor reactor = ReactorFactory.getReactor(null, ReactorType.STOMP); final Future<ReactorListener> futureListener = reactor.createListener(hostName, jsonPort, new ReactorListener.EventListener() { @Override public void onAcccept(final ReactorClient client) { client.addEventListener(new MessageListener() { @Override public void onMessageReceived(byte[] message) { try { JsonRpcRequest request = JsonRpcRequest.fromJsonNode(mapper.readTree(message)); ObjectNode parameters = mapper.createObjectNode(); ContextHolder.init(); ContextHolder.setServerName(client.getHostname()); if (request.getMethod().equalsIgnoreCase("Host.getCapabilities")) { Map response = api.getVdsCapabilities(); parameters.putPOJO("info", response); } JsonRpcResponse response = new JsonRpcResponse(parameters, null, request.getId()); client.sendMessage(fromJson(response)); } catch (IOException e) { log.error("Failure in processing request", e); } } }); } }); Thread t = new Thread(new Runnable() { @Override public void run() { while (true) { try { futureListener.get(); } catch (Exception e) { log.error("Error while waiting on listener", e); } } } }); t.start(); } catch (Exception e) { log.error("Failure to start json server socket", e); } }

Target:
public void start() { try { String hostName = "localhost"; log.debug("Opening a Stomp server " + hostName + ":" + jsonPort); Reactor reactor = ReactorFactory.getReactor(null, ReactorType.STOMP); final Future<ReactorListener> futureListener = reactor.createListener(hostName, jsonPort, new ReactorListener.EventListener() { @Override public void onAcccept(final ReactorClient client) { client.addEventListener(new MessageListener() { @SuppressWarnings("unchecked") @Override public void onMessageReceived(byte[] message) { try { JsonRpcRequest request = JsonRpcRequest.fromJsonNode(mapper.readTree(message)); ContextHolder.init(); ContextHolder.setServerName(client.getHostname()); ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); if (apiMapper.containsKey(methodName)) { Method m = apiMapper.get(methodName); Class<?>[] params = m.getParameterTypes(); Map<?, ?> response = null; if (params == null || params.length == 0) { response = (Map<?, ?>) m.invoke(api); } else { response = (Map<?, ?>) m.invoke(api, request.getParams()); } builder = builder.withResult((Map<String, Object>) response.get("info")); } else { log.error("Unsupported method " + methodName); builder = builder.withError((Map<String, Object>) Collections.EMPTY_MAP); } JsonRpcResponse response = builder.build(); client.sendMessage(fromJson(response)); } catch (Throwable e) { log.error("Failure in processing request", e); } } }); } }); listener = futureListener.get(TIMEOUT, TimeUnit.MILLISECONDS); } catch (Exception e) { log.error("Failure to start json server socket", e); } }
Source:
public Map<SystemStreamPartition, Startpoint> getFanOutForTask(TaskName taskName) { Preconditions.checkState(!stopped, "Underlying metadata store not available"); Preconditions.checkNotNull(taskName, "TaskName cannot be null"); StartpointFanOut.StartpointFanOutSerde startpointFanOutSerde = new StartpointFanOut.StartpointFanOutSerde(); byte[] fanOutBytes = fanOutStore.get(toFanOutStoreKey(taskName)); if (ArrayUtils.isEmpty(fanOutBytes)) { return null; } StartpointFanOut startpointFanOut = startpointFanOutSerde.fromBytes(fanOutBytes); return ImmutableMap.copyOf(startpointFanOut.getFanOuts()); }

Target:
public Map<SystemStreamPartition, Startpoint> getFanOutForTask(TaskName taskName) throws IOException { Preconditions.checkState(!stopped, "Underlying metadata store not available"); Preconditions.checkNotNull(taskName, "TaskName cannot be null"); byte[] fanOutBytes = fanOutStore.get(toFanOutStoreKey(taskName)); if (ArrayUtils.isEmpty(fanOutBytes)) { return ImmutableMap.of(); } StartpointFanOutPerTask startpointFanOutPerTask = objectMapper.readValue(fanOutBytes, StartpointFanOutPerTask.class); return ImmutableMap.copyOf(startpointFanOutPerTask.getFanOuts()); }
Source:
private void close(final boolean clean) { if (clean && checkpointNeeded) { executeAndMaybeSwallow(true, this::writeCheckpointIfNeed, "state manager checkpoint", log); } switch (state()) { case CREATED: case RUNNING: case RESTORING: case SUSPENDED: executeAndMaybeSwallow( clean, () -> StateManagerUtil.closeStateManager( log, logPrefix, clean, eosEnabled, stateMgr, stateDirectory, TaskType.ACTIVE ), "state manager close", log); executeAndMaybeSwallow(clean, recordCollector::close, "record collector close", log); break; case CLOSED: log.trace("Skip closing since state is {}", state()); return; default: throw new IllegalStateException("Unknown state " + state() + " while closing active task " + id); } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); }

Target:
private void close(final boolean clean) { if (clean) { executeAndMaybeSwallow(true, this::writeCheckpointIfNeed, "state manager checkpoint", log); } switch (state()) { case CREATED: case RUNNING: case RESTORING: case SUSPENDED: executeAndMaybeSwallow( clean, () -> StateManagerUtil.closeStateManager( log, logPrefix, clean, eosEnabled, stateMgr, stateDirectory, TaskType.ACTIVE ), "state manager close", log); executeAndMaybeSwallow(clean, recordCollector::close, "record collector close", log); break; case CLOSED: log.trace("Skip closing since state is {}", state()); return; default: throw new IllegalStateException("Unknown state " + state() + " while closing active task " + id); } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); }
Source:
public static void sendMailSync(long userId, Event event, Position position) throws MessagingException { User user = Context.getPermissionsManager().getUser(userId); Properties properties = getProperties(new PropertiesProvider(user)); if (Context.getConfig().getBoolean("mail.smtp.ignoreUserConfig") || !properties.containsKey("mail.smtp.host")) { properties = getProperties(new PropertiesProvider(Context.getConfig())); if (!properties.containsKey("mail.smtp.host")) { Log.warning("No SMTP configuration found"); return; } } Session session = Session.getInstance(properties); MimeMessage message = new MimeMessage(session); String from = properties.getProperty("mail.smtp.from"); if (from != null) { message.setFrom(new InternetAddress(from)); } message.addRecipient(Message.RecipientType.TO, new InternetAddress(user.getEmail())); MailMessage mailMessage = NotificationFormatter.formatMailMessage(userId, event, position); message.setSubject(mailMessage.getSubject()); message.setSentDate(new Date()); message.setContent(mailMessage.getBody(), "text/html; charset=utf-8"); Transport transport = session.getTransport(); try { Context.getStatisticsManager().registerMail(); transport.connect( properties.getProperty("mail.smtp.host"), properties.getProperty("mail.smtp.username"), properties.getProperty("mail.smtp.password")); transport.sendMessage(message, message.getAllRecipients()); } finally { transport.close(); } }

Target:
public static void sendMailSync(long userId, Event event, Position position) throws MessagingException { User user = Context.getPermissionsManager().getUser(userId); Properties properties = null; if (!Context.getConfig().getBoolean("mail.smtp.ignoreUserConfig")) { properties = getProperties(new PropertiesProvider(user)); } if (properties == null || !properties.containsKey("mail.smtp.host")) { properties = getProperties(new PropertiesProvider(Context.getConfig())); } if (!properties.containsKey("mail.smtp.host")) { Log.warning("No SMTP configuration found"); return; } Session session = Session.getInstance(properties); MimeMessage message = new MimeMessage(session); String from = properties.getProperty("mail.smtp.from"); if (from != null) { message.setFrom(new InternetAddress(from)); } message.addRecipient(Message.RecipientType.TO, new InternetAddress(user.getEmail())); MailMessage mailMessage = NotificationFormatter.formatMailMessage(userId, event, position); message.setSubject(mailMessage.getSubject()); message.setSentDate(new Date()); message.setContent(mailMessage.getBody(), "text/html; charset=utf-8"); Transport transport = session.getTransport(); try { Context.getStatisticsManager().registerMail(); transport.connect( properties.getProperty("mail.smtp.host"), properties.getProperty("mail.smtp.username"), properties.getProperty("mail.smtp.password")); transport.sendMessage(message, message.getAllRecipients()); } finally { transport.close(); } }
Source:
private void checkMethodDefinition(MethodTree tree) { BlockTree blockTree = tree.block(); if (tree.symbol() != null && VERIFY_METHOD_MATCHER.matches(tree) && blockTree != null) { checkBlock(blockTree); } }

Target:
private void checkMethodDefinition(MethodTree tree) { BlockTree blockTree = tree.block(); if (VERIFY_METHOD_MATCHER.matches(tree) && blockTree != null) { checkBlock(blockTree); } }
Source:
public void testQueryByDeploymentTimeAfter() { List<Deployment> deployments = repositoryService.createDeploymentQuery().list(); for (Deployment deployment : deployments) { List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(deployment.getDeploymentTime()).list(); for (ProcessDefinition processDefinition : processDefinitions) { Deployment singleDeployment = repositoryService.createDeploymentQuery().deploymentId(processDefinition.getDeploymentId()).singleResult(); assertThat(singleDeployment.getDeploymentTime()).isAfter(deployment.getDeploymentTime()); } } }

Target:
public void testQueryByDeploymentTimeAfter() { Date startTest = DateUtils.addSeconds(ClockUtil.now(), 5); ClockUtil.setCurrentTime(startTest); ClockUtil.setCurrentTime(DateUtils.addSeconds(startTest, 5)); Deployment tempDeploymentOne = repositoryService.createDeployment() .addClasspathResource(getResourceOnePath()).addClasspathResource(getResourceTwoPath()).deploy(); engineRule.manageDeployment(tempDeploymentOne); Date timeAfterDeploymentOne = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); ClockUtil.setCurrentTime(DateUtils.addSeconds(timeAfterDeploymentOne, 5)); Deployment tempDeploymentTwo = repositoryService.createDeployment() .addClasspathResource(getResourceOnePath()).deploy(); engineRule.manageDeployment(tempDeploymentTwo); Date timeAfterDeploymentTwo = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); ClockUtil.setCurrentTime(DateUtils.addSeconds(timeAfterDeploymentTwo, 5)); Deployment tempDeploymentThree = repositoryService.createDeployment() .addClasspathResource(getResourceThreePath()).deploy(); engineRule.manageDeployment(tempDeploymentThree); Date timeAfterDeploymentThree = DateUtils.addSeconds(ClockUtil.getCurrentTime(), 1); List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(startTest).list(); assertThat(processDefinitions).hasSize(4); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(timeAfterDeploymentOne).list(); assertThat(processDefinitions).hasSize(2); assertThatProcessDefinitionsWereDeployedAfter(processDefinitions, timeAfterDeploymentOne); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(timeAfterDeploymentTwo).list(); assertThat(processDefinitions).hasSize(1); assertThatProcessDefinitionsWereDeployedAfter(processDefinitions, timeAfterDeploymentTwo); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(timeAfterDeploymentThree).list(); assertThat(processDefinitions).hasSize(0); }
Source:
private boolean removeVmPool() { if (getVmPoolId() != null && canRemoveVmPool(getVmPoolId())) { getVmPoolDAO().remove(getVmPoolId()); return true; } else { return false; } }

Target:
private boolean removeVmPool() { if (getVmPoolId() != null && canRemoveVmPool(getVmPoolId())) { getVmPoolDAO().remove(getVmPoolId()); return true; } else { if (getVmPoolId() == null) { log.error("Failed to remove VM Pool: VM Pool ID is null"); } else { log.error("Failed to remove VM Pool '{}': there are still VMs in the Pool", getVmPoolName()); } return false; } }
Source:
public synchronized void testInjection() { Integer testInt = Integer.valueOf(123); String testString = new String("abc"); Double testDouble = Double.valueOf(1.23); Float testFloat = Float.valueOf(12.3f); Character testChar = Character.valueOf('v'); IEclipseContext context = EclipseContextFactory.create(); context.set(Integer.class.getName(), testInt); context.set(String.class, testString); context.set(Double.class.getName(), testDouble); context.set(Float.class.getName(), testFloat); context.set(Character.class, testChar); ObjectBasic userObject = new ObjectBasic(); ContextInjectionFactory.inject(userObject, context); assertEquals(testString, userObject.injectedString); assertEquals(testInt, userObject.getInt()); assertEquals(context, userObject.context); assertEquals(1, userObject.setMethodCalled); assertEquals(1, userObject.setMethodCalled2); assertEquals(testDouble, userObject.d); assertEquals(testFloat, userObject.f); assertEquals(testChar, userObject.c); assertTrue(userObject.finalized); }

Target:
public synchronized void testInjection() { Integer testInt = Integer.valueOf(123); String testString = new String("abc"); Double testDouble = Double.valueOf(1.23); Float testFloat = Float.valueOf(12.3f); Character testChar = Character.valueOf('v'); IEclipseContext context = EclipseContextFactory.create(); context.set(Integer.class, testInt); context.set(String.class, testString); context.set(Double.class, testDouble); context.set(Float.class, testFloat); context.set(Character.class, testChar); ObjectBasic userObject = new ObjectBasic(); ContextInjectionFactory.inject(userObject, context); assertEquals(testString, userObject.injectedString); assertEquals(testInt, userObject.getInt()); assertEquals(context, userObject.context); assertEquals(1, userObject.setMethodCalled); assertEquals(1, userObject.setMethodCalled2); assertEquals(testDouble, userObject.d); assertEquals(testFloat, userObject.f); assertEquals(testChar, userObject.c); assertTrue(userObject.finalized); }
Source:
static InternationalFixedDate ofEpochDay(final long epochDay) { InternationalFixedChronology.EPOCH_DAY_RANGE.checkValidValue(epochDay, ChronoField.EPOCH_DAY); long zeroDay = epochDay + InternationalFixedChronology.DAYS_0000_TO_1970; if (zeroDay < 0) { throw new DateTimeException("Invalid epoch: " + epochDay); } long year = (400 * zeroDay) / DAYS_PER_CYCLE; long doy = zeroDay - (InternationalFixedChronology.DAYS_IN_YEAR * year + getLeapYearsBefore(year)); return ofYearDay((int) year, (int) doy); }

Target:
static InternationalFixedDate ofEpochDay(final long epochDay) { EPOCH_DAY_RANGE.checkValidValue(epochDay, ChronoField.EPOCH_DAY); long zeroDay = epochDay + DAYS_0000_TO_1970; long year = (400 * zeroDay) / DAYS_PER_CYCLE; long doy = zeroDay - (DAYS_IN_YEAR * year + INSTANCE.getLeapYearsBefore(year)); boolean isLeapYear = INSTANCE.isLeapYear(year); if (doy == (DAYS_IN_YEAR + 1) && !isLeapYear) { year += 1; doy = 1; } if (doy == 0) { year -= 1; doy = DAYS_IN_YEAR + (isLeapYear ? 1 : 0); } return ofYearDay((int) year, (int) doy); }
Source:
public void assignGroupsToResource(PerunSession perunSession, List<Group> groups, Resource resource) throws InternalErrorException, PrivilegeException, GroupNotExistsException, ResourceNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException, GroupAlreadyAssignedException { Utils.checkPerunSession(perunSession); Utils.notNull(groups, "groups"); getResourcesManagerBl().checkResourceExists(perunSession, resource); List<PerunBean> beans = new ArrayList<>(groups); beans.add(resource); if (!AuthzResolver.isAuthorized(perunSession, Role.VOADMIN, resource) && !AuthzResolver.isAuthorized(perunSession, Role.RESOURCEADMIN, resource)) { if (!AuthzResolver.isAuthorized(perunSession, Role.RESOURCESELFSERVICE, resource)) { throw new PrivilegeException(perunSession, "assignGroupsToResource"); } for (Group group : groups) { if (!AuthzResolver.isAuthorized(perunSession, Role.GROUPADMIN, group)) { throw new PrivilegeException(perunSession, "assignGroupsToResource"); } } } for(Group g: groups) { getPerunBl().getGroupsManagerBl().checkGroupExists(perunSession, g); } getResourcesManagerBl().assignGroupsToResource(perunSession, groups, resource); }

Target:
public void assignGroupsToResource(PerunSession perunSession, List<Group> groups, Resource resource) throws InternalErrorException, PrivilegeException, GroupNotExistsException, ResourceNotExistsException, WrongAttributeValueException, WrongReferenceAttributeValueException, GroupAlreadyAssignedException { Utils.checkPerunSession(perunSession); Utils.notNull(groups, "groups"); getResourcesManagerBl().checkResourceExists(perunSession, resource); if (!AuthzResolver.isAuthorized(perunSession, Role.VOADMIN, resource) && !AuthzResolver.isAuthorized(perunSession, Role.RESOURCEADMIN, resource)) { if (!AuthzResolver.isAuthorized(perunSession, Role.RESOURCESELFSERVICE, resource)) { throw new PrivilegeException(perunSession, "assignGroupsToResource"); } for (Group group : groups) { if (!AuthzResolver.isAuthorized(perunSession, Role.GROUPADMIN, group)) { throw new PrivilegeException(perunSession, "assignGroupsToResource"); } } } for(Group g: groups) { getPerunBl().getGroupsManagerBl().checkGroupExists(perunSession, g); } getResourcesManagerBl().assignGroupsToResource(perunSession, groups, resource); }
Source:
static StringBuilder stringify(String cls, ConstructorOrMethod method) { StringBuilder result = new StringBuilder(cls).append(".").append(method.getName()).append("("); return result.append(method.stringifyParameterTypes()); }

Target:
static StringBuilder stringify(String cls, ConstructorOrMethod method) { StringBuilder result = new StringBuilder(cls).append(".").append(method.getName()).append("("); return result.append(method.stringifyParameterTypes()).append(")"); }
Source:
public RqWithHeaders(final Request req, final Iterable<? extends CharSequence> headers) { super( new RqOf( () -> { final List<String> head = new LinkedList<>(); for (final String hdr : req.head()) { head.add(hdr); } for (final CharSequence header : headers) { head.add(header.toString().trim()); } return head; }, req::body ) ); }

Target:
public RqWithHeaders(final Request req, final Iterable<? extends CharSequence> headers) { super( new RequestOf( () -> { final List<String> head = new LinkedList<>(); for (final String hdr : req.head()) { head.add(hdr); } for (final CharSequence header : headers) { head.add(header.toString().trim()); } return head; }, req::body ) ); }
Source:
public File getTargetFile() { return new File(String.format(TARGET_FILE_PATTERN, exportPath, destination.toString().toLowerCase(), targetResolution.toString().toLowerCase(Locale.ENGLISH), exportName, format.toString().toLowerCase())); }

Target:
public File getTargetFile() { return new File(String.format(TARGET_FILE_PATTERN, exportPath, destination.getFolderName(), targetResolution.toString().toLowerCase(Locale.ENGLISH), exportName, format.toString().toLowerCase())); }
Source:
public String toString() { return toStringHelper(this) .omitNullValues() .add("filter", filter) .toString(); }

Target:
public String toString() { return toStringHelper(this) .add("filter", filter) .toString(); }
Source:
public Builder preferIPv6(boolean preferIPv6) { this.preferIPv6 = true; return this; }

Target:
public Builder preferIPv6(boolean preferIPv6) { this.preferIPv6 = preferIPv6; return this; }
Source:
public boolean onCreateOptionsMenu(Menu menu) { boolean retval = mapBase.onCreateOptionsMenu(menu); Resources res = this.getResources(); SubMenu subMenuSelectSource = menu.addSubMenu(Menu.NONE, selectMapSourceMenuId, Menu.NONE, res.getString(R.string.map_file_select_title)); subMenuSelectSource.setHeaderTitle(res.getString(R.string.map_file_select_title)); try { ArrayList<String> mapDatabaseList = mapBase.getMapView().getMapDatabaseList(); if (mapDatabaseList.size() > 0) { for (int i = 0; i < mapDatabaseList.size(); i++) { MenuItem itm = subMenuSelectSource.add(AbstractMap.MENU_MAP_SPECIFIC_MIN , AbstractMap.MENU_MAP_SPECIFIC_MIN + i + 1 , Menu.NONE , mapDatabaseList.get(i)); itm.setCheckable(true); itm.setChecked((new File(mapBase.getMapView().getCurrentMapDatabase())).getName().equals(mapDatabaseList.get(i))); } subMenuSelectSource.setGroupCheckable(AbstractMap.MENU_MAP_SPECIFIC_MIN, true, true); } } catch (Exception e) { Log.e("MapforgeMapActivity.onCreateOptionsMenu: " + e); } return retval; }

Target:
public boolean onCreateOptionsMenu(Menu menu) { boolean retval = mapBase.onCreateOptionsMenu(menu); Resources res = this.getResources(); SubMenu subMenuSelectSource = menu.addSubMenu(Menu.NONE, selectMapSourceMenuId, Menu.NONE, res.getString(R.string.map_file_select_title)); subMenuSelectSource.setHeaderTitle(res.getString(R.string.map_file_select_title)); try { ArrayList<String> mapDatabaseList = mapBase.getMapView().getMapDatabaseList(); if (mapDatabaseList.size() > 0) { for (int i = 0; i < mapDatabaseList.size(); i++) { String mapDatabase = mapDatabaseList.get(i); MenuItem itm = subMenuSelectSource.add(AbstractMap.MENU_MAP_SPECIFIC_MIN , AbstractMap.MENU_MAP_SPECIFIC_MIN + i + 1 , Menu.NONE , mapDatabase); itm.setCheckable(true); itm.setChecked((new File(mapBase.getMapView().getCurrentMapDatabase())).getName().equals(mapDatabase)); } subMenuSelectSource.setGroupCheckable(AbstractMap.MENU_MAP_SPECIFIC_MIN, true, true); } } catch (Exception e) { Log.e("MapforgeMapActivity.onCreateOptionsMenu: " + e); } return retval; }
Source:
JGitConnection(Repository repository, CredentialsLoader credentialsLoader, SshKeyProvider sshKeyProvider, GitUserResolver userResolver) { this.repository = repository; this.credentialsLoader = credentialsLoader; this.sshKeyProvider = sshKeyProvider; this.userResolver = userResolver; this.proxyAuthenticator = new ProxyAuthenticator(); }

Target:
JGitConnection(Repository repository, CredentialsLoader credentialsLoader, SshKeyProvider sshKeyProvider, GitUserResolver userResolver) { this.repository = repository; this.credentialsLoader = credentialsLoader; this.sshKeyProvider = sshKeyProvider; this.userResolver = userResolver; }
Source:
public void testJpaMessageHandlerParser() throws Exception { setUp("JpaMessageHandlerParserTests.xml", getClass()); final AbstractMessageChannel inputChannel = TestUtils.getPropertyValue(this.consumer, "inputChannel", AbstractMessageChannel.class); assertEquals("target", inputChannel.getComponentName()); final JpaExecutor jpaExecutor = TestUtils.getPropertyValue(this.consumer, "handler.jpaExecutor", JpaExecutor.class); assertNotNull(jpaExecutor); final String query = TestUtils.getPropertyValue(jpaExecutor, "jpaQuery", String.class); assertEquals("from Student", query); final JpaOperations jpaOperations = TestUtils.getPropertyValue(jpaExecutor, "jpaOperations", JpaOperations.class); assertNotNull(jpaOperations); final PersistMode persistMode = TestUtils.getPropertyValue(jpaExecutor, "persistMode", PersistMode.class); assertEquals(PersistMode.PERSIST, persistMode); @SuppressWarnings("unchecked") List<JpaParameter> jpaParameters = TestUtils.getPropertyValue(jpaExecutor, "jpaParameters", List.class); assertNotNull(jpaParameters); assertTrue(jpaParameters.size() == 3); assertEquals(new Integer(10), TestUtils.getPropertyValue(jpaExecutor, "flushSize", Integer.class)); assertTrue(TestUtils.getPropertyValue(jpaExecutor, "cleanOnFlush", Boolean.class)); }

Target:
public void testJpaMessageHandlerParser() throws Exception { setUp("JpaMessageHandlerParserTests.xml", getClass()); final AbstractMessageChannel inputChannel = TestUtils.getPropertyValue(this.consumer, "inputChannel", AbstractMessageChannel.class); assertEquals("target", inputChannel.getComponentName()); final JpaExecutor jpaExecutor = TestUtils.getPropertyValue(this.consumer, "handler.jpaExecutor", JpaExecutor.class); assertNotNull(jpaExecutor); final String query = TestUtils.getPropertyValue(jpaExecutor, "jpaQuery", String.class); assertEquals("from Student", query); final JpaOperations jpaOperations = TestUtils.getPropertyValue(jpaExecutor, "jpaOperations", JpaOperations.class); assertNotNull(jpaOperations); final PersistMode persistMode = TestUtils.getPropertyValue(jpaExecutor, "persistMode", PersistMode.class); assertEquals(PersistMode.PERSIST, persistMode); @SuppressWarnings("unchecked") List<JpaParameter> jpaParameters = TestUtils.getPropertyValue(jpaExecutor, "jpaParameters", List.class); assertNotNull(jpaParameters); assertTrue(jpaParameters.size() == 3); assertEquals(Integer.valueOf(10), TestUtils.getPropertyValue(jpaExecutor, "flushSize", Integer.class)); assertTrue(TestUtils.getPropertyValue(jpaExecutor, "clearOnFlush", Boolean.class)); }
Source:
public static ImageDescriptor getImage(String value, Bundle definingBundle) { URL url = getUrl(value, definingBundle); return url == null ? null : ImageDescriptor.createFromURL(url); }

Target:
protected static Optional<ImageDescriptor> getImage(String value, Bundle definingBundle) { Optional<URL> url = getUrl(value, definingBundle); ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(url.get()); return url.isPresent() ? Optional.of(imageDescriptor) : Optional.empty(); }
Source:
public void search() { WikiBasePageObject base = new WikiBasePageObject(driver); base.openMainPage(wikiURL); NavigationBar navbar = new NavigationBar(driver); navbar.executeScript(ClickTrackingScriptsProvider.REDIRECT_BLOCK); navbar.executeScript(ClickTrackingScriptsProvider.TRACKER_INSTALLATION); navbar.typeQuery(SearchContent.SEARCH_ARTICLE); navbar.clickEnterToSearch(); navbar.dismissPopupWindow(); navbar.typeQuery(SearchContent.SEARCH_ARTICLE); navbar.clickSearchButton(); navbar.dismissPopupWindow(); navbar.triggerSuggestions(SearchContent.SEARCH_SUGGESTION_PHRASE); navbar.verifySuggestions(SearchContent.SEARCH_ARTICLE); navbar.ArrowDownAndEnterSuggestion(SearchContent.SEARCH_ARTICLE); navbar.dismissPopupWindow(); navbar.clickSearchButton(); navbar.dismissPopupWindow(); navbar.triggerSuggestions(SearchContent.SEARCH_SUGGESTION_PHRASE); navbar.verifySuggestions(SearchContent.SEARCH_ARTICLE); navbar.clickSuggestion(SearchContent.SEARCH_ARTICLE); navbar.dismissPopupWindow(); navbar.clickEnterToSearch(); navbar.dismissPopupWindow(); List<JsonObject> expectedEvents = Arrays.asList( EventsGlobalNavigation.searchButtonClick, EventsGlobalNavigation.searchEnter, EventsGlobalNavigation.searchSuggestShow, EventsGlobalNavigation.searchSuggestionEnter, EventsGlobalNavigation.searchAfterSuggestionEnter, EventsGlobalNavigation.searchAfterSuggestionButtonClick ); navbar.compareTrackedEventsTo(expectedEvents); }

Target:
public void search() { WikiBasePageObject base = new WikiBasePageObject(driver); base.openMainPage(wikiURL); NavigationBar navbar = new NavigationBar(driver); navbar.executeScript(ClickTrackingScriptsProvider.REDIRECT_BLOCK); navbar.executeScript(ClickTrackingScriptsProvider.TRACKER_INSTALLATION); navbar.triggerSuggestions(SearchContent.SEARCH_SUGGESTION_PHRASE); navbar.verifySuggestions(SearchContent.SEARCH_ARTICLE); navbar.ArrowDownAndEnterSuggestion(SearchContent.SEARCH_ARTICLE); AlertHandler.dismissPopupWindow(driver); navbar.clickSearchButton(); AlertHandler.dismissPopupWindow(driver); navbar.triggerSuggestions(SearchContent.SEARCH_SUGGESTION_PHRASE); navbar.verifySuggestions(SearchContent.SEARCH_ARTICLE); navbar.clickSuggestion(SearchContent.SEARCH_ARTICLE); AlertHandler.dismissPopupWindow(driver); navbar.clickEnterToSearch(); AlertHandler.dismissPopupWindow(driver); List<JsonObject> expectedEvents = Arrays.asList( EventsGlobalNavigation.searchSuggestShow, EventsGlobalNavigation.searchSuggestionEnter, EventsGlobalNavigation.searchAfterSuggestionEnter, EventsGlobalNavigation.searchAfterSuggestionButtonClick); navbar.compareTrackedEventsTo(expectedEvents); }
Source:
public void update(INetwork network, IPartNetwork partNetwork, PartTarget target, S state) { super.update(network, partNetwork, target, state); IValue lastValue = state.getDisplayValue(); IValue newValue = null; if(state.hasVariable()) { try { IVariable variable = state.getVariable(partNetwork); if(variable != null) { newValue = variable.getValue(); } } catch (EvaluationException e) { state.addGlobalError(new L10NHelpers.UnlocalizedString(e.getLocalizedMessage())); } } if(!ValueHelpers.areValuesEqual(lastValue, newValue)) { onValueChanged(network, partNetwork, target, state, lastValue, newValue); state.onDirty(); if (network != null) { network.getEventBus().post(new VariableContentsUpdatedEvent(network)); } BlockHelpers.markForUpdate(target.getCenter().getPos().getWorld(), target.getCenter().getPos().getBlockPos()); } }

Target:
public void update(INetwork network, IPartNetwork partNetwork, PartTarget target, S state) { super.update(network, partNetwork, target, state); IValue lastValue = state.getDisplayValue(); IValue newValue = null; if(state.hasVariable()) { try { IVariable variable = state.getVariable(partNetwork); if(variable != null) { newValue = variable.getValue(); } } catch (EvaluationException e) { state.addGlobalError(new L10NHelpers.UnlocalizedString(e.getLocalizedMessage())); } } if(!ValueHelpers.areValuesEqual(lastValue, newValue)) { onValueChanged(network, partNetwork, target, state, lastValue, newValue); state.onDirty(); BlockHelpers.markForUpdate(target.getCenter().getPos().getWorld(), target.getCenter().getPos().getBlockPos()); } }