auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String rolesToJson ( List<Role> roles, boolean includeFake, boolean includeLabelAll ) throws IOException, DotDataException, LanguageException { ObjectMapper mapper = new ObjectMapper(); mapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false ); Map<String, Object> m = new LinkedHashMap<String, Object>(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> map = null; if(includeFake) { map = new HashMap<>(); map.put( "name", "" ); map.put( "id", 0 ); list.add( map ); } if(includeLabelAll) { map = new HashMap<>(); map.put( "name", "All" ); map.put( "id", "" ); list.add( map ); } User defaultUser = APILocator.getUserAPI().getDefaultUser(); Role defaultUserRole = null; if ( defaultUser != null ) { defaultUserRole = APILocator.getRoleAPI().getUserRole( defaultUser ); } for ( Role role : roles ) { map = new HashMap<String, Object>(); if ( defaultUserRole != null && role.getId().equals( defaultUserRole.getId() ) ) { continue; } if ( !role.isEditPermissions() ) { continue; } if ( role.getName().contains( "anonymous user" ) ) { continue; } map.put( "name", role.getName() + ((role.isUser()) ? " (" + LanguageUtil.get( PublicCompanyFactory.getDefaultCompany(), "User" ) + ")" : "")); map.put( "id", role.getId() ); list.add( map ); } m.put( "identifier", "id" ); m.put( "label", "name" ); m.put( "items", list ); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString( m ); }

Target:
private String rolesToJson ( List<Role> roles, boolean includeFake, boolean includeLabelAll ) throws IOException, DotDataException, LanguageException { ObjectMapper mapper = new ObjectMapper(); mapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false ); Map<String, Object> m = new LinkedHashMap<String, Object>(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> map = null; if(includeFake) { map = new HashMap<>(); map.put( "name", StringPool.BLANK ); map.put( "id", 0 ); list.add( map ); } if(includeLabelAll) { map = new HashMap<>(); map.put( "name", "All" ); map.put( "id", StringPool.BLANK); list.add( map ); } User defaultUser = APILocator.getUserAPI().getDefaultUser(); Role defaultUserRole = null; if ( defaultUser != null ) { defaultUserRole = APILocator.getRoleAPI().getUserRole( defaultUser ); } for ( Role role : roles ) { map = new HashMap<String, Object>(); if ( defaultUserRole != null && role.getId().equals( defaultUserRole.getId() ) ) { continue; } if ( !role.isEditPermissions() ) { continue; } if ( role.getName().contains( "anonymous user" ) ) { continue; } map.put( "name", role.getName() + ((role.isUser()) ? " (" + LanguageUtil.get( PublicCompanyFactory.getDefaultCompany(), "User" ) + ")" : "")); map.put( "id", role.getId() ); list.add( map ); } m.put( "identifier", "id" ); m.put( "label", "name" ); m.put( "items", list ); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString( m ); }
Source:
public void testWrongCtrlTaskId() { final ILPSolverOptimizer wrongCtrlIlpSolverOptimizer = new ILPSolverOptimizer("##WRONG_CONTROLLER_TASK_ID##"); final int availableEvaluators = 4; final Collection<EvaluatorParameters> activeEvaluators = generateEvaluatorParameters( new int[][]{{100, 50}, {100, 100}}, 50D); final Plan plan = wrongCtrlIlpSolverOptimizer.optimize(activeEvaluators, availableEvaluators); checkPlan(activeEvaluators, plan, availableEvaluators); assertEquals("The plan should be empty", 0, plan.getEvaluatorsToAdd().size()); assertEquals("The plan should be empty", 0, plan.getEvaluatorsToDelete().size()); assertEquals("The plan should be empty", 0, plan.getTransferSteps().size()); }

Target:
public void testWrongCtrlTaskId() throws InjectionException { final CtrlTaskContextIdFetcher mockFetcher = mock(CtrlTaskContextIdFetcher.class); when(mockFetcher.getCtrlTaskContextId()).thenReturn(Optional.of("##WRONG_CONTROLLER_TASK_ID##")); final Injector injector = Tang.Factory.getTang().newInjector(); injector.bindVolatileInstance(CtrlTaskContextIdFetcher.class, mockFetcher); final ILPQuickOptimizer wrongCtrlIlpQuickerOptimizer = injector.getInstance(ILPQuickOptimizer.class); final int availableEvaluators = 4; final Collection<EvaluatorParameters> activeEvaluators = generateEvaluatorParameters( new int[][]{{100, 50}, {100, 100}}, 50D); final Plan plan = wrongCtrlIlpQuickerOptimizer.optimize(activeEvaluators, availableEvaluators); checkPlan(activeEvaluators, plan, availableEvaluators); assertEquals("The plan should be empty", 0, plan.getEvaluatorsToAdd().size()); assertEquals("The plan should be empty", 0, plan.getEvaluatorsToDelete().size()); assertEquals("The plan should be empty", 0, plan.getTransferSteps().size()); }
Source:
public void deleteWorkflowGroups(Collection collection) throws Exception { try (Context c = new Context()) { c.turnOffAuthorisationSystem(); Group defaultItemReadGroup = groupService.findByName(c, "COLLECTION_" + collection.getID().toString() + "_ITEM_DEFAULT_READ"); Group defaultBitstreamReadGroup = groupService.findByName(c, "COLLECTION_" + collection.getID().toString() + "_BITSTREAM_DEFAULT_READ"); if (defaultItemReadGroup != null) { groupService.delete(c, defaultItemReadGroup); } if (defaultBitstreamReadGroup != null) { groupService.delete(c, defaultBitstreamReadGroup); } for (int i = 1; i <= 3; i++) { Group g = collectionService.getWorkflowGroup(c, collection, i); if (g != null) { Group attachedDso = c.reloadEntity(g); if (attachedDso != null) { collectionService.setWorkflowGroup(c, collection, i, null); groupService.delete(c, attachedDso); } } } c.complete(); } indexingService.commit(); }

