auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (grantResults.length == 0) { return; } if (requestCode == PERMISSION_READ_PHONE_STATE) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { PackageManagerUtils.enableComponent(this, IncomingCallHandler.class, prefs.getBoolean("enable-phone-history", false)); } else { SwitchPreference p = (SwitchPreference) findPreference("enable-phone-history"); p.setChecked(false); Toast.makeText(this, R.string.permission_denied, Toast.LENGTH_SHORT).show(); } } else if (requestCode == Permission.PERMISSION_WRITE_SETTINGS_EXTERNAL_STORAGE) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { Toast.makeText(this, R.string.permission_restart, Toast.LENGTH_SHORT).show(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.permission_restart) .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { android.os.Process.killProcess(android.os.Process.myPid()); } }); AlertDialog alert = builder.create(); alert.show(); } else { Toast.makeText(this, R.string.permission_denied, Toast.LENGTH_SHORT).show(); } } else if (requestCode == Permission.PERMISSION_READ_SETTINGS_EXTERNAL_STORAGE) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { ImportExportHandler.loadSharedPreferencesFromFile(this, prefs); } else { Toast.makeText(this, R.string.permission_denied, Toast.LENGTH_SHORT).show(); } } }

Target:
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (grantResults.length == 0) { return; } if (requestCode == PERMISSION_READ_PHONE_STATE) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { PackageManagerUtils.enableComponent(this, IncomingCallHandler.class, prefs.getBoolean("enable-phone-history", false)); } else { SwitchPreference p = (SwitchPreference) findPreference("enable-phone-history"); p.setChecked(false); Toast.makeText(this, R.string.permission_denied, Toast.LENGTH_SHORT).show(); } } else if ((requestCode == Permission.PERMISSION_WRITE_TO_EXTERNAL_STORAGE) || (requestCode == Permission.PERMISSION_READ_FROM_EXTERNAL_STORAGE)) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { Permission.restartWithDialog(this); } else { Toast.makeText(this, R.string.permission_denied, Toast.LENGTH_SHORT).show(); } } }
Source:
private void readXmlAndBuildTree() { ConfigDispayRules.getInstance().refresh(); Modes.setBindState(BindState.edit); try { Integer id = Integer.valueOf(Helper.getRequestParameter("ProzesseID")); this.process = serviceManager.getProcessService().getById(id); } catch (NumberFormatException | DAOException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("error while loading process data" + e.getMessage()); } this.userId = Helper.getRequestParameter("BenutzerID"); this.allPagesSelectionFirstPage = ""; this.allPagesSelectionLastPage = ""; this.result = Helper.getRequestParameter("zurueck"); this.neuesElementWohin = "1"; this.treeNodeStruct = null; try { readXmlStart(); } catch (ReadException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung(e.getMessage()); } catch (PreferencesException | IOException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("error while loading metadata" + e.getMessage()); } expandTree(); this.sperrung.setLocked(this.process.getId(), this.userId); }

Target:
private void readXmlAndBuildTree() { ConfigDispayRules.getInstance().refresh(); Modes.setBindState(BindState.edit); try { Integer id = Integer.valueOf(Helper.getRequestParameter("ProzesseID")); this.process = serviceManager.getProcessService().getById(id); } catch (NumberFormatException | DAOException e) { Helper.setErrorMessage("error while loading process data" + e.getMessage(), logger, e); } this.userId = Helper.getRequestParameter("BenutzerID"); this.allPagesSelectionFirstPage = ""; this.allPagesSelectionLastPage = ""; this.result = Helper.getRequestParameter("zurueck"); this.neuesElementWohin = "1"; this.treeNodeStruct = null; try { readXmlStart(); } catch (ReadException e) { Helper.setErrorMessage(e.getMessage(), logger, e); } catch (PreferencesException | IOException e) { Helper.setErrorMessage("error while loading metadata" + e.getMessage(), logger, e); } expandTree(); this.sperrung.setLocked(this.process.getId(), this.userId); }
Source:
private boolean tryToDispatchTokens(MessageHolderWithTokens msg) throws InterruptedException { for (int i = 0 ; i <= MAX_TIME_TO_BLOCK_WHEN_QUEUE_IS_FULL; i += TIME_BETWEEN_RETRIES_WHEN_QUEUE_IS_FULL) { if (dispatchTokensOrFailWhenQueueIsFull(msg)) { return true; } else { logger.fine(String.format("Queue is full, blocking loading of batch token #%s for %s variant (%s) for %s ms", msg.getSerialId(), msg.getVariant().getType().getTypeName(), msg.getVariant().getVariantID(), TIME_BETWEEN_RETRIES_WHEN_QUEUE_IS_FULL)); Thread.sleep(TIME_BETWEEN_RETRIES_WHEN_QUEUE_IS_FULL); } } return false; }

Target:
private boolean tryToDispatchTokens(MessageHolderWithTokens msg) throws InterruptedException { try { dispatchTokensEvent.fire(msg); return true; } catch (MessageDeliveryException e) { Throwable cause = e.getCause(); if (isQueueFullException(cause)) { return false; } throw e; } }
Source:
public void addTokenForOwnerStats(TokenIdent id) { String realOwner = getTokenRealOwner(id); tokenOwnerStats.put(realOwner, tokenOwnerStats.getOrDefault(realOwner, 0l)+1); }

Target:
private void addTokenForOwnerStats(TokenIdent id) { String realOwner = getTokenRealOwner(id); tokenOwnerStats.put(realOwner, tokenOwnerStats.getOrDefault(realOwner, 0L)+1); }
Source:
public int compare(Nameable nameable1, Nameable nameable2) { final String name1 = nameable1.getName(); final String name2 = nameable2.getName(); final NumericSuffixNormalizer numericSuffixNormalizer = new NumericSuffixNormalizer(); final List<String> normalizedNames = numericSuffixNormalizer.normalize(name1, name2); return ObjectUtils.compare(normalizedNames.get(0), normalizedNames.get(1)); }

