auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void click() throws WidgetNotFoundException { if (commandID != null) { menuClickResult = null; final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class); UIThreadRunnable.asyncExec(new VoidResult() { public void run() { try { menuClickResult = handlerService.executeCommand(commandID, null); } catch (Exception e) { throw new RuntimeException("Failed to execute the command - " + commandID, e); } } }); } else if (action != null) UIThreadRunnable.asyncExec(new VoidResult() { public void run() { action.setChecked(!action.isChecked()); action.run(); } }); else throw new WidgetNotFoundException("There is no action or contribution id to execute."); }

Target:
public void click() throws WidgetNotFoundException { if (commandID != null) { menuClickResult = null; final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class); UIThreadRunnable.asyncExec(new VoidResult() { public void run() { try { menuClickResult = handlerService.executeCommand(commandID, null); } catch (Exception e) { throw new RuntimeException("Failed to execute the command - " + commandID, e); } } }); } else if (action != null) UIThreadRunnable.asyncExec(new VoidResult() { public void run() { if((action.getStyle() == IAction.AS_CHECK_BOX) || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { action.setChecked(!action.isChecked()); } action.run(); } }); else throw new WidgetNotFoundException("There is no action or contribution id to execute."); }
Source:
public void createPartControl(Composite parent) { PatternFilter filter = new PatternFilter(); fFilteredTree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, filter, true); fTreeViewer = fFilteredTree.getViewer(); ColumnViewerToolTipSupport.enableFor(fTreeViewer); fTreeViewer.setContentProvider(new TraceControlContentProvider()); fTreeViewer.setLabelProvider(new TraceControlLabelProvider()); fRoot = new TraceControlRoot(); fRoot.addComponentListener(this); if (fInitialConnections != null) { for (IRemoteConnection rc : fInitialConnections) { TargetNodeComponent node = new TargetNodeComponent(rc.getName(), fRoot, rc); fRoot.addChild(node); } fInitialConnections = null; } fTreeViewer.setInput(fRoot); createContextMenu(); getSite().setSelectionProvider(fTreeViewer); }

Target:
public void createPartControl(Composite parent) { PatternFilter filter = new PatternFilter() { @Override protected boolean isLeafMatch(Viewer viewer, Object element) { ITraceControlComponent parentElement = (ITraceControlComponent) element; while (parentElement != null) { if (super.isLeafMatch(viewer, parentElement)) { return true; } parentElement = parentElement.getParent(); } return false; } }; FilteredTree filteredTree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, filter, true) { @Override protected void updateToolbar(boolean visible) { super.updateToolbar(visible); treeViewer.expandToLevel(3); } }; fTreeViewer = filteredTree.getViewer(); ColumnViewerToolTipSupport.enableFor(fTreeViewer); fTreeViewer.setContentProvider(new TraceControlContentProvider()); fTreeViewer.setLabelProvider(new TraceControlLabelProvider()); fRoot = new TraceControlRoot(); fRoot.addComponentListener(this); if (fInitialConnections != null) { for (IRemoteConnection rc : fInitialConnections) { TargetNodeComponent node = new TargetNodeComponent(rc.getName(), fRoot, rc); fRoot.addChild(node); } fInitialConnections = null; } fTreeViewer.setInput(fRoot); createContextMenu(); getSite().setSelectionProvider(fTreeViewer); }
Source:
private void onFindFinished(Intent intent) { addMembersButton.setEnabled(true); List<FoundFan> devices = intent.getParcelableArrayListExtra(ConnectionService.EXTRA_FANS); if (devices.isEmpty()) { Toaster.iToast(this.getActivity(), R.string.no_fans_found); } else { new MultiSelectListDialog<FoundFan>(this.getActivity(), R.string.select_fans, R.string.connect) .setItems(devices) .setOnClickListener( new IOnDialogMultiItemClickListener<FoundFan>() { @Override public void onItemsClick( List<FoundFan> foundFans) { getConnectionService().connectToFans(foundFans); } }) .show(); } }

Target:
private void onFindFinished(Intent intent) { addMembersButton.setEnabled(true); List<FoundGuest> devices = intent.getParcelableArrayListExtra(ConnectionService.EXTRA_GUESTS); if (devices.isEmpty()) { Toaster.iToast(this.getActivity(), R.string.no_guests_found); } else { new MultiSelectListDialog<FoundGuest>(this.getActivity(), R.string.select_guests, R.string.connect) .setItems(devices) .setOnClickListener( new IOnDialogMultiItemClickListener<FoundGuest>() { @Override public void onItemsClick( List<FoundGuest> foundGuests) { getConnectionService().connectToGuests(foundGuests); } }) .show(); } }
Source:
public String formatSize(double size) { String sSize = String.valueOf(size); int dotIndex = sSize.indexOf("."); if(dotIndex != -1) { return sSize.substring(0, dotIndex + 3); } else { return sSize.concat(".00"); } }

Target:
public String formatSize(double size) { return NumberFormat.getFormat("#.##").format(size); }
Source:
private static void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) { if (emfValidationStatus.getSeverity() == Diagnostic.OK) { return; } final Diagnostic rootStatus = emfValidationStatus; List allDiagnostics = new ArrayList(); SiriusDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new SiriusDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet(), allDiagnostics)); for (Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) { Diagnostic nextDiagnostic = (Diagnostic) it.next(); List data = nextDiagnostic.getData(); if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) { EObject element = (EObject) data.get(0); DSemanticDecorator dSemanticDecorator = getDSemanticDecorator(element, diagramEditPart); if (dSemanticDecorator != null) { View view = SiriusGMFHelper.getGmfView(dSemanticDecorator); addMarker(diagramEditPart.getViewer(), target, view, EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity())); } } } }

