auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean saveEntity(Entity entity) { if (!ctx.isPOST()) { return false; } try { boolean wasNew = entity.isNew(); if (preSaveHandler != null) { preSaveHandler.accept(wasNew); } if (columns != null && !columns.isEmpty()) { load(ctx, entity, columns); } else { load(ctx, entity); } if (onSaveHandler != null) { onSaveHandler.accept(entity); } oma.update(entity); if (postSaveHandler != null) { postSaveHandler.accept(wasNew); } if (wasNew && Strings.isFilled(createdURI)) { ctx.respondWith() .redirectToGet(Formatter.create(createdURI).set("id", entity.getIdAsString()).format()); return true; } if (!oma.hasValidationWarnings(entity) && Strings.isFilled(afterSaveURI)) { ctx.respondWith().redirectToGet(afterSaveURI); return true; } showSavedMessage(); } catch (Exception e) { UserContext.handle(e); } return false; }

Target:
public boolean saveEntity(Entity entity) { if (!ctx.isPOST()) { return false; } try { boolean wasNew = entity.isNew(); if (columns != null && !columns.isEmpty()) { load(ctx, entity, columns); } else { load(ctx, entity); } if (preSaveHandler != null) { preSaveHandler.accept(wasNew); } oma.update(entity); if (postSaveHandler != null) { postSaveHandler.accept(wasNew); } if (wasNew && Strings.isFilled(createdURI)) { ctx.respondWith() .redirectToGet(Formatter.create(createdURI).set("id", entity.getIdAsString()).format()); return true; } if (!oma.hasValidationWarnings(entity) && Strings.isFilled(afterSaveURI)) { ctx.respondWith().redirectToGet(afterSaveURI); return true; } showSavedMessage(); } catch (Exception e) { UserContext.handle(e); } return false; }
Source:
protected InputStream getInputStream() throws IOException { try { return contentResolver.openInputStream(uri); } catch (final FileNotFoundException e) { if (uri.toString().startsWith("http")) { return Network.getResponseStream(Network.getRequest(uri.toString())); } Log.e("GpxZip import cannot resolve " + uri); } return null; }

Target:
protected InputStream getInputStream() throws IOException { try { return contentResolver.openInputStream(uri); } catch (final FileNotFoundException e) { if (uri.toString().startsWith("http")) { return Network.getResponseStream(Network.getRequest(uri.toString())); } } Log.e("GpxZip import cannot resolve " + uri); return null; }
Source:
public void updateParticipantPhoneCannotBeChanged() { mockHealthCodeAndAccountRetrieval(EMAIL, PHONE); when(account.getPhoneVerified()).thenReturn(Boolean.TRUE); StudyParticipant participant = new StudyParticipant.Builder().copyOf(PARTICIPANT) .withPhone(OTHER_PHONE).withEmailVerified(Boolean.FALSE).build(); participantService.updateParticipant(STUDY, ImmutableSet.of(), participant); verify(accountDao).updateAccount(accountCaptor.capture()); Account account = accountCaptor.getValue(); verify(account, never()).setPhone(PHONE); verify(account, never()).setPhoneVerified(Boolean.TRUE); verify(accountWorkflowService, never()).sendEmailVerificationToken(STUDY, ID, EMAIL); }

Target:
public void updateParticipantPhoneCannotBeChanged() { mockHealthCodeAndAccountRetrieval(EMAIL, PHONE); when(account.getPhoneVerified()).thenReturn(Boolean.TRUE); StudyParticipant participant = new StudyParticipant.Builder().copyOf(PARTICIPANT) .withPhone(OTHER_PHONE).withEmailVerified(Boolean.FALSE).build(); participantService.updateParticipant(STUDY, ImmutableSet.of(), participant); verify(accountDao).updateAccount(accountCaptor.capture()); Account account = accountCaptor.getValue(); verify(account, never()).setPhone(any()); verify(account, never()).setPhoneVerified(anyBoolean()); verify(accountWorkflowService, never()).sendEmailVerificationToken(eq(STUDY), eq(ID), anyString()); }
Source:
SynchronousReceiveWork(long id, int numberToReceive, Duration timeout, FluxSink<ServiceBusReceivedMessageContext> emitter) { this.id = id; this.remaining = new AtomicInteger(numberToReceive); this.numberToReceive = numberToReceive; this.timeout = timeout; this.emitter = emitter; nextMessageSubscriber = Flux.switchOnNext(messageReceivedEmitter .map(messageContext -> { emitter.next(messageContext); remaining.decrementAndGet(); return messageContext; }) .flatMap(lockToken -> Mono.delay(SHORT_TIMEOUT_BETWEEN_MESSAGES)) .handle((l, sink) -> { emitter.complete(); sink.complete(); })) .subscribe(); }

Target:
SynchronousReceiveWork(long id, int numberToReceive, Duration timeout, FluxSink<ServiceBusReceivedMessageContext> emitter) { this.id = id; this.remaining = new AtomicInteger(numberToReceive); this.numberToReceive = numberToReceive; this.timeout = timeout; this.emitter = emitter; emitterProcessor = DirectProcessor.create(); messageReceivedSink = emitterProcessor.sink(); nextMessageSubscriber = Flux.switchOnNext(emitterProcessor.map(messageContext -> Flux.interval(TIMEOUT_BETWEEN_MESSAGES))) .handle((delay, sink) -> { logger.info("[{}]: Timeout between the messages occurred. Completing the work.", id); sink.next(delay); emitter.complete(); }) .subscribe(); }
Source:
public YarnAppHandleImpl launchApp(final StreamingApplication app, Configuration conf, Attribute.AttributeMap launchParameters) throws LauncherException { this.conf = conf; if (launchParameters != null) { for (Map.Entry<Attribute<?>, Object> entry : launchParameters.entrySet()) { String property = propMapping.get(entry.getKey()); if (property != null) { setConfiguration(conf, property, entry.getValue()); } } } try { String name = app.getClass().getName(); StramAppLauncher appLauncher = new StramAppLauncher(name, conf); appLauncher.loadDependencies(); StreamingAppFactory appFactory = new StreamingAppFactory(name, app.getClass()) { @Override public LogicalPlan createApp(LogicalPlanConfiguration planConfig) { return super.createApp(app, planConfig); } }; ApplicationId appId = appLauncher.launchApp(appFactory); return new YarnAppHandleImpl(appId); } catch (Exception ex) { throw new LauncherException(ex); } }

