auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean hasNext() { if (bufferedRecord != null) { return true; } try { bufferedRecord = readNextWarcRecord(stream, Document.WARC_VERSION); } catch (IOException e) { LOG.error("Exception from BufferedReader:", e); return false; } return bufferedRecord != null; }

Target:
public boolean hasNext() { if (bufferedRecord != null) { return true; } try { bufferedRecord = readNextWarcRecord(stream, Document.WARC_VERSION); } catch (NoSuchElementException e1) { return false; } catch (IOException e2) { LOG.error("Exception from BufferedReader:", e2); return false; } return bufferedRecord != null; }
Source:
private URI addCookieInterceptorIfRequired(URI uri) throws URISyntaxException { String uriProtocol = uri.getScheme(); String uriHost = uri.getHost(); String uriPath = uri.getRawPath(); int uriPort = uri.getPort(); if (uriPort < 0) { if ("http".equals(uriProtocol)) { uriPort = 80; } else if ("https".equals(uriProtocol)) { uriPort = 443; } } Misc.checkArgument(uriPort >= 0, String.format(Locale.ENGLISH, "Could not determine default port for protocol \"%s\"", uriProtocol)); if (uri.getUserInfo() != null) { String[] parts = uri.getUserInfo().split(":"); if (parts.length == 2) { CookieInterceptor ci = new CookieInterceptor(parts[0], parts[1]); requestInterceptors.add(ci); responseInterceptors.add(ci); } } URI redacted = new URI(uriProtocol + "://" + uriHost + ":" + uriPort + (uriPath != null ? uriPath : "")); return redacted; }

Target:
private URI addCookieInterceptorIfRequired(URI uri) { String uriProtocol = uri.getScheme(); String uriHost = uri.getHost(); String uriPath = uri.getRawPath(); int uriPort = uri.getPort(); if ("http".equals(uriProtocol)) { uriPort = uriPort < 0 ? 80 : uriPort; } else if ("https".equals(uriProtocol)) { uriPort = uriPort < 0 ? 443 : uriPort; } else { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Protocol %s not supported", uriProtocol)); } if (uri.getUserInfo() != null) { String[] parts = uri.getUserInfo().split(":"); if (parts.length == 2) { CookieInterceptor ci = new CookieInterceptor(parts[0], parts[1]); requestInterceptors.add(ci); responseInterceptors.add(ci); } } try { return new URI(uriProtocol + "://" + uriHost + ":" + uriPort + (uriPath != null ? uriPath : "")); } catch (URISyntaxException use) { throw new RuntimeException("Failed to construct URI", use); } }
Source:
@Override protected void onFinishInflate() { super.onFinishInflate(); ((TextView) findViewById(R.id.email)).setText(editor.email); EditText nameView = (EditText) findViewById(R.id.edit_name); nameView.setText(editor.name); nameView.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { editor.name = s.toString(); } @Override public void afterTextChanged(Editable s) { } }); nameView.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { Flow.get(v).set(new EditEmailScreen(editor.id)); return true; } }); }

Target:
@Override protected void onFinishInflate() { super.onFinishInflate(); emailView = (TextView) findViewById(R.id.email); nameView = (EditText) findViewById(R.id.edit_name); }
Source:
public void addUpdate(String updatedItemName, byte[] updatedItemData) { synchronized (itemsToUpdate) { itemsToUpdate.add(updatedItemName); serializedMaps.put(updatedItemName, updatedItemData); itemsToUpdate.notify(); } }

Target:
public void addUpdate(String updatedItemName, byte[] updatedItemData) { updateQueue.add( new Pair<>(updatedItemName, updatedItemData) ); }
Source:
protected void executeQueryCommand() { Guid vdsId = getParameters().getId(); String[] names = new String[0]; setLldpVDSCommandParameters(new GetLldpVDSCommandParameters(vdsId, names)); super.executeQueryCommand(); }

Target:
protected void executeQueryCommand() { String[] names = new String[0]; setLldpVDSCommandParameters(new GetLldpVDSCommandParameters(getVdsId(), names)); super.executeQueryCommand(); }
Source:
public boolean isType(String value) { GlusterStatus volStatus = GlusterStatus.valueOf(value); for (GlusterStatus status : values) { if (status.equals(volStatus)) { return true; } } return false; }

Target:
public boolean isType(String value) { for (GlusterStatus status : values) { if (status.name().equals(value)) { return true; } } return false; }
Source:
public CPPASTLiteralExpression copy(CopyStyle style) { CPPASTLiteralExpression copy = new CPPASTLiteralExpression(fKind, this.getValue()); copy.fNumericCompilerSuffixes = fNumericCompilerSuffixes.clone(); copy.fStringLiteralSize = fStringLiteralSize; copy.fEvaluation = fEvaluation; copy.fUserDefinedLiteralOperator = fUserDefinedLiteralOperator; copy.fImplicitNames = fImplicitNames == null ? null : fImplicitNames.clone(); return copy(copy, style); }

Target:
public CPPASTLiteralExpression copy(CopyStyle style) { CPPASTLiteralExpression copy = new CPPASTLiteralExpression(fKind, this.getValue(), fNumericCompilerSuffixes); copy.fStringLiteralSize = fStringLiteralSize; copy.fEvaluation = fEvaluation; copy.fUserDefinedLiteralOperator = fUserDefinedLiteralOperator; copy.fImplicitNames = fImplicitNames; return copy(copy, style); }
Source:
public ResponseEntity<String> upload(@RequestPart("file") MultipartFile file) throws SdkClientException, AmazonServiceException, URISyntaxException, IOException { String documentName = file.getOriginalFilename(); ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(file.getSize()); objectMetadata.setContentType(file.getContentType()); PutObjectRequest putObjectRequest = new PutObjectRequest(this.bucketName, documentName, file.getInputStream(), objectMetadata) .withCannedAcl(CannedAccessControlList.PublicRead); s3Client.putObject(putObjectRequest); String objectUrl = s3Client.getUrl(this.bucketName, documentName).toExternalForm(); log.info("Uploaded " + documentName + " to S3 bucket: " + objectUrl); HttpHeaders responseHeaders = new HttpHeaders(); responseHeaders.setLocation(new URI(objectUrl)); List<String> headerNames = new ArrayList<>(); headerNames.add("location"); responseHeaders.setAccessControlExposeHeaders(headerNames); return new ResponseEntity<String>(responseHeaders, HttpStatus.CREATED); }

