auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public PrebuiltAppleFramework( BuildRuleParams params, BuildRuleResolver ruleResolver, SourcePathResolver pathResolver, SourcePath frameworkPath, ImmutableSet<FrameworkPath> frameworks, Optional<Pattern> supportedPlatformsRegex, Function<? super CxxPlatform, ImmutableList<String>> exportedLinkerFlags) { super(params, pathResolver); this.params = params; this.frameworkPath = frameworkPath; this.ruleResolver = ruleResolver; this.exportedLinkerFlags = exportedLinkerFlags; this.frameworks = frameworks; this.supportedPlatformsRegex = supportedPlatformsRegex; BuildTarget target = params.getBuildTarget(); this.frameworkName = pathResolver.getAbsolutePath(frameworkPath).getFileName().toString(); this.out = getProjectFilesystem().getBuckPaths().getGenDir() .resolve(target.getBasePath()).resolve(target.getShortNameAndFlavorPostfix()).resolve(frameworkName); }

Target:
public PrebuiltAppleFramework( BuildRuleParams params, BuildRuleResolver ruleResolver, SourcePathResolver pathResolver, SourcePath frameworkPath, ImmutableSet<FrameworkPath> frameworks, Optional<Pattern> supportedPlatformsRegex, Function<? super CxxPlatform, ImmutableList<String>> exportedLinkerFlags) { super(params, pathResolver); this.params = params; this.frameworkPath = frameworkPath; this.ruleResolver = ruleResolver; this.exportedLinkerFlags = exportedLinkerFlags; this.frameworks = frameworks; this.supportedPlatformsRegex = supportedPlatformsRegex; BuildTarget target = params.getBuildTarget(); this.frameworkName = pathResolver.getAbsolutePath(frameworkPath).getFileName().toString(); this.out = BuildTargets.getGenPath(getProjectFilesystem(), target, "%s").resolve(frameworkName); }
Source:
protected void throwExeptionIfRestError(InputStream is, InputStreamReader in) throws IOException, BugzillaRestException { is.mark(25); byte[] b = new byte[20]; is.read(b); String str = new String(b); if (str.startsWith("{\"code\":") || str.startsWith("{\"message\":") || str.startsWith("{\"error\":")) { is.reset(); ErrorResponse resp = parseErrorResponseFromJson(in); throw new BugzillaRestResourceNotFoundException( NLS.bind("Error {1}: {0}", new Object[] { resp.getMessage(), resp.getCode() })); } is.reset(); }

Target:
protected void throwExeptionIfRestError(InputStream is, InputStreamReader in) throws IOException, BugzillaRestException { try { is.mark(18); byte[] b = new byte[17]; is.read(b); String str = new String(b); if (str.startsWith("{\"code\":") || str.startsWith("{\"message\":") || str.startsWith("{\"error\":") || str.startsWith("{\"documentation\":")) { is.reset(); ErrorResponse resp = parseErrorResponseFromJson(in); throw new BugzillaRestResourceNotFoundException( NLS.bind("Error {1}: {0}", new Object[] { resp.getMessage(), resp.getCode() })); } } finally { is.reset(); } }
Source:
protected void verifySchemaVersion(Object record, Long recordId, boolean forTrash) { String schemaField; if (forTrash) { schemaField = "schemaVersion"; } else { schemaField = HistoryTrashClassHelper.historySchemaVersion(record.getClass()); } Long recordSchemaVersion = (Long) PropertyUtil.safeGetProperty(record, schemaField); if (!schemaVersion.equals(recordSchemaVersion)) { throw new SchemaVersionException(schemaVersion, recordSchemaVersion, recordId, record.getClass().getName()); } }

Target:
protected void verifySchemaVersion(Object record, Long recordId, boolean forTrash) { String schemaField; if (forTrash) { schemaField = Constants.Util.SCHEMA_VERSION_FIELD_NAME; } else { schemaField = HistoryTrashClassHelper.historySchemaVersion(record.getClass()); } Long recordSchemaVersion = (Long) PropertyUtil.safeGetProperty(record, schemaField); if (!schemaVersion.equals(recordSchemaVersion)) { throw new SchemaVersionException(schemaVersion, recordSchemaVersion, recordId, record.getClass().getName()); } }
Source:
public boolean isAuthenticated(Request request) { String authheader = request.getHeader(Constants.AUTHORIZATION_HEADER); if (authheader != null && authheader.startsWith(Constants.BASIC_AUTH_HEADER)) { String base64Credentials = authheader.substring(Constants.BASIC_AUTH_HEADER.length()).trim(); String credentials = new String(Base64.decode(base64Credentials), Charset.forName("UTF-8")); final String[] values = credentials.split(":", 2); String username = values[0]; String password = values[1]; if ("".equals(username) || username == null || "".equals(password) || password == null) { return false; } String tenantDomain = MultitenantUtils.getTenantDomain(username); String tenantLessUserName = MultitenantUtils.getTenantAwareUsername(username); try { RealmService realmService = (RealmService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(RealmService.class); if (realmService != null) { int tenantId = realmService.getTenantManager().getTenantId(tenantDomain); if (tenantId == MultitenantConstants.INVALID_TENANT_ID) { log.error("Invalid tenant domain " + tenantDomain); return false; } UserRealm userRealm = realmService.getTenantUserRealm(tenantId); return userRealm.getUserStoreManager().authenticate(tenantLessUserName, password); } } catch (UserStoreException e) { log.error("Can't access the user realm of the user : " + username,e); } } return false; }

Target:
public boolean isAuthenticated(Request request) { String authheader = request.getHeader(Constants.AUTHORIZATION_HEADER); if (authheader != null && authheader.startsWith(Constants.BASIC_AUTH_HEADER)) { String base64Credentials = authheader.substring(Constants.BASIC_AUTH_HEADER.length()).trim(); String credentials = new String(Base64.decode(base64Credentials), Charset.forName("UTF-8")); final String[] values = credentials.split(":", 2); String username = values[0]; String password = values[1]; if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) { return false; } String tenantDomain = MultitenantUtils.getTenantDomain(username); String tenantLessUserName = MultitenantUtils.getTenantAwareUsername(username); try { RealmService realmService = (RealmService) PrivilegedCarbonContext .getThreadLocalCarbonContext().getOSGiService(RealmService.class); if (realmService != null) { int tenantId = realmService.getTenantManager().getTenantId(tenantDomain); if (tenantId == MultitenantConstants.INVALID_TENANT_ID) { log.error("Invalid tenant domain " + tenantDomain); return false; } UserRealm userRealm = realmService.getTenantUserRealm(tenantId); return userRealm.getUserStoreManager().authenticate(tenantLessUserName, password); } } catch (UserStoreException e) { log.error("Can't access the user realm of the user : " + username,e); } } return false; }
Source:
public void excludesIncorrectClassFormCheck() throws Exception { final byte[] bytecode = new BytecodeMocker() .withSource("class Foo { public Foo clone() { return this; } }") .mock(); final Environment env = new Environment.Mock() .withFile("target/classes/Foo.class", bytecode) .withExcludes("findbugs", "Foo") .withDefaultClasspath(); new FindBugsValidator().validate(env); }

