auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testExpiredRequestAllocationOnAnyHost() throws Exception { MockClusterResourceManager spyManager = spy(new MockClusterResourceManager(callback, state)); spyAllocator = Mockito.spy( new ContainerAllocator(spyManager, config, state, false, Optional.empty())); spyAllocator.requestResources(new HashMap<String, String>() { { put("0", "abc"); put("1", "def"); } }); spyThread = new Thread(spyAllocator); spyThread.start(); Thread.sleep(20); assertEquals(state.preferredHostRequests.get(), 0); assertTrue(state.anyHostRequests.get() >= 2); assertTrue(state.expiredAnyHostRequests.get() >= 2); verify(spyAllocator, atLeastOnce()).handleExpiredRequestWithHostAffinityDisabled(eq("0"), any(SamzaResourceRequest.class)); verify(spyAllocator, atLeastOnce()).handleExpiredRequestWithHostAffinityDisabled(eq("1"), any(SamzaResourceRequest.class)); ArgumentCaptor<SamzaResourceRequest> cancelledRequestCaptor = ArgumentCaptor.forClass(SamzaResourceRequest.class); verify(spyManager, atLeast(2)).cancelResourceRequest(cancelledRequestCaptor.capture()); assertTrue(cancelledRequestCaptor.getAllValues() .stream() .map(resourceRequest -> resourceRequest.getPreferredHost()) .collect(Collectors.toSet()) .size() == 1); containerAllocator.stop(); }

Target:
public void testExpiredRequestAllocationOnAnyHost() throws Exception { MockClusterResourceManager spyManager = spy(new MockClusterResourceManager(callback, state)); spyAllocator = Mockito.spy( new ContainerAllocator(spyManager, config, state, false, Optional.empty())); spyAllocator.requestResources(new HashMap<String, String>() { { put("0", "host-0"); put("1", "host-1"); } }); spyThread = new Thread(spyAllocator); spyThread.start(); Thread.sleep(20); assertEquals(state.preferredHostRequests.get(), 0); assertTrue(state.anyHostRequests.get() >= 4); assertTrue(state.expiredAnyHostRequests.get() >= 2); verify(spyAllocator, atLeastOnce()).handleExpiredRequest(eq("0"), eq(ResourceRequestState.ANY_HOST), any(SamzaResourceRequest.class)); verify(spyAllocator, atLeastOnce()).handleExpiredRequest(eq("1"), eq(ResourceRequestState.ANY_HOST), any(SamzaResourceRequest.class)); ArgumentCaptor<SamzaResourceRequest> cancelledRequestCaptor = ArgumentCaptor.forClass(SamzaResourceRequest.class); verify(spyManager, atLeast(2)).cancelResourceRequest(cancelledRequestCaptor.capture()); assertTrue(cancelledRequestCaptor.getAllValues() .stream() .map(resourceRequest -> resourceRequest.getPreferredHost()) .collect(Collectors.toSet()) .size() == 1); containerAllocator.stop(); }
Source:
public static CoordinateReferenceSystem get( CRS crs ) { if ( crs == null || crs.getHref() == null ) { throw new IllegalArgumentException( "Invalid CRS: " + crs ); } else { return get(crs.getHref()); } }

