auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void verify(PublicKey key, Provider sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { <START> verifyInternal(key, sigProvider); <END> }</code><technical_language>Hmm, a need for this verify(PublicKey) is calling verifyInternal(PublicKey, String). other new method simply inlined here. intent is create a fast path BoringSSL, this check: if (key instanceof OpenSSLKeyHolder && sigProvider instanceof OpenSSLProvider) { OpenSSLKey pkey = ((OpenSSLKeyHolder) key).getOpenSSLKey(); verifyOpenSSL(pkey); return; }</technical_language>

Target:
public void verify(PublicKey key, Provider sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException { if (key instanceof OpenSSLKeyHolder && sigProvider instanceof OpenSSLProvider) { OpenSSLKey pkey = ((OpenSSLKeyHolder) key).getOpenSSLKey(); verifyOpenSSL(pkey); return; } final Signature sig; if (sigProvider == null) { sig = Signature.getInstance(getSigAlgName()); } else { sig = Signature.getInstance(getSigAlgName(), sigProvider); } sig.initVerify(key); sig.update(getTBSCertificate()); if (!sig.verify(getSignature())) { throw new SignatureException("signature did not verify"); } }
Source:
<code>public synchronized Set<RemoteTask> scheduleSplits(Node node, Multimap<PlanNodeId, Split> splits, Multimap<PlanNodeId, Lifespan> noMoreSplitsNotification) { requireNonNull(node, "node is null"); requireNonNull(splits, "splits is null"); splitsScheduled.set(true); checkArgument(stateMachine.getFragment().getPartitionedSources().containsAll(splits.keySet()), "Invalid splits"); ImmutableSet.Builder<RemoteTask> newTasks = ImmutableSet.builder(); Collection<RemoteTask> tasks = this.tasks.get(node); RemoteTask task; if (tasks == null) { TaskId taskId = new TaskId(stateMachine.getStageId(), nextTaskId.getAndIncrement()); <START> task = scheduleTask(node, taskId, splits, -1, -1); <END> newTasks.add(task); } else { task = tasks.iterator().next(); task.addSplits(splits); } if (noMoreSplitsNotification.size() > 1) { throw new UnsupportedOperationException("This assumption no longer holds: noMoreSplitsNotification.size() < 1"); } for (Entry<PlanNodeId, Lifespan> entry : noMoreSplitsNotification.entries()) { task.noMoreSplits(entry.getKey(), entry.getValue()); } return newTasks.build(); }</code><technical_language>If values optional, model OptionalInt instead of magic "-1"</technical_language>

Target:
public synchronized Set<RemoteTask> scheduleSplits(Node node, Multimap<PlanNodeId, Split> splits, Multimap<PlanNodeId, Lifespan> noMoreSplitsNotification) { requireNonNull(node, "node is null"); requireNonNull(splits, "splits is null"); splitsScheduled.set(true); checkArgument(stateMachine.getFragment().getPartitionedSources().containsAll(splits.keySet()), "Invalid splits"); ImmutableSet.Builder<RemoteTask> newTasks = ImmutableSet.builder(); Collection<RemoteTask> tasks = this.tasks.get(node); RemoteTask task; if (tasks == null) { TaskId taskId = new TaskId(stateMachine.getStageId(), nextTaskId.getAndIncrement()); task = scheduleTask(node, taskId, splits, OptionalInt.empty()); newTasks.add(task); } else { task = tasks.iterator().next(); task.addSplits(splits); } if (noMoreSplitsNotification.size() > 1) { throw new UnsupportedOperationException("This assumption no longer holds: noMoreSplitsNotification.size() < 1"); } for (Entry<PlanNodeId, Lifespan> entry : noMoreSplitsNotification.entries()) { task.noMoreSplits(entry.getKey(), entry.getValue()); } return newTasks.build(); }
Source:
<code>private String parseResultMap(Method method) { Class<?> returnType = getReturnType(method); ConstructorArgs args = method.getAnnotation(ConstructorArgs.class); Arg arg = method.getAnnotation(Arg.class); Results results = method.getAnnotation(Results.class); Result result = method.getAnnotation(Result.class); TypeDiscriminator typeDiscriminator = method.getAnnotation(TypeDiscriminator.class); String resultMapId = generateResultMapName(method); <START> applyResultMap(resultMapId, returnType, argsIf(args, arg, method), resultsIf(results, result, method), typeDiscriminator); <END> return resultMapId; }</code><technical_language>remove resultsIf() argsIf() method.getAnnotationsByType(Result.class) method.getAnnotationsByType(Arg.class) instead. If applied this change, tests fail. - shouldErrorWhenSpecifyBothArgAndConstructorArgs - shouldErrorWhenSpecifyBothResultAndResults usages weird, for sure, throw exception if handle properly, I think</technical_language>

Target:
private String parseResultMap(Method method) { Class<?> returnType = getReturnType(method); Arg[] args = method.getAnnotationsByType(Arg.class); Result[] results = method.getAnnotationsByType(Result.class); TypeDiscriminator typeDiscriminator = method.getAnnotation(TypeDiscriminator.class); String resultMapId = generateResultMapName(method); applyResultMap(resultMapId, returnType, args, results, typeDiscriminator); return resultMapId; }
Source:
<code>protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { IKernelTrace trace = checkNotNull((IKernelTrace) getTrace()); IKernelAnalysisEventLayout layout = trace.getKernelEventLayout(); String dir = TmfTraceManager.getSupplementaryFileDir(trace); final Path file = Paths.get(dir, DATA_FILENAME); if (Files.exists(file)) { <START> System.out.println("re-read existing file!"); END> try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(file))) { @SuppressWarnings("unchecked") ISegmentStore<ISegment> syscalls = (ISegmentStore<ISegment>) ois.readObject(); fSystemCalls = syscalls; System.out.println(syscalls.getNbElements() + " syscalls"); return true; } catch (IOException | ClassNotFoundException | ClassCastException e) { try { Files.delete(file); } catch (IOException e1) { } } } ISegmentStore<ISegment> syscalls = new TreeMapStore<>(); ITmfEventRequest req = new LatencyAnalysisRequest(layout, syscalls); trace.sendRequest(req); try { req.waitForCompletion(); } catch (InterruptedException e) { } fSystemCalls = syscalls; System.out.println(syscalls.getNbElements() + " syscalls"); try (ObjectOutputStream oos = new ObjectOutputStream(Files.newOutputStream(file))) { System.out.println("writing new file!"); oos.writeObject(syscalls); } catch (IOException e) { } for (LatencyAnalysisListener listener : fListeners) { listener.onComplete(syscalls); } return true; }</code><technical_language>remove</technical_language>