Target:
public void deleteWorkflowGroups(Collection collection) throws Exception { try (Context c = new Context()) { c.turnOffAuthorisationSystem(); for (int i = 1; i <= 3; i++) { Group g = collectionService.getWorkflowGroup(c, collection, i); if (g != null) { Group attachedDso = c.reloadEntity(g); if (attachedDso != null) { collectionService.setWorkflowGroup(c, collection, i, null); groupService.delete(c, attachedDso); } } } c.complete(); } }
Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { final MainActivity activity = (MainActivity) getActivity(); Bundle arguments = getArguments(); final Uri uri = arguments.getParcelable(EXTRA_URI); return new AlertDialog.Builder(activity, R.style.PocketPaintAlertDialog) .setTitle(R.string.menu_new_image) .setMessage(R.string.dialog_warning_new_image) .setCancelable(true) .setPositiveButton(R.string.save_button_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { MainActivityContracts.Presenter presenter = activity.getPresenter(); presenter.checkPermissionAndForward(PERMISSION_EXTERNAL_STORAGE_SAVE_CONFIRMED_NEW_IMAGE, uri); } }) .setNegativeButton(R.string.discard_button_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { MainActivityContracts.Presenter presenter = activity.getPresenter(); presenter.chooseNewImage(); } }) .create(); }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { final MainActivity activity = (MainActivity) getActivity(); Bundle arguments = getArguments(); final int requestCode = arguments.getInt(EXTRA_REQUEST); final Uri uri = arguments.getParcelable(EXTRA_URI); return new AlertDialog.Builder(activity, R.style.PocketPaintAlertDialog) .setTitle(R.string.menu_new_image) .setMessage(R.string.dialog_warning_new_image) .setCancelable(true) .setPositiveButton(R.string.save_button_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { MainActivityContracts.Presenter presenter = activity.getPresenter(); presenter.checkPermissionAndForward(requestCode, uri); } }) .setNegativeButton(R.string.discard_button_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { MainActivityContracts.Presenter presenter = activity.getPresenter(); presenter.chooseNewImage(); } }) .create(); }
Source:
public void fixedDelayTest() throws InterruptedException { Thread.sleep(2100); assertEquals(1, messageCollector.forChannel(triggerSource.output()).size()); messageCollector.forChannel(triggerSource.output()).take().getPayload().equals("test"); }

Target:
public void fixedDelayTest() throws InterruptedException { assertTrue(messageCollector.forChannel(triggerSource.output()).poll(2100, TimeUnit.MILLISECONDS).getPayload().equals("test")); }
Source:
public Boolean tryAdd(final T object) { if (object == null) { throw logger.logExceptionAsWarning(new IllegalArgumentException("object cannot be null")); } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); return objectSerializer.serialize(outputStream, object).map(s -> { EventData eventData = new EventData(s.toByteArray()); EventData event = tracerProvider.isEnabled() ? traceMessageSpan(eventData) : eventData; return tryAdd(event); }).block(); }

Target:
public Mono<Boolean> tryAdd(final T object) { if (object == null) { return monoError(logger, new IllegalArgumentException("object cannot be null")); } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); return serializer.serialize(outputStream, object).map(s -> tryAdd(new EventData(s.toByteArray()))); }
Source:
public void shouldWriteErrorsToCustomFileWhenConfigured() throws IOException { File customBoltLogFile = customBoltLogFile(); db.setConfig( bolt_logging_enabled, TRUE ); db.setConfig( bolt_log_filename, customBoltLogFile.toString() ); db.ensureStarted(); try { driver = newDriver(); } catch ( Exception e ) { String contents = readFile( customBoltLogFile ); System.out.println( contents ); assertThat( contents, containsString( "S: FAILURE" ) ); } assertTrue( fs.fileExists( customBoltLogFile ) ); String query = "RETURN 1 as 2"; try ( Session session = driver.session() ) { session.run( query ).consume(); fail( "Should have failed" ); } catch ( Exception e ) { String contents = readFile( customBoltLogFile ); assertThat( contents, containsString( "S FAILURE" ) ); } }

Target:
public void shouldWriteErrorsToCustomFileWhenConfigured() throws IOException { File customBoltLogFile = customBoltLogFile(); db.setConfig( bolt_logging_enabled, TRUE ); db.setConfig( bolt_log_filename, customBoltLogFile.toString() ); db.ensureStarted(); driver = newDriver(); assertTrue( fs.fileExists( customBoltLogFile ) ); String query = "RETURN 1 as 2"; try ( Session session = driver.session() ) { session.run( query ).consume(); fail( "Should have failed" ); } catch ( Exception e ) { String contents = readFile( customBoltLogFile ); assertThat( contents, containsString( "S FAILURE" ) ); } }
Source:
public GoVarProcessor(@NotNull PsiElement requestedName, @NotNull PsiElement origin, boolean completion, boolean delegate) { super(requestedName, origin, completion); myImShortVarDeclaration = PsiTreeUtil.getParentOfType(origin, GoShortVarDeclaration.class) != null && !delegate; myImInForClause = PsiTreeUtil.getParentOfType(origin, GoForClause.class) != null; myParentGuard = origin.getParent() instanceof GoTypeSwitchGuard ? origin.getParent() : null; myScope = getScope(origin); }

Target:
public GoVarProcessor(@NotNull PsiElement requestedName, @NotNull PsiElement origin, boolean completion, boolean delegate) { super(requestedName, origin, completion); myImShortVarDeclaration = PsiTreeUtil.getParentOfType(origin, GoShortVarDeclaration.class) != null && !delegate; myParentGuard = origin.getParent() instanceof GoTypeSwitchGuard ? origin.getParent() : null; myScope = getScope(origin); }
Source:
public List<Chapter> getChaptersByProperties(Map<String, String> properties) { List chapters = chapterDataService.executeQuery(new QueryExecution<List<Chapter>>() { @Override public List<Chapter> execute(Query query, InstanceSecurityRestriction restriction) { query.setFilter(buildParametersFilter(properties)); return (List) QueryExecutor.execute(query, restriction); } }); return new ArrayList<>(chapters); }

