auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void log(Enumeration.Value level, Function0<String> message) { String s = message.apply(); String prefix = "[" + level.toString().toLowerCase() + "] "; if (s.substring(0, prefix.length()).toLowerCase().equals(prefix)) { s = s.substring(prefix.length()); } if (level.equals(Level.Error())) { log.error(s); } else if (level.equals(Level.Warn())) { log.warn(s); } else if (level.equals(Level.Info())) { log.info(s); } else if (level.equals(Level.Debug())) { log.debug(s); } }

Target:
public void log(Enumeration.Value level, Function0<String> message) { String s = message.apply(); String prefix = "[" + level.toString() + "] "; if (s.regionMatches(true, 0, prefix, 0, prefix.length())) { s = s.substring(prefix.length()); } if (level.equals(Level.Error())) { log.error(s); } else if (level.equals(Level.Warn())) { log.warn(s); } else if (level.equals(Level.Info())) { log.info(s); } else if (level.equals(Level.Debug())) { log.debug(s); } }
Source:
public void shouldUpdateClusterMetadataAndHostInfoOnAssignment() { final Map<HostInfo, Set<TopicPartition>> initialHostState = mkMap( mkEntry(new HostInfo("localhost", 9090), mkSet(t1p0, t1p1)), mkEntry(new HostInfo("otherhost", 9090), mkSet(t2p0, t2p1)) ); final Map<HostInfo, Set<TopicPartition>> newHostState = mkMap( mkEntry(new HostInfo("localhost", 9090), mkSet(t1p0, t1p1)), mkEntry(new HostInfo("newotherhost", 9090), mkSet(t2p0, t2p1)) ); streamsMetadataState = EasyMock.createStrictMock(StreamsMetadataState.class); createMockTaskManager(); configurePartitionAssignor(emptyMap()); streamsMetadataState.onChange(EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject()); streamsMetadataState.onChange(EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject()); EasyMock.replay(taskManager, streamsMetadataState); partitionAssignor.onAssignment(createAssignment(initialHostState), null); partitionAssignor.onAssignment(createAssignment(newHostState), null); EasyMock.verify(taskManager, streamsMetadataState); }

Target:
public void shouldUpdateClusterMetadataAndHostInfoOnAssignment() { final Map<HostInfo, Set<TopicPartition>> initialHostState = mkMap( mkEntry(new HostInfo("localhost", 9090), mkSet(t1p0, t1p1)), mkEntry(new HostInfo("otherhost", 9090), mkSet(t2p0, t2p1)) ); final Map<HostInfo, Set<TopicPartition>> newHostState = mkMap( mkEntry(new HostInfo("localhost", 9090), mkSet(t1p0, t1p1)), mkEntry(new HostInfo("newotherhost", 9090), mkSet(t2p0, t2p1)) ); streamsMetadataState = EasyMock.createStrictMock(StreamsMetadataState.class); streamsMetadataState.onChange(EasyMock.eq(initialHostState), EasyMock.anyObject(), EasyMock.anyObject()); streamsMetadataState.onChange(EasyMock.eq(newHostState), EasyMock.anyObject(), EasyMock.anyObject()); EasyMock.replay(streamsMetadataState); createDefaultMockTaskManager(); configureDefaultPartitionAssignor(); partitionAssignor.onAssignment(createAssignment(initialHostState), null); partitionAssignor.onAssignment(createAssignment(newHostState), null); EasyMock.verify(taskManager, streamsMetadataState); }
Source:
private void enqueueExceptionHandlers(Type exceptionType, ProgramState ps) { List<BytecodeCFG.Block> blocksCatchingException = programPosition.block.successors().stream() .map(b -> (BytecodeCFG.Block) b) .filter(BytecodeCFG.Block::isCatchBlock) .filter(b -> isExceptionHandledByBlock(exceptionType, b)) .collect(Collectors.toList()); if (!blocksCatchingException.isEmpty()) { blocksCatchingException.forEach(b -> enqueue(new ProgramPoint(b), ps)); if (isCatchExhaustive(exceptionType, blocksCatchingException)) { return; } } ps.storeExitValue(); enqueue(new ProgramPoint(exitBlock), ps); }

Target:
private void enqueueExceptionHandlers(Type exceptionType, ProgramState ps) { List<BytecodeCFG.Block> blocksCatchingException = programPosition.block.successors().stream() .map(b -> (BytecodeCFG.Block) b) .filter(BytecodeCFG.Block::isCatchBlock) .filter(b -> isExceptionHandledByBlock(exceptionType, b)) .collect(Collectors.toList()); if (!blocksCatchingException.isEmpty()) { blocksCatchingException.forEach(b -> enqueue(new ProgramPoint(b), ps)); if (isCatchExhaustive(exceptionType, blocksCatchingException)) { return; } } Preconditions.checkState(ps.peekValue() instanceof SymbolicValue.ExceptionalSymbolicValue, "Exception shall be on top of the stack"); ps.storeExitValue(); enqueue(new ProgramPoint(exitBlock), ps); }
Source:
public boolean remove() { if (parentNode == null) return false; boolean success = parentNode.childrenNodes.remove(this); Class<?> parentClass = parentNode.getClass(); while (parentClass != Object.class) { for (Field f : parentClass.getDeclaredFields()) { f.setAccessible(true); try { Object object = f.get(parentNode); if (object == null) continue; if (List.class.isAssignableFrom(object.getClass())) { List<?> l = (List<?>) object; success &= l.remove(this); } else if (object == this) { f.set(parentNode, null); success &= true; } } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("Error while removing " + getClass().getSimpleName(), e); } } parentClass = parentClass.getSuperclass(); } return success; }

Target:
public boolean remove() { if (parentNode == null) return false; boolean success = false; Class<?> parentClass = parentNode.getClass(); while (parentClass != Object.class) { for (Field f : parentClass.getDeclaredFields()) { f.setAccessible(true); try { Object object = f.get(parentNode); if (object == null) continue; if (Collection.class.isAssignableFrom(object.getClass())) { Collection<?> l = (Collection<?>) object; boolean remove = l.remove(this); success |= remove; } else if (Optional.class.equals(f.getType())) { Optional<?> opt = (Optional<?>) object; if (opt.isPresent()) if (opt.get() == this) f.set(parentNode, Optional.empty()); } else if (object == this) { f.set(parentNode, null); success |= true; } } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("Error while removing " + getClass().getSimpleName(), e); } } parentClass = parentClass.getSuperclass(); } setParentNode(null); return success; }
Source:
private void setWarningToError(Map<String, String> options) { for (Map.Entry<String, String> entry : options.entrySet()) { if (entry.getValue().equals(CompilerOptions.WARNING)) { options.put(entry.getKey(), CompilerOptions.ERROR); } } }

