auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setupProperties() { super.setupProperties(); name.setValue(""); applicationName.setValue(""); oAuthMethod.setPossibleValues(OAuthMethod.values()); oAuthMethod.setValue(OAuthMethod.InstalledApplicationWithIdAndSecret); accessToken.setValue(""); clientId.setValue(""); clientSecret.setValue(""); clientSecretFile.setValue(""); serviceAccountFile.setValue(""); dsPath = ".credentials/talend-googledrive"; try { dsPath = Paths.get(System.getProperty("user.home"), ".credentials/talend-googledrive").toAbsolutePath().toString(); dsPath = dsPath.replace("\\", "/"); } catch (Exception e) { } datastorePath.setValue(dsPath); useProxy.setValue(false); proxyHost.setValue("127.0.0.1"); proxyPort.setValue(8087); useSSL.setValue(false); sslAlgorithm.setValue("SSL"); }

Target:
public void setupProperties() { super.setupProperties(); name.setValue(""); applicationName.setValue(""); oAuthMethod.setPossibleValues(OAuthMethod.values()); oAuthMethod.setValue(OAuthMethod.InstalledApplicationWithIdAndSecret); accessToken.setValue(""); clientId.setValue(""); clientSecret.setValue(""); clientSecretFile.setValue(""); serviceAccountFile.setValue(""); dsPath = Paths.get(System.getProperty("user.home", "."), PATH_CREDENTIALS_TALEND_GOOGLEDRIVE); datastorePath.setValue(dsPath.toAbsolutePath().toString()); useProxy.setValue(false); proxyHost.setValue("127.0.0.1"); proxyPort.setValue(8087); useSSL.setValue(false); sslAlgorithm.setValue("SSL"); }
Source:
protected void sendReplies(Object processorResult, Message message) { Object replyChannelHeader = null; if (message != null) { replyChannelHeader = message.getHeaders().getReplyChannel(); } Object replyChannel = super.getOutputChannel(); if (super.getOutputChannel() == null) { replyChannel = replyChannelHeader; } Assert.notNull(replyChannel, "no outputChannel or replyChannel header available"); if (processorResult instanceof Iterable<?> && shouldSendMultipleReplies((Iterable<?>) processorResult)) { for (Object next : (Iterable<?>) processorResult) { this.sendReplyMessage(next, replyChannel); } } else { this.sendReplyMessage(processorResult, replyChannel); } }

Target:
protected void sendReplies(Object processorResult, Message message) { Object replyChannelHeader = null; if (message != null) { replyChannelHeader = message.getHeaders().getReplyChannel(); } if (getOutputChannelName() != null) { synchronized (this) { if (getOutputChannelName() != null) { try { setOutputChannel(getBeanFactory().getBean(getOutputChannelName(), MessageChannel.class)); setOutputChannelName(null); } catch (BeansException e) { throw new DestinationResolutionException("Failed to look up MessageChannel with name '" + getOutputChannelName() + "' in the BeanFactory."); } } } } Object replyChannel = getOutputChannel(); if (replyChannel == null) { replyChannel = replyChannelHeader; } Assert.notNull(replyChannel, "no outputChannel or replyChannel header available"); if (processorResult instanceof Iterable<?> && shouldSendMultipleReplies((Iterable<?>) processorResult)) { for (Object next : (Iterable<?>) processorResult) { this.sendReplyMessage(next, replyChannel); } } else { this.sendReplyMessage(processorResult, replyChannel); } }
Source:
private void initAudioTrackIndexIfNeeded() { if (!mProto.hasAudioTrackIndex()) { mProto = mProto.toBuilder().setAudioTrackIndex(mProto.getAudioTrackIndex()).build(); } }

Target:
private void initAudioTrackIndexIfNeeded() { if (!mProto.hasAudioTrackIndex()) { selectAudioTrack(mProto.getAudioTrackIndex()); } }
Source:
private List<ChangeLogSet<? extends Entry>> getChanges(Run<?,?> run) { if(run instanceof AbstractBuild) return ((AbstractBuild<?,?>) run).getChangeSets(); else if(run instanceof WorkflowRun) return ((WorkflowRun)run).getChangeSets(); else throw new IllegalArgumentException("Unsupported job type "+run.getClass().getName()); }

Target:
private static List<ChangeLogSet<? extends Entry>> getChanges(Run<?,?> run) { if(run instanceof AbstractBuild) { return ((AbstractBuild<?,?>) run).getChangeSets(); } else if(run == null) { throw new IllegalStateException("run cannot be null!"); } else { return getChangesUsingReflection(run); } }
Source:
public static void startNewConv(){ boolean match = false; System.out.println(getConvReceiver((String)Global.list.getSelectedValue()).getPhoneNumber()); for(int i = 0; i < currentConvs.size(); i++){ if(getConvReceiver((String)Global.list.getSelectedValue()).getFirstName().equals(currentConvs.get(i).getFirstName()) && getConvReceiver((String)Global.list.getSelectedValue()).getPhoneNumber().equals(currentConvs.get(i).getPhoneNumber())){ match = true; } } if(!match){ currentConvs.add(getConvReceiver((String)Global.list.getSelectedValue())); createTab(getConvReceiver((String)Global.list.getSelectedValue())); } }

Target:
public static void startNewConv(){ boolean match = false; System.out.println(getConvReceiver((String)Global.list.getSelectedValue()).getPhoneNumber()); for(int i = 0; i < currentConvs.size(); i++){ if(getConvReceiver((String)Global.list.getSelectedValue()).getFirstName().equals(currentConvs.get(i).getFirstName()) && getConvReceiver((String)Global.list.getSelectedValue()).getPhoneNumber().equals(currentConvs.get(i).getPhoneNumber())){ match = true; break; } } if(!match){ currentConvs.add(getConvReceiver((String)Global.list.getSelectedValue())); createTab(getConvReceiver((String)Global.list.getSelectedValue())); } }
Source:
public void contains_customEqualMethod() { RealmCollection<CustomMethods> collection = createCustomMethodsCollection(realm, collectionClass); CustomMethods unmanaged = new CustomMethods("Child0"); assertTrue(collection.contains(unmanaged)); }