Target:
public int compare(Nameable nameable1, Nameable nameable2) { final String name1 = nameable1.getName(); final String name2 = nameable2.getName(); final List<String> normalizedNames = numericSuffixNormalizer.normalize(name1, name2); return ObjectUtils.compare(normalizedNames.get(0), normalizedNames.get(1)); }
Source:
private void paintTableActions(final WTable table, final WebXmlRenderContext renderContext) { XmlStringBuilder xml = renderContext.getWriter(); List<WButton> tableActions = table.getActions(); if (!tableActions.isEmpty()) { boolean hasActions = false; for (WButton button : tableActions) { if (!button.isVisible()) { continue; } if (!hasActions) { hasActions = true; xml.appendTag("ui:actions"); } xml.appendTag("ui:action"); List<WTable.ActionConstraint> constraints = table.getActionConstraints(button); if (constraints != null) { for (WTable.ActionConstraint constraint : constraints) { int minRows = constraint.getMinSelectedRowCount(); int maxRows = constraint.getMaxSelectedRowCount(); String message = constraint.getMessage(); int selectedOnOther = table.getSelectedRows().size(); String type = constraint.isError() ? "error" : "warning"; xml.appendTagOpen("ui:condition"); xml.appendOptionalAttribute("minSelectedRows", minRows > 0, minRows); xml.appendOptionalAttribute("maxSelectedRows", maxRows > 0, maxRows); xml.appendOptionalAttribute("selectedOnOther", selectedOnOther); xml.appendAttribute("type", type); xml.appendAttribute("message", I18nUtilities.format(null, message)); xml.appendEnd(); } } button.paint(renderContext); xml.appendEndTag("ui:action"); } if (hasActions) { xml.appendEndTag("ui:actions"); } } }

Target:
private void paintTableActions(final WTable table, final WebXmlRenderContext renderContext) { XmlStringBuilder xml = renderContext.getWriter(); List<WButton> tableActions = table.getActions(); if (!tableActions.isEmpty()) { boolean hasActions = false; for (WButton button : tableActions) { if (!button.isVisible()) { continue; } if (!hasActions) { hasActions = true; xml.appendTag("ui:actions"); } xml.appendTag("ui:action"); List<WTable.ActionConstraint> constraints = table.getActionConstraints(button); if (constraints != null) { for (WTable.ActionConstraint constraint : constraints) { int minRows = constraint.getMinSelectedRowCount(); int maxRows = constraint.getMaxSelectedRowCount(); String message = constraint.getMessage(); String type = constraint.isError() ? "error" : "warning"; xml.appendTagOpen("ui:condition"); xml.appendOptionalAttribute("minSelectedRows", minRows > 0, minRows); xml.appendOptionalAttribute("maxSelectedRows", maxRows > 0, maxRows); xml.appendAttribute("selectedOnOther", this.selectedOnOther); xml.appendAttribute("type", type); xml.appendAttribute("message", I18nUtilities.format(null, message)); xml.appendEnd(); } } button.paint(renderContext); xml.appendEndTag("ui:action"); } if (hasActions) { xml.appendEndTag("ui:actions"); } } }
Source:
protected String getQuery(MultivaluedMap<String, String> queryParams) { String query = queryParams.getFirst(QUERY); if (query == null) { query = "SELECT * from Document"; } return query; }

Target:
protected String getQuery(MultivaluedMap<String, String> queryParams) { String query = queryParams.getFirst(QUERY); if (query == null) { query = "SELECT * FROM Document"; } return query; }
Source:
private TreeMap<Integer, Initiator> createIv2Initiators(Collection<Integer> partitions, StartAction startAction, List<Integer> m_partitionsToSitesAtStartupForExportInit) { TreeMap<Integer, Initiator> initiators = new TreeMap<>(); TransactionTaskQueue.resetScoreboards(m_messenger.getNextSiteId(), m_nodeSettings.getLocalSitesCount()); TransactionTaskQueue.initBarrier(m_nodeSettings.getLocalSitesCount()); for (Integer partition : partitions) { Initiator initiator = new SpInitiator(m_messenger, partition, getStatsAgent(), m_snapshotCompletionMonitor, startAction); initiators.put(partition, initiator); m_partitionsToSitesAtStartupForExportInit.add(partition); } return initiators; }

Target:
private TreeMap<Integer, Initiator> createIv2Initiators(Collection<Integer> partitions, StartAction startAction, List<Integer> m_partitionsToSitesAtStartupForExportInit) { TreeMap<Integer, Initiator> initiators = new TreeMap<>(); TransactionTaskQueue.resetScoreboards(m_messenger.getNextSiteId(), m_nodeSettings.getLocalSitesCount()); for (Integer partition : partitions) { Initiator initiator = new SpInitiator(m_messenger, partition, getStatsAgent(), m_snapshotCompletionMonitor, startAction); initiators.put(partition, initiator); m_partitionsToSitesAtStartupForExportInit.add(partition); } if (StartAction.JOIN.equals(startAction)) { TransactionTaskQueue.initBarrier(m_nodeSettings.getLocalSitesCount()); } return initiators; }
Source:
public Array<T> getElementsContainingArea(Shape area, boolean entirelyContained) { return null; }

Target:
public Array<T> getElementsContainingArea(Shape area, boolean entirelyContained) { return new Array<>(); }
Source:
protected Class<?>[] getTypes(ResourceMethod method) { Type superclass = method.getResource().getType().getGenericSuperclass(); if(!superclass.equals(Object.class)) { Type[] genericsTypes = getGenericsTypes(superclass); Class<?>[] classes = new Class<?>[genericsTypes.length]; for (int i = 0; i < genericsTypes.length; i++) { classes[i] = (Class<?>) genericsTypes[i]; } return classes; } return method.getMethod().getParameterTypes(); }

Target:
protected Class<?>[] getTypes(ResourceMethod method) { Class<?>[] parameterTypes = method.getMethod().getParameterTypes(); Type genericType = getGenericSuperClass(method); if (genericType != null) { return parseGenericParameters(parameterTypes, genericType); } return parameterTypes; }
Source:
public static boolean canReplicate(JoinNode joinNode, Context context) { PlanNode buildSide = joinNode.getRight(); PlanNodeStatsEstimate buildSideStatsEstimate = context.getStatsProvider().getStats(buildSide); double buildSideSizeInBytes = buildSideStatsEstimate.getOutputSizeInBytes(buildSide.getOutputSymbols(), context.getSymbolAllocator().getTypes()); JoinDistributionType joinDistributionType = getJoinDistributionType(context.getSession()); Optional<DataSize> joinMaxBroadcastTableSize = getJoinMaxBroadcastTableSize(context.getSession()); return joinDistributionType.canReplicate() && (!joinMaxBroadcastTableSize.isPresent() || buildSideSizeInBytes <= joinMaxBroadcastTableSize.get().toBytes()); }