Target:
public ResponseEntity<String> upload(@RequestPart("file") MultipartFile file) throws SdkClientException, AmazonServiceException, URISyntaxException, IOException { String documentName = file.getOriginalFilename(); ObjectMetadata objectMetadata = new ObjectMetadata(); objectMetadata.setContentLength(file.getSize()); objectMetadata.setContentType(file.getContentType()); PutObjectRequest putObjectRequest = new PutObjectRequest(this.bucketName, documentName, file.getInputStream(), objectMetadata) .withCannedAcl(CannedAccessControlList.PublicRead); s3Client.putObject(putObjectRequest); String objectUrl = s3Client.getUrl(this.bucketName, documentName).toExternalForm(); log.info("Uploaded " + documentName + " to S3 bucket: " + objectUrl); HttpHeaders responseHeaders = new HttpHeaders(); responseHeaders.setLocation(new URI(objectUrl)); return new ResponseEntity<String>(responseHeaders, HttpStatus.CREATED); }
Source:
TerminationData killTask(JobId jobId, String taskName) throws UnknownJobException, UnknownTaskException { JobData jobData = lockJob(jobId); if (jobData == null) { throw new UnknownJobException(jobId); } try { InternalTask task = jobData.job.getTask(taskName); if (!task.getStatus().isTaskAlive()) { tlogger.info(task.getId(), "task isn't alive: " + task.getStatus()); return emptyResult(task.getId()); } RunningTaskData taskData = runningTasksData.remove(TaskIdWrapper.wrap(task.getId())); if (taskData == null) { throw new IllegalStateException("No information for: " + task.getId()); } TaskResultImpl taskResult = new TaskResultImpl(task.getId(), new TaskAbortedException("Aborted by user"), new SimpleTaskLogs("", "Aborted by user"), System.currentTimeMillis() - task.getStartTime()); TerminationData terminationData = TerminationData.newTerminationData(); terminationData.addTaskData(jobData.job, taskData, false, taskResult); if (onErrorPolicyInterpreter.requiresCancelJobOnError(task)) { endJob(jobData, terminationData, task, taskResult, "The task has been manually killed. " + "You also ask to cancel the job in such a situation!", JobStatus.CANCELED); } else { terminateTask(jobData, task, true, taskResult, terminationData); } return terminationData; } finally { jobData.unlock(); } }

Target:
TerminationData killTask(JobId jobId, String taskName) throws UnknownJobException, UnknownTaskException { JobData jobData = lockJob(jobId); if (jobData == null) { throw new UnknownJobException(jobId); } try { InternalTask task = jobData.job.getTask(taskName); if (!task.getStatus().isTaskAlive()) { tlogger.info(task.getId(), "task isn't alive: " + task.getStatus()); return emptyResult(task.getId()); } RunningTaskData taskData = runningTasksData.remove(TaskIdWrapper.wrap(task.getId())); if (taskData == null) { throw new IllegalStateException("No information for: " + task.getId()); } TaskResultImpl taskResult = new TaskResultImpl(task.getId(), new TaskAbortedException("Aborted by user"), new SimpleTaskLogs("", "Aborted by user"), System.currentTimeMillis() - task.getStartTime()); TerminationData terminationData = createAndFillTerminationData(taskResult,taskData,jobData.job,false); if (onErrorPolicyInterpreter.requiresCancelJobOnError(task)) { endJob(jobData, terminationData, task, taskResult, "The task has been manually killed. " + "You also ask to cancel the job in such a situation!", JobStatus.CANCELED); } else { terminateTask(jobData, task, true, taskResult, terminationData); } return terminationData; } finally { jobData.unlock(); } }
Source:
public <T> Vector<T> intersection(Vector<T> a, Vector<T> b) { Vector<T> result = new Vector<>(); HashSet<T> setA = new HashSet<>(a); HashSet<T> setB = new HashSet<>(b); setA.retainAll(setB); result.addAll(setA); return result; }