Target:
public YarnAppHandleImpl launchApp(final StreamingApplication app, Configuration conf, Attribute.AttributeMap launchParameters) throws LauncherException { if (launchParameters != null) { for (Map.Entry<Attribute<?>, Object> entry : launchParameters.entrySet()) { String property = propMapping.get(entry.getKey()); if (property != null) { setConfiguration(conf, property, entry.getValue()); } } } try { String name = app.getClass().getName(); StramAppLauncher appLauncher = new StramAppLauncher(name, conf); appLauncher.loadDependencies(); StreamingAppFactory appFactory = new StreamingAppFactory(name, app.getClass()) { @Override public LogicalPlan createApp(LogicalPlanConfiguration planConfig) { return super.createApp(app, planConfig); } }; ApplicationId appId = appLauncher.launchApp(appFactory); return new YarnAppHandleImpl(appId, conf); } catch (Exception ex) { throw new LauncherException(ex); } }
Source:
@Before public void setUp() { FileUtil.fullyDelete(TEST_DIR); assertTrue(TEST_DIR.mkdirs()); }

Target:
public void setUp() { FileUtil.fullyDelete(TEST_DIR); assertTrue(TEST_DIR.mkdirs()); }
Source:
Mono<Response<FileUploadInfo>> clearRangeWithResponse(long length, long offset, Context context) { FileRange range = new FileRange(offset, offset + length - 1); return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.CLEAR, 0L, null, null, null, Context.NONE) .map(this::uploadResponse); }

Target:
Mono<Response<FileUploadInfo>> clearRangeWithResponse(long length, long offset, Context context) { FileRange range = new FileRange(offset, offset + length - 1); return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.CLEAR, 0L, null, null, null, context) .map(this::uploadResponse); }
Source:
public int hashCode() { return commitMetadata.getCommitId().hashCode(); }

Target:
public int hashCode() { return getId().hashCode(); }
Source:
public boolean hasPermisssion() { for(String p : permissions) { if(PackageManager.PERMISSION_DENIED == cordova.getActivity().checkSelfPermission(p)) { return false; } } return true; }

Target:
public boolean hasPermisssion() { if(Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { return true; } for(String p : permissions) { if(PackageManager.PERMISSION_DENIED == cordova.getActivity().checkSelfPermission(p)) { return false; } } return true; }
Source:
public String getBucketPolicy(GetBucketPolicyArgs args) throws BucketPolicyTooLargeException, ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { if (args == null) { throw new IllegalArgumentException("null arguments"); } Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("policy", ""); try (Response response = executeGet(args.bucket(), null, null, queryParamMap)) { byte[] buf = new byte[MAX_BUCKET_POLICY_SIZE]; int bytesRead = 0; bytesRead = response.body().byteStream().read(buf, 0, MAX_BUCKET_POLICY_SIZE); if (bytesRead < 0) { throw new IOException("unexpected EOF when reading bucket policy"); } if (bytesRead == MAX_BUCKET_POLICY_SIZE) { int byteRead = 0; while (byteRead == 0) { byteRead = response.body().byteStream().read(); if (byteRead < 0) { break; } if (byteRead > 0) { throw new BucketPolicyTooLargeException(args.bucket()); } } } return new String(buf, 0, bytesRead, StandardCharsets.UTF_8); } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_BUCKET_POLICY) { throw e; } } return ""; }

Target:
public String getBucketPolicy(GetBucketPolicyArgs args) throws BucketPolicyTooLargeException, ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { checkArgs(args); Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("policy", ""); try (Response response = executeGet(args.bucket(), null, null, queryParamMap)) { byte[] buf = new byte[MAX_BUCKET_POLICY_SIZE]; int bytesRead = 0; bytesRead = response.body().byteStream().read(buf, 0, MAX_BUCKET_POLICY_SIZE); if (bytesRead < 0) { throw new IOException("unexpected EOF when reading bucket policy"); } if (bytesRead == MAX_BUCKET_POLICY_SIZE) { int byteRead = 0; while (byteRead == 0) { byteRead = response.body().byteStream().read(); if (byteRead < 0) { break; } if (byteRead > 0) { throw new BucketPolicyTooLargeException(args.bucket()); } } } return new String(buf, 0, bytesRead, StandardCharsets.UTF_8); } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_BUCKET_POLICY) { throw e; } } return ""; }
Source:
public TracingActivityThread(final ForkJoinPool pool) { super(pool); if (VmSettings.SNAPSHOTS_ENABLED) { this.snapshotBuffer = new SnapshotBuffer((ActorProcessingThread) this); } if (VmSettings.ACTOR_TRACING || VmSettings.KOMPOS_TRACING) { threadId = threadIdGen.getAndIncrement(); traceBuffer = TraceBuffer.create(this.threadId); nextEntityId = 1 + (threadId << TraceData.ENTITY_ID_BITS); externalData = new Object[EXTERNAL_BUFFER_SIZE]; } else { threadId = 0; nextEntityId = 0; traceBuffer = null; externalData = null; } setName(getClass().getSimpleName() + "-" + threadId); }