Target:
public static boolean canReplicate(JoinNode joinNode, Context context) { JoinDistributionType joinDistributionType = getJoinDistributionType(context.getSession()); if (!joinDistributionType.canReplicate()) { return false; } Optional<DataSize> joinMaxBroadcastTableSize = getJoinMaxBroadcastTableSize(context.getSession()); if (!joinMaxBroadcastTableSize.isPresent()) { return true; } PlanNode buildSide = joinNode.getRight(); PlanNodeStatsEstimate buildSideStatsEstimate = context.getStatsProvider().getStats(buildSide); double buildSideSizeInBytes = buildSideStatsEstimate.getOutputSizeInBytes(buildSide.getOutputSymbols(), context.getSymbolAllocator().getTypes()); return buildSideSizeInBytes <= joinMaxBroadcastTableSize.get().toBytes(); }
Source:
private void updateShortcut() { final ShortcutDTO shortcut = getControl().getShortcut(); if (shortcut != null) { title.setValue(shortcut.getInfo().getName()); description.setValue(shortcut.getInfo().getDescription()); try { final Map<String, Object> shortcutProperties = getControl().getObjectMapper() .readValue(shortcut.getScript(), new TypeReference<Map<String, Object>>() { }); this.shortcutProperties.clear(); this.shortcutProperties.putAll(shortcutProperties); } catch (IOException e) { LOGGER.error("An error occurred during a Shortcut update", e); } } }

Target:
private void updateShortcut() { final ShortcutDTO shortcut = getControl().getShortcut(); if (shortcut != null) { title.setValue(shortcut.getInfo().getName()); description.setValue(shortcut.getInfo().getDescription()); try { final Map<String, Object> shortcutProperties = getControl().getObjectMapper() .readValue(shortcut.getScript(), new TypeReference<Map<String, Object>>() { }); this.shortcutProperties.clear(); this.shortcutProperties.putAll(shortcutProperties); } catch (IOException e) { LOGGER.error("An error occurred during a shortcut update", e); } } }
Source:
private PropertyChangeListener addSetMacroListener(final Macro displayMacro, final Collection<Macro> setMacros) { return new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent newValue) { Optional<Macro> existingMacro = setMacros.stream().filter(m -> m.getName().equals(displayMacro.getName())).findFirst(); if (existingMacro.isPresent()) { existingMacro.get().setValue(displayMacro.getValue()); } else { Macro newMacro = new Macro(displayMacro); setMacros.add(newMacro); } setMacros.removeIf(m -> m.getValue() == null); } }; }

Target:
private PropertyChangeListener addSetMacroListener(final Macro displayMacro, final Collection<Macro> setMacros) { return new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent newValue) { Optional<Macro> existingMacro = setMacros.stream().filter(m -> m.getName().equals(displayMacro.getName())).findFirst(); if (existingMacro.isPresent()) { if (displayMacro.getValue() != null) { existingMacro.get().setValue(displayMacro.getValue()); } else { setMacros.remove(existingMacro.get()); } } else { Macro newMacro = new Macro(displayMacro); setMacros.add(newMacro); } } }; }
Source:
HttpResponse uploadObject(ApiAddress address, Object object, Function<URI, R> requestConstructor) throws IOException { R request = buildRequest(address, requestConstructor); if (object != null) { String json = jsonService.serialize(object); try { request.setEntity(new StringEntity(json)); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } request.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON_CONTENT_TYPE); try (CloseableHttpResponse response = cachedRemoteReader.getResponse(request)) { response.close(); return response; } }

Target:
HttpResponse uploadObject(ApiAddress address, Object object, Function<URI, R> requestConstructor) throws IOException { R request = buildRequest(address, requestConstructor); if (object != null) { String json = jsonService.serialize(object); try { request.setEntity(new StringEntity(json)); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } } request.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON_CONTENT_TYPE); try (CloseableHttpResponse response = cachedRemoteReader.getResponse(request)) { return response; } }
Source:
public int compareTo(ActivityEvent object) { if (date == null && object.getDate() == null) { return 0; } if (date == null || object.getDate() == null) { return -1; } return date.compareTo(object.getDate()); }

Target:
public int compareTo(ActivityEvent object) { return CoreUtil.compare(date, object.getDate()); }
Source:
public synchronized void write(int b) throws IOException { if (readonly) throw new IOException("Remote file is read only."); try { outStream.write(("WRITE " + remoteOffset + " 1\r\n").getBytes(Sage.BYTE_CHARSET)); outStream.flush(); outStream.write(b); } catch (IOException e) { reconnect(); outStream.write(("WRITE " + remoteOffset + " 1\r\n").getBytes(Sage.BYTE_CHARSET)); outStream.flush(); outStream.write(b); } remoteOffset += 1; }