Target:
private static void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) { if (emfValidationStatus.getSeverity() == Diagnostic.OK) { return; } final Diagnostic rootStatus = emfValidationStatus; List allDiagnostics = new ArrayList(); collectTargetElements(rootStatus, new HashSet(), allDiagnostics); for (Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) { Diagnostic nextDiagnostic = (Diagnostic) it.next(); List data = nextDiagnostic.getData(); if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) { EObject element = (EObject) data.get(0); DSemanticDecorator dSemanticDecorator = getDSemanticDecorator(element, diagramEditPart); if (dSemanticDecorator != null) { View view = SiriusGMFHelper.getGmfView(dSemanticDecorator); addMarker(diagramEditPart.getViewer(), target, view, EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity())); } } } }
Source:
public NetRC() { parse(); }

Target:
public NetRC() { netrc = getDefaultFile(); parse(); }
Source:
public void optOutTracking() { getAnalyticsMessages().emptyTrackingQueues(new AnalyticsMessages.MixpanelDescription(mToken)); if (getPeople().isIdentified()) { getPeople().deleteUser(); getPeople().clearCharges(); } mPersistentIdentity.clearPreferences(); synchronized (mEventTimings) { mEventTimings.clear(); mPersistentIdentity.clearTimeEvents(); } mPersistentIdentity.clearReferrerProperties(); mPersistentIdentity.setOptOutTracking(true); }

Target:
public void optOutTracking() { getAnalyticsMessages().emptyTrackingQueues(new AnalyticsMessages.MixpanelDescription(mToken)); if (getPeople().isIdentified()) { getPeople().deleteUser(); getPeople().clearCharges(); } mPersistentIdentity.clearPreferences(); synchronized (mEventTimings) { mEventTimings.clear(); mPersistentIdentity.clearTimeEvents(); } mPersistentIdentity.clearReferrerProperties(); mPersistentIdentity.setOptOutTracking(true, mToken); }
Source:
public Status delete(String table, String key) { try { arangoDriver.deleteDocument(table, key); return Status.OK; } catch (ArangoException e) { if (e.getErrorNumber() != ErrorNums.ERROR_ARANGO_DOCUMENT_NOT_FOUND) { logger.error("Fail to delete: " + table + " " + key, e); } else { logger.debug("Trying to delete document not exist: {}", table, key); return Status.NOT_FOUND; } } catch (Exception e) { logger.error("Exception while trying delete " + table + " " + key, e); } return Status.ERROR; }

Target:
public Status delete(String table, String key) { try { arangoDriver.deleteDocument(table, key); return Status.OK; } catch (ArangoException e) { if (e.getErrorNumber() != ErrorNums.ERROR_ARANGO_DOCUMENT_NOT_FOUND) { logger.error("Fail to delete: with ex {}", table, key, e.toString()); } else { logger.debug("Trying to delete document not exist: {}", table, key); return Status.NOT_FOUND; } } catch (RuntimeException e) { logger.error("Exception while trying delete with ex {}", table, key, e.toString()); } return Status.ERROR; }
Source:
public void testApply() { Row expect = null; if (expectIndex >= 0) { expect = requests[expectIndex]; } assertEquals(message, expect, udf.getMainSearchReq(wiki, requests)); }

Target:
public void testApply() { Row expect = null; if (expectIndex >= 0) { expect = requests[expectIndex]; } assertThat(udf.getMainSearchReq(wiki, requests)).isEqualTo(expect); }
Source:
public Association getAssociation() { if ( association == null ) { AssociationKey key = getAssociationKey(); if ( hostingEntity != null ) { OgmEntityEntryState entryState = OgmEntityEntryState.getStateFor( session, hostingEntity ); if ( entryState.hasAssociation( associationKeyMetadata.getCollectionRole() ) ) { association = entryState.getAssociation( associationKeyMetadata.getCollectionRole() ); } else { association = gridDialect.getAssociation( key, getAssociationContext() ); } } else { association = gridDialect.getAssociation( key, getAssociationContext() ); } if ( association == null ) { association = gridDialect.createAssociation( key, getAssociationContext() ); } if ( hostingEntity != null ) { OgmEntityEntryState.getStateFor( session, hostingEntity ) .setAssociation( associationKeyMetadata.getCollectionRole(), association ); } } return association; }

Target:
public Association getAssociation() { if ( association == null ) { AssociationKey key = getAssociationKey(); if ( hostingEntity != null ) { OgmEntityEntryState entryState = OgmEntityEntryState.getStateFor( session, hostingEntity ); if ( entryState.hasAssociation( associationKeyMetadata.getCollectionRole() ) ) { association = entryState.getAssociation( associationKeyMetadata.getCollectionRole() ); } else { association = gridDialect.getAssociation( key, getAssociationContext() ); OgmEntityEntryState.getStateFor( session, hostingEntity ) .setAssociation( associationKeyMetadata.getCollectionRole(), association ); } } else { association = gridDialect.getAssociation( key, getAssociationContext() ); } if ( association == null ) { association = gridDialect.createAssociation( key, getAssociationContext() ); if ( hostingEntity != null ) { OgmEntityEntryState.getStateFor( session, hostingEntity ) .setAssociation( associationKeyMetadata.getCollectionRole(), association ); } } } return association; }
Source:
public BasicSecuritySSLSocketFactory() { try { SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init( null, new TrustManager[] {new BasicSecurityTrustManager()}, new SecureRandom()); sf = ctx.getSocketFactory(); } catch (NoSuchAlgorithmException | KeyManagementException e) { throw new IllegalArgumentException( "Unable to initialize socket factory", e); } }