Target:
private void setWarningToError(Map<String, String> options) { for (Map.Entry<String, String> entry : options.entrySet()) { if (entry.getValue().equals(CompilerOptions.WARNING)) { entry.setValue(CompilerOptions.ERROR); } } }
Source:
private void verifyAbcdAdIsNotDisplayed(AdsBaseObject ads) { ads.scrollToSlot(AdsContent.TOP_LB); Assertion.assertFalse(ads.getGptParams(AdsContent.TOP_LB, "data-gpt-line-item-id").equals("4376117186"), "TOP_LEADERBOARD slot has ABCD ad line item id 4376117186, ABCD slot should not be displayed"); }

Target:
private void verifyAbcdAdIsNotDisplayed(AdsBaseObject ads) { Assertion.assertNotEquals(String.valueOf(ads.getLineItemId(AdsContent.TOP_LB)), ABCD_LINE_ITEM_ID, "ABCD " + ABCD_LINE_ITEM_ID + " line item id is displayed"); }
Source:
private void showMediaToastError(@StringRes int message, @Nullable String messageDetail) { if (isFinishing()) return; String errorMessage = getString(message); if (!TextUtils.isEmpty(messageDetail)) { errorMessage += ", " + messageDetail; } ToastUtils.showToast(this, errorMessage, ToastUtils.Duration.LONG); }

Target:
private void showMediaToastError(@StringRes int message, @Nullable String messageDetail) { if (isFinishing()) { return; } String errorMessage = getString(message); if (!TextUtils.isEmpty(messageDetail)) { errorMessage += ". " + messageDetail; } ToastUtils.showToast(this, errorMessage, ToastUtils.Duration.LONG); }
Source:
protected <T extends Item> void mergeIn(Application application, T chosen, Iterable<T> notChosen) { if (Publisher.AMAZON_UNBOX.equals(chosen.getPublisher())) { if (isNotUhd(chosen)) { return; } Optional<T> nonUhditem = StreamSupport.stream(notChosen.spliterator(), false) .filter(this::isNotUhd) .filter(item -> !Strings.isNullOrEmpty(item.getDescription())) .findFirst(); nonUhditem.ifPresent(item -> chosen.setDescription(item.getDescription())); } super.mergeIn(application, chosen, notChosen); }

Target:
protected <T extends Item> void mergeIn(Application application, T chosen, Iterable<T> notChosen) { if (Publisher.AMAZON_UNBOX.equals(chosen.getPublisher())) { if (isNotUhd(chosen)) { return; } Optional<T> nonUhdItem = StreamSupport.stream(notChosen.spliterator(), false) .filter(this::isNotUhd) .filter(item -> !Strings.isNullOrEmpty(item.getDescription())) .findFirst(); nonUhdItem.ifPresent(item -> chosen.setDescription(item.getDescription())); } super.mergeIn(application, chosen, notChosen); }
Source:
public static void validateParamCollection(EventType[] eventTypes, String paramName) throws Exception { validateParam(eventTypes, paramName); int count = 0; for (Object event : eventTypes) { try { validateParam(event, String.format("collection[%d] , ", count)); } catch (Exception e) { throw new IllegalArgumentException(String.format( "The element at position %d is invalid", count), e); } count++; } if (count == 0) { throw new IllegalArgumentException( String.format("The collection \"%s\" is empty.", paramName) ); } }

Target:
public static void validateParamCollection(EventType[] eventTypes, String paramName) throws Exception { validateParam(eventTypes, paramName); int count = 0; for (EventType event : eventTypes) { try { validateParam(event, String.format("collection[%d] , ", count)); } catch (Exception e) { throw new IllegalArgumentException(String.format( "The element at position %d is invalid", count), e); } count++; } if (count == 0) { throw new IllegalArgumentException( String.format("The collection \"%s\" is empty.", paramName) ); } }
Source:
private void setup() { int startIndex = 0; int endIndex = pattern.length(); if (pattern.startsWith("!")) { startIndex++; negation = true; } if (pattern.endsWith("/")) { endIndex --; dirOnly = true; } pattern = pattern.substring(startIndex, endIndex); if (!pattern.contains("/")) { nameOnly = true; } else if (!pattern.startsWith("/")) { pattern = "/" + pattern; } if (pattern.contains("*") || pattern.contains("?") || pattern.contains("[")) { try { matcher = new FileNameMatcher(pattern, new Character('/')); } catch (InvalidPatternException e) { e.printStackTrace(); } } }

Target:
private void setup() { int startIndex = 0; int endIndex = pattern.length(); if (pattern.startsWith("!")) { startIndex++; negation = true; } if (pattern.endsWith("/")) { endIndex --; dirOnly = true; } pattern = pattern.substring(startIndex, endIndex); if (!pattern.contains("/")) nameOnly = true; else if (!pattern.startsWith("/")) { pattern = "/" + pattern; } if (pattern.contains("*") || pattern.contains("?") || pattern.contains("[")) { try { matcher = new FileNameMatcher(pattern, new Character('/')); } catch (InvalidPatternException e) { e.printStackTrace(); } } }
Source:
TimerThread( BlockingQueue<QueueEntry> queue, int timeout ) { super(); fQueue = queue; setWaitTimout( timeout ); }

Target:
TimerThread( BlockingQueue<QueueEntry> queue, int timeout ) { super(); setName( "GDB Command Timer Thread" ); fQueue = queue; setWaitTimout( timeout ); }
Source:
private void addEntryTodnsToUuidMap(String dnsName, String uuid) { Set<String> dnList = dnsToUuidMap.get(dnsName); if (dnList == null) { dnList = new HashSet<>(); dnsToUuidMap.put(dnsName, dnList); } dnList.add(uuid); }

