auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void addRowModels( List<@NonNull ITimeGraphRowModel> rows, RosMessageFlowSegment segment, @NonNull Map<@NonNull Integer, @NonNull Predicate<@NonNull Map<@NonNull String, @NonNull String>>> predicates, @Nullable IProgressMonitor monitor) { @NonNull List<@NonNull ITimeGraphState> eventList = new ArrayList<>(); long entryId = fSegmentToId.computeIfAbsent(segment, i -> ATOMIC_LONG.getAndIncrement()); long startTime = segment.getStartTime(); long duration = segment.getEndTime() - startTime + 1; String label = String.valueOf(duration); TimeGraphState state = new TimeGraphState(startTime, duration, 0, label); addToStateList(eventList, state, entryId, predicates, monitor); rows.add(new TimeGraphRowModel(entryId, eventList)); Collection<RosMessageFlowSegment> next = segment.getNext(); for (RosMessageFlowSegment n : next) { addRowModels(rows, n, predicates, monitor); } }

Target:
private void addRowModels( List<@NonNull ITimeGraphRowModel> rows, RosMessageFlowSegment segment, @NonNull Map<@NonNull Integer, @NonNull Predicate<@NonNull Map<@NonNull String, @NonNull String>>> predicates, @Nullable IProgressMonitor monitor) { @NonNull List<@NonNull ITimeGraphState> eventList = new ArrayList<>(); long entryId = getSegmentId(segment); long startTime = segment.getStartTime(); long duration = segment.getEndTime() - startTime + 1; String label = StringUtils.EMPTY; TimeGraphState state = new TimeGraphState(startTime, duration, 0, label); addToStateList(eventList, state, entryId, predicates, monitor); rows.add(new TimeGraphRowModel(entryId, eventList)); Collection<RosMessageFlowSegment> next = segment.getNext(); for (RosMessageFlowSegment n : next) { addRowModels(rows, n, predicates, monitor); } }
Source:
private void setConnection(final IDockerConnection connection) { if (connection != null && connection.equals(this.connection)) { return; } if (this.connection != null) { this.connection.removeImageListener(this); } this.connection = connection; if (this.viewer != null && this.connection != null) { final Job refreshJob = new Job( DVMessages.getString("ImagesRefresh.msg")) { @Override protected IStatus run(IProgressMonitor monitor) { connection.getImages(true); return Status.OK_STATUS; } }; refreshJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { connection.addImageListener(DockerImagesView.this); Display.getDefault().asyncExec(() -> { viewer.setInput(connection); refreshViewTitle(); }); } }); refreshJob.schedule(); } else if (this.viewer != null) { viewer.setInput(new IDockerContainer[0]); form.setText(DVMessages.getString(NoConnectionSelected)); } }

Target:
private void setConnection(final IDockerConnection connection) { if (connection != null && connection.equals(this.connection)) { return; } if (this.connection != null) { this.connection.removeImageListener(this); } this.connection = connection; if (this.viewer != null && this.connection != null) { final Job refreshJob = new Job( DVMessages.getString("ImagesRefresh.msg")) { @Override protected IStatus run(IProgressMonitor monitor) { connection.getImages(true); connection.addImageListener(DockerImagesView.this); Display.getDefault().asyncExec(() -> { viewer.setInput(connection); refreshViewTitle(); }); return Status.OK_STATUS; } }; refreshJob.schedule(); } else if (this.viewer != null) { viewer.setInput(new IDockerContainer[0]); form.setText(DVMessages.getString(NoConnectionSelected)); } }
Source:
public void testCreateExplorer() throws Exception { MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean(); JobExecution jobExecution = repositoryFactory.getObject().createJobExecution("foo", new JobParameters()); jobExecution.setStartTime(new Date()); repositoryFactory.getObject().update(jobExecution); MapJobExplorerFactoryBean tested = new MapJobExplorerFactoryBean(repositoryFactory); tested.afterPropertiesSet(); JobExplorer explorer = tested.getObject(); assertEquals(1, explorer.findRunningJobExecutions("foo").size()); }

Target:
public void testCreateExplorer() throws Exception { MapJobRepositoryFactoryBean repositoryFactory = new MapJobRepositoryFactoryBean(); JobRepository jobRepository = repositoryFactory.getObject(); JobExecution jobExecution = jobRepository.createJobExecution("foo", new JobParameters()); jobExecution.setStartTime(new Date()); jobRepository.update(jobExecution); MapJobExplorerFactoryBean tested = new MapJobExplorerFactoryBean(repositoryFactory); tested.afterPropertiesSet(); JobExplorer explorer = tested.getObject(); assertEquals(1, explorer.findRunningJobExecutions("foo").size()); }
Source:
public void upgradeWithMultipleConnectionHeaders() { setUpServerChannel(); String upgradeString = "GET / HTTP/1.1\r\n" + "Host: example.com\r\n" + "Connection: keep-alive\r\n" + "Connection: Upgrade, HTTP2-Settings\r\n" + "Upgrade: h2c\r\n" + "HTTP2-Settings: AAMAAABkAAQAAP__\r\n\r\n"; ByteBuf upgrade = Unpooled.copiedBuffer(upgradeString, CharsetUtil.US_ASCII); assertFalse(channel.writeInbound(upgrade)); assertEquals(1, userEvents.size()); Object userEvent = userEvents.get(0); assertTrue(userEvent instanceof UpgradeEvent); assertEquals("h2c", ((UpgradeEvent) userEvent).protocol()); ReferenceCountUtil.release(userEvent); assertEquals(100, http2ConnectionHandler.connection().local().maxActiveStreams()); assertEquals(65535, http2ConnectionHandler.connection().local().flowController().initialWindowSize()); assertEquals(1, http2ConnectionHandler.connection().numActiveStreams()); assertNotNull(http2ConnectionHandler.connection().stream(1)); Http2Stream stream = http2ConnectionHandler.connection().stream(1); assertEquals(State.HALF_CLOSED_REMOTE, stream.state()); assertFalse(stream.isHeadersSent()); String expectedHttpResponse = "HTTP/1.1 101 Switching Protocols\r\n" + "connection: upgrade\r\n" + "upgrade: h2c\r\n\r\n"; ByteBuf responseBuffer = channel.readOutbound(); assertEquals(expectedHttpResponse, responseBuffer.toString(CharsetUtil.UTF_8)); responseBuffer.release(); ByteBuf settingsBuffer = channel.readOutbound(); assertNotNull(settingsBuffer); settingsBuffer.release(); assertNull(channel.readOutbound()); }