Target:
protected boolean executeAnalysis(IProgressMonitor monitor) throws TmfAnalysisException { IKernelTrace trace = checkNotNull((IKernelTrace) getTrace()); IKernelAnalysisEventLayout layout = trace.getKernelEventLayout(); String dir = TmfTraceManager.getSupplementaryFileDir(trace); final Path file = Paths.get(dir, DATA_FILENAME); if (Files.exists(file)) { try (ObjectInputStream ois = new ObjectInputStream(Files.newInputStream(file))) { @SuppressWarnings("unchecked") ISegmentStore<ISegment> syscalls = (ISegmentStore<ISegment>) ois.readObject(); fSystemCalls = syscalls; return true; } catch (IOException | ClassNotFoundException | ClassCastException e) { try { Files.delete(file); } catch (IOException e1) { } } } ISegmentStore<ISegment> syscalls = new TreeMapStore<>(); ITmfEventRequest req = new LatencyAnalysisRequest(layout, syscalls); trace.sendRequest(req); try { req.waitForCompletion(); } catch (InterruptedException e) { } fSystemCalls = syscalls; try (ObjectOutputStream oos = new ObjectOutputStream(Files.newOutputStream(file))) { oos.writeObject(syscalls); } catch (IOException e) { } for (LatencyAnalysisListener listener : fListeners) { listener.onComplete(syscalls); } return true; }
Source:
<code>public boolean isDocumentPending(@NonNull String docId) throws CouchbaseLiteException { Preconditions.checkArgNotNull(docId, "document ID"); if (config.getReplicatorType().equals(ReplicatorConfiguration.ReplicatorType.PULL)) { throw new CouchbaseLiteException( "Pending Document IDs are not supported on pull-only replicators.", Log.LOGGING_DOMAINS_TO_C4.get(DOMAIN), CBLError.Code.UNSUPPORTED); } final C4Replicator repl; synchronized (lock) { repl = c4repl; } if (repl == null) { Log.i(DOMAIN, "%s: Call to isDocumentPending with unstarted replicator", this); return false; } try { return c4repl.isDocumentPending(docId); } catch (LiteCoreException e) { <START> Log.w(DOMAIN, "Error while fetching pending documentIds: %d/%d", e.domain, e.code); <END> } return false; }</code><technical_language>I throw CouchbaseLiteException here</technical_language>

Target:
public boolean isDocumentPending(@NonNull String docId) throws CouchbaseLiteException { Preconditions.checkArgNotNull(docId, "document ID"); if (config.getReplicatorType().equals(ReplicatorConfiguration.ReplicatorType.PULL)) { throw new CouchbaseLiteException( "Pending Document IDs are not supported on pull-only replicators.", Log.LOGGING_DOMAINS_TO_C4.get(DOMAIN), CBLError.Code.UNSUPPORTED); } final C4Replicator repl; synchronized (lock) { repl = c4repl; } if (repl == null) { Log.i(DOMAIN, "%s: Call to isDocumentPending with unstarted replicator", this); return false; } try { return c4repl.isDocumentPending(docId); } catch (LiteCoreException e) { throw CBLStatus.convertException(e, "Failed getting document pending status"); } }
Source:
<code>public void startListening(final Server server) { if(!checkAndAddServer(server)) { return; } else { if(server.getServerType() == WireProtocol.TCP) { acceptScheduler.execute(new AddToSelector(server, acceptSelector, SelectionKey.OP_ACCEPT)); } else if(server.getServerType() == WireProtocol.UDP) { acceptScheduler.execute(new AddToSelector(server, acceptSelector, SelectionKey.OP_READ)); <START> } <END> acceptSelector.wakeup(); } }</code><technical_language>sense add else condition a safety check (throw UnsupportedOperationException)...same for</technical_language>

Target:
public void startListening(final Server server) { if(!checkServer(server)) { return; } else { if(server.getServerType() == WireProtocol.TCP) { acceptScheduler.execute(new AddToSelector(server, acceptSelector, SelectionKey.OP_ACCEPT)); } else if(server.getServerType() == WireProtocol.UDP) { acceptScheduler.execute(new AddToSelector(server, acceptSelector, SelectionKey.OP_READ)); } else { throw new UnsupportedOperationException("Unknown Server WireProtocol!"+ server.getServerType()); } acceptSelector.wakeup(); } }
Source:
<code>public void processShow(Element transmission) { Element element = transmission .getFirstChildElement("watchable_link") .getFirstChildElement("watchable"); String showLink = element.getFirstChildElement("show_link").getAttributeValue("href"); String id = showLink.split("/")[5]; Brand brand = extractBrand(element, id); EpisodeProcessingNodeFactory nodeFactory = EpisodeProcessingNodeFactory.create( brand, watchableProcessor ); try { String responseBody = httpClient.get(getShowUri(id) + WATCHABLES_URL_SUFFIX).body(); new Builder(nodeFactory).build(new StringReader(responseBody)); } catch(Exception e) { <START> log.error("Exception parsing episodes for brand " + brand.getTitle(), e); <END> return; } if(FILM.equals(brand.getSpecialization()) && nodeFactory.items.size() == 1) { setFilmDescription((Film) Iterables.getOnlyElement(nodeFactory.items), element); } write(brand); watchableProcessor.getSeriesMap() .values() .forEach(this::write); nodeFactory.items .forEach(item -> write(brand, item)); }</code><technical_language>formatting syntax, log.error("... {}", brand.getTitle(), e)</technical_language>