Target:
private synchronized void addEntryTodnsToUuidMap( String dnsName, String uuid) { Set<String> dnList = dnsToUuidMap.get(dnsName); if (dnList == null) { dnList = ConcurrentHashMap.newKeySet(); dnsToUuidMap.put(dnsName, dnList); } dnList.add(uuid); }
Source:
public StepExecutionProgressInfoResource(StepExecution stepExecution, StepExecutionHistory stepExecutionHistory, double percentageComplete, boolean isFinished, double duration) { Assert.notNull(stepExecution, "stepExecution must not be null."); Assert.notNull(stepExecutionHistory, "stepExecution must not be null."); this.stepExecution = stepExecution; this.stepExecutionHistory = stepExecutionHistory; this.percentageComplete = percentageComplete; this.finished = isFinished ? "true" : "false"; this.duration = duration; }

Target:
public StepExecutionProgressInfoResource(StepExecution stepExecution, StepExecutionHistory stepExecutionHistory, double percentageComplete, boolean isFinished, double duration) { Assert.notNull(stepExecution, "stepExecution must not be null."); Assert.notNull(stepExecutionHistory, "stepExecution must not be null."); this.stepExecution = stepExecution; this.stepExecutionHistory = stepExecutionHistory; this.percentageComplete = percentageComplete; this.finished = isFinished; this.duration = duration; }
Source:
public long offset() { return offset; }

Target:
public Long offset() { return offset; }
Source:
public void destroy() { LOG.debug("InitServlet shutdown stopping executor(s)...."); super.destroy(); }

Target:
public void destroy() { LOG.debug("InitServlet--destroy"); super.destroy(); }
Source:
private static Object readTrueTillTheEnd(final StringTokenizer tokenizer) { if (tokenizer.next(3).equals("rue")) { return Boolean.TRUE; } else { throw syntaxError("Expected false value", tokenizer); } }

Target:
private static Object readTrueTillTheEnd(final StringTokenizer tokenizer) { if (tokenizer.next(3).equals("rue")) { return Boolean.TRUE; } else { throw syntaxError("Expected true value", tokenizer); } }
Source:
private String getName(Object object) { if (object instanceof IFSTreeNode) return ((IFSTreeNode) object).getLocation(); if (object instanceof File) return ((File) object).getAbsolutePath(); return String.valueOf(object); }

Target:
private String getName(Object object) { if (object instanceof IFSTreeNode) return ((IFSTreeNode) object).getName(); if (object instanceof File) return ((File) object).getName(); return String.valueOf(object); }
Source:
public void getGroupObjectCollectionTest() throws Exception { CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService(); CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService(); Community community = null; Collection collection = null; Group adminGroup = null; Group worfklowGroup = null; Group submitterGroup = null; try { context.turnOffAuthorisationSystem(); community = communityService.create(null, context); collection = collectionService.create(context, community); adminGroup = collectionService.createAdministrators(context, collection); worfklowGroup = collectionService.createWorkflowGroup(context, collection, 1); submitterGroup = collectionService.createSubmitters(context, collection); context.commit(); adminGroup = context.reloadEntity(adminGroup); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + adminGroup.getID() + "/object") ).andExpect(status().isOk()); getClient(authToken).perform( get("/api/eperson/groups/" + worfklowGroup.getID() + "/object") ).andExpect(status().isOk()); getClient(authToken).perform( get("/api/eperson/groups/" + submitterGroup.getID() + "/object") ).andExpect(status().isOk()); } finally { if (collection != null) { CollectionBuilder.deleteCollection(collection.getID()); } if (community != null) { CommunityBuilder.deleteCommunity(community.getID()); } if (adminGroup != null) { GroupBuilder.deleteGroup(adminGroup.getID()); } if (worfklowGroup != null) { GroupBuilder.deleteGroup(worfklowGroup.getID()); } if (submitterGroup != null) { GroupBuilder.deleteGroup(submitterGroup.getID()); } } }

Target:
public void getGroupObjectCollectionTest() throws Exception { context.turnOffAuthorisationSystem(); Community community = CommunityBuilder.createCommunity(context) .withName("Parent Community") .withAdminGroup(admin) .build(); Collection collection = CollectionBuilder.createCollection(context, community) .withName("Collection") .withAdminGroup(admin) .withWorkflowGroup(1, admin) .withSubmitterGroup(admin) .build(); Group adminGroup = collection.getAdministrators(); Group worfklowGroup = collection.getWorkflowStep1(context); Group submitterGroup = collection.getSubmitters(); context.restoreAuthSystemState(); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform( get("/api/eperson/groups/" + adminGroup.getID() + "/object") ).andExpect(status().isOk()); getClient(authToken).perform( get("/api/eperson/groups/" + worfklowGroup.getID() + "/object") ).andExpect(status().isOk()); getClient(authToken).perform( get("/api/eperson/groups/" + submitterGroup.getID() + "/object") ).andExpect(status().isOk()); }
Source:
public Object getValueAt(int row, int col) { int index = candidateRowToInstanceIndex(row); return keyFields.getField(col, side.opposite()).getView().getString(index); }

Target:
public Object getValueAt(int row, int col) { int index = candidateRowToInstanceIndex(row); String value = keyFields.getField(col, side.opposite()).getView().getString(index); double score = rowScore(matrix, index, col); return String.format("%s [%.2f]", Strings.nullToEmpty(value), score); }
Source:
public void put(byte[] key, byte[] value) { try { OutgoingMessageEnvelope envelope = new OutgoingMessageEnvelope(coordinatorSystemStream, 0, key, value); if (value != null) { bootstrappedMessages.put(key, value); } else { bootstrappedMessages.remove(key); } systemProducer.send(source, envelope); systemProducer.flush(source); } catch (Exception e) { throw new SamzaException(e); } }