Target:
public void upgradeWithMultipleConnectionHeaders() { String upgradeString = "GET / HTTP/1.1\r\n" + "Host: example.com\r\n" + "Connection: keep-alive\r\n" + "Connection: Upgrade, HTTP2-Settings\r\n" + "Upgrade: h2c\r\n" + "HTTP2-Settings: AAMAAABkAAQAAP__\r\n\r\n"; validateClearTextUpgrade(upgradeString); }
Source:
void setup() { map = new HashMap<>(); map.put("name", "bepson"); map.put("age", 10); }

Target:
void setup() { map = mapOf(entry("name", "bepson"), entry("age", 10)); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == MENU_ITEM_ADD_NEW_CHARGES) { ChargeDialogFragment chargeDialogFragment = ChargeDialogFragment.newInstance(clientId); FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager() .beginTransaction(); fragmentTransaction.addToBackStack(FragmentConstants.FRAG_CHARGE_LIST); chargeDialogFragment.show(fragmentTransaction, getString(R.string.change_dialog_fragment)); } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == MENU_ITEM_ADD_NEW_CHARGES) { ChargeDialogFragment chargeDialogFragment = ChargeDialogFragment.newInstance(clientId); FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager() .beginTransaction(); fragmentTransaction.addToBackStack(FragmentConstants.FRAG_CHARGE_LIST); chargeDialogFragment.show(fragmentTransaction, getString(R.string.charge_dialog_fragment)); } return super.onOptionsItemSelected(item); }
Source:
public List<ContentProposal> getProposals(IInterpreter interpreter, ContentContext context) { List<ContentProposal> proposals = new ArrayList(); if (interpreter instanceof AQLSiriusInterpreter) { ExpressionTrimmer trimer = new ExpressionTrimmer(context.getContents()); if (trimer.positionIsWithinAQL(context.getPosition())) { IQueryEnvironment queryEnvironment = ((AQLSiriusInterpreter) interpreter).getEnvironment(); for (EPackage pak : context.getInterpreterContext().getAvailableEPackages()) { if (pak != null) { queryEnvironment.registerEPackage(pak); } } Map<String, Set<IType>> variableTypes = TypesUtil.createAQLVariableTypesFromInterpreterContext(context.getInterpreterContext(), queryEnvironment); addProposals(proposals, trimer, context.getPosition(), queryEnvironment, variableTypes); } } return proposals; }

Target:
public List<ContentProposal> getProposals(IInterpreter interpreter, ContentContext context) { List<ContentProposal> proposals = new ArrayList(); if (interpreter instanceof AQLSiriusInterpreter) { ExpressionTrimmer trimer = new ExpressionTrimmer(context.getContents()); if (trimer.positionIsWithinAQL(context.getPosition())) { IQueryEnvironment queryEnvironment = createEnvironment(context); Map<String, Set<IType>> variableTypes = TypesUtil.createAQLVariableTypesFromInterpreterContext(context.getInterpreterContext(), queryEnvironment); addProposals(proposals, trimer, context.getPosition(), queryEnvironment, variableTypes); } } return proposals; }
Source:
private static boolean isInputFormatSupported(Properties schema) { String inputFormat = HiveUtil.getInputFormatName(schema); if (!supportedInputFormats.contains(inputFormat)) { log.debug("Unsupported S3Select input format found: " + inputFormat); return false; } return true; }

Target:
private static boolean isInputFormatSupported(Properties schema) { String inputFormat = getInputFormatName(schema); if (!SUPPORTED_INPUT_FORMATS.contains(inputFormat)) { return false; } return true; }
Source:
public static String decrypt(String codedText, String secret) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException { Base64 encoder = new Base64(32, linebreak, true); byte[] encypted = encoder.decode(codedText.getBytes()); Cipher cipher = Cipher.getInstance(TRANSFORMATION, PROVIDER); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(secret.getBytes(), ALGORITHM)); byte[] decrypted = cipher.doFinal(encypted); return new String(decrypted); }

Target:
public static String decrypt(String codedText, String secret) { String toReturn = ""; try { toReturn = decrypt_with_exceptions(codedText, secret); } catch (Exception ex) { throw new OseeCoreException(ex); } return toReturn; }
Source:
public boolean equals(final Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (this.getClass() != obj.getClass()) { return false; } final SmartMeterConverter other = (SmartMeterConverter) obj; if (this.helper == null) { if (other.helper != null) { return false; } } else if (!this.helper.equals(other.helper)) { return false; } return true; }

Target:
public boolean equals(final Object obj) { return super.equals(obj) && Objects.equals(this.helper, ((SmartMeterConverter) obj).helper); }
Source:
public static UUID makeUUID(byte bytes[]) { long high = 0; long low = 0; if (bytes.length < Utils.UUID_LEN) { throw new IllegalArgumentException("UUID byte field must be 16 bytes long"); } final int bitsPerByte = Byte.SIZE; int bitMask = (1 << bitsPerByte) - 1; for (int i = 0; i < bitsPerByte; i++) { low = (low << bitsPerByte) | (bytes[i + bitsPerByte] & bitMask); high = (high << bitsPerByte) | (bytes[i] & bitMask); } UUID uuid = new UUID(high, low); return uuid; }

Target:
public static UUID makeUUID(byte bytes[]) throws CTFException { long high = 0; long low = 0; if (bytes.length < Utils.UUID_LEN) { throw new CTFException("UUID byte field must be 16 bytes long"); } final int bitsPerByte = Byte.SIZE; int bitMask = (1 << bitsPerByte) - 1; for (int i = 0; i < bitsPerByte; i++) { low = (low << bitsPerByte) | (bytes[i + bitsPerByte] & bitMask); high = (high << bitsPerByte) | (bytes[i] & bitMask); } return new UUID(high, low); }
Source:
public Collection<Integer> selectNextChildren(long t) throws TimeRangeException { if (t < getNodeStart() || (isOnDisk() && t > getNodeEnd())) { throw new TimeRangeException("Requesting children outside the node's range: " + t); } rwl.readLock().lock(); try { int potentialNextSeqNb = getSequenceNumber(); for (int i = 0; i < nbChildren; i++) { if (t >= childStart[i]) { potentialNextSeqNb = children[i]; } else { break; } } if (potentialNextSeqNb == getSequenceNumber()) { throw new IllegalStateException("No next child node found"); } return Collections.singleton(potentialNextSeqNb); } finally { rwl.readLock().unlock(); } }