Target:
public void processShow(Element transmission) { Element element = transmission .getFirstChildElement("watchable_link") .getFirstChildElement("watchable"); String showLink = element.getFirstChildElement("show_link").getAttributeValue("href"); String id = showLink.split("/")[5]; Brand brand = extractBrand(element, id); EpisodeProcessingNodeFactory nodeFactory = EpisodeProcessingNodeFactory.create( brand, watchableProcessor ); try { String responseBody = httpClient.get(getShowUri(id) + WATCHABLES_URL_SUFFIX).body(); new nu.xom.Builder(nodeFactory).build(new StringReader(responseBody)); } catch(Exception e) { log.error("Exception parsing episodes for brand {}", brand.getTitle(), e); return; } if(FILM.equals(brand.getSpecialization()) && nodeFactory.items.size() == 1) { setFilmDescription((Film) Iterables.getOnlyElement(nodeFactory.items), element); } write(brand); watchableProcessor.getSeriesMap() .values() .forEach(this::write); nodeFactory.items .forEach(item -> write(brand, item)); }
Source:
<code><START> public static Pair<Integer, byte[][]> serializeUTFs(String... values) <END> { int totalLength = 0; byte[][] bytes = new byte[values.length][]; for (int idx = 0; idx < values.length; idx++) { bytes[idx] = StringUtils.toUtf8(values[idx]); totalLength += bytes[idx].length; } return Pair.of(totalLength, bytes); }</code><technical_language>set some UTs for this function</technical_language>

Target:
public static Pair<Integer, byte[][]> serializeUTFs(String... values) { if (values == null) { return Pair.of(0, EMPTY_BYTES_ARRAY); } int totalLength = 0; byte[][] bytes = new byte[values.length][]; for (int idx = 0; idx < values.length; idx++) { bytes[idx] = StringUtils.toUtf8(values[idx]); if (bytes[idx] == null) { bytes[idx] = EMPTY_BYTES; } else { totalLength += bytes[idx].length; } } return Pair.of(totalLength, bytes); }
Source:
<code>public Optional<DefaultValueBridgeExpectations<URI, ?>> getDefaultValueBridgeExpectations() { return Optional.of( new DefaultValueBridgeExpectations<URI, URI>() { @Override public Class<URI> getProjectionType() { return URI.class; } @Override public Class<URI> getIndexFieldJavaType() { return URI.class; } @Override public List<URI> getEntityPropertyValues() { List<URI> uris = Arrays.asList( URI.create( "<LINK_3>" ), URI.create( "<LINK_1>" ), URI.create( "<LINK_4>" ), URI.create( "<LINK_5>" ), URI.create( "<LINK_5>products" ), URI.create( "<LINK_2>" ), <START> URI.create( "<LINK_0>" ) <END> ); return uris; } @Override public List<URI> getDocumentFieldValues() { return getEntityPropertyValues(); } @Override public Class<?> getTypeWithValueBridge1() { return TypeWithValueBridge1.class; } @Override public Object instantiateTypeWithValueBridge1(int identifier, URI propertyValue) { TypeWithValueBridge1 instance = new TypeWithValueBridge1(); instance.id = identifier; instance.myProperty = propertyValue; return instance; } @Override public Class<?> getTypeWithValueBridge2() { return TypeWithValueBridge2.class; } } ); }</code><technical_language>want add more exotic URIs? mailto:java-net@java.sun.com, urn:isbn:096139210x, file:///~calendar for example</technical_language>

Target:
public Optional<DefaultValueBridgeExpectations<URI, ?>> getDefaultValueBridgeExpectations() { return Optional.of( new DefaultValueBridgeExpectations<URI, String>() { @Override public Class<URI> getProjectionType() { return URI.class; } @Override public Class<String> getIndexFieldJavaType() { return String.class; } @Override public List<URI> getEntityPropertyValues() { return Arrays.stream( STRING_URLS ).map( s -> URI.create( s ) ).collect( Collectors.toList() ); } @Override public List<String> getDocumentFieldValues() { return Arrays.asList( STRING_URLS ); } @Override public Class<?> getTypeWithValueBridge1() { return TypeWithValueBridge1.class; } @Override public Object instantiateTypeWithValueBridge1(int identifier, URI propertyValue) { TypeWithValueBridge1 instance = new TypeWithValueBridge1(); instance.id = identifier; instance.myProperty = propertyValue; return instance; } @Override public Class<?> getTypeWithValueBridge2() { return TypeWithValueBridge2.class; } } ); }
Source:
<code>public Resource(int version, String id, Vector<ResourceLocation> locations, String descriptor) { <START> this(version, id, locations, descriptor, "false"); <END> }</code><technical_language>static accessors? Lots of risk of typos</technical_language>

Target:
public Resource(int version, String id, Vector<ResourceLocation> locations, String descriptor) { this(version, id, locations, descriptor, LAZY_VAL_FALSE); }
Source:
<code>public void setInSlot(Object slot, Widget content) { if (slot == ApplicationPresenter.TYPE_SetMainContent && content == null) { main.clear(); } else if (slot == ApplicationPresenter.TYPE_SetMainContent) { <START> main.clear(); <END> main.add(content); } else { super.setInSlot(slot, content); } }</code><technical_language>main.setWidget</technical_language>

Target:
public void setInSlot(Object slot, Widget content) { if (slot == ApplicationPresenter.TYPE_SetMainContent) { main.setWidget(content); } else { super.setInSlot(slot, content); } }
Source:
<code><START> protected void invokeFinishBundle() throws Exception { <END> ((AsyncPythonFunctionRunner) pythonFunctionRunner).flush(); elementCount = 0; while ((resultTuple = pythonFunctionRunner.receive()) != null) { emitResult(); } lastFinishBundleTime = getProcessingTimeService().getCurrentProcessingTime(); if (bundleFinishedCallback != null) { bundleFinishedCallback.run(); bundleFinishedCallback = null; } }</code><technical_language>Originally, flush logic is handled lock bundleStarted. lock is removed</technical_language>

