auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static BoxEntity createEntityFromJson(final String json){ BoxEntity createdByEntity = new BoxEntity(); createdByEntity.createFromJson(json); if (createdByEntity.getType() == null){ return createdByEntity; } if (createdByEntity.getType().equals(BoxCollection.TYPE)) { BoxCollection collection = new BoxCollection(); collection.createFromJson(json); return collection; } else if (createdByEntity.getType().equals(BoxComment.TYPE)) { BoxComment comment = new BoxComment(); comment.createFromJson(json); return comment; } else if (createdByEntity.getType().equals(BoxCollaboration.TYPE)) { BoxCollaboration collaboration = new BoxCollaboration(); collaboration.createFromJson(json); return collaboration; } else if (createdByEntity.getType().equals(BoxEnterprise.TYPE)) { BoxEnterprise enterprise = new BoxEnterprise(); enterprise.createFromJson(json); return enterprise; } else if (createdByEntity.getType().equals(BoxFileVersion.TYPE)) { BoxFileVersion version = new BoxFileVersion(); version.createFromJson(json); return version; } else if (createdByEntity.getType().equals(BoxMetadata.TYPE)) { BoxMetadata metadata = new BoxMetadata(); metadata.createFromJson(json); return metadata; } BoxEntity item = BoxItem.createBoxItemFromJson(json); if (item != null){ return item; } item = BoxCollaborator.createCollaboratorFromJson(json); if (item != null){ return item; } return null; }

Target:
public static BoxEntity createEntityFromJson(final String json){ BoxEntity createdByEntity = new BoxEntity(); createdByEntity.createFromJson(json); if (createdByEntity.getType() == null){ return createdByEntity; } if (createdByEntity.getType().equals(BoxCollection.TYPE)) { BoxCollection collection = new BoxCollection(); collection.createFromJson(json); return collection; } else if (createdByEntity.getType().equals(BoxComment.TYPE)) { BoxComment comment = new BoxComment(); comment.createFromJson(json); return comment; } else if (createdByEntity.getType().equals(BoxCollaboration.TYPE)) { BoxCollaboration collaboration = new BoxCollaboration(); collaboration.createFromJson(json); return collaboration; } else if (createdByEntity.getType().equals(BoxEnterprise.TYPE)) { BoxEnterprise enterprise = new BoxEnterprise(); enterprise.createFromJson(json); return enterprise; } else if (createdByEntity.getType().equals(BoxFileVersion.TYPE)) { BoxFileVersion version = new BoxFileVersion(); version.createFromJson(json); return version; } BoxEntity item = BoxItem.createBoxItemFromJson(json); if (item != null){ return item; } item = BoxCollaborator.createCollaboratorFromJson(json); if (item != null){ return item; } return null; }
Source:
public Collection<Cookie> getRequestCookies() { final List<Cookie> cookies = new ArrayList<>(); final Http.Cookies httpCookies = request.cookies(); httpCookies.forEach(httpCookie -> { final Cookie cookie = new Cookie(httpCookie.name(), httpCookie.value()); cookie.setDomain((httpCookie.domain() != null? httpCookie.domain():".")); cookie.setHttpOnly(httpCookie.httpOnly()); cookie.setMaxAge((httpCookie.maxAge() != null? httpCookie.maxAge():-1)); cookie.setPath(httpCookie.path()); cookie.setSecure(httpCookie.secure()); cookies.add(cookie); }); return cookies; }

Target:
public Collection<Cookie> getRequestCookies() { final List<Cookie> cookies = new ArrayList<>(); final Http.Cookies httpCookies = request.cookies(); httpCookies.forEach(httpCookie -> { final Cookie cookie = new Cookie(httpCookie.name(), httpCookie.value()); if(httpCookie.domain() != null) { cookie.setDomain(httpCookie.domain()); } cookie.setHttpOnly(httpCookie.httpOnly()); if(httpCookie.maxAge() != null) { cookie.setMaxAge(httpCookie.maxAge()); } cookie.setPath(httpCookie.path()); cookie.setSecure(httpCookie.secure()); cookies.add(cookie); }); return cookies; }
Source:
public Status insert(String table, String endpoint, HashMap<String, ByteIterator> values) { int responseCode; try { responseCode = httpExecute(new HttpPost(urlPrefix + endpoint), values.get("data").toString()); } catch (Exception e) { responseCode = handleExceptions(e, urlPrefix + endpoint, HttpMethod.POST); } if (logEnabled) { System.out.println(new StringBuilder("POST Request: ").append(urlPrefix).append(endpoint) .append(" | Response Code: ").append(responseCode).toString()); } return getStatus(responseCode); }

Target:
public Status insert(String table, String endpoint, HashMap<String, ByteIterator> values) { int responseCode; try { responseCode = httpExecute(new HttpPost(urlPrefix + endpoint), values.get("data").toString()); } catch (Exception e) { responseCode = handleExceptions(e, urlPrefix + endpoint, HttpMethod.POST); } if (logEnabled) { System.err.println(new StringBuilder("POST Request: ").append(urlPrefix).append(endpoint) .append(" | Response Code: ").append(responseCode).toString()); } return getStatus(responseCode); }
Source:
private String createLink(ServletContext context){ return context.getContextPath() + "/" + English.plural(getType()) + "/" + getId(); }

Target:
private String createLink(ServletContext context){ return context.getContextPath() + "/" + English.plural(getType()) + "/" + getUUID(); }
Source:
protected void run() { try (Git git = new Git(db)) { if (command == null) { RemoteListCommand cmd = git.remoteList(); List<RemoteConfig> remotes = cmd.call(); print(remotes); } else { switch (command) { case "add": RemoteAddCommand add = git.remoteAdd(); add.setName(name); add.setUri(new URIish(uri)); add.call(); break; case "remove": case "rm": RemoteRemoveCommand rm = git.remoteRemove(); rm.setRemoteName(name); rm.call(); break; case "set-url": RemoteSetUrlCommand remoteSetUrl = git.remoteSetUrl(); remoteSetUrl.setRemoteName(name); remoteSetUrl.setRemoteUri(new URIish(uri)); remoteSetUrl .setUriType(push ? UriType.PUSH : UriType.FETCH); remoteSetUrl.call(); break; case "update": Fetch fetch = new Fetch(); fetch.init(db, gitdir); StringWriter osw = new StringWriter(); fetch.outw = new ThrowingPrintWriter(osw); StringWriter esw = new StringWriter(); fetch.errw = new ThrowingPrintWriter(esw); List<String> fetchArgs = new ArrayList<>(); if (verbose) { fetchArgs.add("--verbose"); } if (prune) { fetchArgs.add("--prune"); } if (name != null) { fetchArgs.add(name); } fetch.execute(fetchArgs.toArray(new String[0])); fetch.outw.flush(); fetch.errw.flush(); outw.println(osw.toString()); errw.println(esw.toString()); break; default: throw new JGitInternalException(MessageFormat .format(CLIText.get().unknownSubcommand, command)); } } } catch (Exception e) { throw die(e.getMessage(), e); } }