Target:
public void excludesIncorrectClassFormCheck() throws Exception { final byte[] bytecode = new BytecodeMocker() .withSource("class Foo { public Foo clone() { return this; } }") .mock(); final Environment env = new Environment.Mock() .withFile("target/classes/Foo.class", bytecode) .withExcludes(FindBugsValidator.EXCLUDE, "Foo") .withDefaultClasspath(); new FindBugsValidator().validate(env); }
Source:
public int isStart(){ long investAmount = (long)getActivityChristmasInvestAmountAndCount().get("investAmount"); if(investAmount >= 420000000 && !redisWrapperClient.exists(redisKey) && activityChristmasEndTime.after(new Date())) redisWrapperClient.setex(redisKey, timeout, sdf.format(new Date())); return ((investAmount >= 420000000 && redisWrapperClient.exists(redisKey)) || (investAmount >= 420000000 && activityChristmasEndTime.before(new Date()))) ? 1 : 0; }

Target:
public int isStart(){ long investAmount = (long)getActivityChristmasInvestAmountAndCount().get("investAmount"); if(investAmount >= CHRISTMAS_ACTIVITY_2_START_MIN_AMOUNT && !redisWrapperClient.exists(redisKey) && activityChristmasEndTime.after(new Date())) redisWrapperClient.setex(redisKey, timeout, sdf.format(new Date())); return ((investAmount >= CHRISTMAS_ACTIVITY_2_START_MIN_AMOUNT && redisWrapperClient.exists(redisKey)) || (investAmount >= CHRISTMAS_ACTIVITY_2_START_MIN_AMOUNT && activityChristmasEndTime.before(new Date()))) ? 1 : 0; }
Source:
public void setCheckedElements(Object[] elements) { Object[] oldCheckedElements = getCheckedElements(); super.setCheckedElements(elements); ArrayList<Object> changedElements = new ArrayList<>(Arrays.asList(elements)); changedElements.removeAll(Arrays.asList(oldCheckedElements)); Control tree = getControl(); try { tree.setRedraw(false); doCheckStateChanged(changedElements.toArray()); } finally { tree.setRedraw(true); } }

Target:
public void setCheckedElements(Object[] elements) { Object[] oldCheckedElements = getCheckedElements(); super.setCheckedElements(elements); Control tree = getControl(); try { tree.setRedraw(false); if (oldCheckedElements.length > 0) { HashSet<Object> changedElements = new HashSet<>(Arrays.asList(elements)); changedElements.removeAll(Arrays.asList(oldCheckedElements)); doCheckStateChanged(changedElements.toArray()); } else { doCheckStateChanged(elements); } } finally { tree.setRedraw(true); } }
Source:
private InvocationStage checkPendingAndLockAllKeys(TxInvocationContext<?> ctx, VisitableCommand command, Collection<Object> keys, long lockTimeout) { PendingLockPromise pendingLockPromise = pendingLockManager.checkPendingTransactionsForKeys(ctx, keys, lockTimeout, TimeUnit.MILLISECONDS); if (pendingLockPromise.isReady()) { return lockAllAndRecord(ctx, command, keys, lockTimeout); } return makeStage(pendingLockPromise.toInvocationStage().thenApply(ctx, command, ((rCtx, rCommand, rv) -> { long remaining = pendingLockPromise.getRemainingTimeout(); return lockAllAndRecord(ctx, command, keys, remaining); }))); }

Target:
private InvocationStage checkPendingAndLockAllKeys(TxInvocationContext<?> ctx, VisitableCommand command, Collection<Object> keys, long lockTimeout) { PendingLockPromise pendingLockPromise = pendingLockManager.checkPendingTransactionsForKeys(ctx, keys, lockTimeout, TimeUnit.MILLISECONDS); if (pendingLockPromise.isReady()) { return lockAllAndRecord(ctx, command, keys, lockTimeout); } return pendingLockPromise.toInvocationStage().thenApplyMakeStage(ctx, command, ((rCtx, rCommand, rv) -> { long remaining = pendingLockPromise.getRemainingTimeout(); return lockAllAndRecord(ctx, command, keys, remaining); })); }
Source:
public Set<Name> suggest(EntityRef sender, Object... resolvedParameters) { Collection<ConsoleCommand> commands = console.getCommands(); Set<Name> suggestions = Sets.newHashSetWithExpectedSize(commands.size()); suggestions.addAll(commands.stream().map(ConsoleCommand::getName).collect(Collectors.toList())); return suggestions; }

Target:
public Set<Name> suggest(EntityRef sender, Object... resolvedParameters) { Collection<ConsoleCommand> commands = console.getCommands(); Set<Name> suggestions = Sets.newHashSetWithExpectedSize(commands.size()); for (ConsoleCommand command : commands) { suggestions.add(command.getName()); } return suggestions; }
Source:
public Optional<LogEntry> getEntry() { if (entry == null) { return Optional.empty(); } return Optional.of(entry); }

Target:
public Optional<LogEntry> getEntry() { return Optional.ofNullable(entry); }
Source:
int getMacCodeLength() { return 8; }