Target:
public List<Chapter> getChaptersByProperties(Map<String, String> properties) { return chapterDataService.executeQuery(new PropertiesMapQueryExecution<>(properties)); }
Source:
public void onNavigationDrawerItemSelected(int position) { Utils.setContext(this); String pin = getIntent().getStringExtra(PinManager.EXTRA_PIN); if (PinManager.get().isPin(pin)) { } FileIndex.create(false, new IOnResult<FileIndex>() { @Override public void onResult(FileIndex result) { Utils.toast("Created file index: " + result); if (result == null) return; FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.container, new ContentFragment()) .commit(); } }); }

Target:
public void onNavigationDrawerItemSelected(int position) { Utils.setContext(this); String pin = getIntent().getStringExtra(PinManager.EXTRA_PIN); if (BuildConfig.DEBUG || PinManager.get().isPin(pin)) { FileIndex.create(false, new IOnResult<FileIndex>() { @Override public void onResult(FileIndex result) { Utils.d("Created file index: " + result); if (result == null) { return; } FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.container, new ContentFragment()) .commit(); } }); } }
Source:
public final TYPE next() { TYPE result = next; next = null; result = (result == null ? fromIterator.next() : result); return result; }

Target:
public final TYPE next() { if (next == null) { return fromIterator.next(); } else { final TYPE result = next; next = null; return result; } }
Source:
public void test1() throws NoSuchAlgorithmException { ObjectId exp = ObjectId .fromString("a9993e364706816aba3e25717850c26c9cd0d89d"); MessageDigest m = MessageDigest.getInstance("SHA-1"); m.update(TEST1.getBytes(StandardCharsets.ISO_8859_1)); ObjectId m1 = ObjectId.fromRaw(m.digest()); SHA1 s = SHA1.newInstance(); s.update(TEST1.getBytes(StandardCharsets.ISO_8859_1)); ObjectId s1 = ObjectId.fromRaw(s.digest()); assertEquals(m1, s1); assertEquals(exp, s1); }

Target:
public void test1() throws NoSuchAlgorithmException { ObjectId exp = ObjectId .fromString("a9993e364706816aba3e25717850c26c9cd0d89d"); MessageDigest m = MessageDigest.getInstance("SHA-1"); m.update(TEST1.getBytes(StandardCharsets.UTF_8)); ObjectId m1 = ObjectId.fromRaw(m.digest()); SHA1 s = SHA1.newInstance(); s.update(TEST1.getBytes(StandardCharsets.UTF_8)); ObjectId s1 = ObjectId.fromRaw(s.digest()); assertEquals(m1, s1); assertEquals(exp, s1); }
Source:
private void save(UnitTestClassReport report, InputFile inputFile, SensorContext context) { int testsCount = report.getTests() - report.getSkipped(); saveMeasure(context, inputFile, CoreMetrics.SKIPPED_TESTS, report.getSkipped()); saveMeasure(context, inputFile, CoreMetrics.TESTS, testsCount); saveMeasure(context, inputFile, CoreMetrics.TEST_ERRORS, report.getErrors()); saveMeasure(context, inputFile, CoreMetrics.TEST_FAILURES, report.getFailures()); saveMeasure(context, inputFile, CoreMetrics.TEST_EXECUTION_TIME, report.getDurationMilliseconds()); double passedTests = testsCount - report.getErrors() - report.getFailures(); if (testsCount > 0) { double percentage = ParsingUtils.scaleValue(passedTests * 100d / testsCount); if (!Double.isNaN(percentage)) { context.<Double>newMeasure().forMetric(CoreMetrics.TEST_SUCCESS_DENSITY).on(inputFile).withValue(percentage).save(); } } saveResults(inputFile, report); }

Target:
private void save(UnitTestClassReport report, InputFile inputFile, SensorContext context) { int testsCount = report.getTests() - report.getSkipped(); saveMeasure(context, inputFile, CoreMetrics.SKIPPED_TESTS, report.getSkipped()); saveMeasure(context, inputFile, CoreMetrics.TESTS, testsCount); saveMeasure(context, inputFile, CoreMetrics.TEST_ERRORS, report.getErrors()); saveMeasure(context, inputFile, CoreMetrics.TEST_FAILURES, report.getFailures()); saveMeasure(context, inputFile, CoreMetrics.TEST_EXECUTION_TIME, report.getDurationMilliseconds()); double passedTests = testsCount - (double) report.getErrors() - report.getFailures(); if (testsCount > 0) { double percentage = ParsingUtils.scaleValue(passedTests * 100d / testsCount); if (!Double.isNaN(percentage)) { context.<Double>newMeasure().forMetric(CoreMetrics.TEST_SUCCESS_DENSITY).on(inputFile).withValue(percentage).save(); } } saveResults(inputFile, report); }
Source:
Entry<String, Map<String, String>> add(String s, Entry<String, Map<String, String>> entry, String key, String value) { checkNonNullArgument(s, "'s' cannot be null"); checkNonNullArgument(entry, "Requires " + s + " to be set before adding " + key + "=" + value); checkNonNullArgument(key, "Key cannot be null"); checkNonNullArgument(value, "Value cannot be null"); String put = entry.getValue().put(key, value); checkState(put != null, "Value already set " + s + " : " + key + "=" + value + " old value was: " + put); return entry; }

Target:
Entry<String, Map<String, String>> add(String s, Entry<String, Map<String, String>> entry, String key, String value) { requireNonNull(s, "'s' cannot be null"); requireNonNull(entry, "Requires " + s + " to be set before adding " + key + "=" + value); requireNonNull(key, "Key cannot be null"); requireNonNull(value, "Value cannot be null"); String put = entry.getValue().put(key, value); if (put != null) { throw new IllegalArgumentException( "Value already set " + s + " : " + key + "=" + value + " old value was: " + put); } return entry; }
Source:
public static <T> Set<IItemDescriptor<T>> getActiveItems(IItemRegistry<T> registry, String disabledItemPreferenceKey) { List<IItemDescriptor<T>> itemsDescriptor = ItemUtil.getItemsDescriptor(registry, disabledItemPreferenceKey, EMFCompareRCPPlugin.getDefault().getEMFComparePreferences()); if (itemsDescriptor == null) { itemsDescriptor = Collections.emptyList(); } Set<IItemDescriptor<T>> disableFactories = Sets.newHashSet(itemsDescriptor); Set<IItemDescriptor<T>> allFactories = Sets.newHashSet(registry.getItemDescriptors()); Set<IItemDescriptor<T>> activeFactory = Sets.difference(allFactories, disableFactories); return activeFactory; }

