auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void initializeGeoRepActionConfirmation(String title, HelpTag helpTag, String hashName, String forceHelp, String forceLabelText, String commandName, String masterVolumeName, String slaveVolumeName, String slaveHostName, String message) { GlusterVolumeGeoRepActionConfirmationModel cModel; if(getWindow() != null) { if((getWindow() instanceof GlusterVolumeGeoRepActionConfirmationModel)) { cModel = (GlusterVolumeGeoRepActionConfirmationModel) getWindow(); } else { return; } } else { cModel = new GlusterVolumeGeoRepActionConfirmationModel(); cModel.setTitle(title); } cModel.setHelpTag(helpTag); cModel.setHashName(hashName); setWindow(cModel); cModel.initWindow(masterVolumeName, slaveVolumeName, slaveHostName); cModel.setMessage(message); cModel.setForceHelp(forceHelp); cModel.setForceLabel(forceLabelText); List<UICommand> geoRepActionCommands = Arrays.asList(UICommand.createDefaultOkUiCommand(commandName, this), UICommand.createCancelUiCommand("closeWindow", this)); if(cModel.getCommands().size() > 0) { cModel.setCommands(geoRepActionCommands); } else { cModel.getCommands().addAll(geoRepActionCommands); } }

Target:
private void initializeGeoRepActionConfirmation(String title, HelpTag helpTag, String hashName, String forceHelp, String forceLabelText, String commandName, String masterVolumeName, String slaveVolumeName, String slaveHostName, String message) { GlusterVolumeGeoRepActionConfirmationModel cModel; if(getWindow() != null) { if((getWindow() instanceof GlusterVolumeGeoRepActionConfirmationModel)) { cModel = (GlusterVolumeGeoRepActionConfirmationModel) getWindow(); } else { return; } } else { cModel = new GlusterVolumeGeoRepActionConfirmationModel(); cModel.setTitle(title); } cModel.setHelpTag(helpTag); cModel.setHashName(hashName); setWindow(cModel); cModel.initWindow(masterVolumeName, slaveVolumeName, slaveHostName); cModel.setActionConfirmationMessage(message); cModel.setForceHelp(forceHelp); cModel.setForceLabel(forceLabelText); List<UICommand> geoRepActionCommands = Arrays.asList(UICommand.createDefaultOkUiCommand(commandName, this), UICommand.createCancelUiCommand("closeWindow", this)); if(cModel.getCommands().size() > 0) { cModel.setCommands(geoRepActionCommands); } else { cModel.getCommands().addAll(geoRepActionCommands); } }
Source:
public void clearInput() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { chkNumberFrom.setSelection(false); chkNumberTo.setSelection(false); chkTimeFrom.setSelection(false); chkTimeTo.setSelection(false); txtSearchRBNumber.setText(""); txtSearchTitle.setText(""); txtSearchUsers.setText(""); spinnerFromNumber.setSelection(0); spinnerToNumber.setSelection(0); spinnerFromNumber.setEnabled(false); spinnerToNumber.setEnabled(false); Calendar cal = Calendar.getInstance(); dtFromDate.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); dtToDate.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); dtFromTime.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND)); dtToTime.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND)); dtFromDate.setEnabled(false); dtToDate.setEnabled(false); dtFromTime.setEnabled(false); dtToTime.setEnabled(false); } }); }

Target:
public void clearInput() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { chkNumberFrom.setSelection(false); chkNumberTo.setSelection(false); chkTimeFrom.setSelection(false); chkTimeTo.setSelection(false); textSearchBox.setText(""); spinnerFromNumber.setSelection(0); spinnerToNumber.setSelection(0); spinnerFromNumber.setEnabled(false); spinnerToNumber.setEnabled(false); Calendar cal = Calendar.getInstance(); dtFromDate.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); dtToDate.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); dtFromTime.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND)); dtToTime.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND)); dtFromDate.setEnabled(false); dtToDate.setEnabled(false); dtFromTime.setEnabled(false); dtToTime.setEnabled(false); } }); }
Source:
public BooleanWrapper defineNodeSource(String nodeSourceName, String infrastructureType, Object[] infraParams, String policyType, Object[] policyParams, boolean nodesRecoverable) { if (nodeSourceName == null) { throw new IllegalArgumentException("Node Source name cannot be null"); } logger.info("Define a node source : " + nodeSourceName); nodeSourceName = nodeSourceName.trim(); NodeSourceData persistedNodeSource = new NodeSourceData(nodeSourceName, infrastructureType, infraParams, policyType, policyParams, caller, nodesRecoverable, NodeSourceStatus.NODES_UNDEPLOYED); boolean added = dbManager.addNodeSource(persistedNodeSource); try { validateNodeSourceNameOrFail(nodeSourceName); createNotActiveNodeSource(persistedNodeSource); return new BooleanWrapper(true); } catch (NodeSourceNameAlreadyExistException e) { logger.error(e.getMessage(), e); throw e; } catch (RuntimeException ex) { logger.error(ex.getMessage(), ex); if (added) { dbManager.removeNodeSource(nodeSourceName); } throw ex; } }

Target:
public BooleanWrapper defineNodeSource(String nodeSourceName, String infrastructureType, Object[] infraParams, String policyType, Object[] policyParams, boolean nodesRecoverable) { if (nodeSourceName == null) { throw new IllegalArgumentException("Node Source name cannot be null"); } List<Serializable> serializableInfraParams = getSerializableParamsOrFail(nodeSourceName, infraParams); List<Serializable> serializablePolicyParams = getSerializableParamsOrFail(nodeSourceName, policyParams); logger.info("Define a node source : " + nodeSourceName); nodeSourceName = nodeSourceName.trim(); NodeSourceData persistedNodeSource = new NodeSourceData(nodeSourceName, infrastructureType, serializableInfraParams, policyType, serializablePolicyParams, caller, nodesRecoverable, NodeSourceStatus.NODES_UNDEPLOYED); boolean added = dbManager.addNodeSource(persistedNodeSource); if (!added) { return new BooleanWrapper(false); } else { return validateAndPrepareNodeSource(nodeSourceName, persistedNodeSource, added); } }
Source:
private void loadConfig(Map<String, String> config) { KieServerConfig kieConfig = new KieServerConfig(); kieConfig.setHost(config.get(HOST)); kieConfig.setPort(Integer.valueOf(config.get(PORT))); kieConfig.setContextRoot(config.get(CONTEXT_ROOT)); kieConfig.setProtocol(config.get(PROTOCOL)); kieConfig.setPath(config.get(PATH)); CredentialsProvider credentialsProvider = new EnteredCredentialsProvider(config.get(USERNAME), config.get(PASSWORD)); kieConfig.setCredentialsProvider(credentialsProvider); KieServicesClient kieServicesClient = createKieServicesClient(kieConfig); kieConfig.setId(kieServicesClient.getServerInfo().getResult().getServerId()); configs.put(kieConfig.getId(), kieConfig); kieServices.put(kieConfig.getId(), kieServicesClient); logger.info("Loaded kie server configuration: {}", kieConfig.getId()); }