Target:
protected void invokeFinishBundle() throws Exception { if (elementCount > 0) { pythonFunctionRunner.flush(); elementCount = 0; emitResults(); lastFinishBundleTime = getProcessingTimeService().getCurrentProcessingTime(); if (bundleFinishedCallback != null) { bundleFinishedCallback.run(); bundleFinishedCallback = null; } } }
Source:
<code>protected void render0(FunctionRenderContext context) { <START> Object[] jsonPathElements = new Object[context.getArgumentsSize() - 1]; <END> for (int i = 1; i < context.getArgumentsSize(); i++) { try { jsonPathElements[i - 1] = Integer.parseInt(JpqlFunctionUtil.unquoteSingleQuotes(context.getArgument(i))); } catch (NumberFormatException e) { jsonPathElements[i - 1] = JpqlFunctionUtil.unquoteDoubleQuotes(JpqlFunctionUtil.unquoteSingleQuotes(context.getArgument(i))); } } String jsonPath = AbstractJsonGetFunction.toJsonPath(jsonPathElements, jsonPathElements.length, true); context.addChunk("coalesce(json_value("); context.addArgument(0); context.addChunk(",'"); context.addChunk(jsonPath); context.addChunk("'),json_query("); context.addArgument(0); context.addChunk(",'"); context.addChunk(jsonPath); context.addChunk("'))"); }</code><technical_language>this utility function I mentioned well</technical_language>

Target:
protected void render0(FunctionRenderContext context) { List<Object> jsonPathElements = AbstractJsonGetFunction.retrieveJsonPathElements(context, 1); String jsonPath = AbstractJsonGetFunction.toJsonPath(jsonPathElements, jsonPathElements.size(), true); context.addChunk("coalesce(json_value("); context.addArgument(0); context.addChunk(",'"); context.addChunk(jsonPath); context.addChunk("'),json_query("); context.addArgument(0); context.addChunk(",'"); context.addChunk(jsonPath); context.addChunk("'))"); }
Source:
<code><START> private <T> List<T> getAnnotatedMembers(Map<Class<? extends Annotation>, List<T>> map, <END> Class<? extends Annotation> type, boolean fillIfAbsent) { if (!map.containsKey(type) && fillIfAbsent) { map.put(type, new ArrayList<T>()); } List<T> members = map.get(type); return members == null ? Collections.<T>emptyList() : members; }</code><technical_language>issue here. this static if</technical_language>

Target:
private static <T> List<T> getAnnotatedMembers(Map<Class<? extends Annotation>, List<T>> map, Class<? extends Annotation> type, boolean fillIfAbsent) { if (!map.containsKey(type) && fillIfAbsent) { map.put(type, new ArrayList<T>()); } List<T> members = map.get(type); return members == null ? Collections.<T>emptyList() : members; }
Source:
<code>private void parseLevelDBCacheStoreCompression(XMLExtendedStreamReader reader, LevelDBStoreConfigurationBuilder builder) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { String value = reader.getAttributeValue(i); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case TYPE: { <START> builder.implementationType(LevelDBStoreConfiguration.ImplementationType.valueOf(value)); <END> break; } default: throw ParseUtils.unexpectedAttribute(reader, i); } } ParseUtils.requireNoContent(reader); }</code><technical_language>parseLevelDBCacheStoreCompression is setting builder.implementationType() parseLevelDBCacheStoreImplementation is setting builder.compressionType</technical_language>

Target:
private void parseLevelDBCacheStoreCompression(XMLExtendedStreamReader reader, LevelDBStoreConfigurationBuilder builder) throws XMLStreamException { for (int i = 0; i < reader.getAttributeCount(); i++) { String value = reader.getAttributeValue(i); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case TYPE: { builder.compressionType(CompressionType.valueOf(value)); break; } default: throw ParseUtils.unexpectedAttribute(reader, i); } } ParseUtils.requireNoContent(reader); }
Source:
<code>public static ObjectMapper buildObjectMapperForDeserialization() { <START> Thread.currentThread().setContextClassLoader(InventoryAbstractMessage.class.getClassLoader()); <END> final ObjectMapper mapper = new ObjectMapper(); InventoryJacksonConfig.configure(mapper); mapper.addMixIn(CanonicalPath.class, CanonicalPathMixin.class); return mapper; }</code><technical_language>this need a perpetual change is bound this method? If is latter, reset context classloader original in a finally block in this method</technical_language>

Target:
public static ObjectMapper buildObjectMapperForDeserialization() { final ObjectMapper mapper = new ObjectMapper(); InventoryJacksonConfig.configure(mapper); mapper.addMixIn(CanonicalPath.class, CanonicalPathMixin.class); return mapper; }
Source:
<code><START> <K, V, M> MessageStream<M> getOutputStream(String streamId, <END> Function<M, K> keyExtractor, Function<M, V> msgExtractor) { return outStreams.computeIfAbsent(runner.getStream(streamId), streamSpec -> new OutputStreamImpl<>(this, streamSpec, keyExtractor, msgExtractor)); }</code><technical_language>I prefer this StreamGraph's public API well. Similar getInputStream(), this defines contract user program talks external streams (e.g. input output, intermediate)</technical_language>

Target:
public <K, V, M> OutputStream<K, V, M> getOutputStream(String streamId, Function<M, K> keyExtractor, Function<M, V> msgExtractor) { return outStreams.computeIfAbsent(runner.getStreamSpec(streamId), streamSpec -> new OutputStreamInternalImpl<>(this, streamSpec, keyExtractor, msgExtractor)); }
Source:
<code><START> public DataSet next() { <END> if (minibatchCount < terminationPoint) { minibatchCount++; return underlyingIterator.next(); } else { throw new RuntimeException("Calls to next have exceeded termination point."); } }</code><technical_language>iterator implementations thread safe, in concurrent way</technical_language>

Target:
public DataSet next() { if (minibatchCount < terminationPoint) { minibatchCount++; return underlyingIterator.next(); } else { throw new RuntimeException("Calls to next have exceeded the allotted number of minibatches."); } }
Source:
<code>public boolean isPulseOnce(GlowBlock block) { <START> return false; <END> }</code><technical_language>Water is a pulse block, flow block other once</technical_language>

Target:
public boolean isPulseOnce(GlowBlock block) { return true; }
Source:
<code>public Map<String, Object> toMap() { Map<String, Object> dict = new HashMap<>(); for (String name : rs.getColumnNames().keySet()) { <START> dict.put(name, getObject(indexForColumnName(name))); <END> } return dict; }</code><technical_language>toMap() return JSON based object. I getObject() return JSON based objects</technical_language>