Target:
public void put(byte[] key, byte[] value) { OutgoingMessageEnvelope envelope = new OutgoingMessageEnvelope(coordinatorSystemStream, 0, key, value); systemProducer.send(SOURCE, envelope); flush(); }
Source:
private boolean maybeWriteResponseMetadata(HttpResponse responseMetadata, GenericFutureListener<ChannelFuture> listener) { long writeProcessingStartTime = System.currentTimeMillis(); boolean writtenThisTime = false; if (responseMetadataWriteInitiated.compareAndSet(false, true) && ctx.channel().isActive()) { if (!HttpUtil.isContentLengthSet(responseMetadata) && (responseMetadata.status().equals(HttpResponseStatus.OK) || responseMetadata.status().equals(HttpResponseStatus.PARTIAL_CONTENT))) { HttpUtil.setTransferEncodingChunked(responseMetadata, true); } else if (HttpUtil.isContentLengthSet(responseMetadata) && HttpUtil.getContentLength(responseMetadata) == 0 && !(responseMetadata instanceof FullHttpResponse)) { FullHttpResponse fullHttpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, responseMetadata.status()); fullHttpResponse.headers().set(responseMetadata.headers()); responseMetadata = fullHttpResponse; } logger.trace("Sending response with status on channel {}", responseMetadata.status(), ctx.channel()); finalResponseMetadata = responseMetadata; ChannelPromise writePromise = ctx.newPromise().addListener(listener); ctx.writeAndFlush(responseMetadata, writePromise); writtenThisTime = true; long writeProcessingTime = System.currentTimeMillis() - writeProcessingStartTime; nettyMetrics.responseMetadataProcessingTimeInMs.update(writeProcessingTime); request.getMetricsTracker().nioMetricsTracker.markFirstByteSent(); } return writtenThisTime; }

Target:
private boolean maybeWriteResponseMetadata(HttpResponse responseMetadata, GenericFutureListener<ChannelFuture> listener) { long writeProcessingStartTime = System.currentTimeMillis(); boolean writtenThisTime = false; if (responseMetadataWriteInitiated.compareAndSet(false, true) && ctx.channel().isActive()) { if (!HttpUtil.isContentLengthSet(responseMetadata) && (responseMetadata.status().equals(HttpResponseStatus.OK) || responseMetadata.status().equals(HttpResponseStatus.PARTIAL_CONTENT))) { HttpUtil.setTransferEncodingChunked(responseMetadata, true); } else if (HttpUtil.isContentLengthSet(responseMetadata) && HttpUtil.getContentLength(responseMetadata) == 0 && !(responseMetadata instanceof FullHttpResponse)) { FullHttpResponse fullHttpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, responseMetadata.status()); fullHttpResponse.headers().set(responseMetadata.headers()); responseMetadata = fullHttpResponse; } logger.trace("Sending response with status on channel {}", responseMetadata.status(), ctx.channel()); finalResponseMetadata = responseMetadata; ChannelPromise writePromise = ctx.newPromise().addListener(listener); ctx.writeAndFlush(responseMetadata, writePromise); writtenThisTime = true; long writeProcessingTime = System.currentTimeMillis() - writeProcessingStartTime; nettyMetrics.responseMetadataProcessingTimeInMs.update(writeProcessingTime); if (request != null) { request.getMetricsTracker().nioMetricsTracker.markFirstByteSent(); } } return writtenThisTime; }
Source:
public void onClosed() { CoreRegistry.remove(WorldGeneratorPluginLibrary.class); if (environment != null) { CoreRegistry.get(AssetManager.class).setEnvironment(moduleManager.getEnvironment()); environment.close(); environment = null; } if (previewGen != null) { previewGen.close(); previewGen = null; } WorldConfigurator worldConfig = worldGenerator.getConfigurator(); Map<String, Component> params = worldConfig.getProperties(); if (params != null) { config.setModuleConfigs(worldGenerator.getUri(), params); } super.onClosed(); }

Target:
public void onClosed() { context.remove(WorldGeneratorPluginLibrary.class); if (environment != null) { assetManager.setEnvironment(moduleManager.getEnvironment()); environment.close(); environment = null; } if (previewGen != null) { previewGen.close(); previewGen = null; } WorldConfigurator worldConfig = worldGenerator.getConfigurator(); Map<String, Component> params = worldConfig.getProperties(); if (params != null) { config.setModuleConfigs(worldGenerator.getUri(), params); } super.onClosed(); }
Source:
private static Cache initGetCache(final String name) { Cache cache = new Cache( new CacheConfiguration(name, MAX_ELEMENTS) .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) .eternal(true) .diskExpiryThreadIntervalSeconds(0) .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP))); return cache; }

Target:
private static Cache initGetCache(final String name) { Cache cache = new Cache( new CacheConfiguration(name, MAX_ELEMENTS) .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU) .eternal(true) .diskExpiryThreadIntervalSeconds(0) .persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP))); return cache; }
Source:
private void onClose() { if (DEBUG) Log.d(TAG, "onClose() called"); if (lockManager != null) { lockManager.releaseWifiAndCpu(); } if (basePlayerImpl != null) { basePlayerImpl.stopActivityBinding(); basePlayerImpl.destroy(); } if (notificationManager != null) notificationManager.cancel(NOTIFICATION_ID); mBinder = null; basePlayerImpl = null; lockManager = null; basePlayerImpl.audioReactor.unregisterMediaButtonEventReceiver(mReceiverComponent); stopForeground(true); stopSelf(); }

Target:
private void onClose() { if (DEBUG) Log.d(TAG, "onClose() called"); if (lockManager != null) { lockManager.releaseWifiAndCpu(); } if (basePlayerImpl != null) { basePlayerImpl.audioReactor.unregisterMediaButtonEventReceiver(mReceiverComponent); basePlayerImpl.stopActivityBinding(); basePlayerImpl.destroy(); } if (notificationManager != null) notificationManager.cancel(NOTIFICATION_ID); mBinder = null; basePlayerImpl = null; lockManager = null; stopForeground(true); stopSelf(); }
Source:
public boolean updateLearnedStateFromPeers(Optional<PaxosValue> greatestLearned) { final long nextToLearnSeq = greatestLearned.map(value -> value.getRound() + 1).orElse(0L); List<PaxosUpdate> updates = PaxosQuorumChecker.<PaxosLearner, PaxosUpdate> collectQuorumResponses( learners, new Function<PaxosLearner, PaxosUpdate>() { @Override @Nullable public PaxosUpdate apply(@Nullable PaxosLearner learner) { return new PaxosUpdate( copyOf(learner.getLearnedValuesSince(nextToLearnSeq))); } }, proposer.getQuorumSize(), executor, PaxosQuorumChecker.DEFAULT_REMOTE_REQUESTS_TIMEOUT_IN_SECONDS); boolean learned = false; for (PaxosUpdate update : updates) { ImmutableCollection<PaxosValue> values = update.getValues(); for (PaxosValue value : values) { PaxosValue currentLearnedValue = knowledge.getLearnedValue(value.getRound()); if (currentLearnedValue == null) { knowledge.learn(value.getRound(), value); learned = true; } } } return learned; }