Target:
public Collection<Integer> selectNextChildren(long t) throws TimeRangeException { if (t < getNodeStart() || (isOnDisk() && t > getNodeEnd())) { throw new TimeRangeException("Requesting children outside the node's range: " + t); } rwl.readLock().lock(); try { int potentialNextSeqNb = -1; for (int i = 0; i < nbChildren; i++) { if (t >= childStart[i]) { potentialNextSeqNb = children[i]; } else { break; } } if (potentialNextSeqNb == -1) { throw new IllegalStateException("No next child node found"); } return Collections.singleton(potentialNextSeqNb); } finally { rwl.readLock().unlock(); } }
Source:
private void convertLoadBalancer(CloudLoadBalancer cloudLoadBalancer, List<CloudResource> instances, AwsNetworkView awsNetworkView, AmazonEC2Client amazonEC2Client, List<AwsLoadBalancer> awsLoadBalancers) { Set<String> subnetIds = selectLoadBalancerSubnetIds(cloudLoadBalancer.getType(), awsNetworkView); AwsLoadBalancerScheme scheme = determinePublicVsPrivateSchema(subnetIds, awsNetworkView.getExistingVpc(), amazonEC2Client); Optional<AwsLoadBalancer> existingLoadBalancer = awsLoadBalancers.stream() .filter(lb -> lb.getScheme() == scheme) .findFirst(); AwsLoadBalancer currentLoadBalancer; if (existingLoadBalancer.isPresent()) { currentLoadBalancer = existingLoadBalancer.get(); } else { currentLoadBalancer = new AwsLoadBalancer(scheme); awsLoadBalancers.add(currentLoadBalancer); } currentLoadBalancer.addSubnets(subnetIds); setupLoadBalancer(cloudLoadBalancer, instances, currentLoadBalancer); }

Target:
private AwsLoadBalancer convertLoadBalancer(CloudLoadBalancer cloudLoadBalancer, List<CloudResource> instances, AwsNetworkView awsNetworkView, AmazonEC2Client amazonEC2Client, List<AwsLoadBalancer> awsLoadBalancers) { Set<String> subnetIds = selectLoadBalancerSubnetIds(cloudLoadBalancer.getType(), awsNetworkView); AwsLoadBalancerScheme scheme = determinePublicVsPrivateSchema(subnetIds, awsNetworkView.getExistingVpc(), amazonEC2Client); Optional<AwsLoadBalancer> existingLoadBalancer = awsLoadBalancers.stream() .filter(lb -> lb.getScheme() == scheme) .findFirst(); AwsLoadBalancer currentLoadBalancer; if (existingLoadBalancer.isPresent()) { currentLoadBalancer = existingLoadBalancer.get(); } else { currentLoadBalancer = new AwsLoadBalancer(scheme); } currentLoadBalancer.addSubnets(subnetIds); setupLoadBalancer(cloudLoadBalancer, instances, currentLoadBalancer); return currentLoadBalancer; }
Source:
private static void checkAllProperty(SubscriptionContext ctx, AssignmentStatement assignmentStatement) { Expression assignedValue = assignmentStatement.assignedValue(); if (!assignedValue.is(Tree.Kind.LIST_LITERAL) && !assignedValue.is(Tree.Kind.TUPLE)) { return; } List<Expression> expressions = getAllExpressions(assignedValue); for (Expression element : expressions) { if (element instanceof HasSymbol) { Symbol symbol = ((HasSymbol) element).symbol(); if (isClassOrFunctionSymbol(symbol)) { ctx.addIssue(element, MESSAGE); continue; } } if (!couldBeString(element)) { ctx.addIssue(element, MESSAGE); } } }

Target:
private static void checkAllProperty(SubscriptionContext ctx, AssignmentStatement assignmentStatement) { Expression assignedValue = assignmentStatement.assignedValue(); if (!assignedValue.is(Tree.Kind.LIST_LITERAL) && !assignedValue.is(Tree.Kind.TUPLE)) { return; } List<Expression> expressions = getAllExpressions(assignedValue); for (Expression element : expressions) { if (!couldBeString(element)) { ctx.addIssue(element, MESSAGE); } } }
Source:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && vm.getCustomCompatibilityVersion() != null) .filter(vm -> getStoragePool().getCompatibilityVersion().greater(vm.getCustomCompatibilityVersion())) .map(VM::getName) .map(name -> "<li>" + name + "</li>") .collect(Collectors.joining()); suspendedVms = "<ul>" + suspendedVms + "</ul>"; if (!suspendedVms.isEmpty()) { addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }

Target:
private boolean hasSuspendedVms() { List<VM> vmList = vmDao.getAllForStoragePool(getStoragePool().getId()); String suspendedVms = vmList.stream() .filter(vm -> vm.getStatus().isSuspended() && vm.getCustomCompatibilityVersion() != null) .filter(vm -> getStoragePool().getCompatibilityVersion().greater(vm.getCustomCompatibilityVersion())) .map(VM::getName) .map(name -> "<li>" + name + "</li>") .collect(Collectors.joining()); if (!suspendedVms.isEmpty()) { suspendedVms = "<ul>" + suspendedVms + "</ul>"; addValidationMessage(EngineMessage.ERROR_CANNOT_UPDATE_STORAGE_POOL_SUSPENDED_VM_COMPATIBILITY_VERSION_NOT_SUPPORTED); addValidationMessageVariable("VmsList", suspendedVms); return true; } return false; }
Source:
protected void updateCurrentCd(String cdPath) { cdPath = cdPath.isEmpty() ? null : cdPath; VmHandler.updateCurrentCd(getVdsId(), getVm(), cdPath); }