Target:
public Map<String, Object> toMap() { List<Object> values = toList(); Map<String, Object> dict = new HashMap<>(); for (String name : rs.getColumnNames().keySet()) { int index = indexForColumnName(name); dict.put(name, values.get(index)); } return dict; }
Source:
<code><START> public void releaseUserCodeClassLoader_willRunReleaseHooks() throws Exception { <END> final BlobLibraryCacheManager libraryCacheManager = new TestingBlobLibraryCacheManagerBuilder().build(); final LibraryCacheManager.ClassLoaderLease classLoaderLease = libraryCacheManager.registerClassLoaderLease(new JobID()); final UserCodeClassLoader userCodeClassLoader = classLoaderLease.getOrResolveClassLoader(Collections.emptyList(), Collections.emptyList()); final OneShotLatch releaseHookLatch = new OneShotLatch(); userCodeClassLoader.registerReleaseHookIfAbsent("test", releaseHookLatch::trigger); classLoaderLease.release(); releaseHookLatch.await(); }</code><technical_language>suggestion public void releaseUserCodeClassLoader_willRunReleaseHooks() throws IOException, InterruptedException { safe a bit IDE warnings useful in other cases</technical_language>

Target:
public void releaseUserCodeClassLoader_willRunReleaseHooks() throws IOException, InterruptedException { final BlobLibraryCacheManager libraryCacheManager = new TestingBlobLibraryCacheManagerBuilder().build(); final LibraryCacheManager.ClassLoaderLease classLoaderLease = libraryCacheManager.registerClassLoaderLease(new JobID()); final UserCodeClassLoader userCodeClassLoader = classLoaderLease.getOrResolveClassLoader(Collections.emptyList(), Collections.emptyList()); final OneShotLatch releaseHookLatch = new OneShotLatch(); userCodeClassLoader.registerReleaseHookIfAbsent("test", releaseHookLatch::trigger); classLoaderLease.release(); releaseHookLatch.await(); }
Source:
<code>public boolean canHandleToken(ReceivedToken validateTarget, String realm) { Object token = validateTarget.getToken(); if ((token instanceof BinarySecurityTokenType) && (X509_PKI_PATH.equals(((BinarySecurityTokenType) token).getValueType()) || X509TokenValidator.X509_V3_TYPE.equals( ((BinarySecurityTokenType) token).getValueType()))) { return true; } <START> if (token instanceof Element <END> && WSConstants.SIG_NS.equals(((Element) token).getNamespaceURI()) && WSConstants.X509_DATA_LN.equals(((Element) token).getLocalName())) { return true; } return false; }</code><technical_language>simplify more simply returning conditions</technical_language>

Target:
public boolean canHandleToken(ReceivedToken validateTarget, String realm) { Object token = validateTarget.getToken(); if ((token instanceof BinarySecurityTokenType) && (X509_PKI_PATH.equals(((BinarySecurityTokenType) token).getValueType()) || X509TokenValidator.X509_V3_TYPE.equals( ((BinarySecurityTokenType) token).getValueType()))) { return true; } return (token instanceof Element && WSConstants.SIG_NS.equals(((Element) token).getNamespaceURI()) && WSConstants.X509_DATA_LN.equals(((Element) token).getLocalName())); }
Source:
<code>public void destroyObjectsInSameTreeTest() { initializeJob(objsToDestroy); objsToDestroy.remove(3); job.run(); PID fileObjPid = objsToDestroy.get(2); PID workObjPid = objsToDestroy.get(1); PID folderObjPid = objsToDestroy.get(0); verify(spyProxyService).destroyProxy(folderObjPid); Tombstone stoneFile = repoObjLoader.getTombstone(fileObjPid); Tombstone stoneWork = repoObjLoader.getTombstone(workObjPid); Tombstone stoneFolder = repoObjLoader.getTombstone(folderObjPid); <START> assertTrue(stoneFile.getModel().contains(stoneFile.getResource(), RDF.type, Cdr.Tombstone)); <END> assertTrue(stoneFile.getModel().contains(stoneFile.getResource(), RDF.type, Cdr.FileObject)); assertTrue(stoneWork.getModel().contains(stoneWork.getResource(), RDF.type, Cdr.Tombstone)); assertTrue(stoneWork.getModel().contains(stoneWork.getResource(), RDF.type, Cdr.Work)); assertTrue(stoneFolder.getModel().contains(stoneFolder.getResource(), RDF.type, Cdr.Tombstone)); assertTrue(stoneFolder.getModel().contains(stoneFolder.getResource(), RDF.type, Cdr.Folder)); PremisEventObject event = repoObjLoader.getPremisEventObject(stoneFolder.getPremisLog().listEvents().get(0)); assertTrue(event.getResource().hasProperty(Premis.hasEventType, Premis.Deletion)); assertTrue(event.getResource().hasProperty(Premis.hasEventDetail, "Item deleted from repository and replaced by tombstone")); }</code><technical_language>if want this is, slightly more readable adjust assertions assertTrue(stoneFile.getResource().hasProperty(RDF.type, Cdr.Tombstone));</technical_language>

Target:
public void destroyObjectsInSameTreeTest() { initializeJob(objsToDestroy); objsToDestroy.remove(3); job.run(); PID fileObjPid = objsToDestroy.get(2); PID workObjPid = objsToDestroy.get(1); PID folderObjPid = objsToDestroy.get(0); verify(spyProxyService).destroyProxy(folderObjPid); Tombstone stoneFile = repoObjLoader.getTombstone(fileObjPid); Tombstone stoneWork = repoObjLoader.getTombstone(workObjPid); Tombstone stoneFolder = repoObjLoader.getTombstone(folderObjPid); assertTrue(stoneFile.getResource().hasProperty(RDF.type, Cdr.Tombstone)); assertTrue(stoneFile.getResource().hasProperty(RDF.type, Cdr.FileObject)); assertTrue(stoneWork.getResource().hasProperty(RDF.type, Cdr.Tombstone)); assertTrue(stoneWork.getResource().hasProperty(RDF.type, Cdr.Work)); assertTrue(stoneFolder.getResource().hasProperty(RDF.type, Cdr.Tombstone)); assertTrue(stoneFolder.getResource().hasProperty(RDF.type, Cdr.Folder)); PremisEventObject event = repoObjLoader.getPremisEventObject(stoneFolder.getPremisLog().listEvents().get(0)); assertTrue(event.getResource().hasProperty(Premis.hasEventType, Premis.Deletion)); assertTrue(event.getResource().hasProperty(Premis.hasEventDetail, "Item deleted from repository and replaced by tombstone")); }
Source:
<code>public static ParcelFileDescriptor fromSocket(Socket socket) { FileDescriptor fd = socket.getFileDescriptor$(); try { return fd != null ? ParcelFileDescriptor.dup(fd) : null; } catch (IOException <START> ex) { <END> throw new UncheckedIOException(ex); } }</code><technical_language>super (okay ignore): below: For consistency, consider "e" "ex". Typically "ex" for nested catch blocks name "e" is enclosing block</technical_language>

Target:
public static ParcelFileDescriptor fromSocket(Socket socket) { FileDescriptor fd = socket.getFileDescriptor$(); try { return fd != null ? ParcelFileDescriptor.dup(fd) : null; } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { try { exceptionsTrustManager.checkServerTrusted(chain, authType); } catch (CertificateException ex) { checkDateValidity(chain); <START> if (chain.length > 1) { <END> try { validatePath(chain); } catch (NoSuchAlgorithmException | KeyStoreException | InvalidAlgorithmParameterException | CertPathValidatorException | CertPathBuilderException e) { Log.error("Validating path failed", e); throw new CertificateException("Certificate path validation failed", e); } } else if (chain.length == 1 && !acceptSelfSigned) { throw new CertificateException("Self Signed certificate"); } else if (chain.length == 1 && acceptSelfSigned) { List<X509Certificate> certList = new ArrayList<>(Arrays.asList(getAcceptedIssuers())); if (!certList.contains(chain[0])) { throw new CertificateException("Certificate not in the TrustStore"); } try { loadCRL(chain); for (X509CRL crl : crlCollection) { if (crl.isRevoked(chain[0])) { throw new CertificateException("Certificate is revoked"); } } } catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException | CertStoreException | CRLException | IOException e) { Log.warning("Couldn't load CRL"); } }else { throw new CertificateException("Certificate chain cannot be trusted"); } } }</code><technical_language>Chain length is a safe determine if certificate in chain is self-signed. chain incomplete (it depend certificates in truststore, including certificates), chains certificates part of chain (and unused). find a identify "self-signed"</technical_language>

Target:
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { try { exceptionsTrustManager.checkServerTrusted(chain, authType); } catch (CertificateException ex) { checkDateValidity(chain); if (isSelfSigned(chain) == false) { try { validatePath(chain); } catch (NoSuchAlgorithmException | KeyStoreException | InvalidAlgorithmParameterException | CertPathValidatorException | CertPathBuilderException e) { Log.error("Validating path failed", e); throw new CertificateException("Certificate path validation failed", e); } } else if (isSelfSigned(chain) && !acceptSelfSigned) { throw new CertificateException("Self Signed certificate"); } else if (isSelfSigned(chain) && acceptSelfSigned) { List<X509Certificate> certList = new ArrayList<>(Arrays.asList(getAcceptedIssuers())); if (!certList.contains(chain[0])) { throw new CertificateException("Certificate not in the TrustStore"); } try { loadCRL(chain); for (X509CRL crl : crlCollection) { if (crl.isRevoked(chain[0])) { throw new CertificateException("Certificate is revoked"); } } } catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException | CertStoreException | CRLException | IOException e) { Log.warning("Couldn't load CRL"); } }else { throw new CertificateException("Certificate chain cannot be trusted"); } } }
Source:
<code>private void testWorkflowVersionMetadata(Workflow workflow) { final String partialReadmeDescription = "AMPA-NF is a pipeline for assessing the antimicrobial domains of proteins,"; final String descriptorDescription = "Fast automated prediction of protein antimicrobial regions"; Assert.assertEquals(descriptorDescription, workflow.getDescription()); Assert.assertEquals(descriptorDescription, workflow.getDescription()); <START> workflow.getWorkflowVersions().forEach(workflowVersion -> { <END> if (workflowVersion.getName().equals("v1.0")) { Assert.assertTrue(workflowVersion.getDescription().contains(partialReadmeDescription)); Assert.assertNull(workflowVersion.getAuthor()); Assert.assertNull(workflowVersion.getEmail()); } else { Assert.assertNotNull(descriptorDescription, workflowVersion.getDescription()); Assert.assertEquals("test.user@test.com", workflowVersion.getAuthor()); Assert.assertNull(workflowVersion.getEmail()); } }); }</code><technical_language>this pass if workflow a name of v1.0</technical_language>