Target:
private void loadConfig(Map<String, String> config) { KieServerConfig kieConfig = new KieServerConfig(); kieConfig.setHost(config.get(HOST)); CredentialsProvider credentialsProvider = new EnteredCredentialsProvider(config.get(USERNAME), config.get(PASSWORD)); kieConfig.setCredentialsProvider(credentialsProvider); try { KieServicesClient kieServicesClient = createKieServicesClient(kieConfig); kieConfig.setId(kieServicesClient.getServerInfo().getResult().getServerId()); configs.put(kieConfig.getId(), kieConfig); kieServices.put(kieConfig.getId(), kieServicesClient); logger.info("Loaded kie server configuration: {}", kieConfig.getId()); } catch (Exception e) { logger.warn("Unable to add KieServer: " + config.toString(), e); } }
Source:
private static Set<Object> getSelectionContents( @NonNull IStructuredSelection selection) { Set<Object> result = new HashSet<>(); for (Object o : selection.toList()) { IResource resource = AdapterUtils.adapt(o, IResource.class); if (resource != null) { result.add(resource); continue; } ResourceMapping mapping = AdapterUtils.adapt(o, ResourceMapping.class); if (mapping != null) { result.addAll(extractResourcesFromMapping(mapping)); } else { IPath location = AdapterUtils.adapt(o, IPath.class); if (location != null) { result.add(location); } } } return result; }

Target:
private static Set<Object> getSelectionContents( @NonNull IStructuredSelection selection) { Set<Object> result = new HashSet<>(); for (Object o : selection.toList()) { ResourceMapping mapping = AdapterUtils.adapt(o, ResourceMapping.class); if (mapping != null) { result.addAll(extractResourcesFromMapping(mapping)); } else { IResource resource = AdapterUtils.adapt(o, IResource.class); if (resource != null) { result.add(resource); } else { IPath location = AdapterUtils.adapt(o, IPath.class); if (location != null) { result.add(location); } } } } return result; }
Source:
public IpTypeCatalog getCatalog() { return new InMemoryIpTypeCatalog(new HashMap<String, Integer>() {{ put(NOT_AVAILABLE.name(), 0); put(PUBLIC.name(), 1); put(PORT_RESTRICTED.name(), 2); put(SINGLE_NAT_PRIVATE.name(), 3); put(UNKNOWN.name(), 7); }}); }

Target:
public IpTypeCatalog getCatalog() { return new InMemoryIpTypeCatalog(new LinkedHashMap<String, Integer>() {{ put(NOT_AVAILABLE.name(), 0); put(PUBLIC.name(), 1); put(PORT_RESTRICTED.name(), 2); put(SINGLE_NAT_PRIVATE.name(), 3); put(UNKNOWN.name(), 7); }}); }
Source:
public EventHubClientBuilder connectionString(String connectionString, String eventHubName) { if (ImplUtils.isNullOrEmpty(eventHubName)) { throw new IllegalArgumentException("'eventHubName' cannot be null or empty"); } final ConnectionStringProperties properties = new ConnectionStringProperties(connectionString); final TokenCredential tokenCredential; try { tokenCredential = new EventHubSharedAccessKeyCredential(properties.sharedAccessKeyName(), properties.sharedAccessKey(), ClientConstants.TOKEN_VALIDITY); } catch (InvalidKeyException | NoSuchAlgorithmException e) { throw new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e); } if (!ImplUtils.isNullOrEmpty(properties.eventHubName())) { throw new IllegalArgumentException(String.format(Locale.US, "'connectionString' contains an Event Hub path [%s]. Please use the" + " credentials(String connectionString) overload. Or supply a 'connectionString' without" + " 'EntityPath' in it.", properties.eventHubName())); } return credential(properties.endpoint().getHost(), eventHubName, tokenCredential); }

Target:
public EventHubClientBuilder connectionString(String connectionString, String eventHubName) { if (ImplUtils.isNullOrEmpty(eventHubName)) { throw new IllegalArgumentException("'eventHubName' cannot be null or empty"); } final ConnectionStringProperties properties = new ConnectionStringProperties(connectionString); final TokenCredential tokenCredential; try { tokenCredential = new EventHubSharedAccessKeyCredential(properties.sharedAccessKeyName(), properties.sharedAccessKey(), ClientConstants.TOKEN_VALIDITY); } catch (InvalidKeyException | NoSuchAlgorithmException e) { throw new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e); } if (!ImplUtils.isNullOrEmpty(properties.eventHubName())) { throw new IllegalArgumentException(String.format(Locale.US, "'connectionString' contains an Event Hub name [%s]. Please use the" + " credentials(String connectionString) overload. Or supply a 'connectionString' without" + " 'EntityPath' in it.", properties.eventHubName())); } return credential(properties.endpoint().getHost(), eventHubName, tokenCredential); }
Source:
PropertyCascadable(Property property, CascadingMetaData cascadingMetaData) { this.property = property; this.cascadableType = property.getType(); this.cascadingMetaData = cascadingMetaData; this.elementType = property.getKind() == Property.Kind.FIELD ? ElementType.FIELD : ElementType.METHOD; }