Target:
public TracingActivityThread(final ForkJoinPool pool) { super(pool); if (VmSettings.SNAPSHOTS_ENABLED) { this.snapshotBuffer = new SnapshotBuffer((ActorProcessingThread) this); } if (VmSettings.ACTOR_TRACING || VmSettings.KOMPOS_TRACING) { threadId = threadIdGen.getAndIncrement(); traceBuffer = TraceBuffer.create(threadId); nextEntityId = 1 + (threadId << TraceData.ENTITY_ID_BITS); externalData = new Object[EXTERNAL_BUFFER_SIZE]; } else { threadId = 0; nextEntityId = 0; traceBuffer = null; externalData = null; } setName(getClass().getSimpleName() + "-" + threadId); }
Source:
public void postInstallFreeIpa(Long stackId, boolean fullPostInstall) throws Exception { LOGGER.debug("Performing post-install configuration for stack {}. {}.", stackId, fullPostInstall ? "Full post install" : "Partial post install"); Stack stack = stackService.getStackById(stackId); FreeIpaClient freeIpaClient = freeIpaClientFactory.getFreeIpaClientForStack(stack); freeIpaTopologyService.updateReplicationTopology(stackId, freeIpaClient); if (!fullPostInstall) { return; } Set<Permission> permission = freeIpaClient.findPermission(SET_PASSWORD_EXPIRATION_PERMISSION); if (permission.isEmpty()) { freeIpaClient.addPasswordExpirationPermission(SET_PASSWORD_EXPIRATION_PERMISSION); } freeIpaClient.addPermissionToPrivilege(USER_ADMIN_PRIVILEGE, SET_PASSWORD_EXPIRATION_PERMISSION); freeIpaPermissionService.setPermissions(freeIpaClient); if (!Objects.equals(MAX_USERNAME_LENGTH, freeIpaClient.getUsernameLength())) { LOGGER.debug("Set maximum username length to {}", MAX_USERNAME_LENGTH); freeIpaClient.setUsernameLength(MAX_USERNAME_LENGTH); } passwordPolicyService.updatePasswordPolicy(freeIpaClient); modifyAdminPasswordExpirationIfNeeded(freeIpaClient); userSyncService.synchronizeUsers( ThreadBasedUserCrnProvider.getAccountId(), ThreadBasedUserCrnProvider.getUserCrn(), Set.of(stack.getEnvironmentCrn()), Set.of(), Set.of()); }

Target:
public void postInstallFreeIpa(Long stackId, boolean fullPostInstall) throws Exception { LOGGER.debug("Performing post-install configuration for stack {}. {}.", stackId, fullPostInstall ? "Full post install" : "Partial post install"); Stack stack = stackService.getStackById(stackId); FreeIpaClient freeIpaClient = freeIpaClientFactory.getFreeIpaClientForStack(stack); freeIpaTopologyService.updateReplicationTopology(stackId, freeIpaClient); if (fullPostInstall) { setInitialFreeIpaPolicies(stack, freeIpaClient); } }
Source:
public List<CourseAttributes> getCoursesForStudentAccount(String googleId) throws EntityDoesNotExistException { List<StudentAttributes> studentDataList = studentsLogic.getStudentsForGoogleId(googleId); if (studentDataList.size() == 0) { throw new EntityDoesNotExistException("Student with Google ID " + googleId + " does not exist"); } List<String> courses = new ArrayList<String>(); for (StudentAttributes s : studentDataList) { courses.add(s.course); } List<CourseAttributes> courseList = coursesDb.getCourses(courses); return courseList; }

Target:
public List<CourseAttributes> getCoursesForStudentAccount(String googleId) throws EntityDoesNotExistException { List<StudentAttributes> studentDataList = studentsLogic.getStudentsForGoogleId(googleId); if (studentDataList.size() == 0) { throw new EntityDoesNotExistException("Student with Google ID " + googleId + " does not exist"); } List<String> courseIds = new ArrayList<String>(); for (StudentAttributes s : studentDataList) { courseIds.add(s.course); } List<CourseAttributes> courseList = coursesDb.getCourses(courseIds); return courseList; }
Source:
protected void createRepositoryInternal(Storage storage, Repository repository) throws RepositoryManagementStrategyException { if (!repositoryFeatures.isIndexingEnabled(repository)) { return; } String storageId = storage.getId(); String repositoryId = repository.getId(); MavenRepositoryConfiguration repositoryConfig = (MavenRepositoryConfiguration) repository.getRepositoryConfiguration(); if (repository.isHostedRepository()) { createRebuildMavenIndexCronJob(storageId, repositoryId, repositoryConfig.getRebuildMavenIndexesCronExpression()); } if (repository.isProxyRepository()) { createRemoteIndexDownloaderCronTask(storageId, repositoryId, repositoryConfig.getDownloadRemoteMavenIndexCronExpression()); } if (repository.isGroupRepository()) { createMergeMavenGroupRepositoryIndexCronJob(storageId, repositoryId); } }

Target:
protected void createRepositoryInternal(Storage storage, Repository repository) throws RepositoryManagementStrategyException { if (!repositoryFeatures.isIndexingEnabled(repository)) { return; } String storageId = storage.getId(); String repositoryId = repository.getId(); MavenRepositoryConfiguration repositoryConfig = (MavenRepositoryConfiguration) repository.getRepositoryConfiguration(); if (repository.isHostedRepository()) { createRebuildMavenIndexCronJob(storageId, repositoryId, repositoryConfig.getCronExpression()); } if (repository.isProxyRepository()) { createRemoteIndexDownloaderCronTask(storageId, repositoryId, repositoryConfig.getCronExpression()); } if (repository.isGroupRepository()) { createMergeMavenGroupRepositoryIndexCronJob(storageId, repositoryId, repositoryConfig.getCronExpression()); } }
Source:
public void testShutdown() throws Exception { File tmpDir = createTempDir("stateManger", "test"); final ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); conf.setJournalDirName(tmpDir.getPath()) .setLedgerDirNames(new String[] { tmpDir.getPath() }) .setZkServers(zkUtil.getZooKeeperConnectString()); BookieServer bkServer = new BookieServer(conf) { protected Bookie newBookie(ServerConfiguration conf) throws IOException, KeeperException, InterruptedException, BookieException { Bookie bookie = new Bookie(conf); rm.setRegisterFail(true); rm.initialize(conf, () -> {}, NullStatsLogger.INSTANCE); LOG.info(" is ", zkc == null); bookie.setRegistrationManager(rm); return bookie; } }; bkServer.start(); bkServer.join(); assertTrue("Failed to return failCode ZK_REG_FAIL", ExitCode.ZK_REG_FAIL == bkServer.getExitCode()); }