Target:
public void contains_customEqualMethod() { RealmCollection<CustomMethods> collection = createCustomMethodsCollection(realm, collectionClass); assertTrue(collection.contains(new CustomMethods("Child0"))); assertTrue(collection.contains(new CustomMethods("Child" + (TEST_SIZE - 1)))); assertFalse(collection.contains(new CustomMethods("Child" + TEST_SIZE))); }
Source:
public void updatePatientNoAccessReturnsForbiddenCode() throws ComponentLookupException, XWikiRestException { when(this.repository.getPatientByExternalId(this.eid)).thenReturn(this.patient); when(this.access.hasAccess(Right.EDIT, null, null)).thenReturn(false); Response response = this.component.updatePatient("json", this.eid); verify(this.logger).debug("Updating patient record with external ID via REST", this.eid); verify(this.logger).debug("Edit access denied to user on patient record [{}]", null, this.patient.getId()); assertEquals(Response.Status.FORBIDDEN.getStatusCode(), response.getStatus()); }

Target:
public void updatePatientNoAccessReturnsForbiddenCode() throws ComponentLookupException { when(this.access.hasAccess(Right.EDIT, this.userReference, this.patientReference)).thenReturn(false); Response response = this.component.updatePatient("json", this.eid); verify(this.logger).debug("Edit access denied to user on patient record [{}]", null, this.patient.getId()); assertEquals(Response.Status.FORBIDDEN.getStatusCode(), response.getStatus()); }
Source:
public int hashCode() { return Objects.hash( snapshotId, clusterId, volumeId, snapshotName, status, description, status ); }

Target:
public int hashCode() { return Objects.hash( snapshotId, clusterId, volumeId, snapshotName, description, status ); }
Source:
void sendPage(String page, HttpServerRequest request, HttpServerResponse response) throws HttpAuthenticationException { if (response.forward(page)) { return; } HttpScope application = request.getScope(Scope.APPLICATION); if (application != null && application.supportsResources()) { try (InputStream pageStream = application.getResource(page)) { if (pageStream != null) { OutputStream responseStream = response.getOutputStream(); if (responseStream != null) { byte[] content = new byte[1024]; int length; while ((length = pageStream.read(content)) > 0) { responseStream.write(content, 0, length); } return; } } } catch (IOException e) { throw new HttpAuthenticationException(e); } } sendRedirect(response, contextPath + page); }

Target:
void sendPage(String page, HttpServerRequest request, HttpServerResponse response) throws HttpAuthenticationException { if (response.forward(page)) { return; } HttpScope application = request.getScope(Scope.APPLICATION); if (application != null && application.supportsResources()) { try (InputStream pageStream = application.getResource(page)) { if (pageStream != null) { OutputStream responseStream = response.getOutputStream(); if (responseStream != null) { byte[] content = new byte[1024]; int length; while ((length = pageStream.read(content)) > 0) { responseStream.write(content, 0, length); } return; } } } catch (IOException e) { throw new HttpAuthenticationException(e); } } URI requestURI = request.getRequestURI(); StringBuilder sb = new StringBuilder(); sb.append(requestURI.getScheme()); sb.append("://"); sb.append(requestURI.getHost()); sb.append(':').append(requestURI.getPort()); sb.append(contextPath); sb.append(page); sendRedirect(response, sb.toString()); }
Source:
private static List<String> getSimilarTables(User user, String tableName, Iterable<TableInfo> tables) { LevenshteinDistance levenshteinDistance = new LevenshteinDistance(); ArrayList<String> candidates = new ArrayList<>(); for (TableInfo table : tables) { if (user.hasAnyPrivilege(Privilege.Clazz.TABLE, table.ident().fqn())) { String candidate = table.ident().name(); if (levenshteinDistance.getDistance(tableName, candidate) > 0.7f || tableName.equalsIgnoreCase(candidate)) { candidates.add(candidate); } } } return candidates; }

Target:
private static List<String> getSimilarTables(User user, String tableName, Iterable<TableInfo> tables) { LevenshteinDistance levenshteinDistance = new LevenshteinDistance(); ArrayList<Candidate> candidates = new ArrayList<>(); for (TableInfo table : tables) { if (user.hasAnyPrivilege(Privilege.Clazz.TABLE, table.ident().fqn())) { String candidate = table.ident().name(); float score = levenshteinDistance.getDistance(tableName.toLowerCase(Locale.ENGLISH), candidate.toLowerCase(Locale.ENGLISH)); if (score > 0.7f) { candidates.add(new Candidate(score, candidate)); } } } candidates.sort(Comparator.comparing((Candidate x) -> x.score).reversed()); return candidates.stream() .limit(5) .map(x -> x.name) .collect(Collectors.toList()); }
Source:
public void getListOfObjectsAsSingleOnlyInitialValue() { final TestSubscriber<Changes> changesTestSubscriber = new TestSubscriber<Changes>(); storIOContentResolver .observeChangesOfUri(TestItem.CONTENT_URI) .take(1) .subscribe(changesTestSubscriber); TestItem testItemToInsert = TestItem.create(null, "value"); contentResolver.insert(TestItem.CONTENT_URI, testItemToInsert.toContentValues()); final TestSubscriber<List<TestItem>> listTestSubscriber = new TestSubscriber<List<TestItem>>(); storIOContentResolver .get() .listOfObjects(TestItem.class) .withQuery(Query.builder() .uri(TestItem.CONTENT_URI) .build()) .prepare() .asRxSingle() .subscribe(listTestSubscriber); listTestSubscriber.awaitTerminalEvent(60, SECONDS); listTestSubscriber.assertNoErrors(); assertThat(listTestSubscriber.getOnNextEvents()).hasSize(1); assertThat(testItemToInsert.equalsWithoutId(listTestSubscriber.getOnNextEvents().get(0).get(0))) .isTrue(); changesTestSubscriber.awaitTerminalEvent(60, SECONDS); changesTestSubscriber.assertNoErrors(); changesTestSubscriber.assertValues(Changes.newInstance(TestItem.CONTENT_URI)); }