Target:
public static <T> Set<IItemDescriptor<T>> getActiveItems(IItemRegistry<T> registry, String disabledItemPreferenceKey) { List<IItemDescriptor<T>> itemsDescriptor = ItemUtil.getItemsDescriptor(registry, disabledItemPreferenceKey, EMFCompareRCPPlugin.getDefault().getEMFComparePreferences()); if (itemsDescriptor == null) { return Sets.newLinkedHashSet(registry.getItemDescriptors()); } Set<IItemDescriptor<T>> disableFactories = Sets.newHashSet(itemsDescriptor); Set<IItemDescriptor<T>> allFactories = Sets.newHashSet(registry.getItemDescriptors()); Set<IItemDescriptor<T>> activeFactory = Sets.difference(allFactories, disableFactories); return activeFactory; }
Source:
public void render(RenderingStage renderingStage) { preRenderUpdate(renderingStage); if (renderingConfig.isDynamicShadows() && isFirstRenderingStageForCurrentFrame) { shadowMapNode.process(); } worldReflectionNode.process(); graphicState.enableWireframeIf(renderingDebugConfig.isWireframe()); graphicState.initialClearing(); graphicState.preRenderSetupSceneOpaque(); renderBackdrop(); try (Activity ignored = PerformanceMonitor.startActivity("Render World")) { renderObjectsOpaque(); renderChunksOpaque(); renderChunksAlphaReject(); renderOverlays(); renderFirstPersonView(); graphicState.postRenderCleanupSceneOpaque(); renderLightGeometry(); renderChunksRefractiveReflective(); } graphicState.disableWireframeIf(renderingDebugConfig.isWireframe()); PerformanceMonitor.startActivity("Pre-post composite"); postProcessor.generateOutline(); postProcessor.generateAmbientOcclusionPasses(); postProcessor.generatePrePostComposite(); PerformanceMonitor.endActivity(); renderSimpleBlendMaterials(); PerformanceMonitor.startActivity("Post-Processing"); postProcessor.generateLightShafts(); postProcessor.initialPostProcessing(); postProcessor.downsampleSceneAndUpdateExposure(); postProcessor.generateToneMappedScene(); postProcessor.generateBloomPasses(); postProcessor.generateBlurPasses(); postProcessor.finalPostProcessing(renderingStage); PerformanceMonitor.endActivity(); playerCamera.updatePrevViewProjectionMatrix(); }

Target:
public void render(RenderingStage renderingStage) { preRenderUpdate(renderingStage); renderingPipeline.forEach(Node::process); graphicState.enableWireframeIf(renderingDebugConfig.isWireframe()); graphicState.initialClearing(); graphicState.preRenderSetupSceneOpaque(); renderBackdrop(); try (Activity ignored = PerformanceMonitor.startActivity("Render World")) { renderObjectsOpaque(); renderChunksOpaque(); renderChunksAlphaReject(); renderOverlays(); renderFirstPersonView(); graphicState.postRenderCleanupSceneOpaque(); renderLightGeometry(); renderChunksRefractiveReflective(); } graphicState.disableWireframeIf(renderingDebugConfig.isWireframe()); PerformanceMonitor.startActivity("Pre-post composite"); postProcessor.generateOutline(); postProcessor.generateAmbientOcclusionPasses(); postProcessor.generatePrePostComposite(); PerformanceMonitor.endActivity(); renderSimpleBlendMaterials(); PerformanceMonitor.startActivity("Post-Processing"); postProcessor.generateLightShafts(); postProcessor.initialPostProcessing(); postProcessor.downsampleSceneAndUpdateExposure(); postProcessor.generateToneMappedScene(); postProcessor.generateBloomPasses(); postProcessor.generateBlurPasses(); postProcessor.finalPostProcessing(renderingStage); PerformanceMonitor.endActivity(); playerCamera.updatePrevViewProjectionMatrix(); }
Source:
private Object readResolve() { return Jenkins.getInstance().getItemByFullName(fullName); }

Target:
private Object readResolve() { Jenkins j = Jenkins.getInstanceOrNull(); if (j == null) { return null; } return j.getItemByFullName(fullName); }
Source:
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { String script = variableMap.getString("Console"); String params = variableMap.getString("Parameters"); String filename = variableMap.getString("Filename"); boolean debug = variableMap.getBoolean("Debug"); boolean excel = variableMap.getBoolean("Excel"); if (Strings.isValid(script)) { StringWriter writer = new StringWriter(); OseeClient oseeClient = ServiceUtil.getOseeClient(); Properties props = getParameters(params); oseeClient.executeScript(script, props, debug, excel, writer); if (!excel) { log(writer.toString()); } else { IFile iFile = OseeData.getIFile(filename + Lib.getDateTimeString() + ".xml"); AIFile.writeToFile(iFile, Lib.stringToInputStream(writer.toString())); log("Excel XML file produced: "); log(iFile.getLocationURI().toASCIIString()); Program.launch(iFile.getLocation().toOSString()); } } else { log("Console was empty - Type script in console."); } }

Target:
public void runOperation(VariableMap variableMap, IProgressMonitor monitor) throws Exception { String script = variableMap.getString("Console"); String params = variableMap.getString("Parameters"); String filename = variableMap.getString("Filename"); boolean debug = variableMap.getBoolean("Debug"); boolean excel = variableMap.getBoolean("Excel"); if (Strings.isValid(script)) { Writer writer = null; MediaType mediaType = null; String outfile = null; if (excel) { outfile = filename + Lib.getDateTimeString() + ".xml"; mediaType = MediaType.APPLICATION_XML_TYPE; writer = new FileWriter(outfile); } else { mediaType = MediaType.APPLICATION_JSON_TYPE; writer = new StringWriter(); } try { OseeClient oseeClient = ServiceUtil.getOseeClient(); Properties props = getParameters(params); oseeClient.executeScript(script, props, debug, mediaType, writer); if (!excel) { log(writer.toString()); } else { log("Excel XML file produced: "); log(outfile); Program.launch(outfile); } } finally { writer.close(); } } else { log("Console was empty - Type script in console."); } }
Source:
public boolean isOrderTypeInUse(OrderType orderType) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Order.class); criteria.add(Restrictions.eq("orderType", orderType)); if (criteria.list().size() > 0) { return true; } return false; }

