auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void sendOutcomeWithValue(@NonNull String name, float value, OutcomeCallback callback) { <START> if (!isValidOutcomeEntry(name) && !isValidOutcomeValue(value)) <END> return; if (outcomeEventsController == null) { OneSignal.Log(LOG_LEVEL.ERROR, "Make sure OneSignal.init is called first"); return; } outcomeEventsController.sendOutcomeEventWithValue(name, value, callback); }</code><technical_language>This instead of AND</technical_language>

Target:
public static void sendOutcomeWithValue(@NonNull String name, float value, OutcomeCallback callback) { if (!isValidOutcomeEntry(name) || !isValidOutcomeValue(value)) return; if (outcomeEventsController == null) { OneSignal.Log(LOG_LEVEL.ERROR, "Make sure OneSignal.init is called first"); return; } outcomeEventsController.sendOutcomeEventWithValue(name, value, callback); }
Source:
<code>private PerfTimer(final String title, final int reportingFrequency) { this.title = title; this.reportingFrequency = reportingFrequency; <START> this.startMillis = this.reportingFrequency > 0 ? System.nanoTime() : 0; <END> }</code><technical_language>Start millis reporting frequency actual start nano time is potentially confusing levels. 1. variable milli assign nanos it. 2. variable another. a variable's meaning depend context previous call history is a SRP violation. want variables internally nullable. Another option is a simple internal object track this for us, object provide a nice API abstract time keeping details</technical_language>

Target:
private PerfTimer(final String title, final int reportingFrequency) { this.title = title; this.reportingFrequency = reportingFrequency; this.startNanos = System.nanoTime(); }
Source:
<code>public void initSequence(String key, int id) { try { Bson filter = and(eq(MongoDBSerializationHelper.MONGODB_ID, key), not(gte(SEQUENCE_VALUE_FIELD, id))); Document sequence = new Document(); sequence.put(MongoDBSerializationHelper.MONGODB_ID, key); sequence.put(SEQUENCE_VALUE_FIELD, id); getSequencerCollection().replaceOne(filter, sequence, new UpdateOptions().upsert(true)); } catch (MongoWriteException e) { if (log.isWarnEnabled()) { log.warn("Failed to update the sequence '" + key + "' with value "+id, e); <START> } <END> } }</code><technical_language>If a problem log rethrow exception (NuxeoException). Logging get buried, want; want crash if is wrong MongoDB access sequence value</technical_language>

Target:
public void initSequence(String key, int id) { try { Bson filter = and(eq(MongoDBSerializationHelper.MONGODB_ID, key), not(gte(SEQUENCE_VALUE_FIELD, id))); Document sequence = new Document(); sequence.put(MongoDBSerializationHelper.MONGODB_ID, key); sequence.put(SEQUENCE_VALUE_FIELD, id); getSequencerCollection().replaceOne(filter, sequence, new UpdateOptions().upsert(true)); } catch (MongoWriteException e) { throw new NuxeoException("Failed to update the sequence '" + key + "' with value " + id, e); } }
Source:
<code>public void addTaskAssocation(ITask review, TaskData taskData) { TaskAttribute attr = taskData.getRoot().getMappedAttribute(TaskAttribute.DESCRIPTION); if (attr == null) { return; } String description = attr.getValue(); for (String token : description.split("\\s+")) { if (token.contains("://")) { try { @SuppressWarnings("unused") URL url = new URL(token); ITask task = getTaskByUrl(token); if (task != null) { review.setAttribute(ATTR_ASSOCIATED_TASK, task.getUrl()); <START> updateMapping(review, task); <END> break; } else { review.setAttribute(ATTR_ASSOCIATED_TASK, null); } } catch (MalformedURLException e) { } } } }</code><technical_language>Yup problem :)</technical_language>

Target:
public void addTaskAssocation(ITask review, TaskData taskData) { TaskAttribute attr = taskData.getRoot().getMappedAttribute(TaskAttribute.DESCRIPTION); if (attr == null) { return; } String description = attr.getValue(); for (String token : description.split("\\s+")) { if (token.contains("://")) { try { @SuppressWarnings("unused") URL url = new URL(token); ITask task = getTaskByUrl(token); if (task != null) { updateMapping(review, task); review.setAttribute(ATTR_ASSOCIATED_TASK, task.getUrl()); return; } } catch (MalformedURLException e) { } } } deleteMappingsTo(review); }
Source:
<code>public V get(final K key) throws CacheLoaderException { getObserver.begin(); <START> cacheLoaderObserver.begin(); <END> statusTransitioner.checkAvailable(); checkNonNull(key); final Function<K, V> mappingFunction = memoize( new Function<K, V>() { @Override public V apply(final K k) { V loaded = null; try { if (cacheLoader != null) { loaded = cacheLoader.load(k); cacheLoaderObserver.end(CacheLoaderOutcome.SUCCESS); } } catch (Exception e) { cacheLoaderObserver.end(CacheLoaderOutcome.FAILURE); throw newCacheLoaderException(e); } return loaded; } }); try { final Store.ValueHolder<V> valueHolder = store.computeIfAbsent(key, mappingFunction); if (valueHolder == null) { getObserver.end(cacheLoader == null ? GetOutcome.MISS_NO_LOADER : GetOutcome.MISS_WITH_LOADER); return null; } else { getObserver.end(cacheLoader == null ? GetOutcome.HIT_NO_LOADER : GetOutcome.HIT_WITH_LOADER); return valueHolder.value(); } } catch (CacheAccessException e) { getObserver.end(GetOutcome.FAILURE); removeKeysWithStrategy(Collections.singleton(key), e); return mappingFunction.apply(key); } catch (CacheLoaderException e) { getObserver.end(GetOutcome.FAILURE); removeKeysWithStrategy(Collections.singleton(key), e); throw e; } }</code><technical_language>This cache loader starts. cache loader is call line 137</technical_language>