Target:
public void testShutdown() throws Exception { File tmpDir = createTempDir("stateManger", "test"); final ServerConfiguration conf = TestBKConfiguration.newServerConfiguration(); conf.setJournalDirName(tmpDir.getPath()) .setLedgerDirNames(new String[] { tmpDir.getPath() }) .setJournalDirName(tmpDir.toString()) .setZkServers(zkUtil.getZooKeeperConnectString()); BookieServer bkServer = new BookieServer(conf) { protected Bookie newBookie(ServerConfiguration conf) throws IOException, KeeperException, InterruptedException, BookieException { Bookie bookie = new Bookie(conf); rm.setRegisterFail(true); rm.initialize(conf, () -> {}, NullStatsLogger.INSTANCE); bookie.setRegistrationManager(rm); return bookie; } }; bkServer.start(); bkServer.join(); assertTrue("Failed to return failCode ZK_REG_FAIL", ExitCode.ZK_REG_FAIL == bkServer.getExitCode()); }
Source:
Map<SystemStreamPartition, String> getFileOffsets() { LOG.info("Loading initial offsets from the file for side input stores."); Map<SystemStreamPartition, String> fileOffsets = new HashMap<>(); stores.keySet().forEach(storeName -> { LOG.debug("Reading local offsets for store: {}", storeName); File storeLocation = getStoreLocation(storeName); if (isValidSideInputStore(storeName, storeLocation)) { try { String fileContents = StorageManagerUtil.readOffsetFile(storeLocation, OFFSET_FILE); TypeReference<HashMap<SystemStreamPartition, String>> ref = new TypeReference<HashMap<SystemStreamPartition, String>>() { }; Map<SystemStreamPartition, String> offsets = OBJECT_MAPPER.readValue(fileContents, ref); fileOffsets.putAll(offsets); } catch (Exception e) { LOG.warn("Failed to load the offset file for side input store:" + storeName, e); } } }); return fileOffsets; }

Target:
Map<SystemStreamPartition, String> getFileOffsets() { LOG.info("Loading initial offsets from the file for side input stores."); Map<SystemStreamPartition, String> fileOffsets = new HashMap<>(); stores.keySet().forEach(storeName -> { LOG.debug("Reading local offsets for store: {}", storeName); File storeLocation = getStoreLocation(storeName); if (isValidSideInputStore(storeName, storeLocation)) { try { String fileContents = StorageManagerUtil.readOffsetFile(storeLocation, OFFSET_FILE); Map<SystemStreamPartition, String> offsets = OBJECT_MAPPER.readValue(fileContents, OFFSETS_TYPE_REFERENCE); fileOffsets.putAll(offsets); } catch (Exception e) { LOG.warn("Failed to load the offset file for side input store:" + storeName, e); } } }); return fileOffsets; }
Source:
public void onBindViewHolder(@NonNull final ContributionViewHolder holder, final int position) { final Contribution contribution = getItem(position); if (contribution != null) { holder.init(position, contribution); } }

Target:
public void onBindViewHolder(@NonNull final ContributionViewHolder holder, final int position) { final Contribution contribution = getItem(position); holder.init(position, contribution); }
Source:
private void reportUpgradeError(CentralRepoException ex) { try { SwingUtilities.invokeAndWait(() -> { JOptionPane.showMessageDialog(null, ex.getUserMessage(), NbBundle.getMessage(this.getClass(), "Installer.centralRepoUpgradeFailed.title"), JOptionPane.ERROR_MESSAGE); }); } catch (InterruptedException | InvocationTargetException e) { LOGGER.warning("There was an error while running the swing utility invoke later while displaying an error " + "for creating the central repository database: " + e.getMessage() + System.lineSeparator() + e.getStackTrace()); } }

Target:
private void reportUpgradeError(CentralRepoException ex) { try { SwingUtilities.invokeAndWait(() -> { JOptionPane.showMessageDialog(null, ex.getUserMessage(), NbBundle.getMessage(this.getClass(), "Installer.centralRepoUpgradeFailed.title"), JOptionPane.ERROR_MESSAGE); }); } catch (InterruptedException | InvocationTargetException e) { LOGGER.log(Level.WARNING, e.getMessage(), e); } }
Source:
protected List<MethodMatcher> getMethodInvocationMatchers() { return ImmutableList.of(MethodMatcher.create().typeDefinition("javax.servlet.http.HttpSession").name("setAttribute").withNoParameterConstraint()); }

Target:
protected List<MethodMatcher> getMethodInvocationMatchers() { return ImmutableList.of( MethodMatcher.create().typeDefinition("javax.servlet.http.HttpSession").name("setAttribute").addParameter(TypeCriteria.anyType()).addParameter(TypeCriteria.anyType()), MethodMatcher.create().typeDefinition("javax.servlet.http.HttpSession").name("putValue").addParameter(TypeCriteria.anyType()).addParameter(TypeCriteria.anyType())); }
Source:
public static int getPortOffset() { ServerConfiguration carbonConfig = ServerConfiguration.getInstance(); String portOffset = System .getProperty(PORT_OFFSET_SYSTEM_VAR, carbonConfig.getFirstProperty(PORT_OFFSET_CONFIG)); try { if (portOffset != null) { return Integer.parseInt(portOffset.trim()); } else { return 0; } } catch (NumberFormatException e) { log.error("Invalid Port Offset: " + portOffset + ". Default value 0 will be used.", e); return 0; } }

Target:
public static int getPortOffset() { ServerConfiguration carbonConfig = ServerConfiguration.getInstance(); String portOffsetInCarbonXML = carbonConfig.getFirstProperty(PORT_OFFSET_CONFIG); String portOffset = System.getProperty(PORT_OFFSET_SYSTEM_VAR, portOffsetInCarbonXML); if (portOffset != null) { return Integer.parseInt(portOffset.trim()); } else { return 0; } }
Source:
protected File discoverGitPrefix() { String path = SystemReader.getInstance().getenv("PATH"); File gitExe = searchPath(path, "git.exe", "git.cmd"); if (gitExe != null) return gitExe.getParentFile().getParentFile(); String w = readPipe(userHome(), new String[] { "bash", "--login", "-c", "which git" }, Charset.defaultCharset().name()); if (w != null) { gitExe = resolve(null, w); if (gitExe != null) { File parentFile = gitExe.getParentFile(); if(parentFile != null) return parentFile.getParentFile(); } } return null; }

