auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void setupSSLSocket() throws NoSuchAlgorithmException, IOException, KeyManagementException, KeyStoreException { String tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm(); TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmfAlgorithm); tmf.init(mKeyStore); SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(null, tmf.getTrustManagers(), new SecureRandom()); mSslSocket = (SSLSocket) sslContext.getSocketFactory().createSocket(); mSslSocket.setSoTimeout(TCP_TIMEOUT); if (!TextUtils.isEmpty(mHostname)) { List<SNIServerName> names = new ArrayList<SNIServerName>(); names.add(new SNIHostName(mHostname)); SSLParameters params = mSslSocket.getSSLParameters(); params.setServerNames(names); mSslSocket.setSSLParameters(params); } }

Target:
private SSLSocket setupSSLSocket() throws NoSuchAlgorithmException, IOException, KeyManagementException, KeyStoreException { final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init((KeyStore) null); final SSLContext sslContext = SSLContext.getInstance("TLSv1.2"); sslContext.init(null , tmf.getTrustManagers(), new SecureRandom()); final int oldTag = TrafficStats.getAndSetThreadStatsTag( TrafficStatsConstants.TAG_SYSTEM_PROBE); SSLSocket sslSocket = (SSLSocket) sslContext.getSocketFactory().createSocket(); sslSocket.setSoTimeout(TCP_TIMEOUT); TrafficStats.setThreadStatsTag(oldTag); if (!TextUtils.isEmpty(mHostname)) { final List<SNIServerName> names = Collections.singletonList(new SNIHostName(mHostname)); SSLParameters params = sslSocket.getSSLParameters(); params.setServerNames(names); sslSocket.setSSLParameters(params); } return sslSocket; }
Source:
public void writeSelf(File file, long pos) { fLock.readLock().lock(); try (FileOutputStream fos = new FileOutputStream(file, true); FileChannel fc = fos.getChannel();) { fc.position(pos); try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeInt(ATTRIB_TREE_MAGIC_NUMBER); List<String[]> list = new ArrayList<>(fAttributeList.size()); String[] prevFullAttribute = null; for (Attribute entry : fAttributeList) { String[] curFullAttribute = entry.getFullAttribute(); String[] curEncodedAttribute = encodeFullAttribute(prevFullAttribute, entry.getFullAttribute()); list.add(curEncodedAttribute); prevFullAttribute = curFullAttribute; } oos.writeObject(list); } } catch (IOException e) { Activator.getDefault().logError("Error writing the file "+file+" due to ", e); } finally { fLock.readLock().unlock(); } }

Target:
public void writeSelf(File file, long pos) { fLock.readLock().lock(); try (FileOutputStream fos = new FileOutputStream(file, true); FileChannel fc = fos.getChannel();) { fc.position(pos); try (ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeInt(ATTRIB_TREE_MAGIC_NUMBER); List<String[]> list = new ArrayList<>(fAttributeList.size()); String[] prevFullAttribute = null; for (Attribute entry : fAttributeList) { String[] curFullAttribute = entry.getFullAttribute(); String[] curEncodedAttribute = encodeFullAttribute(prevFullAttribute, entry.getFullAttribute()); list.add(curEncodedAttribute); prevFullAttribute = curFullAttribute; } oos.writeObject(list); } } catch (IOException e) { Activator.getDefault().logError("Error writing the file "+file+" ", e); } finally { fLock.readLock().unlock(); } }
Source:
public Map<DocumentReference, List<String>> groupAnchorsByUserReference(List<MacroBlock> mentions, WikiReference wikiReference) { Map<DocumentReference, List<String>> ret = new HashMap<>(); for (MacroBlock block : mentions) { String macroReference = block.getParameter(REFERENCE_PARAM_NAME); DocumentReference reference = this.documentReferenceResolver.resolve(macroReference, wikiReference); String anchor = block.getParameter(ANCHORID_PARAM_NAME); ret.merge(reference, new ArrayList<>(Collections.singletonList(anchor)), (l1, l2) -> { l1.addAll(l2); return l1; }); } return ret; }

Target:
public Map<DocumentReference, List<String>> groupAnchorsByUserReference(List<MacroBlock> mentions, WikiReference wikiReference) { Map<DocumentReference, List<String>> ret = new HashMap<>(); for (MacroBlock block : mentions) { String serializedUserReference = block.getParameter(REFERENCE_PARAM_NAME); DocumentReference reference = this.documentReferenceResolver.resolve(serializedUserReference, wikiReference); String anchor = block.getParameter(ANCHORID_PARAM_NAME); ret.merge(reference, new ArrayList<>(Collections.singletonList(anchor)), (l1, l2) -> { l1.addAll(l2); return l1; }); } return ret; }
Source:
public static boolean registryValueExists(HKEY root, String key, String value) { return registryValueExists(root, key, value, WinNT.REG_NONE); }

Target:
public static boolean registryValueExists(HKEY root, String key, String value) { return registryValueExists(root, key, value, 0); }
Source:
private static boolean calculateRegression(double[] coefficient, List<Integer> validColumnIndices, OLSMultipleLinearRegression mlr) { if (coefficient.length != validColumnIndices.size()) { LOG.warn("There are " + coefficient.length + " coefficients, but " + validColumnIndices.size() + " valid columns in the regression"); } double[] beta = mlr.estimateRegressionParameters(); Arrays.fill(coefficient, 0); for (int i = 0; i < validColumnIndices.size(); ++i) { coefficient[validColumnIndices.get(i)] = beta[i]; } coefficient[5] = beta[validColumnIndices.size()]; return true; }

Target:
private static boolean calculateRegression(double[] coefficient, List<Integer> validColumnIndices, OLSMultipleLinearRegression mlr) { if (coefficient.length != validColumnIndices.size()) { LOG.info("There are " + coefficient.length + " coefficients, and " + validColumnIndices.size() + " valid columns in the regression"); } double[] beta = mlr.estimateRegressionParameters(); Arrays.fill(coefficient, 0); for (int i = 0; i < validColumnIndices.size(); ++i) { coefficient[validColumnIndices.get(i)] = beta[i]; } coefficient[5] = beta[validColumnIndices.size()]; return true; }
Source:
public Optional<Feature> get(String name) { return featureManager.getFeatures().stream().filter(f -> name.equals(f.name())).findFirst(); }