Target:
PropertyCascadable(Property property, CascadingMetaData cascadingMetaData) { this.property = property; this.cascadableType = property.getType(); this.cascadingMetaData = cascadingMetaData; this.elementType = property instanceof JavaBeanField ? ElementType.FIELD : ElementType.METHOD; }
Source:
public List<String> getAliasesForCluster(final String clusterName) throws AliasServiceException { return remoteClient == null ? new ArrayList<>() : remoteClient.listChildEntries(buildClusterEntryName(clusterName)); }

Target:
public List<String> getAliasesForCluster(final String clusterName) throws AliasServiceException { final List<String> localAliases = localAliasService.getAliasesForCluster(clusterName); if (localAliases == null || localAliases.isEmpty()) { return remoteClient == null ? new ArrayList<>() : remoteClient.listChildEntries(buildClusterEntryName(clusterName)); } else { return localAliases; } }
Source:
public SpoutEntity(Engine engine, Transform transform, UUID uid, boolean load, byte[] dataMap, Class<? extends Component>... components) { if (transform == null) { throw new IllegalArgumentException("Entities must always have a valid transform"); } id.set(NOTSPAWNEDID); this.engine = engine; observer.set(NOT_OBSERVING); physics = (SpoutPhysicsComponent) add(PhysicsComponent.class); if (!(this instanceof Player)) { network = add(NetworkComponent.class); } else { network = null; } if (uid != null) { this.uid = uid; } else { this.uid = UUID.randomUUID(); } physics.setTransform(transform, false); if (components != null && components.length > 0) { initialComponents = components; } if (dataMap != null) { try { this.getData().deserialize(dataMap); } catch (IOException e) { engine.getLogger().log(Level.SEVERE, "Unable to deserialize entity data", e); } } setupInitialChunk(load == true ? LoadOption.LOAD_GEN : LoadOption.NO_LOAD); }

Target:
public SpoutEntity(Engine engine, Transform transform, UUID uid, boolean load, byte[] dataMap, Class<? extends Component>... components) { if (transform == null) { throw new IllegalArgumentException("Entities must always have a valid transform"); } id.set(NOTSPAWNEDID); this.engine = engine; observer.set(NOT_OBSERVING); physics = (SpoutPhysicsComponent) add(PhysicsComponent.class); network = add(NetworkComponent.class); if (uid != null) { this.uid = uid; } else { this.uid = UUID.randomUUID(); } physics.setTransform(transform, false); if (components != null && components.length > 0) { initialComponents = components; } if (dataMap != null) { try { this.getData().deserialize(dataMap); } catch (IOException e) { engine.getLogger().log(Level.SEVERE, "Unable to deserialize entity data", e); } } setupInitialChunk(load == true ? LoadOption.LOAD_GEN : LoadOption.NO_LOAD); }
Source:
public void testConvertAdHocSubprocessNode_autostart() throws Exception { final AdHocSubprocess definition = new AdHocSubprocess(); definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(true)); final View<BaseAdHocSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseAdHocSubprocess>, ?> node = new NodeImpl<>(UUID.randomUUID().toString()); node.setContent(view); SubProcessPropertyWriter writer = tested.convertAdHocSubprocessNode(node); assertTrue(AdHocSubProcessPropertyWriter.class.isInstance(writer)); assertTrue(CustomElement.autoStart.of(writer.getFlowElement()).get()); }

Target:
public void testConvertAdHocSubprocessNode_autostart() { final AdHocSubprocess definition = new AdHocSubprocess(); definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(true)); final View<BaseAdHocSubprocess> view = new ViewImpl<>(definition, Bounds.create()); final Node<View<BaseAdHocSubprocess>, ?> node = new NodeImpl<>(UUID.randomUUID().toString()); node.setContent(view); SubProcessPropertyWriter writer = tested.convertAdHocSubprocessNode(node); assertTrue(AdHocSubProcessPropertyWriter.class.isInstance(writer)); assertTrue(CustomElement.autoStart.of(writer.getFlowElement()).get()); }
Source:
public static String md5string(String s) { StringBuffer hexStr = new StringBuffer(); try { MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(s.getBytes()); byte[] messageDigest = digest.digest(); for (int i=0; i<messageDigest.length; i++) hexStr.append(Integer.toHexString(0xFF & messageDigest[i])); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return hexStr.toString(); }

Target:
public static String md5string(String s) { StringBuilder hexStr = new StringBuilder(); try { MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(s.getBytes("utf-8")); byte[] messageDigest = digest.digest(); for (byte b : messageDigest) { hexStr.append(Integer.toHexString(0xFF & b)); } } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } return hexStr.toString(); }
Source:
public String toString() { return "ImmutableDruidDataSource{" + "name='" + name + "', segments='" + idToSegments.values() + "', properties='" + properties + "'}"; }

Target:
public String toString() { return "ImmutableDruidDataSource{" + "name='" + name + "', # of segments='" + idToSegments.size() + "', properties='" + properties + "'}"; }
Source:
private int backoffSleep(int failedCount) { try { Thread.sleep(1000 * failedCount++); if (failedCount > 10) failedCount = 1; } catch (InterruptedException e) { rateLimitedLog(Level.ERROR, e, "Interrupted sleep when checkpointing."); } return failedCount; }

Target:
private void backoffSleep(int failedCount) { try { Thread.sleep(200 * failedCount); } catch (InterruptedException e) { rateLimitedLog(Level.WARN, e, "Interrupted sleep when checkpointing."); } }
Source:
boolean isExpandAllowed() { StagingViewContentProvider contentProvider = getContentProvider( stagedViewer); if (contentProvider.getCount() > getMaxLimitForListMode()) { return false; } contentProvider = getContentProvider(unstagedViewer); if (contentProvider.getCount() > getMaxLimitForListMode()) { return false; } return true; }