Target:
public void getListOfObjectsAsSingleOnlyInitialValue() { final TestSubscriber<Changes> changesTestSubscriber = new TestSubscriber<Changes>(); storIOContentResolver .observeChangesOfUri(TestItem.CONTENT_URI) .take(1) .subscribe(changesTestSubscriber); TestItem testItemToInsert = TestItem.create(null, "value"); contentResolver.insert(TestItem.CONTENT_URI, testItemToInsert.toContentValues()); final TestSubscriber<List<TestItem>> listTestSubscriber = new TestSubscriber<List<TestItem>>(); storIOContentResolver .get() .listOfObjects(TestItem.class) .withQuery(Query.builder() .uri(TestItem.CONTENT_URI) .build()) .prepare() .asRxSingle() .subscribe(listTestSubscriber); listTestSubscriber.awaitTerminalEvent(60, SECONDS); listTestSubscriber.assertNoErrors(); List<List<TestItem>> listOfObjects = listTestSubscriber.getOnNextEvents(); assertThat(listOfObjects).hasSize(1); assertThat(listTestSubscriber.getOnNextEvents()).hasSize(1); assertThat(testItemToInsert.equalsWithoutId(listTestSubscriber.getOnNextEvents().get(0).get(0))) .isTrue(); changesTestSubscriber.awaitTerminalEvent(60, SECONDS); changesTestSubscriber.assertNoErrors(); changesTestSubscriber.assertValues(Changes.newInstance(TestItem.CONTENT_URI)); }
Source:
private void loadImplementations() { ServiceLoader<DirectorySpi> loader = ServiceLoader.load(DirectorySpi.class); for (DirectorySpi implementation : loader) { implementations.add(implementation); log.info( "Loaded directory implementation \"" + implementation.getClass().getName() + "\"." ); } }

Target:
private void loadImplementations() { ServiceLoader<DirectorySpi> loader = ServiceLoader.load(DirectorySpi.class); for (DirectorySpi implementation : loader) { implementations.put(implementation.getType(), implementation); log.info( "Loaded directory service implementation \"" + implementation.getType() + "\"." ); } }
Source:
protected Object doGetValue(Object columnElement, Object rowElement, INattableModelManager tableManager) { final List<Object> objects = organizeAndResolvedObjects(columnElement, rowElement, null); final EObject eobject = (EObject) objects.get(0); final EOperation operation = (EOperation) objects.get(1); if (eobject.eClass().getEAllOperations().contains(operation)) { try { return eobject.eInvoke(operation, null); } catch (InvocationTargetException e) { e.printStackTrace(); } } return NOT_AVALAIBLE; }

Target:
protected Object doGetValue(Object columnElement, Object rowElement, INattableModelManager tableManager) { final List<Object> objects = organizeAndResolvedObjects(columnElement, rowElement, null); final EObject eobject = (EObject) objects.get(0); final EOperation operation = (EOperation) objects.get(1); if (eobject.eClass().getEAllOperations().contains(operation)) { try { return eobject.eInvoke(operation, null); } catch (InvocationTargetException e) { Activator.log.error(NOT_IMPLEMENTED_MESSAGE, e); } } return NOT_AVALAIBLE; }
Source:
private String getTransactionListStr(List<TransactionId> transactions) { StringBuilder transStrs = new StringBuilder(); for (TransactionId transactionId : transactions) { transStrs.append(String.format("Tranaction Id [%s] Comment [%s]\n", transactionId.getId(), TransactionManager.getComment(transactionId.getId()))); } return transStrs.toString(); }

Target:
private String getTransactionListStr(List<TransactionId> transactions) { StringBuilder transStrs = new StringBuilder(); int count = 1; for (TransactionId transactionId : transactions) { transStrs.append(String.format("Tranaction Id [%s] Comment [%s]\n", transactionId, TransactionManager.getComment(transactionId))); if (count++ > 30) { transStrs.append("(truncated at 25)..."); break; } } return transStrs.toString(); }
Source:
public StyledString buildTextFromEventIndex(int index, ITaskAttachment attachment) { StyledString text = new StyledString(); switch (index) { case 0: if (AttachmentUtil.isContext(attachment)) { text.append("Task_Context"); } else if (attachment.isPatch()) { text.append("Patch"); } else { text.append(" " + attachment.getFileName()); } break; case 1: text.append(attachment.getDescription()); break; case 2: Long length = attachment.getLength(); if (length < 0) { text.append("-"); } text.append(sizeFormatter.format(length)); break; case 3: String autherText = (attachment.getAuthor() != null) ? attachment.getAuthor().toString() : ""; String[] autherPart = autherText.split(" <"); text.append(autherPart[0] + " ", StyledString.COUNTER_STYLER); if (autherPart.length > 1) { text.append("<" + autherPart[1], StyledString.COUNTER_STYLER); } break; case 4: text.append((attachment.getCreationDate() != null) ? EditorUtil.formatDateTime(attachment.getCreationDate()) : ""); break; case 5: text.append(getAttachmentId(attachment)); break; default: text.append("unrecognized column"); break; } return text; }

Target:
public StyledString buildTextFromEventIndex(int index, ITaskAttachment attachment) { StyledString text = new StyledString(); switch (index) { case 0: if (AttachmentUtil.isContext(attachment)) { text.append(Messages.AttachmentTableLabelProvider_Task_Context); } else if (attachment.isPatch()) { text.append(Messages.AttachmentTableLabelProvider_Patch); } else { text.append(" " + attachment.getFileName()); } break; case 1: text.append(attachment.getDescription()); break; case 2: Long length = attachment.getLength(); if (length < 0) { text.append("-"); } text.append(sizeFormatter.format(length)); break; case 3: String autherText = (attachment.getAuthor() != null) ? attachment.getAuthor().toString() : ""; String[] autherPart = autherText.split(" <"); text.append(autherPart[0] + " ", StyledString.COUNTER_STYLER); if (autherPart.length > 1) { text.append("<" + autherPart[1], StyledString.COUNTER_STYLER); } break; case 4: text.append((attachment.getCreationDate() != null) ? EditorUtil.formatDateTime(attachment.getCreationDate()) : ""); break; case 5: text.append(getAttachmentId(attachment)); break; default: text.append("unrecognized column"); break; } return text; }
Source:
protected BaseVariant getBaseVariant() { LibraryExtension libraryExtension = (LibraryExtension) getAndroidExtension(); Optional<LibraryVariant> baseVariantOptional = libraryExtension .getLibraryVariants() .stream() .filter(i -> i.getName().equals(getName())) .findFirst(); Preconditions.checkArgument(baseVariantOptional.isPresent()); return baseVariantOptional.get(); }

