auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testProcessMultipleTasks() throws Exception { CountDownLatch task0ProcessedMessages = new CountDownLatch(1); CountDownLatch task1ProcessedMessages = new CountDownLatch(1); SystemConsumers consumerMultiplexer = mock(SystemConsumers.class); when(consumerMultiplexer.pollIntervalMs()).thenReturn(10); OffsetManager offsetManager = mock(OffsetManager.class); TestTask task0 = new TestTask(true, true, false, task0ProcessedMessages); TestTask task1 = new TestTask(true, false, true, task1ProcessedMessages); TaskInstance t0 = createTaskInstance(task0, taskName0, ssp0, offsetManager, consumerMultiplexer); TaskInstance t1 = createTaskInstance(task1, taskName1, ssp1, offsetManager, consumerMultiplexer); Map<TaskName, RunLoopTask> tasks = new HashMap<>(); tasks.put(taskName0, t0); tasks.put(taskName1, t1); int maxMessagesInFlight = 1; RunLoop runLoop = new RunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, maxIdleMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)).thenReturn(envelope0).thenReturn(envelope1).thenReturn(null); runLoop.run(); task0ProcessedMessages.await(); task1ProcessedMessages.await(); assertEquals(1, task0.processed); assertEquals(1, task0.completed.get()); assertEquals(1, task1.processed); assertEquals(1, task1.completed.get()); assertEquals(2L, containerMetrics.envelopes().getCount()); assertEquals(2L, containerMetrics.processes().getCount()); }

Target:
public void testProcessMultipleTasks() { SystemConsumers consumerMultiplexer = mock(SystemConsumers.class); RunLoopTask task0 = getMockRunLoopTask(taskName0, ssp0); RunLoopTask task1 = getMockRunLoopTask(taskName1, ssp1); Map<TaskName, RunLoopTask> tasks = new HashMap<>(); tasks.put(taskName0, task0); tasks.put(taskName1, task1); int maxMessagesInFlight = 1; RunLoop runLoop = new RunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, maxIdleMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)).thenReturn(envelope00).thenReturn(envelope11).thenReturn(ssp0EndOfStream).thenReturn(ssp1EndOfStream).thenReturn(null); runLoop.run(); verify(task0).process(eq(envelope00), any(), any()); verify(task1).process(eq(envelope11), any(), any()); assertEquals(4L, containerMetrics.envelopes().getCount()); }
Source:
public void deleteModel() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModel(modelId).subscribe(val -> System.out.printf("Model ID = %s is deleted%n", modelId)); END: com.azure.ai.formrecognizer.FormTrainingAsyncClient.deleteModel#string }

Target:
public void deleteModel() { String modelId = "{model_id}"; formTrainingAsyncClient.deleteModel(modelId).subscribe(val -> System.out.printf("Model Id: %s is deleted%n", modelId)); END: com.azure.ai.formrecognizer.FormTrainingAsyncClient.deleteModel#string }
Source:
protected <T> boolean matchEntity(VmWatchdog entity, T id) { return true; }

Target:
protected <T> boolean matchEntity(VmWatchdog entity, T id) { return entity.getId().equals(id); }
Source:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { CommandEntity commandEntity = CommandCoordinatorUtil.getCommandEntity(cmdId); StorageJobCommandParameters cmdParams = (StorageJobCommandParameters) commandEntity.getCommandParameters(); Guid job = cmdParams.getStorageJobId(); HostJobStatus jobStatus; try { jobStatus = pollStorageJob(cmdParams); } catch (Exception e) { log.error("Failed to poll job '{}' for command '{}' (id: '{}'), will retry soon", job, commandEntity.getCommandType(), cmdId); return; } if (jobStatus == null) { log.error("Job for command '{}' (id: '{}') wasn't created, failing the operation", commandEntity.getCommandType(), cmdId); } if (jobStatus == HostJobStatus.running || jobStatus == HostJobStatus.pending) { log.info("Waiting on vdsm job: '{}' of '{}' (id: '{}') to complete", job, commandEntity.getCommandType(), cmdId); return; } log.info("Command '{}' id: '{}' job '{}' execution was completed with VDSM job status '{}'", commandEntity.getCommandType(), cmdId, job, jobStatus); CommandBase<?> command = getCommand(cmdId); CommandExecutionStatus status = CommandCoordinatorUtil.getCommandExecutionStatus(cmdId); command.getParameters().setTaskGroupSuccess(status == CommandExecutionStatus.EXECUTED && jobStatus == HostJobStatus.done); command.setCommandStatus(command.getParameters().getTaskGroupSuccess() ? CommandStatus.SUCCEEDED : CommandStatus.FAILED); log.info("Command '{}' (id: '{}') execution was completed, the command status is '{}'", command.getActionType(), command.getCommandId(), command.getCommandStatus()); }

Target:
public void doPolling(Guid cmdId, List<Guid> childCmdIds) { CommandEntity commandEntity = CommandCoordinatorUtil.getCommandEntity(cmdId); StorageJobCommandParameters cmdParams = (StorageJobCommandParameters) commandEntity.getCommandParameters(); Guid job = cmdParams.getStorageJobId(); HostJobStatus jobStatus; try { jobStatus = pollStorageJob(cmdParams.getStorageJobId(), cmdParams.getVdsRunningOn()); } catch (Exception e) { log.error("Failed to poll job '{}' for command '{}' (id: '{}'), will retry soon", job, commandEntity.getCommandType(), cmdId); return; } if (jobStatus == null) { log.error("Job for command '{}' (id: '{}') wasn't created, failing the operation", commandEntity.getCommandType(), cmdId); } if (jobStatus.isAlive()) { log.info("Waiting on vdsm job: '{}' of '{}' (id: '{}') to complete", job, commandEntity.getCommandType(), cmdId); return; } log.info("Command '{}' id: '{}' job '{}' execution was completed with VDSM job status '{}'", commandEntity.getCommandType(), cmdId, job, jobStatus); CommandBase<?> command = getCommand(cmdId); CommandExecutionStatus status = CommandCoordinatorUtil.getCommandExecutionStatus(cmdId); command.getParameters().setTaskGroupSuccess(status == CommandExecutionStatus.EXECUTED && jobStatus == HostJobStatus.done); command.setCommandStatus(command.getParameters().getTaskGroupSuccess() ? CommandStatus.SUCCEEDED : CommandStatus.FAILED); log.info("Command '{}' (id: '{}') execution was completed, the command status is '{}'", command.getActionType(), command.getCommandId(), command.getCommandStatus()); }
Source:
public Expression getFillOutlineColor() { if (paint.get("fill-outline-color") != null) { return parse.color(paint, "fill-outline-color", Color.BLACK ); } else { return getFillColor(); } }

Target:
public Color getFillOutlineColor(){ if (paint.get("fill-outline-color") != null) { return parse.optional(Color.class, paint, "fill-outline-color", Color.BLACK); } else { return getFillColor(); } }
Source:
public BoundingBox(final List<Point> points) { if (points == null) { this.points = null; } else { this.points = Collections.unmodifiableList(points); } }

Target:
public BoundingBox(final List<Point> points) { Objects.requireNonNull(points, "'points' cannot be null."); this.points = Collections.unmodifiableList(new ArrayList<>(points)); }
Source:
private StackServiceRequest getRequest(Map<String, Object> properties) { return new StackServiceRequest( (String) properties.get(STACK_NAME_PROPERTY_ID), (String) properties.get(STACK_VERSION_PROPERTY_ID), (String) properties.get(SERVICE_NAME_PROPERTY_ID)); }

Target:
private StackServiceRequest getRequest(Map<String, Object> properties) { return new StackServiceRequest( (String) properties.get(STACK_NAME_PROPERTY_ID), (String) properties.get(STACK_VERSION_PROPERTY_ID), (String) properties.get(SERVICE_NAME_PROPERTY_ID), (String) properties.get(CREDENTIAL_STORE_SUPPORTED), (String) properties.get(CREDENTIAL_STORE_ENABLED)); }
Source:
private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<HashEntry>(tableSize); loadLocks = new ReentrantLock[cfg.getConcurrencyLevel()]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new ReentrantLock(true ); maxBytes = cfg.getBlockLimit(); maxStreamThroughCache = (long) (maxBytes * cfg.getStreamRatio()); blockSize = cfg.getBlockSize(); if ((blockSize & (blockSize - 1)) != 0) throw new IllegalArgumentException(JGitText.get().bSizeMustBePowerOf2); blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); clockHand = new Ref<Object>(new DfsPackKey(), -1, 0, null); clockHand.next = clockHand; packCache = new ConcurrentHashMap<DfsPackDescription, DfsPackFile>( 16, 0.75f, 1); packFiles = Collections.unmodifiableCollection(packCache.values()); statHit = new AtomicLong(); statMiss = new AtomicLong(); }