Target:
protected File discoverGitPrefix() { String path = SystemReader.getInstance().getenv("PATH"); File gitExe = searchPath(path, "git.exe", "git.cmd"); if (gitExe != null) return resolveGrandparentFile(gitExe); String w = readPipe(userHome(), new String[] { "bash", "--login", "-c", "which git" }, Charset.defaultCharset().name()); if (w != null) { gitExe = resolve(null, w); if (gitExe != null) return resolveGrandparentFile(gitExe); } return null; }
Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { String title = getArguments().getString(ARG_TITLE); String message = getArguments().getString(ARG_MESSAGE); AlertDialog ret = new AlertDialog.Builder(getContext()) .setMessage(message) .setPositiveButton(R.string.label_ok, null) .create(); if (title != null) { ret.setTitle(title); } ret.setCanceledOnTouchOutside(false); return ret; }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { String title = getArguments().getString(ARG_TITLE); String message = getArguments().getString(ARG_MESSAGE); AlertDialog alertDialog = new AlertDialog.Builder(getContext()) .setMessage(message) .setPositiveButton(R.string.label_ok, null) .create(); if (title != null) { alertDialog.setTitle(title); } alertDialog.setCanceledOnTouchOutside(false); return alertDialog; }
Source:
private Optional<Account> updateEmail(final Account account, final Long lastModified) { try { int rows = updateEmail(account.email, account.id.get(), account.lastModified, lastModified); if (rows == 0) { return Optional.absent(); } return getById(account.id.get()); } catch (UnableToExecuteStatementException exception) { final Matcher matcher = MatcherPatternsDB.PG_UNIQ_PATTERN.matcher(exception.getMessage()); if (matcher.find()) { LOGGER.error("Account with email = already exists", account.email); } } return Optional.absent(); }

Target:
private Optional<Account> updateEmail(final Account account, final Long lastModified) { try { int rows = updateEmail(account.email, account.id.get(), account.lastModified, lastModified); if (rows == 0) { return Optional.absent(); } return getById(account.id.get()); } catch (UnableToExecuteStatementException exception) { final Matcher matcher = MatcherPatternsDB.PG_UNIQ_PATTERN.matcher(exception.getMessage()); if (matcher.find()) { LOGGER.error("Account with email = already exists", account.email); } LOGGER.error("Unknown error: {}", exception.getMessage()); } return Optional.absent(); }
Source:
public Pair<Boolean, String> validate(DispoAnnotationData annotation) { String pcr = annotation.getResolution().toUpperCase().trim(); boolean isValid = false; String type = "NONE"; if (pcr.matches("^\\s*[CTR]\\d{4,5}\\s*$")) { isValid = true; if (pcr.startsWith("C")) { type = "CODE"; } else if (pcr.startsWith("T")) { type = "TEST"; } else if (pcr.startsWith("R")) { type = "REQ"; } else if (pcr.startsWith("TRAX") || pcr.startsWith("CTE")) { type = "OTHER"; } } boolean isOpen = checkStatus(pcr); Pair<Boolean, String> toReturn = new Pair<Boolean, String>(isOpen && isValid, type); return toReturn; }

Target:
public Pair<Boolean, String> validate(DispoAnnotationData annotation) { String pcr = annotation.getResolution().toUpperCase().trim(); boolean isValid = false; String type = "NONE"; if (pcr.matches("^\\s*[CTR]\\d{4,5}\\s*$")) { isValid = true; if (pcr.startsWith("C")) { type = "CODE"; } else if (pcr.startsWith("T")) { type = "TEST"; } else if (pcr.startsWith("R")) { type = "REQ"; } else { type = "OTHER"; } } boolean isOpen = checkStatus(pcr); Pair<Boolean, String> toReturn = new Pair<Boolean, String>(isOpen && isValid, type); return toReturn; }
Source:
protected void onCreate(Bundle savedInstanceState) { if (DEBUG) Log.d(TAG, "onCreate() called with: savedInstanceState = [" + savedInstanceState + "]"); ServiceHelper.initServices(this); ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this)); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } if (getSupportFragmentManager() != null && getSupportFragmentManager().getBackStackEntryCount() == 0) { initFragments(); } setSupportActionBar(findViewById(R.id.toolbar)); try { setupDrawer(); } catch (Exception e) { ErrorActivity.reportUiError(this, e); } }

Target:
protected void onCreate(Bundle savedInstanceState) { if (DEBUG) Log.d(TAG, "onCreate() called with: savedInstanceState = [" + savedInstanceState + "]"); ThemeHelper.setTheme(this, ServiceHelper.getSelectedServiceId(this)); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } if (getSupportFragmentManager() != null && getSupportFragmentManager().getBackStackEntryCount() == 0) { initFragments(); } setSupportActionBar(findViewById(R.id.toolbar)); try { setupDrawer(); } catch (Exception e) { ErrorActivity.reportUiError(this, e); } }
Source:
List<Object> projectRow(Group row) { ArrayList<Object> output = new ArrayList<Object>(this.visitor.getProjectedColumns().size()); int fieldCount = row.getType().getFieldCount(); for (int field = 0; field < fieldCount; field++) { int valueCount = row.getFieldRepetitionCount(field); Type fieldType = row.getType().getType(field); String fieldName = fieldType.getName(); for (int index = 0; index < valueCount; index++) { switch (fieldName) { case "INT96": output.add(row.getInt96(field, index)); break; case "INT": output.add(row.getInteger(field, index)); break; case "BOOLEAN": output.add(row.getBoolean(field, index)); break; case "FLOAT": output.add(row.getFloat(field, index)); break; case "DOUBLE": output.add(row.getDouble(field, index)); break; case "BYTE_ARRAY": output.add(row.getBinary(field,index)); } } } return output; }

Target:
List<Object> projectRow(Group row) throws TranslatorException { final List<Object> output = new ArrayList<Object>(); int field = 0; List<String> expectedColumnNames = this.visitor.getProjectedColumnNames(); for (int i = 0; i < expectedColumnNames.size(); i++) { if(this.partitionedColumnsHm.contains(expectedColumnNames.get(i))){ output.add(partitionedColumnsValue.get(expectedColumnNames.get(i))); }else { Type fieldType = row.getType().getType(field); int valueCount = row.getFieldRepetitionCount(field); if ("REPEATED".equals(fieldType.getRepetition().toString())) { output.add(getRepeatedList(row, field)); } if (fieldType.getLogicalTypeAnnotation() != null && "LIST".equals(fieldType.getLogicalTypeAnnotation().toString())) { output.add(getList(row.getGroup(field, 0))); field++; continue; } if (!fieldType.isPrimitive()) { throw new TranslatorException("We don't support any logical type other than LIST as of now."); } if (valueCount == 0) { output.add(null); } else { PrimitiveType.PrimitiveTypeName type = fieldType.asPrimitiveType().getPrimitiveTypeName(); output.add(getPrimitiveTypeObject(type, field, 0, row, fieldType)); } field++; } } return output; }
Source:
public <T> T getBitmapResult(BitmapIndexSelector selector, BitmapResultFactory<T> bitmapResultFactory) { return null; }