Target:
public V get(final K key) throws CacheLoaderException { getObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key); final Function<K, V> mappingFunction = memoize( new Function<K, V>() { @Override public V apply(final K k) { V loaded = null; try { if (cacheLoader != null) { cacheLoaderObserver.begin(); loaded = cacheLoader.load(k); cacheLoaderObserver.end(CacheLoaderOutcome.SUCCESS); getObserver.end(loaded != null ? GetOutcome.HIT_WITH_LOADER : GetOutcome.MISS_WITH_LOADER); } } catch (Exception e) { cacheLoaderObserver.end(CacheLoaderOutcome.FAILURE); throw newCacheLoaderException(e); } return loaded; } }); try { final Store.ValueHolder<V> valueHolder = store.computeIfAbsent(key, mappingFunction); if (valueHolder == null) { if (cacheLoader == null) { getObserver.end(GetOutcome.MISS_NO_LOADER); } return null; } else { if (cacheLoader == null) { getObserver.end(GetOutcome.HIT_NO_LOADER); } return valueHolder.value(); } } catch (CacheAccessException e) { getObserver.end(GetOutcome.FAILURE); removeKeysWithStrategy(Collections.singleton(key), e); return mappingFunction.apply(key); } catch (CacheLoaderException e) { getObserver.end(GetOutcome.FAILURE); removeKeysWithStrategy(Collections.singleton(key), e); throw e; } }
Source:
<code>public void sendTicketTransferMail(User sender, User receiver, String url) throws MessagingException { <START> String message = "The user \"" + sender.getUsername() + "\" has send you a ticket for AreaFiftyLAN! To accept this ticket please click on the following link: " + url; <END> sendMail(receiver.getEmail(), receiver.getUsername(), null, "A ticket for AreaFiftyLAN has been sent to you!", message); }</code><technical_language>change this include full name of sender. Tickets bought, a filled in profile is guaranteed. term "user" want say. people! :stuck_out_tongue_winking_eye:</technical_language>

Target:
public void sendTicketTransferMail(User sender, User receiver, String url) throws MessagingException { String message = sender.getProfile().firstName + " has send you a ticket for AreaFiftyLAN! To accept this ticket please click on the following link: " + url; sendMail(receiver.getEmail(), receiver.getProfile().getFirstName() + receiver.getProfile().getLastName(), null, "A ticket for AreaFiftyLAN has been sent to you!", message); }
Source:
<code>public void factoryWithDirectUrlWithRootFolder() { String repositoryName = testRepo.getName(); List<String> expectedItemsAfterCloning = Arrays.asList( "CHANGELOG.md", "Dockerfile", "LICENSE.txt", "README.md", "favicon.ico", "index.html", "karma-test-shim.js", "karma.conf.js", "package.json", "protractor.config.js", "styles.css", "systemjs.config.js", "tsconfig.json", "tslint.json", "typings.json", "wallaby.js"); testFactoryWithRootFolder.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); <START> theiaIde.waitNotificationDisappearance("Che Workspace: Finished cloning projects."); <END> theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.expandItem(repositoryName); expectedItemsAfterCloning.forEach( name -> { theiaProjectTree.waitItem(repositoryName + "/" + name); }); }</code><technical_language>duplicates next waitNotificationDisappearance()</technical_language>

Target:
public void factoryWithDirectUrlWithRootFolder() { String repositoryName = testRepo.getName(); List<String> expectedItemsAfterCloning = Arrays.asList( "CHANGELOG.md", "Dockerfile", "LICENSE.txt", "README.md", "favicon.ico", "index.html", "karma-test-shim.js", "karma.conf.js", "package.json", "protractor.config.js", "styles.css", "systemjs.config.js", "tsconfig.json", "tslint.json", "typings.json", "wallaby.js"); testFactoryWithRootFolder.authenticateAndOpen(); theiaIde.switchToIdeFrame(); theiaIde.waitTheiaIde(); theiaIde.waitLoaderInvisibility(); theiaIde.waitNotificationDisappearance( "Che Workspace: Finished cloning projects.", UPDATING_PROJECT_TIMEOUT_SEC); theiaProjectTree.waitFilesTab(); theiaProjectTree.clickOnFilesTab(); theiaProjectTree.waitItem(repositoryName); theiaProjectTree.expandItem(repositoryName); expectedItemsAfterCloning.forEach( name -> { theiaProjectTree.waitItem(repositoryName + "/" + name); }); }
Source:
<code>public void updateProjectionResults( final TransactionBase tx, final VisibilityBindingSet childBindingSet, final ProjectionMetadata projectionMetadata) throws Exception { checkNotNull(tx); checkNotNull(childBindingSet); checkNotNull(projectionMetadata); log.trace( "Transaction ID: " + tx.getStartTimestamp() + "\n" + "Node ID: " + projectionMetadata.getNodeId() + "\n" + "Parent Node ID: " + projectionMetadata.getParentNodeId() + "\n" + "Child Node ID: " + projectionMetadata.getChildNodeId() + "\n" + "Child Binding Set:\n" + childBindingSet + "\n"); final VariableOrder queryVarOrder = projectionMetadata.getVariableOrder(); final VariableOrder projectionVarOrder = projectionMetadata.getProjectedVars(); final BindingSet queryBindingSet = BindingSetUtil.keepBindings(projectionVarOrder, childBindingSet); VisibilityBindingSet projectedBs = new VisibilityBindingSet(queryBindingSet, childBindingSet.getVisibility()); <START> Bytes resultRow = getRowKey(projectionMetadata.getNodeId(), queryVarOrder, projectedBs); <END> final Bytes nodeValueBytes = BS_SERDE.serialize(projectedBs); log.trace( "Transaction ID: " + tx.getStartTimestamp() + "\n" + "New Binding Set: " + childBindingSet + "\n"); tx.set(resultRow, FluoQueryColumns.PROJECTION_BINDING_SET, nodeValueBytes); }</code><technical_language>create get</technical_language>