Target:
private boolean isExpandAllowed() { StagingViewContentProvider contentProvider = getContentProvider( stagedViewer); if (contentProvider.getCount() > getMaxLimitForListMode()) { return false; } contentProvider = getContentProvider(unstagedViewer); if (contentProvider.getCount() > getMaxLimitForListMode()) { return false; } return true; }
Source:
public void testEmptyQuery() throws ErrnoException { for (Network network : getTestableNetworks()) { CountDownLatch latch = new CountDownLatch(1); final int TIMEOUT_MS = 12_000; final String dname = ""; mDns.query(network, dname, CLASS_IN, TYPE_AAAA, FLAG_NO_CACHE_LOOKUP, mHandler, answer -> { if (answer == null) { return; } try { new DnsRawAnswer(answer); } catch (DnsPacket.ParseException e) { e.getMessage().equals("No available answer"); latch.countDown(); } } ); String msg = "Raw query " + dname + " got unexpected answer " + TIMEOUT_MS + "ms."; try { assertTrue(msg, latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); } catch (InterruptedException e) { } } }

Target:
public void testEmptyQuery() throws ErrnoException { for (Network network : getTestableNetworks()) { CountDownLatch latch = new CountDownLatch(1); final int TIMEOUT_MS = 12_000; final String dname = ""; mDns.query(network, dname, CLASS_IN, TYPE_AAAA, FLAG_NO_CACHE_LOOKUP, mHandler, answer -> { if (answer == null) { fail("Raw Query empty dname(ROOT) no answer returned"); } try { new CheckedDnsPacket(answer); fail("Raw Query empty dname(ROOT) get valid answer"); } catch (DnsPacket.ParseException e) { e.getMessage().equals("No available answer"); latch.countDown(); } } ); String msg = "Raw query empty dname(ROOT) but no answer after " + TIMEOUT_MS + "ms."; try { assertTrue(msg, latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); } catch (InterruptedException e) { } } }
Source:
public CaseInsensitiveDictionaryMap(Dictionary<? extends K, ? extends V> dictionary) { this(initialCapacity(dictionary.size())); Enumeration<? extends K> keys = dictionary.keys(); while (keys.hasMoreElements()) { K key = keys.nextElement(); V value = dictionary.get(key); if (key != null && value != null) { if (put(key, value) != null) { throw new IllegalArgumentException(NLS.bind(Msg.HEADER_DUPLICATE_KEY_EXCEPTION, key)); } } } }

Target:
public CaseInsensitiveDictionaryMap(Dictionary<? extends K, ? extends V> dictionary) { this(initialCapacity(dictionary.size())); Enumeration<? extends K> keys = dictionary.keys(); while (keys.hasMoreElements()) { K key = keys.nextElement(); if (key != null) { V value = dictionary.get(key); if (value != null) { if (put(key, value) != null) { throw new IllegalArgumentException(NLS.bind(Msg.HEADER_DUPLICATE_KEY_EXCEPTION, key)); } } } } }
Source:
public RawPacket transform(RawPacket pkt) { if (extensionID != -1) { RawPacket.HeaderExtension ext = pkt.getHeaderExtension((byte) extensionID); if (ext == null) { ext = pkt.addExtension((byte) extensionID, 3); } setTimestamp(ext.getBuffer(), ext.getOffset() + 1); } return pkt; }

Target:
public RawPacket transform(RawPacket pkt) { if (extensionID != -1) { RawPacket.HeaderExtension ext = pkt.getHeaderExtension((byte) extensionID); if (ext == null) { ext = pkt.addExtension((byte) extensionID, EXT_LENGTH); } setTimestamp(ext.getBuffer(), ext.getOffset() + 1); } return pkt; }
Source:
public static int getLastItemPositionOnSameRow(View view, RecyclerView parent) { GridLayoutManager layoutManager = ((GridLayoutManager) parent.getLayoutManager()); GridLayoutManager.SpanSizeLookup spanSizeLookup = layoutManager.getSpanSizeLookup(); int spanCount = layoutManager.getSpanCount(); int itemCount = parent.getAdapter().getItemCount(); int currentChildPosition = parent.getChildAdapterPosition(view); int spanSum = getSpanIndex(view) + spanSizeLookup.getSpanSize(currentChildPosition); while (currentChildPosition < itemCount && spanSum <= spanCount) { int nextSpanSize = spanSizeLookup.getSpanSize(currentChildPosition + 1); if (spanSum + nextSpanSize > spanCount) { return currentChildPosition; } currentChildPosition++; spanSum += nextSpanSize; } return itemCount - 1; }

Target:
public static int getLastItemPositionOnSameRow(View view, RecyclerView parent) { GridLayoutManager layoutManager = ((GridLayoutManager) parent.getLayoutManager()); GridLayoutManager.SpanSizeLookup spanSizeLookup = layoutManager.getSpanSizeLookup(); int spanCount = layoutManager.getSpanCount(); int lastItemPosition = parent.getAdapter().getItemCount() - 1; int currentChildPosition = parent.getChildAdapterPosition(view); int spanSum = getSpanIndex(view) + spanSizeLookup.getSpanSize(currentChildPosition); while (currentChildPosition <= lastItemPosition && spanSum <= spanCount) { spanSum += spanSizeLookup.getSpanSize(currentChildPosition + 1); if (spanSum > spanCount) { return currentChildPosition; } currentChildPosition++; } return lastItemPosition; }
Source:
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int facing, float par8, float par9, float par10) { if (!world.isRemote) { float value = 0; int blockZ; int blockY; int blockX; switch (facing) { case 0: z = z - 1; x = x - 1; break; case 1: z = z - 1; x = x - 1; break; case 2: y = y - 1; x = x + 1; break; case 3: y = y - 1; x = x - 1; break; case 4: y = y - 1; z = z - 1; break; case 5: y = y - 1; z = z + 1; break; } for (int i = 0; i < 3; i++) { if (facing == 3 || facing == 5) { blockZ = z - i; } else { blockZ = z + i; } for (int o = 0; o < 3; o++) { if (facing == 1) { blockY = y - o; } else { blockY = y + o; } for (int s = 0; s < 3; s++) { if (facing == 2 || facing == 5) { blockX = x - s; } else { blockX = x + s; } Block block = world.getBlock(blockX, blockY, blockZ); LogHelper.info(block.getUnlocalizedName()); if (block != Blocks.air) { List<WrappedStack> get = new ArrayList<WrappedStack>(); get.clear(); get.add(new WrappedStack(block)); value = value + EnergyValueHelper.computeEnergyValueFromList(get).getValue(); } } } } ChatComponentText T = new ChatComponentText("Value = " + String.valueOf((int) value / 27)); entityPlayer.addChatMessage(T); } return super.onItemUse(itemStack, entityPlayer, world, x, z, y, facing, par8, par9, par10); }