Target:
public static CoordinateReferenceSystem get( CRS crs ) { Objects.requireNonNull( crs ); return get(crs.getHref()); }
Source:
public NetworkScan requestNetworkScan(int subId, NetworkScanRequest request, Executor executor, NetworkScanCallback callback, String callingPackage) { try { ITelephony telephony = getITelephony(); if (telephony != null) { int scanId; synchronized (mScanInfo) { scanId = telephony.requestNetworkScan( subId, request, mMessenger, new Binder(), callingPackage); if (scanId == INVALID_SCAN_ID) { Rlog.e(TAG, "Failed to initiate network scan"); return null; } saveScanInfo(scanId, request, executor, callback); return new NetworkScan(scanId, subId); } } } catch (RemoteException ex) { Rlog.e(TAG, "requestNetworkScan RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "requestNetworkScan NPE", ex); } return null; }

Target:
public NetworkScan requestNetworkScan(int subId, NetworkScanRequest request, Executor executor, NetworkScanCallback callback, String callingPackage) { try { ITelephony telephony = getITelephony(); if (telephony != null) { synchronized (mScanInfo) { int scanId = telephony.requestNetworkScan( subId, request, mMessenger, new Binder(), callingPackage); if (scanId == INVALID_SCAN_ID) { Rlog.e(TAG, "Failed to initiate network scan"); return null; } saveScanInfo(scanId, request, executor, callback); return new NetworkScan(scanId, subId); } } } catch (RemoteException ex) { Rlog.e(TAG, "requestNetworkScan RemoteException", ex); } catch (NullPointerException ex) { Rlog.e(TAG, "requestNetworkScan NPE", ex); } return null; }
Source:
public ClusterParticipant getClusterParticipant() throws IOException { if (clusterMapConfig == null) { throw new IllegalArgumentException( "Cluster participant creation requires the factory to be initialized with a non-null ClusterMapConfig"); } if (clusterParticipant == null) { clusterParticipant = new ClusterParticipant() { @Override public void initialize(String hostname, int port) throws Exception { } @Override public void terminate() { } }; } return clusterParticipant; }

Target:
public ClusterParticipant getClusterParticipant() throws IOException { if (clusterParticipant == null) { clusterParticipant = new ClusterParticipant() { @Override public void initialize(String hostname, int port) { } @Override public void close() { } }; } return clusterParticipant; }
Source:
public void resilientToRollingRestarts() { CassandraClientPool cassandraClientPool = clientPoolWithServersInCurrentPool(ImmutableSet.of(HOST_1, HOST_2)); AtomicReference<InetSocketAddress> downHost = new AtomicReference<>(HOST_1); cassandraClientPool.getCurrentPools().values().forEach(pool -> setConditionalTimeoutFailureForHost( pool, container -> container.getHost().equals(downHost.get()))); runNoopWithRetryOnHost(HOST_1, cassandraClientPool); assertThat(blacklist.contains(HOST_1), is(true)); downHost.set(HOST_2); runNoopWithRetryOnHost(HOST_1, cassandraClientPool); assertThat(blacklist.contains(HOST_1), is(false)); }

Target:
public void resilientToRollingRestarts() { CassandraClientPool cassandraClientPool = clientPoolWithServersInCurrentPool(ImmutableSet.of(HOST_1, HOST_2)); AtomicReference<InetSocketAddress> downHost = new AtomicReference<>(HOST_1); cassandraClientPool.getCurrentPools().values().forEach(pool -> setConditionalTimeoutFailureForHost( pool, container -> container.getHost().equals(downHost.get()))); runNoopWithRetryOnHost(HOST_1, cassandraClientPool); assertThat(blacklist.contains(HOST_1), is(true)); downHost.set(HOST_2); runNoopWithRetryOnHost(HOST_2, cassandraClientPool); assertThat(blacklist.contains(HOST_1), is(false)); }
Source:
public AxisAlignedBB getCollisionBoundingBox(IBlockState state) { EnumRailDirection dir = TrackTools.getTrackDirectionRaw(state); if (isGateOpen()) return null; double x = tileEntity.getPos().getX(); double y = tileEntity.getPos().getY(); double z = tileEntity.getPos().getZ(); if (dir == EnumRailDirection.NORTH_SOUTH) return AxisAlignedBB.fromBounds(x, y, z + 0.375F, z + 1, y + 1.5F, z + 0.625F); else return AxisAlignedBB.fromBounds(x, y, z + 0.625F, z + 1, y + 1.5F, z + 0.375F); }

Target:
public AxisAlignedBB getCollisionBoundingBox(IBlockState state) { EnumRailDirection dir = TrackTools.getTrackDirectionRaw(state); if (isGateOpen()) return null; AABBFactory factory = AABBFactory.make().createBoxForTileAt(getPos()).raiseCeiling(0.5); if (dir == EnumRailDirection.NORTH_SOUTH) return factory.expandZAxis(AABB_SHRINK).build(); else return factory.expandXAxis(AABB_SHRINK).build(); }
Source:
public SegmentProcessorConfig build() { Preconditions.checkNotNull(tableConfig, "Must provide table config in SegmentProcessorConfig"); Preconditions.checkNotNull(schema, "Must provide schema in SegmentProcessorConfig"); if (recordTransformerConfig == null) { recordTransformerConfig = new RecordTransformerConfig.Builder().build(); } if (recordFilterConfig == null) { recordFilterConfig = new RecordFilterConfig.Builder().build(); } if (partitioningConfig == null) { partitioningConfig = new PartitioningConfig.Builder().build(); } if (collectorConfig == null) { collectorConfig = new CollectorConfig.Builder().build(); } if (_segmentConfig == null) { _segmentConfig = new SegmentConfig.Builder().build(); } return new SegmentProcessorConfig(tableConfig, schema, recordTransformerConfig, recordFilterConfig, partitioningConfig, collectorConfig, _segmentConfig); }

Target:
public SegmentProcessorConfig build() { Preconditions.checkState(_tableConfig != null, "Must provide table config in SegmentProcessorConfig"); Preconditions.checkState(_schema != null, "Must provide schema in SegmentProcessorConfig"); if (_recordTransformerConfig == null) { _recordTransformerConfig = new RecordTransformerConfig.Builder().build(); } if (_recordFilterConfig == null) { _recordFilterConfig = new RecordFilterConfig.Builder().build(); } if (_partitionerConfig == null) { _partitionerConfig = new PartitionerConfig.Builder().build(); } if (_collectorConfig == null) { _collectorConfig = new CollectorConfig.Builder().build(); } if (_segmentConfig == null) { _segmentConfig = new SegmentConfig.Builder().build(); } return new SegmentProcessorConfig(_tableConfig, _schema, _recordTransformerConfig, _recordFilterConfig, _partitionerConfig, _collectorConfig, _segmentConfig); }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { request.setAttribute(MD5Attributes.ATTR_SELECTOR_SCRIPT.getAttributeKey(), getSelectorScriptName()); request.setAttribute(MD5Attributes.ATTR_STYLES.getAttributeKey(), brandingManager.getBrandingThemes()); request.setAttribute(MD5Attributes.ATTR_MESSAGES.getAttributeKey(), getBrandingMessages()); request.setAttribute(ATTR_THEME_PATH, ATTR_THEME_PATH); request.setAttribute(ATTR_DEFAULT_STYLE, "default.css"); request.setAttribute(MD5Attributes.ATTR_APPLICATION_TYPE.getAttributeKey(), getApplicationType()); VdcUser loggedInUser = getLoggedInUser(request.getSession().getId()); if (loggedInUser != null) { request.setAttribute(MD5Attributes.ATTR_USER_INFO.getAttributeKey(), getUserInfoObject(loggedInUser)); } try { String md5sum = getMd5Sum(request); if (request.getHeader(IF_NONE_MATCH_HEADER) != null && request.getHeader(IF_NONE_MATCH_HEADER).equals(md5sum)) { response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { RequestDispatcher dispatcher = request.getRequestDispatcher(HOST_JSP); response.setContentType(UTF_CONTENT_TYPE); response.addHeader(ETAG_HEADER, md5sum); if (dispatcher != null) { dispatcher.include(request, response); } } } catch (NoSuchAlgorithmException ex) { throw new ServletException(ex); } }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { request.setAttribute(MD5Attributes.ATTR_SELECTOR_SCRIPT.getKey(), getSelectorScriptName()); request.setAttribute(MD5Attributes.ATTR_STYLES.getKey(), brandingManager.getBrandingThemes()); request.setAttribute(MD5Attributes.ATTR_MESSAGES.getKey(), getBrandingMessages()); request.setAttribute(ATTR_THEME_PATH, "theme"); request.setAttribute(ATTR_DEFAULT_STYLE, "default.css"); request.setAttribute(MD5Attributes.ATTR_APPLICATION_TYPE.getKey(), getApplicationType()); VdcUser loggedInUser = getLoggedInUser(request.getSession().getId()); if (loggedInUser != null) { request.setAttribute(MD5Attributes.ATTR_USER_INFO.getKey(), getUserInfoObject(loggedInUser)); } try { String md5sum = getMd5Sum(request); if (request.getHeader(IF_NONE_MATCH_HEADER) != null && request.getHeader(IF_NONE_MATCH_HEADER).equals(md5sum)) { response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { RequestDispatcher dispatcher = request.getRequestDispatcher(HOST_JSP); response.setContentType(UTF_CONTENT_TYPE); response.addHeader(ETAG_HEADER, md5sum); if (dispatcher != null) { dispatcher.include(request, response); } } } catch (NoSuchAlgorithmException ex) { throw new ServletException(ex); } }
Source:
public boolean isCellEditable(int rowIndex, int columnIndex) { if (element.isEditable()) { try { Type fieldType = getMetadata().getFieldType(columnIndex); Constraint c = fieldType.getConstraint(Constraint.READONLY); return (fieldType.getTypeCode() != Type.RASTER) && (c == null); } catch (DriverException e) { return false; } } else { return false; } }

Target:
public boolean isCellEditable(int rowIndex, int columnIndex) { if (element.isEditable()) { try { Type fieldType = getMetadata().getFieldType(columnIndex); Constraint c = fieldType.getConstraint(Constraint.READONLY); return (fieldType.getTypeCode() != Type.RASTER) && (c == null); } catch (DriverException e) { LOGGER.warn(e.getLocalizedMessage(), e); return false; } } else { return false; } }
Source:
public CborObject toCbor() { Map<String, CborObject> cbor = new TreeMap<>(); cbor.put("p", new CborObject.CborString(path)); cbor.put("fp", fp.toCbor()); return CborObject.CborMap.build(cbor); }

Target:
public CborObject toCbor() { Map<String, CborObject> cbor = new TreeMap<>(); cbor.put("p", new CborObject.CborString(path)); cbor.put("c", cap.toCbor()); return CborObject.CborMap.build(cbor); }
Source:
public void test_of_String() { CurrencyAmount test = CurrencyAmount.of("USD", A1); assertEquals(test.getCurrency(), Currency.USD); assertEquals(test.getAmount(), A1, 0.0001d); }

Target:
public void test_of_String() { CurrencyAmount test = CurrencyAmount.of("USD", AMT1); assertEquals(test.getCurrency(), Currency.USD); assertEquals(test.getAmount(), AMT1, 0); }
Source:
public void loadConfiguration(IProgressMonitor monitor) { if (!fConfigured) { synchronized (this) { if (!fConfigured) { try { fMapping.clear(); for (MappingFile mf : TmfTraceManager.getInstance().getCurrentTraceContext().getMappingFiles()) { for (Map.Entry<String, String> entry : mf.getSymbolMapping().entrySet()) { if (!fMapping.containsKey(entry.getKey())) { fMapping.put(entry.getKey(), entry.getValue()); } } } } finally { fConfigured = true; } } } } }

Target:
public void loadConfiguration(IProgressMonitor monitor) { if (!fConfigured) { synchronized (this) { if (!fConfigured) { try { fMapping.clear(); for (MappingFile mf : TmfTraceManager.getInstance().getTraceContext(fTrace).getMappingFiles()) { for (Map.Entry<String, String> entry : mf.getSymbolMapping().entrySet()) { if (!fMapping.containsKey(entry.getKey())) { fMapping.put(entry.getKey(), entry.getValue()); } } } } finally { fConfigured = true; } } } } }
Source:
private CoverageReportAction generateCoverageReportAction( CoverageArgs args, ArgsFunc argsFunc, LocationFunc locationFunc) { ArtifactRoot root = args.directories().getBuildDataDirectory(args.workspaceName()); PathFragment coverageDir = TestRunnerAction.COVERAGE_TMP_ROOT; Artifact lcovOutput = args.factory().getDerivedArtifact( coverageDir.getRelative("_coverage_report.dat"), root, args.artifactOwner()); Artifact reportGeneratorExec = args.reportGenerator().getExecutable(); args = CoverageArgs.createCopyWithCoverageDirAndLcovOutput(args, coverageDir, lcovOutput); ImmutableList<String> actionArgs = argsFunc.apply(args); NestedSetBuilder<Artifact> inputsBuilder = NestedSetBuilder.stableOrder(); Iterable<Artifact> inputs = inputsBuilder .addAll(args.coverageArtifacts()) .add(reportGeneratorExec) .addTransitive( NestedSetBuilder.create(Order.STABLE_ORDER, args.reportGenerator().getRunfilesSupport().getRunfilesMiddleman())) .add(args.lcovArtifact()) .build(); return new CoverageReportAction( ACTION_OWNER, inputs, ImmutableList.of(lcovOutput), actionArgs, locationFunc.apply(args), !args.htmlReport(), args.reportGenerator().getRunfilesSupplier()); }

Target:
private CoverageReportAction generateCoverageReportAction( CoverageArgs args, ArgsFunc argsFunc, LocationFunc locationFunc) { ArtifactRoot root = args.directories().getBuildDataDirectory(args.workspaceName()); PathFragment coverageDir = TestRunnerAction.COVERAGE_TMP_ROOT; Artifact lcovOutput = args.factory().getDerivedArtifact( coverageDir.getRelative("_coverage_report.dat"), root, args.artifactOwner()); Artifact reportGeneratorExec = args.reportGenerator().getExecutable(); RunfilesSupport runfilesSupport = args.reportGenerator().getRunfilesSupport(); args = CoverageArgs.createCopyWithCoverageDirAndLcovOutput(args, coverageDir, lcovOutput); ImmutableList<String> actionArgs = argsFunc.apply(args); ImmutableList.Builder<Artifact> inputsBuilder = ImmutableList.<Artifact>builder() .addAll(args.coverageArtifacts()) .add(reportGeneratorExec) .add(args.lcovArtifact()); if (runfilesSupport != null) { inputsBuilder.add(runfilesSupport.getRunfilesMiddleman()); } return new CoverageReportAction( ACTION_OWNER, inputsBuilder.build(), ImmutableList.of(lcovOutput), actionArgs, locationFunc.apply(args), !args.htmlReport(), args.reportGenerator().getRunfilesSupplier()); }
Source:
public void fold(ColumnValueSelector selector) { boolean isCurrentValNull = selector.isNull(); if (!isCurrentValNull) { if (isNullResult) { isNullResult = false; } delegate.fold(selector); } }

Target:
public void fold(ColumnValueSelector selector) { boolean isNotNull = !selector.isNull(); if (isNotNull) { if (isNullResult) { isNullResult = false; } delegate.fold(selector); } }
Source:
public void generate() { genWrapperHeader(); append(IOUtils.LINE_SEPARATOR); append(" is").append(IOUtils.LINE_SEPARATOR); genWrapperVariables(); append(" begin").append(IOUtils.LINE_SEPARATOR); append(" "); genSpCallWithinWrapper(); append(";").append(IOUtils.LINE_SEPARATOR); assignOutputVariables(); genWrapperReturnStatement(); append(" end ").append(getWrapperName()).append(";").append(IOUtils.LINE_SEPARATOR); append(IOUtils.LINE_SEPARATOR); }

Target:
public void generate() { genWrapperHeader(); append("\n"); append(" is\n"); genWrapperVariables(); append(" begin\n"); append(" "); genSpCallWithinWrapper(); append(";\n"); assignOutputVariables(); genWrapperReturnStatement(); append(" end ").append(getWrapperName()).append(";\n"); append("\n"); }
Source:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.search_fragment, container, false); ((AppCompatActivity) getActivity()).setSupportActionBar(layout.findViewById(R.id.toolbar)); progressBar = layout.findViewById(R.id.progressBar); recyclerView = layout.findViewById(R.id.recyclerView); recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool()); recyclerView.setVisibility(View.GONE); adapter = new EpisodeItemListAdapter((MainActivity) getActivity()); recyclerView.setAdapter(adapter); RecyclerView recyclerViewFeeds = layout.findViewById(R.id.recyclerViewFeeds); LinearLayoutManager layoutManagerFeeds = new LinearLayoutManager(getActivity()); layoutManagerFeeds.setOrientation(RecyclerView.HORIZONTAL); recyclerViewFeeds.setLayoutManager(layoutManagerFeeds); adapterFeeds = new FeedSearchResultAdapter((MainActivity) getActivity()); recyclerViewFeeds.setAdapter(adapterFeeds); emptyViewHandler = new EmptyViewHandler(getContext()); emptyViewHandler.attachToRecyclerView(recyclerView); emptyViewHandler.setIcon(R.attr.action_search); emptyViewHandler.setTitle(R.string.search_status_no_results); EventBus.getDefault().register(this); chip = layout.findViewById(R.id.feed_title_chip); if ((getArguments().getLong(ARG_FEED) != 0) && !FEED_TITLE.isEmpty()) { chip.setText(FEED_TITLE); } else { chip.setVisibility(View.GONE); } return layout; }

Target:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.search_fragment, container, false); ((AppCompatActivity) getActivity()).setSupportActionBar(layout.findViewById(R.id.toolbar)); progressBar = layout.findViewById(R.id.progressBar); recyclerView = layout.findViewById(R.id.recyclerView); recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool()); recyclerView.setVisibility(View.GONE); adapter = new EpisodeItemListAdapter((MainActivity) getActivity()); recyclerView.setAdapter(adapter); RecyclerView recyclerViewFeeds = layout.findViewById(R.id.recyclerViewFeeds); LinearLayoutManager layoutManagerFeeds = new LinearLayoutManager(getActivity()); layoutManagerFeeds.setOrientation(RecyclerView.HORIZONTAL); recyclerViewFeeds.setLayoutManager(layoutManagerFeeds); adapterFeeds = new FeedSearchResultAdapter((MainActivity) getActivity()); recyclerViewFeeds.setAdapter(adapterFeeds); emptyViewHandler = new EmptyViewHandler(getContext()); emptyViewHandler.attachToRecyclerView(recyclerView); emptyViewHandler.setIcon(R.attr.action_search); emptyViewHandler.setTitle(R.string.search_status_no_results); EventBus.getDefault().register(this); chip = layout.findViewById(R.id.feed_title_chip); chip.setOnCloseIconClickListener(v -> { getArguments().putLong(ARG_FEED, 0); search(); }); return layout; }
Source:
public Map<String, List<Location>> getLocations(List<String> locations){ HttpClient httpClient = new DefaultHttpClient(); try { URIBuilder uri = new URIBuilder(url+SEARCH_API); for(String loc: locations){ uri.addParameter(SEARCH_PARAM, loc); } HttpGet httpGet = new HttpGet(uri.build()); HttpResponse resp = httpClient.execute(httpGet); String respJson = IOUtils.toString(resp.getEntity().getContent()); @SuppressWarnings("serial") Type typeDef = new TypeToken<Map<String, List<Location>>>(){}.getType(); return new Gson().fromJson(respJson, typeDef); } catch (Exception e) { LOG.severe(e.getMessage()); } return null; }