Target:
public boolean isOrderTypeInUse(OrderType orderType) { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Order.class); criteria.add(Restrictions.eq("orderType", orderType)); return criteria.list().size() > 0; }
Source:
private void handleScreenTurnedOff() { mHardwareFingerprintUnavailableRetryCount = 0; mHardwareIrisUnavailableRetryCount = 0; final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onScreenTurnedOff(); } } updateBiometricsListeningState(); }

Target:
private void handleScreenTurnedOff() { mHardwareFingerprintUnavailableRetryCount = 0; mHardwareIrisUnavailableRetryCount = 0; final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onScreenTurnedOff(); } } }
Source:
private void createVolumeProfileDoc() throws DocumentException, IOException { createPdf = new CreatePdf(); ExportData exportData = getParameters().getExportData(); String userId = getParameters().getUserId(); GlusterVolumeProfileInfo profileInfo = getParameters().getProfileInfo(); String filePath = getParameters().getFilePath(); Date today = new Date(); if(filePath == null || filePath.isEmpty()) { filePath = "/home/ababu/" + getGlusterVolumeDao().getById(profileInfo.getVolumeId()).getName() + "-" + exportData.toString()+ "-" + today.getTime() + ".pdf"; } try { Document document = new Document(); ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); PdfWriter.getInstance(document, byteStream); document.open(); createPdf.addMetaData(document, createMetaData(getGlusterVolumeDao().getById(profileInfo.getVolumeId()).getName(), userId)); addContent(document, profileInfo, exportData); document.close(); setSucceeded(true); VdcReturnValueBase returnValue = new VdcReturnValueBase(); returnValue.setDescription("Pdf Saved"); returnValue.setSucceeded(true); setActionReturnValue(byteStream); } catch (Exception e) { setSucceeded(false); setActionReturnValue(e.toString()); } }

Target:
private void createVolumeProfileDoc() throws DocumentException, IOException { createPdf = new CreatePdf(); ExportData exportData = getParameters().getExportData(); String userId = getParameters().getUserId(); GlusterVolumeProfileInfo profileInfo = getParameters().getProfileInfo(); try { Document document = new Document(); ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); PdfWriter.getInstance(document, byteStream); document.open(); createPdf.addMetaData(document, createMetaData(getGlusterVolumeDao().getById(profileInfo.getVolumeId()).getName(), userId)); addContent(document, profileInfo, exportData); document.close(); setSucceeded(true); VdcReturnValueBase returnValue = new VdcReturnValueBase(); returnValue.setDescription("Pdf Saved"); returnValue.setSucceeded(true); setActionReturnValue(byteStream.toByteArray()); } catch (Exception e) { setSucceeded(false); setActionReturnValue(e.toString()); } }
Source:
public void setContext(StructDefinition context) { this.fContext = context; }

Target:
public void setContext(StructDefinition context) { fContext = context; }
Source:
protected Option[] configureMavenRepos() { return options( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.repositories", "<LINK_2>," + "<LINK_4>," + "<LINK_10>," + "<LINK_7>," + "<LINK_8>," + "<LINK_5>," + "<LINK_0>," + "<LINK_6>," + "<LINK_1>"), when(System.getProperty(MVN_LOCAL_REPO) != null) .useOptions( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", PAX_URL_MVN_LOCAL_REPO, System.getProperty(MVN_LOCAL_REPO)))); }

Target:
protected Option[] configureMavenRepos() { return options( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.repositories", "<LINK_2>," + "<LINK_4>," + "<LINK_10>," + "<LINK_7>," + "<LINK_8>," + "<LINK_5>," + "<LINK_0>," + "<LINK_6>," + "<LINK_1>," + "<LINK_3>"), when(System.getProperty(MVN_LOCAL_REPO) != null) .useOptions( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", PAX_URL_MVN_LOCAL_REPO, System.getProperty(MVN_LOCAL_REPO)))); }
Source:
public String getWorkflowDag(@ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); String result = null; if(mainDescriptor != null) { File tmpDir = Files.createTempDir(); File tempMainDescriptor = null; try { tempMainDescriptor = File.createTempFile("main", "descriptor", tmpDir); Files.write(mainDescriptor.getContent(), tempMainDescriptor, StandardCharsets.UTF_8); File secondaryDescriptor; for (SourceFile secondaryFile : workflowVersion.getSourceFiles()) { if (!secondaryFile.getPath().equals(workflowVersion.getWorkflowPath())) { secondaryDescriptor = new File(tmpDir.getAbsolutePath(), secondaryFile.getPath()); Files.write(secondaryFile.getContent(), secondaryDescriptor, StandardCharsets.UTF_8); } } } catch (IOException e) { e.printStackTrace(); } if (workflow.getDescriptorType().equals("wdl")) { result = getContentWDL(tempMainDescriptor,"dag"); } else { result = getContentCWL(tempMainDescriptor, tmpDir,"dag"); } } return result; }