Target:
protected void run() { try (Git git = new Git(db)) { if (command == null) { RemoteListCommand cmd = git.remoteList(); List<RemoteConfig> remotes = cmd.call(); print(remotes); return; } switch (command) { case "add": RemoteAddCommand add = git.remoteAdd(); add.setName(name); add.setUri(new URIish(uri)); add.call(); break; case "remove": case "rm": RemoteRemoveCommand rm = git.remoteRemove(); rm.setRemoteName(name); rm.call(); break; case "set-url": RemoteSetUrlCommand remoteSetUrl = git.remoteSetUrl(); remoteSetUrl.setRemoteName(name); remoteSetUrl.setRemoteUri(new URIish(uri)); remoteSetUrl.setUriType(push ? UriType.PUSH : UriType.FETCH); remoteSetUrl.call(); break; case "update": Fetch fetch = new Fetch(); fetch.init(db, gitdir); StringWriter osw = new StringWriter(); fetch.outw = new ThrowingPrintWriter(osw); StringWriter esw = new StringWriter(); fetch.errw = new ThrowingPrintWriter(esw); List<String> fetchArgs = new ArrayList<>(); if (verbose) { fetchArgs.add("--verbose"); } if (prune) { fetchArgs.add("--prune"); } if (name != null) { fetchArgs.add(name); } fetch.execute(fetchArgs.toArray(new String[0])); fetch.outw.flush(); fetch.errw.flush(); outw.println(osw.toString()); errw.println(esw.toString()); break; default: throw new JGitInternalException(MessageFormat .format(CLIText.get().unknownSubcommand, command)); } } catch (Exception e) { throw die(e.getMessage(), e); } }
Source:
protected List<String> getChildrenIds(String parentId, boolean excludeSpecialChildren, boolean excludeRegularChildren) { if (isOrderable(parentId)) { List<DBSDocumentState> docStates; docStates = transaction.getChildrenStates(parentId, excludeSpecialChildren, excludeRegularChildren); docStates.sort(POS_COMPARATOR); List<String> children = new ArrayList<>(docStates.size()); for (DBSDocumentState docState : docStates) { children.add(docState.getId()); } return children; } else { return transaction.getChildrenIds(parentId, excludeSpecialChildren, excludeRegularChildren); } }

Target:
protected List<String> getChildrenIds(String parentId, boolean excludeSpecialChildren, boolean excludeRegularChildren) { if (isOrderable(parentId)) { List<DBSDocumentState> docStates = transaction.getChildrenStates(parentId, excludeSpecialChildren, excludeRegularChildren); docStates.sort(POS_COMPARATOR); List<String> children = new ArrayList<>(docStates.size()); for (DBSDocumentState docState : docStates) { children.add(docState.getId()); } return children; } else { return transaction.getChildrenIds(parentId, excludeSpecialChildren, excludeRegularChildren); } }
Source:
private synchronized Long getGasPrice() { int size = calcGasPricesSize(); if (size < getMinTransactions() || blockGasPrices.size() < getMinBlocks()) return null; long[] difficulties = new long[size > getMinTransactions() ? size : getMinTransactions()]; int index = 0; for (int i = 0; i < blockGasPrices.size(); ++i) { long[] current = blockGasPrices.get(i); for (long currentDifficulty : current) { difficulties[index] = currentDifficulty; ++index; } } Arrays.sort(difficulties); return difficulties[difficulties.length/getPercentileShare()]; }

Target:
private synchronized Long getGasPrice() { int size = calcGasPricesSize(); if (size < getMinTransactions() || blockGasPrices.size() < getMinBlocks()) return null; long[] difficulties = new long[size]; int index = 0; for (long[] currentBlock : blockGasPrices) { for (long currentDifficulty : currentBlock) { difficulties[index] = currentDifficulty; ++index; } } Arrays.sort(difficulties); return difficulties[difficulties.length/getPercentileShare()]; }
Source:
public FeedbackSubmissionEditQuestion(FeedbackQuestionAttributes questionAttributes, int qnIndx, boolean isModeratedQuestion) { courseId = questionAttributes.courseId; questionNumber = questionAttributes.questionNumber; this.qnIndx = qnIndx; questionId = questionAttributes.getId(); questionText = questionAttributes.getQuestionDetails().getQuestionText(); visibilityMessages = questionAttributes.getVisibilityMessage(); questionType = questionAttributes.questionType; numberOfEntitiesToGiveFeedbackTo = questionAttributes.numberOfEntitiesToGiveFeedbackTo; this.isModeratedQuestion = isModeratedQuestion; isRecipientNameHidden = questionAttributes.isRecipientNameHidden(); isTeamQuestion = questionAttributes.giverType.equals(FeedbackParticipantType.TEAMS); isRecipientTeam = questionAttributes.recipientType.equals(FeedbackParticipantType.TEAMS) || questionAttributes.recipientType.equals(FeedbackParticipantType.OWN_TEAM); }

Target:
public FeedbackSubmissionEditQuestion(FeedbackQuestionAttributes questionAttributes, int qnIndx, boolean isModeratedQuestion) { courseId = questionAttributes.courseId; questionNumber = questionAttributes.questionNumber; this.qnIndx = qnIndx; questionId = questionAttributes.getId(); questionText = questionAttributes.getQuestionDetails().getQuestionText(); visibilityMessages = questionAttributes.getVisibilityMessage(); questionType = questionAttributes.questionType; numberOfEntitiesToGiveFeedbackTo = questionAttributes.numberOfEntitiesToGiveFeedbackTo; this.isModeratedQuestion = isModeratedQuestion; isRecipientNameHidden = questionAttributes.isRecipientNameHidden(); isGiverTeam = questionAttributes.giverType.equals(FeedbackParticipantType.TEAMS); isRecipientTeam = questionAttributes.recipientType.isTeam(); }
Source:
public void doInit() { ConversionService conversionService = this.getConversionService(); if (conversionService != null && this.messageProcessor instanceof AbstractMessageProcessor) { ((AbstractMessageProcessor<?>) this.messageProcessor).setConversionService(conversionService); } if (this.messageProcessor instanceof BeanFactoryAware) { ((BeanFactoryAware) this.messageProcessor).setBeanFactory(this.getBeanFactory()); } }