Target:
public <T> T getBitmapResult(BitmapIndexSelector selector, BitmapResultFactory<T> bitmapResultFactory) { return bitmapResultFactory.wrapAllTrue(Filters.allTrue(selector)); }
Source:
protected ValidationResult validate(Artifact artToValidate, IProgressMonitor monitor) throws OseeCoreException { Collection<String> errorMessages = new ArrayList<>(); boolean validationPassed = true; String wtc = artToValidate.getSoleAttributeValue(CoreAttributeTypes.WordTemplateContent, ""); Matcher match = NORMAL_LIST_BULLET_STYLE.matcher(wtc); if (match.find()) { errorMessages.add(ValidationReportOperation.getRequirementHyperlink( artToValidate) + " (" + artToValidate.getGammaId() + ")" + " is not using lists or bullets associated with an expected style."); validationPassed = false; } return new ValidationResult(errorMessages, validationPassed); }

Target:
protected ValidationResult validate(Artifact artToValidate, IProgressMonitor monitor) throws OseeCoreException { Collection<String> errorMessages = new ArrayList<>(); boolean validationPassed = true; String wtc = artToValidate.getSoleAttributeValue(CoreAttributeTypes.WordTemplateContent, ""); Matcher match = NORMAL_LIST_BULLET_STYLE.matcher(wtc); if (match.find()) { errorMessages.add(ValidationReportOperation.getRequirementHyperlink( artToValidate) + " (" + artToValidate.getGammaId() + ")" + " is not using lists or bullets associated with an expected style." + " See " + getHyperLink()); validationPassed = false; } return new ValidationResult(errorMessages, validationPassed); }
Source:
public void append(final LogEvent event) { if (event.getLoggerName() != null && event.getLoggerName().startsWith("org.apache.redis")) { LOGGER.warn("Recursive logging from for appender [{}].", event.getLoggerName(), getName()); } else { try { tryAppend(event); } catch (final Exception e) { error("Unable to write to Redis in appender [" + getName() + "]", event, e); } } }

Target:
public void append(final LogEvent event) { final Layout<? extends Serializable> layout = getLayout(); if (event.getLoggerName() != null && AbstractLogger.getRecursionDepth() > 1) { LOGGER.warn("Recursive logging from for appender [{}].", event.getLoggerName(), getName()); } else if (layout instanceof StringLayout) { String serializedEvent = ((StringLayout)layout).toSerializable(event); while (!logQueue.offer(serializedEvent)) { tryFlushQueue(); } if (shouldFlushLogQueue(event.isEndOfBatch())) { tryFlushQueue(); } } else { throw new AppenderLoggingException("The Redis appender only supports StringLayouts."); } }
Source:
public Construct exec(Target t, Environment environment, Construct... args) throws CancelCommandException, ConfigRuntimeException { if(!(args[0].nval() instanceof String)) { throw new CRECastException(this.getName() + " expects a string as first argument, but type " + args[0].typeof() + " was found.", t); } String text = args[0].nval(); if(text.length() != 1) { throw new CREFormatException("Got \"" + text + "\" instead of expected character.", t); } char check = text.charAt(0); if(!Character.isLetter(check)) { throw new CRECastException("Got \"" + text + "\" instead of alphabetical character.", t); } return CBoolean.get(Character.isUpperCase(check)); }

Target:
public Construct exec(Target t, Environment environment, Construct... args) throws CancelCommandException, ConfigRuntimeException { if(!(args[0].nval() instanceof String)) { throw new CRECastException(this.getName() + " expects a string as first argument, but type " + args[0].typeof() + " was found.", t); } String text = args[0].nval(); if(text.length() != 1) { throw new CREFormatException("Got \"" + text + "\" instead of expected character.", t); } char check = text.charAt(0); if(!Character.isLetter(check)) { throw new CREFormatException("Got \"" + text + "\" instead of alphabetical character.", t); } return CBoolean.get(Character.isUpperCase(check)); }
Source:
@Test public void startActivityInNewAppTestCaseWithoutClosingApp() { driver.startActivity("io.appium.android.apis", ".accessibility.AccessibilityNodeProviderActivity"); Assert.assertEquals(driver.currentActivity(), ".accessibility.AccessibilityNodeProviderActivity"); driver.startActivity("com.android.contacts", ".ContactsListActivity", "com.android.contacts", ".ContactsListActivity", false); Assert.assertEquals(driver.currentActivity(), ".ContactsListActivity"); driver.pressKeyCode(AndroidKeyCode.BACK); Assert.assertEquals(driver.currentActivity(), ".accessibility.AccessibilityNodeProviderActivity"); }

Target:
@Test public void startActivityInNewAppTestCaseWithoutClosingApp() { driver.startActivity("io.appium.android.apis", ".accessibility.AccessibilityNodeProviderActivity"); assertEquals(driver.currentActivity(), ".accessibility.AccessibilityNodeProviderActivity"); driver.startActivity("com.android.contacts", ".ContactsListActivity", "com.android.contacts", ".ContactsListActivity", false); assertEquals(driver.currentActivity(), ".ContactsListActivity"); driver.pressKeyCode(AndroidKeyCode.BACK); assertEquals(driver.currentActivity(), ".accessibility.AccessibilityNodeProviderActivity"); }
Source:
void should_fail_if_period_is_zero() { Period period = Period.ofMonths(0); ThrowableAssert.ThrowingCallable code = () -> assertThat(period).isPositive(); assertThatAssertionErrorIsThrownBy(code).withMessage(shouldBePositive(period).create()); }

Target:
void should_fail_if_period_is_zero() { Period period = Period.ZERO; final AssertionError code = expectAssertionError(() -> assertThat(period).isPositive()); then(code).hasMessage(shouldBePositive(period).create()); }
Source:
public int read(byte[] buffer, int offset, int readLength) throws AssetDataSourceException { if (bytesRemaining == 0) { return -1; } else { int bytesRead = 0; try { bytesRead = assetInputStream.read(buffer, offset, (int) Math.min(bytesRemaining, readLength)); } catch (IOException e) { throw new AssetDataSourceException(e); } if (bytesRead > 0) { bytesRemaining -= bytesRead; if (listener != null) { listener.onBytesTransferred(bytesRead); } } Log.i("AssetDataSource", "read(). bytesRead = " + bytesRead); return bytesRead; } }