Target:
public synchronized void write(int b) throws IOException { if (readonly) throw new IOException("Remote file is read only."); try { outStream.write(("WRITE " + remoteOffset + " 1\r\n").getBytes(Sage.BYTE_CHARSET)); outStream.write(b); outStream.flush(); } catch (IOException e) { reconnect(); outStream.write(("WRITE " + remoteOffset + " 1\r\n").getBytes(Sage.BYTE_CHARSET)); outStream.write(b); outStream.flush(); } remoteOffset += 1; }
Source:
private static List<String> getCombinedStyles(Document getCapabilitiesXml, String layerName) { List<String> combinedStyles = new ArrayList<String>(); DefaultXPath xpath = new DefaultXPath(" Map<String,String> namespaces = new TreeMap<String, String>(); namespaces.put("x", "<LINK_0>"); xpath.setNamespaceURIs(namespaces); List<DefaultText> list = xpath.selectNodes(getCapabilitiesXml); for (final DefaultText text : list) { combinedStyles.add(text.getText()); } return combinedStyles; }

Target:
private static List<String> getCombinedStyles(Document getCapabilitiesXml, String layerName) { List<String> combinedStyles = new ArrayList<String>(); DefaultXPath xpath = new DefaultXPath(" Map<String,String> namespaces = new TreeMap<String, String>(); namespaces.put("x", "<LINK_0>"); xpath.setNamespaceURIs(namespaces); @SuppressWarnings("unchecked") List<DefaultText> list = xpath.selectNodes(getCapabilitiesXml); for (final DefaultText text : list) { combinedStyles.add(text.getText()); } return combinedStyles; }
Source:
private static HttpCookie parseLine(String line, Date creationDate) { if (line.isEmpty() || (line.startsWith("#") && !line.startsWith(HTTP_ONLY_PREAMBLE))) { return null; } String[] cookieLineParts = line.split(COLUMN_SEPARATOR, 7); if (cookieLineParts == null) { throw new IllegalArgumentException( "Did not find any tab in line " + line); } if (cookieLineParts.length < 7) { throw new IllegalArgumentException( "Each line must consist of 7 tab separated entries, found only " + cookieLineParts.length); } String name = cookieLineParts[5]; String value = cookieLineParts[6]; HttpCookie cookie = new HttpCookie(name, value); String domain = cookieLineParts[0]; if (domain.startsWith(HTTP_ONLY_PREAMBLE)) { cookie.setHttpOnly(true); domain = domain.substring(HTTP_ONLY_PREAMBLE.length()); } cookie.setDomain(domain); cookie.setPath(cookieLineParts[2]); cookie.setSecure(Boolean.parseBoolean(cookieLineParts[3])); long expires = Long.parseLong(cookieLineParts[4]); if (creationDate == null) { creationDate = new Date(); } long maxAge = (expires - creationDate.getTime()) / 1000; if (maxAge < 0) { maxAge = -1; } cookie.setMaxAge(maxAge); return cookie; }

Target:
private static HttpCookie parseLine(String line, Date creationDate) { if (line.isEmpty() || (line.startsWith("#") && !line.startsWith(HTTP_ONLY_PREAMBLE))) { return null; } String[] cookieLineParts = line.split(COLUMN_SEPARATOR, 7); if (cookieLineParts == null) { throw new IllegalArgumentException(MessageFormat .format(JGitText.get().couldNotFindTabInLine, line)); } if (cookieLineParts.length < 7) { throw new IllegalArgumentException(MessageFormat.format( JGitText.get().couldNotFindSixTabsInLine, cookieLineParts.length, line)); } String name = cookieLineParts[5]; String value = cookieLineParts[6]; HttpCookie cookie = new HttpCookie(name, value); String domain = cookieLineParts[0]; if (domain.startsWith(HTTP_ONLY_PREAMBLE)) { cookie.setHttpOnly(true); domain = domain.substring(HTTP_ONLY_PREAMBLE.length()); } cookie.setDomain(domain); cookie.setPath(cookieLineParts[2]); cookie.setSecure(Boolean.parseBoolean(cookieLineParts[3])); long expires = Long.parseLong(cookieLineParts[4]); if (creationDate == null) { creationDate = new Date(); } long maxAge = (expires - creationDate.getTime()) / 1000; if (maxAge < 0) { maxAge = -1; } cookie.setMaxAge(maxAge); return cookie; }
Source:
public void setupMonitor() { if (monitoringInterval > 0) { executorService.scheduleAtFixedRate(() -> monitorClouderaManagerDescriptors(null), 0, monitoringInterval, TimeUnit.MILLISECONDS); LOG.monitoringClouderaManagerDescriptor(descriptorsDir); } }

Target:
public void setupMonitor() { if (monitoringInterval > 0) { final ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(new BasicThreadFactory.Builder().namingPattern("ClouderaManagerDescriptorMonitor-%d").build()); executorService.scheduleAtFixedRate(() -> monitorClouderaManagerDescriptors(null), 0, monitoringInterval, TimeUnit.MILLISECONDS); LOG.monitoringClouderaManagerDescriptor(descriptorsDir); } }
Source:
public boolean isEmpty() { return (fInputBuffer.isEmpty() && fOutputBuffer.isEmpty() && fInnerQueue.isEmpty()); }

Target:
public boolean isEmpty() { fOutputLock.lock(); try { return (fInputBuffer.isEmpty() && fOutputBuffer.isEmpty() && fInnerQueue.isEmpty()); } finally { fOutputLock.unlock(); } }
Source:
public void when_formUploaderIsRunning_should_appropriateResultBeReturned() { doReturn(true).when(storageMigrator).isFormUploaderRunning(); assertThat(storageMigrator.performStorageMigration(), is(StorageMigrationResult.FORM_UPLOADER_IS_RUNNING)); }

Target:
public void when_formUploaderIsRunning_should_appropriateResultBeReturned() { doReturn(true).when(storageMigrator).isFormUploaderRunning(); assertThat(storageMigrator.migrate(), is(StorageMigrationResult.FORM_UPLOADER_IS_RUNNING)); }
Source:
protected boolean canDoAction() { if (getParameters() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID); return false; } else if (!QuotaHelper.getInstance().checkQuotaValidationForAddEdit(getParameters().getQuota(), getReturnValue().getCanDoActionMessages())) { return false; } else if (getParameters().getQuota().getId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID); return false; } return true; }

Target:
protected boolean canDoAction() { if (!QuotaHelper.getInstance().checkQuotaValidationForAddEdit(getParameters().getQuota(), getReturnValue().getCanDoActionMessages())) { return false; } else if (getParameters().getQuota().getId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID); return false; } else if (getQuotaDAO().getById(getParameters().getQuota().getId()) == null) { } return true; }
Source:
private void connectAndRefreshAllUpHosts(final boolean commandSucceeded) { try { for (VDS vds : getAllRunningVdssInPool()) { try { VDSReturnValue returnValue = null; if (!_isLastMaster && commandSucceeded && !getVds().equals(vds)) { returnValue = executeRefreshStoragePoolCommand(vds); if (!returnValue.getSucceeded()) { log.errorFormat("Post reconstruct actions (refreshPool) did not complete on host {0} in the pool. error {1}", vds.getId(), returnValue.getVdsError().getMessage()); } } if (returnValue == null || returnValue.getSucceeded()) { returnValue = executeConnectStoragePoolCommand(vds); if (!returnValue.getSucceeded()) { log.errorFormat("Post reconstruct actions (connectPool) did not complete on host {0} in the pool. error {1}", vds.getId(), returnValue.getVdsError().getMessage()); } } if (getParameters().isInactive()) { StorageHelperDirector.getInstance() .getItem(getStorageDomain().getstorage_type()) .DisconnectStorageFromDomainByVdsId(getStorageDomain(), vds.getId()); } } catch (Exception e) { log.errorFormat("Post reconstruct actions (connectPool,refreshPool,disconnect storage)" + " did not complete on host {0} in the pool. error {1}", vds.getId(), e.getMessage()); } } } catch (Exception ex) { log.errorFormat("Post reconstruct actions (connectPool,refreshPool,disconnect storage)" + " did not complete on all up hosts in the pool. error {0}", ex.getMessage()); } }

Target:
private void connectAndRefreshAllUpHosts(final boolean commandSucceeded) { try { for (VDS vds : getAllRunningVdssInPool()) { try { if (!_isLastMaster && commandSucceeded) { if (!getVds().equals(vds)) { executeRefreshStoragePoolCommand(vds); } VDSReturnValue returnValue = executeConnectStoragePoolCommand(vds); if (!returnValue.getSucceeded()) { log.errorFormat("Post reconstruct actions (connectPool) did not complete on host {0} in the pool. error {1}", vds.getId(), returnValue.getVdsError().getMessage()); } } if (getParameters().isInactive()) { StorageHelperDirector.getInstance() .getItem(getStorageDomain().getstorage_type()) .DisconnectStorageFromDomainByVdsId(getStorageDomain(), vds.getId()); } } catch (Exception e) { log.errorFormat("Post reconstruct actions (connectPool,refreshPool,disconnect storage)" + " did not complete on host {0} in the pool. error {1}", vds.getId(), e.getMessage()); } } } catch (Exception ex) { log.errorFormat("Post reconstruct actions (connectPool,refreshPool,disconnect storage)" + " did not complete on all up hosts in the pool. error {0}", ex.getMessage()); } }
Source:
public static String getResponseFromServer(final URL constructedUrl, final HttpURLConnectionFactory factory, final String encoding) { HttpURLConnection conn = null; InputStreamReader in = null; try { conn = factory.buildHttpURLConnection(constructedUrl.openConnection()); if (CommonUtils.isEmpty(encoding)) { in = new InputStreamReader(conn.getInputStream()); } else { in = new InputStreamReader(conn.getInputStream(), encoding); } final StringBuilder builder = new StringBuilder(255); int byteRead; while ((byteRead = in.read()) != -1) { builder.append((char) byteRead); } return builder.toString(); } catch (final SSLException e) { LOGGER.error("SSL error getting response from host: : Error Message: {}", constructedUrl.getHost(), e.getMessage(), e); throw new RuntimeException(e); } catch (final Exception e) { LOGGER.error("Error getting response from host: with path: and protocol: {}: Error Message: {}", constructedUrl.getHost(), constructedUrl.getPath(), constructedUrl.getProtocol(), e.getMessage(), e); throw new RuntimeException(e); } finally { closeQuietly(in); if (conn != null) { conn.disconnect(); } } }

Target:
public static String getResponseFromServer(final URL constructedUrl, final HttpURLConnectionFactory factory, final String encoding) { HttpURLConnection conn = null; InputStreamReader in = null; try { conn = factory.buildHttpURLConnection(constructedUrl.openConnection()); if (CommonUtils.isEmpty(encoding)) { in = new InputStreamReader(conn.getInputStream()); } else { in = new InputStreamReader(conn.getInputStream(), encoding); } final StringBuilder builder = new StringBuilder(255); int byteRead; while ((byteRead = in.read()) != -1) { builder.append((char) byteRead); } return builder.toString(); } catch (final RuntimeException e) { throw e; } catch (final SSLException e) { LOGGER.error("SSL error getting response from host: : Error Message: {}", constructedUrl.getHost(), e.getMessage(), e); throw new RuntimeException(e); } catch (final IOException e) { LOGGER.error("Error getting response from host: with path: and protocol: Error Message: {}", constructedUrl.getHost(), constructedUrl.getPath(), constructedUrl.getProtocol(), e.getMessage(), e); throw new RuntimeException(e); } finally { closeQuietly(in); if (conn != null) { conn.disconnect(); } } }
Source:
public void endWindow() { boolean isTimeUnifiedStore = (store instanceof ManagedTimeUnifiedStateImpl); for (K key: cache.getChangedKeys()) { long timeOrBucketId = getBucket(key); long bucketId = timeOrBucketId; if (isTimeUnifiedStore) { bucketId = ((ManagedTimeUnifiedStateImpl)store).getTimeBucketId(timeOrBucketId); } keyValueSerdeManager.updateBuffersForBucketChange(bucketId); store.put(timeOrBucketId, keyValueSerdeManager.serializeDataKey(key, true), keyValueSerdeManager.serializeValue(cache.get(key))); } for (K key: cache.getRemovedKeys()) { long timeOrBucketId = getBucket(key); long bucketId = timeOrBucketId; if (isTimeUnifiedStore) { bucketId = ((ManagedTimeUnifiedStateImpl)store).getTimeBucketId(timeOrBucketId); } keyValueSerdeManager.updateBuffersForBucketChange(bucketId); store.put(timeOrBucketId, keyValueSerdeManager.serializeDataKey(key, true), BufferSlice.EMPTY_SLICE); } cache.endWindow(); keyValueSerdeManager.resetReadBuffer(); }

Target:
public void endWindow() { boolean isTimeUnifiedStore = (store instanceof ManagedTimeUnifiedStateImpl); for (K key: cache.getChangedKeys()) { long timeOrBucketId = bucket; long bucketId = timeOrBucketId; if (isTimeUnifiedStore) { timeOrBucketId = getBucketTimeOrId(key); bucketId = ((ManagedTimeUnifiedStateImpl)store).getTimeBucketAssigner().getTimeBucket(timeOrBucketId); } keyValueSerdeManager.updateBuffersForBucketChange(bucketId); store.put(timeOrBucketId, keyValueSerdeManager.serializeDataKey(key, true), keyValueSerdeManager.serializeValue(cache.get(key))); } for (K key: cache.getRemovedKeys()) { long timeOrBucketId = bucket; long bucketId = timeOrBucketId; if (isTimeUnifiedStore) { timeOrBucketId = getBucketTimeOrId(key); bucketId = ((ManagedTimeUnifiedStateImpl)store).getTimeBucketAssigner().getTimeBucket(timeOrBucketId); } keyValueSerdeManager.updateBuffersForBucketChange(bucketId); store.put(timeOrBucketId, keyValueSerdeManager.serializeDataKey(key, true), BufferSlice.EMPTY_SLICE); } cache.endWindow(); keyValueSerdeManager.resetReadBuffer(); }
Source:
public void testWriteBool() { final boolean expected = false; final String tag = "tag1"; checkWriterAndReader( (oa) -> oa.writeBool(expected, tag), (ia) -> { boolean actual = ia.readBool(tag); Assert.assertEquals(expected, actual); } ); }

Target:
public void testWriteBool() { final boolean expected = false; final String tag = "tag1"; checkWriterAndReader( (oa) -> oa.writeBool(expected, tag), (ia) -> { boolean actual = ia.readBool(tag); assertEquals(expected, actual); } ); }
Source:
public Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException { RestPage<TaskStateData> page = null; try { page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit); } catch (NotConnectedRestException e) { throw new NotConnectedException(e); } catch (PermissionRestException e) { throw new PermissionException(e); } List<TaskId> lTaskIds = new ArrayList<TaskId>(page.getList().size()); for (TaskStateData taskStateData : page.getList()) { JobId jobId = new JobIdImpl(taskStateData.getTaskInfo().getJobId().getId(), taskStateData.getTaskInfo().getJobId().getReadableName()); TaskId taskId = TaskIdImpl.createTaskId(jobId, taskStateData.getTaskInfo().getTaskId().getReadableName(), taskStateData.getTaskInfo().getTaskId().getId()); lTaskIds.add(taskId); } return new Page<TaskId>(lTaskIds, page.getSize()); }