Target:
public <T> Vector<T> intersection(Vector<T> a, Vector<T> b) { HashSet<T> setA = new HashSet<>(a); HashSet<T> setB = new HashSet<>(b); setA.retainAll(setB); return new Vector<>(setA); }
Source:
public void doGet(HttpServletRequest req, HttpServletResponse resp) { String courseId = HttpRequestHelper.getValueFromRequestParameterMap(req, ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentEmail = HttpRequestHelper.getValueFromRequestParameterMap(req, ParamsNames.STUDENT_EMAIL); Assumption.assertNotNull(studentEmail); try { StudentsLogic.inst().sendRegistrationInviteToStudent(courseId, studentEmail); } catch (EntityDoesNotExistException e) { log.severe("Unexpected error while sending emails " + e.getMessage()); } }

Target:
public void doGet(HttpServletRequest req, HttpServletResponse resp) { String courseId = HttpRequestHelper.getValueFromRequestParameterMap(req, ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentEmail = HttpRequestHelper.getValueFromRequestParameterMap(req, ParamsNames.STUDENT_EMAIL); Assumption.assertNotNull(studentEmail); try { StudentsLogic.inst().sendRegistrationInviteToStudent(courseId, studentEmail); } catch (EntityDoesNotExistException e) { log.severe("Unexpected error while sending emails " + TeammatesException.toStringWithStackTrace(e)); } }
Source:
public String getLogString() { StringBuffer sb = new StringBuffer(); appendPair(sb, "merchantID", merchantID); appendPair(sb, "keysDirectory", keysDirectory); appendPair(sb, "keyAlias", keyAlias); appendPair(sb, "keyPassword", new String(kp)); appendPair(sb, "sendToProduction", sendToProduction); appendPair(sb, "sendToAkamai", sendToAkamai); appendPair(sb, "targetAPIVersion", targetAPIVersion); appendPair(sb, "keyFilename", keyFilename); appendPair(sb, "serverURL", serverURL); appendPair(sb, "namespaceURI", namespaceURI); appendPair(sb, "enableLog", enableLog); appendPair(sb, "logDirectory", logDirectory); appendPair(sb, "logFilename", logFilename); appendPair(sb, "logMaximumSize", logMaximumSize); appendPair(sb, "customHttpClass", customHttpClass); appendPair(sb, "customHttpClassEnabled", customHttpClassEnabled); appendPair(sb, "useHttpClient", useHttpClient); appendPair(sb, "enableJdkCert", enableJdkCert); appendPair(sb, "enableCacert", enableCacert); if(useHttpClient){ appendPair(sb, "allowRetry", allowRetry); appendPair(sb, "RetryCount", numberOfRetries); appendPair(sb, "RetryInterval", retryInterval); } appendPair(sb, "timeout", timeout); if (proxyHost != null) { appendPair(sb, "proxyHost", proxyHost); appendPair(sb, "proxyPort", proxyPort); if (proxyUser != null) { appendPair(sb, "proxyUser", proxyUser); appendPair(sb, "proxyPassword", pp != null ? "(masked)" : null); } } appendPair(sb, "useSignAndEncrypted", useSignAndEncrypted); appendPair(sb, "certificateCacheEnabled", certificateCacheEnabled); return (sb.toString()); }

Target:
public String getLogString() { StringBuffer sb = new StringBuffer(); appendPair(sb, "merchantID", merchantID); appendPair(sb, "keysDirectory", keysDirectory); appendPair(sb, "keyAlias", keyAlias); appendPair(sb, "keyPassword", new String(kp) != null ? "(masked)" : null); appendPair(sb, "sendToProduction", sendToProduction); appendPair(sb, "sendToAkamai", sendToAkamai); appendPair(sb, "targetAPIVersion", targetAPIVersion); appendPair(sb, "keyFilename", keyFilename); appendPair(sb, "serverURL", serverURL); appendPair(sb, "namespaceURI", namespaceURI); appendPair(sb, "enableLog", enableLog); appendPair(sb, "logDirectory", logDirectory); appendPair(sb, "logFilename", logFilename); appendPair(sb, "logMaximumSize", logMaximumSize); appendPair(sb, "customHttpClass", customHttpClass); appendPair(sb, "customHttpClassEnabled", customHttpClassEnabled); appendPair(sb, "useHttpClient", useHttpClient); appendPair(sb, "enableJdkCert", enableJdkCert); appendPair(sb, "enableCacert", enableCacert); if(useHttpClient){ appendPair(sb, "allowRetry", allowRetry); appendPair(sb, "RetryCount", numberOfRetries); appendPair(sb, "RetryInterval", retryInterval); } appendPair(sb, "timeout", timeout); if (proxyHost != null) { appendPair(sb, "proxyHost", proxyHost); appendPair(sb, "proxyPort", proxyPort); if (proxyUser != null) { appendPair(sb, "proxyUser", proxyUser); appendPair(sb, "proxyPassword", pp != null ? "(masked)" : null); } } appendPair(sb, "useSignAndEncrypted", useSignAndEncrypted); appendPair(sb, "certificateCacheEnabled", certificateCacheEnabled); return (sb.toString()); }
Source:
void throwingEvaluatorIsCreatedWhenScriptEngineIsNotAvailable() { String nameOfScriptEngine = "javax.script.DoesNotExist"; String name = "org.junit.jupiter.engine.extension.ScriptExecutionEvaluator"; ScriptExecutionCondition.Evaluator evaluator = ScriptExecutionCondition.Evaluator.forName(nameOfScriptEngine, name); Exception e = assertThrows(Exception.class, () -> evaluator.evaluate(null, null)); assertTrue(e instanceof ExtensionConfigurationException); String message = e.getMessage(); System.out.println(message); assertTrue(message.startsWith("Class `" + nameOfScriptEngine + "` is not loadable")); assertTrue(message.endsWith("`--add-modules ...,java.scripting`")); }

Target:
void throwingEvaluatorIsCreatedWhenScriptEngineIsNotAvailable() { String nameOfScriptEngine = "javax.script.DoesNotExist"; String name = "org.junit.jupiter.engine.extension.ScriptExecutionEvaluator"; ScriptExecutionCondition.Evaluator evaluator = ScriptExecutionCondition.Evaluator.forName(nameOfScriptEngine, name); Exception e = assertThrows(Exception.class, () -> evaluator.evaluate(null, null)); assertThat(e) .isInstanceOf(ExtensionConfigurationException.class) .hasMessageStartingWith("Class `" + nameOfScriptEngine + "` is not loadable") .hasMessageEndingWith("`--add-modules ...,java.scripting`"); }
Source:
public void init() throws Exception { final NakadiSettings nakadiSettings = new NakadiSettings(0, 0, 0, TOPIC_RETENTION_TIME_MS, 0, 60, NAKADI_POLL_TIMEOUT, NAKADI_SEND_TIMEOUT, 0, NAKADI_EVENT_MAX_BYTES, 0); final PartitionsCalculator partitionsCalculator = new KafkaConfig().createPartitionsCalculator( "t2.large", objectMapper, nakadiSettings); final EventTypeService eventTypeService = new EventTypeService(eventTypeRepository, topicRepository, partitionResolver, enrichment, subscriptionRepository, schemaEvolutionService, partitionsCalculator, featureToggleService, timelineSync, nakadiSettings); final EventTypeOptionsValidator eventTypeOptionsValidator = new EventTypeOptionsValidator(TOPIC_RETENTION_MIN_MS, TOPIC_RETENTION_MAX_MS); final EventTypeController controller = new EventTypeController(eventTypeService, featureToggleService, eventTypeOptionsValidator, applicationService, nakadiSettings); doReturn(randomUUID).when(uuid).randomUUID(); final MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(objectMapper); doReturn(true).when(applicationService).exists(any()); doReturn(SecuritySettings.AuthMode.OFF).when(settings).getAuthMode(); doReturn("nakadi").when(settings).getAdminClientId(); doReturn(true).when(featureToggleService).isFeatureEnabled(CHECK_PARTITIONS_KEYS); mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), jackson2HttpMessageConverter) .setCustomArgumentResolvers(new ClientResolver(settings, featureToggleService)) .build(); }