Target:
protected void doInit() { ConversionService conversionService = this.getConversionService(); if (conversionService != null && this.messageProcessor instanceof AbstractMessageProcessor) { ((AbstractMessageProcessor<?>) this.messageProcessor).setConversionService(conversionService); } if (this.messageProcessor instanceof BeanFactoryAware) { ((BeanFactoryAware) this.messageProcessor).setBeanFactory(this.getBeanFactory()); } }
Source:
public void render() { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); stage.act(); stage.draw(); Table.drawDebug(stage); }

Target:
public void render() { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); stage.act(); stage.draw(); }
Source:
protected void executeCommand() { StoragePoolParametersBase parameters = new StoragePoolParametersBase(getStoragePoolId()); ActionReturnValue actionReturnValue = runInternalAction(ActionType.ProcessOvfUpdateForStoragePool, parameters, getContext()); Set<Guid> proccessedDomains = actionReturnValue.getActionReturnValue(); if (!proccessedDomains.isEmpty()) { runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); } setSucceeded(true); }

Target:
protected void executeCommand() { StoragePoolParametersBase parameters = new StoragePoolParametersBase(getStoragePoolId()); ActionReturnValue actionReturnValue = runInternalAction(ActionType.ProcessOvfUpdateForStoragePool, parameters, getContext()); Set<Guid> proccessedDomains = actionReturnValue.getActionReturnValue(); if (actionReturnValue.getSucceeded() && !proccessedDomains.isEmpty()) { runInternalActionWithTasksContext(ActionType.ProcessOvfUpdateForStorageDomain, createProcessOvfUpdateForDomainParams()); } setSucceeded(true); }
Source:
public static ThreadPoolExecutor newBoundedThreadPool(int maxThreads, ThreadFactory threadFactory) { BlockingQueue<Runnable> queue = new RefusingQueue<>(); return new ThreadPoolExecutor( 0, maxThreads, 60, TimeUnit.SECONDS, queue, threadFactory, (runnable, executor) -> queue.add(runnable)); }

Target:
public static ThreadPoolExecutor newBoundedThreadPool(int maxThreads, ThreadFactory threadFactory) { return newBoundedThreadPool(0, maxThreads, threadFactory); }
Source:
public void testProfileEntry() { com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue profileEntryValueVo = new com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue( "test"); ProfileEntryValue profileEntryValue = this.monitoringMapper.map(profileEntryValueVo, ProfileEntryValue.class); Assert.assertTrue(profileEntryValue.getStringValueOrDateValueOrFloatValue().get(0).equals("test")); profileEntryValueVo = new com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue( new Date()); profileEntryValue = this.monitoringMapper.map(profileEntryValueVo, ProfileEntryValue.class); Assert.assertTrue(profileEntryValue.getStringValueOrDateValueOrFloatValue().get(0) instanceof Date); profileEntryValueVo = new com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue( new BigDecimal(100.0d)); profileEntryValue = this.monitoringMapper.map(profileEntryValueVo, ProfileEntryValue.class); Assert.assertTrue(((BigDecimal) profileEntryValue.getStringValueOrDateValueOrFloatValue().get(0)).doubleValue() == 100.d); profileEntryValueVo = new com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue(12345L); profileEntryValue = this.monitoringMapper.map(profileEntryValueVo, ProfileEntryValue.class); Assert.assertTrue(((Long) profileEntryValue.getStringValueOrDateValueOrFloatValue().get(0)).doubleValue() == 12345L); }

Target:
public void testProfileEntry() { com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue profileEntryValueVo = new com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue( "test"); ProfileEntryValue profileEntryValue = this.monitoringMapper.map(profileEntryValueVo, ProfileEntryValue.class); assertEquals(profileEntryValue.getStringValueOrDateValueOrFloatValue().get(0), "test"); profileEntryValueVo = new com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue( new Date()); profileEntryValue = this.monitoringMapper.map(profileEntryValueVo, ProfileEntryValue.class); assertThat(profileEntryValue.getStringValueOrDateValueOrFloatValue().get(0), instanceOf(Date.class)); profileEntryValueVo = new com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue( new BigDecimal(100.0d)); profileEntryValue = this.monitoringMapper.map(profileEntryValueVo, ProfileEntryValue.class); assertTrue(((BigDecimal) profileEntryValue.getStringValueOrDateValueOrFloatValue().get(0)).doubleValue() == 100.d); profileEntryValueVo = new com.alliander.osgp.domain.core.valueobjects.smartmetering.ProfileEntryValue(12345L); profileEntryValue = this.monitoringMapper.map(profileEntryValueVo, ProfileEntryValue.class); assertTrue(((Long) profileEntryValue.getStringValueOrDateValueOrFloatValue().get(0)).doubleValue() == 12345L); }
Source:
private IRefactorService getRefactorService() { IRefactorService refactorService = null; try { refactorService = ServiceUtilsForResourceSet.getInstance().getService(IRefactorService.class, getTarget().getResourceSet()); } catch (ServiceException e) { Activator.log.error(e); } return refactorService; }