Target:
int getMacCodeLength() { return 0; }
Source:
public RepositoryBuild triggerWithOptions(@PathParam("id") int branchId, BuildOptions buildOptions, @QueryParam("username") Optional<String> username) { Optional<GitInfo> gitInfo = branchService.get(branchId); if (!gitInfo.isPresent()) { throw new NotFoundException("No branch found with id: " + branchId); } BuildTrigger buildTrigger; if (username.isPresent()) { buildTrigger = BuildTrigger.forUser(username.get()); } else { buildTrigger = BuildTrigger.forUser("unknown"); } long repositoryBuildId = repositoryBuildService.enqueue(gitInfo.get(), buildTrigger, buildOptions); return repositoryBuildService.get(repositoryBuildId).get(); }

Target:
public RepositoryBuild triggerWithOptions(@PathParam("id") int branchId, BuildOptions buildOptions, @QueryParam("username") Optional<String> username) { Optional<GitInfo> gitInfo = branchService.get(branchId); if (!gitInfo.isPresent()) { throw new NotFoundException("No branch found with id: " + branchId); } BuildTrigger buildTrigger = BuildTrigger.forUser(username.or("unknown")); long repositoryBuildId = repositoryBuildService.enqueue(gitInfo.get(), buildTrigger, buildOptions); return repositoryBuildService.get(repositoryBuildId).get(); }
Source:
public long store(RepositoryPath repositoryPath, InputStream is) throws IOException { boolean updatedMetadataFile = false; boolean updatedArtifactFile = false; boolean updatedArtifactChecksumFile = false; if (Files.exists(repositoryPath)) { if (RepositoryFiles.isMetadata(repositoryPath)) { updatedMetadataFile = true; } else if (RepositoryFiles.isChecksum(repositoryPath)) { updatedArtifactChecksumFile = true; } else { updatedArtifactFile = true; } } long result; URI pathUri = repositoryPath.toUri(); acquireLock(pathUri); try (final RepositoryOutputStream aos = artifactResolutionService.getOutputStream(repositoryPath)) { result = storeArtifact(repositoryPath, is, aos); } catch (IOException e) { throw e; } catch (Exception e) { throw new ArtifactStorageException(e); } finally { releaseLock(pathUri); } artifactEventListenerRegistry.dispatchArtifactStoredEvent(repositoryPath); if (updatedMetadataFile) { artifactEventListenerRegistry.dispatchArtifactMetadataFileUpdatedEvent(repositoryPath); artifactEventListenerRegistry.dispatchArtifactMetadataFileUploadedEvent(repositoryPath); } if (updatedArtifactChecksumFile) { artifactEventListenerRegistry.dispatchArtifactChecksumFileUpdatedEvent(repositoryPath); } if (RepositoryFiles.isChecksum(repositoryPath)) { artifactEventListenerRegistry.dispatchArtifactChecksumUploadedEvent(repositoryPath); } if (updatedArtifactFile) { artifactEventListenerRegistry.dispatchArtifactUploadedEvent(repositoryPath); } return result; }

Target:
public long store(RepositoryPath repositoryPath, InputStream is) throws IOException { boolean updatedMetadataFile = false; boolean updatedArtifactFile = false; boolean updatedArtifactChecksumFile = false; if (Files.exists(repositoryPath)) { if (RepositoryFiles.isMetadata(repositoryPath)) { updatedMetadataFile = true; } else if (RepositoryFiles.isChecksum(repositoryPath)) { updatedArtifactChecksumFile = true; } else { updatedArtifactFile = true; } } long result; repositoryPathLock.lock(repositoryPath); try (final RepositoryOutputStream aos = artifactResolutionService.getOutputStream(repositoryPath)) { result = storeArtifact(repositoryPath, is, aos); } catch (IOException e) { throw e; } catch (Exception e) { throw new ArtifactStorageException(e); } finally { repositoryPathLock.unlock(repositoryPath); } artifactEventListenerRegistry.dispatchArtifactStoredEvent(repositoryPath); if (updatedMetadataFile) { artifactEventListenerRegistry.dispatchArtifactMetadataFileUpdatedEvent(repositoryPath); artifactEventListenerRegistry.dispatchArtifactMetadataFileUploadedEvent(repositoryPath); } if (updatedArtifactChecksumFile) { artifactEventListenerRegistry.dispatchArtifactChecksumFileUpdatedEvent(repositoryPath); } if (RepositoryFiles.isChecksum(repositoryPath)) { artifactEventListenerRegistry.dispatchArtifactChecksumUploadedEvent(repositoryPath); } if (updatedArtifactFile) { artifactEventListenerRegistry.dispatchArtifactUploadedEvent(repositoryPath); } return result; }
Source:
public void setConfigValue(ConfigValues enumValue, DomainsConfigurationEntry entry, boolean passedAsValue) throws ManageDomainsResult { log.info("Setting value for " + enumValue.toString() + " to " + entry.getDomainsLoggingEntry()); String fileName = null; try { fileName = createPassFile(entry.getDomainsConfigurationEntry()); Process engineConfigProcess = Runtime.getRuntime().exec(engineConfigExecutable + " -s " + enumValue.name() + ((passedAsValue) ? "=" + entry.getDomainsConfigurationEntry() : " --admin-pass-file " + fileName) + " -p " + engineConfigProperties); int retVal = engineConfigProcess.waitFor(); if (retVal != 0) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION, enumValue.name()); } } catch (IOException e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, new String[] { enumValue.name(), e.getMessage() }); } catch (InterruptedException e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, new String[] { enumValue.name(), e.getMessage() }); } finally { disposePassFile(fileName); } }