Target:
public void init() throws Exception { final NakadiSettings nakadiSettings = new NakadiSettings(0, 0, 0, TOPIC_RETENTION_TIME_MS, 0, 60, NAKADI_POLL_TIMEOUT, NAKADI_SEND_TIMEOUT, 0, NAKADI_EVENT_MAX_BYTES, NAKADI_SUBSCRIPTION_MAX_PARTITIONS); final PartitionsCalculator partitionsCalculator = new KafkaConfig().createPartitionsCalculator( "t2.large", objectMapper, nakadiSettings); final EventTypeService eventTypeService = new EventTypeService(eventTypeRepository, topicRepository, partitionResolver, enrichment, subscriptionRepository, schemaEvolutionService, partitionsCalculator, featureToggleService, timelineSync, nakadiSettings); final EventTypeOptionsValidator eventTypeOptionsValidator = new EventTypeOptionsValidator(TOPIC_RETENTION_MIN_MS, TOPIC_RETENTION_MAX_MS); final EventTypeController controller = new EventTypeController(eventTypeService, featureToggleService, eventTypeOptionsValidator, applicationService, nakadiSettings); doReturn(randomUUID).when(uuid).randomUUID(); final MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(objectMapper); doReturn(true).when(applicationService).exists(any()); doReturn(SecuritySettings.AuthMode.OFF).when(settings).getAuthMode(); doReturn("nakadi").when(settings).getAdminClientId(); doReturn(true).when(featureToggleService).isFeatureEnabled(CHECK_PARTITIONS_KEYS); mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), jackson2HttpMessageConverter) .setCustomArgumentResolvers(new ClientResolver(settings, featureToggleService)) .build(); }
Source:
public void testCallbackOnCancel() throws Exception { TestCancellableCallable callable = new TestCancellableCallable("results"); Future<String> future = admin.schedule(callable, callback); Thread.sleep(500); future.cancel(true); verify(callback, times(0)).onSuccess(Matchers.anyString()); verify(callback).onCancelled(); verify(callback, times(0)).onFailure(Matchers.<Throwable> any()); assertEquals(true, callable.isCancelled()); assertEquals(true, future.isCancelled()); thrown.expect(CancellationException.class); future.get(); }

Target:
public void testCallbackOnCancel() throws Exception { TestCancellableCallable callable = new TestCancellableCallable("results"); Future<String> future = admin.schedule(callable, callback); while (!callable.hasBeenCalled()) { Thread.sleep(20); } future.cancel(true); verify(callback, times(0)).onSuccess(Matchers.anyString()); verify(callback).onCancelled(); verify(callback, times(0)).onFailure(Matchers.<Throwable> any()); assertEquals(true, callable.isCancelled()); assertEquals(true, future.isCancelled()); thrown.expect(CancellationException.class); future.get(); }
Source:
public void onPullComplete() { IProgramRepository programRepository = new ProgramLocalDataSource(); IMediaRepository mediaRepository = new MediaRepository(); List<Media> mediaList = mediaRepository.getAll(); if(mediaList==null || mediaList.size()==0){ mPullUseCase.notifyComplete(); return; } Media media = mediaList.get(0); if(media!=null && media.getProgram()!=null && !media.getProgram() .equals(programRepository.getUserProgram().getId())){ System.out.println("The media data will be removed"); PopulateDB.wipeMedia(Constants.MEDIA_FOLDER); } mPullUseCase.notifyComplete(); }

Target:
public void onPullComplete() { IProgramRepository programRepository = new ProgramLocalDataSource(); IMediaRepository mediaRepository = new MediaRepository(); List<Media> mediaList = mediaRepository.getAll(); if(mediaList==null || mediaList.size()==0){ mPullUseCase.notifyComplete(); return; } Media media = mediaList.get(0); if(media!=null && media.getProgram()!=null && !media.getProgram() .equals(programRepository.getUserProgram().getId())){ System.out.println("The media data will be removed"); mediaRepository.deleteAll(); FileUtils.removeDir( PreferencesState.getInstance().getContext().getFilesDir().getAbsolutePath()+"/"+Constants.MEDIA_FOLDER); } mPullUseCase.notifyComplete(); }
Source:
public boolean downloadTemplate() { HttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet(getTemplate().getUrl()); try { HttpResponse response = client.execute(get); org.apache.http.HttpEntity entity = response.getEntity(); if (entity == null) { s_logger.debug("Failed to get entity"); throw new CloudRuntimeException("Failed to get url: " + getTemplate().getUrl()); } File destFile = new File(getDownloadedFilePath()); if (!destFile.createNewFile()) { s_logger.warn("Reusing existing file " + destFile.getPath()); } try (FileOutputStream outputStream = new FileOutputStream(destFile)) { entity.writeTo(outputStream); } catch (IOException e) { s_logger.debug("downloadFromUrlToNfs:Exception:" + e.getMessage(), e); } } catch (IOException e) { s_logger.debug("Failed to get url:" + getTemplate().getUrl() + ", due to " + e.toString()); throw new CloudRuntimeException(e); } return true; }

Target:
public boolean downloadTemplate() { HttpClient client = new DefaultHttpClient(); HttpGet get = new HttpGet(getTemplate().getUrl()); try { HttpResponse response = client.execute(get); org.apache.http.HttpEntity entity = response.getEntity(); if (entity == null) { s_logger.debug("Failed to get entity"); throw new CloudRuntimeException("Failed to get url: " + getTemplate().getUrl()); } File destFile = new File(getDownloadedFilePath()); if (!destFile.createNewFile()) { s_logger.warn("Reusing existing file " + destFile.getPath()); } try (FileOutputStream outputStream = new FileOutputStream(destFile)) { entity.writeTo(outputStream); } catch (IOException e) { s_logger.debug("downloadFromUrlToNfs:Exception:" + e.getMessage(), e); } } catch (IOException e) { s_logger.debug("Failed to get url:" + getTemplate().getUrl() + ", due to " + e.toString(), e); throw new CloudRuntimeException(e); } return true; }
Source:
public void resendNotification(final ResponseData responseData) { if (EnumUtils.isValidEnum(NotificationType.class, responseData.getMessageType())) { LOGGER.info("Found response data for resending notification"); final NotificationType notificationType = NotificationType.valueOf(responseData.getMessageType()); this.notificationServiceMicrogrids.sendNotification(responseData.getOrganisationIdentification(), responseData.getDeviceIdentification(), responseData.getResultType().name(), responseData.getCorrelationUid(), this.getNotificationMessage(responseData.getMessageType()), notificationType); LOGGER.info("Notification has been resend"); responseData.setNumberOfNotificationsSent((short) (responseData.getNumberOfNotificationsSent() + 1)); this.responseDataRepository.save(responseData); } }