Target:
public TogglzFeature get(String name) { Feature feature = getFeature(name); if (feature == null) { return null; } else { return new TogglzFeature(feature, featureManager.getFeatureState(feature)); } }
Source:
public SessionSettings(StreamInput in) throws IOException { this.userName = in.readString(); this.searchPath = SearchPath.createSearchPathFrom(in); this.hashJoinsEnabled = in.readBoolean(); if (in.getVersion().onOrAfter(Version.V_4_2_0)) { int ruleSize = in.readVInt(); excludedOptimizerRules = new HashSet<>(ruleSize); if (ruleSize > 0) { for (int i = 0; i < ruleSize; i++) { excludedOptimizerRules.add(in.readString()); } } } else { excludedOptimizerRules = Set.of(); } }

Target:
public SessionSettings(StreamInput in) throws IOException { this.userName = in.readString(); this.searchPath = SearchPath.createSearchPathFrom(in); this.hashJoinsEnabled = in.readBoolean(); this.excludedOptimizerRules = Set.of(); }
Source:
public void testCHER002_quit() throws Exception { setupCHER002(); runCherryPick(Returns.ABORTED, "branch_c", "branch_d"); assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_c") + "]... Delete C1")); assertNoConflitMarker(projectPath.resolve("model.uml"), projectPath.resolve("model.notation")); project = new ProjectBuilder(this) .clean(true) .addContentToCopy("data/conflicts/CHER_002/conflict/resolution1/model.di") .addContentToCopy("data/conflicts/CHER_002/conflict/resolution1/model.uml") .addContentToCopy("data/conflicts/CHER_002/conflict/resolution1/model.notation") .create(projectPath); getGit().add().addFilepattern(".").call(); runQuit(Returns.ABORTED); assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_d") + "]... Delete C2")); }

Target:
public void testCHER002_quit() throws Exception { setupCHER002(); runCherryPick(Returns.ABORTED, "branch_c", "branch_d"); assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_c") + "]... Delete C1")); assertNoConflitMarker(projectPath.resolve("model.uml"), projectPath.resolve("model.notation")); project = new ProjectBuilder(this) .clean(true) .addContentToCopy("data/conflicts/CHER002/conflict/resolution1/model.di") .addContentToCopy("data/conflicts/CHER002/conflict/resolution1/model.uml") .addContentToCopy("data/conflicts/CHER002/conflict/resolution1/model.notation") .create(projectPath); getGit().add().addFilepattern(".").call(); runQuit(Returns.ABORTED); assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_d") + "]... Delete C2")); }
Source:
public void update(long usedBytes) { File path = Environment.getDataDirectory(); float availableGB = bytesToGB(path.getFreeSpace()); float otherGB = bytesToGB(path.getTotalSpace()); float usedGB = bytesToGB(usedBytes); otherGB -= usedGB; sizeText.setText(getResources().getString(R.string.storage_size_format, usedGB)); usageFreeText.setText(getResources().getString(R.string.storage_size_free, availableGB)); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) otherBar.getLayoutParams(); params.weight = otherGB; otherBar.setLayoutParams(params); params = (LinearLayout.LayoutParams) freeBar.getLayoutParams(); params.weight = availableGB; freeBar.setLayoutParams(params); params = (LinearLayout.LayoutParams) usedBar.getLayoutParams(); params.weight = usedGB; usedBar.setLayoutParams(params); }

Target:
public void update(long usedBytes) { File path = Environment.getDataDirectory(); float availableGB = bytesToGB(path.getFreeSpace()); float otherGB = bytesToGB(path.getTotalSpace()); float usedGB = bytesToGB(usedBytes); otherGB -= usedGB; sizeText.setText(getResources().getString(R.string.storage_size_format, usedGB)); usageFreeText.setText(getResources().getString(R.string.storage_size_free, availableGB)); setUsageBarWeight(otherBar, otherGB); setUsageBarWeight(freeBar, availableGB); setUsageBarWeight(usedBar, usedGB); }
Source:
public static boolean canSwitchToAmmo(Mounted weapon, AmmoType otherAmmo) { if((weapon == null) || (weapon.getLinked() == null) || (otherAmmo == null)) { return false; } AmmoType currentAmmoType = (AmmoType) weapon.getLinked().getType(); boolean ammoOfSameType = currentAmmoType.equalsAmmoTypeOnly(otherAmmo) && (currentAmmoType.getRackSize() == otherAmmo.getRackSize()); boolean mmlAmmoMatch = (currentAmmoType.getAmmoType() == AmmoType.T_MML) && (otherAmmo.getAmmoType() == AmmoType.T_MML); boolean lbxAmmoMatch = (currentAmmoType.getAmmoType() == AmmoType.T_AC_LBX) && (otherAmmo.getAmmoType() == AmmoType.T_AC_LBX); boolean caselessLoaded = currentAmmoType.getMunitionType() == AmmoType.M_CASELESS; boolean otherBinCaseless = otherAmmo.getMunitionType() == AmmoType.M_CASELESS; boolean caselessMismatch = caselessLoaded != otherBinCaseless; boolean hasStaticFeed = weapon.hasQuirk(OptionsConstants.QUIRK_WEAP_NEG_STATIC_FEED); boolean staticFeedMismatch = hasStaticFeed && (currentAmmoType.getMunitionType() != otherAmmo.getMunitionType()); return (ammoOfSameType || mmlAmmoMatch || lbxAmmoMatch) && !caselessMismatch && !staticFeedMismatch; }