Target:
private IRefactorService getRefactorService() { IRefactorService refactorService = null; try { refactorService = ServiceUtilsForResourceSet.getInstance().getService(IRefactorService.class, getTarget().getResourceSet()); unavailableService = false; } catch (ServiceException e) { if (!unavailableService) { Activator.log.error(e); unavailableService = true; } } return refactorService; }
Source:
public InputRow parse(GenericRecord record) { LogicalType logicalType; if (null != _timestampSpecLogicalType) { logicalType = _timestampSpecLogicalType; } else { logicalType = determineTimestampSpecLogicalType(record.getSchema(), timestampSpec.getTimestampColumn()); } GenericRecordAsMap genericRecordAsMap = new GenericRecordAsMap(record, false, binaryAsString); DateTime dateTime; if (logicalType instanceof LogicalTypes.Date) { int daysSinceEpoch = (Integer) genericRecordAsMap.get(timestampSpec.getTimestampColumn()); long DAY_IN_MILISECONDS = 1000L * 60L * 60L * 24L; dateTime = new DateTime(daysSinceEpoch * DAY_IN_MILISECONDS); } else { dateTime = timestampSpec.extractTimestamp(genericRecordAsMap); } return new MapBasedInputRow(dateTime, dimensions, genericRecordAsMap); }

Target:
public InputRow parse(GenericRecord record) { GenericRecordAsMap genericRecordAsMap = new GenericRecordAsMap(record, false, binaryAsString); LogicalType logicalType = determineTimestampSpecLogicalType(record.getSchema(), timestampSpec.getTimestampColumn()); DateTime dateTime; if (logicalType instanceof LogicalTypes.Date) { int daysSinceEpoch = (Integer) genericRecordAsMap.get(timestampSpec.getTimestampColumn()); dateTime = new DateTime(TimeUnit.DAYS.toMillis(daysSinceEpoch)); } else { dateTime = timestampSpec.extractTimestamp(genericRecordAsMap); } return new MapBasedInputRow(dateTime, dimensions, genericRecordAsMap); }
Source:
public void addEmptyRowWithPrimaryKeyLong() { Table t = getTableWithIntegerPrimaryKey(); long rowIndex = t.addEmptyRowWithPrimaryKey(42); assertEquals(1, t.size()); assertEquals(42, t.getUncheckedRow(rowIndex).getLong(0)); sharedRealm.cancelTransaction(); }

Target:
public void addEmptyRowWithPrimaryKeyLong() { Table t = getTableWithIntegerPrimaryKey(); long rowIndex = t.addEmptyRowWithPrimaryKey(42); assertEquals(1, t.size()); assertEquals(42L, t.getUncheckedRow(rowIndex).getLong(0)); sharedRealm.cancelTransaction(); }
Source:
public PatchIdDiffFormatter() { super(new DigestOutputStream(new ByteArrayOutputStream(), Constants.newMessageDigest())); digest = ((DigestOutputStream) getOutputStream()).getMessageDigest(); }

Target:
public PatchIdDiffFormatter() { super(new DigestOutputStream(NullOutputStream.INSTANCE, Constants.newMessageDigest())); digest = ((DigestOutputStream) getOutputStream()).getMessageDigest(); }
Source:
public String getIdentificationString() { return courseId + "/" + feedbackPathId; }

Target:
public String getIdentificationString() { return courseId + "/" + feedbackPathId + "/" + giver + "/" + recipient; }
Source:
private void testProfileEditBox(StudentProfileEditBox profileEditBox) { assertEquals(acct.name, profileEditBox.getName()); assertEquals(isEditingPhoto, profileEditBox.getEditingPhoto()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.shortName), profileEditBox.getShortName()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.email), profileEditBox.getEmail()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.institute), profileEditBox.getInstitute()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.nationality), profileEditBox.getNationality()); assertEquals(spa.gender.name(), profileEditBox.getGender().name()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.moreInfo), profileEditBox.getMoreInfo()); assertEquals(acct.googleId, profileEditBox.getGoogleId()); assertEquals(pictureUrl, profileEditBox.getPictureUrl()); }

Target:
private void testProfileEditBox(StudentProfileEditBox profileEditBox) { assertEquals(acct.name, profileEditBox.getName()); assertEquals(isEditingPhoto, profileEditBox.getEditingPhoto()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.shortName), profileEditBox.getShortName()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.email), profileEditBox.getEmail()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.institute), profileEditBox.getInstitute()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.nationality), profileEditBox.getNationality()); assertEquals(spa.gender, profileEditBox.getGender()); assertEquals(StringHelper.convertToEmptyStringIfNull(spa.moreInfo), profileEditBox.getMoreInfo()); assertEquals(acct.googleId, profileEditBox.getGoogleId()); assertEquals(pictureUrl, profileEditBox.getPictureUrl()); }
Source:
protected LanguageServer doInitialize(LanguageDescription language, LanguageServerLauncher launcher, String projectPath) throws LanguageServerException { String languageId = launcher.getLanguageId(); InitializeParams initializeParams = prepareInitializeParams(projectPath); LanguageServer server; try { server = launcher.launch(projectPath, languageClient); } catch (LanguageServerException e) { throw new LanguageServerException( "Can't initialize Language Server " + languageId + " on " + projectPath + ". " + e.getMessage(), e); } registerCallbacks(server); CompletableFuture<InitializeResult> completableFuture = server.initialize(initializeParams); try { InitializeResult initializeResult = completableFuture.get(); serversToInitResult.put(server, new LanguageServerDescription(initializeResult, language)); } catch (InterruptedException | ExecutionException e) { server.shutdown(); server.exit(); throw new LanguageServerException("Error fetching server capabilities " + languageId + ". " + e.getMessage(), e); } LOG.info("Initialized Language Server on project {}", languageId, projectPath); return server; }

Target:
protected LanguageServer doInitialize(LanguageDescription language, LanguageServerLauncher launcher, String projectPath) throws LanguageServerException { String languageId = launcher.getLanguageId(); InitializeParams initializeParams = prepareInitializeParams(projectPath); LanguageServer server; try { server = launcher.launch(projectPath, languageClient); } catch (LanguageServerException e) { throw new LanguageServerException( "Can't initialize Language Server " + languageId + " on " + projectPath + ". " + e.getMessage(), e); } registerCallbacks(server, launcher); CompletableFuture<InitializeResult> completableFuture = server.initialize(initializeParams); try { InitializeResult initializeResult = completableFuture.get(); serversToInitResult.put(server, new LanguageServerDescription(initializeResult, language)); } catch (InterruptedException | ExecutionException e) { server.shutdown(); server.exit(); throw new LanguageServerException("Error fetching server capabilities " + languageId + ". " + e.getMessage(), e); } LOG.info("Initialized Language Server on project {}", languageId, projectPath); return server; }
Source:
public void save(Object object, int operatorId, long windowId) throws IOException { try { store(generateKey(operatorId, windowId), object); logger.info("saved check point object key region {}", generateKey(operatorId, windowId), applicationId); } catch (Throwable t) { logger.info("while saving {}", operatorId, windowId, t); DTThrowable.rethrow(t); } }