Target:
protected void updateCurrentCd(String cdPath) { cdPath = StringUtils.isEmpty(cdPath) ? null : cdPath; VmHandler.updateCurrentCd(getVdsId(), getVm(), cdPath); }
Source:
public synchronized void resumeJob(final String jobName, final String groupName) throws SchedulerException { if (!ifJobExist(jobName, groupName)) { throw new SchedulerException( "can not find job with group name: " + groupName + " in quartz."); } else { this.scheduler.resumeJob(new JobKey(jobName, groupName)); } }

Target:
public synchronized void resumeJob(final String jobName, final String groupName) throws SchedulerException { checkJobExistence(jobName, groupName); this.scheduler.resumeJob(new JobKey(jobName, groupName)); }
Source:
public void printUsageAndExit(final String message, final CmdLineParser clp) { System.err.println(message); System.err.print("jgit "); System.err.print(commandName); OutputStreamWriter writer = new OutputStreamWriter(System.err); ResourceBundle resourceBundle = getResourceBundle(); clp.printSingleLineUsage(writer, resourceBundle); System.err.println(); System.err.println(); clp.printUsage(writer, resourceBundle); System.err.println(); System.exit(1); }

Target:
public void printUsageAndExit(final String message, final CmdLineParser clp) { PrintWriter writer = new PrintWriter(System.err); writer.println(message); writer.print("jgit "); writer.print(commandName); clp.printSingleLineUsage(writer, getResourceBundle()); writer.println(); writer.println(); clp.printUsage(writer, getResourceBundle()); writer.println(); writer.flush(); System.exit(1); }
Source:
public void createPollMetrics() { _numPolls = new Meter(); _eventCountsPerPoll = new Histogram(new SlidingTimeWindowReservoir(1, TimeUnit.MINUTES)); _numPolls = DYNAMIC_METRICS_MANAGER.registerMetric(_className, _metricsKey, NUM_POLLS, Meter.class); _eventCountsPerPoll = DYNAMIC_METRICS_MANAGER.registerMetric(_className, _metricsKey, EVENT_COUNTS_PER_POLL, Histogram.class); _aggregatedClientPollOverTimeout = DYNAMIC_METRICS_MANAGER.registerMetric(_className, AGGREGATE, CLIENT_POLL_OVER_TIMEOUT, Counter.class); _aggregatedClientPollIntervalOverSessionTimeout = DYNAMIC_METRICS_MANAGER.registerMetric(_className, AGGREGATE, CLIENT_POLL_INTERVAL_OVER_SESSION_TIMEOUT, Counter.class); }

Target:
public void createPollMetrics() { _pollMetrics = new PollMetrics(_className, _key); _metricsList.add(_pollMetrics); }
Source:
public MediaListMode getMediaListMode() { MediaListMode mediaListMode = null; if(getMediaPreference().equals(MediaListMode.GRID.toString())){ mediaListMode = MediaListMode.GRID; }else if(getMediaPreference().equals(MediaListMode.LIST.toString())){ mediaListMode = MediaListMode.LIST; } return mediaListMode; }

Target:
private MediaListMode getMediaListMode() { MediaListMode mediaListMode = null; if(getMediaPreference().equals(MediaListMode.GRID.toString())){ mediaListMode = MediaListMode.GRID; }else if(getMediaPreference().equals(MediaListMode.LIST.toString())){ mediaListMode = MediaListMode.LIST; } return mediaListMode; }
Source:
public Mono<AccountProperties> getAccountProperties() { try { return getAccountPropertiesWithResponse().flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
public Mono<AccountProperties> getAccountProperties() { return getAccountPropertiesWithResponse().flatMap(FluxUtil::toMono); }
Source:
public static WebViewClient getWebViewClient(final boolean ignoreErrors, final boolean followLinks, final Form form, final Component component) { return new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return !followLinks; } @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { if (ignoreErrors) { handler.proceed(); } else { handler.cancel(); form.dispatchErrorOccurredEvent(component, "WebView", ErrorMessages.ERROR_WEBVIEW_SSL_ERROR); } } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { EventDispatcher.dispatchEvent(component, "BeforePageLoad", url); } @Override public void onPageFinished(WebView view, String url) { EventDispatcher.dispatchEvent(component, "PageLoaded", url); } @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { container.$form().runOnUiThread(new Runnable() { public void run() { EventDispatcher.dispatchEvent(component, "ErrorOccurred", errorCode, description, failingUrl); } }); } }; }

Target:
public static WebViewClient getWebViewClient(final boolean ignoreErrors, final boolean followLinks, final Form form, final Component component) { return new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return !followLinks; } @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { if (ignoreErrors) { handler.proceed(); } else { handler.cancel(); form.dispatchErrorOccurredEvent(component, "WebView", ErrorMessages.ERROR_WEBVIEW_SSL_ERROR); } } @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { EventDispatcher.dispatchEvent(component, "BeforePageLoad", url); } @Override public void onPageFinished(WebView view, String url) { EventDispatcher.dispatchEvent(component, "PageLoaded", url); } @Override public void onReceivedError(WebView view, final int errorCode, final String description, final String failingUrl) { form.runOnUiThread(new Runnable() { public void run() { EventDispatcher.dispatchEvent(component, "ErrorOccurred", errorCode, description, failingUrl); } }); } }; }
Source:
private Map<String, Map<String, Object>> readDatabase(File inputFile) { try { final Map<String, Map<String, Object>> inputMap = new ConcurrentHashMap<String, Map<String, Object>>(); FileReader reader = new FileReader(inputFile); Map<String, Map<String, Object>> type = new HashMap<String, Map<String, Object>>(); Map<String, Map<String, Object>> loadedMap = outerMapper.fromJson(reader, type.getClass()); if (loadedMap != null && loadedMap.size() != 0) { inputMap.putAll(loadedMap); } return inputMap; } catch (JsonSyntaxException | JsonIOException | FileNotFoundException e) { logger.error("Error reading JsonDB from {}. Cause {}.", inputFile.getPath(), e.getMessage()); return null; } }