Target:
public void updateProjectionResults( final TransactionBase tx, final VisibilityBindingSet childBindingSet, final ProjectionMetadata projectionMetadata) throws Exception { checkNotNull(tx); checkNotNull(childBindingSet); checkNotNull(projectionMetadata); log.trace( "Transaction ID: " + tx.getStartTimestamp() + "\n" + "Node ID: " + projectionMetadata.getNodeId() + "\n" + "Parent Node ID: " + projectionMetadata.getParentNodeId() + "\n" + "Child Node ID: " + projectionMetadata.getChildNodeId() + "\n" + "Child Binding Set:\n" + childBindingSet + "\n"); final VariableOrder queryVarOrder = projectionMetadata.getVariableOrder(); final VariableOrder projectionVarOrder = projectionMetadata.getProjectedVars(); final BindingSet queryBindingSet = BindingSetUtil.keepBindings(projectionVarOrder, childBindingSet); VisibilityBindingSet projectedBs = new VisibilityBindingSet(queryBindingSet, childBindingSet.getVisibility()); Bytes resultRow = makeRowKey(projectionMetadata.getNodeId(), queryVarOrder, projectedBs); final Bytes nodeValueBytes = BS_SERDE.serialize(projectedBs); log.trace( "Transaction ID: " + tx.getStartTimestamp() + "\n" + "New Binding Set: " + childBindingSet + "\n"); tx.set(resultRow, FluoQueryColumns.PROJECTION_BINDING_SET, nodeValueBytes); }
Source:
<code><START> public ShellCommandProcessor(AbstractByteArraySerializer serializer, String command) { <END> this(serializer, StringUtils.delimitedListToStringArray(command," ")); }</code><technical_language>cases want this, this overloaded constructor prevents a single argument spaces. is done of this class, I drop this constructor</technical_language>

Target:
public ShellCommandProcessor(AbstractByteArraySerializer serializer, String command) { Assert.hasLength(command, "A shell command is required"); Assert.notNull(serializer, "'serializer' cannot be null"); this.command = command; List<String> commandPlusArgs = parse(command); Assert.notEmpty(commandPlusArgs, "The shell command is invalid: '" + command + "'"); this.serializer = serializer; processBuilder = new ProcessBuilder(commandPlusArgs); }
Source:
<code>public void put(T element) { fInputLock.lock(); try { <START> fQueueSize.incrementAndGet(); <END> fInputBuffer.add(element); fInputBufferSize++; if (fInputBufferSize >= fChunkSize) { this.flushInputBuffer(); } } finally { fInputLock.unlock(); } }</code><technical_language>increment happen element inserted</technical_language>

Target:
public void put(T element) { fInputLock.lock(); try { fInputBuffer.add(element); fQueueSize.incrementAndGet(); fInputBufferSize++; if (fInputBufferSize >= fChunkSize) { this.flushInputBuffer(); } } finally { fInputLock.unlock(); } }
Source:
<code>public void LargeTest() { ITmfStateSystemBuilder fixture = createFixture(); int parentQuark = fixture.getQuarkAbsoluteAndAdd(PROCESS_PATH, THREAD_PATH, CALLSTACK_PATH); for (int i = 0; i < LARGE_AMOUNT_OF_SEGMENTS; i++) { int quark = fixture.getQuarkRelativeAndAdd(parentQuark, Integer.toString(i)); TmfStateValue statev = TmfStateValue.newValueLong(i); fixture.modifyAttribute(0, statev, quark); <START> fixture.modifyAttribute(10, TmfStateValue.nullValue(), quark); <END> } fixture.closeHistory(1002); String[] csp = { CALLSTACK_PATH }; String[] pp = { PROCESS_PATH }; String[] tp = { THREAD_PATH }; CGAnalysis cga = new CGAnalysis(); assertTrue(cga.iterateOverStateSystem(fixture, tp, pp, csp, new NullProgressMonitor())); ISegmentStore<@NonNull ISegment> segmentStore = cga.getSegmentStore(); assertNotNull(segmentStore); Object[] segments = segmentStore.toArray(); assertEquals("Number of segments found", LARGE_AMOUNT_OF_SEGMENTS, segments.length, ERROR); }</code><technical_language>length here? Is OK? a loop fixture.pushAttribute callStack timestamp difference time another loop fixture.popAttribute them. produce a nice pyramid of LARGE_AMOUNT_OF_SEGMENTS depth</technical_language>

Target:
public void LargeTest() { ITmfStateSystemBuilder fixture = createFixture(); int parentQuark = fixture.getQuarkAbsoluteAndAdd(PROCESS_PATH, THREAD_PATH, CALLSTACK_PATH); for (int i = 0; i < LARGE_AMOUNT_OF_SEGMENTS; i++) { int quark = fixture.getQuarkRelativeAndAdd(parentQuark, Integer.toString(i)); TmfStateValue statev = TmfStateValue.newValueLong(i); fixture.pushAttribute(0, statev, quark); } for (int i = 0; i < LARGE_AMOUNT_OF_SEGMENTS; i++) { int quark = fixture.getQuarkRelativeAndAdd(parentQuark, Integer.toString(i)); fixture.popAttribute(10, quark); } fixture.closeHistory(1002); CGAnalysis cga = new CGAnalysis(); assertTrue(cga.iterateOverStateSystem(fixture, tp, pp, csp, new NullProgressMonitor())); ISegmentStore<@NonNull ISegment> segmentStore = cga.getSegmentStore(); assertNotNull(segmentStore); Object[] segments = segmentStore.toArray(); assertEquals("Number of segments found", LARGE_AMOUNT_OF_SEGMENTS, segments.length, ERROR); }
Source:
<code>public void write(ObjectDataOutput out, SerializedPage page) throws IOException { out.writeInt(page.getPageId()); out.writeUTF(page.getPageType()); <START> out.write(page.getData()); <END> }</code><technical_language>writeByteArray(page.getData())</technical_language>

Target:
public void write(ObjectDataOutput out, SerializedPage page) throws IOException { out.writeInt(page.getPageId()); out.writeUTF(page.getPageType()); out.writeByteArray(page.getData()); }
Source:
<code>void setApp(@NonNull AppWithState app) { <START> impl.app = app; <END> }</code><technical_language>Is reason access this wrt property accessor function? change getters/setters</technical_language>