Target:
private void testWorkflowVersionMetadata(Workflow workflow) { final String partialReadmeDescription = "AMPA-NF is a pipeline for assessing the antimicrobial domains of proteins,"; final String descriptorDescription = "Fast automated prediction of protein antimicrobial regions"; final String versionWithReadmeDescription = "v1.0"; Assert.assertEquals(descriptorDescription, workflow.getDescription()); Assert.assertTrue(workflow.getWorkflowVersions().stream().anyMatch(workflowVersion -> workflowVersion.getName().equals(versionWithReadmeDescription))); workflow.getWorkflowVersions().forEach(workflowVersion -> { if (workflowVersion.getName().equals(versionWithReadmeDescription)) { Assert.assertTrue(workflowVersion.getDescription().contains(partialReadmeDescription)); Assert.assertNull(workflowVersion.getAuthor()); Assert.assertNull(workflowVersion.getEmail()); } else { Assert.assertNotNull(descriptorDescription, workflowVersion.getDescription()); Assert.assertEquals("test.user@test.com", workflowVersion.getAuthor()); Assert.assertNull(workflowVersion.getEmail()); } }); }
Source:
<code>private List<String> getPublicIpAddresses(Container container) { String dockerIpAddress; <START> if (container.node() != null && container.node().isPresent()) { <END> dockerIpAddress = container.node().get().ip(); } else { dockerIpAddress = URI.create(providerMetadata.getEndpoint()).getHost(); } return ImmutableList.of(dockerIpAddress); }</code><technical_language>If optionals get rid of null check assume is null</technical_language>