Target:
public static boolean canSwitchToAmmo(Mounted weapon, AmmoType otherAmmo) { if((weapon == null) || (weapon.getLinked() == null) || (otherAmmo == null)) { return false; } AmmoType currentAmmoType = (AmmoType) weapon.getLinked().getType(); boolean ammoOfSameType = currentAmmoType.equalsAmmoTypeOnly(otherAmmo) && (currentAmmoType.getRackSize() == otherAmmo.getRackSize()); boolean mmlAmmoMatch = (currentAmmoType.getAmmoType() == AmmoType.T_MML) && (otherAmmo.getAmmoType() == AmmoType.T_MML) && (currentAmmoType.getRackSize() == otherAmmo.getRackSize()); boolean lbxAmmoMatch = (currentAmmoType.getAmmoType() == AmmoType.T_AC_LBX) && (otherAmmo.getAmmoType() == AmmoType.T_AC_LBX) && (currentAmmoType.getRackSize() == otherAmmo.getRackSize()); boolean caselessLoaded = currentAmmoType.getMunitionType() == AmmoType.M_CASELESS; boolean otherBinCaseless = otherAmmo.getMunitionType() == AmmoType.M_CASELESS; boolean caselessMismatch = caselessLoaded != otherBinCaseless; boolean hasStaticFeed = weapon.hasQuirk(OptionsConstants.QUIRK_WEAP_NEG_STATIC_FEED); boolean staticFeedMismatch = hasStaticFeed && (currentAmmoType.getMunitionType() != otherAmmo.getMunitionType()); return (ammoOfSameType || mmlAmmoMatch || lbxAmmoMatch) && !caselessMismatch && !staticFeedMismatch; }
Source:
public void matchesIdenticalTypes() throws IOException { MatcherAssert.assertThat( new FkContentType( "text/html charset=iso-8859-1", new RsEmpty() ).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, "text/html charset=iso-8859-1" ) ).has(), Matchers.is(true) ); }

Target:
public void matchesIdenticalTypes() throws IOException { MatcherAssert.assertThat( new FkContentType( FkContentTypeTest.CTYPE, new RsEmpty() ).route( new RqWithHeader( new RqFake(), FkContentTypeTest.CONTENT_TYPE, FkContentTypeTest.CTYPE ) ).has(), Matchers.is(true) ); }
Source:
public static String buildImagePathToCard(CardDownloadData card) { String setPath = buildImagePathToSet(card); String prefixType = ""; if (card.getType() != 0) { prefixType = " " + Integer.toString(card.getType()); } String cardName = card.getFileName(); if (cardName.isEmpty()) { cardName = prepareCardNameForFile(card.getName()); } cardName = cardName.replaceAll("[\\\\/:*?\"<>|]", ""); String finalFileName = ""; if (card.getUsesVariousArt()) { finalFileName = cardName + prefixType + '.' + card.getCollectorId() + ".full.jpg"; } else { finalFileName = cardName + prefixType + ".full.jpg"; } TFile dirFile = new TFile(setPath); TFile imageFile = new TFile(setPath + finalFileName); try { if (dirFile.exists() && !imageFile.exists()) { for (String fileName : dirFile.list()) { if (fileName.toLowerCase(Locale.ENGLISH).equals(finalFileName.toLowerCase(Locale.ENGLISH))) { finalFileName = fileName; break; } } } } catch (Exception ex) { log.error("Can't read card name from file, may be it broken: " + setPath); } return setPath + finalFileName; }

Target:
public static String buildImagePathToCard(CardDownloadData card) { String setPath = buildImagePathToSet(card); String prefixType = ""; if (card.getType() != 0) { prefixType = " " + Integer.toString(card.getType()); } String cardName = card.getFileName(); if (cardName.isEmpty()) { cardName = prepareCardNameForFile(card.getName()); } String finalFileName = ""; if (card.getUsesVariousArt()) { finalFileName = cardName + prefixType + '.' + card.getCollectorId() + ".full.jpg"; } else { finalFileName = cardName + prefixType + ".full.jpg"; } TFile dirFile = new TFile(setPath); TFile imageFile = new TFile(setPath + finalFileName); try { if (dirFile.exists() && !imageFile.exists()) { for (String fileName : dirFile.list()) { if (fileName.toLowerCase(Locale.ENGLISH).equals(finalFileName.toLowerCase(Locale.ENGLISH))) { finalFileName = fileName; break; } } } } catch (Exception ex) { log.error("Can't read card name from file, may be it broken: " + setPath); } return setPath + finalFileName; }
Source:
protected boolean isFullyQualified(String href) { if (href == null || href.length() < 5) { return false; } char c = href.charAt(0); if (c == 'h' || c == 'H') { c = href.charAt(1); if (c == 't' || c == 'T') { c = href.charAt(2); if (c == 't' || c == 'T') { c = href.charAt(3); return c == 'p' || c == 'P'; } } } return false; }

Target:
protected boolean isFullyQualified(String href) { if (href == null || href.length() < 5) { return false; } return href.regionMatches(true, 0, "http", 0, 4); }
Source:
private static String sortingColumnToString(SortingColumn column) { return (column.getOrder() == ASCENDING ? '+' : '-') + column.getColumnName(); }

Target:
private static String sortingColumnToString(SortingColumn column) { return column.getColumnName() + ((column.getOrder() == DESCENDING) ? " DESC" : ""); }
Source:
protected void onMethodInvocationFound(MethodInvocationTree method) { List<StringConstant> patterns = antMatchersPatterns(method); if (!patterns.isEmpty()) { List<StringConstant> previousPatterns = new PreviousMethodDetection().scan(method).previousPatterns; patterns.forEach(pattern -> checkAntPattern(pattern, previousPatterns)); } }