Target:
private DfsBlockCache(final DfsBlockCacheConfig cfg) { tableSize = tableSize(cfg); if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); table = new AtomicReferenceArray<HashEntry>(tableSize); loadLocks = new ReentrantLock[cfg.getConcurrencyLevel()]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new ReentrantLock(true ); maxBytes = cfg.getBlockLimit(); maxStreamThroughCache = (long) (maxBytes * cfg.getStreamRatio()); blockSize = cfg.getBlockSize(); if ((blockSize & (blockSize - 1)) != 0) { throw new IllegalArgumentException(JGitText.get().blockSizeNotPowerOf2); } blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true ); clockHand = new Ref<Object>(new DfsPackKey(), -1, 0, null); clockHand.next = clockHand; packCache = new ConcurrentHashMap<DfsPackDescription, DfsPackFile>( 16, 0.75f, 1); packFiles = Collections.unmodifiableCollection(packCache.values()); statHit = new AtomicLong(); statMiss = new AtomicLong(); }
Source:
private SearchResponse getSearchResponse(ElasticsearchQueryBuilder queryBuilder) { try { return retry() .maxAttempts(maxAttempts) .exponentialBackoff(maxRetryTime, 2.0) .run("searchRequest", () -> { return queryBuilder.buildScrollSearchRequest() .execute() .actionGet(requestTimeout.toMillis()); }); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
private SearchResponse getSearchResponse(ElasticsearchQueryBuilder queryBuilder) { try { return retry() .maxAttempts(maxAttempts) .exponentialBackoff(maxRetryTime) .run("searchRequest", () -> queryBuilder.buildScrollSearchRequest() .execute() .actionGet(requestTimeout.toMillis())); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public static FilterGenerator getInstance() { return Holder.INSTNACE; }

Target:
public static FilterGenerator getInstance() { return Holder.INSTANCE; }
Source:
private static boolean isLocalJarUpToDate(String url, String filePath) { try { URLConnection urlConnection = new URL(url).openConnection(); File file = new File(filePath); System.out.println("Url date=" + new Date(urlConnection.getLastModified())); System.out.println("File date=" + new Date(file.lastModified())); if (!file.exists() || file.lastModified() < urlConnection.getLastModified()) { System.out.println("Local jar " + file + " is obsolete or not present"); } else { System.out.println("Local jar " + file + " is up to date"); return true; } } catch (IOException e) { e.printStackTrace(); } return false; }

Target:
private boolean isLocalJarUpToDate(String url, String filePath) { try { URLConnection urlConnection = new URL(url).openConnection(); File file = new File(filePath); logger.info("Url date=" + new Date(urlConnection.getLastModified())); logger.info("File date=" + new Date(file.lastModified())); if (!file.exists() || file.lastModified() < urlConnection.getLastModified()) { logger.info("Local jar " + file + " is obsolete or not present"); } else { logger.info("Local jar " + file + " is up to date"); return true; } } catch (IOException e) { logError("Error when contacting the remote url " + url, e); } return false; }
Source:
public void close() { if (reader != null) { reader.close(); reader = null; } }

Target:
public void close() { reader = Misc.free(reader); }
Source:
protected void testAccessControl() throws Exception { InstructorAttributes instructor = typicalBundle.instructors.get("instructor3OfCourse1"); StudentAttributes student = typicalBundle.students.get("student2InCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, Const.ParamsNames.STUDENT_EMAIL, student.email, Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session" }; verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams); }

Target:
protected void testAccessControl() throws Exception { InstructorAttributes instructor = typicalBundle.instructors.get("instructor3OfCourse1"); StudentAttributes student = typicalBundle.students.get("student2InCourse1"); CourseAttributes course = typicalBundle.courses.get("typicalCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.STUDENT_EMAIL, student.email, Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session" }; verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams); ______TS("Instructor cannot view sections without View-Student-In-Sections privilege"); instructor = typicalBundle.instructors.get("helperOfCourse1"); gaeSimulation.loginAsInstructor(instructor.googleId); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.STUDENT_EMAIL, student.email, Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session" }; InstructorStudentRecordsAjaxPageAction a = getAction(submissionParams); ShowPageResult r = getShowPageResult(a); a = getAction(submissionParams); r = getShowPageResult(a); assertEquals( getPageResultDestination(Const.ViewURIs.INSTRUCTOR_STUDENT_RECORDS_AJAX, false, "idOfHelperOfCourse1"), r.getDestinationWithParams()); assertFalse(r.isError); assertEquals("", r.getStatusMessage()); InstructorStudentRecordsAjaxPageData data = (InstructorStudentRecordsAjaxPageData) r.data; assertEquals(0, data.getResultsTables().size()); }
Source:
private File getPathToTile(int x, int y) { File path = new File(cacheDirectory, formatLatLon(x, y) + ".tiff"); if (path.exists()) { return path; } else { path.getParentFile().mkdirs(); if (awsAccessKey == null || awsSecretKey == null) { throw new RuntimeException( "Cannot download NED tiles from S3: awsAccessKey or awsSecretKey properties are not set"); } log.info("Downloading NED degree tile " + path); AWSCredentials awsCredentials = new AWSCredentials(awsAccessKey, awsSecretKey); String key = formatLatLon(x, y) + ".tiff"; try { S3Service s3Service = new RestS3Service(awsCredentials); S3Object object = s3Service.getObject(awsBucketName, key); InputStream istream = object.getDataInputStream(); FileOutputStream ostream = new FileOutputStream(path); byte[] buffer = new byte[4096]; while (true) { int read = istream.read(buffer); if (read == -1) { break; } ostream.write(buffer, 0, read); } ostream.close(); istream.close(); } catch (ServiceException | IOException e) { log.error("Error downloading tile {}! Error: {}.", key, e.getMessage()); path.deleteOnExit(); return null; } return path; } }

Target:
private File getPathToTile(int x, int y) { File path = new File(cacheDirectory, formatLatLon(x, y) + ".tiff"); if (path.exists()) { return path; } else { path.getParentFile().mkdirs(); if (awsAccessKey == null || awsSecretKey == null) { throw new RuntimeException( "Cannot download NED tiles from S3: awsAccessKey or awsSecretKey properties are not set"); } log.info("Downloading NED degree tile " + path); AWSCredentials awsCredentials = new AWSCredentials(awsAccessKey, awsSecretKey); String key = formatLatLon(x, y) + ".tiff"; try { S3Service s3Service = new RestS3Service(awsCredentials); S3Object object = s3Service.getObject(awsBucketName, key); InputStream istream = object.getDataInputStream(); FileOutputStream ostream = new FileOutputStream(path); byte[] buffer = new byte[4096]; while (true) { int read = istream.read(buffer); if (read == -1) { break; } ostream.write(buffer, 0, read); } ostream.close(); istream.close(); } catch (S3ServiceException e) { if (e.getS3ErrorCode().equals("NoSuchKey")) { log.error( graph.addBuilderAnnotation( new Graphwide( String.format("Elevation tile %s missing from s3bucket. Proceeding without tile!", key) ) ) ); return null; } path.deleteOnExit(); throw new RuntimeException(e); } catch (ServiceException | IOException e) { path.deleteOnExit(); throw new RuntimeException(e); } return path; } }
Source:
public String getInvalidityInfoForEmail(String email) { Assumption.assertTrue("Non-null value expected", email != null); String sanitizedValue = Sanitizer.sanitizeForHtml(email); if (email.isEmpty()) { return getInterpolatedErrorMessage( EMAIL_ERROR_MESSAGE, email, EMAIL_FIELD_NAME, REASON_EMPTY, EMAIL_MAX_LENGTH); } else if (isUntrimmed(email)) { return WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE.replace("${fieldName}", EMAIL_FIELD_NAME); } else if (email.length() > EMAIL_MAX_LENGTH) { return getInterpolatedErrorMessage( EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_TOO_LONG, EMAIL_MAX_LENGTH); } else if (!StringHelper.isMatching(email, REGEX_EMAIL)) { return getInterpolatedErrorMessage( EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_INCORRECT_FORMAT, EMAIL_MAX_LENGTH); } return ""; }

Target:
public String getInvalidityInfoForEmail(String email) { Assumption.assertTrue("Non-null value expected", email != null); String sanitizedValue = Sanitizer.sanitizeForHtml(email); if (email.isEmpty()) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, email, EMAIL_FIELD_NAME, REASON_EMPTY, EMAIL_MAX_LENGTH); } else if (isUntrimmed(email)) { return WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE.replace("${fieldName}", EMAIL_FIELD_NAME); } else if (email.length() > EMAIL_MAX_LENGTH) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_TOO_LONG, EMAIL_MAX_LENGTH); } else if (!StringHelper.isMatching(email, REGEX_EMAIL)) { return getPopulatedErrorMessage(EMAIL_ERROR_MESSAGE, sanitizedValue, EMAIL_FIELD_NAME, REASON_INCORRECT_FORMAT, EMAIL_MAX_LENGTH); } return ""; }
Source:
public Response deleteSubscriptionConstraints(@PathParam("topicName") String topicName, @PathParam("subscriptionName") String subscriptionName) { service.deleteConstraints(SubscriptionName.fromString(String.format("%s$%s", topicName, subscriptionName))); return Response.status(OK).build(); }