Target:
public String getWorkflowDag(@ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); String result = null; if(mainDescriptor != null) { String descFileContent = mainDescriptor.getContent(); Map<String, String> secondaryDescContent = new HashMap<>(); File tmpDir = Files.createTempDir(); File tempMainDescriptor = null; try { tempMainDescriptor = File.createTempFile("main", "descriptor", tmpDir); Files.write(mainDescriptor.getContent(), tempMainDescriptor, StandardCharsets.UTF_8); for (SourceFile secondaryFile : workflowVersion.getSourceFiles()) { if (!secondaryFile.getPath().equals(workflowVersion.getWorkflowPath())) { secondaryDescContent.put(secondaryFile.getPath(),secondaryFile.getContent()); } } } catch (IOException e) { e.printStackTrace(); } if (workflow.getDescriptorType().equals("wdl")) { result = getContentWDL(tempMainDescriptor,Type.DAG); } else { result = getContentCWL(descFileContent, secondaryDescContent, Type.DAG); } } return result; }
Source:
public void onSuccess(WorkflowExecutionContext context) throws FalconException { if (context.hasWorkflowSucceeded()) { if (context.getEntityType().toString().equals(EntityType.FEED.toString())){ updateSLAMonitoring(context.getClusterName(), context.getOutputFeedNamesList(), context.getOutputFeedInstancePathsList()); } if (context.getEntityType().toString().equals(EntityType.PROCESS.toString())){ EntitySLAMonitoringService.get().updateProcessSLAMonitoring(context.getClusterName(), context.getEntityName(), context.getNominalTimeAsISO8601(), context.getEntityType()); } } }

Target:
public void onSuccess(WorkflowExecutionContext context) throws FalconException { if (context.hasWorkflowSucceeded()) { if (context.getEntityType().toString().equals(EntityType.FEED.name())){ updateSLAMonitoring(context.getClusterName(), context.getOutputFeedNamesList(), context.getOutputFeedInstancePathsList()); } if (context.getEntityType().toString().equals(EntityType.PROCESS.name())){ EntitySLAMonitoringService.get().makeProcessInstanceAvailable(context.getClusterName(), context.getEntityName(), context.getNominalTimeAsISO8601(), context.getEntityType()); } } }
Source:
public void testEqualsNull() { CodePoints cp1 = new CodePoints("ABCD"); String str = null; assertThat(cp1.equals(str), is(false)); }

Target:
public void testEqualsNull() { CodePoints cp1 = new CodePoints("ABCD"); CodePoints cp2 = null; assertThat(cp1.equals(cp2), is(false)); }
Source:
public void initialize(ServerConfiguration conf, LedgerManager ledgerManager, LedgerDirsManager ledgerDirsManager, LedgerDirsManager indexDirsManager, StateManager stateManager, CheckpointSource checkpointSource, Checkpointer checkpointer, StatsLogger statsLogger) throws IOException { super.initialize( conf, ledgerManager, ledgerDirsManager, indexDirsManager, stateManager, checkpointSource, checkpointer, statsLogger); if (conf.isEntryLogPerLedgerEnabled()) { this.flushExecutor = OrderedExecutor.newBuilder().numThreads(conf.getNumOfMemtableFlushThreads()) .name("MemtableFlushThreads").build(); this.memTable = new EntryMemTableWithParallelFlusher(conf, checkpointSource, statsLogger, flushExecutor); } else { this.memTable = new EntryMemTable(conf, checkpointSource, statsLogger); } this.scheduler = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder() .setNameFormat("SortedLedgerStorage-%d") .setPriority((Thread.NORM_PRIORITY + Thread.MAX_PRIORITY) / 2).build()); this.stateManager = stateManager; }

Target:
public void initialize(ServerConfiguration conf, LedgerManager ledgerManager, LedgerDirsManager ledgerDirsManager, LedgerDirsManager indexDirsManager, StateManager stateManager, CheckpointSource checkpointSource, Checkpointer checkpointer, StatsLogger statsLogger) throws IOException { super.initialize( conf, ledgerManager, ledgerDirsManager, indexDirsManager, stateManager, checkpointSource, checkpointer, statsLogger); if (conf.isEntryLogPerLedgerEnabled()) { this.memTable = new EntryMemTableWithParallelFlusher(conf, checkpointSource, statsLogger); } else { this.memTable = new EntryMemTable(conf, checkpointSource, statsLogger); } this.scheduler = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder() .setNameFormat("SortedLedgerStorage-%d") .setPriority((Thread.NORM_PRIORITY + Thread.MAX_PRIORITY) / 2).build()); this.stateManager = stateManager; }
Source:
boolean internalExecute(String sql) throws SQLException { clearCurrentResults(); checkOpen(); ResultSet resultSet = null; try (StatementClient client = connection().startQuery(sql, getStatementSessionProperties())) { if (client.isFinished()) { QueryStatusInfo finalStatusInfo = client.finalStatusInfo(); if (finalStatusInfo.getError() != null) { throw resultsException(finalStatusInfo); } } executingClient.set(client); resultSet = new PrestoResultSet(client, maxRows.get(), progressConsumer); if (client.currentStatusInfo().getUpdateType() == null) { currentResult.set(resultSet); return true; } while (resultSet.next()) { } connection().updateSession(client); Long updateCount = client.finalStatusInfo().getUpdateCount(); currentUpdateCount.set((updateCount != null) ? updateCount : 0); currentUpdateType.set(client.finalStatusInfo().getUpdateType()); return false; } catch (ClientException e) { throw new SQLException(e.getMessage(), e); } catch (RuntimeException e) { throw new SQLException("Error executing query", e); } finally { executingClient.set(null); if (currentResult.get() == null) { if (resultSet != null) { resultSet.close(); } } } }

Target:
boolean internalExecute(String sql) throws SQLException { clearCurrentResults(); checkOpen(); StatementClient client = null; ResultSet resultSet = null; try { client = connection().startQuery(sql, getStatementSessionProperties()); if (client.isFinished()) { QueryStatusInfo finalStatusInfo = client.finalStatusInfo(); if (finalStatusInfo.getError() != null) { throw resultsException(finalStatusInfo); } } executingClient.set(client); resultSet = new PrestoResultSet(client, maxRows.get(), progressConsumer); if (client.currentStatusInfo().getUpdateType() == null) { currentResult.set(resultSet); return true; } while (resultSet.next()) { } connection().updateSession(client); Long updateCount = client.finalStatusInfo().getUpdateCount(); currentUpdateCount.set((updateCount != null) ? updateCount : 0); currentUpdateType.set(client.finalStatusInfo().getUpdateType()); return false; } catch (ClientException e) { throw new SQLException(e.getMessage(), e); } catch (RuntimeException e) { throw new SQLException("Error executing query", e); } finally { executingClient.set(null); if (currentResult.get() == null) { if (resultSet != null) { resultSet.close(); } if (client != null) { client.close(); } } } }
Source:
public final void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { String nextUrl = req.getParameter(Const.ParamsNames.NEXT_URL); if (nextUrl == null) { nextUrl = "/index.html"; } String expectedId = req.getParameter(Const.ParamsNames.HINT); String actualId = req.getParameter(Const.ParamsNames.USER_ID); String logoutUrl = Logic.getLogoutUrl(nextUrl); if (expectedId == null || actualId == null) { resp.sendRedirect(logoutUrl); } else { try { req.setAttribute(Const.ParamsNames.HINT, StringHelper.decrypt(expectedId)); req.setAttribute(Const.ParamsNames.USER_ID, StringHelper.decrypt(actualId)); req.setAttribute(Const.ParamsNames.NEXT_URL, logoutUrl); req.getRequestDispatcher(Const.ViewURIs.GOOGLE_ACCOUNT_HINT).forward(req, resp); } catch (Exception e) { resp.sendRedirect(logoutUrl); } } }