Target:
public Page<TaskId> getTaskIds(String taskTag, long from, long to, boolean mytasks, boolean running, boolean pending, boolean finished, int offset, int limit) throws NotConnectedException, PermissionException { RestPage<TaskStateData> page = null; try { page = restApi().getTaskStates(sid, from, to, mytasks, running, pending, finished, offset, limit); } catch (NotConnectedRestException e) { throw new NotConnectedException(e); } catch (PermissionRestException e) { throw new PermissionException(e); } List<TaskId> lTaskIds = new ArrayList<TaskId>(page.getList().size()); for (TaskStateData taskStateData : page.getList()) { TaskInfoData taskInfo = taskStateData.getTaskInfo(); TaskIdData taskIdData = taskInfo.getTaskId(); JobId jobId = new JobIdImpl(taskInfo.getJobId().getId(), taskInfo.getJobId().getReadableName()); TaskId taskId = TaskIdImpl.createTaskId(jobId, taskIdData.getReadableName(), taskIdData.getId()); lTaskIds.add(taskId); } return new Page<TaskId>(lTaskIds, page.getSize()); }
Source:
public HttpRequest filterKey(HttpRequest request) throws HttpException { request = replaceDateHeader(request); String signature = calculateSignature(createStringToSign(request)); request = replaceAuthorizationHeader(request, signature); return request; }