Target:
public Response deleteSubscriptionConstraints(@PathParam("topicName") String topicName, @PathParam("subscriptionName") String subscriptionName) { service.deleteConstraints(new SubscriptionName(subscriptionName, TopicName.fromQualifiedName(topicName))); return Response.status(OK).build(); }
Source:
public void validateAllFilesForDownloadArchival() { selectAllFiles(); boolean guestbookRequired = isDownloadPopupRequired(); boolean downloadOriginal = false; validateFilesForDownload(guestbookRequired, downloadOriginal); }

Target:
public void validateAllFilesForDownloadArchival() { boolean guestbookRequired = isDownloadPopupRequired(); boolean downloadOriginal = false; validateFilesForDownloadAll(guestbookRequired, downloadOriginal); }
Source:
private void notifySync(Queue<CountDownLatch> latches) { if (latches == null) { return; } while (true) { CountDownLatch latch = latches.poll(); if (latch == null) { break; } latch.countDown(); } }

Target:
private void notifySync(Queue<CountDownLatch> latches) { if (latches == null) { return; } CountDownLatch latch = latches.poll(); if (latch != null) { latch.countDown(); } }
Source:
public void testMoveAdminUnitIntoFolder() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("is not a folder or a work and cannot be added to a folder"); FolderObject mockWorkObj = mock(FolderObject.class); when(repositoryObjectLoader.getRepositoryObject(destPid)).thenReturn(mockWorkObj); PID movePid = makePid(); AdminUnit moveObj = mock(AdminUnit.class); when(repositoryObjectLoader.getRepositoryObject(movePid)).thenReturn(moveObj); List<PID> movePids = asList(movePid); service.moveObjects(mockAgent, destPid, movePids); }