Target:
protected void onMethodInvocationFound(MethodInvocationTree method) { List<StringConstant> antPatterns = collectAntPatterns(method); for (int indexToCheck = 1; indexToCheck < antPatterns.size(); indexToCheck++) { checkAntPatternAt(antPatterns, indexToCheck); } }
Source:
public static void main(String... args) throws IOException { if (JAVA_VERSION >= 9){ UILog.log("Parabot", "Please downgrade to Java 8 in order to use Parabot"); System.exit(0); } parseArgs(args); Directories.validate(); Core.verbose(TranslationHelper.translate("DEBUG_MODE") + Core.inDebugMode()); try { Core.verbose(TranslationHelper.translate("SETTING_LOOK_AND_FEEL") + UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable t) { t.printStackTrace(); } if (!Core.inDebugMode() && Core.hasValidation() && !Core.isValid()) { if (Core.newVersionAlert() == JOptionPane.YES_OPTION) { Core.downloadNewVersion(); return; } } Core.verbose(TranslationHelper.translate("VALIDATION_ACCOUNT_MANAGER")); AccountManager.validate(); if (username != null && password != null) { new BotUI(username, password); username = null; password = null; return; } Core.verbose(TranslationHelper.translate("STARTING_LOGIN_GUI")); new BotUI(null, null); }

Target:
public static void main(String... args) throws IOException { if (Context.getJavaVersion() >= 9){ UILog.log("Parabot", "Parabot doesn't support Java 9+ currently. Please downgrade to Java 8 to ensure Parabot is working correctly."); System.exit(0); } parseArgs(args); Directories.validate(); Core.verbose(TranslationHelper.translate("DEBUG_MODE") + Core.inDebugMode()); try { Core.verbose(TranslationHelper.translate("SETTING_LOOK_AND_FEEL") + UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable t) { t.printStackTrace(); } if (!Core.inDebugMode() && Core.hasValidation() && !Core.isValid()) { if (Core.newVersionAlert() == JOptionPane.YES_OPTION) { Core.downloadNewVersion(); return; } } Core.verbose(TranslationHelper.translate("VALIDATION_ACCOUNT_MANAGER")); AccountManager.validate(); if (username != null && password != null) { new BotUI(username, password); username = null; password = null; return; } Core.verbose(TranslationHelper.translate("STARTING_LOGIN_GUI")); new BotUI(null, null); }
Source:
public boolean isDslCompatibleWith(LuceneFieldProjectionBuilderFactory obj) { if ( this == obj ) { return true; } if ( obj.getClass() != GeoPointFieldProjectionBuilderFactory.class ) { return false; } GeoPointFieldProjectionBuilderFactory<?> other = (GeoPointFieldProjectionBuilderFactory<?>) obj; return codec.isCompatibleWith( other.codec ) && converter.isDslCompatibleWith( other.converter ); }

Target:
public boolean isDslCompatibleWith(LuceneFieldProjectionBuilderFactory obj) { if ( this == obj ) { return true; } if ( obj.getClass() != GeoPointFieldProjectionBuilderFactory.class ) { return false; } GeoPointFieldProjectionBuilderFactory<?> other = (GeoPointFieldProjectionBuilderFactory<?>) obj; return projectable == other.projectable && codec.isCompatibleWith( other.codec ) && converter.isDslCompatibleWith( other.converter ); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("INITITATE_RESPONSE FOR TXN "); sb.append(m_txnId); sb.append("\n SP HANDLE: ").append(m_spHandle); sb.append("\n INITIATOR HSID: ").append(CoreUtils.hsIdToString(m_initiatorHSId)); sb.append("\n COORDINATOR HSID: ").append(CoreUtils.hsIdToString(m_coordinatorHSId)); sb.append("\n CLIENT INTERFACE HANDLE: ").append(m_clientInterfaceHandle); sb.append("\n CLIENT CONNECTION ID: ").append(m_connectionId); sb.append("\n READ-ONLY: ").append(m_readOnly); sb.append("\n RECOVERING: ").append(m_recovering); sb.append("\n MISPARTITIONED: ").append(m_mispartitioned); if (m_commit) sb.append("\n COMMIT"); else sb.append("\n ROLLBACK/ABORT, "); sb.append("\n CLIENT RESPONSE: \n"); if (m_response == null) { sb.append(" NULL\n"); } else { sb.append(m_response.toJSONString()); } return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("INITITATE_RESPONSE FOR TXN "); sb.append(m_txnId); sb.append("\n SP HANDLE: ").append(m_spHandle); sb.append("\n INITIATOR HSID: ").append(CoreUtils.hsIdToString(m_initiatorHSId)); sb.append("\n COORDINATOR HSID: ").append(CoreUtils.hsIdToString(m_coordinatorHSId)); sb.append("\n CLIENT INTERFACE HANDLE: ").append(m_clientInterfaceHandle); sb.append("\n CLIENT CONNECTION ID: ").append(m_connectionId); sb.append("\n READ-ONLY: ").append(m_readOnly); sb.append("\n RECOVERING: ").append(m_recovering); sb.append("\n MISPARTITIONED: ").append(m_mispartitioned); if (m_commit) sb.append("\n COMMIT"); else sb.append("\n ROLLBACK/ABORT, "); sb.append("\n CLIENT RESPONSE: \n"); if (m_response == null) { sb.append( "NULL" ); } else { sb.append(m_response.toJSONString()); } return sb.toString(); }
Source:
private void markLoaded(@Nonnull Scope range, @Nonnull JDefinedClassOrInterface loaded) { loadStatus |= range.getMask(); if (loadStatus == Scope.ALL) { synchronized (this) { loaded.removeLoader(); } } }

Target:
private void markLoaded(@Nonnull Scope range, @Nonnull JDefinedClassOrInterface loaded) { loadStatus |= range.getMask(); if (loadStatus == Scope.ALL) { loaded.removeLoader(); } }
Source:
private static JPanel createFilterPanel(final JXTable table) { JPanel filterPanel = new JPanel(); filterPanel.setLayout(new GridBagLayout()); JLabel filterLabel = new JLabel(Constant.messages.getString("cfu.label.addons.filter")); final JTextField filterTextField = new JTextField(); filterLabel.setLabelFor(filterTextField); filterPanel.add(filterLabel, LayoutHelper.getGBC(0, 0, 1, 0.0D)); filterPanel.add(filterTextField, LayoutHelper.getGBC(1, 0, 1, 1.0D)); String tooltipText = Constant.messages.getString("cfu.label.addons.filter.tooltip"); filterLabel.setToolTipText(tooltipText); filterTextField.setToolTipText(tooltipText); filterTextField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateFilter(); } @Override public void removeUpdate(DocumentEvent e) { updateFilter(); } @Override public void changedUpdate(DocumentEvent e) { updateFilter(); } public void updateFilter() { String filterText = filterTextField.getText(); if (filterText.isEmpty()) { table.setRowFilter(null); } else { try { table.setRowFilter(RowFilter.regexFilter("(?i)" + filterText)); filterTextField.setForeground(UIManager.getColor("TextField.foreground")); } catch (PatternSyntaxException e) { filterTextField.setForeground(Color.RED); } } } }); return filterPanel; }