Target:
public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int facing, float par8, float par9, float par10) { if (!world.isRemote) { float value = 0; int blockZ; int blockY; int blockX; switch (facing) { case 0: z = z - 1; x = x - 1; break; case 1: z = z - 1; x = x - 1; y = y - 2; break; case 2: y = y - 1; x = x - 1; break; case 3: y = y - 1; x = x - 1; z = z - 2; break; case 4: y = y - 1; z = z - 1; break; case 5: y = y - 1; z = z - 1; x = x - 2; break; } for (int i = 0; i < 3; i++) { blockZ = z + i; for (int o = 0; o < 3; o++) { blockY = y + o; for (int s = 0; s < 3; s++) { blockX = x + s; Block block = world.getBlock(blockX, blockY, blockZ); if (block != Blocks.air) { List<WrappedStack> get = new ArrayList<WrappedStack>(); get.add(new WrappedStack(block)); value = value + EnergyValueHelper.computeEnergyValueFromList(get).getValue(); } } } } ChatComponentText T = new ChatComponentText("Energy Value = " + String.valueOf((int) value / 27)); entityPlayer.addChatMessage(T); } return super.onItemUse(itemStack, entityPlayer, world, x, z, y, facing, par8, par9, par10); }
Source:
public void dispose() { sessionManager.removeSessionLifecycleListener(sessionLifecycleListener); ISarosSession currentSession = session; if (currentSession != null) { currentSession.removeListener(sessionListener); removeSessionNode(currentSession); } sessionNodeList.clear(); userNodeList.clear(); }

Target:
public void dispose() { sessionManager.removeSessionLifecycleListener(sessionLifecycleListener); ISarosSession currentSession = session; if (currentSession != null) { currentSession.removeListener(sessionListener); } }
Source:
public void dispose() { if (!commentPopupDialog.isCommentEditorText() && !commentPopupDialog.getEditable()) { cancelMarkCommentAsReadJob(); commentPopupDialog.dispose(false); commentPopupDialog = null; } }

Target:
public void dispose() { if (!commentPopupDialog.hasEdits()) { cancelMarkCommentAsReadJob(); commentPopupDialog.dispose(false); commentPopupDialog = null; } }
Source:
public boolean equals(Object o) { return o != null && o.getClass() != getClass(); }

Target:
public boolean equals(Object o) { return o != null && o.getClass() == getClass(); }
Source:
public void updateFileMenuButtons(int view) { if (isReadOnly) { return; } if (view == 0) { fileDropDown.setItemEnabled(MESSAGES.deleteProjectButton(), false); fileDropDown.setItemEnabled(MESSAGES.trashProjectMenuItem(), ProjectListBox.getProjectListBox().getProjectList().getMyProjectsCount() == 0); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), ProjectListBox.getProjectListBox().getProjectList().getMyProjectsCount() > 0); fileDropDown.setItemEnabled(MESSAGES.exportProjectMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.saveMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.saveAsMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.checkpointMenuItem(), false); buildDropDown.setItemEnabled(MESSAGES.showBarcodeMenuItem(), false); buildDropDown.setItemEnabled(MESSAGES.downloadToComputerMenuItem(), false); } else { fileDropDown.setItemEnabled(MESSAGES.deleteProjectButton(), true); fileDropDown.setItemEnabled(MESSAGES.trashProjectMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), ProjectListBox.getProjectListBox().getProjectList().getMyProjectsCount() > 0); fileDropDown.setItemEnabled(MESSAGES.exportProjectMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.saveMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.saveAsMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.checkpointMenuItem(), true); buildDropDown.setItemEnabled(MESSAGES.showBarcodeMenuItem(), true); buildDropDown.setItemEnabled(MESSAGES.downloadToComputerMenuItem(), true); } updateKeystoreFileMenuButtons(true); }

Target:
public void updateFileMenuButtons(int view) { if (isReadOnly) { return; } if (view == 0) { fileDropDown.setItemEnabled(MESSAGES.deleteProjectButton(), false); fileDropDown.setItemEnabled(MESSAGES.trashProjectMenuItem(), ProjectListBox.getProjectListBox().getProjectList().getMyProjectsCount() == 0); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), ProjectListBox.getProjectListBox().getProjectList().getMyProjectsCount() > 0); fileDropDown.setItemEnabledById(WIDGET_NAME_EXPORTPROJECT, false); fileDropDown.setItemEnabled(MESSAGES.saveMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.saveAsMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.checkpointMenuItem(), false); buildDropDown.setItemEnabled(MESSAGES.showBarcodeMenuItem(), false); buildDropDown.setItemEnabled(MESSAGES.downloadToComputerMenuItem(), false); } else { fileDropDown.setItemEnabled(MESSAGES.deleteProjectButton(), true); fileDropDown.setItemEnabled(MESSAGES.trashProjectMenuItem(), false); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), ProjectListBox.getProjectListBox().getProjectList().getMyProjectsCount() > 0); fileDropDown.setItemEnabledById(WIDGET_NAME_EXPORTPROJECT, true); fileDropDown.setItemEnabled(MESSAGES.saveMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.saveAsMenuItem(), true); fileDropDown.setItemEnabled(MESSAGES.checkpointMenuItem(), true); buildDropDown.setItemEnabled(MESSAGES.showBarcodeMenuItem(), true); buildDropDown.setItemEnabled(MESSAGES.downloadToComputerMenuItem(), true); } updateKeystoreFileMenuButtons(true); }
Source:
synchronized void waitForClose() { while (stateMachine.getCurrentState().equals(STATE_CLOSING)) { try { wait(); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "InterruptedException while waiting for close to complete", e); } } }