Target:
public BasicSecuritySSLSocketFactory() { SSLContext ctx = new TLSUtils.ClientSSLContextBuilder() .setProtocol(basicAuthSSLConfig.getProtocol()) .setTrustStoreType(basicAuthSSLConfig.getTrustStoreType()) .setTrustStorePath(basicAuthSSLConfig.getTrustStorePath()) .setTrustStoreAlgorithm(basicAuthSSLConfig.getTrustStoreAlgorithm()) .setTrustStorePasswordProvider(basicAuthSSLConfig.getTrustStorePasswordProvider()) .setKeyStoreType(basicAuthSSLConfig.getKeyStoreType()) .setKeyStorePath(basicAuthSSLConfig.getKeyStorePath()) .setKeyStoreAlgorithm(basicAuthSSLConfig.getKeyManagerFactoryAlgorithm()) .setCertAlias(basicAuthSSLConfig.getCertAlias()) .setKeyStorePasswordProvider(basicAuthSSLConfig.getKeyStorePasswordProvider()) .setKeyManagerFactoryPasswordProvider(basicAuthSSLConfig.getKeyManagerPasswordProvider()) .setValidateHostnames(basicAuthSSLConfig.getValidateHostnames()) .setCertificateChecker(certificateChecker) .build(); sf = ctx.getSocketFactory(); }
Source:
public void roundTrip_full() throws IOException { InspectContainerResponse[] responses = JSONTestHelper.testRoundTrip(CommandJSONSamples.inspectContainerResponse_full, InspectContainerResponse[].class); Assert.assertEquals(1, responses.length); final InspectContainerResponse response = responses[0]; Assert.assertEquals(response.getVolumes().length, 2); Assert.assertEquals(response.getVolumesRW().length, 2); Assert.assertEquals(response.getVolumes()[1].getContainerPath(), "/bar/foo/myvol2"); Assert.assertEquals(response.getVolumes()[1].getHostPath(), "/path2"); Assert.assertEquals(response.getVolumesRW()[1].getVolume().getPath(), "/bar/foo/myvol2"); Assert.assertFalse(response.getVolumesRW()[1].getAccessMode().toBoolean()); Assert.assertTrue(response.getVolumesRW()[0].getAccessMode().toBoolean()); }

Target:
public void roundTrip_full() throws IOException { InspectContainerResponse[] responses = JSONTestHelper.testRoundTrip(CommandJSONSamples.inspectContainerResponse_full, InspectContainerResponse[].class); assertEquals(1, responses.length); final InspectContainerResponse response = responses[0]; assertEquals(response.getVolumes().length, 2); assertEquals(response.getVolumesRW().length, 2); assertEquals(response.getVolumes()[1].getContainerPath(), "/bar/foo/myvol2"); assertEquals(response.getVolumes()[1].getHostPath(), "/path2"); assertEquals(response.getVolumesRW()[1].getVolume().getPath(), "/bar/foo/myvol2"); assertFalse(response.getVolumesRW()[1].getAccessMode().toBoolean()); assertTrue(response.getVolumesRW()[0].getAccessMode().toBoolean()); }
Source:
public List<DerivedCube> getAllDerivedQueryableCubes(CubeInterface cube) throws HiveException { List<DerivedCube> dcubes = new ArrayList<DerivedCube>(); try { for (CubeInterface cb : getAllCubes()) { if (cb.isDerivedCube() && ((DerivedCube)cb).getParent().getName().equalsIgnoreCase(cube.getName()) && cb.allFieldsQueriable()) { dcubes.add((DerivedCube)cb); } } } catch (HiveException e) { throw new HiveException("Could not get all tables", e); } return dcubes; }

Target:
public List<DerivedCube> getAllDerivedQueryableCubes(CubeInterface cube) throws HiveException { List<DerivedCube> dcubes = new ArrayList<DerivedCube>(); try { for (CubeInterface cb : getAllCubes()) { if (cb.isDerivedCube() && ((DerivedCube)cb).getParent().getName().equalsIgnoreCase(cube.getName()) && cb.allFieldsQueriable()) { dcubes.add((DerivedCube)cb); } } } catch (HiveException e) { throw new HiveException("Could not get all derived queryable cubes of " + cube, e); } return dcubes; }
Source:
private void stopGlusterServices(VDS vds) { if (vds.getVdsGroupSupportsGlusterService()) { boolean succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "stop")).getSucceeded(); if (succeeded) { succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.StopGlusterProcesses, new VdsIdVDSCommandParametersBase(vds.getId())).getSucceeded(); if (succeeded) { List<GlusterBrickEntity> bricks = glusterBrickDao.getGlusterVolumeBricksByServerId(vds.getId()); for (GlusterBrickEntity brick : bricks) { brick.setStatus(GlusterStatus.DOWN); } glusterBrickDao.updateBrickStatuses(bricks); } } if(!succeeded){ log.info("Failed to stop gluster services while moving the host '{}' to maintenance", vds.getName()); } } }

Target:
private void stopGlusterServices(VDS vds) { if (vds.getVdsGroupSupportsGlusterService()) { boolean succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "stop")).getSucceeded(); if (succeeded) { succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.StopGlusterProcesses, new VdsIdVDSCommandParametersBase(vds.getId())).getSucceeded(); if (succeeded) { List<GlusterBrickEntity> bricks = glusterBrickDao.getGlusterVolumeBricksByServerId(vds.getId()); for (GlusterBrickEntity brick : bricks) { brick.setStatus(GlusterStatus.DOWN); } glusterBrickDao.updateBrickStatuses(bricks); } } if(!succeeded){ log.error("Failed to stop gluster services while moving the host '{}' to maintenance", vds.getName()); } } }
Source:
public void setBuildStatus(String buildStatus) { StashBuildState overwrittenBuildState = null; try { overwrittenBuildState = StashBuildState.valueOf(buildStatus); } catch (Exception e) { } this.buildStatus = overwrittenBuildState; }

Target:
public void setBuildStatus(String buildStatus) { try { this.buildStatus = StashBuildState.valueOf(buildStatus); } catch (Exception e) { } }
Source:
private void ping() throws IOException, InterruptedException { Future<?> f = channel.callAsync(new Ping()); long start = System.currentTimeMillis(); long end = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(timeout); long remaining = end - System.nanoTime(); do { try { f.get(Math.max(TimeUnit.MILLISECONDS.toNanos(10),remaining),TimeUnit.NANOSECONDS); return; } catch (ExecutionException e) { if (e.getCause() instanceof RequestAbortedException) return; onDead(e); return; } catch (TimeoutException e) { } remaining = end - System.nanoTime(); } while(remaining>0); onDead(new TimeoutException("Ping started at "+start+" hasn't completed by "+System.currentTimeMillis())); }