Target:
void setApp(@NonNull AppWithState app) { impl.setApp(app); }
Source:
<code>Monitor getMonitor (long hmonitor) { MONITORINFO lpmi = new MONITORINFO (); lpmi.cbSize = MONITORINFO.sizeof; OS.GetMonitorInfo (hmonitor, lpmi); Monitor monitor = new Monitor (); monitor.handle = hmonitor; Rectangle boundsInPixels = new Rectangle (lpmi.rcMonitor_left, lpmi.rcMonitor_top, lpmi.rcMonitor_right - lpmi.rcMonitor_left,lpmi.rcMonitor_bottom - lpmi.rcMonitor_top); monitor.setBounds (DPIUtil.autoScaleDown (boundsInPixels)); Rectangle clientAreaInPixels = new Rectangle (lpmi.rcWork_left, lpmi.rcWork_top, lpmi.rcWork_right - lpmi.rcWork_left, lpmi.rcWork_bottom - lpmi.rcWork_top); monitor.setClientArea (DPIUtil.autoScaleDown (clientAreaInPixels)); if (OS.WIN32_VERSION >= OS.VERSION (6, 3)) { int dpiX = new int[1]; int dpiY = new int[1]; int result = OS.GetDpiForMonitor (monitor.handle, OS.MDT_EFFECTIVE_DPI, dpiX, dpiY); result = (result == OS.S_OK) ? DPIUtil.mapDPIToZoom (dpiX[0]) : 100; monitor.zoom = DPIUtil.getZoomForAutoscaleProperty (result); } else { <START> long hDC = OS.GetDC (0); int dpi = OS.GetDeviceCaps (hDC, OS.LOGPIXELSX); OS.ReleaseDC (0, hDC); monitor.zoom = DPIUtil.mapDPIToZoom (dpi); <END> } return monitor; }</code><technical_language>code exists a method in Device.getDeviceZoom(), please replace below: monitor.zoom = getDeviceZoom();</technical_language>

Target:
Monitor getMonitor (long hmonitor) { MONITORINFO lpmi = new MONITORINFO (); lpmi.cbSize = MONITORINFO.sizeof; OS.GetMonitorInfo (hmonitor, lpmi); Monitor monitor = new Monitor (); monitor.handle = hmonitor; Rectangle boundsInPixels = new Rectangle (lpmi.rcMonitor_left, lpmi.rcMonitor_top, lpmi.rcMonitor_right - lpmi.rcMonitor_left,lpmi.rcMonitor_bottom - lpmi.rcMonitor_top); monitor.setBounds (DPIUtil.autoScaleDown (boundsInPixels)); Rectangle clientAreaInPixels = new Rectangle (lpmi.rcWork_left, lpmi.rcWork_top, lpmi.rcWork_right - lpmi.rcWork_left, lpmi.rcWork_bottom - lpmi.rcWork_top); monitor.setClientArea (DPIUtil.autoScaleDown (clientAreaInPixels)); if (OS.WIN32_VERSION >= OS.VERSION (6, 3)) { int dpiX = new int[1]; int dpiY = new int[1]; int result = OS.GetDpiForMonitor (monitor.handle, OS.MDT_EFFECTIVE_DPI, dpiX, dpiY); result = (result == OS.S_OK) ? DPIUtil.mapDPIToZoom (dpiX[0]) : 100; monitor.zoom = DPIUtil.getZoomForAutoscaleProperty (result); } else { monitor.zoom = getDeviceZoom (); } return monitor; }
Source:
<code>public void testErrorWithMaxSeverityWarn() throws IOException { <START> warnPrinter.error(null, ERROR_MSG, new Location(LINE_NUMBER, COLUMN_NUMBER)); <END> warnPrinter.close(); assertEquals(expectedOutput(null, Severity.WARNING, ERROR_MSG, LINE_NUMBER, COLUMN_NUMBER), outContent.toString(Charset.defaultCharset().name())); }</code><technical_language>Do testing null? If no, substitute rule (like other cases in this test class). If yes, tests consistently testing null</technical_language>

Target:
public void testErrorWithMaxSeverityWarn() throws IOException { warnPrinter.error(Rules.LOWER_CAMEL_CASE, ERROR_MSG, new Location(LINE_NUMBER, COLUMN_NUMBER)); warnPrinter.close(); assertEquals(expectedOutput(Rules.LOWER_CAMEL_CASE, Severity.WARNING, ERROR_MSG, LINE_NUMBER, COLUMN_NUMBER), outContent.toString(Charset.defaultCharset().name())); }
Source:
<code>public void render(List<T> dataList) { getView().removeAllViews(); if (dataList.size() == 0) { LayoutInflater inflater = LayoutInflater.from(getContext()); <START> View rowView = inflater.inflate(emptyViewRenderer.getRowLayout(null), getView()); <END> emptyViewRenderer.render(rowView, null); } for (T data : dataList) { LayoutInflater inflater = LayoutInflater.from(getContext()); View rowView = inflater.inflate(rowRenderer.getRowLayout(data), getView(), false); rowRenderer.render(rowView, data); getView().addView(rowView); } }</code><technical_language>inflate it. paradigm ListViewInitializer layout include View for empty view</technical_language>

Target:
public void render(List<T> dataList) { getView().removeAllViews(); if (dataList.size() == 0) { getView().addView(emptyView); } for (T data : dataList) { LayoutInflater inflater = LayoutInflater.from(getContext()); View rowView = inflater.inflate(rowRenderer.getRowLayout(data), getView(), false); rowRenderer.render(rowView, data); getView().addView(rowView); } }
Source:
<code>private void unregisterListeners() { <START> Display.getDefault().asyncExec(new Runnable() { <END> @Override public void run() { ISelectionService selectionService = ((ISelectionService) getWorkbench().getService(ISelectionService.class)); if (selectionService != null) { selectionService.removeSelectionListener(UiPlugin.this.contextActivatingSelectionListener); } } }); CorePlugin.listenerRegistry().removeEventListener(this.workingSetsAddingProjectCreatedListener); CorePlugin.listenerRegistry().removeEventListener(this.executionShowingBuildLaunchRequestListener); DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this.consoleShowingLaunchListener); }</code><technical_language>Display object obtained IWorkbench interface tested if disposed. IMHO this: java Display display = PlatformUI.getWorkbench().getDisplay(); if (display != null && !display.isDisposed()) { display.asyncExec(...) }</technical_language>