Target:
public HttpRequest filterKey(HttpRequest request) throws HttpException { request = replaceDateHeader(request); String signature = calculateSignature(createStringToSign(request)); return replaceAuthorizationHeader(request, signature); }
Source:
public void connect(IDocument doc) { if (doc == document) { return; } synchronized (partitions) { disconnect(); if (doc != null) { inputPartitions = new ArrayList<>(); document = doc; legalLineDelimiterMatcher = MultiStringMatcher.create(document.getLegalLineDelimiters()); } } }

Target:
public void connect(IDocument doc) { if (doc == document) { return; } disconnect(); if (doc != null) { synchronized (partitions) { inputPartitions = new ArrayList<>(); document = doc; legalLineDelimiterMatcher = MultiStringMatcher.create(document.getLegalLineDelimiters()); } } }
Source:
public void testMultiPartitionCURRENT_TIMESTAMP() throws IOException, ProcCallException { if (!isHSQL()) { Client client = getClient(); client.callProcedure(CurrentTimestampProcedure.class.getSimpleName()); } }

Target:
public void testMultiPartitionCURRENT_TIMESTAMP() throws IOException, ProcCallException { if (isHSQL()) { return; } Client client = getClient(); client.callProcedure(CurrentTimestampProcedure.class.getSimpleName()); }
Source:
public void do2DQuery(ITmfStateIntervalList stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { if (!checkValidTime(t)) { throw new TimeRangeException(); } CoreNode currentNode = sht.getLatestBranch().get(0); currentNode.writeInfoFromNode(stateInfo); try { while (currentNode.getNbChildren() > 0) { currentNode = (CoreNode) sht.selectNextChild(currentNode, t); currentNode.writeInfoFromNode(stateInfo); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } return; }

Target:
public void do2DQuery(ITmfStateIntervalList stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { if (!checkValidTime(t)) { throw new TimeRangeException(); } CoreNode currentNode = sht.getLatestBranch().get(0); currentNode.writeInfoFromNode(stateInfo); try { while (currentNode.getNbChildren() > 0) { currentNode = (CoreNode) sht.selectNextChild(currentNode, t); currentNode.writeInfoFromNode(stateInfo); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } }
Source:
public void setStacktrace(@NonNull List<Stackframe> stacktrace) { if (stacktrace != null) { impl.setStacktrace(stacktrace); } else { error("stacktrace"); } }

Target:
public void setStacktrace(@NonNull List<Stackframe> stacktrace) { if (!CollectionUtils.containsNullElements(stacktrace)) { impl.setStacktrace(stacktrace); } else { logNull("stacktrace"); } }
Source:
synchronized private void flush() { lastFlush.set(System.nanoTime()); if (!leaseManager.stillInLeasePeriod()) { if (batch.getNumEvents() > 0) { writer.clearWriteBuffer(); panicker.panic("Replica " + tsoHostAndPort + " lost mastership before flushing data. Committing suicide"); } } else { try { writer.flush(); } catch (IOException e) { panicker.panic("Error persisting commit batch", e.getCause()); } batchSizeHistogram.update(batch.getNumEvents()); if (!leaseManager.stillInLeasePeriod()) { panicker.panic("Replica " + tsoHostAndPort + " lost mastership after flushing data. Committing suicide"); } } flushTimer.update((System.nanoTime() - lastFlush.get())); batch.sendRepliesAndReset(reply, retryProc); }

Target:
synchronized private void flush() { if (batch.getNumEvents() > 0) { lastFlush.set(System.nanoTime()); commitSuicideIfNotMaster(); try { writer.flush(); batchSizeHistogram.update(batch.getNumEvents()); } catch (IOException e) { panicker.panic("Error persisting commit batch", e); } commitSuicideIfNotMaster(); flushTimer.update((System.nanoTime() - lastFlush.get())); batch.sendRepliesAndReset(reply, retryProc); } }
Source:
protected Timestamp doBackward(String s) { try { return Timestamps.parse(s); } catch (ParseException e) { final ConversionError conversionError = new ConversionError(e.getMessage(), e.getErrorOffset()); throw new IllegalArgumentException(conversionError); } }

Target:
protected Timestamp doBackward(String s) { try { return Timestamps.parse(s); } catch (ParseException e) { final ConversionError conversionError = new ConversionError(e.getMessage()); throw new IllegalConversionArgumentException(conversionError); } }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View courseUnitOnlyOnYoutubeView = inflater.inflate(R.layout.fragment_course_unit_only_on_youtube, container, false); if (environment.getConfig().getEmbeddedYoutubeConfig().isYoutubeEnabled()) { ((TextView) courseUnitOnlyOnYoutubeView.findViewById(R.id.only_youtube_available_message)).setText(R.string.assessment_needed_updating_youtube); courseUnitOnlyOnYoutubeView.findViewById(R.id.update_youtube_button).setVisibility(View.VISIBLE); courseUnitOnlyOnYoutubeView.findViewById(R.id.update_youtube_button).setOnClickListener(v -> { final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(AppConstants.BROWSER_PLAYSTORE_YOUTUBE_URI)); startActivity(intent); }); } courseUnitOnlyOnYoutubeView.findViewById(R.id.view_on_youtube_button).setOnClickListener(v -> { final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(((VideoBlockModel) unit).getData().encodedVideos.youtube.url)); startActivity(intent); }); return courseUnitOnlyOnYoutubeView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_course_unit_only_on_youtube, container, false); TextView tvYouTubeMessage = view.findViewById(R.id.only_youtube_available_message); if (environment.getConfig().getYoutubePlayerConfig().isYoutubePlayerEnabled()) { tvYouTubeMessage.setText(R.string.assessment_needed_updating_youtube); view.findViewById(R.id.update_youtube_button).setVisibility(View.VISIBLE); view.findViewById(R.id.update_youtube_button).setOnClickListener(v -> { BrowserUtil.open(getActivity(), AppConstants.BROWSER_PLAYSTORE_YOUTUBE_URI); }); } else { tvYouTubeMessage.setText(R.string.assessment_only_on_youtube); } view.findViewById(R.id.view_on_youtube_button).setOnClickListener(v -> { BrowserUtil.open(getActivity(), ((VideoBlockModel) unit).getData().encodedVideos.youtube.url); }); return view; }
Source:
public void start(){ if (started.compareAndSet(false, true)){ for (final KafkaStream<byte[], byte[]> stream: streams){ executorService.execute(new Runnable() { @Override public void run() { while (!closed.get()) { try { String input = null; ConsumerIterator<byte[], byte[]> it = stream.iterator(); while(it.hasNext()){ input = new String(it.next().message()); if (outputEmitter == null) { throw new RuntimeException("OutputEmitter should be set in " + BaseSourceGenerator.class.getName()); } if (input.equals("")) { Thread.sleep(sleepTime); } else { outputEmitter.emit(input); } } } catch (final InterruptedException e){ e.printStackTrace(); } } } }); } } }