Target:
public boolean updateLearnedStateFromPeers(Optional<PaxosValue> greatestLearned) { final long nextToLearnSeq = greatestLearned.map(value -> value.getRound()).orElse(PaxosAcceptor.NO_LOG_ENTRY) + 1; List<PaxosUpdate> updates = PaxosQuorumChecker.<PaxosLearner, PaxosUpdate>collectQuorumResponses( learners, new Function<PaxosLearner, PaxosUpdate>() { @Override @Nullable public PaxosUpdate apply(@Nullable PaxosLearner learner) { return new PaxosUpdate( copyOf(learner.getLearnedValuesSince(nextToLearnSeq))); } }, proposer.getQuorumSize(), executor, PaxosQuorumChecker.DEFAULT_REMOTE_REQUESTS_TIMEOUT_IN_SECONDS); boolean learned = false; for (PaxosUpdate update : updates) { ImmutableCollection<PaxosValue> values = update.getValues(); for (PaxosValue value : values) { PaxosValue currentLearnedValue = knowledge.getLearnedValue(value.getRound()); if (currentLearnedValue == null) { knowledge.learn(value.getRound(), value); learned = true; } } } return learned; }
Source:
public void shouldReturn400_whenCorporateDebitCardSurchargeOperationIsInvalid() { JsonNode jsonNode = new ObjectMapper() .valueToTree(ImmutableMap.of("op", "anything other than the string replace", "path", "corporate_debit_card_surcharge_amount", "value", 250)); Response response = resources.client() .target("/v1/api/accounts/12") .request() .method("PATCH", Entity.json(jsonNode)); assertThat(response.getStatus(), is(400)); String errorMessage = response.readEntity(JsonNode.class).get("errors").get(0).textValue(); assertThat(errorMessage, is("Operation [anything other than the string replace] is not valid for path [corporate_debit_card_surcharge_amount]")); }

Target:
public void shouldReturn400_whenCorporateDebitCardSurchargeOperationIsInvalid() { JsonNode jsonNode = new ObjectMapper() .valueToTree(ImmutableMap.of("op", "add", "path", "corporate_debit_card_surcharge_amount", "value", 250)); Response response = resources.client() .target("/v1/api/accounts/12") .request() .method("PATCH", Entity.json(jsonNode)); assertThat(response.getStatus(), is(400)); String errorMessage = response.readEntity(JsonNode.class).get("errors").get(0).textValue(); assertThat(errorMessage, is("Operation [add] is not valid for path [corporate_debit_card_surcharge_amount]")); }
Source:
public HttpServiceResponse handle(HttpServiceRequest request) throws Exception { HttpServiceResponse response = new HttpServiceResponse(); if (HttpServer.Method.PUT == request.getMethod()) { ClientConfiguration adminConf = new ClientConfiguration(conf); BookKeeperAdmin admin = new BookKeeperAdmin(adminConf); try { admin.triggerAudit(); } catch (Exception e) { e.printStackTrace(); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Exception when do operation." + e.getMessage()); return response; } response.setCode(HttpServer.StatusCode.OK); response.setBody("Success trigger audit."); LOG.debug("response body:" + response.getBody()); return response; } else { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Not found method. Should be PUT method"); return response; } }

Target:
public HttpServiceResponse handle(HttpServiceRequest request) throws Exception { HttpServiceResponse response = new HttpServiceResponse(); if (HttpServer.Method.PUT == request.getMethod()) { try { bka.triggerAudit(); } catch (Exception e) { LOG.error("Meet Exception: ", e); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Exception when do operation." + e.getMessage()); return response; } response.setCode(HttpServer.StatusCode.OK); response.setBody("Success trigger audit."); LOG.debug("response body:" + response.getBody()); return response; } else { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Not found method. Should be PUT method"); return response; } }
Source:
public void RegularUserCanAddVideoInArticleCommentEditorByFindingWikiaVideo() { new ArticleContent().clear(); ArticlePageObject article = new ArticlePageObject().open(); MiniEditorComponentObject editor = article.triggerCommentArea(); VetAddVideoComponentObject vetAddingVideo = editor.clickAddVideo(); VetOptionsComponentObject vetOptions = vetAddingVideo.addVideoByQuery(VideoContent.WIKIA_VIDEO_QUERY, 0); vetOptions.setCaption(PageContent.CAPTION); String desiredVideoName = vetOptions.getVideoName(); vetOptions.submit(); Assertion.assertTrue(article.getArticleComment().isVideoVisible()); article.submitComment(); Assertion.assertTrue(article.isVideoCommentPresent(desiredVideoName)); }

Target:
public void RegularUserCanAddVideoInArticleCommentEditorByFindingWikiaVideo() { new ArticleContent().clear(); ArticlePageObject article = new ArticlePageObject().open(); MiniEditorComponentObject editor = article.triggerCommentArea(); VetAddVideoComponentObject vetAddingVideo = editor.clickAddVideo(); VetOptionsComponentObject vetOptions = vetAddingVideo.addVideoByQuery(VideoContent.WIKIA_VIDEO_QUERY, 0); vetOptions.setCaption(PageContent.CAPTION); String desiredVideoName = vetOptions.getVideoName(); vetOptions.submit(); Assertion.assertTrue(article.getArticleComment().isVideoVisible(), "Video is not visible"); article.submitComment(); Assertion.assertTrue(article.isVideoCommentPresent(desiredVideoName), "Video comment doesn't have desired name"); }
Source:
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); pageTitle = GsonUnmarshaller.unmarshal(PageTitle.class, getArguments().getString(ARG_TITLE)); reviewEnabled = getArguments().getBoolean(ARG_REVIEW_ENABLED); DescriptionEditFunnel.Type type = pageTitle.getDescription() == null ? DescriptionEditFunnel.Type.NEW : DescriptionEditFunnel.Type.EXISTING; highlightText = getArguments().getString(ARG_HIGHLIGHT_TEXT); languageCode = StringUtils.defaultString(SiteInfoClient.getLang(pageTitle.getWikiSite()), pageTitle.getWikiSite().languageCode()); funnel = new DescriptionEditFunnel(WikipediaApp.getInstance(), pageTitle, type); funnel.logStart(); }