Target:
private Map<String, StorageEntry> readDatabase(File inputFile) { try { final Map<String, StorageEntry> inputMap = new ConcurrentHashMap<>(); FileReader reader = new FileReader(inputFile); Map<String, StorageEntry> loadedMap = internalMapper.fromJson(reader, map.getClass()); if (loadedMap != null && loadedMap.size() != 0) { inputMap.putAll(loadedMap); } return inputMap; } catch (JsonSyntaxException | JsonIOException | FileNotFoundException e) { logger.error("Error reading JsonDB from {}. Cause {}.", inputFile.getPath(), e.getMessage()); return null; } }
Source:
public MojoExecution setupMojoExecution(final MavenProject project, final MojoExecution execution, IProgressMonitor monitor) throws CoreException { return context().execute(project, new ICallable<MojoExecution>() { public MojoExecution call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException { return setupMojoExecution(context.getSession(), project, execution); } }, monitor); }

Target:
public MojoExecution setupMojoExecution(final MavenProject project, final MojoExecution execution, IProgressMonitor monitor) throws CoreException { return context().execute(project, (context, pm) -> setupMojoExecution(context.getSession(), project, execution), monitor); }
Source:
public float getProgress() throws IOException, InterruptedException { return 0; }

Target:
public float getProgress() throws IOException, InterruptedException { if (numRows > 0) { return (rowNum * 1.0f) / numRows; } else { return 0; } }
Source:
private static OnlineHmmPriors getPriorsFromS3Object(final AmazonS3 s3,final String bucket, final String key) { OnlineHmmPriors onlineHmmPriors = OnlineHmmPriors.createEmpty(); final S3Object s3Object = s3.getObject(bucket, key); final Reader inputStream = new InputStreamReader(s3Object.getObjectContent()); try { final String base64data = CharStreams.toString(inputStream); byte bindata = Base64.decodeBase64(base64data); final int len = bindata.length; final Optional<OnlineHmmPriors> priorsOptional = OnlineHmmPriors.createFromProtoBuf(bindata); if (priorsOptional.isPresent()) { onlineHmmPriors = priorsOptional.get(); LOGGER.info("successfully pulled default models from {}/{}",bucket,key); } else { LOGGER.error("failed to find default models for the ensemble"); } } catch (IOException e) { LOGGER.error(e.getMessage()); } return onlineHmmPriors; }

Target:
private static OnlineHmmPriors getPriorsFromS3Object(final AmazonS3 s3,final String bucket, final String key) { final S3Object s3Object = s3.getObject(bucket, key); try (final Reader inputStream = new InputStreamReader(s3Object.getObjectContent())) { final String base64data = CharStreams.toString(inputStream); byte bindata = Base64.decodeBase64(base64data); final int len = bindata.length; final Optional<OnlineHmmPriors> priorsOptional = OnlineHmmPriors.createFromProtoBuf(bindata); if (!priorsOptional.isPresent()) { LOGGER.error("failed to find default models for the ensemble"); return OnlineHmmPriors.createEmpty(); } LOGGER.info("successfully pulled default models from {}/{}",bucket,key); return priorsOptional.get(); } catch (IOException e) { LOGGER.error(e.getMessage()); } return OnlineHmmPriors.createEmpty(); }
Source:
public ExecutionResult compare(FileElement localFile, FileElement remoteFile, ExternalDiffTool tool, boolean trustExitCode) throws ToolException { try { if (tool == null) { throw new ToolException( "External diff tool specified in git attributes can not be found."); } String command = ExternalToolUtils.prepareCommand(tool.getCommand(), localFile, remoteFile, null, null); Map<String, String> env = ExternalToolUtils.prepareEnvironment( gitDir, localFile, remoteFile, null, null); CommandExecutor cmdExec = new CommandExecutor(fs, trustExitCode); return cmdExec.run(command, workTree, env); } catch (IOException | InterruptedException e) { throw new ToolException(e); } finally { localFile.cleanTemporaries(); remoteFile.cleanTemporaries(); } }

Target:
public ExecutionResult compare(FileElement localFile, FileElement remoteFile, ExternalDiffTool tool, boolean trustExitCode) throws ToolException { try { if (tool == null) { throw new ToolException(JGitText .get().diffToolNotSpecifiedInGitAttributesError); } String command = ExternalToolUtils.prepareCommand(tool.getCommand(), localFile, remoteFile, null, null); Map<String, String> env = ExternalToolUtils.prepareEnvironment( gitDir, localFile, remoteFile, null, null); CommandExecutor cmdExec = new CommandExecutor(fs, trustExitCode); return cmdExec.run(command, workTree, env); } catch (IOException | InterruptedException e) { throw new ToolException(e); } finally { localFile.cleanTemporaries(); remoteFile.cleanTemporaries(); } }
Source:
public void fixScrollPositionByNavbarOnF2(boolean isMobile) { if(isMobile){ int mobileNavbarHeight = -1 * driver.findElement(F2_MOBILE_NAVIGATION_BAR).getSize().getHeight(); jsActions.scrollBy(0, mobileNavbarHeight); } else { int desktopNavbarHeight = -1 * driver.findElement(F2_DESKTOP_NAVIGATION_BAR).getSize().getHeight(); jsActions.scrollBy(0, desktopNavbarHeight); } }

Target:
public void fixScrollPositionByNavbarOnF2(boolean isMobile) { By element = isMobile ? MOBILE_NAVIGATION_BAR : DESKTOP_NAVIGATION_BAR; int navbarHeight = driver.findElement(element).getSize().getHeight(); jsActions.scrollBy(0, -navbarHeight); }
Source:
private boolean isUnsupportedParamWithNonBlankValue(Map.Entry<String, String> queryParam) { return !(getSupportedSearchParams().contains(queryParam.getKey()) || isBlank(queryParam.getValue())); }

Target:
private boolean isUnsupportedParamWithNonBlankValue(Map.Entry<String, String> queryParam) { return !getSupportedSearchParams().contains(queryParam.getKey()) && isNotBlank(queryParam.getValue()); }
Source:
public void finish() { try { CryptoFileSystemProvider.changePassphrase(vault.getPath(), MASTERKEY_FILENAME, oldPasswordField.getCharacters(), newPassword.get()); LOG.info("Successful changed password for {}", vault.getDisplayableName()); window.close(); updatePasswordInSystemkeychain(); } catch (IOException e) { LOG.error("IO error occured during password change. Unable to perform operation.", e); errorComponent.cause(e).window(window).returnToScene(window.getScene()).build().showErrorScene(); } catch (InvalidPassphraseException e) { Animations.createShakeWindowAnimation(window).play(); oldPasswordField.selectAll(); oldPasswordField.requestFocus(); } }