Target:
public void testMoveAdminUnitIntoFolder() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("is not a folder or a work and cannot be added to a folder"); FolderObject mockFolderObj = mock(FolderObject.class); when(repositoryObjectLoader.getRepositoryObject(destPid)).thenReturn(mockFolderObj); PID movePid = makePid(); AdminUnit moveObj = mock(AdminUnit.class); when(repositoryObjectLoader.getRepositoryObject(movePid)).thenReturn(moveObj); List<PID> movePids = asList(movePid); service.moveObjects(mockAgent, destPid, movePids); }
Source:
private void collectServiceInterfaces(SwitchYardType switchyard) { if (switchyard == null) { return; } ClassLoader oldTCCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader( JavaUtil.getProjectClassLoader( JavaCore.create(WorkspaceSynchronizer.getFile(switchyard.eResource()).getProject()), getClass().getClassLoader())); for (Iterator<EObject> it = EcoreUtil.getAllContents(switchyard, true); it.hasNext();) { EObject eobject = it.next(); if (eobject instanceof Contract) { Interface intf = ((Contract) eobject).getInterface(); if (intf == null) { continue; } try { ServiceInterface si = SwitchYardModelUtils.getServiceInterface(intf); if (si != null) { _serviceInterfaces.put((Contract) eobject, si); } } catch (Exception e) { e.printStackTrace(); if (e instanceof RuntimeException) { String message = e.getMessage(); if (message != null && message.startsWith("SWITCHYARD010004")) { _serviceInterfaces.put((Contract) eobject, INVALID_SERVICE_INTERFACE); } else { _serviceInterfaces.put((Contract) eobject, URESOLVABLE_SERVICE_INTERFACE); } } else { _serviceInterfaces.put((Contract) eobject, URESOLVABLE_SERVICE_INTERFACE); } } } } } catch (Exception e) { _problems.add(new Status(Status.WARNING, Activator.PLUGIN_ID, Messages.WiringValidationContext_statusMessage_errorLoadingServiceInterfaceMetadata, e)); } finally { Thread.currentThread().setContextClassLoader(oldTCCL); } }

Target:
private void collectServiceInterfaces(SwitchYardType switchyard) { if (switchyard == null) { return; } ClassLoader oldTCCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader( JavaUtil.getProjectClassLoader( JavaCore.create(WorkspaceSynchronizer.getFile(switchyard.eResource()).getProject()), getClass().getClassLoader())); for (Iterator<EObject> it = EcoreUtil.getAllContents(switchyard, true); it.hasNext();) { EObject eobject = it.next(); if (eobject instanceof Contract) { Interface intf = ((Contract) eobject).getInterface(); if (intf == null) { continue; } try { ServiceInterface si = SwitchYardModelUtils.getServiceInterface(intf); if (si != null) { _serviceInterfaces.put((Contract) eobject, si); } } catch (Exception e) { Activator.getDefault().getLog().log(new Status(IStatus.INFO, Activator.PLUGIN_ID, "Service Interface cannot be loaded.", e)); if (e instanceof RuntimeException) { String message = e.getMessage(); if (message != null && message.startsWith("SWITCHYARD010004")) { _serviceInterfaces.put((Contract) eobject, INVALID_SERVICE_INTERFACE); } else { _serviceInterfaces.put((Contract) eobject, URESOLVABLE_SERVICE_INTERFACE); } } else { _serviceInterfaces.put((Contract) eobject, URESOLVABLE_SERVICE_INTERFACE); } } } } } catch (Exception e) { _problems.add(new Status(Status.WARNING, Activator.PLUGIN_ID, Messages.WiringValidationContext_statusMessage_errorLoadingServiceInterfaceMetadata, e)); } finally { Thread.currentThread().setContextClassLoader(oldTCCL); } }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.CLASSDEF, ctx -> { ClassDef classDef = (ClassDef) ctx.syntaxNode(); if (!isRelevantClass(classDef)) { return; } List<FunctionDef> functions = classDef.body().statements().stream() .filter(s -> s.is(Tree.Kind.FUNCDEF)) .map(s -> (FunctionDef) s) .collect(Collectors.toList()); for (FunctionDef functionDef : functions) { handleFunctionDef(ctx, classDef, functionDef); } }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.CLASSDEF, ctx -> { ClassDef classDef = (ClassDef) ctx.syntaxNode(); ClassSymbol classSymbol = TreeUtils.getClassSymbolFromDef(classDef); if (classSymbol == null || !isRelevantClass(classDef, classSymbol)) { return; } CollectFunctionDefsVisitor visitor = new CollectFunctionDefsVisitor(); classDef.body().accept(visitor); visitor.functionDefs.forEach(functionDef -> handleFunctionDef(ctx, classDef, classSymbol, functionDef)); }); }
Source:
private void readInternal(long position, byte[] buffer, int bufferOffset, int bufferLength) { try { long readStart = System.nanoTime(); inputStream.readFully(position, buffer, bufferOffset, bufferLength); stats.readDataBytesPerSecond(bufferLength, System.nanoTime() - readStart); } catch (PrestoException e) { throw e; } catch (Exception e) { throw new PrestoException(HIVE_FILESYSTEM_ERROR, format("Error reading from %s at position %s", id.toString(), position), e); } }