Target:
public Map<String, List<Location>> getLocations(List<String> locations){ HttpClient httpClient = new DefaultHttpClient(); try { URIBuilder uri = new URIBuilder(url+SEARCH_API); for(String loc: locations){ uri.addParameter(SEARCH_PARAM, loc); } HttpGet httpGet = new HttpGet(uri.build()); HttpResponse resp = httpClient.execute(httpGet); String respJson = IOUtils.toString(resp.getEntity().getContent(), Charsets.UTF_8); @SuppressWarnings("serial") Type typeDef = new TypeToken<Map<String, List<Location>>>(){}.getType(); return new Gson().fromJson(respJson, typeDef); } catch (Exception e) { LOG.severe(e.getMessage()); } return null; }
Source:
public void checkPreference() { if (preference==null){ SConfiguration config =EngineDriver.driver().getConfiguration(); int maxQuotedLines = config.getImportMaxQuotedColumnLines(); preference=new CsvPreference.Builder( characterDelimiter!=null && !characterDelimiter.isEmpty() ?characterDelimiter.charAt(0):DEFAULT_STRIP_STRING, columnDelimiter!=null && !columnDelimiter.isEmpty() ?columnDelimiter.charAt(0):DEFAULT_COLUMN_DELIMITTER, "\n").maxLinesPerRow(maxQuotedLines).build(); } }