Target:
@Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); pageTitle = GsonUnmarshaller.unmarshal(PageTitle.class, getArguments().getString(ARG_TITLE)); reviewEnabled = getArguments().getBoolean(ARG_REVIEW_ENABLED); DescriptionEditFunnel.Type type = pageTitle.getDescription() == null ? DescriptionEditFunnel.Type.NEW : DescriptionEditFunnel.Type.EXISTING; highlightText = getArguments().getString(ARG_HIGHLIGHT_TEXT); funnel = new DescriptionEditFunnel(WikipediaApp.getInstance(), pageTitle, type); funnel.logStart(); }
Source:
private Boolean getBooleanCapability(String key) { Object o = getRawCapabilities().get(key); if (o == null) { return null; } else { return is(key); } }

Target:
private Boolean getBooleanCapability(String key) { Object o = getRawCapabilities().get(key); if (o == null) { return null; } else if (o instanceof Boolean) { return (Boolean) o; } else if (o instanceof String && ("true".equalsIgnoreCase((String) o) || "false".equalsIgnoreCase((String) o))) { return Boolean.valueOf((String) o); } else { throw new ClassCastException(String.format( "DesiredCapability %s's value should be boolean: found value %s of type %s", key, o.toString(), o.getClass().getName())); } }
Source:
public static boolean onPistonMove(World world, BlockPos pos, EnumFacing facing, boolean extending) { if (extending) return MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.PistonEvent.PistonExtendEvent(world, pos, facing)); else return MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.PistonEvent.PistonRetractEvent(world, pos, facing)); }

Target:
public static boolean onPistonMove(World world, BlockPos pos, EnumFacing facing, boolean extending) { if (extending) return MinecraftForge.EVENT_BUS.post(new PistonExtendEvent(world, pos, facing)); else return MinecraftForge.EVENT_BUS.post(new PistonRetractEvent(world, pos, facing)); }
Source:
public void test_add_sub_mul_div_rem() throws Exception { int[] opcodes = new int[] { Opcodes.IADD, LADD, Opcodes.FADD, Opcodes.DADD, Opcodes.ISUB, Opcodes.LSUB, Opcodes.FSUB, Opcodes.DSUB, Opcodes.IMUL, Opcodes.LMUL, Opcodes.FMUL, Opcodes.DMUL, Opcodes.IDIV, Opcodes.LDIV, Opcodes.FDIV, Opcodes.DDIV, Opcodes.IREM, Opcodes.LREM, Opcodes.FREM, Opcodes.DREM, }; assertConsume2produceNotNull(opcodes); assertThrowWhenInvalidStack(opcodes, " needs 2 values on stack"); }

Target:
public void test_add_sub_mul_div_rem() throws Exception { int[] opcodes = new int[] { Opcodes.IADD, Opcodes.LADD, Opcodes.FADD, Opcodes.DADD, Opcodes.ISUB, Opcodes.LSUB, Opcodes.FSUB, Opcodes.DSUB, Opcodes.IMUL, Opcodes.LMUL, Opcodes.FMUL, Opcodes.DMUL, Opcodes.IDIV, Opcodes.LDIV, Opcodes.FDIV, Opcodes.DDIV, Opcodes.IREM, Opcodes.LREM, Opcodes.FREM, Opcodes.DREM, }; assertConsume2produceNotNull(opcodes); assertThrowWhenInvalidStack(opcodes, " needs 2 values on stack"); }
Source:
public boolean inputIsConnected(int index) { if (index >= 0 && index < getInputs().length) { return getInputs()[index] != null && getInputs()[index].isFullyConnected(); } return false; }

Target:
public boolean inputIsConnected(int index) { return index>=0 && index < inputs.size() && inputs.get(index).isConnected(); }
Source:
private static int[] buildLookupArray( SortedSet<LocalDate> holidays, Set<DayOfWeek> weekendDays, int startYear, int endYearExclusive) { int[] array = new int[(endYearExclusive - startYear) * 12]; LocalDate firstOfMonth = LocalDate.of(startYear, 1, 1); for (int i = 0; i < array.length; i++) { int monthLen = firstOfMonth.lengthOfMonth(); array[i] = (1 << monthLen) - 1; for (DayOfWeek weekendDow : weekendDays) { int loopDow0 = firstOfMonth.getDayOfWeek().getValue() - 1; int weekendDow0 = weekendDow.getValue() - 1; int offset = (weekendDow0 - loopDow0 + 7) % 7; array[i] &= ~(0b10000001000000100000010000001 << offset); } firstOfMonth = firstOfMonth.plusMonths(1); } for (LocalDate date : holidays) { int index = (date.getYear() - startYear) * 12 + date.getMonthValue() - 1; array[index] &= ~(1 << (date.getDayOfMonth() - 1)); } return array; }

Target:
private static int[] buildLookupArray( SortedSet<LocalDate> holidays, Set<DayOfWeek> weekendDays, int startYear, int endYearExclusive) { int[] array = new int[(endYearExclusive - startYear) * 12]; LocalDate firstOfMonth = LocalDate.of(startYear, 1, 1); for (int i = 0; i < array.length; i++) { int monthLen = firstOfMonth.lengthOfMonth(); array[i] = (1 << monthLen) - 1; for (DayOfWeek weekendDow : weekendDays) { int daysDiff = weekendDow.getValue() - firstOfMonth.getDayOfWeek().getValue(); int offset = (daysDiff < 0 ? daysDiff + 7 : daysDiff); array[i] &= ~(0b10000001000000100000010000001 << offset); } firstOfMonth = firstOfMonth.plusMonths(1); } for (LocalDate date : holidays) { int index = (date.getYear() - startYear) * 12 + date.getMonthValue() - 1; array[index] &= ~(1 << (date.getDayOfMonth() - 1)); } return array; }
Source:
public GroupedHistogramState( Type keyType, int expectedEntriesCount) { valuesBlockBuilder = keyType.createBlockBuilder(null, computeBucketCount(expectedEntriesCount, GroupedTypedHistogram.MAX_FILL_RATIO)); typedHistogram = new GroupedTypedHistogram(keyType, expectedEntriesCount, valuesBlockBuilder); }