Target:
public void save(Object object, int operatorId, long windowId) throws IOException { try { store(generateKey(operatorId, windowId), object); logger.debug("saved check point object key region {}", generateKey(operatorId, windowId), applicationId); } catch (Exception ex) { throw new RuntimeException(ex); } }
Source:
public void updateNonExistingCustomer() { final int nonExistingId = 999; final String newFirstname = "Douglas"; final String newLastname = "MacArthur"; final Customer customer = new Customer(nonExistingId, newFirstname, newLastname); impl.updateCustomer(customer); assertNull(impl.getCustomerById(nonExistingId)); final Customer existingCustomer = impl.getCustomerById(CUSTOMER.getId()); assertEquals(CUSTOMER.getFirstName(), existingCustomer.getFirstName()); assertEquals(CUSTOMER.getLastName(), existingCustomer.getLastName()); }

Target:
public void updateNonExistingCustomer() { final int nonExistingId = getNonExistingCustomerId(); final String newFirstname = "Douglas"; final String newLastname = "MacArthur"; final Customer customer = new Customer(nonExistingId, newFirstname, newLastname); impl.updateCustomer(customer); assertNull(impl.getCustomerById(nonExistingId)); final Customer existingCustomer = impl.getCustomerById(CUSTOMER.getId()); assertEquals(CUSTOMER.getFirstName(), existingCustomer.getFirstName()); assertEquals(CUSTOMER.getLastName(), existingCustomer.getLastName()); }
Source:
public Object evaluate(Row row, Object[] parameters, SelectItem operandItem) { SelectItem[] selectItems = row.getSelectItems(); if (parameters.length == 0) { throw new IllegalArgumentException("Expecting some parameters to CONCAT function"); } StringBuilder strBuilder = new StringBuilder(); for (Object parameter: parameters) { String parameterAsString = parameter.toString(); final int startLiteral = parameterAsString.indexOf('\''); if (startLiteral == 0) { String literalWithoutTicks = parameterAsString.substring(1, parameterAsString.length() - 1); strBuilder.append(literalWithoutTicks); } else { Column column = getColumnValueFromRow(parameterAsString, selectItems); strBuilder.append(row.getValue(column)); } } return strBuilder; }

Target:
public Object evaluate(Row row, Object[] parameters, SelectItem operandItem) { if (parameters.length == 0) { throw new IllegalArgumentException("Expecting some parameters to CONCAT function"); } StringBuilder strBuilder = new StringBuilder(); for (Object parameter: parameters) { final Object valueToConcat; if (parameter instanceof SelectItem) { valueToConcat = row.getValue((SelectItem) parameter); } else if (parameter instanceof Column) { valueToConcat = row.getValue((Column) parameter); } else { valueToConcat = parameter; } strBuilder.append(valueToConcat.toString()); } return strBuilder.toString(); }
Source:
public ServiceBuilder<SecurityConfiguration> build(ServiceTarget target) { ServiceBuilder<SecurityConfiguration> builder = target.addService(this.getServiceName(), new ValueService<>(this)).setInitialMode(ServiceController.Mode.ON_DEMAND); if (sslContextDependency != null) { this.sslContextDependency.register(builder); } return builder; }

Target:
public ServiceBuilder<SecurityConfiguration> build(ServiceTarget target) { ServiceBuilder<SecurityConfiguration> builder = target.addService(this.getServiceName(), new ValueService<>(this)).setInitialMode(ServiceController.Mode.ON_DEMAND); return (this.sslContextDependency != null) ? this.sslContextDependency.register(builder) : builder; }
Source:
private Supplier<ZkUtils> getZkConnection() { String zkConnect = config.get(String.format(KafkaConfig.CONSUMER_CONFIGS_CONFIG_KEY(), systemName, ZOOKEEPER_CONNECT)); if (StringUtils.isBlank(zkConnect)) { throw new SamzaException("Missing zookeeper.connect config for admin for system " + systemName); } return () -> { return ZkUtils.apply(zkConnect, 6000, 6000, false); }; }

Target:
private Supplier<ZkUtils> getZkConnection() { String zkConnect = config.get(String.format(KafkaConfig.CONSUMER_CONFIGS_CONFIG_KEY(), systemName, ZOOKEEPER_CONNECT)); if (StringUtils.isBlank(zkConnect)) { throw new SamzaException("Missing zookeeper.connect config for admin for system " + systemName); } return () -> ZkUtils.apply(zkConnect, 6000, 6000, false); }
Source:
private long balanceCost(MrBalancePenalty penalty, MrMachine machine, long originalUsage, long targetUsage) { long originalAvailability = machine.getMachineCapacity(penalty.getOriginResource()).getMaximumCapacity() - originalUsage; long targetAvailability = machine.getMachineCapacity(penalty.getTargetResource()).getMaximumCapacity() - targetUsage; long balanceCost = penalty.getMultiplicand() * originalAvailability - targetAvailability; return balanceCost < 0 ? 0 : balanceCost; }

Target:
private long balanceCost(MrBalancePenalty penalty, MrMachine machine, long originalUsage, long targetUsage) { long originalAvailability = machine.getMachineCapacity(penalty.getOriginResource()).getMaximumCapacity() - originalUsage; long targetAvailability = machine.getMachineCapacity(penalty.getTargetResource()).getMaximumCapacity() - targetUsage; long balanceCost = penalty.getMultiplicand() * originalAvailability - targetAvailability; return Math.max(0, balanceCost); }
Source:
static Long toMillis(Duration duration) { if (duration == null) { return null; } return duration.toMillis(); }

Target:
private static Long toMillis(Duration duration) { if (duration == null) { return null; } return duration.toMillis(); }
Source:
public Object create(SimpleObject post, RequestContext context) throws ResponseException { moduleFactoryWrapper.checkPrivilege(); ModuleAction action = parseAction(post, context); Collection<Module> modules = action.isAllModules() ? moduleFactoryWrapper.getLoadedModules() : action.getModules(); ServletContext servletContext = getServletContext(context); if (modules.isEmpty()) { throw new IllegalArgumentException("Cannot execute action " + action.getType() + " on empty set of modules."); } else { switch (action.getType()) { case START: startModules(modules, servletContext); break; case STOP: stopModules(modules, servletContext); break; case RESTART: restartModules(modules, servletContext); break; case UNLOAD: unloadModules(modules, servletContext); break; } } return ConversionUtil.convertToRepresentation(action, Representation.DEFAULT); }