Target:
synchronized void waitForClose() { while (!stateMachine.getCurrentState().equals(STATE_CLOSED)) { try { wait(); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "InterruptedException while waiting for close to complete", e); } } }
Source:
public void shouldCreateMultipleToolsAndAggregationResultWithWarningsAggregateFalse() { FreeStyleProject project = createJobWithWorkspaceFile("checkstyle.xml", "pmd-warnings.xml"); enableWarningsAggregation(project, false, "**/checkstyle-issues.txt", new CheckStyle(), "**/pmd-warnings-issues.txt", new Pmd()); List<AnalysisResult> results = scheduleBuildAndAssertStatusForBothTools(project, Result.SUCCESS); for (AnalysisResult element : results) { if (element.getId().equals("checkstyle")) { assertThat(element.getTotalSize()).isEqualTo(6); } else { assertThat(element.getId()).isEqualTo("pmd"); assertThat(element.getTotalSize()).isEqualTo(4); } assertThat(element).hasOverallResult(Result.SUCCESS); } }

Target:
public void shouldCreateMultipleToolsAndAggregationResultWithWarningsAggregateFalse() { FreeStyleProject project = createJobWithWorkspaceFile("checkstyle.xml", "pmd-warnings.xml"); enableWarningsAggregation(project, false, "**/checkstyle-issues.txt", new CheckStyle(), "**/pmd-warnings-issues.txt", new Pmd()); List<AnalysisResult> results = scheduleBuildAndAssertStatusForBothTools(project, Result.SUCCESS); assertThat(results).hasSize(2); for (AnalysisResult element : results) { if (element.getId().equals("checkstyle")) { assertThat(element).hasTotalSize(6); } else { assertThat(element.getId()).isEqualTo("pmd"); assertThat(element).hasTotalSize(4); } assertThat(element).hasOverallResult(Result.SUCCESS); } }
Source:
private double castToDoubleOrDefault(String value, double defaultValue) { if (value.isEmpty()) { return defaultValue; } if ("-".equals(value)) { return defaultValue; } return Double.parseDouble(value); }

Target:
private double castToDoubleOrDefault(String value, double defaultValue) { if (value.isEmpty() || "-".equals(value)) { return defaultValue; } return Double.parseDouble(value); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent target = null; String deepLinkId = PlusShare.getDeepLinkId(getIntent()); if (!TextUtils.isEmpty(deepLinkId)) { target = parseDeepLinkId(deepLinkId); } else { if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { target = new Intent(); target.setClass(getApplicationContext(), EventActivity.class); target.putExtra(Const.EXTRA_EVENT_ID, getIntent().getData().getLastPathSegment()); target.putExtra(Const.EXTRA_SECTION, EventActivity.EventPagerAdapter.SECTION_OVERVIEW); } } if (target != null) { if (target.resolveActivity(getPackageManager()) != null) { startActivity(target); } } finish(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent target = null; String deepLinkId = PlusShare.getDeepLinkId(getIntent()); if (!TextUtils.isEmpty(deepLinkId)) { target = parseDeepLinkId(deepLinkId); } else { if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { target = new Intent(); target.setClass(getApplicationContext(), EventActivity.class); target.putExtra(Const.EXTRA_EVENT_ID, getIntent().getData().getLastPathSegment()); target.putExtra(Const.EXTRA_SECTION, EventActivity.EventPagerAdapter.SECTION_OVERVIEW); } } if (target != null && target.resolveActivity(getPackageManager()) != null) { startActivity(target); } finish(); }
Source:
public void start() { if(mRunning.compareAndSet(false, true)) { try { StringBuilder sb = new StringBuilder(); sb.append(mFilePrefix); sb.append("_"); sb.append(TimeStamp.getTimeStamp("_")); sb.append(".wav"); String cleaned = StringUtils.replaceIllegalCharacters(sb.toString()); mFile = Paths.get(cleaned); mWriter = new ReusableBufferWaveWriter(mAudioFormat, mFile); mBufferProcessor.setListener(mWriter); mBufferProcessor.start(); } catch(IOException io) { mLog.error("Error starting complex baseband recorder", io); } } }

Target:
public void start() { if(mRunning.compareAndSet(false, true)) { try { StringBuilder sb = new StringBuilder(); sb.append(mFilePrefix); sb.append("_"); sb.append(TimeStamp.getTimeStamp("_")); sb.append(".wav"); mFile = Paths.get(sb.toString()); mWriter = new ReusableBufferWaveWriter(mAudioFormat, mFile); mBufferProcessor.setListener(mWriter); mBufferProcessor.start(); } catch(IOException io) { mLog.error("Error starting complex baseband recorder", io); } } }
Source:
public HttpLoadQueuePeon( String baseUrl, ObjectMapper jsonMapper, HttpClient httpClient, DruidCoordinatorConfig config, ScheduledExecutorService processingExecutor, ExecutorService callBackExecutor ) { this.jsonMapper = jsonMapper; this.httpClient = httpClient; this.config = config; this.processingExecutor = processingExecutor; this.callBackExecutor = callBackExecutor; this.serverId = baseUrl; try { this.changeRequestURL = new URL( new URL(baseUrl), StringUtils.safeFormat( "druid-internal/v1/segments/changeRequests?timeout=%d", config.getHttpLoadQueuePeonHostTimeout().getMillis() ) ); } catch (MalformedURLException ex) { throw Throwables.propagate(ex); } }

Target:
public HttpLoadQueuePeon( String baseUrl, ObjectMapper jsonMapper, HttpClient httpClient, DruidCoordinatorConfig config, ScheduledExecutorService processingExecutor, ExecutorService callBackExecutor ) { this.jsonMapper = jsonMapper; this.requestBodyWriter = jsonMapper.writerWithType(REQUEST_ENTITY_TYPE_REF); this.httpClient = httpClient; this.config = config; this.processingExecutor = processingExecutor; this.callBackExecutor = callBackExecutor; this.serverId = baseUrl; try { this.changeRequestURL = new URL( new URL(baseUrl), StringUtils.safeFormat( "druid-internal/v1/segments/changeRequests?timeout=%d", config.getHttpLoadQueuePeonHostTimeout().getMillis() ) ); } catch (MalformedURLException ex) { throw Throwables.propagate(ex); } }
Source:
public void afterRun() throws Exception { super.afterRun(); if (recordStore.isWanReplicationEnabled()) { for (Data key : keys) { CacheRecord record = recordStore.getRecord(key); wanEventPublisher.publishWanUpdate(name, CacheEntryViews.createEntryView(key, expiryPolicy, record)); } } }

Target:
public void afterRun() throws Exception { super.afterRun(); if (recordStore.isWanReplicationEnabled()) { for (Data key : keys) { CacheRecord record = recordStore.getRecord(key); publishWanUpdate(key, record); } } }
Source:
public void testFailParse() { onView(withId(R.id.brick_set_variable_edit_text)) .perform(click()); onFormulaEditor() .performEnterFormula("1+"); onFormulaEditor() .performCloseAndSave(); onView(withText(R.string.formula_editor_parse_fail)).inRoot(withDecorView(not(baseActivityTestRule.getActivity().getWindow().getDecorView()))) .check(matches(isDisplayed())); }

Target:
public void testFailParse() { onBrickAtPosition(1).onChildView(withId(R.id.brick_set_variable_edit_text)) .perform(click()); onFormulaEditor() .performEnterFormula("1+"); onFormulaEditor() .performCloseAndSave(); UiTestUtils.onToast(withText(R.string.formula_editor_parse_fail)) .check(matches(isDisplayed())); }
Source:
private Producer<String, Set<Statement>> makeProducer(final KafkaParameters params) { requireNonNull(params); final Properties props = new Properties(); props.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, params.bootstrapServers); props.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); props.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StatementsSerializer.class.getName()); return new KafkaProducer<>(props); }