Target:
public void resendNotification(final ResponseData responseData) { if (!EnumUtils.isValidEnum(NotificationType.class, responseData.getMessageType())) { this.logUnknownNotificationTypeError(responseData.getCorrelationUid(), responseData.getMessageType(), this.notificationService.getClass().getName()); return; } final NotificationType notificationType = NotificationType.valueOf(responseData.getMessageType()); this.notificationService.sendNotification(responseData.getOrganisationIdentification(), responseData.getDeviceIdentification(), responseData.getResultType().name(), responseData.getCorrelationUid(), this.getNotificationMessage(responseData.getMessageType()), notificationType); }
Source:
public void serviceConfigBlockGeneration() { ServicesConfigBlock servicesConfigBlock = DialogueClientOptions.toServicesConfigBlock( ImmutableMap.of(SERVICE_NAME, REMOTE_SERVICE_CONFIGURATION_EXTENDED_TIMEOUT)); assertThat(servicesConfigBlock.services()).containsOnlyKeys(SERVICE_NAME); PartialServiceConfiguration partialServiceConfiguration = servicesConfigBlock.services().get(SERVICE_NAME); assertThat(partialServiceConfiguration.uris()).hasSameElementsAs(SERVERS); assertThat(partialServiceConfiguration.security()).contains(SSL_CONFIGURATION); assertThat(partialServiceConfiguration.backoffSlotSize()) .contains(ClientOptionsConstants.STANDARD_BACKOFF_SLOT_SIZE); assertThat(partialServiceConfiguration.connectTimeout()).contains(ClientOptionsConstants.CONNECT_TIMEOUT); assertThat(partialServiceConfiguration.maxNumRetries()).contains(ClientOptionsConstants.STANDARD_MAX_RETRIES); assertThat(partialServiceConfiguration.readTimeout()).contains(ClientOptionsConstants.LONG_READ_TIMEOUT); }

Target:
public void serviceConfigBlockGeneration() { ServicesConfigBlock servicesConfigBlock = DialogueClientOptions.toServicesConfigBlock( ImmutableMap.of(SERVICE_NAME, REMOTE_SERVICE_CONFIGURATION_EXTENDED_TIMEOUT)); assertThat(servicesConfigBlock.services()).containsOnlyKeys(SERVICE_NAME); PartialServiceConfiguration partialServiceConfiguration = servicesConfigBlock.services().get(SERVICE_NAME); assertThat(partialServiceConfiguration.uris()).hasSameElementsAs(SERVERS); assertThat(partialServiceConfiguration.security()).contains(SSL_CONFIGURATION); assertThat(partialServiceConfiguration.proxyConfiguration()).isEmpty(); assertThat(partialServiceConfiguration.backoffSlotSize()) .contains(ClientOptionsConstants.STANDARD_BACKOFF_SLOT_SIZE); assertThat(partialServiceConfiguration.connectTimeout()).contains(ClientOptionsConstants.CONNECT_TIMEOUT); assertThat(partialServiceConfiguration.maxNumRetries()).contains(ClientOptionsConstants.STANDARD_MAX_RETRIES); assertThat(partialServiceConfiguration.readTimeout()).contains(ClientOptionsConstants.LONG_READ_TIMEOUT); }
Source:
public void restartMesos() { if(!nativeLibraryLoaded) { try { MesosNativeLibrary.load(nativeLibraryPath); } catch (UnsatisfiedLinkError error) { LOGGER.warning("Failed to load native Mesos library from '" + nativeLibraryPath + "': " + error.getMessage()); MesosNativeLibrary.load(); } nativeLibraryLoaded = true; } if (!master.equals(staticMaster) || !Mesos.getInstance().isSchedulerRunning()) { if (!master.equals(staticMaster)) { LOGGER.info("Mesos master changed, restarting the scheduler"); staticMaster = master; } else { LOGGER.info("Scheduler was down, restarting the scheduler"); } Mesos.getInstance().stopScheduler(); Mesos.getInstance().startScheduler(Jenkins.getInstance().getRootUrl(), master, this.frameworkName, this); } else { Mesos.getInstance().updateScheduler(this); LOGGER.info("Mesos master has not changed, leaving the scheduler running"); } }

Target:
public void restartMesos() { if(!nativeLibraryLoaded) { try { MesosNativeLibrary.load(nativeLibraryPath); } catch (UnsatisfiedLinkError error) { LOGGER.warning("Failed to load native Mesos library from '" + nativeLibraryPath + "': " + error.getMessage()); MesosNativeLibrary.load(); } nativeLibraryLoaded = true; } if (!master.equals(staticMaster) || !Mesos.getInstance().isSchedulerRunning()) { if (!master.equals(staticMaster)) { LOGGER.info("Mesos master changed, restarting the scheduler"); staticMaster = master; } else { LOGGER.info("Scheduler was down, restarting the scheduler"); } Mesos.getInstance().stopScheduler(); Mesos.getInstance().startScheduler(Jenkins.getInstance().getRootUrl(), this); } else { Mesos.getInstance().updateScheduler(this); LOGGER.info("Mesos master has not changed, leaving the scheduler running"); } }
Source:
public void testSendSerialDataOtherProtocolsConnectionClosed() throws Exception { PowerMockito.doReturn(XBeeProtocol.ZIGBEE).when(xbeeDevice, "getXBeeProtocol"); PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_NOT_OPEN)).when(xbeeDevice, "sendXBeePacket", transmitPacket); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }

Target:
public void testSendSerialDataOtherProtocolsConnectionClosed() throws Exception { PowerMockito.doReturn(XBeeProtocol.ZIGBEE).when(xbeeDevice, "getXBeeProtocol"); Mockito.when(xbeeDevice.isOpen()).thenReturn(false); try { xbeeDevice.sendSerialData(XBEE_16BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(XBEE_64BIT_ADDRESS, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } try { xbeeDevice.sendSerialData(mockedDevice, SEND_DATA_BYTES); fail("TransmitRequest frame shouldn't have been sent successfully."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { assertEquals(XBeeException.CONNECTION_NOT_OPEN, e.getErrorCode()); } }
Source:
public static void init() { if (!glusterModeSupported()) { log.debug("Gluster mode not supported. Will not schedule jobs for refreshing Gluster data."); return; } log.debug("Initializing Gluster Jobs Manager"); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshLightWeightData", new Class[0], new Object[0], getGlusterRefreshRateLight(), getGlusterRefreshRateLight(), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshHeavyWeightData", new Class[0], new Object[0], getGlusterRefreshRateHeavy(), getGlusterRefreshRateHeavy(), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterHookSyncJob.getInstance(), "refreshHooks", new Class[0], new Object[0], getGlusterRefreshRateHooks(), getGlusterRefreshRateHooks(), TimeUnit.SECONDS); }

Target:
public static void init() { if (!glusterModeSupported()) { log.debug("Gluster mode not supported. Will not schedule jobs for refreshing Gluster data."); return; } log.debug("Initializing Gluster Jobs Manager"); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshLightWeightData", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateLight), getRefreshRate(ConfigValues.GlusterRefreshRateLight), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshHeavyWeightData", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateHeavy), getRefreshRate(ConfigValues.GlusterRefreshRateHeavy), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterHookSyncJob.getInstance(), "refreshHooks", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateHooks), getRefreshRate(ConfigValues.GlusterRefreshRateHooks), TimeUnit.SECONDS); }
Source:
public void testCreate() throws StripeException { Calendar now = Calendar.getInstance(); Map<String, Object> card = new HashMap<String, Object>(); card.put("number", "4242424242424242"); card.put("exp_month", now.get(Calendar.MONTH)); card.put("exp_year", now.get(Calendar.YEAR) + 1); Map<String, Object> params = new HashMap<String, Object>(); params.put("card", card); Token token = Token.create(params); assertNotNull(token); verifyRequest( APIResource.RequestMethod.POST, "/v1/tokens", params ); }

Target:
public void testCreate() throws StripeException { final Calendar now = Calendar.getInstance(); final Map<String, Object> card = new HashMap<String, Object>(); card.put("number", "4242424242424242"); card.put("exp_month", now.get(Calendar.MONTH)); card.put("exp_year", now.get(Calendar.YEAR) + 1); final Map<String, Object> params = new HashMap<String, Object>(); params.put("card", card); final Token token = Token.create(params); assertNotNull(token); verifyRequest( APIResource.RequestMethod.POST, "/v1/tokens", params ); }
Source:
private PoolEntry createPoolEntry() { if (totalConnections.incrementAndGet() > config.getMaximumPoolSize()) { totalConnections.decrementAndGet(); return MAXED_POOL_MARKER; } try { final PoolEntry poolEntry = newPoolEntry(); final long maxLifetime = config.getMaxLifetime(); if (maxLifetime > 0) { long inHours = TimeUnit.MILLISECONDS.toHours(maxLifetime); long randomIntervalInMillis = inHours * 10_000; if (inHours == 0) { randomIntervalInMillis = maxLifetime > 60_000 ? 10_000 : 0; } final long variance = randomIntervalInMillis > 0 ? ThreadLocalRandom.current().nextLong(randomIntervalInMillis) : 0; final long lifetime = maxLifetime - variance; poolEntry.setFutureEol(houseKeepingExecutorService.schedule(new Runnable() { @Override public void run() { softEvictConnection(poolEntry, "(connection reached maxLifetime)", false ); } }, lifetime, TimeUnit.MILLISECONDS)); } LOGGER.debug("{} - Added connection {}", poolName, poolEntry.connection); return poolEntry; } catch (Exception e) { totalConnections.decrementAndGet(); if (poolState == POOL_NORMAL) { LOGGER.debug("{} - Cannot acquire connection from data source", poolName, e); } return null; } }

Target:
private PoolEntry createPoolEntry() { if (totalConnections.incrementAndGet() > config.getMaximumPoolSize()) { totalConnections.decrementAndGet(); return MAXED_POOL_MARKER; } try { final PoolEntry poolEntry = newPoolEntry(); final long maxLifetime = config.getMaxLifetime(); if (maxLifetime > 0) { final long maxIntervalInMillis = maxLifetime > 10_000 ? Math.max(10_000, maxLifetime / 40) : 0; final long randomIntervalInMillis = maxIntervalInMillis > 0 ? ThreadLocalRandom.current().nextLong(maxIntervalInMillis) : 0; final long lifetime = maxLifetime - randomIntervalInMillis; poolEntry.setFutureEol(houseKeepingExecutorService.schedule(new Runnable() { @Override public void run() { softEvictConnection(poolEntry, "(connection reached maxLifetime)", false ); } }, lifetime, TimeUnit.MILLISECONDS)); } LOGGER.debug("{} - Added connection {}", poolName, poolEntry.connection); return poolEntry; } catch (Exception e) { totalConnections.decrementAndGet(); if (poolState == POOL_NORMAL) { LOGGER.debug("{} - Cannot acquire connection from data source", poolName, e); } return null; } }
Source:
static boolean create(final CharSequence name, final RenderedImage image, final GridSampleDimension[] src, final GridSampleDimension[] dst) { final int numBands = image.getSampleModel().getNumBands(); if (src!=null && src.length!=numBands) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NUMBER_OF_BANDS_MISMATCH_$3, numBands, src.length, "SampleDimension")); } if (dst.length != numBands) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NUMBER_OF_BANDS_MISMATCH_$3, numBands, dst.length, "SampleDimension")); } int countGeophysics = 0; GridSampleDimension[] defaultSD = null; for (int i=0; i<numBands; i++) { GridSampleDimension sd = (src!=null) ? src[i] : null; if (sd == null) { if (defaultSD == null) { defaultSD = new GridSampleDimension[numBands]; create(name, RectIterFactory.create(image, null), image.getSampleModel(), null, null, null, null, defaultSD, null); } sd = defaultSD[i]; } sd = new RenderedSampleDimension(sd, image, i); dst[i] = sd; countGeophysics++; } if (countGeophysics == numBands) { return true; } throw new IllegalArgumentException(Errors.format(ErrorKeys.MIXED_CATEGORIES)); }