Target:
protected BaseVariant getBaseVariant() { LibraryExtension libraryExtension = (LibraryExtension) getAndroidExtension(); Optional<LibraryVariant> baseVariantOptional = libraryExtension .getLibraryVariants() .stream() .filter(variant -> variant.getName().equals(getName())) .findFirst(); Preconditions.checkArgument(baseVariantOptional.isPresent()); return baseVariantOptional.get(); }
Source:
private Document createDocument() { Document document = null; try { DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder(); document = documentBuilder.newDocument(); } catch (ParserConfigurationException pce) { pce.printStackTrace(); } return document; }

Target:
private static Document createDocument() throws ParserConfigurationException { Document document = null; DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder(); document = documentBuilder.newDocument(); return document; }
Source:
public void addWriteNotificationLog(AcidWriteEvent acidWriteEvent) throws MetaException { Connection dbConn = null; try { try { lockInternal(); dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED); MetaStoreListenerNotifier.notifyEventWithDirectSql(transactionalListeners, EventMessage.EventType.ACID_WRITE, acidWriteEvent, dbConn, sqlGenerator); LOG.debug("Going to commit"); dbConn.commit(); return; } catch (SQLException e) { LOG.debug("Going to rollback"); rollbackDBConn(dbConn); if (isDuplicateKeyError(e)) { if (waitForRetry("allocateTableWriteIds(" + acidWriteEvent + ")", e.getMessage())) { throw new RetryException(); } retryNum = 0; throw new MetaException(e.getMessage()); } checkRetryable(dbConn, e, "allocateTableWriteIds(" + acidWriteEvent + ")"); throw new MetaException("Unable to update transaction database " + StringUtils.stringifyException(e)); } finally{ closeDbConn(dbConn); unlockInternal(); } } catch (RetryException e) { addWriteNotificationLog(acidWriteEvent); } }

Target:
public void addWriteNotificationLog(AcidWriteEvent acidWriteEvent) throws MetaException { Connection dbConn = null; try { try { lockInternal(); dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED); MetaStoreListenerNotifier.notifyEventWithDirectSql(transactionalListeners, EventMessage.EventType.ACID_WRITE, acidWriteEvent, dbConn, sqlGenerator); LOG.debug("Going to commit"); dbConn.commit(); return; } catch (SQLException e) { LOG.debug("Going to rollback"); rollbackDBConn(dbConn); if (isDuplicateKeyError(e)) { if (waitForRetry("addWriteNotificationLog(" + acidWriteEvent + ")", e.getMessage())) { throw new RetryException(); } retryNum = 0; throw new MetaException(e.getMessage()); } checkRetryable(dbConn, e, "addWriteNotificationLog(" + acidWriteEvent + ")"); throw new MetaException("Unable to add write notification event " + StringUtils.stringifyException(e)); } finally{ closeDbConn(dbConn); unlockInternal(); } } catch (RetryException e) { addWriteNotificationLog(acidWriteEvent); } }
Source:
public static boolean isRetryableException(Exception exception) { if (exception == null) { throw new IllegalArgumentException("exception cannot be null."); } if (exception instanceof EventHubException) { return ((EventHubException) exception).getIsTransient(); } return false; }

Target:
public static boolean isRetryableException(Exception exception) { if (exception == null) { throw new IllegalArgumentException("exception cannot be null"); } if (exception instanceof EventHubException) { return ((EventHubException) exception).getIsTransient(); } return false; }
Source:
public void getThreadData() throws Throwable { for (int i = 0; i < 5; i++) { SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_AFTER_THREAD_START")); SyncUtil.resumeUntilStopped(); } SyncUtil.addBreakpoint(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED")); SyncUtil.resumeUntilStopped(); IThreadDMData mainThreadData = SyncUtil.getThreadData(1); Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); Matcher matcher = pattern.matcher(mainThreadData.getId()); assertTrue("Thread ID is a series of number", matcher.matches()); final String names[] = { EXEC_NAME, "monday", "tuesday", "wednesday", "thursday", "friday" }; for (int i = 1; i <= 6; i++) { IThreadDMData threadData = SyncUtil.getThreadData(i); String name = threadData.getName(); String expectedName = threadNamesSupported() ? names[i - 1] : ""; assertEquals("Thread name of thread " + i, expectedName, name); } }