Target:
public void start() { if (started.compareAndSet(false, true)) { final KafkaStream<byte[], byte[]> stream = streams.get(0); executorService.execute(new Runnable() { @Override public void run() { while (!closed.get()) { try { String input; final ConsumerIterator<byte[], byte[]> it = stream.iterator(); while(it.hasNext()){ input = new String(it.next().message()); if (outputEmitter == null) { throw new RuntimeException("OutputEmitter should be set in " + BaseSourceGenerator.class.getName()); } if (input.equals("")) { Thread.sleep(sleepTime); } else { outputEmitter.emit(input); } } } catch (final InterruptedException e) { e.printStackTrace(); } } } }); } }
Source:
public void validate(String ownerId, Collection<String> serviceLevels) { Set<String> invalidServiceLevels = new HashSet<>(); for (String serviceLevel : serviceLevels) { if (!StringUtils.isBlank(serviceLevel)) { boolean found = false; for (String level : poolManager.retrieveServiceLevelsForOwner(ownerId, false)) { if (serviceLevel.equalsIgnoreCase(level)) { found = true; break; } } if (!found) { invalidServiceLevels.add(serviceLevel); } } } if (!invalidServiceLevels.isEmpty()) { Owner owner = ownerCurator.findOwnerById(ownerId); String error = i18n.tr("Service level \"{0}\" is not available to units of organization {1}.", StringUtils.join(invalidServiceLevels, ", "), owner.getKey()); throw new RuleValidationException(error); } }

Target:
private void validate(String ownerId, Collection<String> serviceLevels) { Set<String> invalidServiceLevels = new HashSet<>(); for (String serviceLevel : serviceLevels) { if (!StringUtils.isBlank(serviceLevel)) { boolean found = false; for (String level : poolManager.retrieveServiceLevelsForOwner(ownerId, false)) { if (serviceLevel.equalsIgnoreCase(level)) { found = true; break; } } if (!found) { invalidServiceLevels.add(serviceLevel); } } } if (!invalidServiceLevels.isEmpty()) { Owner owner = ownerCurator.findOwnerById(ownerId); String error = i18n.tr("Service level \"{0}\" is not available to units of organization {1}.", StringUtils.join(invalidServiceLevels, ", "), owner.getKey()); throw new SlaValidationException(error); } }
Source:
private void addEntryToZip(String path, String srcFile, ZipOutputStream zip, boolean isFolder, boolean isManifest) throws IOException { File entry = new File(srcFile); if (isFolder == true) { zip.putNextEntry(new ZipEntry(path + SEPARATOR + entry.getName() + SEPARATOR)); } else { if (entry.isDirectory()) { addFolderToZip(path, srcFile, zip); } else { byte[] buf = new byte[8192]; int len; FileInputStream in = new FileInputStream(srcFile); ZipEntry zipEntry = isManifest ? new ZipEntry(entry.getName()) : new ZipEntry(path + SEPARATOR + entry.getName()); zip.putNextEntry(zipEntry); while ((len = in.read(buf)) > 0) { zip.write(buf, 0, len); } } } }