Target:
public void setConfigValue(ConfigValues enumValue, DomainsConfigurationEntry entry, boolean passedAsValue) throws ManageDomainsResult { log.info("Setting value for " + enumValue.toString() + " to " + entry.getDomainsLoggingEntry()); String filePath = null; try { filePath = createPassFile(entry.getDomainsConfigurationEntry()); Process engineConfigProcess = Runtime.getRuntime().exec(engineConfigExecutable + " -s " + enumValue.name() + ((passedAsValue) ? "=" + entry.getDomainsConfigurationEntry() : " --admin-pass-file " + filePath) + " -p " + engineConfigProperties); int retVal = engineConfigProcess.waitFor(); if (retVal != 0) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION, enumValue.name()); } } catch (IOException e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, new String[] { enumValue.name(), e.getMessage() }); } catch (InterruptedException e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, new String[] { enumValue.name(), e.getMessage() }); } finally { disposePassFile(filePath); } }
Source:
public void onAuthenticationFailure( HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { super.onAuthenticationFailure(request, response, exception); HttpSession session = request.getSession(false); if (session != null || isAllowSessionCreation()) { String usernameParameter = loginDecisionFilter.getUsernameParameter(); String lastUserName = request.getParameter(usernameParameter); request.getSession().setAttribute(LAST_USERNAME_KEY, lastUserName); String provider = request.getParameter("provider"); provider = Strings.isNullOrEmpty(provider) ? "internal" : provider; request.getSession().setAttribute(LAST_PROVIDER_KEY, provider); request.getSession().setAttribute(IS_LOCKED, false); if(exception instanceof LdapAuthenticationProcessException) { request.getSession().setAttribute(ERROR_KEY, "login.ldap.internal.user.exists"); } if(exception instanceof LockedException) { ((LockedException)exception).getExtraInformation(); request.getSession().setAttribute(IS_LOCKED, true); } } }

Target:
public void onAuthenticationFailure( HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { super.onAuthenticationFailure(request, response, exception); HttpSession session = request.getSession(false); if (session != null || isAllowSessionCreation()) { String usernameParameter = loginDecisionFilter.getUsernameParameter(); String lastUserName = request.getParameter(usernameParameter); request.getSession().setAttribute(LAST_USERNAME_KEY, lastUserName); String provider = request.getParameter("provider"); provider = Strings.isNullOrEmpty(provider) ? "internal" : provider; request.getSession().setAttribute(LAST_PROVIDER_KEY, provider); request.getSession().setAttribute(IS_LOCKED, false); if(exception instanceof LdapAuthenticationProcessException) { request.getSession().setAttribute(ERROR_KEY, "login.ldap.internal.user.exists"); } if(exception instanceof LockedException) { request.getSession().setAttribute(IS_LOCKED, true); } } }
Source:
public void callServerForLogin() { if (NetworkUtil.isConnected(this)) { emailStr = email_et.getText().toString().trim(); String passwordStr = password_et.getText().toString().trim(); if (email_et != null && emailStr.length() == 0) { showErrorMessage(getString(R.string.login_error), getString(R.string.error_enter_email)); email_et.requestFocus(); } else if (password_et != null && passwordStr.length() == 0) { showErrorMessage(getString(R.string.login_error), getString(R.string.error_enter_password)); password_et.requestFocus(); } else { email_et.setEnabled(false); password_et.setEnabled(false); forgotPassword_tv.setEnabled(false); eulaTv.setEnabled(false); clearDialogs(); LoginTask logintask = new LoginTask(this, email_et.getText().toString().trim(), password_et.getText().toString()) { @Override public void onSuccess(AuthResponse result) { try { if (result != null && result.hasValidProfile()) { onUserLoginSuccess(result.profile); } else { LoginErrorMessage errorMsg = new LoginErrorMessage( getString(R.string.login_error), getString(R.string.login_failed)); throw new LoginException(errorMsg); } } catch (LoginException ex) { super.onException(ex); onUserLoginFailure(ex, null, null); } } @Override public void onException(Exception ex) { super.onException(ex); } }; tryToSetUIInteraction(false); logintask.setProgressDialog(progressbar); logintask.execute(); } } else { showErrorMessage(getString(R.string.no_connectivity), getString(R.string.network_not_connected)); } }

Target:
public void callServerForLogin() { if (NetworkUtil.isConnected(this)) { emailStr = email_et.getText().toString().trim(); String passwordStr = password_et.getText().toString().trim(); if (email_et != null && emailStr.length() == 0) { showErrorMessage(getString(R.string.login_error), getString(R.string.error_enter_email)); email_et.requestFocus(); } else if (password_et != null && passwordStr.length() == 0) { showErrorMessage(getString(R.string.login_error), getString(R.string.error_enter_password)); password_et.requestFocus(); } else { email_et.setEnabled(false); password_et.setEnabled(false); forgotPassword_tv.setEnabled(false); eulaTv.setEnabled(false); clearDialogs(); LoginTask logintask = new LoginTask(this, email_et.getText().toString().trim(), password_et.getText().toString()) { @Override public void onSuccess(AuthResponse result) { try { if (result != null && result.hasValidProfile()) { onUserLoginSuccess(result.profile); } else { LoginErrorMessage errorMsg = new LoginErrorMessage( getString(R.string.login_error), getString(R.string.login_failed)); throw new LoginException(errorMsg); } } catch (LoginException ex) { super.onException(ex); onUserLoginFailure(ex, null, null); } } @Override public void onException(Exception ex) { super.onException(ex); tryToSetUIInteraction(true); } }; tryToSetUIInteraction(false); logintask.setProgressDialog(progressbar); logintask.execute(); } } else { showErrorMessage(getString(R.string.no_connectivity), getString(R.string.network_not_connected)); } }
Source:
private static void setResponseVisibleSettings(PageData data, FeedbackSessionAttributes feedbackSession, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings) { boolean hasResultVisibleDate = !TimeHelper.isSpecialTime(feedbackSession.resultsVisibleFromTime); additionalSettings.setResponseVisibleDateChecked(hasResultVisibleDate); additionalSettings.setResponseVisibleDateValue(hasResultVisibleDate ? TimeHelper.formatDate(feedbackSession.resultsVisibleFromTime) : ""); additionalSettings.setResponseVisibleTimeOptions( data.getTimeOptionsAsElementTags( hasResultVisibleDate ? feedbackSession.resultsVisibleFromTime : null)); additionalSettings.setResponseVisibleDateDisabled(!hasResultVisibleDate); additionalSettings.setResponseVisibleImmediatelyChecked( Const.TIME_REPRESENTS_FOLLOW_VISIBLE.equals( feedbackSession.resultsVisibleFromTime)); additionalSettings.setResponseVisiblePublishManuallyChecked( Const.TIME_REPRESENTS_LATER.equals(feedbackSession.resultsVisibleFromTime) || Const.TIME_REPRESENTS_NOW.equals(feedbackSession.resultsVisibleFromTime)); additionalSettings.setResponseVisibleNeverChecked(Const.TIME_REPRESENTS_NEVER.equals(feedbackSession.resultsVisibleFromTime)); }

Target:
private static void setResponseVisibleSettings(PageData data, FeedbackSessionAttributes feedbackSession, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings) { boolean hasResultVisibleDate = !TimeHelper.isSpecialTime(feedbackSession.resultsVisibleFromTime); additionalSettings.isResponseVisibleDateChecked = hasResultVisibleDate; additionalSettings.responseVisibleDateValue = hasResultVisibleDate ? TimeHelper.formatDate(feedbackSession.resultsVisibleFromTime) : ""; additionalSettings.responseVisibleTimeOptions = data.getTimeOptionsAsElementTags( hasResultVisibleDate ? feedbackSession.resultsVisibleFromTime : null); additionalSettings.isResponseVisibleDateDisabled = !hasResultVisibleDate; additionalSettings.isResponseVisibleImmediatelyChecked = Const.TIME_REPRESENTS_FOLLOW_VISIBLE.equals( feedbackSession.resultsVisibleFromTime); additionalSettings.isResponseVisiblePublishManuallyChecked = Const.TIME_REPRESENTS_LATER.equals(feedbackSession.resultsVisibleFromTime) || Const.TIME_REPRESENTS_NOW.equals(feedbackSession.resultsVisibleFromTime); additionalSettings.isResponseVisibleNeverChecked = Const.TIME_REPRESENTS_NEVER.equals( feedbackSession.resultsVisibleFromTime); }
Source:
public void onViewStateRestored(@Nullable Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); updateSendButtonEnabledState(); editMessageTextField.addTextChangedListener(new SimpleTextWatcher() { @Override public void afterTextChanged(Editable s) { updateSendButtonEnabledState(); } }); }

Target:
public void onViewStateRestored(@Nullable Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); final String message = editMessageTextField.getText().toString(); sendButton.setEnabled(!message.trim().isEmpty()); editMessageTextField.addTextChangedListener(new SimpleTextWatcher() { @Override public void afterTextChanged(Editable s) { updateSendButtonEnabledState(); } }); }
Source:
public String getUrl() { return "module/radiology/radiologyOrder.list"; }