Target:
public GroupedHistogramState(Type keyType, int expectedEntriesCount) { typedHistogram = new GroupedTypedHistogram(keyType, expectedEntriesCount); }
Source:
public void createTopic(final String topic, final int partitionsNum, final int replicaFactor, final long retentionMs, final long rotationMs) { final String connectionString = zkFactory.get().getZookeeperClient().getCurrentConnectionString(); final ZkClient zkClient = new ZkClient(connectionString, settings.getZkSessionTimeoutMs(), settings.getZkConnectionTimeoutMs(), ZKStringSerializer$.MODULE$); final ZkUtils zkUtils = ZkUtils.apply(zkClient, false); final Properties topicConfig = new Properties(); topicConfig.setProperty("retention.ms", Long.toString(retentionMs)); topicConfig.setProperty("segment.ms", Long.toString(rotationMs)); AdminUtils.createTopic(zkUtils, topic, partitionsNum, replicaFactor, topicConfig); zkClient.close(); }

Target:
public void createTopic(final String topic, final int partitionsNum, final int replicaFactor, final long retentionMs, final long rotationMs) { final String connectionString = zkFactory.get().getZookeeperClient().getCurrentConnectionString(); final ZkUtils zkUtils = ZkUtils.apply(connectionString, settings.getZkSessionTimeoutMs(), settings.getZkConnectionTimeoutMs(), false); try { final Properties topicConfig = new Properties(); topicConfig.setProperty("retention.ms", Long.toString(retentionMs)); topicConfig.setProperty("segment.ms", Long.toString(rotationMs)); AdminUtils.createTopic(zkUtils, topic, partitionsNum, replicaFactor, topicConfig); } finally { zkUtils.close(); } }
Source:
public long get(int length, boolean signed) throws CTFReaderException { if (length > BIT_LONG) { throw new CTFReaderException("Cannot read a long longer than 64 bits. Rquested: " + length); } if (length > BIT_INT) { final int highShift = length - BIT_INT; long a = getInt() & 0x00000000FFFFFFFFL; long b = getInt(highShift, false); long retVal; a &= 0xFFFFFFFFL; b &= ((1L << highShift) - 1L); retVal = (this.byteOrder == ByteOrder.BIG_ENDIAN) ? ((a << highShift) | b) : ((b << BIT_INT) | a); if (signed) { int signExtendBits = BIT_LONG - length; retVal = (retVal << signExtendBits) >> signExtendBits; } return retVal; } long retVal = getInt(length, signed); return (signed ? retVal : (retVal & 0xFFFFFFFFL)); }

Target:
public long get(int length, boolean signed) throws CTFReaderException { if (length > BIT_LONG) { throw new CTFReaderException("Cannot read a long longer than 64 bits. Rquested: " + length); } if (length > BIT_INT) { final int highShift = length - BIT_INT; long a = getInt(); long b = getInt(highShift, false); long retVal; a &= 0xFFFFFFFFL; b &= (1L << highShift) - 1L; retVal = (this.byteOrder == ByteOrder.BIG_ENDIAN) ? ((a << highShift) | b) : ((b << BIT_INT) | a); if (signed) { int signExtendBits = BIT_LONG - length; retVal = (retVal << signExtendBits) >> signExtendBits; } return retVal; } long retVal = getInt(length, signed); return (signed ? retVal : (retVal & 0xFFFFFFFFL)); }
Source:
public FulltextFactory( FileSystemAbstraction fileSystem, File storeDir, Analyzer analyzer ) throws IOException { this.analyzer = analyzer; this.fileSystem = fileSystem; Factory<IndexWriterConfig> population = () -> IndexWriterConfigs.population( analyzer ); partitionFactory = new WritableIndexPartitionFactory( population ); this.storeDir = storeDir; }

Target:
public FulltextFactory( FileSystemAbstraction fileSystem, File storeDir, Analyzer analyzer ) throws IOException { this.analyzer = analyzer; this.fileSystem = fileSystem; Factory<IndexWriterConfig> indexWriterConfigFactory = () -> IndexWriterConfigs.standard( analyzer ); partitionFactory = new WritableIndexPartitionFactory( indexWriterConfigFactory ); indexDir = new File( storeDir, INDEX_DIR ); }
Source:
public void onSupportActionModeStarted(ActionMode mode) { if (CustomCabMenuHelper.shouldInjectCustomMenu(PageActivity.this, mode)) { CustomCabMenuHelper.injectCustomMenu(PageActivity.this, mode); } prepareActionMode(mode); super.onSupportActionModeStarted(mode); }

Target:
public void onSupportActionModeStarted(ActionMode mode) { boolean wasCabOpen = isCabOpen(); currentActionMode = new CompatActionMode(mode, wasCabOpen); if (currentActionMode.shouldInjectCustomMenu(PageActivity.this)) { currentActionMode.injectCustomMenu(PageActivity.this); } prepareActionMode(); super.onSupportActionModeStarted(mode); }
Source:
protected Document fillCreateOptions(DocumentRef parentRef, String childName, Map<String, Serializable> options) throws DocumentSecurityException { Document document; if (parentRef == null || EMPTY_PATH.equals(parentRef)) { document = getSession().getNullDocument(); options.put(CoreEventConstants.DESTINATION_REF, null); options.put(CoreEventConstants.DESTINATION_PATH, null); options.put(CoreEventConstants.DESTINATION_NAME, childName); options.put(CoreEventConstants.DESTINATION_EXISTS, false); } else { document = resolveReference(parentRef); checkPermission(document, ADD_CHILDREN); options.put(CoreEventConstants.DESTINATION_REF, parentRef); options.put(CoreEventConstants.DESTINATION_PATH, document.getPath()); options.put(CoreEventConstants.DESTINATION_NAME, childName); if (Boolean.TRUE.equals(options.get(CoreSession.SKIP_DESTINATION_CHECK_ON_CREATE))) { options.put(CoreEventConstants.DESTINATION_EXISTS, false); } else { options.put(CoreEventConstants.DESTINATION_EXISTS, document.hasChild(childName)); } } return document; }