Target:
public Object create(SimpleObject post, RequestContext context) throws ResponseException { moduleFactoryWrapper.checkPrivilege(); ModuleAction action = newDelegate(); setConvertedProperties(action, post, getCreatableProperties(), true); Collection<Module> modules; if (action.isAllModules() != null && action.isAllModules()) { modules = moduleFactoryWrapper.getLoadedModules(); action.setModules(new ArrayList<Module>(modules)); } else { modules = action.getModules(); } ServletContext servletContext = getServletContext(context); if (modules == null || modules.isEmpty()) { throw new IllegalRequestException("Cannot execute action " + action.getAction() + " on empty set of modules."); } else { Module restModule = moduleFactoryWrapper.getModuleById(RestConstants.MODULE_ID); modules.remove(restModule); switch (action.getAction()) { case START: startModules(modules, servletContext); break; case STOP: stopModules(modules, servletContext, true); break; case RESTART: restartModules(modules, servletContext); break; case UNLOAD: unloadModules(modules, servletContext); break; } } return ConversionUtil.convertToRepresentation(action, Representation.DEFAULT); }
Source:
protected List getModelChildren() { if (eic == null) { eic = new EventInputContainer(getModel()); } if (eoc == null) { eoc = new EventOutputContainer(getModel()); } if (vic == null) { vic = new VariableInputContainer(getModel()); } if (socketcont == null) { socketcont = new SocketContainer(getModel()); } if (voc == null) { voc = new VariableOutputContainer(getModel()); } if (plugcont == null) { plugcont = new PlugContainer(getModel()); } ArrayList<Object> temp = new ArrayList<>(6); temp.add(eic); temp.add(eoc); temp.add(vic); if (!(getModel() instanceof AdapterFBType)) { temp.add(socketcont); } temp.add(voc); if (!(getModel() instanceof AdapterFBType)) { temp.add(plugcont); } return temp; }

Target:
protected List getModelChildren() { if (null == eic) { eic = new EventInputContainer(getModel()); } if (null == eoc) { eoc = new EventOutputContainer(getModel()); } if (null == vic) { vic = new VariableInputContainer(getModel()); } if (null == socketcont) { socketcont = new SocketContainer(getModel()); } if (null == voc) { voc = new VariableOutputContainer(getModel()); } if (null == plugcont) { plugcont = new PlugContainer(getModel()); } ArrayList<Object> temp = new ArrayList<>(6); temp.add(eic); temp.add(eoc); temp.add(vic); if (!(getModel() instanceof AdapterFBType)) { temp.add(socketcont); } temp.add(voc); if (!(getModel() instanceof AdapterFBType)) { temp.add(plugcont); } return temp; }
Source:
public GHBranch apply(GHBranch remoteBranch) { LOGGER.trace("updating local branch repository with [{}]", remoteBranch.getName()); localRepo.getBranches().put(remoteBranch.getName(), new GitHubBranch(remoteBranch)); return remoteBranch; }

Target:
public GHBranch apply(GHBranch remoteBranch) { LOGGER.trace("Updating local branch repository with [{}]", remoteBranch.getName()); localRepo.getBranches().put(remoteBranch.getName(), new GitHubBranch(remoteBranch)); return remoteBranch; }
Source:
private static void trainData(DataNormalization dataNormalization, ParentPathLabelGenerator labelMaker, ComputationGraph computationGraph) { try { for (int i = 0; i < numEpochs; ++i) { currentEpoch = i; ImageRecordReader recordReader = new ImageRecordReader(height, width, channels, labelMaker); recordReader.initialize(trainingData, getImageTransform(i)); DataSetIterator dataSetIterator = new RecordReaderDataSetIterator(recordReader, batchSize, 1, outputNum); dataNormalization.fit(dataSetIterator); dataSetIterator.setPreProcessor(dataNormalization); computationGraph.fit(dataSetIterator); dataSetIterator.reset(); } } catch (IOException e) { e.printStackTrace(); } }

Target:
private static void trainData(DataNormalization dataNormalization, ParentPathLabelGenerator labelMaker, ComputationGraph computationGraph) { try { ImageRecordReader recordReader = new ImageRecordReader(height, width, channels, labelMaker); recordReader.initialize(trainingData, getImageTransform()); DataSetIterator dataSetIterator = new RecordReaderDataSetIterator(recordReader, batchSize, 1, outputNum); dataNormalization.fit(dataSetIterator); dataSetIterator.setPreProcessor(dataNormalization); computationGraph.fit(dataSetIterator, numEpochs); dataSetIterator.reset(); } catch (IOException e) { e.printStackTrace(); } }
Source:
public synchronized VDS getFullVds() { if (fullVds == null) { fullVds = DbFacade.getInstance().getVdsDao().get(vdsStatic.getId()); } return fullVds; }