Target:
private void ping() throws IOException, InterruptedException { Future<?> f = channel.callAsync(new Ping()); long start = System.currentTimeMillis(); long end = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(timeout); long remaining = end - System.nanoTime(); do { try { f.get(Math.max(1,remaining),TimeUnit.NANOSECONDS); return; } catch (ExecutionException e) { if (e.getCause() instanceof RequestAbortedException) return; onDead(e); return; } catch (TimeoutException e) { } remaining = end - System.nanoTime(); } while(remaining>0); onDead(new TimeoutException("Ping started at "+start+" hasn't completed by "+System.currentTimeMillis())); }
Source:
public void testOne() throws Exception { final File fileToProcess = new File( getPath("SuppressionXpathRegressionOverloadMethodsDeclarationOrder.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); final String[] expectedViolation = { "14:5: " + getCheckMessage(clazz, OverloadMethodsDeclarationOrderCheck.MSG_KEY, "5"), }; final List<String> expectedXpathQueries = Arrays.asList( "/CLASS_DEF[./IDENT" + "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]", "/CLASS_DEF[./IDENT" + "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]/MODIFIERS", "/CLASS_DEF[./IDENT" + "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]" + "/MODIFIERS/LITERAL_PUBLIC" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }

Target:
public void testOne() throws Exception { final File fileToProcess = new File( getPath("SuppressionXpathRegressionOverloadMethodsDeclarationOrder1.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); final String[] expectedViolation = { "14:5: " + getCheckMessage(clazz, OverloadMethodsDeclarationOrderCheck.MSG_KEY, "5"), }; final List<String> expectedXpathQueries = Arrays.asList( "/CLASS_DEF[./IDENT" + "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder1']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]", "/CLASS_DEF[./IDENT" + "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder1']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]/MODIFIERS", "/CLASS_DEF[./IDENT" + "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder1']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]" + "/MODIFIERS/LITERAL_PUBLIC" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }
Source:
private void addLink(String label, final PatchSet.Id id) { final Anchor anchor = new Anchor(label); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (side == Side.A) { idSideA = id; } else { idSideB = id; } Patch.Key k = new Patch.Key(idSideB, patchKey.get()); switch (screenType) { case SIDE_BY_SIDE: Gerrit.display(Dispatcher.toPatchSideBySide(idSideA, k)); break; case UNIFIED: Gerrit.display(Dispatcher.toPatchUnified(idSideA, k)); break; } } }); links.add(anchor); linkPanel.add(anchor); }

Target:
private void addLink(String label, final PatchSet.Id id) { final Anchor anchor = new Anchor(label); anchor.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (side == Side.A) { idSideA = id; } else { idSideB = id; } Patch.Key keySideB = new Patch.Key(idSideB, patchKey.get()); switch (screenType) { case SIDE_BY_SIDE: Gerrit.display(Dispatcher.toPatchSideBySide(idSideA, keySideB)); break; case UNIFIED: Gerrit.display(Dispatcher.toPatchUnified(idSideA, keySideB)); break; } } }); links.add(anchor); linkPanel.add(anchor); }
Source:
public synchronized void start() { if (!started.compareAndSet(false, true)) { logger.info("Event processor is already running"); return; } logger.info("Starting a new event processor instance with id {}", this.identifier); scheduler = Schedulers.newElastic("EventProcessor"); runner = scheduler.schedulePeriodically(partitionBasedLoadBalancer::loadBalance, INITIAL_DELAY, INTERVAL_IN_SECONDS , TimeUnit.SECONDS); }

Target:
public synchronized void start() { if (!started.compareAndSet(false, true)) { logger.info("Event processor is already running"); return; } logger.info("Starting a new event processor instance with id {}", this.identifier); scheduler = Schedulers.newElastic("EventProcessor"); Double jitterInMillis = ThreadLocalRandom.current().nextDouble() * TimeUnit.SECONDS.toMillis(BASE_JITTER_IN_SECONDS); runner = scheduler.schedulePeriodically(partitionBasedLoadBalancer::loadBalance, jitterInMillis.longValue(), TimeUnit.SECONDS.toMillis(INTERVAL_IN_SECONDS) , TimeUnit.MILLISECONDS); }
Source:
private String classReplaceToIndicativeSentence(Class<?> testClass) { Class<?> enclosingParent = testClass.getEnclosingClass(); Optional<DisplayName> displayName = AnnotationSupport.findAnnotation(testClass, DisplayName.class); Optional<DisplayNameGeneration> displayNameGeneration = AnnotationSupport.findAnnotation(testClass, DisplayNameGeneration.class); if (enclosingParent == null) { return displayName.map(DisplayName::value).orElseGet(() -> generateDisplayNameForClass(testClass)); } else { if (displayNameGeneration.isPresent()) { return displayName.map(DisplayName::value).orElseGet(() -> generateDisplayNameForClass(testClass)); } else { return displayName.map(name -> classReplaceToIndicativeSentence(enclosingParent) + getSentenceSeparator(testClass) + name.value()).orElseGet( () -> classReplaceToIndicativeSentence(enclosingParent) + getSentenceSeparator(testClass) + super.generateDisplayNameForNestedClass(testClass)); } } }

Target:
private String classReplaceToIndicativeSentence(Class<?> testClass) { Class<?> enclosingParent = testClass.getEnclosingClass(); Optional<DisplayName> displayName = AnnotationSupport.findAnnotation(testClass, DisplayName.class); Optional<DisplayNameGeneration> displayNameGeneration = AnnotationSupport.findAnnotation(testClass, DisplayNameGeneration.class); if (enclosingParent == null) { return displayName.map(DisplayName::value).orElseGet(() -> generateDisplayNameForClass(testClass)); } if (displayNameGeneration.isPresent()) { return displayName.map(DisplayName::value).orElseGet(() -> generateDisplayNameForClass(testClass)); } return displayName.map(name -> classReplaceToIndicativeSentence(enclosingParent) + getSentenceSeparator(testClass) + name.value()).orElseGet( () -> classReplaceToIndicativeSentence(enclosingParent) + getSentenceSeparator(testClass) + getGeneratorForIndicativeSentence(testClass).generateDisplayNameForNestedClass( testClass)); }
Source:
public boolean matches(ITmfEvent event) { for (ITmfFilterTreeNode node : getChildren()) { if (node.matches(event)) { return true ^ fNot; } } return false; }