Target:
protected void checkPreference() { if (preference==null){ SConfiguration config =EngineDriver.driver().getConfiguration(); int maxQuotedLines = config.getImportMaxQuotedColumnLines(); preference=new CsvPreference.Builder( characterDelimiter!=null && !characterDelimiter.isEmpty() ?characterDelimiter.charAt(0):DEFAULT_STRIP_STRING, columnDelimiter!=null && !columnDelimiter.isEmpty() ?columnDelimiter.charAt(0):DEFAULT_COLUMN_DELIMITTER, "\n").maxLinesPerRow(maxQuotedLines).build(); } }
Source:
public void setUp(){ testObjectContext = testPersistenceObjectFactory.createTestObjectContext(); enrichmentTags = testPersistenceObjectFactory.createEnrichmentTagsForJudgment(testObjectContext.getCcJudgmentId()); parametersExtractor.setMinPageSize(1); DumpEnrichmentTagController dumpEnrichmentTagController = new DumpEnrichmentTagController(); dumpEnrichmentTagController.setParametersExtractor(parametersExtractor); dumpEnrichmentTagController.setDatabaseSearchService(databaseSearchService); dumpEnrichmentTagController.setDumpEnrichmentTagsListSuccessRepresentationBuilder(dumpEnrichmentTagsListSuccessRepresentationBuilder); mockMvc = standaloneSetup(dumpEnrichmentTagController) .addInterceptors(new RestrictParamsHandlerInterceptor()) .build(); }