Target:
protected Document fillCreateOptions(DocumentRef parentRef, String childName, Map<String, Serializable> options) throws DocumentSecurityException { Document folder; if (parentRef == null || EMPTY_PATH.equals(parentRef)) { folder = getSession().getNullDocument(); options.put(CoreEventConstants.DESTINATION_REF, null); options.put(CoreEventConstants.DESTINATION_PATH, null); options.put(CoreEventConstants.DESTINATION_NAME, childName); options.put(CoreEventConstants.DESTINATION_EXISTS, false); } else { folder = resolveReference(parentRef); checkPermission(folder, ADD_CHILDREN); options.put(CoreEventConstants.DESTINATION_REF, parentRef); options.put(CoreEventConstants.DESTINATION_PATH, folder.getPath()); options.put(CoreEventConstants.DESTINATION_NAME, childName); if (Boolean.TRUE.equals(options.get(CoreSession.SKIP_DESTINATION_CHECK_ON_CREATE))) { options.put(CoreEventConstants.DESTINATION_EXISTS, false); } else { options.put(CoreEventConstants.DESTINATION_EXISTS, folder.hasChild(childName)); } } return folder; }
Source:
public void testExecutionOrder() throws Exception { final PersistentObject container = mock(PersistentObject.class); final List<SConnectorDefinition> connectors = getConnectorList(); bpmInstancesCreator.createConnectorInstances(container, connectors, SConnectorInstance.FLOWNODE_TYPE); verify(bpmInstancesCreator).createConnectorInstanceObject(any(PersistentObject.class), anyString(), any(SConnectorDefinition.class),eq(0)); verify(bpmInstancesCreator).createConnectorInstanceObject(any(PersistentObject.class), anyString(), any(SConnectorDefinition.class),eq(1)); ignoreStubs(transactionExecutor); ignoreStubs(connectorInstanceService); }

Target:
public void testExecutionOrder() throws Exception { final PersistentObject container = mock(PersistentObject.class); final List<SConnectorDefinition> connectors = getConnectorList(); bpmInstancesCreator.createConnectorInstances(container, connectors, SConnectorInstance.FLOWNODE_TYPE); verify(bpmInstancesCreator).createConnectorInstanceObject(any(PersistentObject.class), anyString(), any(SConnectorDefinition.class),eq(0)); verify(bpmInstancesCreator).createConnectorInstanceObject(any(PersistentObject.class), anyString(), any(SConnectorDefinition.class),eq(1)); }
Source:
public void getResourceClasses(final IDMContext dmc, final DataRequestMonitor<IResourceClass[]> rm) { getExecutor().submit(new DsfRunnable() { @Override public void run() { IGDBControl control = getServicesTracker().getService(IGDBControl.class); control.queueCommand(new MIInfoOs(dmc), new DataRequestMonitor<MIInfoOsInfo>(getExecutor(), rm) { @Override @ConfinedToDsfExecutor("fExecutor") protected void handleCompleted() { rm.setData(getData().getResourceClasses()); super.handleCompleted(); } }); } }); }

Target:
public void getResourceClasses(final IDMContext dmc, final DataRequestMonitor<IResourceClass[]> rm) { IGDBControl control = getServicesTracker().getService(IGDBControl.class); if (control == null) { rm.done(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_STATE, "Service not available", null)); return; } control.queueCommand(new MIInfoOs(dmc), new DataRequestMonitor<MIInfoOsInfo>(getExecutor(), rm) { @Override @ConfinedToDsfExecutor("fExecutor") protected void handleSuccess() { rm.setData(getData().getResourceClasses()); rm.done(); } }); }
Source:
private boolean updateTemplates() { for (VmTemplate template : templatesLockedForUpdate) { template.setClusterCompatibilityVersion(getCluster().getCompatibilityVersion()); UpdateVmTemplateParameters parameters = new UpdateVmTemplateParameters(template); parameters.setLockProperties(LockProperties.create(LockProperties.Scope.None)); parameters.setClusterLevelChangeFromVersion(oldCluster.getCompatibilityVersion()); updateRngDeviceIfNecessary(template.getId(), template.getCustomCompatibilityVersion(), parameters); if (!parameters.isUpdateRngDevice()) { continue; } final VdcReturnValueBase result = runInternalAction( VdcActionType.UpdateVmTemplate, parameters, cloneContextAndDetachFromParent()); if (!result.getSucceeded()) { List<String> params = new ArrayList<>(); params.add("$action Update"); params.add("$type Template"); params.add(parseErrorMessage(result.getValidationMessages())); List<String> messages = Backend.getInstance().getErrorsTranslator().translateErrorText(params); failedUpgradeVms.put(template.getName(), messages.get(0)); } } return true; }

Target:
private boolean updateTemplates() { for (VmTemplate template : templatesLockedForUpdate) { template.setClusterCompatibilityVersion(getCluster().getCompatibilityVersion()); UpdateVmTemplateParameters parameters = new UpdateVmTemplateParameters(template); parameters.setLockProperties(LockProperties.create(LockProperties.Scope.None)); parameters.setClusterLevelChangeFromVersion(oldCluster.getCompatibilityVersion()); updateRngDeviceIfNecessary(template.getId(), template.getCustomCompatibilityVersion(), parameters); if (!parameters.isUpdateRngDevice()) { continue; } final VdcReturnValueBase result = runInternalAction( VdcActionType.UpdateVmTemplate, parameters, cloneContextAndDetachFromParent()); if (!result.getSucceeded()) { List<String> params = new ArrayList<>(); params.add("$action Update"); params.add("$type Template"); params.add(parseErrorMessage(result.getValidationMessages())); List<String> messages = Backend.getInstance().getErrorsTranslator().translateErrorText(params); failedUpgradeEntities.put(template.getName(), getFailedMessage(messages)); } } return true; }
Source:
public void close() { try { LOG.info("Shutting down supervisor {}", getId()); metricsReporters.close(); this.active = false; heartbeatTimer.close(); workerHeartbeatTimer.close(); eventTimer.close(); if (eventManager != null) { eventManager.close(); } if (readState != null) { readState.close(); } asyncLocalizer.close(); getStormClusterState().disconnect(); if (thriftServer != null) { this.thriftServer.stop(); } } catch (Exception e) { LOG.error("Error Shutting down", e); } }

Target:
public void close() { try { LOG.info("Shutting down supervisor {}", getId()); if (metricsReporters != null) { metricsReporters.close(); } this.active = false; heartbeatTimer.close(); workerHeartbeatTimer.close(); eventTimer.close(); if (eventManager != null) { eventManager.close(); } if (readState != null) { readState.close(); } asyncLocalizer.close(); getStormClusterState().disconnect(); if (thriftServer != null) { this.thriftServer.stop(); } } catch (Exception e) { LOG.error("Error Shutting down", e); } }