Target:
public boolean matches(ITmfEvent event) { for (ITmfFilterTreeNode node : getChildren()) { if (node.matches(event)) { return true ^ fNot; } } return false ^ fNot; }
Source:
private void createClinitMethod(final ClassVisitor cv, final int probeCount) { final MethodVisitor mv = cv.visitMethod(InstrSupport.INITMETHOD_ACC, InstrSupport.CLINIT_NAME, InstrSupport.CLINIT_DESC, null, null); mv.visitCode(); final int maxStack = accessorGenerator.generateDataAccessor(classId, className, probeCount, mv); mv.visitFieldInsn(Opcodes.PUTSTATIC, className, InstrSupport.DATAFIELD_NAME, InstrSupport.DATAFIELD_DESC); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(maxStack, 0); mv.visitEnd(); }

Target:
private void createClinitMethod(final ClassVisitor cv, final int probeCount) { final MethodVisitor mv = cv.visitMethod(InstrSupport.CLINIT_ACC, InstrSupport.CLINIT_NAME, InstrSupport.CLINIT_DESC, null, null); mv.visitCode(); final int maxStack = accessorGenerator.generateDataAccessor(classId, className, probeCount, mv); mv.visitFieldInsn(Opcodes.PUTSTATIC, className, InstrSupport.DATAFIELD_NAME, InstrSupport.DATAFIELD_DESC); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(maxStack, 0); mv.visitEnd(); }
Source:
protected PartitionId getPartitionForPut(List<PartitionId> partitionIdsToExclude) throws RouterException { List<PartitionId> partitions = clusterMap.getWritablePartitionIds(); for (PartitionId partitionIdToExclude : partitionIdsToExclude) { partitions.remove(partitionIdToExclude); } if (partitions.isEmpty()) { throw new RouterException("No writable partitions available.", RouterErrorCode.AmbryUnavailable); } return partitions.get(ThreadLocalRandom.current().nextInt(partitions.size())); }

Target:
protected PartitionId getPartitionForPut(List<PartitionId> partitionIdsToExclude) throws RouterException { List<PartitionId> partitions = clusterMap.getWritablePartitionIds(); partitions.removeAll(partitionIdsToExclude); if (partitions.isEmpty()) { throw new RouterException("No writable partitions available.", RouterErrorCode.AmbryUnavailable); } return partitions.get(ThreadLocalRandom.current().nextInt(partitions.size())); }
Source:
public StreamGobbler(InputStream stream, OutputStream output) { this.reader = new BufferedReader(new InputStreamReader(stream)); if (output == null) this.writer = new BufferedWriter(new OutputStreamWriter( new ByteArrayOutputStream())); else this.writer = new BufferedWriter(new OutputStreamWriter(output)); }

Target:
public StreamGobbler(InputStream stream, OutputStream output) { this.reader = new BufferedReader(new InputStreamReader(stream)); if (output == null) this.writer = null; else this.writer = new BufferedWriter(new OutputStreamWriter(output)); }
Source:
public CauseOfBlockage getCauseOfBlockage() { if (isLogUpdated() && !isConcurrentBuild()) { final R lastBuild = getLastBuild(); if (lastBuild != null) { return new BlockedBecauseOfBuildInProgress(lastBuild); } else { LOGGER.log(Level.FINEST, "Previous build instance has been during the non-concurrent cause creation. The build is not blocked anymore"); } } if (blockBuildWhenDownstreamBuilding()) { AbstractProject<?,?> bup = getBuildingDownstream(); if (bup!=null) return new BecauseOfDownstreamBuildInProgress(bup); } if (blockBuildWhenUpstreamBuilding()) { AbstractProject<?,?> bup = getBuildingUpstream(); if (bup!=null) return new BecauseOfUpstreamBuildInProgress(bup); } return null; }

Target:
public CauseOfBlockage getCauseOfBlockage() { if (isLogUpdated() && !isConcurrentBuild()) { final R lastBuild = getLastBuild(); if (lastBuild != null) { return new BlockedBecauseOfBuildInProgress(lastBuild); } else { LOGGER.log(Level.FINE, "The last build has been deleted during the non-concurrent cause creation. The build is not blocked anymore"); } } if (blockBuildWhenDownstreamBuilding()) { AbstractProject<?,?> bup = getBuildingDownstream(); if (bup!=null) return new BecauseOfDownstreamBuildInProgress(bup); } if (blockBuildWhenUpstreamBuilding()) { AbstractProject<?,?> bup = getBuildingUpstream(); if (bup!=null) return new BecauseOfUpstreamBuildInProgress(bup); } return null; }
Source:
protected void setOptionalValues(final DlmsDevice device, final TcpConnectionBuilder tcpConnectionBuilder) throws FunctionalException { if (device.getPort() != null) { tcpConnectionBuilder.setTcpPort(device.getPort().intValue()); } if (device.getLogicalId() != null) { tcpConnectionBuilder.setLogicalDeviceId(device.getLogicalId().intValue()); } final Integer challengeLength = device.getChallengeLength(); try { if (challengeLength != null) { tcpConnectionBuilder.setChallengeLength(challengeLength); } } catch (final IllegalArgumentException e) { final String errorMessage = String.format("Challenge length has to be between 8 and 64 for device %s", device.getDeviceIdentification()); LOGGER.error(errorMessage); throw new FunctionalException(FunctionalExceptionType.CHALLENGE_LENGHT_OUT_OF_RANGE, ComponentType.PROTOCOL_DLMS, e); } }