Target:
private static Producer<String, Set<Statement>> makeProducer(final KafkaParameters params) { requireNonNull(params); final Properties props = new Properties(); props.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, params.bootstrapServers); props.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); props.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StatementsSerializer.class.getName()); return new KafkaProducer<>(props); }
Source:
private Bundle metaDataToBundle(Map<String, String> meta){ if(meta.size() == 0) return null; Bundle bundle = new Bundle(); for(Map.Entry<String,String> entry : meta.entrySet()){ if(entry.getValue() == null){ } else if("true".equals(entry.getValue())){ bundle.putBoolean(entry.getKey(), true); } else if("false".equals(entry.getValue())){ bundle.putBoolean(entry.getKey(), false); } else { if(entry.getValue().contains(".")){ try { bundle.putFloat(entry.getKey(), Float.parseFloat(entry.getValue())); } catch (NumberFormatException ef) { } } if(!bundle.containsKey(entry.getKey()) && !entry.getValue().startsWith("#")){ try { bundle.putInt(entry.getKey(), Integer.parseInt(entry.getValue())); } catch (NumberFormatException ei) { } } if(!bundle.containsKey(entry.getKey())){ try { bundle.putInt(entry.getKey(), Color.parseColor(entry.getValue())); } catch (IllegalArgumentException e) { } } if(!bundle.containsKey(entry.getKey())){ bundle.putString(entry.getKey(), entry.getValue()); } } } return bundle; }

Target:
private Bundle metaDataToBundle(Map<String, String> meta) { if (meta.size() == 0) { return null; } Bundle bundle = new Bundle(); for (Map.Entry<String,String> entry : meta.entrySet()) { if (entry.getValue() == null) { } else if ("true".equals(entry.getValue())) { bundle.putBoolean(entry.getKey(), true); } else if ("false".equals(entry.getValue())) { bundle.putBoolean(entry.getKey(), false); } else { if (entry.getValue().contains(".")) { try { bundle.putFloat(entry.getKey(), Float.parseFloat(entry.getValue())); } catch (NumberFormatException ef) { } } if (!bundle.containsKey(entry.getKey()) && !entry.getValue().startsWith("#")) { try { bundle.putInt(entry.getKey(), Integer.parseInt(entry.getValue())); } catch (NumberFormatException ei) { } } if (!bundle.containsKey(entry.getKey())) { try { bundle.putInt(entry.getKey(), Color.parseColor(entry.getValue())); } catch (IllegalArgumentException e) { } } if (!bundle.containsKey(entry.getKey())) { bundle.putString(entry.getKey(), entry.getValue()); } } } return bundle; }
Source:
public void test() throws IOException { AntJPADomainExporter exporter = new AntJPADomainExporter(); exporter.setNamePrefix("Q"); exporter.setNameSuffix(""); exporter.setTargetFolder(folder.getRoot().getAbsolutePath()); exporter.setPersistenceUnitName("h2"); exporter.execute(); File origRoot = new File("../querydsl-jpa/target/generated-test-sources/java"); Set<File> files = exporter.getGeneratedFiles(); assertFalse(files.isEmpty()); for (File file : files) { String path = file.getAbsolutePath().replace( folder.getRoot().getAbsolutePath(), origRoot.getAbsolutePath()); String reference = Files.toString(new File(path), Charsets.UTF_8); String content = Files.toString(file, Charsets.UTF_8); assertEquals(file.getPath(), reference, content); } }

Target:
public void test() throws IOException { AntJPADomainExporter exporter = new AntJPADomainExporter(); exporter.setNamePrefix("Q"); exporter.setNameSuffix(""); Path outputFolder = folder.getRoot().toPath(); exporter.setTargetFolder(outputFolder.toFile().getAbsolutePath()); exporter.setPersistenceUnitName("h2"); exporter.execute(); File origRoot = new File("../querydsl-jpa/target/generated-test-sources/java"); Set<File> files = exporter.getGeneratedFiles(); assertFalse(files.isEmpty()); for (File file : files) { Path relativeFile = outputFolder.relativize(file.toPath()); Path origFile = origRoot.toPath().resolve(relativeFile); String reference = Files.toString(origFile.toFile(), Charsets.UTF_8); String content = Files.toString(file, Charsets.UTF_8); errors.checkThat("Mismatch for " + file.getPath(), content, is(equalTo(reference))); } }
Source:
public Channel retrieve(VeluxBridge bridge) { logger.trace("retrieve() called."); logger.trace("retrieve() About to query device status."); GetDeviceStatus bcp = bridge.bridgeAPI().getDeviceStatus(); if ((bridge.bridgeCommunicate(bcp)) && (bcp.isCommunicationSuccessful())) { VeluxGwState state = bcp.getState(); this.channel.gwState = new StringType(state.toString()); this.channel.gwStateDescription = new StringType(state.toDescription()); this.channel.isRetrieved = true; logger.trace("retrieve() finished successfully with result {}.", state.toDescription()); return channel; } else { logger.trace("retrieve() finished with failure."); return null; } }