Target:
private void readInternal(long position, byte[] buffer, int bufferOffset, int bufferLength) { try { long readStart = System.nanoTime(); inputStream.readFully(position, buffer, bufferOffset, bufferLength); stats.readDataBytesPerSecond(bufferLength, System.nanoTime() - readStart); } catch (PrestoException e) { throw e; } catch (Exception e) { throw new PrestoException(HIVE_FILESYSTEM_ERROR, format("Error reading from %s at position %s", id, position), e); } }
Source:
public void testFileLoggingLoggingLevels() throws Exception { final File path = tempFolder.newFolder(); final String logDirectory = emptyDirectory(path.getAbsolutePath()); LogFileConfiguration config = new LogFileConfiguration(logDirectory) .setUsePlaintext(true) .setMaxRotateCount(0); testWithConfiguration(LogLevel.INFO, config, new Runnable() { @Override public void run() { LogLevel levels[] = { LogLevel.NONE, LogLevel.ERROR, LogLevel.WARNING, LogLevel.INFO, LogLevel.VERBOSE }; for (LogLevel level : levels) { Database.log.getFile().setLevel(level); Log.v("DATABASE", "TEST VERBOSE"); Log.i("DATABASE", "TEST INFO"); Log.w("DATABASE", "TEST WARNING"); Log.e("DATABASE", "TEST ERROR"); } try { for (File log : path.listFiles()) { BufferedReader fin = new BufferedReader(new FileReader(log)); int lineCount = 0; while (fin.readLine() != null) { lineCount++; } if (log.getAbsolutePath().contains("verbose")) { assertEquals(2, lineCount); } else if (log.getAbsolutePath().contains("info")) { assertEquals(3, lineCount); } else if (log.getAbsolutePath().contains("warning")) { assertEquals(4, lineCount); } else if (log.getAbsolutePath().contains("error")) { assertEquals(5, lineCount); } } } catch(Exception e) { fail("Exception during test callback " + e.toString()); } } }); }

Target:
public void testFileLoggingLoggingLevels() throws IOException { final File path = tempFolder.newFolder(); final String logDirectory = emptyDirectory(path.getAbsolutePath()); LogFileConfiguration config = new LogFileConfiguration(logDirectory) .setUsePlaintext(true) .setMaxRotateCount(0); testWithConfiguration(LogLevel.INFO, config, () -> { LogLevel levels[] = { LogLevel.NONE, LogLevel.ERROR, LogLevel.WARNING, LogLevel.INFO, LogLevel.VERBOSE }; for (LogLevel level : levels) { Database.log.getFile().setLevel(level); Log.v(LogDomain.DATABASE, "TEST VERBOSE"); Log.i(LogDomain.DATABASE, "TEST INFO"); Log.w(LogDomain.DATABASE, "TEST WARNING"); Log.e(LogDomain.DATABASE, "TEST ERROR"); } try { for (File log : path.listFiles()) { BufferedReader fin = new BufferedReader(new FileReader(log)); int lineCount = 0; while (fin.readLine() != null) { lineCount++; } if (log.getAbsolutePath().contains("verbose")) { assertEquals(2, lineCount); } else if (log.getAbsolutePath().contains("info")) { assertEquals(3, lineCount); } else if (log.getAbsolutePath().contains("warning")) { assertEquals(4, lineCount); } else if (log.getAbsolutePath().contains("error")) { assertEquals(5, lineCount); } } } catch(Exception e) { fail("Exception during test callback " + e.toString()); } }); }
Source:
public String getInstanceBeanName(String instanceName) { return String.format("%s,%s=%s", clusterBeanName(), INSTANCE_DN_KEY, instanceName); }

Target:
protected String getInstanceBeanName(String instanceName) { return String.format("%s,%s=%s", clusterBeanName(), INSTANCE_DN_KEY, instanceName); }
Source:
protected <T> Class<T> loadClass(BrooklynCatalog catalog, String type) throws ClassNotFoundException { try { Class<T> result = (Class<T>) catalog.getRootClassLoader().loadClass(type); log.debug("Loaded class directly", type); return result; } catch (ClassNotFoundException e) { log.warn("No catalog item for type {}, and could not load class directly; rethrowing", type); throw e; } }

Target:
protected <T> Class<T> loadClass(BrooklynCatalog catalog, String type) throws ClassNotFoundException { try { Class<T> result = (Class<T>) catalog.getRootClassLoader().loadClass(type); log.debug("Loaded class directly", type); return result; } catch (ClassNotFoundException e) { log.warn("Could not load class directly; rethrowing", type); throw e; } }
Source:
public PagedArrayList(Collection<? extends T> collection, KeysetPage keyset, long totalSize, int firstResult, int maxResults) { super(collection); this.keyset = keyset; this.totalSize = totalSize; this.page = (int) Math.floor((firstResult == -1 ? 0 : firstResult) * 1d / maxResults) + 1; this.totalPages = totalSize < 1 ? (int) totalSize : (int) Math.ceil(totalSize * 1d / maxResults); this.firstResult = firstResult; this.maxResults = maxResults; }

Target:
public PagedArrayList(Collection<? extends T> collection, KeysetPage keyset, long totalSize, int firstResult, int maxResults) { super(collection); this.keyset = keyset; this.totalSize = totalSize; this.page = (int) Math.floor((firstResult == -1 ? 0 : firstResult) * 1d / maxResults) + 1; this.totalPages = totalSize < 1 ? 0 : (int) Math.ceil(totalSize * 1d / maxResults); this.firstResult = firstResult; this.maxResults = maxResults; }
Source:
LocalDateTime extractV4ExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { String ts = ""; try { ts = args.get(SignerConstants.X_AMZ_DATE.toLowerCase()); val reqDate = ZonedDateTime.parse(ts, formatter); log.trace("Request DateTime (Zoned): %s%n", reqDate); val expSeconds = Integer.parseInt(args.get(SignerConstants.X_AMZ_EXPIRES.toLowerCase())); return reqDate.withZoneSameInstant(effectiveTimeZone).toLocalDateTime().plusSeconds(expSeconds); } catch (DateTimeParseException pe) { log.error("%s is not parsable!%n", ts); throw pe; } }