Target:
public String getUrl() { return RadiologyOrderListController.RADIOLOGY_ORDER_LIST_REQUEST_MAPPING; }
Source:
public List<Long> allocateAvailableMacs(int numberOfMacs) { if (getAvailableMacsCount() < numberOfMacs) { throw new VdcBLLException(VdcBllErrors.MAC_POOL_NO_MACS_LEFT); } final List<Long> result = new ArrayList<>(numberOfMacs); int remainingMacs = numberOfMacs; while (remainingMacs > 0) { final Range rangeWithAvailableMac = getRangeWithAvailableMac(true); final List<Long> allocatedMacs = rangeWithAvailableMac.allocateMacs(remainingMacs); remainingMacs -= allocatedMacs.size(); result.addAll(allocatedMacs); } return result; }

Target:
public List<Long> allocateAvailableMacs(int numberOfMacs) { if (getAvailableMacsCount() < numberOfMacs) { throw new VdcBLLException(VdcBllErrors.MAC_POOL_NO_MACS_LEFT); } final List<Long> result = new ArrayList<>(numberOfMacs); int remainingMacs = numberOfMacs; while (remainingMacs > 0) { final Range rangeWithAvailableMac = getRangeWithAvailableMac(); Validate.notNull(rangeWithAvailableMac); final List<Long> allocatedMacs = rangeWithAvailableMac.allocateMacs(remainingMacs); remainingMacs -= allocatedMacs.size(); result.addAll(allocatedMacs); } return result; }
Source:
public void testFileConversion() throws Exception { List<String> cmd = new ArrayList<>(); cmd.add("bin\\win32\\ffmpeg64.exe"); cmd.add("-i"); cmd.add("C:\\Users\\IBM_ADMIN\\Downloads\\jungle\\utbr.mp3"); cmd.add("-vn"); cmd.add("-f"); cmd.add("mp3"); cmd.add("pipe:"); String[] cmdArray = cmd.toArray(new String[cmd.size()]); OutputParams params = new OutputParams(null); ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params); pw.runInNewThread(); InputStream file = pw.getInputStream(0); PushbackInputStream pis = new PushbackInputStream(file); FileOutputStream os = new FileOutputStream("a.mp3"); int read = file.read(); read = pis.read(); byte[] bytes = new byte[1024 * 1024]; while (read != -1) { read = pis.read(); pis.unread(read); read = pis.read(bytes, 0, bytes.length); System.out.println(read); os.write(bytes); read = pis.read(); pis.unread(read); System.out.println(read); } file.close(); os.close(); }

Target:
public void testFileConversion() throws Exception { List<String> cmd = new ArrayList<>(); cmd.add("bin\\win32\\ffmpeg64.exe"); cmd.add("-i"); cmd.add("utbr.mp3"); cmd.add("-vn"); cmd.add("-f"); cmd.add("mp3"); cmd.add("pipe:"); String[] cmdArray = cmd.toArray(new String[cmd.size()]); OutputParams params = new OutputParams(null); ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params); pw.runInNewThread(); InputStream file = pw.getInputStream(0); PushbackInputStream pis = new PushbackInputStream(file); FileOutputStream os = new FileOutputStream("a.mp3"); int read = file.read(); read = pis.read(); byte[] bytes = new byte[1024 * 1024]; while (read != -1) { read = pis.read(); pis.unread(read); read = pis.read(bytes, 0, bytes.length); System.out.println(read); os.write(bytes); read = pis.read(); pis.unread(read); System.out.println(read); } file.close(); os.close(); }
Source:
public ResultData customizeResult(ResultData result) { if (extraOptions == null) { return new MapResultData(); } MapResultData customizedResult = new MapResultData(); customizedResult.setResult(DATA_CTX_RESULT, result); MapResultData extraResult = new MapResultData(); extraOptions.getProperties() .forEach((key, value) -> extraResult.setResult(key, new ValueResultData(value))); customizedResult.setResult(DATA_CTX_EXTRA_OPTIONS, extraResult); return customizedResult; }