Target:
private static JPanel createFilterPanel(final JXTable table) { JPanel filterPanel = new JPanel(); filterPanel.setLayout(new GridBagLayout()); JLabel filterLabel = new JLabel(Constant.messages.getString("cfu.label.addons.filter")); final JTextField filterTextField = new JTextField(); filterLabel.setLabelFor(filterTextField); filterPanel.add(filterLabel, LayoutHelper.getGBC(0, 0, 1, 0.0D)); filterPanel.add(filterTextField, LayoutHelper.getGBC(1, 0, 1, 1.0D)); String tooltipText = Constant.messages.getString("cfu.label.addons.filter.tooltip"); filterLabel.setToolTipText(tooltipText); filterTextField.setToolTipText(tooltipText); filterTextField.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateFilter(); } @Override public void removeUpdate(DocumentEvent e) { updateFilter(); } @Override public void changedUpdate(DocumentEvent e) { updateFilter(); } public void updateFilter() { String filterText = filterTextField.getText(); if (filterText.isEmpty()) { table.setRowFilter(null); filterTextField.setForeground(UIManager.getColor("TextField.foreground")); } else { try { table.setRowFilter(RowFilter.regexFilter("(?i)" + filterText)); filterTextField.setForeground(UIManager.getColor("TextField.foreground")); } catch (PatternSyntaxException e) { filterTextField.setForeground(Color.RED); } } } }); return filterPanel; }
Source:
private boolean connectHostToPool() { final VDS vds = getVds(); EventResult result = ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(getStoragePool().getId(), null, vds.getId(), EventType.VDSCONNECTTOPOOL, ""), new Callable<EventResult>() { @Override public EventResult call() { return runConnectHostToPoolEvent(getStoragePool().getId(), vds); } }); if (result != null) { return result.isSuccess(); } return false; }

Target:
private boolean connectHostToPool() { final VDS vds = getVds(); EventResult result = ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(getStoragePool().getId(), null, vds.getId(), EventType.VDSCONNECTTOPOOL, "Trying to connect the host to the pool "+getStoragePool().getId()), new Callable<EventResult>() { @Override public EventResult call() { return runConnectHostToPoolEvent(getStoragePool().getId(), vds); } }); if (result != null) { return result.isSuccess(); } return false; }
Source:
public static BufferedImage colorCamoImage(Color color) { if (color == null) { DefaultMmLogger.getInstance().error("A null color was passed."); return ImageUtil.failStandardImage(); } BufferedImage result = new BufferedImage(84, 72, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = result.createGraphics(); graphics.setColor(color); graphics.fillRect(0, 0, 84, 72); return result; }

Target:
public static BufferedImage colorCamoImage(Color color) { if (color == null) { MegaMek.getLogger().error("A null color was passed."); return ImageUtil.failStandardImage(); } BufferedImage result = new BufferedImage(84, 72, BufferedImage.TYPE_INT_RGB); Graphics2D graphics = result.createGraphics(); graphics.setColor(color); graphics.fillRect(0, 0, 84, 72); return result; }
Source:
static ClassToExternalizerMap load(GlobalConfiguration globalCfg) { ClassToExternalizerMap exts = new ClassToExternalizerMap(4, 0x0.6p0f); Map<Integer, AdvancedExternalizer<?>> cfgExts = globalCfg.serialization().advancedExternalizers(); for (Map.Entry<Integer, AdvancedExternalizer<?>> config : cfgExts.entrySet()) { AdvancedExternalizer ext = config.getValue(); Integer id = ext.getId(); if (config.getKey() == null && id == null) throw new CacheConfigurationException(String.format( "No advanced externalizer identifier set for externalizer %s", ext.getClass().getName())); else if (config.getKey() != null) id = config.getKey(); id = checkForeignIdLimit(id, ext); Set<Class> subTypes = ext.getTypeClasses(); ForeignAdvancedExternalizer foreignExt = new ForeignAdvancedExternalizer(id, ext); for (Class<?> subType : subTypes) exts.put(subType, foreignExt); } return exts; }

Target:
static ClassToExternalizerMap load(GlobalConfiguration globalCfg) { ClassToExternalizerMap exts = new ClassToExternalizerMap(4, 0.375f); Map<Integer, AdvancedExternalizer<?>> cfgExts = globalCfg.serialization().advancedExternalizers(); for (Map.Entry<Integer, AdvancedExternalizer<?>> config : cfgExts.entrySet()) { AdvancedExternalizer ext = config.getValue(); Integer id = ext.getId(); if (config.getKey() == null && id == null) throw new CacheConfigurationException(String.format( "No advanced externalizer identifier set for externalizer %s", ext.getClass().getName())); else if (config.getKey() != null) id = config.getKey(); checkForeignIdLimit(id, ext); Set<Class> subTypes = ext.getTypeClasses(); ForeignAdvancedExternalizer foreignExt = new ForeignAdvancedExternalizer(id, ext); for (Class<?> subType : subTypes) exts.put(subType, foreignExt); } return exts; }
Source:
void check() throws Exception { TransactionalEditingDomain domain = CreateViewOperationTest.this.session.getTransactionalEditingDomain(); SiriusCommand viewpointCommand = new SiriusCommand(domain); viewpointCommand.getTasks().add(task); domain.getCommandStack().execute(viewpointCommand); IInterpreter interpreter = session.getInterpreter(); assertNotNull("The $" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral() + " should be available to reference the created view", interpreter.evaluateEObject(rootContext.getCurrentTarget(), "aql:" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral())); assertNotNull("The $" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral() + " should be available to reference the created view", interpreter.getVariable(ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral())); }

Target:
void check() throws Exception { TransactionalEditingDomain domain = CreateViewOperationTest.this.session.getTransactionalEditingDomain(); SiriusCommand viewpointCommand = new SiriusCommand(domain); viewpointCommand.getTasks().add(task); domain.getCommandStack().execute(viewpointCommand); IInterpreter interpreter = session.getInterpreter(); assertNotNull("The variable" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral() + " should be available to reference the created view", interpreter.evaluateEObject(rootContext.getCurrentTarget(), "aql:" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral())); assertNotNull("The variable" + ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral() + " should be available to reference the created view", interpreter.getVariable(ToolPackage.Literals.CREATE_VIEW__VARIABLE_NAME.getDefaultValueLiteral())); }
Source:
public static void e(String tag, String msg, Object... args) { if (level >= 1) { String source = getTag(tag); String message = getMessage(msg, args); if (delegate != null) { delegate.error(source, message); } else { Log.e(source, message); } } }

Target:
public static void e(String tag, String msg, Object... args) { if (level >= 1) { String source = getTag(tag); String message = getMessage(msg, args); delegate.error(source, message); } }
Source:
private boolean describesTestClass(Description description) { return description.getMethodName() == null || description.getMethodName().equals("null"); }

Target:
private boolean describesTestClass( Description description ) { String methodName = description.getMethodName(); return methodName == null || methodName.equals( "null" ); }
Source:
private static String convertDomain(final String domain) { if (domain == null) { return null; } return stripDotSuffix(domain).toUpperCase(); }

Target:
private static String convertDomain(final String domain) { return domain != null ? stripDotSuffix(domain).toUpperCase() : null; }
Source:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } VdcActionType.QuotaDependency quotaDependency = this.getActionType().getQuotaDependency(); List<QuotaConsumptionParameter> consumptionParameters = new ArrayList<QuotaConsumptionParameter>(); QuotaConsumptionParameters quotaConsumptionParameters = new QuotaConsumptionParameters( this.getStoragePool(), this.getStoragePool().getId(), this.getReturnValue().getCanDoActionMessages(), this); try { switch (quotaDependency) { case NONE: return true; case STORAGE: getInternalStorageParameters(consumptionParameters); break; case VDS: getInternalVdsParameters(consumptionParameters); break; case BOTH: getInternalStorageParameters(consumptionParameters); getInternalStorageParameters(consumptionParameters); break; } } catch (ClassCastException e) { log.error("Command: " + this.getClass().getName() + ". Quota handling was expected - class does not implement the expected interface"); } if (!consumptionParameters.isEmpty()) { return true; } else { return true; } }