Target:
public void getThreadData() throws Throwable { for (int i = 0; i < 5; i++) { SyncUtil.runToLocation(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_AFTER_THREAD_START")); } SyncUtil.runToLocation(SOURCE_NAME + ":" + getLineForTag("LINE_MAIN_ALL_THREADS_STARTED")); IThreadDMData mainThreadData = SyncUtil.getThreadData(1); Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); Matcher matcher = pattern.matcher(mainThreadData.getId()); assertTrue("Thread ID is a series of number", matcher.matches()); final String names[] = { EXEC_NAME, "monday", "tuesday", "wednesday", "thursday", "friday" }; for (int i = 1; i <= 6; i++) { IThreadDMData threadData = SyncUtil.getThreadData(i); String name = threadData.getName(); String expectedName = threadNamesSupported() ? names[i - 1] : ""; assertEquals("Thread name of thread " + i, expectedName, name); } }
Source:
protected boolean canDoAction() { setVmId((Guid) (getParameters().getSlaParameter(VmSlaPolicyParameters.Params.VM_ID))); setVdsId((Guid) getParameters().getSlaParameter(VmSlaPolicyParameters.Params.VDS_ID)); setVdsGroupId(getVds().getVdsGroupId()); if (!FeatureSupported.vmSlaPolicy(getVdsGroup().getcompatibility_version())) { return failCanDoAction(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } return true; }

Target:
protected boolean canDoAction() { if (!FeatureSupported.vmSlaPolicy(getVdsGroup().getcompatibility_version())) { return failCanDoAction(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } return true; }
Source:
public void setupProperties() { super.setupProperties(); batchSize.setValue(300); dieOnError.setValue(true); outputOperation.setPossibleValues((Object[]) OutputOperation.values()); outputOperation.setValue(syncLead); operationType.setPossibleValues((Object[]) values()); operationType.setValue(createOnly); lookupField.setPossibleValues((Object[]) RESTLookupFields.values()); lookupField.setValue(RESTLookupFields.email); customLookupField.setValue(""); deDupeEnabled.setValue(false); deleteLeadsInBatch.setValue(false); customObjectDeleteBy.setValue(CustomObjectDeleteBy.idField); customObjectDedupeBy.setValue("dedupeFields"); customObjectSyncAction.setPossibleValues((Object[]) CustomObjectSyncAction.values()); customObjectSyncAction.setValue(CustomObjectSyncAction.createOrUpdate); schemaInput.schema.setValue(MarketoConstants.getRESTOutputSchemaForSyncLead()); beforeMappingInput(); setSchemaListener(new ISchemaListener() { @Override public void afterSchema() { schemaFlow.schema.setValue(null); schemaReject.schema.setValue(null); beforeMappingInput(); updateOutputSchemas(); } }); }

Target:
public void setupProperties() { super.setupProperties(); batchSize.setValue(REST_API_LIMIT); dieOnError.setValue(true); outputOperation.setPossibleValues((Object[]) OutputOperation.values()); outputOperation.setValue(syncLead); operationType.setPossibleValues((Object[]) values()); operationType.setValue(createOnly); lookupField.setPossibleValues((Object[]) RESTLookupFields.values()); lookupField.setValue(RESTLookupFields.email); customLookupField.setValue(""); deDupeEnabled.setValue(false); deleteLeadsInBatch.setValue(false); customObjectDeleteBy.setValue(CustomObjectDeleteBy.idField); customObjectDedupeBy.setValue("dedupeFields"); customObjectSyncAction.setPossibleValues((Object[]) CustomObjectSyncAction.values()); customObjectSyncAction.setValue(CustomObjectSyncAction.createOrUpdate); schemaInput.schema.setValue(MarketoConstants.getRESTOutputSchemaForSyncLead()); beforeMappingInput(); setSchemaListener(new ISchemaListener() { @Override public void afterSchema() { schemaFlow.schema.setValue(null); schemaReject.schema.setValue(null); beforeMappingInput(); updateOutputSchemas(); } }); }
Source:
private void display(final PatchSetPublishDetail r) { setPageTitle(Util.M.publishComments(r.getChange().getKey().abbreviate(), patchSetId.get())); descBlock.display(r.getChange(), r.getPatchSetInfo(), r.getAccounts()); if (r.getChange().getStatus().isOpen()) { initApprovals(r, approvalPanel); } if (lastState != null && patchSetId.equals(lastState.patchSetId)) { message.setText(lastState.message); } draftsPanel.clear(); commentEditors = new ArrayList<CommentEditorPanel>(); if (!r.getDrafts().isEmpty()) { draftsPanel.add(new SmallHeading(Util.C.headingPatchComments())); Panel panel = null; String priorFile = ""; for (final PatchLineComment c : r.getDrafts()) { final Patch.Key patchKey = c.getKey().getParentKey(); final String fn = patchKey.get(); if (!fn.equals(priorFile)) { panel = new FlowPanel(); panel.addStyleName(Gerrit.RESOURCES.css().patchComments()); draftsPanel.add(panel); panel.add(new PatchLink.SideBySide(PatchTable .getDisplayFileName(patchKey), patchKey, 0, null, null)); priorFile = fn; } final CommentEditorPanel editor = new CommentEditorPanel(c); editor.setAuthorNameText(Util.M.lineHeader(c.getLine())); editor.setOpen(true); commentEditors.add(editor); panel.add(editor); } } submit.setVisible(r.canSubmit()); if (Gerrit.getConfig().testChangeMerge()) { submit.setEnabled(r.getChange().isMergeable()); errorlabel.setVisible(r.getChange().isMergeable()); } }

Target:
private void display(final PatchSetPublishDetail r) { setPageTitle(Util.M.publishComments(r.getChange().getKey().abbreviate(), patchSetId.get())); descBlock.display(r.getChange(), r.getPatchSetInfo(), r.getAccounts()); if (r.getChange().getStatus().isOpen()) { initApprovals(r, approvalPanel); } if (lastState != null && patchSetId.equals(lastState.patchSetId)) { message.setText(lastState.message); } draftsPanel.clear(); commentEditors = new ArrayList<CommentEditorPanel>(); if (!r.getDrafts().isEmpty()) { draftsPanel.add(new SmallHeading(Util.C.headingPatchComments())); Panel panel = null; String priorFile = ""; for (final PatchLineComment c : r.getDrafts()) { final Patch.Key patchKey = c.getKey().getParentKey(); final String fn = patchKey.get(); if (!fn.equals(priorFile)) { panel = new FlowPanel(); panel.addStyleName(Gerrit.RESOURCES.css().patchComments()); draftsPanel.add(panel); panel.add(new PatchLink.SideBySide(PatchTable .getDisplayFileName(patchKey), patchKey, 0, null, null)); priorFile = fn; } final CommentEditorPanel editor = new CommentEditorPanel(c); editor.setAuthorNameText(Util.M.lineHeader(c.getLine())); editor.setOpen(true); commentEditors.add(editor); panel.add(editor); } } submit.setVisible(r.canSubmit()); if (Gerrit.getConfig().testChangeMerge()) { submit.setEnabled(r.getChange().isMergeable()); errorlabel.setVisible(!r.getChange().isMergeable()); } }
Source:
protected boolean createKeys(List<BlackboardArtifact.Type> list) { if (skCase != null) { try { List<BlackboardArtifact.Type> types = (datasourceObjId > 0) ? blackboard.getArtifactTypesInUse(datasourceObjId) : skCase.getArtifactTypesInUse() ; types.removeAll(doNotShow); Collections.sort(types, new Comparator<BlackboardArtifact.Type>() { @Override public int compare(BlackboardArtifact.Type a, BlackboardArtifact.Type b) { return a.getDisplayName().compareTo(b.getDisplayName()); } }); list.addAll(types); for (BlackboardArtifact.Type art : types) { TypeNode node = typeNodeList.get(art); if (node != null) { node.updateDisplayName(); } } } catch (TskCoreException ex) { Logger.getLogger(TypeFactory.class.getName()).log(Level.SEVERE, "Error getting list of artifacts in use: " + ex.getLocalizedMessage()); } } return true; }

Target:
protected boolean createKeys(List<BlackboardArtifact.Type> list) { if (skCase != null) { try { List<BlackboardArtifact.Type> types = (filteringDSObjId > 0) ? blackboard.getArtifactTypesInUse(filteringDSObjId) : skCase.getArtifactTypesInUse() ; types.removeAll(doNotShow); Collections.sort(types, new Comparator<BlackboardArtifact.Type>() { @Override public int compare(BlackboardArtifact.Type a, BlackboardArtifact.Type b) { return a.getDisplayName().compareTo(b.getDisplayName()); } }); list.addAll(types); for (BlackboardArtifact.Type art : types) { TypeNode node = typeNodeList.get(art); if (node != null) { node.updateDisplayName(); } } } catch (TskCoreException ex) { Logger.getLogger(TypeFactory.class.getName()).log(Level.SEVERE, "Error getting list of artifacts in use: " + ex.getLocalizedMessage()); } } return true; }
Source:
public void aggregationSortingTest() throws Exception { String graphQLRequest = document( selection( field( "playerStats", arguments( argument("sort", "\"-highScore\"") ), selections( field("highScore"), field( "country", selections( field("name"), field("id") ) ) ) ) ) ).toQuery(); String expected = document( selections( field( "playerStats", selections( field("highScore", 2412), field( "country", selections( field("name", "United States"), field("id", "840") ) ) ), selections( field("highScore", 1000), field( "country", selections( field("name", "Hong Kong"), field("id", "344") ) ) ) ) ) ).toResponse(); runQueryWithExpectedResult(graphQLRequest, expected); }

Target:
public void aggregationSortingTest() throws Exception { String graphQLRequest = document( selection( field( "playerStats", arguments( argument("sort", "\"-highScore\"") ), selections( field("highScore"), field( "country", selections( field("name") ) ) ) ) ) ).toQuery(); String expected = document( selections( field( "playerStats", selections( field("highScore", 2412), field( "country", selections( field("name", "United States") ) ) ), selections( field("highScore", 1000), field( "country", selections( field("name", "Hong Kong") ) ) ) ) ) ).toResponse(); runQueryWithExpectedResult(graphQLRequest, expected); }
Source:
public void createContainerWithVolume() throws DockerException { Volume volume = new Volume("/var/log"); CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withVolumes(volume) .withCmd("true").exec(); LOG.info("Created container {}", container.toString()); assertThat(container.getId(), not(isEmptyString())); InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec(); LOG.info("Inspect container {}", inspectContainerResponse.getConfig().getVolumes()); assertThat(inspectContainerResponse.getConfig().getVolumes().keySet(), contains("/var/log")); assertEquals(inspectContainerResponse.getMounts().get(0).getDestination(), volume); assertEquals(inspectContainerResponse.getMounts().get(0).getMode(), AccessMode.rw); assertTrue(inspectContainerResponse.getMounts().get(0).getRW()); }

Target:
public void createContainerWithVolume() throws DockerException { Volume volume = new Volume("/var/log"); CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withVolumes(volume) .withCmd("true").exec(); LOG.info("Created container {}", container.toString()); assertThat(container.getId(), not(isEmptyString())); InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec(); LOG.info("Inspect container {}", inspectContainerResponse.getConfig().getVolumes()); assertThat(inspectContainerResponse.getConfig().getVolumes().keySet(), contains("/var/log")); assertThat(inspectContainerResponse.getMounts().get(0).getDestination(), equalTo(volume)); assertThat(inspectContainerResponse.getMounts().get(0).getMode(), equalTo("")); assertThat(inspectContainerResponse.getMounts().get(0).getRW(), equalTo(true)); }
Source:
private static double getVariance(java.util.List<Integer> numbers) { double sum = 0; int size = numbers.size(); for (Integer number : numbers) { sum += number; } double average = sum / size; sum = 0; for (int number : numbers) { sum += Math.abs(number - average); } return sum / size; }

Target:
private static double getVariance(java.util.List<Integer> numbers) { double sum = 0; int size = numbers.size(); for (Integer number : numbers) { sum += number; } double average = sum / size; sum = 0; for (int number : numbers) { sum += Math.pow(number - average, 2); } return sum / size; }
Source:
public void start() { if(mLogFile == null) { try { StringBuilder sb = new StringBuilder(); sb.append(mLogDirectory); sb.append(File.separator); sb.append(TimeStamp.getTimeStamp("_")); sb.append("_"); sb.append(StringUtils.replaceIllegalCharacters(mFileNameSuffix)); mLogFileName = sb.toString(); mLog.info("Creating log file:" + mLogFileName); mLogFile = new OutputStreamWriter(new FileOutputStream(mLogFileName)); write(getHeader()); } catch(FileNotFoundException e) { mLog.error("Couldn't create log file in directory:" + mLogDirectory); } } }

Target:
public void start() { if(mLogFile == null) { try { StringBuilder sb = new StringBuilder(); sb.append(mLogDirectory); sb.append(File.separator); sb.append(TimeStamp.getTimeStamp("_")); sb.append("_"); sb.append(mFileNameSuffix); mLogFileName = sb.toString(); mLog.info("Creating log file:" + mLogFileName); mLogFile = new OutputStreamWriter(new FileOutputStream(mLogFileName)); write(getHeader()); } catch(FileNotFoundException e) { mLog.error("Couldn't create log file in directory:" + mLogDirectory); } } }
Source:
public void commitManually(String committed, String rewriteFile) throws IOException { Path srcDir = outputCommitter.getCommittedTaskPath(context); Path src = new Path(srcDir, committed); Path dst = new Path(path, rewriteFile); FileSystem fs = src.getFileSystem(context.getConfiguration()); if (fs.exists(dst) && !fs.delete(dst, true)) { throw new IOException("Could not delete " + dst); } if (!fs.exists(src)) { FileStatus[] matches = fs.globStatus(new Path(src.getParent(), committed+"*")); if (matches.length == 1) src = matches[0].getPath(); else throw new IOException("Could not find committed file " + src); } if (!fs.rename(src, dst)) { throw new IOException("Could not rename " + src + " to " + dst); } fs.delete(srcDir, true); }

Target:
public void commitManually(String committed, String rewriteFile) throws IOException { Path srcDir = outputCommitter.getCommittedTaskPath(context); Path src = new Path(srcDir, committed); Path dst = new Path(path, rewriteFile); FileSystem fs = src.getFileSystem(context.getConfiguration()); if (fs.exists(dst) && !fs.delete(dst, true)) { throw new IOException("Could not delete " + dst); } if (!fs.exists(src)) { FileStatus[] matches = fs.globStatus(new Path(src.getParent(), committed+"*")); if (matches != null && matches.length == 1) src = matches[0].getPath(); else throw new IOException("Could not find committed file " + src); } if (!fs.rename(src, dst)) { throw new IOException("Could not rename " + src + " to " + dst); } fs.delete(srcDir, true); }
Source:
public void waitForPanelsToExpand() { By panelCollapseSelector = By.cssSelector(".panel-heading+.panel-collapse"); List<WebElement> webElements = browser.driver.findElements(panelCollapseSelector); for (WebElement element : webElements) { try { waitForElementVisibility(element); } catch (org.openqa.selenium.StaleElementReferenceException e) { } } }

Target:
public void waitForPanelsToExpand() { By panelCollapseSelector = By.cssSelector(".panel-heading+.panel-collapse"); List<WebElement> webElements = browser.driver.findElements(panelCollapseSelector); for (WebElement element : webElements) { try { waitForElementVisibility(element); } catch (StaleElementReferenceException e) { } } }
Source:
public LogoutSuccessHandler getLogoutSuccessHandler() { return (httpServletRequest, httpServletResponse, authentication) -> { if (authentication != null && authentication.getDetails() != null){ try { httpServletRequest.getSession().invalidate(); } catch (IllegalStateException e) { log.error("Attempted to log out of an already logged out session"); } } validateHostname(httpServletRequest); String logoutServiceUrl = Link.toSitelessHandler() .toPattern(requestMappingContextDictionary, LOGOUT_HANDLER_NAME, ImmutableMap.of(), ImmutableMultimap.of(), ImmutableList.of()) .get(httpServletRequest); httpServletResponse.setStatus(HttpServletResponse.SC_OK); httpServletResponse.sendRedirect(runtimeConfiguration.getCasConfiguration().getLogoutUrl() + "?service=" + URLEncoder.encode(logoutServiceUrl, Charsets.UTF_8.name())); }; }

Target:
public LogoutSuccessHandler getLogoutSuccessHandler() { return (httpServletRequest, httpServletResponse, authentication) -> { if (authentication != null && authentication.getDetails() != null){ try { httpServletRequest.getSession().invalidate(); } catch (IllegalStateException e) { log.error("Attempted to log out of an already logged out session"); } } validateHostname(httpServletRequest); String logoutServiceUrl = Link.toSitelessHandler() .toPattern(requestMappingContextDictionary, LOGOUT_HANDLER_NAME).build() .get(httpServletRequest); httpServletResponse.setStatus(HttpServletResponse.SC_OK); httpServletResponse.sendRedirect(runtimeConfiguration.getCasConfiguration().getLogoutUrl() + "?service=" + URLEncoder.encode(logoutServiceUrl, Charsets.UTF_8.name())); }; }
Source:
public ViewContainers(ThemeManager themeManager) { super("Containers", themeManager); this.sideBar = new ContainerSideBar(); this.availableContainers = MiniatureListWidget.create(MiniatureListWidget.Element::create, (element, event) -> showContainerDetails(element.getValue())); this.categories = FXCollections.observableArrayList(); this.sortedCategories = this.categories.sorted(Comparator.comparing(ContainerCategoryDTO::getName)); this.containers = new ExpandedList<ContainerDTO, ContainerCategoryDTO>(this.sortedCategories, ContainerCategoryDTO::getContainers); this.sortedContainers = this.containers.sorted(Comparator.comparing(ContainerDTO::getName)); this.sideBar.setOnApplyFilter(this::applyFilter); this.sideBar.bindCategories(this.sortedCategories); Bindings.bindContent(this.availableContainers.getItems(), this.sortedContainers); this.sideBar.setOnCategorySelection(category -> { showAvailableContainers(); }); this.sideBar.setOnAllCategorySelection(() -> { showAvailableContainers(); }); this.setSideBar(sideBar); }

Target:
public ViewContainers(ThemeManager themeManager) { super("Containers", themeManager); this.sideBar = new ContainerSideBar(); this.availableContainers = MiniatureListWidget.create(MiniatureListWidget.Element::create, (element, event) -> showContainerDetails(element.getValue())); this.categories = FXCollections.observableArrayList(); this.sortedCategories = this.categories.sorted(Comparator.comparing(ContainerCategoryDTO::getName)); this.containers = new ExpandedList<ContainerDTO, ContainerCategoryDTO>(this.sortedCategories, ContainerCategoryDTO::getContainers); this.sortedContainers = this.containers.sorted(Comparator.comparing(ContainerDTO::getName)); this.sideBar.setOnApplyFilter(this::applyFilter); this.sideBar.bindCategories(this.sortedCategories); Bindings.bindContent(this.availableContainers.getItems(), this.sortedContainers); this.sideBar.setOnCategorySelection(category -> showAvailableContainers()); this.sideBar.setOnAllCategorySelection(this::showAvailableContainers); this.setSideBar(sideBar); }
Source:
private boolean hasBlacklistedWords(String tokenName) { boolean result = false; for (String blacklistedWord : blacklistedWords) { if (tokenName.contains(blacklistedWord)) { result = true; break; } } return result; }

Target:
private boolean hasBlacklistedWords(String tokenName) { for (String blacklistedWord : blacklistedWords) { if (tokenName.contains(blacklistedWord)) { return true; } } return false; }
Source:
public void shouldSetDefaultProjectIntoDevfileIfNotSpecified() throws Exception { String githubUrl = "<LINK_1>"; FactoryDto computedFactory = generateDevfileFactory(); when(urlFactoryBuilder.createFactoryFromDevfile(any(RemoteFactoryUrl.class), any(), anyMap())) .thenReturn(Optional.of(computedFactory)); Map<String, String> params = ImmutableMap.of(URL_PARAMETER_NAME, githubUrl); FactoryDto factory = githubFactoryParametersResolver.createFactory(params); assertNotNull(factory.getDevfile()); SourceDto source = factory.getDevfile().getProjects().get(0).getSource(); assertEquals(source.getLocation(), githubUrl); assertEquals(source.getBranch(), "master"); }

Target:
public void shouldSetDefaultProjectIntoDevfileIfNotSpecified() throws Exception { String githubUrl = "<LINK_1>/tree/foobar"; FactoryDto computedFactory = generateDevfileFactory(); when(urlFactoryBuilder.createFactoryFromDevfile(any(RemoteFactoryUrl.class), any(), anyMap())) .thenReturn(Optional.of(computedFactory)); Map<String, String> params = ImmutableMap.of(URL_PARAMETER_NAME, githubUrl); FactoryDto factory = githubFactoryParametersResolver.createFactory(params); assertNotNull(factory.getDevfile()); SourceDto source = factory.getDevfile().getProjects().get(0).getSource(); assertEquals(source.getLocation(), "<LINK_0>"); assertEquals(source.getBranch(), "foobar"); }
Source:
private boolean isNullOrConcurrentException( final Throwable throwable ) { if ( throwable == null ){ return true; }else if(throwable.getCause() instanceof ConcurrentModificationException) { return true; } return false; }

Target:
private boolean isNullOrConcurrentException(final Throwable throwable) { return throwable == null || throwable.getCause() instanceof ConcurrentModificationException; }
Source:
public void run() { ImmutableTriple<List<TurboIssue>, String, Date> changes = repo.getUpdatedIssues(model.getRepoId(), model.getUpdateSignature().issuesETag, model.getUpdateSignature().lastCheckTime); List<PullRequest> updatedPullRequests = repo.getUpdatedPullRequests( model.getRepoId(), "", model.getUpdateSignature().lastCheckTime); List<TurboIssue> existing = model.getIssues(); List<TurboIssue> updatedIssues = changes.left; logger.info(HTLog.format(model.getRepoId(), "%s issue(s)) changed%s", updatedIssues.size(), updatedIssues.isEmpty() ? "" : ": " + updatedIssues)); logger.info(HTLog.format(model.getRepoId(), "%s pr(s)) changed%s", updatedPullRequests.size(), updatedPullRequests.isEmpty() ? "" : ": " + updatedPullRequests)); List<TurboIssue> updated = updatedIssues.isEmpty() ? existing : TurboIssue.reconcile(model.getRepoId(), existing, updatedIssues); updated = TurboIssue.combineWithPullRequests(updated, updatedPullRequests); response.complete(new Result<>(updated, changes.middle, changes.right)); }

Target:
public void run() { ImmutableTriple<List<TurboIssue>, String, Date> changes = repo.getUpdatedIssues(model.getRepoId(), model.getUpdateSignature().issuesETag, model.getUpdateSignature().lastCheckTime); List<PullRequest> updatedPullRequests = repo.getUpdatedPullRequests( model.getRepoId(), model.getUpdateSignature().lastCheckTime); List<TurboIssue> existing = model.getIssues(); List<TurboIssue> updatedIssues = changes.left; logger.info(HTLog.format(model.getRepoId(), "%s issue(s)) changed%s", updatedIssues.size(), updatedIssues.isEmpty() ? "" : ": " + updatedIssues)); logger.info(HTLog.format(model.getRepoId(), "%s pr(s)) changed%s", updatedPullRequests.size(), updatedPullRequests.isEmpty() ? "" : ": " + updatedPullRequests)); List<TurboIssue> updated = updatedIssues.isEmpty() ? existing : TurboIssue.reconcile(model.getRepoId(), existing, updatedIssues); updated = TurboIssue.combineWithPullRequests(updated, updatedPullRequests); response.complete(new Result<>(updated, changes.middle, changes.right)); }
Source:
private boolean isSurveyFragmentActive() { Fragment currentFragment = this.getFragmentManager ().findFragmentById(R.id.dashboard_details_container); if (currentFragment instanceof SurveyFragment) { return true; } return false; }

Target:
private boolean isSurveyFragmentActive() { return isFragmentActive(surveyFragment, R.id.dashboard_details_container); }
Source:
public void postProcess() { uniqueID = UUID.randomUUID().toString(); if (hasMissingAttributes()) { int failuresCount = 0; int errorsCount = 0; Double totalTime = 0.0; for (TestSuiteModel suite : testsuite) { if (suite.getOverallStatus().equals(Constants.FAILED)) { failuresCount++; } else if (suite.getOverallStatus().equals(Constants.ERRORED)) { errorsCount++; } totalTime += Double.parseDouble(suite.getTime()); } if (failures == null) failures = Integer.toString(failuresCount); if (tests == null) tests = Integer.toString(testsuite.size()); if (time == null) time = Double.toString(totalTime); if (errors == null) errors = Integer.toString(errorsCount); } if (Integer.parseInt(failures) > 0 || Integer.parseInt(errors) > 0) { overallStatus = Constants.FAILED; } else { overallStatus = Constants.PASSED; } }

Target:
public void postProcess() { uniqueID = UUID.randomUUID().toString(); if (hasMissingAttributes()) { int failuresCount = 0; int errorsCount = 0; Double totalTime = 0.0; for (TestSuiteModel suite : testsuite) { if (suite.getOverallStatus().equals(Constants.FAILED)) { failuresCount++; } else if (suite.getOverallStatus().equals(Constants.ERRORED)) { errorsCount++; } totalTime += Double.parseDouble(suite.getTime()); } if (failures == null) { failures = Integer.toString(failuresCount); } if (tests == null) { tests = Integer.toString(testsuite.size()); } if (time == null) { time = Double.toString(totalTime); } if (errors == null) { errors = Integer.toString(errorsCount); } } if (Integer.parseInt(failures) > 0 || Integer.parseInt(errors) > 0) { overallStatus = Constants.FAILED; } else { overallStatus = Constants.PASSED; } }