Target:
public ResultData customizeResult(ResultData result) { MapResultData customizedResult = new MapResultData(); customizedResult.setResult(DATA_CTX_RESULT, result); if (extraOptions == null) { return customizedResult; } MapResultData extraResult = new MapResultData(); extraOptions.getProperties().forEach((key, value) -> extraResult.setResult(key, new ValueResultData(value))); customizedResult.setResult(DATA_CTX_EXTRA_OPTIONS, extraResult); return customizedResult; }
Source:
public void testExtraRequirementMissingVersionRange() throws Exception { Xpp3Dom dom = new Xpp3Dom("configuration"); Xpp3Dom extraRequirements = new Xpp3Dom("extraRequirements"); Xpp3Dom requirement = new Xpp3Dom("requirement"); Xpp3Dom type = new Xpp3Dom("type"); Xpp3Dom id = new Xpp3Dom("id"); requirement.addChild(id); requirement.addChild(type); extraRequirements.addChild(requirement); dom.addChild(extraRequirements); try { configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom); fail(); } catch (Exception e) { assertTrue(e.getMessage().contains( "Element <versionRange> is missing in <extraRequirements><requirement> section.")); } }

Target:
public void testExtraRequirementMissingVersionRange() throws Exception { Xpp3Dom dom = createConfigurationDom("type", "id"); try { configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom); fail(); } catch (BuildFailureException e) { assertTrue(e.getMessage().contains( "Element <versionRange> is missing in <extraRequirements><requirement> section.")); } }
Source:
private static Archive<?> createDeploymentWithSpringContextLoaderListener() { WebArchive archive = ShrinkWrap.create(WebArchive.class, deploymentWithSpringContextLoaderListenerSpringIncluded + ".war") .addClass(TestResource.class) .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "web.xml", "web.xml") .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "applicationContext.xml", "applicationContext.xml"); archive.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new PropertyPermission("arquillian.*", "read"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader"), new FilePermission("<<ALL FILES>>", "read"), new LoggingPermission("control", "") ), "permissions.xml"); TestUtilSpring.addSpringLibraries(archive); archive.as(ZipExporter.class).exportTo(new File("target", deploymentWithSpringContextLoaderListenerSpringIncluded + ".war"), true); return archive; }

Target:
private static Archive<?> createDeploymentWithSpringContextLoaderListener() { WebArchive archive = ShrinkWrap.create(WebArchive.class, deploymentWithSpringContextLoaderListenerSpringIncluded + ".war") .addClass(TestResource.class) .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "web.xml", "web.xml") .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "applicationContext.xml", "applicationContext.xml"); archive.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new RuntimePermission("accessDeclaredMembers"), new FilePermission("<<ALL FILES>>", "read"), new LoggingPermission("control", "") ), "permissions.xml"); TestUtilSpring.addSpringLibraries(archive); archive.as(ZipExporter.class).exportTo(new File("target", deploymentWithSpringContextLoaderListenerSpringIncluded + ".war"), true); return archive; }
Source:
public static ReadMapping decimalReadMapping(DecimalType decimalType) { requireNonNull(decimalType, "decimalType is null"); if (decimalType.isShort()) { return longReadMapping(decimalType, (resultSet, columnIndex) -> resultSet.getBigDecimal(columnIndex).unscaledValue().longValueExact()); } else { return sliceReadMapping(decimalType, (resultSet, columnIndex) -> encodeScaledValue(resultSet.getBigDecimal(columnIndex))); } }

Target:
public static ReadMapping decimalReadMapping(DecimalType decimalType) { if (decimalType.isShort()) { return longReadMapping(decimalType, (resultSet, columnIndex) -> resultSet.getBigDecimal(columnIndex).unscaledValue().longValueExact()); } return sliceReadMapping(decimalType, (resultSet, columnIndex) -> encodeScaledValue(resultSet.getBigDecimal(columnIndex))); }
Source:
public void receiveResponse(final Exchange exchange, final Response response) { if (isTransparentBlockwiseHandlingEnabled()) { if (exchange.getRequest().isCanceled()) { if (response.getType() != Type.ACK) { LOGGER.finer("rejecting blockwise transfer for canceled Exchange"); EmptyMessage rst = EmptyMessage.newRST(response); sendEmptyMessage(exchange, rst); } } else if (!response.hasBlockOption()) { exchange.setResponse(response); upper().receiveResponse(exchange, response); } else { BlockOption block = response.getOptions().getBlock1(); if (block != null) { handleBlock1Response(exchange, response, block); } block = response.getOptions().getBlock2(); if (block != null) { handleBlock2Response(exchange, response, block); } } } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } }

Target:
public void receiveResponse(final Exchange exchange, final Response response) { if (isTransparentBlockwiseHandlingEnabled()) { if (response.isError()) { switch(response.getCode()) { case REQUEST_ENTITY_INCOMPLETE: case REQUEST_ENTITY_TOO_LARGE: KeyUri key = getKey(exchange, exchange.getCurrentRequest()); clearBlock1Status(key); default: Response resp = new Response(response.getCode()); resp.setToken(exchange.getRequest().getToken()); if (exchange.getRequest().getType() == Type.CON) { resp.setType(Type.ACK); resp.setMID(exchange.getRequest().getMID()); } else { resp.setType(Type.NON); } resp.setSource(response.getSource()); resp.setSourcePort(response.getSourcePort()); resp.setPayload(response.getPayload()); resp.setOptions(response.getOptions()); exchange.setResponse(resp); upper().receiveResponse(exchange, resp); } } else if (!response.hasBlockOption()) { exchange.setResponse(response); upper().receiveResponse(exchange, response); } else { if (response.getOptions().hasBlock1()) { handleBlock1Response(exchange, response); } if (response.getOptions().hasBlock2()) { handleBlock2Response(exchange, response); } } } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } }
Source:
public ServerTemplate cloneServerTemplate() { ServerTemplate serverTemplate = new ServerTemplate(); serverTemplate.setId(this.getId()); serverTemplate.setName(this.getName()); containersSpec.forEach(c -> serverTemplate.addContainerSpec(new ContainerSpec(c.getId(), c.getContainerName(), c.getServerTemplateKey(), c.getReleasedId(), c.getStatus(), cloneContainerConfigMap(c.getConfigs())))); final Map<Capability, ServerConfig> cloneServerConfig = new HashMap<>(); configs.entrySet().stream().forEach(entry -> cloneServerConfig.put(entry.getKey(), entry.getValue())); serverTemplate.setConfigs(cloneServerConfig); serverInstances.forEach(serverInstance -> serverTemplate.addServerInstance(new ServerInstanceKey(serverInstance.getServerTemplateId(), serverInstance.getServerName(), serverInstance.getServerInstanceId(), serverInstance.getUrl()))); final List<String> cloneCapabilities = new ArrayList<>(); capabilities.forEach(capability -> cloneCapabilities.add(capability)); serverTemplate.setCapabilities(cloneCapabilities); serverTemplate.setMode(mode); return serverTemplate; }