Target:
public void setUp(){ testObjectContext = testPersistenceObjectFactory.createTestObjectContext(); enrichmentTags = testPersistenceObjectFactory.createEnrichmentTagsForJudgment(testObjectContext.getCcJudgmentId()); DumpEnrichmentTagController dumpEnrichmentTagController = new DumpEnrichmentTagController(); dumpEnrichmentTagController.setParametersExtractor(parametersExtractor); dumpEnrichmentTagController.setDatabaseSearchService(databaseSearchService); dumpEnrichmentTagController.setDumpEnrichmentTagsListSuccessRepresentationBuilder(dumpEnrichmentTagsListSuccessRepresentationBuilder); mockMvc = standaloneSetup(dumpEnrichmentTagController) .addInterceptors(new RestrictParamsHandlerInterceptor()) .build(); }
Source:
public Result getCurrentRowState(Mutation m, Collection<? extends ColumnReference> columns, boolean ignoreNewerMutations) throws IOException { byte[] row = m.getRow(); Result r = results.get(new ImmutableBytesPtr(row)); if (r !=null) { return r; } Scan s = IndexManagementUtil.newLocalStateScan(Collections.singletonList(columns)); s.setStartRow(row); s.setStopRow(row); if (ignoreNewerMutations) { long ts = getOldestTimestamp(m.getFamilyCellMap().values()); s.setTimeRange(0,ts); } Region region = this.env.getRegion(); try (RegionScanner scanner = region.getScanner(s)) { List<Cell> kvs = new ArrayList<Cell>(1); boolean more = scanner.next(kvs); assert !more : "Got more than one result when scanning" + " a single row in the primary table!"; r = Result.create(kvs); return r; } }

Target:
public Result getCurrentRowState(Mutation m, Collection<? extends ColumnReference> columns, boolean ignoreNewerMutations) throws IOException { byte[] row = m.getRow(); Result r; if (results != null) { if (m.getAttribute(BaseScannerRegionObserver.REPLAY_WRITES) == null) { r = results.get(new ImmutableBytesPtr(row)); if (r == null) { List<Cell> kvs = new ArrayList<Cell>(1); r = Result.create(kvs); } return r; } } Scan s = IndexManagementUtil.newLocalStateScan(Collections.singletonList(columns)); s.setStartRow(row); s.setStopRow(row); if (ignoreNewerMutations) { long ts = getOldestTimestamp(m.getFamilyCellMap().values()); s.setTimeRange(0,ts); } Region region = this.env.getRegion(); try (RegionScanner scanner = region.getScanner(s)) { List<Cell> kvs = new ArrayList<Cell>(1); boolean more = scanner.next(kvs); assert !more : "Got more than one result when scanning" + " a single row in the primary table!"; r = Result.create(kvs); return r; } }
Source:
public PolymorphicScalarFunctionBuilder choice(Function<ChoiceBuilder, ChoiceBuilder> choiceSpecification) { ChoiceBuilder choiceBuilder = new ChoiceBuilder(clazz, signature); choiceSpecification.apply(choiceBuilder); PolymorphicScalarFunctionChoice choice = choiceBuilder.build(); choices.add(choice); return this; }

Target:
public PolymorphicScalarFunctionBuilder choice(Function<ChoiceBuilder, ChoiceBuilder> choiceSpecification) { ChoiceBuilder choiceBuilder = new ChoiceBuilder(clazz, signature); choiceSpecification.apply(choiceBuilder); choices.add(choiceBuilder.build()); return this; }
Source:
public Object execute(ExecutionEvent executionEvent) { final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(executionEvent); if (window == null) { return null; } if (!((WorkbenchWindow) window).isToolbarVisible()) { displayQuickAccessDialog(window, executionEvent.getCommand()); return null; } MWindow mWindow = ((WorkbenchWindow) window).getModel(); EModelService modelService = mWindow.getContext().get(EModelService.class); MToolControl searchField = (MToolControl) modelService.find("SearchField", mWindow); if (searchField == null) { displayQuickAccessDialog(window, executionEvent.getCommand()); return null; } Control control = (Control) searchField.getWidget(); if (((WorkbenchWindow) window).isToolbarVisible() && control != null) { Control previousFocusControl = control.getDisplay().getFocusControl(); control.setFocus(); SearchField field = (SearchField) searchField.getObject(); field.activate(previousFocusControl); } return null; }

Target:
public Object execute(ExecutionEvent executionEvent) { final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(executionEvent); if (window == null) { return null; } MWindow mWindow = ((WorkbenchWindow) window).getModel(); EModelService modelService = mWindow.getContext().get(EModelService.class); MToolControl searchField = (MToolControl) modelService.find("SearchField", mWindow); if (searchField == null || !searchField.isVisible() || !((WorkbenchWindow) window).isToolbarVisible()) { displayQuickAccessDialog(window, executionEvent.getCommand()); return null; } Control control = (Control) searchField.getWidget(); if (((WorkbenchWindow) window).isToolbarVisible() && control != null) { Control previousFocusControl = control.getDisplay().getFocusControl(); control.setFocus(); SearchField field = (SearchField) searchField.getObject(); field.activate(previousFocusControl); } return null; }
Source:
public void handleRequest(HttpServerExchange serverExchange) throws Exception { String originalTenantName = getTenantName(serverExchange); if (originalTenantName == null || originalTenantName.startsWith("_")) { containerHandler.handleRequest(serverExchange); } else { String namespaceName = ""; String[] splitted = originalTenantName.split(","); for (int i=0; i<splitted.length; i++) { String namespaceID = namespaceListener.getNamespaceId(splitted[i]); if (namespaceID != null) { String tenantName; if (projectOverwrites.containsKey(namespaceID)) { tenantName = projectOverwrites.get(namespaceID); } else { tenantName = splitted[i] + ":" + namespaceID; } if (i < splitted.length - 1) { tenantName += ","; } namespaceName += tenantName; } else { log.error("Could not determine a namespace id for namespace " + namespaceID + ". Cannot process request. Returning an INTERNAL_SERVER_ERROR."); Utils.endExchange(serverExchange, INTERNAL_SERVER_ERROR); return; } } serverExchange.getRequestHeaders().remove(HAWKULAR_TENANT_HEADER_NAME); serverExchange.getRequestHeaders().put(new HttpString(HAWKULAR_TENANT_HEADER_NAME), namespaceName); containerHandler.handleRequest(serverExchange); } }