Target:
public int read(byte[] buffer, int offset, int readLength) throws AssetDataSourceException { if (bytesRemaining == 0) { return -1; } else { int bytesRead = 0; try { bytesRead = assetInputStream.read(buffer, offset, (int) Math.min(bytesRemaining, readLength)); } catch (IOException e) { throw new AssetDataSourceException(e); } if (bytesRead > 0) { bytesRemaining -= bytesRead; if (listener != null) { listener.onBytesTransferred(bytesRead); } } return bytesRead; } }
Source:
public void instantiate(@Observes StackStarting event) { ControllerMethod controllerMethod = event.getControllerMethod(); if (containsParameters(controllerMethod)) { fixIndexedParameters(request); addHeaderParametersToAttribute(controllerMethod); Object[] values = getParametersFor(controllerMethod); validator.addAll(errors); logger.debug("Conversion errors: {}", errors); logger.debug("Parameter values for are {}", controllerMethod, values); Parameter[] parameters = parameterNameProvider.parametersFor(controllerMethod.getMethod()); ValuedParameter[] valuedParameters = new ValuedParameter[values.length]; for (int i = 0; i < valuedParameters.length; i++) { valuedParameters[i] = new ValuedParameter(parameters[i], values[i]); } methodInfo.setValuedParameters(valuedParameters); } }

Target:
public void instantiate(@Observes StackStarting event) { ControllerMethod controllerMethod = event.getControllerMethod(); if (containsParameters(controllerMethod)) { fixIndexedParameters(request); addHeaderParametersToAttribute(controllerMethod); Object[] values = getParametersFor(controllerMethod); validator.addAll(errors); logger.debug("Conversion errors: {}", errors); logger.debug("Parameter values for are {}", controllerMethod, values); ValuedParameter[] valuedParameters = methodInfo.getValuedParameters(); for (int i = 0; i < valuedParameters.length; i++) { valuedParameters[i].setValue(values[i]); } } }
Source:
public void onPostsSearched(OnPostsSearched event) { hideLoadMoreProgress(); if (event.isError()) { ToastUtils.showToast(getActivity(), "Error searching posts: " + event.error.type); return; } List<PostModel> results = event.searchResults == null ? null : event.searchResults.getPosts(); updateAdapter(results); }

Target:
public void onPostsSearched(OnPostsSearched event) { mIsSearching = false; hideLoadMoreProgress(); if (event.isError()) { AppLog.w(AppLog.T.POSTS, "Error searching posts: " + event.error.message); ToastUtils.showToast(getActivity(), "Error searching posts: " + event.error.type); return; } if (event.searchResults != null && !ListUtils.isEmpty(event.searchResults.getPosts())) { mSearchResults.addAll(event.searchResults.getPosts()); } mCanSearchMore = event.canLoadMore; showSearchResults(); }
Source:
private AuthenticationResult acquireTokenWithCachedItem(final TokenCacheItem cachedItem) throws AuthenticationException { final AuthenticationResult result = acquireTokenWithRefreshToken(cachedItem.getRefreshToken()); mTokenCacheAccessor.updateCachedItemToResult(mAuthRequest.getResource(), mAuthRequest.getClientId(), result, cachedItem); return result; }

Target:
private AuthenticationResult acquireTokenWithCachedItem(final TokenCacheItem cachedItem) throws AuthenticationException { final AuthenticationResult result = acquireTokenWithRefreshToken(cachedItem.getRefreshToken()); if (result != null) { mTokenCacheAccessor.updateCachedItemWithResult(mAuthRequest.getResource(), mAuthRequest.getClientId(), result, cachedItem); } return result; }
Source:
private JSONObject makeRequest(DOI doi) throws ShortDOIServiceException { URIBuilder uriBuilder = null; URL url = null; try { uriBuilder = new URIBuilder(BASIC_URL); uriBuilder.setPath(uriBuilder.getPath() + doi.getDOI()); uriBuilder.addParameter("format", "json"); URI uri = uriBuilder.build(); url = uri.toURL(); } catch (URISyntaxException | MalformedURLException e) { throw new ShortDOIServiceException("Cannot get short DOI", e); } URLDownload urlDownload = new URLDownload(url); JSONObject jsonObject = null; try { jsonObject = JsonReader.toJsonObject(urlDownload.asInputStream()); } catch (ParseException | IOException | JSONException e) { throw new ShortDOIServiceException("Cannot get short DOI", e); } return jsonObject; }

Target:
private JSONObject makeRequest(DOI doi) throws ShortDOIServiceException { URIBuilder uriBuilder = null; URL url = null; try { uriBuilder = new URIBuilder(BASIC_URL); uriBuilder.setPath(uriBuilder.getPath() + doi.getDOI()); uriBuilder.addParameter("format", "json"); URI uri = uriBuilder.build(); url = uri.toURL(); } catch (URISyntaxException | MalformedURLException e) { throw new ShortDOIServiceException("Cannot get short DOI", e); } URLDownload urlDownload = new URLDownload(url); try { return JsonReader.toJsonObject(urlDownload.asInputStream()); } catch (ParseException | IOException | JSONException e) { throw new ShortDOIServiceException("Cannot get short DOI", e); } }
Source:
public Map<String, Collection<Message>> getGrouped() { if (grouped == null) { grouped = Multimaps.index(delegate, new GroupByCategory()).asMap(); } return grouped; }

Target:
public Map<String, Collection<Message>> getGrouped() { if (grouped == null) { grouped = index(delegate, byCategory).asMap(); } return grouped; }
Source:
public void testAddTransfer_Receiver(){ addTicketTransfer(ticketReciever.getUsername(), "password").then().statusCode(HttpStatus.SC_FORBIDDEN); ticket = ticketRepository.findByKey(ticket.getKey()).orElse(null); if(ticket == null) Assert.fail("Could not refresh ticket"); Assert.assertTrue(ticket.isLockedForTransfer()); }