Target:
private List<String> getPublicIpAddresses(Container container) { String dockerIpAddress; if (container.node().isPresent()) { dockerIpAddress = container.node().get().ip(); } else { dockerIpAddress = URI.create(providerMetadata.getEndpoint()).getHost(); } return ImmutableList.of(dockerIpAddress); }
Source:
<code>public static String getNimbusHost(Map mesosStormConf) throws UnknownHostException { Optional<String> nimbusHostFromConfig = Optional.fromNullable((String) mesosStormConf.get(Config.NIMBUS_HOST)); Optional<String> nimbusHostFromEnv = Optional.fromNullable(System.getenv("MESOS_NIMBUS_HOST")); <START> return nimbusHostFromConfig.or(nimbusHostFromEnv).or(nimbusHostFromConfig).or(InetAddress.getLocalHost().getCanonicalHostName()); <END> }</code><technical_language>need .or(nimbusHostFromConfig), option is there</technical_language>

Target:
public static String getNimbusHost(Map mesosStormConf) throws UnknownHostException { Optional<String> nimbusHostFromConfig = Optional.fromNullable((String) mesosStormConf.get(Config.NIMBUS_HOST)); Optional<String> nimbusHostFromEnv = Optional.fromNullable(System.getenv("MESOS_NIMBUS_HOST")); return nimbusHostFromConfig.or(nimbusHostFromEnv).or(InetAddress.getLocalHost().getCanonicalHostName()); }
Source:
<code>private void initDragDrop() { DropSupport drop = DropSupport.addIfSupported(this); if (drop != null) { drop.setListener(new DropSupport.Listener() { @Override public boolean onDrop(DropEvent event) { event.preventDefault(); event.stopPropagation(); PackagesPanelUi.this.packagesDropzone.removeStyleName(DROPZONE_ACTIVE_STYLE_NAME); final List<File> droppedFiles = event.getFiles(); if (!droppedFiles.isEmpty()) { <START> <END> final File first = droppedFiles.get(0); if (first.getName().endsWith(".dp")) { PackagesPanelUi.this.confirmDialog.show(MSGS.packagesConfirmMessage(), () -> installDp(first)); } else { PackagesPanelUi.this.uploadErrorText.setText(MSGS.packagesMarketplaceInstallDpNotValid()); PackagesPanelUi.this.uploadErrorModal.show(); } } else { final String url = event.getAsText(); if (isEclipseMarketplaceUrl(url)) { PackagesPanelUi.this.confirmDialog.show(MSGS.packagesMarketplaceInstallConfirmMessage(), () -> eclipseMarketplaceInstall(url)); } else { PackagesPanelUi.this.uploadErrorText.setText(MSGS.packagesMarketplaceInstallDpNotValid()); PackagesPanelUi.this.uploadErrorModal.show(); } } return true; } @Override public boolean onDragOver(DropEvent event) { PackagesPanelUi.this.packagesDropzone.addStyleName(DROPZONE_ACTIVE_STYLE_NAME); return true; } @Override public void onDragExit(DropEvent event) { PackagesPanelUi.this.packagesDropzone.removeStyleName(DROPZONE_ACTIVE_STYLE_NAME); } }); } else { this.marketplaceInstallWell.setVisible(false); } }</code><technical_language>maybe, for readability, is move content a specific method</technical_language>

Target:
private void initDragDrop() { DropSupport drop = DropSupport.addIfSupported(this); if (drop != null) { drop.setListener(new DropSupport.Listener() { @Override public boolean onDrop(DropEvent event) { event.preventDefault(); event.stopPropagation(); PackagesPanelUi.this.packagesDropzone.removeStyleName(DROPZONE_ACTIVE_STYLE_NAME); final List<File> droppedFiles = event.getFiles(); if (!droppedFiles.isEmpty()) { installFromFile(droppedFiles); } else { installFromUrl(event); } return true; } @Override public boolean onDragOver(DropEvent event) { PackagesPanelUi.this.packagesDropzone.addStyleName(DROPZONE_ACTIVE_STYLE_NAME); return true; } @Override public void onDragExit(DropEvent event) { PackagesPanelUi.this.packagesDropzone.removeStyleName(DROPZONE_ACTIVE_STYLE_NAME); } }); } else { this.marketplaceInstallWell.setVisible(false); } }
Source:
<code>public DelimitedInputFormat( @JsonProperty("columns") @Nullable List<String> columns, @JsonProperty("listDelimiter") @Nullable String listDelimiter, @JsonProperty("delimiter") @Nullable String delimiter, @Deprecated @JsonProperty("hasHeaderRow") @Nullable Boolean hasHeaderRow, @JsonProperty("findColumnsFromHeader") @Nullable Boolean findColumnsFromHeader, @JsonProperty("skipHeaderRows") int skipHeaderRows ) { this.listDelimiter = listDelimiter; this.columns = columns == null ? Collections.emptyList() : columns; this.findColumnsFromHeader = Checks.checkOneNotNullOrEmpty( ImmutableList.of( new Property<>("hasHeaderRow", hasHeaderRow), new Property<>("findColumnsFromHeader", findColumnsFromHeader) ) ).getValue(); this.skipHeaderRows = skipHeaderRows; this.format = getFormat(delimiter); Preconditions.checkArgument( <START> delimiter == null || delimiter.length() == 1, <END> "The delimiter should be a single character" ); if (!this.columns.isEmpty()) { for (String column : this.columns) { Preconditions.checkArgument( !column.contains(format.getDelimiterAsString()), "Column[%s] has a " + format.getLiteral() + ", it cannot", column ); } } else { Preconditions.checkArgument( this.findColumnsFromHeader, "If columns field is not set, the first row of your data must have your header" + " and hasHeaderRow must be set to true." ); } }</code><technical_language>this is created a "tsv" JSON type delimiter is annotated @Nullable, delimiter == null in this check. If delimiter is null here, suggest defining a default delimiter (the tab) setting delimiter here, removing delimiter == null clause in else if in getFormat</technical_language>