Target:
public final void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { String nextUrl = req.getParameter(Const.ParamsNames.NEXT_URL); if (nextUrl == null) { nextUrl = "/index.html"; } String expectedId = req.getParameter(Const.ParamsNames.HINT); String actualId = req.getParameter(Const.ParamsNames.USER_ID); String logoutUrl = Logic.getLogoutUrl(nextUrl); if (expectedId == null || actualId == null) { resp.sendRedirect(logoutUrl); return; } try { req.setAttribute(Const.ParamsNames.HINT, StringHelper.decrypt(expectedId)); req.setAttribute(Const.ParamsNames.USER_ID, StringHelper.decrypt(actualId)); req.setAttribute(Const.ParamsNames.NEXT_URL, logoutUrl); req.getRequestDispatcher(Const.ViewURIs.GOOGLE_ACCOUNT_HINT).forward(req, resp); } catch (Exception e) { resp.sendRedirect(logoutUrl); } }
Source:
public static List<String> getQuotaTypes(List<String> quotaTypes) { if(quotaTypes.size() < 1) throw new VoldemortException("Quota type not specified."); Set<String> validQuotaTypes = QuotaUtils.validQuotaTypes(); if(quotaTypes.size() == 1 && quotaTypes.get(0).equals(AdminUtils.QUOTATYPE_ALL)) { Iterator<String> iter = validQuotaTypes.iterator(); quotaTypes = Lists.newArrayList(); while(iter.hasNext()) { quotaTypes.add(iter.next()); } } else { for(String quotaType: quotaTypes) { if(!validQuotaTypes.contains(quotaType)) { Utils.croak("Specify a valid quota type from :" + validQuotaTypes); } } } return quotaTypes; }

Target:
public static List<String> getQuotaTypes(List<String> quotaTypes) { if(quotaTypes.size() < 1) { throw new VoldemortException("Quota type not specified."); } Set<String> validQuotaTypes = QuotaUtils.validQuotaTypes(); if(quotaTypes.size() == 1 && quotaTypes.get(0).equals(AdminUtils.QUOTATYPE_ALL)) { Iterator<String> iter = validQuotaTypes.iterator(); quotaTypes = Lists.newArrayList(); while(iter.hasNext()) { quotaTypes.add(iter.next()); } } else { for(String quotaType: quotaTypes) { if(!validQuotaTypes.contains(quotaType)) { Utils.croak("Specify a valid quota type from :" + validQuotaTypes); } } } return quotaTypes; }
Source:
public void testXmlDeniesDuplicateGroupConfig() { expectDuplicateElementError("group"); String groupConfig = " <group>\n" + " <name>foobar</name>\n" + " <password>dev-pass</password>\n" + " </group>\n"; buildConfig(HAZELCAST_START_TAG + groupConfig + groupConfig + HAZELCAST_END_TAG, null); }

Target:
public void testXmlDeniesDuplicateGroupConfig() { expectDuplicateElementError("group"); String groupConfig = "" + " <group>\n" + " <name>foobar</name>\n" + " <password>dev-pass</password>\n" + " </group>\n"; buildConfig(HAZELCAST_START_TAG + groupConfig + groupConfig + HAZELCAST_END_TAG); }
Source:
private void processEvents() throws SQLException { Connection connection = null; PreparedStatement ps = null; ResultSet rs = null; List<EventAuditLogSubscriber> eventSubscribers = new ArrayList<>(); try { connection = ds.getConnection(); ps = connection .prepareStatement("select * from event_audit_log_subscriber_view " + "where audit_log_id <= (select max(audit_log_id) from audit_log)"); rs = ps.executeQuery(); while (rs.next()) { eventSubscribers.add(getEventAuditLogSubscriber(rs)); } } catch (SQLException e) { if (isConnectionException(e)){ handleQueryFailure(); } throw e; } finally { DbUtils.closeQuietly(rs, ps, connection); } DbUser dbUser; for (EventAuditLogSubscriber eventSubscriber:eventSubscribers) { dbUser = getUserByUserId(eventSubscriber.getsubscriber_id()); if (dbUser != null) { EventSender method = methodsMapper.getMethod(EventNotificationMethods.forValue(eventSubscriber.getmethod_id())); EventSenderResult sendResult; try { sendResult = method.send(eventSubscriber, dbUser.getemail()); } catch (Exception e) { log.error("Failed to dispatch message", e); sendResult = new EventSenderResult(); sendResult.setSent(false); sendResult.setReason(e.getMessage()); } addEventNotificationHistory(geteventNotificationHist(eventSubscriber, sendResult.isSent(), sendResult.getReason())); updateAuditLogEventProcessed(eventSubscriber); } } }