Target:
public void testAddTransfer_Receiver(){ addTicketTransfer(ticketReceiver.getUsername(), "password") .then() .statusCode(HttpStatus.SC_FORBIDDEN); Assert.assertTrue(tttRepository.count() == 0); }
Source:
public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Bundle arguments = getArgumentsBundle(); Query.one( AssignmentsDAO.class, "SELECT * " + "FROM " + AssignmentsDAO.TABLE_NAME + " " + "WHERE soldierId = ? AND platformId = ? AND version = ?", arguments.getString(Keys.Soldier.ID, ""), arguments.getInt(Keys.Soldier.PLATFORM, 0), Assignments.VERSION ).getAsync( getLoaderManager(), new OneQuery.ResultHandler<AssignmentsDAO>() { @Override public boolean handleResult(AssignmentsDAO assignmentsDAO) { final View view = getView(); if (view == null || assignmentsDAO == null) { return true; } final SortedAssignmentContainer container = assignmentsDAO.getSortedAssignmentContainer(); Log.d("YOLO", "number of items: " + container); sendDataToGridView(view, container.getItems()); showLoadingState(false); return true; } } ); }

Target:
public void onViewCreated(final View view, final Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); final Bundle arguments = getArgumentsBundle(); Query.one( AssignmentsDAO.class, "SELECT * " + "FROM " + AssignmentsDAO.TABLE_NAME + " " + "WHERE soldierId = ? AND platformId = ? AND version = ?", arguments.getString(Keys.Soldier.ID, ""), arguments.getInt(Keys.Soldier.PLATFORM, 0), BuildConfig.VERSION_CODE ).getAsync( getLoaderManager(), new OneQuery.ResultHandler<AssignmentsDAO>() { @Override public boolean handleResult(AssignmentsDAO assignmentsDAO) { final View view = getView(); if (view == null || assignmentsDAO == null) { return true; } final SortedAssignmentContainer container = assignmentsDAO.getSortedAssignmentContainer(); sendDataToGridView(view, container.getItems()); showLoadingState(false); return true; } } ); }
Source:
protected void onSaveInstanceState(Bundle outState) { if(mNoteEditorFragmentPagerAdapter.getItem(0).isAdded()) { getSupportFragmentManager() .putFragment(outState, getString(R.string.tab_edit), mNoteEditorFragmentPagerAdapter.getItem(0)); } if(mNoteEditorFragmentPagerAdapter.getItem(1).isAdded()) { getSupportFragmentManager() .putFragment(outState, getString(R.string.tab_preview), mNoteEditorFragmentPagerAdapter.getItem(1)); } outState.putBoolean(NoteEditorFragment.ARG_MARKDOWN_ENABLED, isMarkdownEnabled); super.onSaveInstanceState(outState); }

Target:
protected void onSaveInstanceState(Bundle outState) { if (mNoteEditorFragmentPagerAdapter.getCount() > 0 && mNoteEditorFragmentPagerAdapter.getItem(0).isAdded()) { getSupportFragmentManager() .putFragment(outState, getString(R.string.tab_edit), mNoteEditorFragmentPagerAdapter.getItem(0)); } if (mNoteEditorFragmentPagerAdapter.getCount() > 1 && mNoteEditorFragmentPagerAdapter.getItem(1).isAdded()) { getSupportFragmentManager() .putFragment(outState, getString(R.string.tab_preview), mNoteEditorFragmentPagerAdapter.getItem(1)); } outState.putBoolean(NoteEditorFragment.ARG_MARKDOWN_ENABLED, isMarkdownEnabled); super.onSaveInstanceState(outState); }
Source:
protected void clickXY(int x, int y) { log.debug(MessageFormat.format("Clicking on {0}", this)); notifyTree(SWT.MouseEnter); notifyTree(SWT.MouseMove); notifyTree(SWT.Activate); notifyTree(SWT.FocusIn); notifyTree(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.NONE, 1)); notifyTree(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1)); syncExec(new VoidResult() { public void run() { if (tree.getSelectionCount() != 1 || tree.getSelection()[0].equals(widget)) { tree.setSelection(widget); } } }); notifyTree(SWT.Selection, createSelectionEvent(SWT.BUTTON1)); notifyTree(SWT.MouseHover); notifyTree(SWT.MouseMove); notifyTree(SWT.MouseExit); notifyTree(SWT.Deactivate); notifyTree(SWT.FocusOut); log.debug(MessageFormat.format("Clicked on {0}", this)); }

Target:
protected void clickXY(int x, int y) { log.debug(MessageFormat.format("Clicking on {0}", this)); notifyTree(SWT.MouseEnter); notifyTree(SWT.MouseMove); notifyTree(SWT.Activate); notifyTree(SWT.FocusIn); notifyTree(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.NONE, 1)); notifyTree(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1)); syncExec(new VoidResult() { public void run() { if (tree.getSelectionCount() != 1 || !tree.getSelection()[0].equals(widget)) { tree.setSelection(widget); } } }); notifyTree(SWT.Selection, createSelectionEvent(SWT.BUTTON1)); notifyTree(SWT.MouseHover); notifyTree(SWT.MouseMove); notifyTree(SWT.MouseExit); notifyTree(SWT.Deactivate); notifyTree(SWT.FocusOut); log.debug(MessageFormat.format("Clicked on {0}", this)); }
Source:
private final Xid createXid (boolean branch, XAModifier theModifier) { Xid jtaXid = baseXid(); if (jtaXid != null && jtaXid.getFormatId() != com.arjuna.ats.jts.extensions.Arjuna.XID()) return jtaXid; try { if (jtaXid != null) { Integer eisName = null; if(jtaXid instanceof XidImple) eisName = XATxConverter.getEISName(((XidImple) jtaXid).getXID()); jtaXid = new XidImple(jtaXid, branch, eisName); } else { jtaXid = _theTransaction.get_xid(branch); } if (theModifier != null) { try { jtaXid = theModifier.createXid(jtaXid); } catch (Exception e) { e.printStackTrace(); } } return jtaXid; } catch (Exception e) { e.printStackTrace(); } return null; }

Target:
private final Xid createXid (boolean branch, XAModifier theModifier) { Xid jtaXid = baseXid(); if (jtaXid != null && jtaXid.getFormatId() != com.arjuna.ats.jts.extensions.Arjuna.XID()) return jtaXid; try { if (jtaXid != null) { jtaXid = new XidImple(jtaXid, branch, XAUtils.getEisName(jtaXid)); } else { jtaXid = _theTransaction.get_xid(branch); } if (theModifier != null) { try { jtaXid = theModifier.createXid(jtaXid); } catch (Exception e) { e.printStackTrace(); } } return jtaXid; } catch (Exception e) { e.printStackTrace(); } return null; }