Target:
protected void setOptionalValues(final DlmsDevice device, final TcpConnectionBuilder tcpConnectionBuilder) throws FunctionalException { if (device.getPort() != null) { tcpConnectionBuilder.setTcpPort(device.getPort().intValue()); } if (device.getLogicalId() != null) { tcpConnectionBuilder.setLogicalDeviceId(device.getLogicalId().intValue()); } final Integer challengeLength = device.getChallengeLength(); try { if (challengeLength != null) { tcpConnectionBuilder.setChallengeLength(challengeLength); } } catch (final IllegalArgumentException e) { final String errorMessage = String.format("Challenge length has to be between 8 and 64 for device %s", device.getDeviceIdentification()); LOGGER.error(errorMessage); throw new FunctionalException(FunctionalExceptionType.CHALLENGE_LENGTH_OUT_OF_RANGE, ComponentType.PROTOCOL_DLMS, e); } }
Source:
public synchronized void decrement(String name, String fieldName, double score) { modifyFieldValue(name, fieldName, score); }

Target:
public void decrement(String name, String fieldName, double score) { modifyFieldValue(name, fieldName, -score); }
Source:
static int getShard(WriteInfo writeInfo) { int shard = writeInfo.tableRefCell().hashCode() % SHARDS; return (shard + SHARDS) % SHARDS; }

Target:
static int getShard(WriteInfo writeInfo) { return IntMath.mod(writeInfo.tableRefCell().hashCode(), SHARDS); }
Source:
private static String findPath() { String filename = System.getProperty("postgres.pgservicefile"); if (filename == null) { filename = System.getenv().get("PGSERVICEFILE"); } if (filename == null) { filename = System.getProperty("user.home") + "/.pgservices.conf"; } return filename; }

Target:
private static String findPath() { String filename = System.getProperty("org.postgresql.pgservicefile"); if (filename == null) { filename = System.getenv().get("PGSERVICEFILE"); } if (filename == null) { filename = System.getProperty("user.home") + File.separator + ".pg_service.conf"; } return filename; }
Source:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateEscalationEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertEscalationEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateEscalationEvent emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertEscalationEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
List<String> fetchTableHeaders() { return isAdmin() ? SUPER_MOD_HEADERS : HEADERS; }

Target:
List<String> fetchTableHeaders() { return isAdmin() ? HEADERS_FOR_ADMIN : HEADERS; }
Source:
private URI relativize(File file) { if (base == null) { try { return file.getCanonicalFile().toURI(); } catch (final IOException ex) { return file.toURI(); } } Path filePath = file.toPath() .toAbsolutePath(); Path relativePath = base.relativize(filePath); URI relativeURI = URI.create(IO.normalizePath(relativePath)); reporter.trace("Resolving %s relative to %s; Relative Path: %s, URI: %s", filePath, base, relativePath, relativeURI); return relativeURI; }

Target:
private URI relativize(File file) { if (base == null) { return file.toURI(); } Path filePath = file.toPath() .toAbsolutePath(); Path relativePath = base.relativize(filePath); URI relativeURI = URI.create(IO.normalizePath(relativePath)); reporter.trace("Resolving %s relative to %s; Relative Path: %s, URI: %s", filePath, base, relativePath, relativeURI); return relativeURI; }
Source:
public void theDatabaseShouldBeUpdatedSoItIndicatesThatDeviceEIsUsingFirmwareVersion( final String deviceIdentification, final String firmwareVersion) throws Throwable { final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification); assertNotNull(device); final Firmware firmware = this.firmwareRepository.findByFilename(firmwareVersion); assertNotNull(firmware); final Firmware activeFirmware = device.getActiveFirmware(); assertNotNull(activeFirmware); assertTrue(activeFirmware.getFilename().equals(firmware.getFilename())); assertTrue(activeFirmware.getModuleVersionComm().equals(firmware.getModuleVersionComm())); assertTrue(activeFirmware.getModuleVersionFunc().equals(firmware.getModuleVersionFunc())); assertTrue(activeFirmware.getModuleVersionMa().equals(firmware.getModuleVersionMa())); }

Target:
public void theDatabaseShouldBeUpdatedSoItIndicatesThatDeviceEIsUsingFirmwareVersion( final String deviceIdentification, final String firmwareVersion) throws Throwable { final Device device = this.deviceRepository.findByDeviceIdentification(deviceIdentification); assertNotNull("Device not found.", device); final Firmware firmware = this.firmwareRepository.findByFilename(firmwareVersion); assertNotNull("Firmware not found.", firmware); final Firmware activeFirmware = device.getActiveFirmware(); assertNotNull("No active firmware found for device.", activeFirmware); assertEquals("Firmware filenames do not match.", firmware.getFilename(), activeFirmware.getFilename()); assertEquals("Firmware fields module_version_comm do not match.", firmware.getModuleVersionComm(), activeFirmware.getModuleVersionComm()); assertEquals("Firmware fields module_version_func do not match.", firmware.getModuleVersionFunc(), activeFirmware.getModuleVersionFunc()); assertEquals("Firmware fields module_version_ma do not match.", firmware.getModuleVersionMa(), activeFirmware.getModuleVersionMa()); }
Source:
private boolean hostExists(List<GlusterServerInfo> glusterServers, VDS server) { if (GlusterFeatureSupported.glusterHostUuidSupported(getVdsGroup().getcompatibility_version())) { VdsGluster vdsGluster = DbFacade.getInstance().getVdsGlusterDao().getById(getVds().getId()); if (vdsGluster != null) { for (GlusterServerInfo glusterServer : glusterServers) { if (glusterServer.getUuid().equals(vdsGluster.getGlusterHostUuid())) { return true; } } } } else { for (GlusterServerInfo glusterServer : glusterServers) { if (glusterServer.getHostnameOrIp().equals(server.getHostName())) { return true; } for (VdsNetworkInterface vdsNwInterface : getVdsInterfaces(server.getId())) { if (glusterServer.getHostnameOrIp().equals(vdsNwInterface.getAddress())) { return true; } } } } return false; }