Target:
public void handleRequest(HttpServerExchange serverExchange) throws Exception { String originalTenantName = getTenantName(serverExchange); if (originalTenantName == null || originalTenantName.startsWith("_")) { containerHandler.handleRequest(serverExchange); } else { StringJoiner namespaceName = new StringJoiner(","); String[] splitted = originalTenantName.split(","); for (String namespace: originalTenantName.split(",")) { String namespaceID = namespaceListener.getNamespaceId(namespace); if (namespaceID != null) { String tenantName; if (projectOverwrites.containsKey(namespaceID)) { tenantName = projectOverwrites.get(namespaceID); } else { tenantName = namespace + ":" + namespaceID; } namespaceName.add(tenantName); } else { log.info("Could not determine a namespace id for namespace " + namespaceID + ". Cannot process request. Returning an INTERNAL_SERVER_ERROR."); Utils.endExchange(serverExchange, INTERNAL_SERVER_ERROR, "Could not determine a namespace id for namespace " + namespaceID); return; } } serverExchange.getRequestHeaders().remove(HAWKULAR_TENANT_HEADER_NAME); serverExchange.getRequestHeaders().put(new HttpString(HAWKULAR_TENANT_HEADER_NAME), namespaceName.toString()); containerHandler.handleRequest(serverExchange); } }
Source:
private void checkAppTarget() throws UnfullfilledRequirementsException { SharedPreferences prefs = CommCareApp.currentSandbox.getAppPreferences(); if (prefs.contains(KEY_TARGET_PACKAGE_ID)) { String targetPackage = prefs.getString(KEY_TARGET_PACKAGE_ID, ""); if (!StringUtils.isEmpty(targetPackage)) { String myAppPackage = CommCareApplication.instance().getPackageName(); if (!myAppPackage.contentEquals(targetPackage)) { throw new UnfullfilledRequirementsException( "Your app doesn't match with this commcare flavour", UnfullfilledRequirementsException.RequirementType.INCORRECT_TARGET_PACKAGE); } } } }

Target:
private void checkAppTarget() throws UnfullfilledRequirementsException { SharedPreferences prefs = CommCareApp.currentSandbox.getAppPreferences(); if (prefs.contains(KEY_TARGET_PACKAGE_ID)) { String targetPackage = prefs.getString(KEY_TARGET_PACKAGE_ID, ""); if (!StringUtils.isEmpty(targetPackage)) { String myAppPackage = CommCareApplication.instance().getPackageName(); if (!myAppPackage.contentEquals(targetPackage)) { String error = "This app requires " + (targetPackage.contentEquals("org.commcare.lts") ? "Commcare LTS" : "Regular Commcare (Non LTS)") + " to be installed"; throw new UnfullfilledRequirementsException( error, UnfullfilledRequirementsException.RequirementType.INCORRECT_TARGET_PACKAGE); } } } }
Source:
public static byte[] parseHex(String string) { try { return Hex.decodeHex(string.toCharArray()); } catch (DecoderException e) { throw new RuntimeException(e); } }