Target:
static boolean create(final CharSequence name, final RenderedImage image, final GridSampleDimension[] src, final GridSampleDimension[] dst) { final int numBands = image.getSampleModel().getNumBands(); if (src!=null && src.length!=numBands) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NUMBER_OF_BANDS_MISMATCH_$3, numBands, src.length, "SampleDimension")); } if (dst.length != numBands) { throw new IllegalArgumentException(Errors.format(ErrorKeys.NUMBER_OF_BANDS_MISMATCH_$3, numBands, dst.length, "SampleDimension")); } int count = 0; GridSampleDimension[] defaultSD = null; for (int i=0; i<numBands; i++) { GridSampleDimension sd = (src!=null) ? src[i] : null; if (sd == null) { if (defaultSD == null) { defaultSD = new GridSampleDimension[numBands]; create(name, RectIterFactory.create(image, null), image.getSampleModel(), null, null, null, null, defaultSD, null); } sd = defaultSD[i]; } sd = new RenderedSampleDimension(sd, image, i); dst[i] = sd; count++; } if (count == numBands) { return true; } throw new IllegalArgumentException(Errors.format(ErrorKeys.MIXED_CATEGORIES)); }
Source:
public String login( @ActionParam("username") String username, @ActionParam("password") String password) throws UserManagerException, ServletException { String ip = (String)this.getContext().getRawRequestContext().getLocalAttr("REMOTE_ADDR"); for(String key : this.getContext().getRawRequestContext().getLocalAttrs().keySet()) { System.out.println("Key: " + key + ", Value: " + this.getContext().getRawRequestContext().getLocalAttr(key)); } logger.info("Attempting to login for " + username + " from ip '" + ip + "'"); Session session = createSession(username, password, ip); logger.info("Session id " + session.getSessionId() + " created for user '" + username + "' and ip " + ip); return session.getSessionId(); }

Target:
public String login( @ActionParam("username") String username, @ActionParam("password") String password) throws UserManagerException, ServletException { String ip = (String)this.getContext().getRawRequestContext().getLocalAttr("REMOTE_ADDR"); logger.info("Attempting to login for " + username + " from ip '" + ip + "'"); Session session = createSession(username, password, ip); logger.info("Session id " + session.getSessionId() + " created for user '" + username + "' and ip " + ip); return session.getSessionId(); }
Source:
public Repository clone() { return startTracking(); }

Target:
public Repository clone() { return parent.startTracking(); }
Source:
private void stateResolveConstraints(ResolverBundle rb) { ResolverImport[] imports = rb.getImportPackages(); for (ResolverImport import1 : imports) { ResolverExport export = (ResolverExport) import1.getSelectedSupplier(); BaseDescription supplier = export == null ? null : export.getExportPackageDescription(); state.resolveConstraint(import1.getVersionConstraint(), supplier); } BundleConstraint[] requires = rb.getRequires(); for (BundleConstraint require : requires) { ResolverBundle bundle = (ResolverBundle) require.getSelectedSupplier(); BaseDescription supplier = bundle == null ? null : bundle.getBundleDescription(); state.resolveConstraint(require.getVersionConstraint(), supplier); } GenericConstraint[] genericRequires = rb.getGenericRequires(); for (GenericConstraint genericRequire : genericRequires) { VersionSupplier[] matchingCapabilities = genericRequire.getMatchingCapabilities(); if (matchingCapabilities == null) { state.resolveConstraint(genericRequire.getVersionConstraint(), null); } else { for (VersionSupplier matchingCapabilitie : matchingCapabilities) { state.resolveConstraint(genericRequire.getVersionConstraint(), matchingCapabilitie.getBaseDescription()); } } } }

Target:
private void stateResolveConstraints(ResolverBundle rb) { ResolverImport[] imports = rb.getImportPackages(); for (ResolverImport resolverImport : imports) { ResolverExport export = (ResolverExport) resolverImport.getSelectedSupplier(); BaseDescription supplier = export == null ? null : export.getExportPackageDescription(); state.resolveConstraint(resolverImport.getVersionConstraint(), supplier); } BundleConstraint[] requires = rb.getRequires(); for (BundleConstraint require : requires) { ResolverBundle bundle = (ResolverBundle) require.getSelectedSupplier(); BaseDescription supplier = bundle == null ? null : bundle.getBundleDescription(); state.resolveConstraint(require.getVersionConstraint(), supplier); } GenericConstraint[] genericRequires = rb.getGenericRequires(); for (GenericConstraint genericRequire : genericRequires) { VersionSupplier[] matchingCapabilities = genericRequire.getMatchingCapabilities(); if (matchingCapabilities == null) { state.resolveConstraint(genericRequire.getVersionConstraint(), null); } else { for (VersionSupplier matchingCapabilitie : matchingCapabilities) { state.resolveConstraint(genericRequire.getVersionConstraint(), matchingCapabilitie.getBaseDescription()); } } } }
Source:
public Response getPages(@PathParam("language") String languageCode, @PathParam("package") String packageCode, @HeaderParam("Authorization") String authTokenHeader) throws MalformedURLException { log.info("Requesting draft pages for package: " + packageCode + " for language: " + languageCode); AuthorizationRecord.checkAccessToDrafts(authService.getAuthorizationRecord("", authTokenHeader), clock.currentDateTime()); Optional<GodToolsTranslation> godToolsTranslationOptional = draftTranslation.retrieve(languageCode, packageCode, false); if(!godToolsTranslationOptional.isPresent()) { return Response .status(Response.Status.NOT_FOUND) .build(); } return Response .ok(godToolsTranslationOptional.get().getPageStructureList()) .build(); }