Target:
public VDS getFullVds() { if (fullVds == null) { synchronized (this) { if (fullVds == null) { fullVds = DbFacade.getInstance().getVdsDao().get(vdsStatic.getId()); } } } return fullVds; }
Source:
public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) { if (obj != null && obj instanceof Number && toAppendTo != null) { @Nullable LamiGraphRange internalRange = fInternalRange; @Nullable LamiGraphRange externalRange = fExternalRange; if (internalRange == null || externalRange == null) { long time = ((Number)obj).longValue(); return checkNotNull(toAppendTo.append(fFormat.format(time))); } if (internalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { long time = externalRange.getMinimum().longValue(); return checkNotNull(toAppendTo.append(fFormat.format(time))); } BigDecimal externalValue = (new BigDecimal(obj.toString())) .subtract(internalRange.getMinimum()) .multiply(externalRange.getDelta()) .divide(internalRange.getDelta(), 22, BigDecimal.ROUND_DOWN) .add(externalRange.getMinimum()); return checkNotNull(toAppendTo.append(fFormat.format(externalValue.longValue()))); } return new StringBuffer(); }

Target:
public StringBuffer format(@Nullable Object obj, @Nullable StringBuffer toAppendTo, @Nullable FieldPosition pos) { if (obj != null && obj instanceof Number && toAppendTo != null) { @Nullable LamiGraphRange internalRange = fInternalRange; @Nullable LamiGraphRange externalRange = fExternalRange; if (internalRange == null || externalRange == null) { long time = ((Number)obj).longValue(); return checkNotNull(toAppendTo.append(fFormat.format(time))); } BigDecimal externalDelta = externalRange.getDelta(); if (externalRange.getDelta().compareTo(BigDecimal.ZERO) == 0) { externalDelta = BigDecimal.ONE; } BigDecimal externalValue = (new BigDecimal(obj.toString())) .subtract(internalRange.getMinimum()) .multiply(externalDelta) .divide(internalRange.getDelta(), BIG_DECIMAL_DIVISION_SCALE, BigDecimal.ROUND_DOWN) .add(externalRange.getMinimum()); return checkNotNull(toAppendTo.append(fFormat.format(externalValue.longValue()))); } return new StringBuffer(); }
Source:
private NewTableConfiguration attachIteratorToNewTable(final CommandLine cl, final Shell shellState, NewTableConfiguration ntc) { EnumSet<IteratorUtil.IteratorScope> scopeEnumSet = null; IteratorSetting iteratorSetting = null; if (shellState.iteratorProfiles.size() == 0) throw new IllegalArgumentException("No shell iterator profiles have been created."); String[] options = cl.getOptionValues(createTableOptIteratorProps.getOpt()); for (String profileInfo : options) { String[] parts = profileInfo.split(":", 2); String profileName = parts[0]; try { iteratorSetting = shellState.iteratorProfiles.get(profileName).get(0); } catch (NullPointerException ex) { throw new IllegalArgumentException("invalid iterator argument. Either profile does not exist or unexpected spaces in argument list.", ex); } if (parts.length == 1) { scopeEnumSet = EnumSet.allOf(IteratorUtil.IteratorScope.class); } else { List<String> scopeArgs = Arrays.asList(parts[1].split(",")); if (scopeArgs.size() > 3) throw new IllegalArgumentException("Too many scope arguments supplied"); if (scopeArgs.contains("all")) { if (scopeArgs.size() > 1) throw new IllegalArgumentException("Cannot use 'all' in conjunction with other scopes"); scopeEnumSet = EnumSet.allOf(IteratorUtil.IteratorScope.class); } else { validateScopes(scopeArgs); scopeEnumSet = addScopeArgsToIteratorEnumSet(scopeArgs); } } ntc.attachIterator(iteratorSetting, scopeEnumSet); } return ntc; }

Target:
private NewTableConfiguration attachIteratorToNewTable(final CommandLine cl, final Shell shellState, NewTableConfiguration ntc) { EnumSet<IteratorScope> scopeEnumSet; IteratorSetting iteratorSetting; if (shellState.iteratorProfiles.size() == 0) throw new IllegalArgumentException("No shell iterator profiles have been created."); String[] options = cl.getOptionValues(createTableOptIteratorProps.getOpt()); for (String profileInfo : options) { String[] parts = profileInfo.split(":", 2); String profileName = parts[0]; try { iteratorSetting = shellState.iteratorProfiles.get(profileName).get(0); } catch (NullPointerException ex) { throw new IllegalArgumentException("invalid iterator argument. Either profile does not exist or unexpected spaces in argument list.", ex); } if (parts.length == 1) { scopeEnumSet = EnumSet.allOf(IteratorScope.class); } else { List<String> scopeArgs = Arrays.asList(parts[1].split(",")); if (scopeArgs.size() > 3) throw new IllegalArgumentException("Too many scope arguments supplied"); if (scopeArgs.contains("all")) { if (scopeArgs.size() > 1) throw new IllegalArgumentException("Cannot use 'all' in conjunction with other scopes"); scopeEnumSet = EnumSet.allOf(IteratorScope.class); } else { scopeEnumSet = validateScopes(scopeArgs); } } ntc.attachIterator(iteratorSetting, scopeEnumSet); } return ntc; }
Source:
public void testGetSetDateTime() throws IOException { final long expectedDatetimeValue = 1454059947000L; final long expectedDatetimeOffsetValue = 32400000L; final String dateTimeValue = "2017:02:02 22:22:22"; final String dateTimeOriginalValue = "2017:01:01 11:11:11"; File imageFile = new File( Environment.getExternalStorageDirectory(), JPEG_WITH_EXIF_BYTE_ORDER_II); ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath()); assertEquals(expectedDatetimeValue, exif.getDateTime()); exif.setAttribute(ExifInterface.TAG_DATETIME, dateTimeValue); exif.setAttribute(ExifInterface.TAG_DATETIME_ORIGINAL, dateTimeOriginalValue); exif.saveAttributes(); exif = new ExifInterface(imageFile.getAbsolutePath()); assertEquals(dateTimeValue, exif.getAttribute(ExifInterface.TAG_DATETIME)); assertEquals(dateTimeOriginalValue, exif.getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL)); exif.setAttribute(ExifInterface.TAG_DATETIME, null); exif.saveAttributes(); exif = new ExifInterface(imageFile.getAbsolutePath()); assertEquals(dateTimeOriginalValue, exif.getAttribute(ExifInterface.TAG_DATETIME)); long currentTimeStamp = System.currentTimeMillis(); exif.setDateTime(currentTimeStamp); exif.saveAttributes(); exif = new ExifInterface(imageFile.getAbsolutePath()); assertEquals(currentTimeStamp - expectedDatetimeOffsetValue, exif.getDateTime()); }