Target:
private void addEntryToZip(String path, String srcFile, ZipOutputStream zip, boolean isFolder, boolean isManifest) throws IOException { File entry = new File(srcFile); if (isFolder == true) { zip.putNextEntry(new ZipEntry(path + SEPARATOR + entry.getName() + SEPARATOR)); } else { if (entry.isDirectory()) { addFolderToZip(path, srcFile, zip); } else { byte[] buf = new byte[8192]; int len; ZipEntry zipEntry = isManifest ? new ZipEntry(entry.getName()) : new ZipEntry(path + SEPARATOR + entry.getName()); zip.putNextEntry(zipEntry); try (FileInputStream in = new FileInputStream(srcFile)) { while ((len = in.read(buf)) > 0) { zip.write(buf, 0, len); } } } } }
Source:
public void testResolveUserWithUnresolvedUser() throws Exception { ParseACL acl = new ParseACL(); ParseUser unresolvedUser = new ParseUser(); setLazy(unresolvedUser); acl.setReadAccess(unresolvedUser, true); acl.setWriteAccess(unresolvedUser, true); unresolvedUser.setObjectId("test"); acl.resolveUser(unresolvedUser); unresolvedUser.setObjectId("test"); assertNull(acl.getUnresolvedUser()); assertTrue(acl.getReadAccess(unresolvedUser)); assertTrue(acl.getWriteAccess(unresolvedUser)); assertEquals(1, acl.getPermissionsById().length()); assertFalse(acl.getPermissionsById().has(UNRESOLVED_KEY)); }

Target:
public void testResolveUserWithUnresolvedUser() throws Exception { ParseACL acl = new ParseACL(); ParseUser unresolvedUser = new ParseUser(); setLazy(unresolvedUser); acl.setReadAccess(unresolvedUser, true); acl.setWriteAccess(unresolvedUser, true); unresolvedUser.setObjectId("test"); acl.resolveUser(unresolvedUser); assertNull(acl.getUnresolvedUser()); assertTrue(acl.getReadAccess(unresolvedUser)); assertTrue(acl.getWriteAccess(unresolvedUser)); assertEquals(1, acl.getPermissionsById().length()); assertFalse(acl.getPermissionsById().has(UNRESOLVED_KEY)); }
Source:
public void testOutOfOrderCreatedInCurrentTimeIsDisplayedInHomeNowTile() { String startDate = testData.get(3).get("Start date (days to add)"); String endDate = testData.get(3).get("End date (days to add)"); String startTime = testData.get(3).get("Start time (minutes to add)"); String endTime = testData.get(3).get("End time (minutes to add)"); String description = testData.get(3).get("Description"); HomeAdminPage homeAdminPage = new HomeAdminPage(); RoomsPage conferenceRoom = homeAdminPage.clickConferenceRoomsLink(); RoomOutOfOrderPlanningPage outOfOrder = conferenceRoom .doubleClickOverRoomName(roomName) .clickOutOfOrderPlanningLink(); conferenceRoom = outOfOrder .setOutOfOrderPeriodInformation(startDate, endDate, startTime, endTime, title, description) .activateOutOfOrder() .clickSaveOutOfOrderBtn(); HomeTabletPage homeTabletPage = new HomeTabletPage(); SettingsPage settingsPage = homeTabletPage.clickSettingsBtn(); homeTabletPage = settingsPage.selectRoom(roomName); Assert.assertEquals(homeTabletPage.getNowTileLbl(), title); }

Target:
public void testOutOfOrderCreatedInCurrentTimeIsDisplayedInHomeNowTile() { String startDate = testData.get(3).get("Start date (days to add)"); String endDate = testData.get(3).get("End date (days to add)"); String startTime = testData.get(3).get("Start time (minutes to add)"); String endTime = testData.get(3).get("End time (minutes to add)"); String description = testData.get(3).get("Description"); HomeAdminPage homeAdminPage = new HomeAdminPage(); RoomsPage roomsPage = homeAdminPage.clickConferenceRoomsLink(); RoomInfoPage roomInfoPage = roomsPage.doubleClickOverRoomName(roomName); RoomOutOfOrderPlanningPage outOfOrderPage = roomInfoPage.clickOutOfOrderPlanningLink(); roomsPage = outOfOrderPage .setOutOfOrderPeriodInformation(startDate, endDate, startTime, endTime, title, description) .activateOutOfOrder() .clickSaveOutOfOrderBtn(); HomeTabletPage homeTabletPage = new HomeTabletPage(); SettingsPage settingsPage = homeTabletPage.clickSettingsBtn(); homeTabletPage = settingsPage.selectRoom(roomName); Assert.assertEquals(homeTabletPage.getNowTileLbl(), title); }
Source:
private List<Artifact> getNewDependencies(List<Dependency> dependencies, List<Dependency> existingDependencies) throws MojoExecutionException { List<Artifact> updatedArtifacts = new ArrayList<Artifact>(); for (Dependency dep : dependencies) { boolean newDependency = true; for (Dependency existingDep : existingDependencies) { if (dep.getArtifactId().equals(existingDep.getArtifactId())) { newDependency = false; } } if (newDependency) { log.debug("New dependency found: " + dep.getArtifactId()); Artifact artifact = getArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getType(), dep.getVersion()); updatedArtifacts.add(artifact); } } return updatedArtifacts; }

Target:
private List<Artifact> getNewDependencies(List<Dependency> dependencies, List<Dependency> existingDependencies) throws MojoExecutionException { List<Artifact> updatedArtifacts = new ArrayList<Artifact>(); for (Dependency dep : dependencies) { boolean newDependency = true; for (Dependency existingDep : existingDependencies) { if (dep.getArtifactId().equals(existingDep.getArtifactId())) { newDependency = false; break; } } if (newDependency) { log.debug("New dependency found: " + dep.getArtifactId()); Artifact artifact = getArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getType(), dep.getVersion()); updatedArtifacts.add(artifact); } } return updatedArtifacts; }