Target:
LocalDateTime extractV4ExpiryDate(Map<String, String> args, ZoneId effectiveTimeZone) { String ts = ""; try { ts = args.get(SignerConstants.X_AMZ_DATE.toLowerCase()); val reqDate = ZonedDateTime.parse(ts, formatter); log.trace("Request DateTime (Zoned): {}", reqDate); val expSeconds = Integer.parseInt(args.get(SignerConstants.X_AMZ_EXPIRES.toLowerCase())); return reqDate.withZoneSameInstant(effectiveTimeZone).toLocalDateTime().plusSeconds(expSeconds); } catch (DateTimeParseException pe) { log.error("{} is not parsable!", ts); throw pe; } }
Source:
private QueryBuilder createQueryClauseSearchAttribute( QueryRule queryRule, EntityType entityType) { List<Attribute> attributePath = getAttributePathExpanded(queryRule.getField(), entityType); Attribute attr = attributePath.get(attributePath.size() - 1); Object queryValue = getQueryValue(attr, queryRule.getValue()); String fieldName = getQueryFieldName(attributePath); AttributeType dataType = attr.getDataType(); switch (dataType) { case DATE: case DATE_TIME: case DECIMAL: case EMAIL: case ENUM: case HTML: case HYPERLINK: case INT: case LONG: case SCRIPT: case STRING: case TEXT: return nestedQueryBuilder( entityType, attributePath, QueryBuilders.simpleQueryStringQuery(queryValue.toString()) .defaultOperator(org.elasticsearch.index.query.Operator.AND) .field(fieldName)); case BOOL: throw new MolgenisQueryException( "Cannot execute search query on [" + dataType + "] attribute"); case CATEGORICAL: case CATEGORICAL_MREF: case XREF: case MREF: case FILE: case ONE_TO_MANY: case COMPOUND: throw new MolgenisQueryException( format( "Illegal data type [%s] for operator [%s]", dataType, QueryRule.Operator.SEARCH)); default: throw new UnexpectedEnumException(dataType); } }

Target:
private QueryBuilder createQueryClauseSearchAttribute( QueryRule queryRule, EntityType entityType) { List<Attribute> attributePath = getAttributePathExpanded(queryRule.getField(), entityType); Attribute attr = attributePath.get(attributePath.size() - 1); Object queryValue = getQueryValue(attr, queryRule.getValue()); String fieldName = getQueryFieldName(attributePath); AttributeType dataType = attr.getDataType(); switch (dataType) { case DATE: case DATE_TIME: case DECIMAL: case EMAIL: case ENUM: case HTML: case HYPERLINK: case INT: case LONG: case SCRIPT: case STRING: case TEXT: return nestedQueryBuilder( entityType, attributePath, QueryBuilders.simpleQueryStringQuery(queryValue.toString()) .defaultOperator(org.elasticsearch.index.query.Operator.AND) .field(fieldName)); case BOOL: throw new MolgenisQueryException( "Cannot execute search query on [" + dataType + "] attribute"); case CATEGORICAL: case CATEGORICAL_MREF: case XREF: case MREF: case FILE: case ONE_TO_MANY: case COMPOUND: throw new MolgenisQueryException( format("Illegal data type [%s] for operator [%s]", dataType, Operator.SEARCH_QUERY)); default: throw new UnexpectedEnumException(dataType); } }
Source:
public static String normalizePhone(String phoneNumber) { if (phoneNumber == null) return ""; if (false) { if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return PhoneNumberUtils.formatNumberToE164(phoneNumber, instance.countryIso); } else { return PhoneNumberUtils.formatNumber(instance.toE164(phoneNumber)); } } String normalized = instance.toE164(phoneNumber); Log.d("NORM", phoneNumber + " => " + normalized); return PhoneNumberUtils.formatNumber(normalized); }

Target:
public static String normalizePhone(String phoneNumber) { if (phoneNumber == null) return ""; if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String e164 = PhoneNumberUtils.formatNumberToE164(phoneNumber, instance.countryIso); if (e164 != null) { return PhoneNumberUtils.formatNumber(e164, instance.countryIso); } } return PhoneNumberUtils.formatNumber(instance.toE164(phoneNumber)); }
Source:
public BytecodeNode generateCall(String name, ScalarFunctionImplementation function, List<BytecodeNode> arguments) { Binding binding = callSiteBinder.bind(function.getMethodHandle()); Optional<BytecodeNode> instance = Optional.empty(); if (function.getInstanceFactory().isPresent()) { FieldDefinition field = cachedInstanceBinder.getCachedInstance(function.getInstanceFactory().get()); instance = Optional.of(scope.getThis().getField(field)); } return generateInvocation(scope, name, function, instance, arguments, callSiteBinder); }

Target:
public BytecodeNode generateCall(String name, ScalarFunctionImplementation function, List<BytecodeNode> arguments) { Optional<BytecodeNode> instance = Optional.empty(); if (function.getInstanceFactory().isPresent()) { FieldDefinition field = cachedInstanceBinder.getCachedInstance(function.getInstanceFactory().get()); instance = Optional.of(scope.getThis().getField(field)); } return generateInvocation(scope, name, function, instance, arguments, callSiteBinder); }
Source:
public void blockAndUnblockTwice() throws KettleException, InterruptedException { final ExecutorService executorService = Executors.newFixedThreadPool( 1 ); TransMeta parentMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); TransMeta subMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = new Trans( parentMeta, loggingObject ); SubtransExecutor subtransExecutor = new SubtransExecutor( "subtransname", parentTrans, subMeta, true, new TransExecutorParameters(), "", 1 ); RowMetaInterface rowMeta = parentMeta.getStepFields( "Data Grid" ); List<RowMetaAndData> rows = Arrays.asList( new RowMetaAndData( rowMeta, "Pentaho", 1L ), new RowMetaAndData( rowMeta, "Pentaho", 2L ), new RowMetaAndData( rowMeta, "Pentaho", 3L ), new RowMetaAndData( rowMeta, "Pentaho", 4L ) ); Future future = executorService.submit( () -> safeAcquirePermits( subtransExecutor, 8 ) ); Thread.sleep( 1000 ); subtransExecutor.execute( rows ); subtransExecutor.execute( rows ); final boolean timedOut = !safeWaitForCompletion( future, 3 ); assertFalse( timedOut ); }