Target:
public void finish() { try { CryptoFileSystemProvider.changePassphrase(vault.getPath(), MASTERKEY_FILENAME, oldPasswordField.getCharacters(), newPassword.get()); LOG.info("Successfully changed password for {}", vault.getDisplayableName()); window.close(); updatePasswordInSystemkeychain(); } catch (IOException e) { LOG.error("IO error occured during password change. Unable to perform operation.", e); errorComponent.cause(e).window(window).returnToScene(window.getScene()).build().showErrorScene(); } catch (InvalidPassphraseException e) { Animations.createShakeWindowAnimation(window).play(); oldPasswordField.selectAll(); oldPasswordField.requestFocus(); } }
Source:
protected @NonNull Iterable<@NonNull IAnalysisModule> getDependentAnalyses() { try { ITmfTrace trace = getTrace(); if (trace != null) { final XmlPatternStateSystemModule stateSystemModule = new XmlPatternStateSystemModule(getId()); stateSystemModule.setXmlFile(fXmlFile); stateSystemModule.setTrace(trace); setDependentModule(stateSystemModule); return ImmutableList.of((IAnalysisModule) stateSystemModule); } } catch (TmfAnalysisException e) { Activator.logError("Failed to set dependent analysis trace."); } return super.getDependentAnalyses(); }

Target:
protected @NonNull Iterable<@NonNull IAnalysisModule> getDependentAnalyses() { try { ITmfTrace trace = getTrace(); if (trace != null) { final XmlPatternStateSystemModule stateSystemModule = new XmlPatternStateSystemModule(getDependentAnalysisId()); stateSystemModule.setXmlFile(fXmlFile); stateSystemModule.setTrace(trace); setDependentModule(stateSystemModule); return ImmutableList.of((IAnalysisModule) stateSystemModule); } } catch (TmfAnalysisException e) { Activator.logError("Failed to set dependent analysis trace."); } return super.getDependentAnalyses(); }
Source:
protected Slice getKey(Object tuple) { Object key = keyGetter.get(tuple); return new Slice(key.toString().getBytes()); }

Target:
protected Slice getKey(Object tuple) { Object key = keyGetter.get(tuple); return streamCodec.toByteArray(key); }
Source:
private void setSearchFilter(String string) { if (patternFilter == null) { patternFilter = new TypeListPatternFilter(); commonViewer.addFilter(patternFilter); } patternFilter.setPattern(string); commonViewer.refresh(false); handleTreeExpansion(string); }

Target:
private void setSearchFilter(String string) { if (null == patternFilter) { patternFilter = new TypeListPatternFilter(); commonViewer.addFilter(patternFilter); } patternFilter.setPattern(string); commonViewer.refresh(false); handleTreeExpansion(string); }
Source:
public List<String> resolveVirtualAttributeValueChange(PerunSessionImpl session, String message) throws WrongReferenceAttributeValueException, AttributeNotExistsException, WrongAttributeAssignmentException { Matcher statusChangeMatcher = statusChange.matcher(message); if (statusChangeMatcher.find() && (statusChangeMatcher.group(2).equals("expired") || statusChangeMatcher.group(2).equals("disabled") || statusChangeMatcher.group(2).equals("validated"))) { try { int memberId = Integer.valueOf(statusChangeMatcher.group(1)); Member member = session.getPerunBl().getMembersManagerBl().getMemberById(session, memberId); Attribute attribute = session.getPerunBl().getAttributesManagerBl().getAttribute(session, member, AttributesManager.NS_MEMBER_ATTR_DEF + ":suspensionInfo"); attribute.setValue(new LinkedHashMap<String, String>()); session.getPerunBl().getAttributesManagerBl().setAttribute(session, member, attribute); } catch (AttributeNotExistsException e) { } catch (Exception e) { log.error("Can't resolve auditer's message for " + this.getClass().getSimpleName() + " module because of exception.", e); } } return new ArrayList<>(); }

Target:
public List<String> resolveVirtualAttributeValueChange(PerunSessionImpl session, String message) throws WrongReferenceAttributeValueException, AttributeNotExistsException, WrongAttributeAssignmentException { Matcher statusChangeMatcher = statusChange.matcher(message); if (statusChangeMatcher.find() && (statusChangeMatcher.group(2).equals("expired") || statusChangeMatcher.group(2).equals("disabled") || statusChangeMatcher.group(2).equals("validated"))) { try { int memberId = Integer.valueOf(statusChangeMatcher.group(1)); Member member = session.getPerunBl().getMembersManagerBl().getMemberById(session, memberId); Attribute attribute = session.getPerunBl().getAttributesManagerBl().getAttribute(session, member, AttributesManager.NS_MEMBER_ATTR_DEF + ":suspensionInfo"); attribute.setValue(new LinkedHashMap<String, String>()); session.getPerunBl().getAttributesManagerBl().setAttribute(session, member, attribute); } catch (AttributeNotExistsException e) { } catch (MemberNotExistsException | WrongAttributeValueException | InternalErrorException e) { log.error("Can't resolve auditer's message for " + this.getClass().getSimpleName() + " module because of exception.", e); } } return new ArrayList<>(); }
Source:
public void scanFile(JavaFileScannerContext context) { Preconditions.checkNotNull(sensorContext); JavaFilesCache javaFilesCache = new JavaFilesCache(); javaFilesCache.scanFile(context); InputFile inputFile = fs.inputFile(fs.predicates().is(context.getFile())); org.sonar.api.resources.File currentResource = (org.sonar.api.resources.File) sensorContext.getResource(inputFile); String fileKey = context.getFileKey(); if (currentResource == null) { throw new IllegalStateException("resource not found : " + fileKey); } resourceMapping.addResource(currentResource, fileKey); for (Map.Entry<String, File> classIOFileEntry : javaFilesCache.getResourcesCache().entrySet()) { resourcesByClass.put(classIOFileEntry.getKey(), currentResource); if (fileKey != null) { sourceFileByClass.put(classIOFileEntry.getKey(), fileKey); } } methodStartLines.putAll(javaFilesCache.getMethodStartLines()); String componentKey = currentResource.getEffectiveKey(); if (javaFilesCache.hasSuppressWarningLines()) { suppressWarningsFilter.addComponent(componentKey, javaFilesCache.getSuppressWarningLines()); } for (JavaIssueFilter javaIssueFilter : issueFilters) { javaIssueFilter.addComponent(fileKey, componentKey); javaIssueFilter.scanFile(context); } }