Target:
public void testGetSetDateTime() throws IOException { final long expectedDatetimeValue = 1454059947000L; final long expectedDatetimeOffsetLongValue = 32400000L; final String expectedDatetimeOffsetStringValue = "+09:00"; final String dateTimeValue = "2017:02:02 22:22:22"; final String dateTimeOriginalValue = "2017:01:01 11:11:11"; File imageFile = getFileFromExternalDir(JPEG_WITH_DATETIME_TAG); ExifInterface exif = new ExifInterface(imageFile.getAbsolutePath()); assertEquals(expectedDatetimeValue, exif.getDateTime()); assertEquals(expectedDatetimeValue, exif.getDateTimeOriginal()); assertEquals(expectedDatetimeValue, exif.getDateTimeDigitized()); assertEquals(expectedDatetimeOffsetStringValue, exif.getAttribute(ExifInterface.TAG_OFFSET_TIME)); assertEquals(expectedDatetimeOffsetStringValue, exif.getAttribute(ExifInterface.TAG_OFFSET_TIME_ORIGINAL)); assertEquals(expectedDatetimeOffsetStringValue, exif.getAttribute(ExifInterface.TAG_OFFSET_TIME_DIGITIZED)); exif.setAttribute(ExifInterface.TAG_DATETIME, dateTimeValue); exif.setAttribute(ExifInterface.TAG_DATETIME_ORIGINAL, dateTimeOriginalValue); exif.saveAttributes(); exif = new ExifInterface(imageFile.getAbsolutePath()); assertEquals(dateTimeValue, exif.getAttribute(ExifInterface.TAG_DATETIME)); assertEquals(dateTimeOriginalValue, exif.getAttribute(ExifInterface.TAG_DATETIME_ORIGINAL)); exif.setAttribute(ExifInterface.TAG_DATETIME, null); exif.saveAttributes(); exif = new ExifInterface(imageFile.getAbsolutePath()); assertEquals(dateTimeOriginalValue, exif.getAttribute(ExifInterface.TAG_DATETIME)); long currentTimeStamp = System.currentTimeMillis(); exif.setDateTime(currentTimeStamp); exif.saveAttributes(); exif = new ExifInterface(imageFile.getAbsolutePath()); assertEquals(currentTimeStamp - expectedDatetimeOffsetLongValue, exif.getDateTime()); }
Source:
public int run() throws IOException { Preconditions.checkArgument(samplePaths != null && !samplePaths.isEmpty(), "Sample JSON path is required"); Preconditions.checkArgument(samplePaths.size() == 1, "Only one JSON sample can be given"); Preconditions.checkArgument(objectsToSample > 0, "At least one object must be sampled"); Schema sampleSchema = JsonUtil.inferSchema( open(samplePaths.get(0)), recordName, objectsToSample); if (sampleSchema != null) { output(sampleSchema.toString(!minimize), console, outputPath); return 0; } else { console.error("Sample file did not contain any records"); return 1; } }

Target:
public int run() throws IOException { Preconditions.checkArgument(samplePaths != null && !samplePaths.isEmpty(), "Sample JSON path is required"); Preconditions.checkArgument(samplePaths.size() == 1, "Only one JSON sample can be given"); Schema sampleSchema = JsonUtil.inferSchema( open(samplePaths.get(0)), recordName, 10); if (sampleSchema != null) { output(sampleSchema.toString(!minimize), console, outputPath); return 0; } else { console.error("Sample file did not contain any records"); return 1; } }
Source:
private String getTextForSegments(VDomainModelReference dmr) { final EList<VDomainModelReferenceSegment> segments = dmr.getSegments(); if (segments.isEmpty()) { return adapterFactoryItemDelegator.getText(dmr); } String attributeType = null; try { final IEMFValueProperty valueProperty = Activator.getDefault().getEMFFormsDatabinding().getValueProperty( dmr, Helper.getRootEClass(dmr)); attributeType = valueProperty.getStructuralFeature().getEType().getName(); } catch (final DatabindingFailedException ex) { } final String className = Helper.getRootEClass(dmr).getName(); String attributeName = " -> " + adapterFactoryItemDelegator.getText(segments.get(segments.size() - 1)); if (attributeType != null && !attributeType.isEmpty()) { attributeName += " : " + attributeType; } String referencePath = ""; for (int i = 0; i < segments.size() - 1; i++) { referencePath = referencePath + " -> " + adapterFactoryItemDelegator.getText(segments.get(i)); } final String linkText = className + referencePath + attributeName; if (linkText.equals(" -> ")) { return null; } return linkText; }

Target:
private String getTextForSegments(VDomainModelReference dmr) { final EList<VDomainModelReferenceSegment> segments = dmr.getSegments(); if (segments.isEmpty()) { return adapterFactoryItemDelegator.getText(dmr); } String attributeType = null; final EClass rootEClass = Helper.getRootEClass(dmr); try { final IValueProperty<?, ?> valueProperty = getEMFFormsDatabinding().getValueProperty( dmr, rootEClass); final EStructuralFeature feature = (EStructuralFeature) valueProperty.getValueType(); attributeType = feature.getEType().getName(); } catch (final DatabindingFailedException ex) { } final String className = rootEClass.getName(); String attributeName = " -> " + adapterFactoryItemDelegator.getText(segments.get(segments.size() - 1)); if (attributeType != null && !attributeType.isEmpty()) { attributeName += " : " + attributeType; } String referencePath = ""; for (int i = 0; i < segments.size() - 1; i++) { referencePath = referencePath + " -> " + adapterFactoryItemDelegator.getText(segments.get(i)); } final String linkText = className + referencePath + attributeName; if (linkText.equals(" -> ")) { return null; } return linkText; }
Source:
private CoverageProvider getUberallsCoverage(AbstractBuild build, BuildListener listener) { if (!build.getResult().isBetterOrEqualTo(Result.UNSTABLE) || !uberallsEnabled) { return null; } Logger logger = new Logger(listener.getLogger()); InstanceProvider<CoverageProvider> provider = new InstanceProvider<CoverageProvider>( Jenkins.getInstance(), "cobertura", COBERTURA_CLASS_NAME, logger ); CoverageProvider coverage = provider.getInstance(); if (coverage == null) { return null; } coverage.setBuild(build); if (coverage.hasCoverage()) { return coverage; } else { logger.info(UBERALLS_TAG, "No cobertura results found"); return null; } }

Target:
private CoverageProvider getUberallsCoverage(AbstractBuild build, BuildListener listener) { if (!build.getResult().isBetterOrEqualTo(Result.UNSTABLE) || !uberallsEnabled) { return null; } Logger logger = new Logger(listener.getLogger()); InstanceProvider<CoverageProvider> provider = new InstanceProvider<CoverageProvider>( Jenkins.getInstance(), COBERTURA_PLUGIN_NAME, COBERTURA_CLASS_NAME, logger ); CoverageProvider coverage = provider.getInstance(); if (coverage == null) { return null; } coverage.setBuild(build); if (coverage.hasCoverage()) { return coverage; } else { logger.info(UBERALLS_TAG, "No cobertura results found"); return null; } }