Target:
private boolean internalValidateAndSetQuota() { if (isInternalExecution()) { return true; } VdcActionType.QuotaDependency quotaDependency = this.getActionType().getQuotaDependency(); List<QuotaConsumptionParameter> consumptionParameters = new ArrayList<QuotaConsumptionParameter>(); try { switch (quotaDependency) { case NONE: return true; case STORAGE: addInternalStorageParameters(consumptionParameters); break; case VDS: addInternalVdsParameters(consumptionParameters); break; case BOTH: addInternalStorageParameters(consumptionParameters); addInternalVdsParameters(consumptionParameters); break; } } catch (ClassCastException e) { log.error("Command: " + this.getClass().getName() + ". Quota handling was expected - class does not implement the expected interface"); } QuotaConsumptionParameters quotaConsumptionParameters; if (getStoragePool() != null) { quotaConsumptionParameters = new QuotaConsumptionParameters( this.getStoragePool(), this.getStoragePool().getId(), this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParameters.setParameters(consumptionParameters); } else { quotaConsumptionParameters = new QuotaConsumptionParameters( null, null, this.getReturnValue().getCanDoActionMessages(), this); quotaConsumptionParameters.setParameters(consumptionParameters); log.error("Command: " + this.getClass().getName() + ". Storage pool is not available for quota calculation. "); } if (!consumptionParameters.isEmpty()) { return true; } else { return true; } }
Source:
protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { ITmfTrace trace = getTrace(); if (trace == null) { fInitializationSucceeded = false; fInitialized.countDown(); return false; } IStatus status1 = totalsModule.schedule(); IStatus status2 = eventTypesModule.schedule(); if (!(status1.isOK() && status2.isOK())) { cancelSubAnalyses(); fInitializationSucceeded = false; fInitialized.countDown(); return false; } if (!totalsModule.waitForInitialization() || !eventTypesModule.waitForInitialization()) { fInitializationSucceeded = false; fInitialized.countDown(); return false; } ITmfStateSystem totalsSS = totalsModule.getStateSystem(); ITmfStateSystem eventTypesSS = eventTypesModule.getStateSystem(); if (totalsSS == null || eventTypesSS == null) { fInitializationSucceeded = false; fInitialized.countDown(); return false; } fStatistics = new TmfStateStatistics(totalsSS, eventTypesSS); fInitializationSucceeded = true; fInitialized.countDown(); if (!(totalsModule.waitForCompletion(monitor) && eventTypesModule.waitForCompletion(monitor))) { return false; } return true; }

Target:
protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { ITmfTrace trace = getTrace(); if (trace == null) { fInitializationSucceeded = false; fInitialized.countDown(); return false; } IStatus status1 = totalsModule.schedule(); IStatus status2 = eventTypesModule.schedule(); if (!(status1.isOK() && status2.isOK())) { cancelSubAnalyses(); fInitializationSucceeded = false; fInitialized.countDown(); return false; } if (!totalsModule.waitForInitialization() || !eventTypesModule.waitForInitialization()) { fInitializationSucceeded = false; fInitialized.countDown(); return false; } ITmfStateSystem totalsSS = totalsModule.getStateSystem(); ITmfStateSystem eventTypesSS = eventTypesModule.getStateSystem(); if (totalsSS == null || eventTypesSS == null) { fInitializationSucceeded = false; fInitialized.countDown(); throw new IllegalArgumentException("TmfStatisticsModule : Sub-modules initialization succeeded but there is a null state system."); } fStatistics = new TmfStateStatistics(totalsSS, eventTypesSS); fInitializationSucceeded = true; fInitialized.countDown(); if (!(totalsModule.waitForCompletion(monitor) && eventTypesModule.waitForCompletion(monitor))) { return false; } return true; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DataNodeConfig that = (DataNodeConfig) o; return port == that.port && xid == that.xid && Objects.equals(instanceName, that.instanceName) && Objects.equals( hostName, that.hostName) && Objects.equals(datacenterName, that.datacenterName) && Objects.equals(sslPort, that.sslPort) && Objects.equals(http2Port, that.http2Port) && Objects.equals(rackId, that.rackId) && sealedReplicas.equals(that.sealedReplicas) && stoppedReplicas.equals(that.stoppedReplicas) && disabledReplicas.equals(that.disabledReplicas) && diskConfigs.equals(that.diskConfigs); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DataNodeConfig that = (DataNodeConfig) o; return Objects.equals(instanceName, that.instanceName) && Objects.equals(hostName, that.hostName) && Objects.equals( datacenterName, that.datacenterName) && port == that.port && Objects.equals(sslPort, that.sslPort) && Objects.equals(http2Port, that.http2Port) && Objects.equals(rackId, that.rackId) && xid == that.xid && sealedReplicas.equals(that.sealedReplicas) && stoppedReplicas.equals(that.stoppedReplicas) && disabledReplicas.equals(that.disabledReplicas) && diskConfigs.equals(that.diskConfigs); }
Source:
public static int getOptionAsInteger(Map<String, String> options, String option, int defaultValue) { String value = options.get(option); return value == null ? defaultValue : Integer.valueOf(value); }

Target:
public static int getOptionAsInteger(Map<String, String> options, String option, int defaultValue) { String value = options.get(option); return value == null ? defaultValue : Integer.parseInt(value); }
Source:
public static Put getHadoopVersionPut(int historyFileVersion, byte[] jobKeyBytes) { Put pVersion = new Put(jobKeyBytes); byte[] valueBytes = null; valueBytes = Bytes.toBytes(Integer.toString(historyFileVersion)); byte[] qualifier = Bytes.toBytes(JobHistoryKeys.hadoopversion.toString().toLowerCase()); pVersion.add(Constants.INFO_FAM_BYTES, qualifier, valueBytes); return pVersion; }

Target:
public Put getHadoopVersionPut(int historyFileVersion, byte[] jobKeyBytes) { Put pVersion = new Put(jobKeyBytes); byte[] valueBytes = null; valueBytes = Bytes.toBytes(Integer.toString(historyFileVersion)); byte[] qualifier = Bytes.toBytes(JobHistoryKeys.hadoopversion.toString().toLowerCase()); pVersion.add(Constants.INFO_FAM_BYTES, qualifier, valueBytes); return pVersion; }
Source:
public static void registerItemColors(ColorHandlerEvent.Item event) { final ItemColors colors = event.getItemColors(); colors.register((@Nonnull ItemStack stack, int tintIndex) -> SlimeSlingItem.getColorFromStack(stack), GadgetItems.slime_sling_blue.get(), GadgetItems.slime_sling_purple.get(), GadgetItems.slime_sling_magma.get(), GadgetItems.slime_sling_green.get(), GadgetItems.slime_sling_blood.get()); colors.register((@Nonnull ItemStack stack, int tintIndex) -> SlimeBootsItem.getColorFromStack(stack), GadgetItems.slime_boots_blue.get(), GadgetItems.slime_boots_purple.get(), GadgetItems.slime_boots_magma.get(), GadgetItems.slime_boots_green.get(), GadgetItems.slime_boots_blood.get()); }

Target:
public static void registerItemColors(ColorHandlerEvent.Item event) { final ItemColors colors = event.getItemColors(); for (SlimeBlock.SlimeType slime : SlimeBlock.SlimeType.values()) { colors.register((stack,index)->slime.getBallColor(), GadgetItems.slime_sling.get(slime), GadgetItems.slime_boots.get(slime)); } }
Source:
protected AbstractBuilder() { this.filters = new ConcurrentLinkedDeque<>(); }

Target:
protected AbstractBuilder() { this.filters = newLinkedList(); }
Source:
public void testSupportedPlanNodes() throws Exception { Field field = null; try { field = ApplyConnectorOptimization.class.getDeclaredField("CONNECTOR_ACCESSIBLE_PLAN_NODES"); field.setAccessible(true); @SuppressWarnings("unchecked") Set<Class<? extends PlanNode>> actual = (Set<Class<? extends PlanNode>>) field.get(new ApplyConnectorOptimization(ImmutableMap.of())); Set<Class<? extends PlanNode>> expected = ImmutableSet.of(FilterNode.class, TableScanNode.class); assertEquals(actual, expected); } finally { if (field != null) { field.setAccessible(false); } } }

Target:
public void testSupportedPlanNodes() { @SuppressWarnings("unchecked") Set<Class<? extends PlanNode>> expected = Arrays.stream(PlanVisitor.class.getDeclaredMethods()) .map(Method::getParameterTypes) .filter(parameterTypes -> parameterTypes.length > 0) .filter(parameterTypes -> PlanNode.class.isAssignableFrom(parameterTypes[0])) .filter(parameterTypes -> isFinal(parameterTypes[0].getModifiers())) .map(parameterTypes -> (Class<? extends PlanNode>) parameterTypes[0]) .collect(toImmutableSet()); assertEquals(ApplyConnectorOptimization.CONNECTOR_ACCESSIBLE_PLAN_NODES, expected); }
Source:
public void display(IStructuredSelection selection) { if (selection != null && selection.getFirstElement() instanceof IJavaVariable) { IJavaVariable variable = (IJavaVariable) (selection.getFirstElement()); if (fVariable == null || !fVariable.equals(variable)) { fVariable = variable; fExpressionHistory.setEnabled(true); initializeExpressionHistoryDropDown(); } } super.display(selection); }

Target:
public void display(IStructuredSelection selection) { if (fExpressionHistory != null && selection != null && selection.getFirstElement() instanceof IJavaVariable) { IJavaVariable variable = (IJavaVariable) (selection.getFirstElement()); if (fVariable == null || !fVariable.equals(variable)) { fVariable = variable; fExpressionHistory.setEnabled(true); initializeExpressionHistoryDropDown(); } } super.display(selection); }
Source:
private boolean isVmMigratable(VM vm) { return (vm.getMigrationSupport() == MigrationSupport.MIGRATABLE) && !vm.isHostedEngine(); }

Target:
private static boolean isVmMigratable(VM vm) { return (vm.getMigrationSupport() == MigrationSupport.MIGRATABLE) && !vm.isHostedEngine(); }
Source:
private static AbstractFactory createFactory() { try { return (AbstractFactory) Class.forName(LiferayServerContext.getFactoryClass()).newInstance(); } catch (Exception e) { Log.e("LiferayScreens", "Error creating the instance class"); return new FactoryCE(); } }

Target:
private static AbstractFactory createFactory() { try { return (AbstractFactory) Class.forName(LiferayServerContext.getFactoryClass()).newInstance(); } catch (Exception e) { Log.e("LiferayScreens", "Error creating the instance class, " + "there isn't an attribute called *factory_class* that can be instantiated. " + "Are you sure that your class and package exists and it has a public empty constructor?"); return new FactoryCE(); } }
Source:
@Test public void resultRespectsBackpressure() { server.enqueue(new MockResponse().setBody("Hi")); RecordingSubscriber<Result<String>> subscriber = subscriberRule.get(0); service.result().unsafeSubscribe(subscriber); assertThat(server.getRequestCount()).isEqualTo(0); subscriber.requestMore(1); assertThat(server.getRequestCount()).isEqualTo(1); subscriber.assertAnyValue().assertCompleted(); subscriber.requestMore(Long.MAX_VALUE); assertThat(server.getRequestCount()).isEqualTo(1); }

Target:
@Test public void resultRespectsBackpressure() { server.enqueue(new MockResponse().setBody("Hi")); RecordingSubscriber<Result<String>> subscriber = subscriberRule.createWithInitialRequest(0); service.result().unsafeSubscribe(subscriber); assertThat(server.getRequestCount()).isEqualTo(0); subscriber.requestMore(1); assertThat(server.getRequestCount()).isEqualTo(1); subscriber.assertAnyValue().assertCompleted(); subscriber.requestMore(Long.MAX_VALUE); assertThat(server.getRequestCount()).isEqualTo(1); }
Source:
public String sendMessage(final Map<String, String> headers, final int type, final String body, boolean durable, final String user, final String password) throws Exception { try { securityStore.check(queue.getAddress(), queue.getName(), CheckType.SEND, new SecurityAuth() { @Override public String getUsername() { return user; } @Override public String getPassword() { return password; } @Override public RemotingConnection getRemotingConnection() { return null; } }); CoreMessage message = new CoreMessage(storageManager.generateID(), 50); if (headers != null) { for (String header : headers.keySet()) { message.putStringProperty(new SimpleString(header), new SimpleString(headers.get(header))); } } message.setType((byte) type); message.setDurable(durable); message.setTimestamp(System.currentTimeMillis()); if (body != null) { if (type == Message.TEXT_TYPE) { message.getBodyBuffer().writeNullableSimpleString(new SimpleString(body)); } else { message.getBodyBuffer().writeBytes(Base64.decode(body)); } } message.setAddress(queue.getAddress()); ByteBuffer buffer = ByteBuffer.allocate(8); buffer.putLong(queue.getID()); message.putBytesProperty(Message.HDR_ROUTE_TO_IDS, buffer.array()); server.getPostOffice().route(LargeServerMessageImpl.checkLargeMessage(message, server.getStorageManager()), true); return "" + message.getMessageID(); } catch (Exception e) { throw new IllegalStateException(e.getMessage()); } }

Target:
public String sendMessage(final Map<String, String> headers, final int type, final String body, boolean durable, final String user, final String password) throws Exception { try { return sendMessage(queue.getAddress(), server, headers, type, body, durable, user, password, queue.getID()); } catch (Exception e) { throw new IllegalStateException(e.getMessage()); } }
Source:
public ReduceSeedObserver(SingleObserver<? super R> actual, BiFunction<R, ? super T, R> reducer, R value) { this.actual = actual; this.value = value; this.reducer = reducer; this.value = value; }

Target:
public ReduceSeedObserver(SingleObserver<? super R> actual, BiFunction<R, ? super T, R> reducer, R value) { this.actual = actual; this.value = value; this.reducer = reducer; }
Source:
private EntityModel<String> validateName(E entityData) { final int maxNameLength = getMaxNameLength(); EntityModel<String> name = new EntityModel<>(entityData.getName()); name.validateEntity( new IValidation[] { new NotEmptyValidation(), new LengthValidation(maxNameLength), new I18NNameValidation(), new UniqueNameValidator(entityData), value -> entityData.isNameExistsInTheSystem() ? ValidationResult.fail(ConstantsManager.getInstance() .getConstants() .nameMustBeUniqueInvalidReason()) : ValidationResult.ok() }); return name; }

Target:
private EntityModel<String> validateName(E entityData) { final int maxNameLength = AsyncDataProvider.getInstance().getMaxVmNameLength(); EntityModel<String> name = new EntityModel<>(entityData.getName()); name.validateEntity( new IValidation[] { new NotEmptyValidation(), new LengthValidation(maxNameLength), new I18NNameValidation(), uniqueNameValidator -> !isNameUnique(entityData) ? ValidationResult.fail(ConstantsManager.getInstance() .getConstants() .nameMustBeUniqueInvalidReason()) : ValidationResult.ok(), value -> entityData.isNameExistsInTheSystem() ? ValidationResult.fail(ConstantsManager.getInstance() .getConstants() .nameMustBeUniqueInvalidReason()) : ValidationResult.ok() }); return name; }
Source:
public Collection<IAtsTeamWorkflow> getSiblingTeamWorkflows(IAtsTeamWorkflow teamWf) { List<IAtsTeamWorkflow> teams = new LinkedList<IAtsTeamWorkflow>(); teamWf.getStoreObject(); Object action = getAction(teamWf); for (Object teamArt : atsServices.getRelationResolver().getRelated(action, AtsRelationTypes.ActionToWorkflow_WorkFlow)) { if (!teamArt.equals(teamWf)) { teams.add(atsServices.getWorkItemFactory().getTeamWf(teamArt)); } } return teams; }

Target:
public Collection<IAtsTeamWorkflow> getSiblingTeamWorkflows(IAtsTeamWorkflow teamWf) { List<IAtsTeamWorkflow> teams = new LinkedList<IAtsTeamWorkflow>(); Object action = getAction(teamWf); for (Object teamArt : atsServices.getRelationResolver().getRelated(action, AtsRelationTypes.ActionToWorkflow_WorkFlow)) { if (!teamArt.equals(teamWf)) { teams.add(atsServices.getWorkItemFactory().getTeamWf(teamArt)); } } return teams; }