Target:
public Channel retrieve(VeluxBridge bridge) { logger.trace("retrieve() called. About to query device status."); GetDeviceStatus bcp = bridge.bridgeAPI().getDeviceStatus(); if (bridge.bridgeCommunicate(bcp) && bcp.isCommunicationSuccessful()) { VeluxGwState state = bcp.getState(); this.channel.gwState = new StringType(state.toString()); this.channel.gwStateDescription = new StringType(state.toDescription()); this.channel.isRetrieved = true; logger.trace("retrieve() finished successfully with result {}.", state.toDescription()); return channel; } else { logger.trace("retrieve() finished with failure."); return null; } }
Source:
public void execute(StartProcessInstanceCmd cmd) { ProcessInstance processInstance = processEngine.startProcess(cmd); StartProcessInstanceResults cmdResult = new StartProcessInstanceResults(cmd.getId(), processInstance.getId()); commandResults.send(MessageBuilder.withPayload(cmdResult).build()); }

Target:
public void execute(StartProcessInstanceCmd cmd) { ProcessInstance processInstance = processEngine.startProcess(cmd); if(processInstance != null) { StartProcessInstanceResults cmdResult = new StartProcessInstanceResults(cmd.getId(), processInstance.getId()); commandResults.send(MessageBuilder.withPayload(cmdResult).build()); }else{ throw new IllegalStateException("Failed to start processInstance"); } }
Source:
public String getText(Mode mode) { if (staticText != null && !staticText.isEmpty()) { return staticText; } StringBuilder sb = new StringBuilder(); if (mode.getTargets().isEmpty()) { return ""; } sb.append("target ").append(mode.getTargets().get(0).getTargetName()); sb.append(" creates "); if (amount.toString().equals("1")) { sb.append("a "); if (tapped && !attacking) { sb.append("tapped "); } sb.append(token.getDescription()); } else { sb.append(CardUtil.numberToText(amount.toString())).append(' '); if (tapped && !attacking) { sb.append("tapped "); } sb.append(token.getDescription()); if (token.getDescription().endsWith("token")) { sb.append("s "); } int tokenLocation = sb.indexOf("token "); if (tokenLocation != -1) { sb.replace(tokenLocation, tokenLocation + 6, "tokens "); } } if (attacking) { sb.append(" that are"); if (tapped) { sb.append(" tapped and"); } sb.append(" attacking"); } String message = amount.getMessage(); if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { sb.append(" for each "); } } sb.append(message); return sb.toString(); }

Target:
public String getText(Mode mode) { if (staticText != null && !staticText.isEmpty()) { return staticText; } StringBuilder sb = new StringBuilder(); if (mode.getTargets().isEmpty()) { sb.append("target player"); } else { sb.append("target ").append(mode.getTargets().get(0).getTargetName()); } sb.append(" creates "); if (amount.toString().equals("1")) { sb.append("a "); if (tapped && !attacking) { sb.append("tapped "); } sb.append(token.getDescription()); } else { sb.append(CardUtil.numberToText(amount.toString())).append(' '); if (tapped && !attacking) { sb.append("tapped "); } sb.append(token.getDescription()); if (token.getDescription().endsWith("token")) { sb.append("s "); } int tokenLocation = sb.indexOf("token "); if (tokenLocation != -1) { sb.replace(tokenLocation, tokenLocation + 6, "tokens "); } } if (attacking) { sb.append(" that are"); if (tapped) { sb.append(" tapped and"); } sb.append(" attacking"); } String message = amount.getMessage(); if (!message.isEmpty()) { if (amount.toString().equals("X")) { sb.append(", where X is "); } else { sb.append(" for each "); } } sb.append(message); return sb.toString(); }
Source:
private void createFormRecordScanResultDialog(Pair<Boolean, String> result, FormRecord record) { String title; if (result.first) { title = Localization.get("app.workflow.forms.scan.title.valid"); } else { title = Localization.get("app.workflow.forms.scan.title.invalid"); } int resId = result.first ? R.drawable.checkmark : R.drawable.redx; StandardAlertDialog dialog = StandardAlertDialog.getBasicAlertDialogWithIcon(this, title, result.second, resId, null); if (FormRecordFilter.Pending.containsStatus(record.getStatus())) { if (DeveloperPreferences.isManualFormQuarantineAllowed()) { dialog.setNegativeButton(Localization.get("app.workflow.forms.quarantine"), (dialog1, which) -> { manuallyQuarantineRecord(record); dismissAlertDialog(); DeveloperPreferences.disableManualFormQuarantine(); }); } } showAlertDialog(dialog); }

Target:
private void createFormRecordScanResultDialog(Pair<Boolean, String> result, FormRecord record) { String title; if (result.first) { title = Localization.get("app.workflow.forms.scan.title.valid"); } else { title = Localization.get("app.workflow.forms.scan.title.invalid"); } int resId = result.first ? R.drawable.checkmark : R.drawable.redx; StandardAlertDialog dialog = StandardAlertDialog.getBasicAlertDialogWithIcon(this, title, result.second, resId, null); if (FormRecordFilter.Pending.containsStatus(record.getStatus())) { if (AdvancedActionsPreferences.isManualFormQuarantineAllowed()) { dialog.setNegativeButton(Localization.get("app.workflow.forms.quarantine"), (dialog1, which) -> { manuallyQuarantineRecord(record); dismissAlertDialog(); AdvancedActionsPreferences.setManualFormQuarantine(false); }); } } showAlertDialog(dialog); }