Target:
public static byte[] parseHex(String string) { try { return Hex.decodeHex(string); } catch (DecoderException e) { throw new RuntimeException(e); } }
Source:
private TitleAreaFilterDialogWithEmptyOptions createEObjectAttributePicker(final String title) { final HashSet<String> set = new HashSet<String>(); Collection<EObject> allEObjects = getAllEObjects(); for (EObject obj : allEObjects) { for (EAttribute attribute : obj.eClass().getEAllAttributes()) { set.add(attribute.getName()); } } final ArrayList<String> sorted = new ArrayList<String>(set); Collections.sort(sorted); ILabelProvider renderer = new LabelProvider() { @Override public String getText(Object element) { return String.valueOf(element); } }; TitleAreaFilterDialogWithEmptyOptions dlg = new TitleAreaFilterDialogWithEmptyOptions(context.get(Shell.class), renderer) { @Override protected Control createContents(Composite parent) { Control ret = super.createContents(parent); setMessage("Select an attribute"); try { setTitleImage(new Image(getShell().getDisplay(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/wizban/attribute_wiz.gif").openStream())); } catch (Exception e) { e.printStackTrace(); } setTitle(title); setElements(sorted.toArray(new String[0])); return ret; } }; return dlg; }

Target:
private TitleAreaFilterDialogWithEmptyOptions createEObjectAttributePicker(final String title) { final HashSet<String> set = new HashSet<String>(); Collection<EObject> allEObjects = getAllEObjects(); for (EObject obj : allEObjects) { for (EAttribute attribute : obj.eClass().getEAllAttributes()) { set.add(attribute.getName()); } } final ArrayList<String> sorted = new ArrayList<String>(set); Collections.sort(sorted); ILabelProvider renderer = new LabelProvider() { @Override public String getText(Object element) { return String.valueOf(element); } }; TitleAreaFilterDialogWithEmptyOptions dlg = new TitleAreaFilterDialogWithEmptyOptions(context.get(Shell.class), renderer) { @Override protected Control createContents(Composite parent) { Control ret = super.createContents(parent); setMessage("Select an attribute"); try { setTitleImage(imageCache.create("org.eclipse.e4.tools.emf.ui", "/icons/full/wizban/attribute_wiz.gif")); } catch (Exception e) { e.printStackTrace(); } setTitle(title); setElements(sorted.toArray(new String[0])); return ret; } }; return dlg; }
Source:
private boolean originalFileUsedInFurtherBatches(String originalFile, List<VersionOnePartialDownloadBatch> partialDownloadBatches, List<CompletedDownloadBatch> completeDownloadBatches) { for (VersionOnePartialDownloadBatch partialDownloadBatch : partialDownloadBatches) { for (String originalFileLocation : partialDownloadBatch.originalFileLocations()) { if (originalFileLocation.equals(originalFile)) { return true; } } } for (CompletedDownloadBatch completeDownloadBatch : completeDownloadBatches) { for (CompletedDownloadFile completedDownloadFile : completeDownloadBatch.completedDownloadFiles()) { if (completedDownloadFile.originalFileLocation().equals(originalFile)) { return true; } } } return false; }

Target:
private boolean originalFileUsedInFurtherBatches(String originalFile, List<VersionOnePartialDownloadBatch> partialDownloadBatches, List<CompletedDownloadBatch> completeDownloadBatches) { for (VersionOnePartialDownloadBatch partialDownloadBatch : partialDownloadBatches) { if (partialDownloadBatch.originalFileLocations().contains(originalFile)) { return true; } } for (CompletedDownloadBatch completeDownloadBatch : completeDownloadBatches) { for (CompletedDownloadFile completedDownloadFile : completeDownloadBatch.completedDownloadFiles()) { if (completedDownloadFile.originalFileLocation().equals(originalFile)) { return true; } } } return false; }
Source:
protected CorrelationData generateCorrelationData(Message<?> requestMessage) { CorrelationData correlationData = null; if (this.correlationDataGenerator != null) { UUID messageId = requestMessage.getHeaders().getId(); if (messageId == null) { messageId = NO_ID; } Object userData = this.correlationDataGenerator.processMessage(requestMessage); if (userData != null) { correlationData = new CorrelationDataWrapper(messageId.toString(), userData, requestMessage); } } return correlationData; }

Target:
protected CorrelationData generateCorrelationData(Message<?> requestMessage) { CorrelationData correlationData = null; if (this.correlationDataGenerator != null) { UUID messageId = requestMessage.getHeaders().getId(); if (messageId == null) { messageId = NO_ID; } Object userData = this.correlationDataGenerator.processMessage(requestMessage); if (userData != null) { correlationData = new CorrelationDataWrapper(messageId.toString(), userData, requestMessage); } else { this.logger.debug("'confirmCorrelationExpression' resolved to 'null'; " + "no publisher confirm will be sent to the ack or nack channel"); } } return correlationData; }
Source:
public void shutdown(ShutdownInput shutDownInput) { if (shutDownInput.getShutdownReason().equals(ShutdownReason.TERMINATE)) { commitCheckPoint(shutDownInput.getCheckpointer()); } }

Target:
public void shutdown(ShutdownInput shutDownInput) { if (ShutdownReason.TERMINATE.equals(shutDownInput.getShutdownReason())) { commitCheckPoint(shutDownInput.getCheckpointer()); } }
Source:
public void createWithHistory(DocumentRevision revision, int revisionsStart, List<String> revisionsIDs) throws DocumentException { Map<String, Attachment> attachments = revision.getAttachments(); Collections.list(Collections.enumeration(revision.getAttachments().values())); InternalDocumentRevision internalRev = new DocumentRevisionBuilder() .setDocId(revision.getId()) .setRevId(revision.getRevision()) .setBody(revision.getBody()) .setAttachments(attachments) .setDeleted(revision.isDeleted()) .build(); Map<String[], Map<String, PreparedAttachment>> preparedAttachments = Collections .singletonMap (new String[]{revision.getId(), revision.getRevision()}, AttachmentManager .prepareAttachments(attachmentsDir, attachmentStreamFactory, attachments)); Map<String, Object> attachmentsMetadata = new HashMap<String, Object>(); attachmentsMetadata.putAll(revision.getAttachments()); Map<String, Object> revisions = new HashMap<String, Object>(2); revisions.put("start", revisionsStart); revisions.put("ids", Collections.list(Collections.enumeration(revisionsIDs))); List<String> revIDs = CouchUtils.parseCouchDBRevisionHistory(Collections.<String, Object> singletonMap(CouchConstants._revisions, revisions)); Collections.reverse(revIDs); forceInsert(Collections.singletonList(new ForceInsertItem(internalRev, revIDs, attachmentsMetadata, preparedAttachments, false))); }

Target:
public void createWithHistory(DocumentRevision revision, int revisionsStart, List<String> revisionsIDs) throws DocumentException { Misc.checkNotNull(revision, "DocumentRevision"); Misc.checkArgument(revisionsStart > 0, "revisionsStart must be greater than zero, but was" + " " + revisionsStart + "."); Misc.checkArgument(revisionsIDs != null && revisionsIDs.size() > 0, "revisionsIDs history" + " list must not be null or empty."); Map<String, Attachment> attachments = revision.getAttachments(); Collections.list(Collections.enumeration(revision.getAttachments().values())); InternalDocumentRevision internalRev = new DocumentRevisionBuilder() .setDocId(revision.getId()) .setRevId(revision.getRevision()) .setBody(revision.getBody()) .setAttachments(attachments) .setDeleted(revision.isDeleted()) .build(); Map<String[], Map<String, PreparedAttachment>> preparedAttachments = Collections .singletonMap (new String[]{revision.getId(), revision.getRevision()}, AttachmentManager .prepareAttachments(attachmentsDir, attachmentStreamFactory, attachments)); List<String> revIDs = CouchUtils.couchStyleRevisionHistoryToFullRevisionIDs (revisionsStart, revisionsIDs); forceInsert(Collections.singletonList(new ForceInsertItem(internalRev, revIDs, null, preparedAttachments, false))); }
Source:
private DispatcherJob( CompletableFuture<JobManagerRunner> jobManagerRunnerFuture, JobID jobId, String jobName) { this.jobManagerRunnerFuture = jobManagerRunnerFuture; this.jobId = jobId; this.jobName = jobName; this.initializationTimestamp = System.currentTimeMillis(); this.jobResultFuture = new CompletableFuture<>(); FutureUtils.assertNoException(this.jobManagerRunnerFuture.handle((jobManagerRunner, throwable) -> { synchronized (lock) { if (jobStatus != DispatcherJobStatus.CANCELLING) { jobStatus = DispatcherJobStatus.JOB_MANAGER_RUNNER_INITIALIZED; } if (throwable == null) { jobManagerRunner.getResultFuture().whenComplete((archivedExecutionGraph, resultThrowable) -> { if (archivedExecutionGraph != null) { jobResultFuture.complete(DispatcherJobResult.forSuccess(archivedExecutionGraph)); } else { jobResultFuture.completeExceptionally(ExceptionUtils.stripCompletionException(resultThrowable)); } }); } else { final Throwable strippedThrowable = ExceptionUtils.stripCompletionException(throwable); ArchivedExecutionGraph archivedExecutionGraph = ArchivedExecutionGraph.createFromInitializingJob( jobId, jobName, JobStatus.FAILED, strippedThrowable, initializationTimestamp); jobResultFuture.complete(DispatcherJobResult.forInitializationFailure(archivedExecutionGraph, strippedThrowable)); } } return null; })); }

Target:
private DispatcherJob( CompletableFuture<JobManagerRunner> jobManagerRunnerFuture, JobID jobId, String jobName) { this.jobManagerRunnerFuture = jobManagerRunnerFuture; this.jobId = jobId; this.jobName = jobName; this.initializationTimestamp = System.currentTimeMillis(); this.jobResultFuture = new CompletableFuture<>(); FutureUtils.assertNoException(this.jobManagerRunnerFuture.handle((jobManagerRunner, throwable) -> { synchronized (lock) { jobStatus = DispatcherJobStatus.JOB_MANAGER_RUNNER_INITIALIZED; if (throwable == null) { jobManagerRunner.getResultFuture().whenComplete((archivedExecutionGraph, resultThrowable) -> { if (archivedExecutionGraph != null) { jobResultFuture.complete(DispatcherJobResult.forSuccess(archivedExecutionGraph)); } else { jobResultFuture.completeExceptionally(ExceptionUtils.stripCompletionException(resultThrowable)); } }); } else { final Throwable strippedThrowable = ExceptionUtils.stripCompletionException(throwable); ArchivedExecutionGraph archivedExecutionGraph = ArchivedExecutionGraph.createFromInitializingJob( jobId, jobName, JobStatus.FAILED, strippedThrowable, initializationTimestamp); jobResultFuture.complete(DispatcherJobResult.forInitializationFailure(archivedExecutionGraph, strippedThrowable)); } } return null; })); }
Source:
public CustomEntryTypeViewModel(BibEntryType entryType) { this.entryType.set(entryType); List<FieldViewModel> allFieldsForType = entryType.getAllFields().stream().map(bibField -> new FieldViewModel(bibField.getField(), entryType.isRequired(bibField.getField()), bibField.getPriority(), entryType)).collect(Collectors.toList()); fields = new SimpleListProperty<>(FXCollections.observableArrayList(allFieldsForType)); fields.addListener((ListChangeListener<? super FieldViewModel>) change -> { while (change.next()) { if (change.wasRemoved()) { fieldsToRemove.addAll(change.getAddedSubList()); } } }); }

Target:
public CustomEntryTypeViewModel(BibEntryType entryType) { this.entryType.set(entryType); List<FieldViewModel> allFieldsForType = entryType.getAllBibFields().stream().map(bibField -> new FieldViewModel(bibField.getField(), entryType.isRequired(bibField.getField()), bibField.getPriority())).collect(Collectors.toList()); fields = FXCollections.observableArrayList((allFieldsForType)); }
Source:
public void addAllReviewers(ChangeAttribute a, Change change) throws OrmException { ResultSet<PatchSetApproval> approvals = db.get().patchSetApprovals().byChange(change.getId()); if (approvals.iterator().hasNext()) { a.allReviewers = Lists.newArrayList(); ArrayList<Object> accountIdlist = Lists.newArrayList(); for (PatchSetApproval psa : approvals) { Account.Id accountId = psa.getAccountId(); if (!accountIdlist.contains(accountId)) { accountIdlist.add(accountId); a.allReviewers.add(asAccountAttribute(psa.getAccountId())); } } } }

Target:
public void addAllReviewers(ChangeAttribute a, Change change) throws OrmException { ResultSet<PatchSetApproval> approvals = db.get().patchSetApprovals().byChange(change.getId()); a.allReviewers = Lists.newArrayList(); Set<Account.Id> accountIdlist = new HashSet<Account.Id>(); for (PatchSetApproval psa : approvals) { Account.Id accountId = psa.getAccountId(); if (!accountIdlist.contains(accountId)) { accountIdlist.add(accountId); a.allReviewers.add(asAccountAttribute(psa.getAccountId())); } } if (a.allReviewers.isEmpty()) { a.allReviewers = null; } }
Source:
public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(37, 7) .append(super.hashCode()) .append(this.getId()) .append(this.getName()) .append(this.getDescription()) .append(this.getOwner() != null ? this.getOwner().getId() : null) .append(this.getReleaseVer()) .append(this.getServiceLevel()) .append(this.isAutoAttach()) .append(this.getPools()) .append(this.getProducts()); return builder.toHashCode(); }

Target:
public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(7, 17) .append(this.id); return builder.toHashCode(); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { final RepositoryTreeNode node = getSelectedNodes(event).get(0); final Ref baseBranch; if (node.getObject() instanceof Ref) { baseBranch = (Ref) node.getObject(); } else { baseBranch = null; } Wizard wiz = new Wizard() { @Override public void addPages() { addPage(new CreateBranchPage(node.getRepository(), baseBranch)); setWindowTitle(UIText.RepositoriesView_NewBranchTitle); } @Override public boolean performFinish() { try { getContainer().run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { CreateBranchPage cp = (CreateBranchPage) getPages()[0]; try { cp.createBranch(monitor); } catch (CoreException ce) { throw new InvocationTargetException(ce); } catch (IOException ioe) { throw new InvocationTargetException(ioe); } } }); } catch (InvocationTargetException ite) { Activator .handleError( UIText.RepositoriesView_BranchCreationFailureMessage, ite.getCause(), true); return false; } catch (InterruptedException ie) { } return true; } }; new WizardDialog(getView(event).getSite().getShell(), wiz).open(); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { final RepositoryTreeNode node = getSelectedNodes(event).get(0); final Ref baseBranch; if (node.getObject() instanceof Ref) baseBranch = (Ref) node.getObject(); else baseBranch = null; Wizard wiz = new Wizard() { @Override public void addPages() { addPage(new CreateBranchPage(node.getRepository(), baseBranch)); setWindowTitle(UIText.RepositoriesView_NewBranchTitle); } @Override public boolean performFinish() { try { getContainer().run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { CreateBranchPage cp = (CreateBranchPage) getPages()[0]; try { cp.createBranch(monitor); } catch (CoreException ce) { throw new InvocationTargetException(ce); } catch (IOException ioe) { throw new InvocationTargetException(ioe); } } }); } catch (InvocationTargetException ite) { Activator .handleError( UIText.RepositoriesView_BranchCreationFailureMessage, ite.getCause(), true); return false; } catch (InterruptedException ie) { } return true; } }; new WizardDialog(getView(event).getSite().getShell(), wiz).open(); return null; }