Target:
private void unregisterListeners() { Display display = PlatformUI.getWorkbench().getDisplay(); if (display != null && !display.isDisposed()) { display.asyncExec(new Runnable() { @Override public void run() { ISelectionService selectionService = ((ISelectionService) getWorkbench().getService(ISelectionService.class)); if (selectionService != null) { selectionService.removeSelectionListener(UiPlugin.this.contextActivatingSelectionListener); } } }); } CorePlugin.listenerRegistry().removeEventListener(this.workingSetsAddingProjectCreatedListener); CorePlugin.listenerRegistry().removeEventListener(this.executionShowingBuildLaunchRequestListener); DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this.consoleShowingLaunchListener); }
Source:
<code>public void testSimpleAtomicBlockwisePUTWithSmallerNegociation() throws Exception { System.out.println("Simple atomic blockwise PUT with smaller size negociation"); reqtPayload = generateRandomPayload(200); respPayload = generateRandomPayload(50); String path = "test"; Request request = createRequest(PUT, path, server); request.setPayload(reqtPayload); client.sendRequest(request); server.expectRequest(CON, PUT, path).storeBoth("A").block1(0, true, 128).payload(reqtPayload.substring(0, 128)).go(); server.sendResponse(ACK, CONTINUE).loadBoth("A").block1(0, true, 32).go(); server.expectRequest(CON, PUT, path).storeBoth("B").block1(4, true, 32).payload(reqtPayload.substring(128, 160)).go(); server.sendResponse(ACK, CONTINUE).loadBoth("B").block1(4, true, 32).go(); server.expectRequest(CON, PUT, path).storeBoth("C").block1(5, true, 32).payload(reqtPayload.substring(160, 192)).go(); server.sendResponse(ACK, CHANGED).loadBoth("C").block1(5, true, 32).go(); <START> server.expectRequest(CON, PUT, path).storeBoth("D").block1(6, false, 32).go(); <END> server.sendResponse(ACK, CHANGED).loadBoth("D").block1(6, false, 32).payload(respPayload).go(); Response response = request.waitForResponse(1000); assertResponseContainsExpectedPayload(response, CHANGED, respPayload); printServerLog(clientInterceptor); }</code><technical_language>PUT remaining bytes (193 - 200) payload</technical_language>

Target:
public void testSimpleAtomicBlockwisePUTWithSmallerNegociation() throws Exception { System.out.println("Simple atomic blockwise PUT with smaller size negociation"); reqtPayload = generateRandomPayload(200); respPayload = generateRandomPayload(50); String path = "test"; Request request = createRequest(PUT, path, server); request.setPayload(reqtPayload); client.sendRequest(request); server.expectRequest(CON, PUT, path).storeBoth("A").block1(0, true, 128).payload(reqtPayload.substring(0, 128)).go(); server.sendResponse(ACK, CONTINUE).loadBoth("A").block1(0, true, 32).go(); server.expectRequest(CON, PUT, path).storeBoth("B").block1(4, true, 32).payload(reqtPayload.substring(128, 160)).go(); server.sendResponse(ACK, CONTINUE).loadBoth("B").block1(4, true, 32).go(); server.expectRequest(CON, PUT, path).storeBoth("C").block1(5, true, 32).payload(reqtPayload.substring(160, 192)).go(); server.sendResponse(ACK, CHANGED).loadBoth("C").block1(5, true, 32).go(); server.expectRequest(CON, PUT, path).storeBoth("D").block1(6, false, 32) .payload(reqtPayload.substring(192, 200)).go(); server.sendResponse(ACK, CHANGED).loadBoth("D").block1(6, false, 32).payload(respPayload).go(); Response response = request.waitForResponse(1000); assertResponseContainsExpectedPayload(response, CHANGED, respPayload); printServerLog(clientInterceptor); }
Source:
<code>public void undeploySynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("Undeployment of the API named : " + artifactName + " : Started"); } try { API api = getSynapseConfiguration().getAPI(artifactName); if (api != null) { api.setLogSetterValue(); getSynapseConfiguration().removeAPI(artifactName); if (log.isDebugEnabled()) { log.debug("Undeployment of the API named : " + artifactName + " : Completed"); } String unDeployTime = String.valueOf(System.currentTimeMillis()); log.info("API named '" + api.getName() + "' has been undeployed"); <START> executeSynapseHandlerOnArtifactUnDeployment(api.getName(),"api", unDeployTime); <END> } else if (log.isDebugEnabled()) { log.debug("API " + artifactName + " has already been undeployed"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "Undeployment of API named : " + artifactName + " : Failed", e); } }</code><technical_language>reuse constant instead of "api"</technical_language>