Target:
public Response getPages(@PathParam("language") String languageCode, @PathParam("package") String packageCode, @HeaderParam("Authorization") String authTokenHeader) throws MalformedURLException { log.info("Requesting draft pages for package: " + packageCode + " for language: " + languageCode); AuthorizationRecord.checkAccessToDrafts(authService.getAuthorizationRecord(null, authTokenHeader), clock.currentDateTime()); Optional<GodToolsTranslation> godToolsTranslationOptional = draftTranslation.retrieve(languageCode, packageCode, false); if(!godToolsTranslationOptional.isPresent()) { return Response .status(Response.Status.NOT_FOUND) .build(); } return Response .ok(godToolsTranslationOptional.get().getPageStructureList()) .build(); }
Source:
public List<? extends Module> getJacksonModules() { return ImmutableList.of( new SimpleModule("KafkaEightSimpleConsumerFirehoseModule") .registerSubtypes( new NamedType(KafkaEightSimpleConsumerFirehoseFactory.class, "kafka-0.8-simpaleConsumer") ) ); }

Target:
public List<? extends Module> getJacksonModules() { return ImmutableList.of( new SimpleModule("KafkaEightSimpleConsumerFirehoseModule") .registerSubtypes( new NamedType(KafkaEightSimpleConsumerFirehoseFactory.class, "kafka-0.8-simpleConsumer") ) ); }
Source:
private void assertMatchesNone(ImmutableSet<InboxMessage> messages, CatchUp job) { for (InboxMessage message : messages) { assertThat(CatchUpStation.matches(job, message)) .isFalse(); } }

Target:
private void assertMatchesNone(ImmutableSet<InboxMessage> messages, CatchUp job) { for (InboxMessage message : messages) { assertThat(job.matches(message)) .isFalse(); } }
Source:
public static void copyTo(Described from, Described to) { Identified.copyTo(from, to); to.description = from.description; to.firstSeen = from.firstSeen; to.genres = ImmutableSet.copyOf(from.genres); to.image = from.image; to.lastFetched = from.lastFetched; to.mediaType = from.mediaType; to.publisher = from.publisher; to.specialization = from.specialization; to.tags = Sets.newHashSet(from.tags); to.thisOrChildLastUpdated = from.thisOrChildLastUpdated; to.thumbnail = from.thumbnail; to.title = from.title; to.scheduleOnly = from.scheduleOnly; to.presentationChannel = from.presentationChannel; to.images = from.images; to.shortDescription = from.shortDescription; to.mediumDescription = from.mediumDescription; to.longDescription = from.longDescription; to.localizedDescriptions = ImmutableSet.copyOf(from.localizedDescriptions); to.localizedTitles = ImmutableSet.copyOf(from.localizedTitles); to.reviews = ImmutableSet.copyOf(from.reviews); to.ratings = ImmutableSet.copyOf(from.ratings); to.audienceStatistics = from.audienceStatistics; to.activelyPublished = from.activelyPublished; to.priority = from.priority; to.awards = ImmutableSet.copyOf(from.awards); to.distributions = ImmutableSet.copyOf(from.distributions); to.language = from.language; }

Target:
public static void copyTo(Described from, Described to) { Identified.copyTo(from, to); to.description = from.description; to.firstSeen = from.firstSeen; to.genres = ImmutableSet.copyOf(from.genres); to.image = from.image; to.lastFetched = from.lastFetched; to.mediaType = from.mediaType; to.publisher = from.publisher; to.specialization = from.specialization; to.tags = Sets.newHashSet(from.tags); to.thisOrChildLastUpdated = from.thisOrChildLastUpdated; to.thumbnail = from.thumbnail; to.title = from.title; to.scheduleOnly = from.scheduleOnly; to.presentationChannel = from.presentationChannel; to.images = from.images; to.shortDescription = from.shortDescription; to.mediumDescription = from.mediumDescription; to.longDescription = from.longDescription; to.localizedDescriptions = ImmutableSet.copyOf(from.localizedDescriptions); to.localizedTitles = ImmutableSet.copyOf(from.localizedTitles); to.reviews = ImmutableSet.copyOf(from.reviews); to.ratings = ImmutableSet.copyOf(from.ratings); to.audienceStatistics = from.audienceStatistics; to.activelyPublished = from.activelyPublished; to.priority = from.priority; to.awards = ImmutableSet.copyOf(from.awards); to.distributions = ImmutableList.copyOf(from.distributions); to.language = from.language; }
Source:
public static boolean isValidNumber(Object value) { if (!(value instanceof Number)) { return false; } Number number = (Number) value; if (number instanceof Double) { if (Double.isNaN(number.doubleValue()) || Double.isInfinite(number.doubleValue())) { return false; } } if (number instanceof Float) { if (Float.isNaN(number.floatValue()) || Float.isInfinite(number.floatValue())) { return false; } } return true; }

Target:
public static boolean isValidNumber(Object value) { if (value == null) { return false; } if (value instanceof Number) { return isValidNumber((Number) value); } if (value instanceof String) { return isNumeric(value); } return false; }
Source:
public String getCustomDefaultContributorRoleName(){ if (dvObject instanceof Dataverse && isCustomDefaultConributorRole() ){ return defaultContributorRoleAlias.equals("none") ? "None" : roleService.findCustomRoleByAliasAndOwner(defaultContributorRoleAlias,dvObject.getId()).getName(); } else { return ""; } }

Target:
public String getCustomDefaultContributorRoleName(){ if (dvObject instanceof Dataverse && isCustomDefaultContributorRole() ){ return defaultContributorRoleAlias.equals(DataverseRole.NONE) ? BundleUtil.getStringFromBundle("permission.default.contributor.role.none.name") : roleService.findCustomRoleByAliasAndOwner(defaultContributorRoleAlias,dvObject.getId()).getName(); } else { return ""; } }