Target:
public ServerTemplate cloneServerTemplate() { synchronized (lock) { ServerTemplate serverTemplate = new ServerTemplate(this.getId(), this.getName(), new ArrayList<>(capabilities), getConfigs(), Collections.EMPTY_LIST, new ArrayList<ServerInstanceKey>(serverInstances)); containersSpec.forEach(c -> serverTemplate.addContainerSpec(new ContainerSpec(c.getId(), c.getContainerName(), c.getServerTemplateKey(), c.getReleasedId(), c.getStatus(), new EnumMap<>(c.getConfigs())))); serverTemplate.setMode(mode); return serverTemplate; } }
Source:
static void removeFromWarsByContext(Entity entity, String targetName) { targetName = filenameToWebContextMapper.convertDeploymentTargetNameToContext(targetName); synchronized (entity) { Map<String,String> newWarsMap = MutableMap.copyOf(entity.getConfig(WARS_BY_CONTEXT)); String url = newWarsMap.remove(targetName); if (url==null) { DynamicTasks.submit(Tasks.warning("Context "+targetName+" not known at "+entity+"; attempting to undeploy regardless", null), entity); } ((EntityInternal)entity).setConfig(WARS_BY_CONTEXT, newWarsMap); } }

Target:
static boolean removeFromWarsByContext(Entity entity, String targetName) { targetName = FILENAME_TO_WEB_CONTEXT_MAPPER.convertDeploymentTargetNameToContext(targetName); synchronized (entity) { Map<String,String> newWarsMap = MutableMap.copyOf(entity.getConfig(WARS_BY_CONTEXT)); String url = newWarsMap.remove(targetName); if (url==null) { return false; } ((EntityInternal)entity).setConfig(WARS_BY_CONTEXT, newWarsMap); return true; } }
Source:
public String toString() { StringBuffer sb = new StringBuffer("{"); sb.append("webrequest:"); sb.append("uriHost" + this.getUriHost()); sb.append("uriPath," + this.getUriPath()); sb.append("uriQuery," + this.getUriQuery()); sb.append("httpStatus," + this.getHttpStatus()); sb.append("contentType," + this.getContentType()); sb.append("userAgent," + this.getUserAgent()) ; sb.append("X-Analytics," + this.getRawXAnalyticsHeader()); sb.append("}"); return sb.toString(); }

Target:
public String toString() { StringBuffer sb = new StringBuffer("{"); sb.append("webrequest:"); sb.append(", 'uriHost':" + this.getUriHost()); sb.append(", 'uriPath':" + this.getUriPath()); sb.append(", 'uriQuery':" + this.getUriQuery()); sb.append(", 'httpStatus':" + this.getHttpStatus()); sb.append(", 'contentType':" + this.getContentType()); sb.append(", 'userAgent':" + this.getUserAgent()) ; sb.append(", 'X-Analytics':" + this.getRawXAnalyticsHeader()); sb.append("}"); return sb.toString(); }
Source:
protected Users mapDbUserCollection(List<DbUser> entities) { Users collection = new Users(); for (DbUser entity : entities) { collection.getUsers().add(addLinks(modifyDomain(map(entity)), BaseResource.class)); } return collection; }

Target:
protected Users mapDbUserCollection(List<DbUser> entities) { Users collection = new Users(); for (DbUser entity : entities) { User user = map(entity); user = populate(user, entity); user = addLinks(user, BaseResource.class); collection.getUsers().add(user); } return collection; }
Source:
public void handle(Request request, Response response) throws Exception { userSession.checkLoggedIn().checkIsSystemAdministrator(); GroupsWsResponse groupsWsResponse = doHandle(toGroupsRequest(request)); writeProtobuf(groupsWsResponse, request, response); }

Target:
public void handle(Request request, Response response) throws Exception { GroupsWsResponse groupsWsResponse = doHandle(toGroupsRequest(request)); writeProtobuf(groupsWsResponse, request, response); }
Source:
public boolean waitForCompletion(long timeoutMillis) throws InterruptedException { WorkManager workManager = getWorkManager(); if (workManager!=null) { return workManager.awaitCompletion(timeoutMillis, TimeUnit.MILLISECONDS); } else { return false; } }

Target:
public boolean waitForCompletion(long timeoutMillis) throws InterruptedException { WorkManager workManager = getWorkManager(); if (workManager == null) { return false; } return workManager.awaitCompletion(timeoutMillis, TimeUnit.MILLISECONDS); }
Source:
public void addAll(final Subscription... subscriptions) { List<Subscription> subscriptionList = new ArrayList<Subscription>(4); for (Subscription s : subscriptions) { if (!s.isUnsubscribed()) { subscriptionList.add(s); } } if (!unsubscribed) { synchronized (this) { if (!unsubscribed) { if (this.subscriptions == null) { this.subscriptions = new HashSet<Subscription>(4); } this.subscriptions.addAll(subscriptionList); return; } } } for (Subscription s : subscriptionList) { s.unsubscribe(); } }

Target:
public void addAll(final Subscription... subscriptions) { if (!unsubscribed) { synchronized (this) { if (!unsubscribed) { if (this.subscriptions == null) { this.subscriptions = new HashSet<Subscription>(subscriptions.length); } for (Subscription s : subscriptions) { if (!s.isUnsubscribed()) { this.subscriptions.add(s); } } return; } } } for (Subscription s : subscriptions) { s.unsubscribe(); } }
Source:
protected ActionResult execute() { String idOfCourseToArchive = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(idOfCourseToArchive); String setArchiveStatus = getRequestParamValue(Const.ParamsNames.COURSE_ARCHIVE_STATUS); Assumption.assertNotNull(setArchiveStatus); boolean setArchive = Boolean.parseBoolean(setArchiveStatus); new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(idOfCourseToArchive, account.googleId), logic.getCourse(idOfCourseToArchive)); try { if (setArchive) { logic.setArchiveStatusOfInstructor(account.googleId, idOfCourseToArchive, setArchive); if (isRedirectedToHomePage()) { statusToUser.add(String.format(Const.StatusMessages.COURSE_ARCHIVED_FROM_HOMEPAGE, idOfCourseToArchive)); } else { statusToUser.add(String.format(Const.StatusMessages.COURSE_ARCHIVED, idOfCourseToArchive)); } statusToAdmin = "Course archived: " + idOfCourseToArchive; } else { logic.setArchiveStatusOfInstructor(account.googleId, idOfCourseToArchive, setArchive); statusToUser.add(String.format(Const.StatusMessages.COURSE_UNARCHIVED, idOfCourseToArchive)); statusToAdmin = "Course unarchived: " + idOfCourseToArchive; } } catch (Exception e) { setStatusForException(e); } if (isRedirectedToHomePage()) { return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); } else { return createRedirectResult(Const.ActionURIs.INSTRUCTOR_COURSES_PAGE); } }