Target:
public void blockAndUnblockTwice() throws KettleException, InterruptedException, ExecutionException, TimeoutException { final ExecutorService executorService = Executors.newFixedThreadPool( 1 ); TransMeta parentMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-parent.ktr" ).getPath(), new Variables() ); TransMeta subMeta = new TransMeta( this.getClass().getResource( "subtrans-executor-sub.ktr" ).getPath(), new Variables() ); LoggingObjectInterface loggingObject = new LoggingObject( "anything" ); Trans parentTrans = new Trans( parentMeta, loggingObject ); SubtransExecutor subtransExecutor = new SubtransExecutor( "subtransname", parentTrans, subMeta, true, new TransExecutorParameters(), "", 1 ); RowMetaInterface rowMeta = parentMeta.getStepFields( "Data Grid" ); List<RowMetaAndData> rows = Arrays.asList( new RowMetaAndData( rowMeta, "Pentaho", 1L ), new RowMetaAndData( rowMeta, "Pentaho", 2L ), new RowMetaAndData( rowMeta, "Pentaho", 3L ), new RowMetaAndData( rowMeta, "Pentaho", 4L ) ); CompletableFuture<Boolean> acquireThreadRunning = new CompletableFuture(); Future future = executorService.submit( () -> safeAcquirePermits( subtransExecutor, 8, acquireThreadRunning ) ); assertTrue( acquireThreadRunning.get( 5, TimeUnit.SECONDS ) ); subtransExecutor.execute( rows ); subtransExecutor.execute( rows ); final boolean timedOut = !safeWaitForCompletion( future, 5 ); assertFalse( timedOut ); }
Source:
protected ValueBlock(CustomUIPane pane, String fxml) { super(pane); value = new SimpleStringProperty("5.0"); this.loadFXML(fxml); try { output = new OutputAnchor(this, new Value(new ConstT("Float"), getValue()).analyze(getPane().getEnvInstance())); } catch (HaskellException e) { throw new TypeUnavailableException(); } outputSpace.getChildren().add(this.getOutputAnchor()); outputSpace.toFront(); output.layoutXProperty().bind(outputSpace.widthProperty().divide(2)); }

Target:
protected ValueBlock(CustomUIPane pane, String fxml) { super(pane); value = new SimpleStringProperty("5.0"); this.loadFXML(fxml); try { output = new OutputAnchor(this, new Value(new ConstT("Float"), getValue()).analyze(getPane().getEnvInstance())); } catch (HaskellException e) { throw new TypeUnavailableException(); } outputSpace.setCenter(this.getOutputAnchor()); outputSpace.toFront(); }
Source:
public Map<Integer, List<Cluster>> execute(GraphDatabaseService service) { Queue<Cluster> rootClusters = new PriorityQueue<>((e1, e2) -> e1.getStartRank() - e2.getStartRank() ); Set<String> visited = new HashSet<>(); Map<Integer, List<Cluster>> result = new HashMap<Integer, List<Cluster>>(); ClustersFromQuery clusterFrom = new ClustersFromQuery(visited, startNodes, threshold); rootClusters.addAll(clusterFrom.execute(service)); int minrank = rootClusters.stream().mapToInt(e -> e.getStartRank()).min().getAsInt(); while (!rootClusters.isEmpty()) { Cluster c = rootClusters.poll(); if (c.getStartRank() < minrank || c.getStartRank() > maxRank) { continue; } result.putIfAbsent(c.getStartRank(), new ArrayList<>()); result.get(c.getStartRank()).add(c); c.getNodes().forEach(sn -> { ClustersFromQuery cfq = new ClustersFromQuery(visited, sn.getOutgoing(), threshold); rootClusters.addAll(cfq.execute(service)); }); } return result; }

Target:
public Map<Integer, List<Cluster>> execute(GraphDatabaseService service) { Queue<Cluster> rootClusters = new PriorityQueue<>((e1, e2) -> e1.getStartRank() - e2.getStartRank() ); Set<String> visited = new HashSet<>(); Map<Integer, List<Cluster>> result = new HashMap<Integer, List<Cluster>>(); ClustersFromQuery clusterFrom = new ClustersFromQuery(visited, startNodes, threshold); rootClusters.addAll(clusterFrom.execute(service)); int minrank = rootClusters.stream().mapToInt(e -> e.getStartRank()).min().orElse(0); while (!rootClusters.isEmpty()) { Cluster c = rootClusters.poll(); if (c.getStartRank() < minrank || c.getStartRank() > maxRank) { continue; } result.putIfAbsent(c.getStartRank(), new ArrayList<>()); result.get(c.getStartRank()).add(c); c.getNodes().forEach(sn -> { ClustersFromQuery cfq = new ClustersFromQuery(visited, sn.getOutgoing(), threshold); rootClusters.addAll(cfq.execute(service)); }); } return result; }
Source:
private void makeRollback(OMicroTransaction microTransaction, Exception e) { OLogManager.instance().debug(this, "Error during micro-transaction commit, micro-transaction will be rolled back (tx-id=%d)", e, microTransaction.getId()); rollback(microTransaction); if (e instanceof OException) throw ((OException) e); else throw OException.wrapException(new OStorageException("Error during micro-transaction commit"), e); }

Target:
private void makeRollback(OMicroTransaction microTransaction, Exception e) { OLogManager.instance().debug(this, "Error during micro-transaction commit, micro-transaction will be rolled back (tx-id=%d)", e, microTransaction.getId()); rollback(microTransaction); if (e instanceof RuntimeException) throw ((RuntimeException) e); else throw OException.wrapException(new OStorageException("Error during micro-transaction commit"), e); }
Source:
public static String zkSecuritySysConfigString() { String loginConfig = System.getProperty(JAVA_LOGIN_CONFIG_PARAM); String clientEnabled = System.getProperty(ZK_SASL_CLIENT); String contextName = System.getProperty(ZK_LOGIN_CONTEXT_NAME_KEY); return "[" + JAVA_LOGIN_CONFIG_PARAM + "=" + loginConfig + ", " + ZK_SASL_CLIENT + "=" + (clientEnabled == null ? "default:" + DEFAULT_ZK_SASL_CLIENT : clientEnabled) + ", " + ZK_LOGIN_CONTEXT_NAME_KEY + "=" + (contextName == null ? "default:" + DEFAULT_ZK_LOGIN_CONTEXT_NAME : contextName) + "]"; }

Target:
public static String zkSecuritySysConfigString() { String loginConfig = System.getProperty(JAVA_LOGIN_CONFIG_PARAM); String clientEnabled = System.getProperty(ZK_SASL_CLIENT, "default:" + DEFAULT_ZK_SASL_CLIENT); String contextName = System.getProperty(ZK_LOGIN_CONTEXT_NAME_KEY, "default:" + DEFAULT_ZK_LOGIN_CONTEXT_NAME); return "[" + JAVA_LOGIN_CONFIG_PARAM + "=" + loginConfig + ", " + ZK_SASL_CLIENT + "=" + clientEnabled + ", " + ZK_LOGIN_CONTEXT_NAME_KEY + "=" + contextName + "]"; }
Source:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("Entered SsoLoginServlet"); String scope = String.format("ovirt-app-admin ovirt-app-portal ovirt-ext=auth:sequence-priority=%s", EngineLocalConfig.getInstance().getProperty(authSequencePriorityPropertyName)); String redirectUri = String.format("%s://%s:%s%s", request.getScheme(), FiltersHelper.getRedirectUriServerName(request.getServerName()), request.getServerPort(), postActionUrl); String url = new URLBuilder(FiltersHelper.getEngineSsoUrl(request), "/oauth/authorize") .addParameter("client_id", EngineLocalConfig.getInstance().getProperty("ENGINE_SSO_CLIENT_ID")) .addParameter("response_type", "code") .addParameter("app_url", request.getParameter("app_url")) .addParameter("engine_url", FiltersHelper.getEngineUrl(request)) .addParameter("redirect_uri", redirectUri) .addParameter("scope", scope).build(); log.debug("Redirecting to url: {}", url); response.sendRedirect(url); }

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("Entered SsoLoginServlet"); String scope = String.format("ovirt-app-admin ovirt-app-portal ovirt-ext=auth:sequence-priority=%s", EngineLocalConfig.getInstance().getProperty(authSequencePriorityPropertyName)); String redirectUri = String.format("%s://%s:%s%s", request.getScheme(), FiltersHelper.getRedirectUriServerName(request.getServerName()), request.getServerPort(), postActionUrl); String url = new URLBuilder(FiltersHelper.getEngineSsoUrl(request), "/oauth/authorize") .addParameter("client_id", EngineLocalConfig.getInstance().getProperty("ENGINE_SSO_CLIENT_ID")) .addParameter("response_type", "code") .addParameter("app_url", request.getParameter("app_url")) .addParameter("engine_url", FiltersHelper.getEngineUrl(request)) .addParameter("redirect_uri", redirectUri) .addParameter("scope", scope).build(); log.debug("Redirecting to '{}'", url); response.sendRedirect(url); }
Source:
public void updateMeta(Session session, DbObject obj) { if (isMVStore()) { synchronizes (this) { int id = obj.getId(); if (id > 0) { if (!starting && !obj.isTemporary()) { Row newRow = meta.getTemplateRow(); MetaRecord.populateRowFromDBObject(obj, newRow); Row oldRow = metaIdIndex.getRow(session, id); if (oldRow != null) { meta.updateRow(session, oldRow, newRow); } } objectIds.set(id); } } } else { lockMeta(session); synchronized (this) { int id = obj.getId(); removeMeta(session, id); addMeta(session, obj); if(id > 0) { objectIds.set(id); } } } }