Target:
public void scanFile(JavaFileScannerContext context) { Preconditions.checkNotNull(sensorContext); JavaFilesCache javaFilesCache = new JavaFilesCache(); javaFilesCache.scanFile(context); InputFile inputFile = fs.inputFile(fs.predicates().is(context.getFile())); org.sonar.api.resources.File currentResource = (org.sonar.api.resources.File) sensorContext.getResource(inputFile); if (currentResource == null) { throw new IllegalStateException("resource not found : " + context.getFileKey()); } resourceMapping.addResource(currentResource, context.getFileKey()); for (Map.Entry<String, File> classIOFileEntry : javaFilesCache.getResourcesCache().entrySet()) { resourcesByClass.put(classIOFileEntry.getKey(), currentResource); if (context.getFileKey() != null) { sourceFileByClass.put(classIOFileEntry.getKey(), context.getFileKey()); } } methodStartLines.putAll(javaFilesCache.getMethodStartLines()); if (javaFilesCache.hasSuppressWarningLines()) { suppressWarningsFilter.addComponent(currentResource.getEffectiveKey(), javaFilesCache.getSuppressWarningLines()); } }
Source:
public SerializedPage serialize(Page page) { SliceOutput serializationBuffer = new DynamicSliceOutput(toIntExact(page.getSizeInBytes() + Integer.BYTES)); writeRawPage(page, serializationBuffer, blockEncodingSerde); Slice slice = serializationBuffer.slice(); int uncompressedSize = serializationBuffer.size(); byte markers = PageCodecMarker.none(); if (compressor.isPresent()) { int maxCompressedSize = compressor.get().maxCompressedLength(uncompressedSize); ensureCompressionBufferCapacity(maxCompressedSize); int compressedSize = compressor.get().compress((byte[]) slice.getBase(), 0, uncompressedSize, compressionBuffer, 0, maxCompressedSize); if ((((double) compressedSize) / uncompressedSize) <= MINIMUM_COMPRESSION_RATIO) { slice = Slices.copyOf(Slices.wrappedBuffer(compressionBuffer, 0, compressedSize)); markers = COMPRESSED.set(markers); } } if (spillCipher.isPresent()) { slice = Slices.wrappedBuffer(spillCipher.get().encrypt(slice.toByteBuffer())); markers = ENCRYPTED.set(markers); } else { slice = Slices.copyOf(slice); } return new SerializedPage(slice, markers, page.getPositionCount(), uncompressedSize); }

Target:
public SerializedPage serialize(Page page) { SliceOutput serializationBuffer = new DynamicSliceOutput(toIntExact(page.getSizeInBytes() + Integer.BYTES)); writeRawPage(page, serializationBuffer, blockEncodingSerde); Slice slice = serializationBuffer.slice(); int uncompressedSize = serializationBuffer.size(); byte markers = PageCodecMarker.none(); if (compressor.isPresent()) { int maxCompressedSize = compressor.get().maxCompressedLength(uncompressedSize); compressionBuffer = ensureCapacity(compressionBuffer, maxCompressedSize); int compressedSize = compressor.get().compress( (byte[]) slice.getBase(), (int) (slice.getAddress() - ARRAY_BYTE_BASE_OFFSET), uncompressedSize, compressionBuffer, 0, maxCompressedSize); if (compressedSize / (double) uncompressedSize <= MINIMUM_COMPRESSION_RATIO) { slice = Slices.copyOf(Slices.wrappedBuffer(compressionBuffer, 0, compressedSize)); markers = COMPRESSED.set(markers); } } if (spillCipher.isPresent()) { slice = Slices.wrappedBuffer(spillCipher.get().encrypt(slice.toByteBuffer())); markers = ENCRYPTED.set(markers); } else { slice = Slices.copyOf(slice); } return new SerializedPage(slice, markers, page.getPositionCount(), uncompressedSize); }
Source:
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException { String addr = getAddr(url); Class implClass = ApplicationModel.getProviderModel(url.getServiceKey()).getServiceInstance().getClass(); RestServer server = servers.computeIfAbsent(addr, addr0 -> { RestServer s = serverFactory.createServer(url.getParameter(Constants.SERVER_KEY, DEFAULT_SERVER)); s.start(url); return s; }); String contextPath = getContextPath(url); if ("servlet".equalsIgnoreCase(url.getParameter(Constants.SERVER_KEY, DEFAULT_SERVER))) { ServletContext servletContext = ServletManager.getInstance().getServletContext(ServletManager.EXTERNAL_SERVER_PORT); if (servletContext == null) { throw new RpcException("No servlet context found. Since you are using server='servlet', " + "make sure that you've configured " + BootstrapListener.class.getName() + " in web.xml"); } String webappPath = servletContext.getContextPath(); if (StringUtils.isNotEmpty(webappPath)) { webappPath = webappPath.substring(1); if (!contextPath.startsWith(webappPath)) { throw new RpcException("Since you are using server='servlet', " + "make sure that the 'contextpath' property starts with the path of external webapp"); } contextPath = contextPath.substring(webappPath.length()); if (contextPath.startsWith("/")) { contextPath = contextPath.substring(1); } } } final Class resourceDef = GetRestful.getRootResourceClass(implClass) != null ? implClass : type; server.deploy(resourceDef, impl, contextPath); final RestServer s = server; return () -> { s.undeploy(resourceDef); }; }