Target:
protected ActionResult execute() { String idOfCourseToArchive = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(idOfCourseToArchive); String setArchiveStatus = getRequestParamValue(Const.ParamsNames.COURSE_ARCHIVE_STATUS); Assumption.assertNotNull(setArchiveStatus); boolean setArchive = Boolean.parseBoolean(setArchiveStatus); new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(idOfCourseToArchive, account.googleId), logic.getCourse(idOfCourseToArchive)); try { logic.setArchiveStatusOfInstructor(account.googleId, idOfCourseToArchive, setArchive); if (setArchive) { if (isRedirectedToHomePage()) { statusToUser.add(String.format(Const.StatusMessages.COURSE_ARCHIVED_FROM_HOMEPAGE, idOfCourseToArchive)); } else { statusToUser.add(String.format(Const.StatusMessages.COURSE_ARCHIVED, idOfCourseToArchive)); } statusToAdmin = "Course archived: " + idOfCourseToArchive; } else { statusToUser.add(String.format(Const.StatusMessages.COURSE_UNARCHIVED, idOfCourseToArchive)); statusToAdmin = "Course unarchived: " + idOfCourseToArchive; } } catch (Exception e) { setStatusForException(e); } if (isRedirectedToHomePage()) { return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); } else { return createRedirectResult(Const.ActionURIs.INSTRUCTOR_COURSES_PAGE); } }
Source:
private static List<AbstractHead> createSimpleHeads( final String patternPart, final Character invalidWildgetCharacter) throws InvalidPatternException { final List<AbstractHead> heads = new ArrayList<AbstractHead>( patternPart.length()); boolean escapeFlag = false; for (int i = 0; i < patternPart.length(); i++) { final char c = patternPart.charAt(i); switch (c) { case '*': { if (escapeFlag) { addCharacterHead(heads, c); escapeFlag = false; } else { final AbstractHead head = createWildCardHead( invalidWildgetCharacter, true); heads.add(head); } break; } case '?': { if (escapeFlag) { addCharacterHead(heads, c); escapeFlag = false; } else { final AbstractHead head = createWildCardHead( invalidWildgetCharacter, false); heads.add(head); } break; } case '\\': { if (escapeFlag || (invalidWildgetCharacter != null && invalidWildgetCharacter == '\\')) { addCharacterHead(heads, c); escapeFlag = false; } else { escapeFlag = true; } break; } default: addCharacterHead(heads, c); escapeFlag = false; } } if (escapeFlag) { throw new InvalidPatternException("Pattern ends with '\\'", patternPart); } return heads; }

Target:
private static List<AbstractHead> createSimpleHeads( final String patternPart, final Character invalidWildgetCharacter) throws InvalidPatternException { final List<AbstractHead> heads = new ArrayList<AbstractHead>( patternPart.length()); boolean escapeFlag = false; for (int i = 0; i < patternPart.length(); i++) { final char c = patternPart.charAt(i); switch (c) { case '*': { if (escapeFlag) { addCharacterHead(heads, c); escapeFlag = false; } else { final AbstractHead head = createWildCardHead( invalidWildgetCharacter, true); heads.add(head); } break; } case '?': { if (escapeFlag) { addCharacterHead(heads, c); escapeFlag = false; } else { final AbstractHead head = createWildCardHead( invalidWildgetCharacter, false); heads.add(head); } break; } case '\\': { if (escapeFlag || (invalidWildgetCharacter != null && invalidWildgetCharacter == '\\')) { addCharacterHead(heads, c); escapeFlag = false; } else { escapeFlag = true; } break; } default: addCharacterHead(heads, c); escapeFlag = false; } } if (escapeFlag) throw new InvalidPatternException("Pattern ends with '\\'", patternPart); return heads; }
Source:
protected void resolveDuplicates(SourceRefElement handle) { Integer occurenceCount = this.occurenceCounts.get(handle); if (occurenceCount == null) this.occurenceCounts.put(handle, Integer.valueOf(1)); else { this.occurenceCounts.put(handle, Integer.valueOf(occurenceCount.intValue() + 1)); handle.occurrenceCount = occurenceCount.intValue(); } if (handle instanceof SourceType && ((SourceType) handle).isAnonymous()) { Object key = handle.getParent().getAncestor(IJavaElement.TYPE); occurenceCount = this.localOccurrenceCounts.get(key); if (occurenceCount == null) this.localOccurrenceCounts.put(key, Integer.valueOf(1)); else { this.localOccurrenceCounts.put(key, Integer.valueOf(occurenceCount.intValue() + 1)); ((SourceType)handle).localOccurrenceCount = occurenceCount.intValue(); } } }

Target:
protected void resolveDuplicates(SourceRefElement handle) { Integer occurenceCount = this.occurenceCounts.get(handle); if (occurenceCount == null) this.occurenceCounts.put(handle, Integer.valueOf(1)); else { this.occurenceCounts.put(handle, Integer.valueOf(occurenceCount.intValue() + 1)); handle.occurrenceCount = occurenceCount.intValue() + 1; } if (handle instanceof SourceType && ((SourceType) handle).isAnonymous()) { Object key = handle.getParent().getAncestor(IJavaElement.TYPE); occurenceCount = this.localOccurrenceCounts.get(key); if (occurenceCount == null) this.localOccurrenceCounts.put(key, Integer.valueOf(1)); else { this.localOccurrenceCounts.put(key, Integer.valueOf(occurenceCount.intValue() + 1)); ((SourceType)handle).localOccurrenceCount = occurenceCount.intValue() + 1; } } }