Target:
public void updateMeta(Session session, DbObject obj) { if (isMVStore()) { synchronized (this) { int id = obj.getId(); if (id > 0) { if (!starting && !obj.isTemporary()) { Row newRow = meta.getTemplateRow(); MetaRecord.populateRowFromDBObject(obj, newRow); Row oldRow = metaIdIndex.getRow(session, id); if (oldRow != null) { meta.updateRow(session, oldRow, newRow); } } objectIds.set(id); } } } else { lockMeta(session); synchronized (this) { int id = obj.getId(); removeMeta(session, id); addMeta(session, obj); if(id > 0) { objectIds.set(id); } } } }
Source:
public SubscriptionScheduleCollection list(Map<String, Object> params) throws StripeException { return list(params, (RequestOptions) null); }

Target:
public static SubscriptionScheduleCollection list(Map<String, Object> params) throws StripeException { return list(params, (RequestOptions) null); }
Source:
public String rewriteColumnType(ColumnType columnType, Integer columnSize) { if (columnType == ColumnType.INTEGER) { return "INT"; } if (columnType == ColumnType.STRING && columnSize == null) { return super.rewriteColumnType(columnType, 65535); } return super.rewriteColumnType(columnType, columnSize); }

Target:
public String rewriteColumnType(ColumnType columnType, Integer columnSize) { if (columnType == ColumnType.INTEGER) { return "INT"; } if(columnType == ColumnType.STRING) { return "STRING"; } if (columnType == ColumnType.VARCHAR && columnSize == null) { return super.rewriteColumnType(columnType, 65535); } return super.rewriteColumnType(columnType, columnSize); }
Source:
public static Organization createDtoFromDbo(DBOOrganization dbo) { Organization dto = new Organization(); dto.setCreatedBy("" + dbo.getCreatedBy()); dto.setCreatedOn(dbo.getCreatedOn()); dto.setId(""+dbo.getId()); dto.setName(dbo.getName()); return dto; }

Target:
public static Organization createDtoFromDbo(DBOOrganization dbo) { Organization dto = new Organization(); dto.setCreatedBy(dbo.getCreatedBy().toString()); dto.setCreatedOn(dbo.getCreatedOn()); dto.setId(dbo.getId().toString()); dto.setName(dbo.getName()); return dto; }
Source:
private AggregatedColumn(Column column, Function function) { super(column.table, column.field, column.type); this.function = function; this.sqlKeyword = function.toString() + "(" + column.getSqlKeyword() + ")"; this.alias = column.getSqlKeyword().replaceAll("\\.", "_") + "_" + function.name().toLowerCase(); }

Target:
private AggregatedColumn(Column column, Function function) { this(column, function, createSqlKeyword(column, function), createAlias(column, function)); }
Source:
public void shutdown() { log.info("Shutdown LogUnit server. Current epoch: {}, ", serverContext.getServerEpoch()); super.shutdown(); executor.shutdown(); logCleaner.shutdown(); batchWriter.close(); streamLog.close(); }

Target:
public CompletableFuture<Void> shutdown() { log.info("Shutdown LogUnit server. Current epoch: {}, ", serverContext.getServerEpoch()); markShutdown(); return shutdownServerExecutor(executor) .exceptionally(ex -> { log.error("LogUitServer shutdown error", ex); return null; }) .thenCompose(empty -> logCleaner.shutdown()) .thenCompose(empty -> batchWriter.asyncClose()) .thenRun(streamLog::close); }