Target:
private boolean hostExists(List<GlusterServerInfo> glusterServers, VDS server) { if (GlusterFeatureSupported.glusterHostUuidSupported(getVdsGroup().getcompatibility_version())) { GlusterServer glusterServer = DbFacade.getInstance().getGlusterServerDao().getByServerId(server.getId()); if (glusterServer != null) { for (GlusterServerInfo glusterServerInfo : glusterServers) { if (glusterServerInfo.getUuid().equals(glusterServer.getGlusterServerUuid())) { return true; } } } } else { for (GlusterServerInfo glusterServer : glusterServers) { if (glusterServer.getHostnameOrIp().equals(server.getHostName())) { return true; } try { String glusterHostAddr = InetAddress.getByName(glusterServer.getHostnameOrIp()).getHostAddress(); for (VdsNetworkInterface vdsNwInterface : getVdsInterfaces(server.getId())) { if (glusterHostAddr.equals(vdsNwInterface.getAddress())) { return true; } } } catch (UnknownHostException e) { log.errorFormat("Could not resole IP address of the host {0}. Error: {1}", glusterServer.getHostnameOrIp(), e.getMessage()); } } } return false; }
Source:
private static boolean isHttpUrlOptions(RemoteOptions options) { return options.remoteCache != null && !options.remoteCache.isEmpty() && options.remoteCache.startsWith("http"); }

Target:
private static boolean isHttpUrlOptions(RemoteOptions options) { return options.remoteCache != null && options.remoteCache.toLowerCase().startsWith("http"); }
Source:
public void testRecordSubmoduleLabels() throws Exception { try ( Repository remoteDb = createBareRepository(); Repository tempDb = createWorkRepository()) { StringBuilder xmlContent = new StringBuilder(); xmlContent .append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"test\" ") .append("revision=\"master\" ") .append("name=\"").append(notDefaultUri).append("\" ") .append("groups=\"a1,a2\" />") .append("</manifest>"); JGitTestUtil.writeTrashFile(tempDb, "manifest.xml", xmlContent.toString()); RepoCommand command = new RepoCommand(remoteDb); command.setPath(tempDb.getWorkTree().getAbsolutePath() + "/manifest.xml") .setURI(rootUri) .setRecordSubmoduleLabels(true) .call(); File directory = createTempDirectory("testBareRepo"); try (Repository localDb = Git.cloneRepository() .setDirectory(directory) .setURI(remoteDb.getDirectory().toURI().toString()).call() .getRepository();) { File gitmodules = new File(localDb.getWorkTree(), ".gitmodules"); assertTrue("The .gitmodules file should exist", gitmodules.exists()); FileBasedConfig c = new FileBasedConfig(gitmodules, FS.DETECTED); c.load(); Set<String> expect = new HashSet<String>(); expect.add("a1"); expect.add("a2"); Set<String> actual = new HashSet<String>(); actual.addAll(Arrays.asList(c.getStringList("submodule", "test", "label"))); assertEquals("recording labels works", expect, actual); } } }

Target:
public void testRecordSubmoduleLabels() throws Exception { try ( Repository remoteDb = createBareRepository(); Repository tempDb = createWorkRepository()) { StringBuilder xmlContent = new StringBuilder(); xmlContent .append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"test\" ") .append("revision=\"master\" ") .append("name=\"").append(notDefaultUri).append("\" ") .append("groups=\"a1,a2\" />") .append("</manifest>"); JGitTestUtil.writeTrashFile(tempDb, "manifest.xml", xmlContent.toString()); RepoCommand command = new RepoCommand(remoteDb); command.setPath(tempDb.getWorkTree().getAbsolutePath() + "/manifest.xml") .setURI(rootUri) .setRecordSubmoduleLabels(true) .call(); File directory = createTempDirectory("testBareRepo"); try (Repository localDb = Git.cloneRepository() .setDirectory(directory) .setURI(remoteDb.getDirectory().toURI().toString()).call() .getRepository();) { File gitmodules = new File(localDb.getWorkTree(), ".gitmodules"); assertTrue("The .gitmodules file should exist", gitmodules.exists()); FileBasedConfig c = new FileBasedConfig(gitmodules, FS.DETECTED); c.load(); Set<String> expect = new HashSet<String>(); expect.add("a1"); expect.add("a2"); Set<String> actual = new HashSet<String>(); actual.addAll(Arrays.asList(c.getStringList("submodule", "test", "label"))); assertEquals("Recorded labels should be the same as in the manifest", expect, actual); } } }
Source:
private static void addTumorTypeToRows(TumorType tumorType, List<String> rows, List<String> parents) { List<String> row = new ArrayList<>(); String displayName = StringUtils.defaultString(tumorType.getName()).trim() + " (" + StringUtils.defaultString(tumorType.getCode()).trim() + ")"; row.addAll(parents); row.add(displayName); for (int i = 4; i > parents.size(); i--) { row.add(""); } row.add(StringUtils.defaultString(tumorType.getMainType() != null ? tumorType.getMainType().getName() : "")); row.add(StringUtils.defaultString(tumorType.getColor())); row.add(StringUtils.defaultString(tumorType.getNCI())); row.add(StringUtils.defaultString(tumorType.getUMLS())); rows.add(StringUtils.join(row, "\t")); Map<String, TumorType> children = tumorType.getChildren(); if (children.size() > 0) { parents.add(displayName); for (String code : children.keySet()) { TumorType child = children.get(code); addTumorTypeToRows(child, rows, parents); } parents.remove(parents.size() - 1); } }