Target:
private void processEvents() throws SQLException { Connection connection = null; PreparedStatement ps = null; ResultSet rs = null; List<EventAuditLogSubscriber> eventSubscribers = new ArrayList<>(); try { connection = ds.getConnection(); ps = connection .prepareStatement("select * from event_audit_log_subscriber_view " + "where audit_log_id <= (select max(audit_log_id) from audit_log)"); rs = ps.executeQuery(); while (rs.next()) { eventSubscribers.add(getEventAuditLogSubscriber(rs)); } } catch (SQLException e) { if (isConnectionException(e)){ handleQueryFailure(); } throw e; } finally { DbUtils.closeQuietly(rs, ps, connection); } DbUser dbUser = null; for (EventAuditLogSubscriber eventSubscriber:eventSubscribers) { dbUser = getUserByUserId(eventSubscriber.getsubscriber_id()); if (dbUser != null) { EventSender method = methodsMapper.getMethod(EventNotificationMethods.forValue(eventSubscriber.getmethod_id())); EventSenderResult sendResult = null; try { sendResult = method.send(eventSubscriber, dbUser.getemail()); } catch (Exception e) { log.error("Failed to dispatch message", e); sendResult = new EventSenderResult(); sendResult.setSent(false); sendResult.setReason(e.getMessage()); } addEventNotificationHistory(geteventNotificationHist(eventSubscriber, sendResult.isSent(), sendResult.getReason())); updateAuditLogEventProcessed(eventSubscriber); } } }
Source:
public void notifyCheckpointComplete(long checkpointId, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isRunning) throws Exception { if (isRunning.get()) { LOG.debug("Notification of complete checkpoint for task {}", taskName); for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { if (!operatorWrapper.isClosed()) { operatorWrapper.getStreamOperator().notifyCheckpointComplete(checkpointId); } } } else { LOG.debug("Ignoring notification of complete checkpoint for not-running task {}", taskName); } env.getTaskStateManager().notifyCheckpointComplete(checkpointId); }

Target:
public void notifyCheckpointComplete(long checkpointId, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isRunning) throws Exception { if (isRunning.get()) { LOG.debug("Notification of complete checkpoint for task {}", taskName); for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { operatorWrapper.notifyCheckpointComplete(checkpointId); } } else { LOG.debug("Ignoring notification of complete checkpoint for not-running task {}", taskName); } env.getTaskStateManager().notifyCheckpointComplete(checkpointId); }
Source:
public static Optional<Principal> createPrincipal(Optional<String> principal) { return principal.map(name -> new InternalPrincipal(name)); }

Target:
public static Optional<Principal> createPrincipal(Optional<String> principal) { return principal.map(InternalPrincipal::new); }
Source:
public void doChangeMergedHook(final Change change, final Account account, final PatchSet patchSet, final ReviewDb db, String mergeResultRev) throws OrmException { final ChangeMergedEvent event = new ChangeMergedEvent(); final AccountState owner = accountCache.get(change.getOwner()); event.change = eventFactory.asChangeAttribute(change); event.submitter = eventFactory.asAccountAttribute(account); event.patchSet = eventFactory.asPatchSetAttribute(patchSet); event.newRev = mergeResultRev; fireEvent(change, event, db); final List<String> args = new ArrayList<>(); addArg(args, "--change", event.change.id); addArg(args, "--change-url", event.change.url); addArg(args, "--change-owner", getDisplayName(owner.getAccount())); addArg(args, "--project", event.change.project); addArg(args, "--branch", event.change.branch); addArg(args, "--topic", event.change.topic); addArg(args, "--submitter", getDisplayName(account)); addArg(args, "--commit", event.patchSet.revision); addArg(args, "--new-rev", mergeResultRev); runHook(change.getProject(), changeMergedHook, args); }

Target:
public void doChangeMergedHook(final Change change, final Account account, final PatchSet patchSet, final ReviewDb db, String mergeResultRev) throws OrmException { final ChangeMergedEvent event = new ChangeMergedEvent(); final AccountState owner = accountCache.get(change.getOwner()); event.change = eventFactory.asChangeAttribute(change); event.submitter = eventFactory.asAccountAttribute(account); event.patchSet = eventFactory.asPatchSetAttribute(patchSet); event.newRev = mergeResultRev; fireEvent(change, event, db); final List<String> args = new ArrayList<>(); addArg(args, "--change", event.change.id); addArg(args, "--change-url", event.change.url); addArg(args, "--change-owner", getDisplayName(owner.getAccount())); addArg(args, "--project", event.change.project); addArg(args, "--branch", event.change.branch); addArg(args, "--topic", event.change.topic); addArg(args, "--submitter", getDisplayName(account)); addArg(args, "--commit", event.patchSet.revision); addArg(args, "--newrev", mergeResultRev); runHook(change.getProject(), changeMergedHook, args); }
Source:
private CorfuReplicationClusterManagerAdapter buildClusterManagerAdapter(String pluginConfigFilePath) { LogReplicationPluginConfig config = new LogReplicationPluginConfig(pluginConfigFilePath); File jar = new File(config.getTopologyManagerAdapterJARPath()); try (URLClassLoader child = new URLClassLoader(new URL[]{jar.toURI().toURL()}, this.getClass().getClassLoader())) { Class adapter = Class.forName(config.getTopologyManagerAdapterName(), true, child); if (config.getTopologyConfigPath().isPresent()) { String param = config.getTopologyConfigPath().get(); log.info("Using static config path: {}", param); Constructor declaredConstructor = adapter .getDeclaredConstructor(String.class); return (CorfuReplicationClusterManagerAdapter) declaredConstructor.newInstance(param); } else { return (CorfuReplicationClusterManagerAdapter) adapter.newInstance(); } } catch (Exception e) { log.error("Fatal error: Failed to create serverAdapter", e); throw new UnrecoverableCorfuError(e); } }

Target:
private CorfuReplicationClusterManagerAdapter buildClusterManagerAdapter(String pluginConfigFilePath) { LogReplicationPluginConfig config = new LogReplicationPluginConfig(pluginConfigFilePath); File jar = new File(config.getTopologyManagerAdapterJARPath()); try (URLClassLoader child = new URLClassLoader(new URL[]{jar.toURI().toURL()}, this.getClass().getClassLoader())) { Class adapter = Class.forName(config.getTopologyManagerAdapterName(), true, child); return (CorfuReplicationClusterManagerAdapter) adapter.getDeclaredConstructor().newInstance(); } catch (Exception e) { log.error("Fatal error: Failed to create serverAdapter", e); throw new UnrecoverableCorfuError(e); } }