Target:
public void undeploySynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("Undeployment of the API named : " + artifactName + " : Started"); } try { API api = getSynapseConfiguration().getAPI(artifactName); if (api != null) { api.setLogSetterValue(); getSynapseConfiguration().removeAPI(artifactName); if (log.isDebugEnabled()) { log.debug("Undeployment of the API named : " + artifactName + " : Completed"); } String unDeployTime = String.valueOf(System.currentTimeMillis()); executeSynapseHandlerOnArtifactUnDeployment(api.getName(), SynapseConstants.FAIL_SAFE_MODE_API, unDeployTime); log.info("API named '" + api.getName() + "' has been undeployed"); } else if (log.isDebugEnabled()) { log.debug("API " + artifactName + " has already been undeployed"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "Undeployment of API named : " + artifactName + " : Failed", e); } }
Source:
<code>public void init(FunctionInvokeContext context) throws IOException { UDFInvocationDesc udfDesc = functionDesc.getInvocation().getUDF(); URL urls = new URL { new URL(udfDesc.getPath()) }; URLClassLoader loader = new URLClassLoader(urls); try { Class<?> udfclass = loader.loadClass(udfDesc.getName()); evalMethod = getEvaluateMethod(functionDesc.getParamTypes(), udfclass); } catch (ClassNotFoundException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>Throwing exception is required</technical_language>

Target:
public void init(FunctionInvokeContext context) throws IOException { UDFInvocationDesc udfDesc = functionDesc.getInvocation().getUDF(); URL urls = new URL { new URL(udfDesc.getPath()) }; URLClassLoader loader = new URLClassLoader(urls); try { Class<?> udfclass = loader.loadClass(udfDesc.getName()); evalMethod = getEvaluateMethod(functionDesc.getParamTypes(), udfclass); } catch (ClassNotFoundException e) { throw new TajoInternalError(e); } }
Source:
<code>private static String createWithConstructorBulk(final Arguments arg, final String requestName) { <START> String constructor = new String(); <END> if (bulkBaseClassArgs.contains(arg.getName())) { constructor += indent(1) + "@Override\n" + withConstructorFirstLine(arg, requestName) + indent(2) + "super.with" + capFirst(arg.getName()) + "(" + uncapFirst(arg.getName()) + ");\n"; } else if (arg.getName().equals("MaxUploadSize")) { constructor += maxUploadSizeWithConstructor(arg, requestName); } else if (arg.getType().equals("void")) { constructor += voidWithConstructor(arg, requestName); } else { constructor += withConstructor(arg, requestName); } constructor += indent(2) + "return this;\n" + indent(1) + "}\n"; return constructor; }</code><technical_language>a StringBuilder instead of a String</technical_language>

Target:
public static String createWithConstructorBulk(final Arguments arg, final String requestName) { final StringBuilder stringBuilder = new StringBuilder(); if (bulkBaseClassArgs.contains(arg.getName())) { stringBuilder.append(indent(1) + "@Override\n" + withConstructorFirstLine(arg, requestName) + indent(2) + "super.with" + capFirst(arg.getName()) + "(" + uncapFirst(arg.getName()) + ");\n"); } else if (arg.getName().equals("MaxUploadSize")) { stringBuilder.append(maxUploadSizeWithConstructor(arg, requestName)); } else if (arg.getType().equals("void")) { stringBuilder.append(voidWithConstructor(arg, requestName)); } else { stringBuilder.append(withConstructor(arg, requestName)); } stringBuilder.append(indent(2) + "return this;\n" + indent(1) + "}\n"); return stringBuilder.toString(); }
Source:
<code>public Page getOutput() { if (unfinishedWork != null && !processUnfinishedWork()) { return null; } if (groupByIds == null) { return null; } verify(pageBuilder.getPositionCount() == 0); verify(inputPage != null); for (int position = 0; position < groupByIds.getPositionCount(); position++) { if (groupByIds.getGroupId(position) == nextDistinctId) { pageBuilder.declarePosition(); for (int channel = 0; channel < types.size(); channel++) { Type type = types.get(channel); type.appendTo(inputPage.getBlock(channel), position, pageBuilder.getBlockBuilder(channel)); } remainingLimit--; nextDistinctId++; if (remainingLimit == 0) { break; } } } groupByIds = null; inputPage = null; Page result = null; if (!pageBuilder.isEmpty()) { result = pageBuilder.build(); <START> pageBuilder.reset(); <END> } updateMemory(); return result; }</code><technical_language>previously calling pageBuilder.reset(); unconditionally in addInput setting memory reservation, is correct move call do in a conditional way</technical_language>

Target:
public Page getOutput() { if (unfinishedWork != null && !processUnfinishedWork()) { return null; } if (groupByIds == null) { return null; } verify(pageBuilder.getPositionCount() == 0); verify(inputPage != null); for (int position = 0; position < groupByIds.getPositionCount(); position++) { if (groupByIds.getGroupId(position) == nextDistinctId) { pageBuilder.declarePosition(); for (int channel = 0; channel < types.size(); channel++) { Type type = types.get(channel); type.appendTo(inputPage.getBlock(channel), position, pageBuilder.getBlockBuilder(channel)); } remainingLimit--; nextDistinctId++; if (remainingLimit == 0) { break; } } } groupByIds = null; inputPage = null; Page result = null; if (!pageBuilder.isEmpty()) { result = pageBuilder.build(); pageBuilder.reset(); } updateMemoryReservation(); return result; }
Source:
<code><START> protected static Reference findPrimaryReference(List<Reference> references) { <END> List<Reference> followsFrom = references.stream() .filter(ref -> ref.getReferenceType() == References.FOLLOWS_FROM) .collect(Collectors.toList()); List<Reference> childOfSpan = references.stream() .filter(ref -> ref.getReferenceType() == References.CHILD_OF && ref.getReferredTo() instanceof APMSpan) .collect(Collectors.toList()); List<Reference> childOfSpanContext = references.stream() .filter(ref -> ref.getReferenceType() == References.CHILD_OF && ref.getReferredTo() instanceof APMSpanBuilder) .collect(Collectors.toList()); if (!childOfSpanContext.isEmpty()) { if (childOfSpanContext.size() == 1) { return childOfSpanContext.get(0); } return null; } if (!childOfSpan.isEmpty()) { if (childOfSpan.size() == 1) { return childOfSpan.get(0); } } if (followsFrom.size() == 1) { return followsFrom.get(0); } return null; }</code><technical_language>this need protected static? <LINK_0></technical_language>

Target:
public static Reference findPrimaryReference(List<Reference> references) { List<Reference> followsFrom = references.stream() .filter(ref -> References.FOLLOWS_FROM.equals(ref.getReferenceType()) && ref.getReferredTo() instanceof APMSpan) .collect(Collectors.toList()); List<Reference> childOfSpan = references.stream() .filter(ref -> References.CHILD_OF.equals(ref.getReferenceType()) && ref.getReferredTo() instanceof APMSpan) .collect(Collectors.toList()); List<Reference> extractedTraceState = references.stream() .filter(ref -> ref.getReferredTo() instanceof APMSpanBuilder) .collect(Collectors.toList()); if (!extractedTraceState.isEmpty()) { if (extractedTraceState.size() == 1) { return extractedTraceState.get(0); } return null; } if (!childOfSpan.isEmpty()) { if (childOfSpan.size() == 1) { return childOfSpan.get(0); } return null; } if (followsFrom.size() == 1) { return followsFrom.get(0); } return null; }
Source:
<code>private void loadResourcePids() { Optional<BulkExportJobEntity> jobOpt = myBulkExportJobDao.findByJobId(myJobUUID); if (!jobOpt.isPresent()) { <START> ourLog.info("Job appears to be deleted"); <END> return; } myJobEntity = jobOpt.get(); ourLog.info("Bulk export starting generation for batch export job: {}", myJobEntity); IFhirResourceDao dao = myDaoRegistry.getResourceDao(myResourceType); ourLog.info("Bulk export assembling export of type for job {}", myResourceType, myJobUUID); Class<? extends IBaseResource> nextTypeClass = myContext.getResourceDefinition(myResourceType).getImplementingClass(); ISearchBuilder sb = mySearchBuilderFactory.newSearchBuilder(dao, myResourceType, nextTypeClass); SearchParameterMap map = new SearchParameterMap(); map.setLoadSynchronous(true); if (myJobEntity.getSince() != null) { map.setLastUpdated(new DateRangeParam(myJobEntity.getSince(), null)); } IResultIterator myResultIterator = sb.createQuery(map, new SearchRuntimeDetails(null, myJobUUID), null, RequestPartitionId.allPartitions()); List<ResourcePersistentId> myReadPids = new ArrayList<>(); while (myResultIterator.hasNext()) { myReadPids.add(myResultIterator.next()); } myPidIterator = myReadPids.iterator(); }</code><technical_language>warn</technical_language>

Target:
private void loadResourcePids() { Optional<BulkExportJobEntity> jobOpt = myBulkExportJobDao.findByJobId(myJobUUID); if (!jobOpt.isPresent()) { ourLog.warn("Job appears to be deleted"); return; } myJobEntity = jobOpt.get(); ourLog.info("Bulk export starting generation for batch export job: {}", myJobEntity); IFhirResourceDao dao = myDaoRegistry.getResourceDao(myResourceType); ourLog.info("Bulk export assembling export of type for job {}", myResourceType, myJobUUID); Class<? extends IBaseResource> nextTypeClass = myContext.getResourceDefinition(myResourceType).getImplementingClass(); ISearchBuilder sb = mySearchBuilderFactory.newSearchBuilder(dao, myResourceType, nextTypeClass); SearchParameterMap map = new SearchParameterMap(); map.setLoadSynchronous(true); if (myJobEntity.getSince() != null) { map.setLastUpdated(new DateRangeParam(myJobEntity.getSince(), null)); } IResultIterator myResultIterator = sb.createQuery(map, new SearchRuntimeDetails(null, myJobUUID), null, RequestPartitionId.allPartitions()); List<ResourcePersistentId> myReadPids = new ArrayList<>(); while (myResultIterator.hasNext()) { myReadPids.add(myResultIterator.next()); } myPidIterator = myReadPids.iterator(); }
Source:
<code>public void testRdfOutput() { DumpProcessingAction action = new RdfSerializationAction(); action.open(); action.close(); assertEquals(action.getReport(), <START> "Finished serialization of 24 RDF triples in file null"); <END> }</code><technical_language>This is a robust test. number 24 change soon change vocabulary</technical_language>

Target:
public void testRdfOutput() { String[] args = { "-a", "rdf", "-o", "output/wikidata.rdf" }; ClientConfiguration configuration = new ClientConfiguration(args); DumpProcessingAction action = configuration.actions.get(0); action.open(); action.close(); assertTrue(action .getReport() .matches( "Finished serialization of \\d+ RDF triples in file output/wikidata.rdf")); }
Source:
<code>public void testConflictingOptionsTvsP() throws Exception { exit.expectSystemExitWithStatus(-1); exit.checkAssertionAfterwards(() -> { assertEquals("Option '-t' cannot be used with other options." + System.lineSeparator(), systemOut.getLog()); assertEquals("", systemErr.getLog()); }); <START> Main.main("-p", getPath("mycheckstyle.properties"), "-t", <END> getNonPackagePath("checks/metrics")); }</code><technical_language>mycheckstyle.properties name test start Input</technical_language>

Target:
public void testConflictingOptionsTvsP() throws Exception { exit.expectSystemExitWithStatus(-1); exit.checkAssertionAfterwards(() -> { assertEquals("Option '-t' cannot be used with other options." + System.lineSeparator(), systemOut.getLog()); assertEquals("", systemErr.getLog()); }); Main.main("-p", getPath("InputMainMycheckstyle.properties"), "-t", getPath("")); }
Source:
<code>public void deleteAllTimestampsOnSingleHost( TableReference tableRef, InetSocketAddress host, Map<Cell, Long> maxTimestampExclusiveByCell) { if (maxTimestampExclusiveByCell.isEmpty()) { return; } try { clientPool.runWithRetryOnHost(host, new FunctionCheckedException<CassandraClient, Void, Exception>() { @Override public Void apply(CassandraClient client) throws Exception { Map<ByteBuffer, Map<String, List<Mutation>>> mutationsByRowByTable = Maps.newHashMap(); <START> maxTimestampExclusiveByCell.forEach((cell, maxTimestampExclusive) -> { <END> SlicePredicate pred = SlicePredicates.rangeTombstoneForColumn( cell.getColumnName(), maxTimestampExclusive); Deletion del = new Deletion(); del.setPredicate(pred); del.setTimestamp(Long.MAX_VALUE); Mutation mutation = new Mutation(); mutation.setDeletion(del); mutationsByRowByTable .computeIfAbsent(ByteBuffer.wrap(cell.getRowName()), ignored -> new HashMap<>()) .computeIfAbsent(internalTableName(tableRef), ignored -> new ArrayList<>()) .add(mutation); }); batchMutateInternal("deleteAllTimestamps", client, tableRef, mutationsByRowByTable, deleteConsistency); return null; } @Override public String toString() { return "delete_timestamp_ranges_batch_mutate(" + host + ", " + tableRef.getQualifiedName() + ", " + maxTimestampExclusiveByCell.size() + " column timestamp ranges)"; } }); } catch (UnavailableException e) { throw new InsufficientConsistencyException("Deleting requires all Cassandra nodes to be up and available.", e); } catch (Exception e) { throw QosAwareThrowables.unwrapAndThrowRateLimitExceededOrAtlasDbDependencyException(e); } }</code><technical_language>This method is long, this lambda in big for a lambda me. Consider pulling out methods more readable (I'd happily pair this if sitting distantly)</technical_language>

Target:
public void deleteAllTimestampsOnSingleHost( TableReference tableRef, InetSocketAddress host, Map<Cell, Long> maxTimestampExclusiveByCell) { if (maxTimestampExclusiveByCell.isEmpty()) { return; } try { clientPool.runWithRetryOnHost(host, new FunctionCheckedException<CassandraClient, Void, Exception>() { @Override public Void apply(CassandraClient client) throws Exception { insertRangeTombstones(client, maxTimestampExclusiveByCell, tableRef); return null; } @Override public String toString() { return "delete_timestamp_ranges_batch_mutate(" + host + ", " + tableRef.getQualifiedName() + ", " + maxTimestampExclusiveByCell.size() + " column timestamp ranges)"; } }); } catch (UnavailableException e) { throw new InsufficientConsistencyException("Deleting requires all Cassandra nodes to be up and available.", e); } catch (Exception e) { throw QosAwareThrowables.unwrapAndThrowRateLimitExceededOrAtlasDbDependencyException(e); } }
Source:
<code>public FutureSuccess(ProducerRecord record, int offset) { this.record = record; <START> this._metadata = new RecordMetadata(new TopicPartition(record.topic(), record.partition() == null ? 0 : record.partition()), 0, offset, -1L, -1, -1, -1); <END> }</code><technical_language>nit: So, Record.NO_TIMESTAMP constant is removed? I thought is more readable -1L</technical_language>

Target:
public FutureSuccess(ProducerRecord record, int offset) { this.record = record; this._metadata = new RecordMetadata(new TopicPartition(record.topic(), record.partition() == null ? 0 : record.partition()), 0, offset, RecordBatch.NO_TIMESTAMP, -1, -1, -1); }
Source:
<code>public void run() { File trustStoreFile = new File(TRUST_STORE); FileInputStream localTrustStoreStream; try { long lastUpdatedTimeStamp = CertificateReLoaderUtil.getLastUpdatedTimeStamp(); long lastModified = trustStoreFile.lastModified(); if (lastUpdatedTimeStamp != lastModified) { CertificateReLoaderUtil.setLastUpdatedTimeStamp(lastModified); localTrustStoreStream = new FileInputStream(trustStoreFile); KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(localTrustStoreStream, TRUST_STORE_PASSWORD); ServiceReferenceHolder.getInstance().setTrustStore(trustStore); } } catch (KeyStoreException | CertificateException | IOException | NoSuchAlgorithmException e) { <START> log.error("Certificate Couldn't find", e); <END> } }</code><technical_language>Unable find certificate</technical_language>

Target:
public void run() { if (StringUtils.isNotEmpty(TRUST_STORE_PASSWORD)) { File trustStoreFile = new File(TRUST_STORE); FileInputStream localTrustStoreStream; try { long lastUpdatedTimeStamp = CertificateReLoaderUtil.getLastUpdatedTimeStamp(); long lastModified = trustStoreFile.lastModified(); if (lastUpdatedTimeStamp != lastModified) { CertificateReLoaderUtil.setLastUpdatedTimeStamp(lastModified); localTrustStoreStream = new FileInputStream(trustStoreFile); KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(localTrustStoreStream, TRUST_STORE_PASSWORD.toCharArray()); ServiceReferenceHolder.getInstance().setTrustStore(trustStore); } } catch (KeyStoreException | CertificateException | IOException | NoSuchAlgorithmException e) { log.error("Unable to find the certificate", e); } } }
Source:
<code>protected void doDeleteItem( final ResourceStoreRequest request ) throws UnsupportedStorageOperationException, ItemNotFoundException, StorageException { super.doDeleteItem( request ); if ( getRepositoryKind().isFacetAvailable( MavenHostedRepository.class ) ) { String parentPath = request.getRequestPath(); parentPath = parentPath.substring( 0, parentPath.lastIndexOf( RepositoryItemUid.PATH_SEPARATOR ) ); final String parentMetadataPath = parentPath + "/maven-metadata.xml"; try { if ( getLocalStorage().containsItem( this, new ResourceStoreRequest( parentMetadataPath ) ) ) { recreateMavenMetadata( new ResourceStoreRequest( parentPath ) ); } } catch ( Exception e ) { <START> getLogger().warn( "Could not determine if Maven metadata should be rebuild", e ); <END> } } }</code><technical_language>misleading log message. logged recreateMavenMetadata throws exception. read "could maintain Maven metadata" include path of metadata.xml file</technical_language>

Target:
protected void doDeleteItem( final ResourceStoreRequest request ) throws UnsupportedStorageOperationException, ItemNotFoundException, StorageException { super.doDeleteItem( request ); if ( getRepositoryKind().isFacetAvailable( MavenHostedRepository.class ) ) { String parentPath = request.getRequestPath(); parentPath = parentPath.substring( 0, parentPath.lastIndexOf( RepositoryItemUid.PATH_SEPARATOR ) ); final String parentMetadataPath = parentPath + "/maven-metadata.xml"; try { if ( getLocalStorage().containsItem( this, new ResourceStoreRequest( parentMetadataPath ) ) ) { recreateMavenMetadata( new ResourceStoreRequest( parentPath ) ); } } catch ( Exception e ) { getLogger().warn( "Could not maintain Maven metadata '{}'", parentMetadataPath, e ); } } }
Source:
<code>public long numberOfShards() { <START> return getOrInitializeTo(NUMBER_OF_SHARDS_INDEX, true, 1L); <END> }</code><technical_language>Strong suggestion: enum bool, for readability reduce mental mapping</technical_language>

Target:
public long numberOfShards() { return getOrInitializeTo(ShardAndStrategy.conservative(SHARD_COUNT_INDEX), INITIAL_SHARDS); }
Source:
<code><START> public Map<Object, T> getExpandedItems() { <END> return Collections.unmodifiableMap(expandedItems); }</code><technical_language>I return collection of items, a mapping. a client code perspective, necessary a mapping (someone recalculate object ids if needed), items expanded. I suggest limit this method return Collection<T></technical_language>

Target:
public Collection<T> getExpandedItems() { return Collections.unmodifiableCollection(expandedItems.values()); }
Source:
<code>public boolean validate(Library library) { if (library.getSample().getSampleAdditionalInfo() == null) return true; if (library.getSample().getSampleAdditionalInfo().getSampleClass().getSampleClassId() != sampleClass.getSampleClassId()) return false; if (library.getLibraryType().getLibraryTypeId() != libraryType.getLibraryTypeId()) return false; <START> if (library.getLibrarySelectionType().getLibrarySelectionTypeId() != librarySelectionType) return false; <END> if (library.getLibraryStrategyType().getLibraryStrategyTypeId() != libraryStrategyType) return false; return true; }</code><technical_language>Masellclash</technical_language>

Target:
public boolean validate(Library library) { if (library.getSample().getSampleAdditionalInfo() == null) return true; if (library.getSample().getSampleAdditionalInfo().getSampleClass().getId() != sampleClass.getId()) return false; if (library.getLibraryType().getId() != libraryType.getId()) return false; if (library.getLibrarySelectionType().getId() != librarySelectionType) return false; if (library.getLibraryStrategyType().getId() != libraryStrategyType) return false; return true; }