Target:
private static void addTumorTypeToRows(TumorType tumorType, List<String> rows, List<String> parents) { List<String> row = new ArrayList<>(); String oncotreeCode = StringUtils.defaultString(tumorType.getCode()).trim(); if (parents.size() > 4) { throw new RuntimeException("Oncotree depth for code " + oncotreeCode + " exceeds max representation. Depth cannot be > 5"); } String displayName = StringUtils.defaultString(tumorType.getName()).trim() + " (" + oncotreeCode + ")"; row.addAll(parents); row.add(displayName); for (int i = 4; i > parents.size(); i--) { row.add(""); } row.add(StringUtils.defaultString(tumorType.getMainType() != null ? tumorType.getMainType().getName() : "")); row.add(StringUtils.defaultString(tumorType.getColor())); row.add(StringUtils.defaultString(tumorType.getNCI())); row.add(StringUtils.defaultString(tumorType.getUMLS())); rows.add(StringUtils.join(row, "\t")); Map<String, TumorType> children = tumorType.getChildren(); if (children.size() > 0) { parents.add(displayName); for (String code : children.keySet()) { TumorType child = children.get(code); addTumorTypeToRows(child, rows, parents); } parents.remove(parents.size() - 1); } }
Source:
private static int megabytes(int size) { return toIntExact(new DataSize(size, DataSize.Unit.MEGABYTE).toBytes()); }

Target:
private static int megabytes(int size) { return toIntExact(new DataSize(size, MEGABYTE).toBytes()); }
Source:
private String getExtraClass(String giverEmail, String instructorEmail, boolean isPublic) { StringBuilder extraClass = new StringBuilder(50); extraClass.append(" giver_display-by-") .append(giverEmail.equals(instructorEmail) ? "you" : "others") .append(" status_display-") .append(isPublic ? "public" : "private"); return extraClass.toString(); }

Target:
private String getExtraClass(String giverEmail, String instructorEmail, boolean isPublic) { return " giver_display-by-" + (giverEmail.equals(instructorEmail) ? "you" : "others") + " status_display-" + (isPublic ? "public" : "private"); }
Source:
private static void startGUI(String guiName, String[] args) { final String METHOD_NAME = "startGUI(String, String[])"; if (null == guiName) { getLogger().error(MegaMek.class, METHOD_NAME, "guiName must be non-null"); return; } if (null == args) { getLogger().error(MegaMek.class, METHOD_NAME, "args must be non-null"); return; } IMegaMekGUI mainGui = MegaMek.getGui(guiName); if (mainGui == null) { getLogger().info(MegaMek.class, METHOD_NAME, UNKNOWN_GUI_MESSAGE + guiName); System.exit(1); } else { StringBuffer message = new StringBuffer("Starting GUI "); message.append(guiName).append(". "); MegaMek.dumpArgs(message, args); getLogger().info(MegaMek.class, METHOD_NAME, message.toString()); mainGui.start(args); } }

Target:
private static void startGUI(String guiName, String[] args) { final String METHOD_NAME = "startGUI(String, String[])"; if (null == guiName) { getLogger().error(MegaMek.class, METHOD_NAME, "guiName must be non-null"); return; } if (null == args) { getLogger().error(MegaMek.class, METHOD_NAME, "args must be non-null"); return; } IMegaMekGUI mainGui = MegaMek.getGui(guiName); if (mainGui == null) { getLogger().fatal(MegaMek.class, METHOD_NAME, UNKNOWN_GUI_MESSAGE + guiName); System.exit(1); } else { StringBuffer message = new StringBuffer("Starting GUI "); message.append(guiName).append(". "); MegaMek.dumpArgs(message, args); getLogger().info(MegaMek.class, METHOD_NAME, message.toString()); mainGui.start(args); } }
Source:
public void beforeCompletion() { try { if ( prepared ) { if ( log.isTraceEnabled() ) { log.tracef( "Transaction's beforeCompletion() phase already been processed, ignoring: %s", this.toString() ); } } else { if ( log.isTraceEnabled() ) { log.tracef( "Processing Transaction's beforeCompletion() phase: %s", this.toString() ); } queueingProcessor.prepareWorks( queue ); prepared = true; } if ( log.isTraceEnabled() ) { log.tracef( "Processing Transaction's afterCompletion() phase for %s. Performing work.", this.toString() ); } queueingProcessor.performWorks( queue ); } finally { consumed = true; if ( queuePerTransaction != null ) { queuePerTransaction.remove( transactionIdentifier ); } } }

Target:
public void beforeCompletion() { try { if ( prepared ) { log.tracef( "Transaction's beforeCompletion() phase already been processed, ignoring: %s", this ); } else { log.tracef( "Processing Transaction's beforeCompletion() phase: %s", this ); queueingProcessor.prepareWorks( queue ); prepared = true; } log.tracef( "Processing Transaction's afterCompletion() phase for %s. Performing work.", this ); queueingProcessor.performWorks( queue ); } finally { consumed = true; if ( queuePerTransaction != null ) { queuePerTransaction.remove( transactionIdentifier ); } } }
Source:
private void validateSchema(Schema inputSchema, List<String> uniqueFields, @Nullable DedupConfig.DedupFunctionInfo function, FailureCollector collector) { for (String uniqueField : uniqueFields) { Schema.Field field = inputSchema.getField(uniqueField); if (field == null) { collector.addFailure(String.format("Cannot do an unique on field '%s' because it does " + "not exist in inputSchema", uniqueField), "Remove this entry.").withConfigElement("uniqueFields", uniqueField); } } if (function != null) { Schema.Field field = inputSchema.getField(function.getField()); if (field == null) { collector.addFailure(String.format( "Invalid filter %s(%s): Field '%s' does not exist in input schema ", function.getFunction(), function.getField(), function.getField()), "Remove this entry").withConfigProperty("filterOperation"); } } }

Target:
private void validateSchema(Schema inputSchema, List<String> uniqueFields, @Nullable DedupConfig.DedupFunctionInfo function, FailureCollector collector) { for (String uniqueField : uniqueFields) { Schema.Field field = inputSchema.getField(uniqueField); if (field == null) { collector.addFailure(String.format("Field '%s' does not exist in the input schema", uniqueField), "") .withConfigElement("uniqueFields", uniqueField); } } if (function != null) { Schema.Field field = inputSchema.getField(function.getField()); if (field == null) { collector.addFailure(String.format("Invalid filter %s(%s): Field '%s' does not exist in input schema ", function.getFunction(), function.getField(), function.getField()), null) .withConfigProperty("filterOperation"); } } }