Target:
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws RpcException { String addr = getAddr(url); Class implClass = ApplicationModel.getProviderModel(url.getServiceKey()).getServiceInstance().getClass(); RestServer server = servers.computeIfAbsent(addr, restServer -> { RestServer s = serverFactory.createServer(url.getParameter(Constants.SERVER_KEY, DEFAULT_SERVER)); s.start(url); return s; }); String contextPath = getContextPath(url); if ("servlet".equalsIgnoreCase(url.getParameter(Constants.SERVER_KEY, DEFAULT_SERVER))) { ServletContext servletContext = ServletManager.getInstance().getServletContext(ServletManager.EXTERNAL_SERVER_PORT); if (servletContext == null) { throw new RpcException("No servlet context found. Since you are using server='servlet', " + "make sure that you've configured " + BootstrapListener.class.getName() + " in web.xml"); } String webappPath = servletContext.getContextPath(); if (StringUtils.isNotEmpty(webappPath)) { webappPath = webappPath.substring(1); if (!contextPath.startsWith(webappPath)) { throw new RpcException("Since you are using server='servlet', " + "make sure that the 'contextpath' property starts with the path of external webapp"); } contextPath = contextPath.substring(webappPath.length()); if (contextPath.startsWith("/")) { contextPath = contextPath.substring(1); } } } final Class resourceDef = GetRestful.getRootResourceClass(implClass) != null ? implClass : type; server.deploy(resourceDef, impl, contextPath); final RestServer s = server; return () -> { s.undeploy(resourceDef); }; }
Source:
private @CheckForNull String getCurrentUserLogin() { String userLogin = null; Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) { userLogin = auth.getName(); } return userLogin; }

Target:
private @CheckForNull String getCurrentUserLogin() { return Stream.of(Jenkins.getAuthentication()) .filter(auth -> !auth.equals(Jenkins.ANONYMOUS)) .findFirst() .map(auth -> auth.getName()) .orElse(null); }
Source:
public void subscribe(Subscriber<? super RecordsRetrieved> s) { subscriber = s; ++subscriptionTryCount; s.onSubscribe(new Subscription() { @Override public void request(long n) { if (subscriptionTryCount == 1) { } else { send(n); } } @Override public void cancel() { requested = 0; } }); }

Target:
public void subscribe(Subscriber<? super RecordsRetrieved> s) { subscriber = s; ++subscriptionTryCount; s.onSubscribe(new Subscription() { @Override public void request(long n) { if (subscriptionTryCount != 1) { send(n); } } @Override public void cancel() { requested = 0; } }); }
Source:
private Sequence<Row> mergeGroupByResults(final GroupByQuery query, QueryRunner<Row> runner) { Sequence<Row> result; DataSource dataSource = query.getDataSource(); if (dataSource instanceof QueryDataSource) { GroupByQuery subquery; try { subquery = (GroupByQuery) ((QueryDataSource) dataSource).getQuery(); } catch (ClassCastException e) { throw new UnsupportedOperationException("Subqueries must be of type 'group by'"); } Sequence<Row> subqueryResult = mergeGroupByResults(subquery, runner); final GroupByQuery.Builder builder = new GroupByQuery.Builder(subquery); for (PostAggregator postAggregator : subquery.getPostAggregatorSpecs()) { builder.addAggregator(new DoubleSumAggregatorFactory(postAggregator.getName(), postAggregator.getName())); } IncrementalIndexStorageAdapter adapter = new IncrementalIndexStorageAdapter(makeIncrementalIndex(builder.build(), subqueryResult)); result = engine.process(query, adapter); } else { result = runner.run(query); } return postAggregate(query, makeIncrementalIndex(query, result)); }

Target:
private Sequence<Row> mergeGroupByResults(final GroupByQuery query, QueryRunner<Row> runner) { final DataSource dataSource = query.getDataSource(); if (dataSource instanceof QueryDataSource) { GroupByQuery subquery; try { subquery = (GroupByQuery) ((QueryDataSource) dataSource).getQuery(); } catch (ClassCastException e) { throw new UnsupportedOperationException("Subqueries must be of type 'group by'"); } final Sequence<Row> subqueryResult = mergeGroupByResults(subquery, runner); final List<AggregatorFactory> aggs = Lists.newArrayList(); for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { aggs.addAll(aggregatorFactory.getRequiredColumns()); } final GroupByQuery innerQuery = new GroupByQuery.Builder(query) .setAggregatorSpecs(aggs) .setInterval(subquery.getIntervals()) .setPostAggregatorSpecs(Lists.<PostAggregator>newArrayList()) .build(); final GroupByQuery outerQuery = new GroupByQuery.Builder(query) .setLimitSpec(query.getLimitSpec().merge(subquery.getLimitSpec())) .build(); final IncrementalIndexStorageAdapter adapter = new IncrementalIndexStorageAdapter( makeIncrementalIndex(innerQuery, subqueryResult) ); return outerQuery.applyLimit(engine.process(outerQuery, adapter)); } else { return query.applyLimit(postAggregate(query, makeIncrementalIndex(query, runner.run(query)))); } }
Source:
public static void inspectTextFile() { String projectId = "my-project-id"; String filePath = "path/to/textfile.txt"; inspectTextFile(projectId, filePath); }

Target:
public static void inspectTextFile() { String projectId = "your-project-id"; String filePath = "path/to/file.txt"; inspectTextFile(projectId, filePath); }
Source:
private Object checkForCompositeRename(ExecutionEvent event) { ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { String newName= resource.getName().substring(0, resource.getName().lastIndexOf('.')) + 'a'; String placeHolderFileName= newName + '.' + resource.getFileExtension(); RenameResourceWizard refactoringWizard= new RenameResourceWizard(resource, placeHolderFileName); Change change= getChange(refactoringWizard); return isCompositeChange(change); } } return null; }

Target:
private Object checkForCompositeRename(ExecutionEvent event) { ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { String placeHolderFileName; if (resource.getFileExtension() != null) { String newName= resource.getName().substring(0, resource.getName().lastIndexOf('.')) + 'a'; placeHolderFileName= newName + '.' + resource.getFileExtension(); } else { placeHolderFileName= resource.getName() + 'a'; } RenameResourceWizard refactoringWizard= new RenameResourceWizard(resource, placeHolderFileName); Change change= getChange(refactoringWizard); return isCompositeChange(change); } } return null; }
Source:
private String getDateTimeFromTimeStamp(long timeStampMillis) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.XXX"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); return sdf.format(new Date(timeStampMillis)); }

Target:
private String getDateTimeFromTimeStamp(long timeStampMillis) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); return sdf.format(new Date(timeStampMillis)); }