Target:
public DelimitedInputFormat( @JsonProperty("columns") @Nullable List<String> columns, @JsonProperty("listDelimiter") @Nullable String listDelimiter, @JsonProperty("delimiter") @Nullable String delimiter, @Deprecated @JsonProperty("hasHeaderRow") @Nullable Boolean hasHeaderRow, @JsonProperty("findColumnsFromHeader") @Nullable Boolean findColumnsFromHeader, @JsonProperty("skipHeaderRows") int skipHeaderRows ) { this.listDelimiter = listDelimiter; this.columns = columns == null ? Collections.emptyList() : columns; this.findColumnsFromHeader = Checks.checkOneNotNullOrEmpty( ImmutableList.of( new Property<>("hasHeaderRow", hasHeaderRow), new Property<>("findColumnsFromHeader", findColumnsFromHeader) ) ).getValue(); this.skipHeaderRows = skipHeaderRows; this.delimiter = delimiter == null ? "\t" : delimiter; this.format = getFormat(this.delimiter); Preconditions.checkArgument( this.delimiter.length() == 1, "The delimiter should be a single character" ); Preconditions.checkArgument( !this.delimiter.equals(listDelimiter), "Cannot have same delimiter and list delimiter of [%s]", this.delimiter ); if (!this.columns.isEmpty()) { for (String column : this.columns) { Preconditions.checkArgument( !column.contains(format.getDelimiterAsString()), "Column[%s] has a " + format.getLiteral() + ", it cannot", column ); } } else { Preconditions.checkArgument( this.findColumnsFromHeader, "If columns field is not set, the first row of your data must have your header" + " and hasHeaderRow must be set to true." ); } }
Source:
<code>private void didClickAddDirectory(ActionEvent event) { final DirectoryChooser dirChooser = new DirectoryChooser(); final File file = dirChooser.showDialog(stage); <START> addDirectory(file); <END> }</code><technical_language>change file.toPath()</technical_language>

Target:
private void didClickAddDirectory(ActionEvent event) { final DirectoryChooser dirChooser = new DirectoryChooser(); final File file = dirChooser.showDialog(stage); addDirectory(file.toPath()); }
Source:
<code>private Collection<CheService> toServices(Collection<CheFeature> features) throws InfrastructureException { Collection<CheService> services = getServices(features); Map<String, List<String>> parameters = getServicesParameters(features); for (CheService service : services) { String serviceName = service.getMetadata().getName(); String serviceVersion = service.getSpec().getVersion(); String serviceKey = serviceName + '/' + serviceVersion; service.getSpec() .getContainers() .forEach(container -> container.getEnv() .forEach(envVar -> { if (isParameter(envVar)) { String envVarValue = envVar.getValue(); String parameterKey = serviceKey + '/' + envVarValue; List<String> remove = parameters.remove(parameterKey); <START> if (remove != null) { <END> envVar.setValue(String.join(",", remove)); } } })); if (!parameters.isEmpty()) { throw new InfrastructureException( "Parameters not supported by services found: " + parameters); } } return services; }</code><technical_language>idea discuss, set empty if is parameter in a feature</technical_language>

Target:
private Collection<CheService> toServices(Collection<CheFeature> features) throws InfrastructureException { Collection<CheService> services = getServices(features); Map<String, List<String>> parameters = getServicesParameters(features); for (CheService service : services) { String serviceName = service.getMetadata().getName(); String serviceVersion = service.getSpec().getVersion(); String serviceKey = serviceName + '/' + serviceVersion; service .getSpec() .getContainers() .stream() .flatMap(container -> container.getEnv().stream()) .filter(this::isParameter) .forEach( envVar -> { String parameterKey = serviceKey + '/' + envVar.getValue(); List<String> remove = parameters.remove(parameterKey); String envVarValue; if (remove != null) { envVarValue = String.join(",", remove); } else { envVarValue = ""; } envVar.setValue(envVarValue); }); } if (!parameters.isEmpty()) { throw new InfrastructureException( "Parameters not supported by services found: " + parameters.keySet()); } return services; }
Source:
<code>protected void executeCommand() { <START> updateClusterCpuName(getMaxServerCpu().getCpuName(), getMaxServerCpu().getArchitecture()); <END> if (maxServerFound() && !architecturesMatch() ) { addCustomValue("VdsArchitecture", getMaxServerCpu().getArchitecture().name()); addCustomValue("ClusterArchitecture", getCluster().getArchitecture().name()); SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { List<String> missingFlags = getCpuFlagsManagerHandler().missingServerCpuFlags( getCluster().getCpuName(), getVds().getCpuFlags(), getCluster().getCompatibilityVersion()); if (vdsContainsFlags() && !cpuFlagsMatch(missingFlags)) { if (missingFlags != null) { addCustomValue("CpuFlags", StringUtils.join(missingFlags, ", ")); if (missingFlags.contains("nx")) { auditLogDirector.log(this, AuditLogType.CPU_FLAGS_NX_IS_MISSING); } } SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.CPU_TYPE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { setCommandShouldBeLogged(false); } } setSucceeded(true); }</code><technical_language>this raise NPE maxServerCPU is null, right</technical_language>

Target:
protected void executeCommand() { setMaxServerCPU(getCpuFlagsManagerHandler().findMaxServerCpuByFlags( getVds().getCpuFlags(), getVds().getClusterCompatibilityVersion())); if (getMaxServerCpu() != null) { updateClusterCpuName(getMaxServerCpu().getCpuName(), getMaxServerCpu().getArchitecture()); } else { log.error("Could not find server cpu for server '{}' ({}), flags: '{}'", getVds().getName(), getVdsId(), getVds().getCpuFlags()); } if (maxServerFound() && !architecturesMatch() ) { addCustomValue("VdsArchitecture", getMaxServerCpu().getArchitecture().name()); addCustomValue("ClusterArchitecture", getCluster().getArchitecture().name()); SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.ARCHITECTURE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { List<String> missingFlags = getCpuFlagsManagerHandler().missingServerCpuFlags( getCluster().getCpuName(), getVds().getCpuFlags(), getCluster().getCompatibilityVersion()); if (vdsContainsFlags() && !cpuFlagsMatch(missingFlags)) { if (missingFlags != null) { addCustomValue("CpuFlags", StringUtils.join(missingFlags, ", ")); if (missingFlags.contains("nx")) { auditLogDirector.log(this, AuditLogType.CPU_FLAGS_NX_IS_MISSING); } } SetNonOperationalVdsParameters params = new SetNonOperationalVdsParameters(getVdsId(), NonOperationalReason.CPU_TYPE_INCOMPATIBLE_WITH_CLUSTER); runInternalAction(ActionType.SetNonOperationalVds, params, ExecutionHandler.createInternalJobContext(getContext())); } else { setCommandShouldBeLogged(false); } } setSucceeded(true); }