auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartEscalationEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartEscalationEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertEscalationEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, ""); assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartEscalationEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartEscalationEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertEscalationEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, EMPTY_VALUE); assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE); }
Source:
public String createCsrfToken(HttpServletRequest request, HttpServletResponse response) { CsrfToken csrfToken = this.csrfTokenRepository.loadToken(request); final boolean missingToken = csrfToken == null; if (missingToken) { csrfToken = this.csrfTokenRepository.generateToken(request); this.csrfTokenRepository.saveToken(csrfToken, request, response); } return csrfToken.getToken(); }

Target:
public String createCsrfToken(HttpServletRequest request, HttpServletResponse response) { CsrfToken csrfToken = this.csrfTokenRepository.loadToken(request); if (csrfToken == null) { csrfToken = this.csrfTokenRepository.generateToken(request); this.csrfTokenRepository.saveToken(csrfToken, request, response); } return csrfToken.getToken(); }
Source:
private AuthenticationResult postMessage(String requestMessage) throws Exception { URL authority = null; AuthenticationResult result = null; try { authority = new URL(getTokenEndpoint()); } catch (MalformedURLException e1) { Logger.e(TAG, e1.getMessage(), "", ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_URL, e1); throw e1; } HashMap<String, String> headers = getRequestHeaders(); try { mWebRequestHandler.setRequestCorrelationId(mRequest.getCorrelationId()); HttpWebResponse response = mWebRequestHandler.sendPost(authority, headers, requestMessage.getBytes(AuthenticationConstants.ENCODING_UTF8), "application/x-www-form-urlencoded"); if (response.getResponseException() == null) { Logger.v(TAG, "Token request does not have exception"); result = processTokenResponse(response); } } catch (IllegalArgumentException e) { Logger.e(TAG, e.getMessage(), "", ADALError.ARGUMENT_EXCEPTION, e); throw e; } catch (UnsupportedEncodingException e) { Logger.e(TAG, e.getMessage(), "", ADALError.ENCODING_IS_NOT_SUPPORTED, e); throw e; } catch (IOException e) { Logger.e(TAG, e.getMessage(), "", ADALError.IO_EXCEPTION, e); throw e; } catch (Exception e) { Logger.e(TAG, e.getMessage(), "", ADALError.SERVER_ERROR, e); throw e; } return result; }

Target:
private AuthenticationResult postMessage(String requestMessage) throws Exception { URL authority = null; AuthenticationResult result = null; authority = StringExtensions.getUrl(getTokenEndpoint()); if (authority == null) { throw new AuthenticationException(ADALError.DEVELOPER_AUTHORITY_IS_NOT_VALID_URL); } HashMap<String, String> headers = getRequestHeaders(); try { mWebRequestHandler.setRequestCorrelationId(mRequest.getCorrelationId()); HttpWebResponse response = mWebRequestHandler.sendPost(authority, headers, requestMessage.getBytes(AuthenticationConstants.ENCODING_UTF8), "application/x-www-form-urlencoded"); if (response.getResponseException() == null) { Logger.v(TAG, "Token request does not have exception"); result = processTokenResponse(response); } } catch (IllegalArgumentException e) { Logger.e(TAG, e.getMessage(), "", ADALError.ARGUMENT_EXCEPTION, e); throw e; } catch (UnsupportedEncodingException e) { Logger.e(TAG, e.getMessage(), "", ADALError.ENCODING_IS_NOT_SUPPORTED, e); throw e; } catch (IOException e) { Logger.e(TAG, e.getMessage(), "", ADALError.IO_EXCEPTION, e); throw e; } catch (Exception e) { Logger.e(TAG, e.getMessage(), "", ADALError.SERVER_ERROR, e); throw e; } return result; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RMEvent rmEvent = (RMEvent) o; return counter == rmEvent.counter; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RMEvent rmEvent = (RMEvent) o; return counter == rmEvent.counter; }
Source:
protected Image retrieveAndStoreImage(String descriptorId) { NavigatorContentDescriptor contentDescriptor = getContentDescriptor(descriptorId); Image image = null; if (contentDescriptor != null) { String iconPath = contentDescriptor.getIcon(); if (iconPath != null) { String prefix = contentDescriptor.getId() == null ? "" : contentDescriptor.getId(); String iconKey = prefix + "::" + iconPath; ImageRegistry registry = getImageRegistry(); image = registry.get(iconKey); if (image == null || image.isDisposed()) { String pluginId = contentDescriptor.getContribution().getPluginId(); ResourceLocator.imageDescriptorFromBundle(pluginId, iconPath) .ifPresent(d -> registry.put(iconKey, d.createImage())); } } } return image; }

Target:
protected Image retrieveAndStoreImage(String descriptorId) { NavigatorContentDescriptor contentDescriptor = getContentDescriptor(descriptorId); Image image = null; if (contentDescriptor != null) { String iconPath = contentDescriptor.getIcon(); if (iconPath != null) { String prefix = contentDescriptor.getId() == null ? "" : contentDescriptor.getId(); String iconKey = prefix + "::" + iconPath; ImageRegistry registry = getImageRegistry(); image = registry.get(iconKey); if (image == null || image.isDisposed()) { String pluginId = contentDescriptor.getContribution().getPluginId(); ResourceLocator.imageDescriptorFromBundle(pluginId, iconPath).ifPresent(d -> { Image created = d.createImage(); if (created != null) { registry.put(iconKey, created); } }); } } } return image; }
Source:
public XWikiAttachmentList getAttachmentList() { return this.attachmentList; }

Target:
public List<XWikiAttachment> getAttachmentList() { return this.attachmentList; }
Source:
public List<Container> getContainers() throws UnrecoverableKeyException, CertificateEncodingException, NoSuchAlgorithmException, KeyStoreException, IOException { KubernetesSlave slave = getNode(); if(slave == null) { return new ArrayList<>(); } KubernetesCloud cloud = slave.getKubernetesCloud(); KubernetesClient client = cloud.connect(); String namespace = StringUtils.defaultIfBlank(slave.getNamespace(), client.getNamespace()); Pod pod = client.pods().inNamespace(namespace).withName(getName()).get(); return pod.getSpec().getContainers(); }

Target:
public List<Container> getContainers() throws UnrecoverableKeyException, CertificateEncodingException, NoSuchAlgorithmException, KeyStoreException, IOException { Jenkins.get().checkPermission(Jenkins.ADMINISTER); KubernetesSlave slave = getNode(); if(slave == null) { return new ArrayList<>(); } KubernetesCloud cloud = slave.getKubernetesCloud(); KubernetesClient client = cloud.connect(); String namespace = StringUtils.defaultIfBlank(slave.getNamespace(), client.getNamespace()); Pod pod = client.pods().inNamespace(namespace).withName(getName()).get(); return pod.getSpec().getContainers(); }
Source:
public final <R> Observable<R> concatMapEager(Function<? super T, ? extends ObservableSource<? extends R>> mapper, int maxConcurrency, int prefetch) { ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); return RxJavaPlugins.onAssembly(new ObservableConcatMapEager<T, R>(this, mapper, ErrorMode.IMMEDIATE, maxConcurrency, prefetch)); }

Target:
public final <R> Observable<R> concatMapEager(Function<? super T, ? extends ObservableSource<? extends R>> mapper, int maxConcurrency, int prefetch) { ObjectHelper.requireNonNull(mapper, "mapper is null"); ObjectHelper.verifyPositive(maxConcurrency, "maxConcurrency"); ObjectHelper.verifyPositive(prefetch, "prefetch"); return RxJavaPlugins.onAssembly(new ObservableConcatMapEager<T, R>(this, mapper, ErrorMode.IMMEDIATE, maxConcurrency, prefetch)); }
Source:
private void createIndexes() { mongoOperations.getCollection(collection).createIndex( new BasicDBObject(VariantToDBObjectConverter.CHROMOSOME_FIELD, 1) .append(VariantToDBObjectConverter.START_FIELD, 1).append(VariantToDBObjectConverter.END_FIELD, 1), new BasicDBObject(MongoDBHelper.BACKGROUND_INDEX, true)); mongoOperations.getCollection(collection).createIndex( new BasicDBObject(VariantToDBObjectConverter.IDS_FIELD, 1), new BasicDBObject(MongoDBHelper.BACKGROUND_INDEX, true)); String filesStudyIdField = String.format("%s.%s", VariantToDBObjectConverter.FILES_FIELD, VariantSourceEntryToDBObjectConverter.STUDYID_FIELD); String filesFileIdField = String.format("%s.%s", VariantToDBObjectConverter.FILES_FIELD, VariantSourceEntryToDBObjectConverter.FILEID_FIELD); mongoOperations.getCollection(collection).createIndex( new BasicDBObject(filesStudyIdField, 1).append(filesFileIdField, 1), new BasicDBObject(MongoDBHelper.BACKGROUND_INDEX, true)); mongoOperations.getCollection(collection).createIndex( new BasicDBObject(VARIANT_ANNOTATION_SO_FIELD, 1), new BasicDBObject(MongoDBHelper.BACKGROUND_INDEX, true)); }

Target:
private void createIndexes() { mongoOperations.getCollection(collection).createIndex( new BasicDBObject(VariantToDBObjectConverter.CHROMOSOME_FIELD, 1) .append(VariantToDBObjectConverter.START_FIELD, 1).append(VariantToDBObjectConverter.END_FIELD, 1), new BasicDBObject(MongoDBHelper.BACKGROUND_INDEX, true)); mongoOperations.getCollection(collection).createIndex( new BasicDBObject(VariantToDBObjectConverter.IDS_FIELD, 1), new BasicDBObject(MongoDBHelper.BACKGROUND_INDEX, true)); String filesStudyIdField = String.format("%s.%s", VariantToDBObjectConverter.FILES_FIELD, VariantSourceEntryToDBObjectConverter.STUDYID_FIELD); String filesFileIdField = String.format("%s.%s", VariantToDBObjectConverter.FILES_FIELD, VariantSourceEntryToDBObjectConverter.FILEID_FIELD); mongoOperations.getCollection(collection).createIndex( new BasicDBObject(filesStudyIdField, 1).append(filesFileIdField, 1), new BasicDBObject(MongoDBHelper.BACKGROUND_INDEX, true)); mongoOperations.getCollection(collection).createIndex( new BasicDBObject(ANNOTATION_FIELD+"."+XREFS_FIELD, 1), new BasicDBObject(MongoDBHelper.BACKGROUND_INDEX, true)); mongoOperations.getCollection(collection).createIndex( new BasicDBObject(ANNOTATION_FIELD+"."+ SO_ACCESSION_FIELD, 1), new BasicDBObject(MongoDBHelper.BACKGROUND_INDEX, true)); }
Source:
public R get() { if (_countDownLatch != null) { try { boolean finished = false; int iteration = 0; while (!finished) { iteration++; finished = _countDownLatch.await(2, TimeUnit.MINUTES); if (!finished) { logger.info("Awaited completion for " + (iteration * 2) + " minutes..."); } } } catch (InterruptedException e) { throw new IllegalStateException("Awaiting completion of AnalyzerResultFuture was interrupted!", e); } } if (_error != null) { throw _error; } return _result; }

Target:
public R get() { if (_countDownLatch != null) { try { boolean finished = false; int iteration = 0; final int minutesToWaitPerIteration = 2; while (!finished) { iteration++; finished = _countDownLatch.await(minutesToWaitPerIteration, TimeUnit.MINUTES); if (!finished) { logger.info("Awaited completion for " + (iteration * minutesToWaitPerIteration) + " minutes..."); } } } catch (InterruptedException e) { throw new IllegalStateException("Awaiting completion of AnalyzerResultFuture was interrupted!", e); } } if (_error != null) { throw _error; } return _result; }
Source:
public void execute(MinecraftServer server, ICommandSender sender, String... args) throws CommandException { if (args.length == 0) { sender.sendMessage(new TextComponentTranslation("commands.blooodmagic.ritual.create.noRitual")); return; } else if (args.length == 2 && (args[1].equals("-h") || args[1].equals("?"))) { sender.sendMessage(new TextComponentTranslation(BloodMagic.RITUAL_MANAGER.getRitual(args[0]).getUnlocalizedName() + ".info")); return; } EntityPlayerMP player = args.length < 3 ? getCommandSenderAsPlayer(sender) : getPlayer(server, sender, args[1]); boolean safe = false; if (args.length > 1 && args.length < 4) { int k = args.length - 1; if (args[k].equals("true") || args[k].equals("false")) { safe = Boolean.parseBoolean(args[k]); } else if (args[1].equals("safe")) safe = true; else player = getPlayer(server, sender, args[1]); } BlockPos pos = player.getPosition().down(); World world = player.getEntityWorld(); EnumFacing direction = EnumFacing.NORTH; if (RitualHelper.createRitual(world, pos, direction, BloodMagic.RITUAL_MANAGER.getRitual(args[0]), safe)) sender.sendMessage(new TextComponentTranslation("commands.bloodmagic.success")); else if (!safe) sender.sendMessage(new TextComponentTranslation("commands.bloodmagic.ritual.create.error.outOfWorldBoundaries")); else sender.sendMessage(new TextComponentTranslation("commands.bloodmagic.ritaul.create.error.unsafe")); }

Target:
public void execute(MinecraftServer server, ICommandSender sender, String... args) throws CommandException { if (args.length == 0) { sender.sendMessage(new TextComponentTranslation("commands.blooodmagic.ritual.create.noRitual")); return; } else if (args.length == 2 && (args[1].equals("help") || args[1].equals("?"))) { sender.sendMessage(new TextComponentTranslation(BloodMagic.RITUAL_MANAGER.getRitual(args[0]).getUnlocalizedName() + ".info")); return; } EntityPlayerMP player = args.length < 3 ? getCommandSenderAsPlayer(sender) : getPlayer(server, sender, args[1]); boolean safe = false; if (args.length > 1 && args.length < 4) { int k = args.length - 1; if (args[k].equals("true") || args[k].equals("false")) { safe = Boolean.parseBoolean(args[k]); } else if (args[1].equals("safe")) safe = true; else player = getPlayer(server, sender, args[1]); } BlockPos pos = player.getPosition().down(); World world = player.getEntityWorld(); EnumFacing direction = player.getHorizontalFacing(); if (RitualHelper.createRitual(world, pos, direction, BloodMagic.RITUAL_MANAGER.getRitual(args[0]), safe)) sender.sendMessage(new TextComponentTranslation("commands.bloodmagic.success")); else if (!safe) sender.sendMessage(new TextComponentTranslation("commands.bloodmagic.ritual.create.error.outOfWorldBoundaries")); else sender.sendMessage(new TextComponentTranslation("commands.bloodmagic.ritaul.create.error.unsafe")); }
Source:
public BasicQueryInfo(QueryInfo queryInfo) { this(queryInfo.getQueryId(), queryInfo.getSession(), queryInfo.getState(), queryInfo.getMemoryPool(), queryInfo.isScheduled(), queryInfo.getSelf(), queryInfo.getQueryAbridged(), new BasicQueryStats(queryInfo.getQueryStats()), queryInfo.getErrorType(), queryInfo.getErrorCode()); }

Target:
public BasicQueryInfo(QueryInfo queryInfo) { this(queryInfo.getQueryId(), queryInfo.getSession(), queryInfo.getState(), queryInfo.getMemoryPool(), queryInfo.isScheduled(), queryInfo.getSelf(), queryInfo.getQuery(), new BasicQueryStats(queryInfo.getQueryStats()), queryInfo.getErrorType(), queryInfo.getErrorCode()); }
Source:
public void serialize(T value, JsonGenerator generator, SerializerProvider provider) throws IOException { if (value == null) { provider.defaultSerializeNull(generator); return; } try { Class<?> type = value.getClass(); JsonSerializer<T> serializer = serializerCache.get(type, () -> createSerializer(provider, type)); serializer.serializeWithType(value, generator, provider, typeSerializer); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause != null) { throwIfInstanceOf(cause, IOException.class); } throw Throwables.propagate(cause); } }

Target:
public void serialize(T value, JsonGenerator generator, SerializerProvider provider) throws IOException { if (value == null) { provider.defaultSerializeNull(generator); return; } try { Class<?> type = value.getClass(); JsonSerializer<T> serializer = serializerCache.get(type, () -> createSerializer(provider, type)); serializer.serializeWithType(value, generator, provider, typeSerializer); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause != null) { throwIfInstanceOf(cause, IOException.class); } throw new RuntimeException(e); } }
Source:
private Map<String, String> getMessageMap(final String prefix, final Locale locale) { List<BrandingTheme> messageThemes = getBrandingThemes(); Map<String, String> keyValues = new HashMap<String, String>(); for (BrandingTheme theme : messageThemes) { ResourceBundle messagesBundle = theme.getMessagesBundle(locale); for (String key : messagesBundle.keySet()) { if (key.startsWith(BRAND_PREFIX + "." + prefix) || key.startsWith(COMMON_PREFIX)) { keyValues.put(key.replaceFirst(BRAND_PREFIX + "\\." + prefix + "\\.", "") .replaceFirst(COMMON_PREFIX + "\\.", ""), messagesBundle.getString(key)); } } } return keyValues; }

Target:
private Map<String, String> getMessageMap(final String prefix, final Locale locale) { List<BrandingTheme> messageThemes = getBrandingThemes(); Map<String, String> keyValues = new HashMap<String, String>(); if (messageThemes != null) { for (BrandingTheme theme : messageThemes) { ResourceBundle messagesBundle = theme.getMessagesBundle(locale); for (String key : messagesBundle.keySet()) { if (key.startsWith(BRAND_PREFIX + "." + prefix) || key.startsWith(COMMON_PREFIX)) { keyValues.put(key.replaceFirst(BRAND_PREFIX + "\\." + prefix + "\\.", "") .replaceFirst(COMMON_PREFIX + "\\.", ""), messagesBundle.getString(key)); } } } } return keyValues; }
Source:
ReflectionClass(Class<?> clazz) { this.clazz = clazz; if (clazz.isEnum()) { enumConstants = new LinkedHashMap<>(); for (Field f : clazz.getDeclaredFields()) { if (f.isEnumConstant()) { Enum<?> e; try { f.setAccessible(true); e = (Enum<?>) f.get(clazz); } catch (IllegalArgumentException | IllegalAccessException ex) { throw new IllegalStateException("Failed to access enum constant field", ex); } enumConstants.put(f, new ReflectionEnumConstant(this, e, f)); } } } else { enumConstants = null; } }

Target:
ReflectionClass(Class<?> clazz) { this.clazz = clazz; if (clazz.isEnum()) { enumConstants = new LinkedHashMap<>(); for (Field f : clazz.getDeclaredFields()) { if (f.isEnumConstant()) { Enum<?> e; try { f.setAccessible(true); e = (Enum<?>) f.get(clazz); } catch (IllegalAccessException iae) { throw new IllegalStateException("Failed to access enum constant field", iae); } enumConstants.put(f, new ReflectionEnumConstant(this, e, f)); } } } else { enumConstants = null; } }
Source:
public void createTableWithTableNameLengthLimit() throws AccumuloException, AccumuloSecurityException, TableExistsException { StringBuilder tableNameBuilder = new StringBuilder(); for (int i = 0; i < 1026; i++) { tableNameBuilder.append('a'); } String tableName = tableNameBuilder.toString(); accumuloClient.tableOperations().create(tableName); assertTrue(!accumuloClient.tableOperations().exists(tableName)); }

Target:
public void createTableWithTableNameLengthLimit() throws AccumuloException, AccumuloSecurityException, TableExistsException { StringBuilder tableNameBuilder = new StringBuilder(); for (int i = 0; i <= MAX_TABLE_NAME_LEN; i++) { tableNameBuilder.append('a'); } String tableName = tableNameBuilder.toString(); assertThrows(IllegalArgumentException.class, () -> accumuloClient.tableOperations().create(tableName)); assertFalse(accumuloClient.tableOperations().exists(tableName)); }
Source:
public TimestampRange handOut(long numberToHandOut) { checkValidTimestampRangeRequest(numberToHandOut); synchronized (this) { long targetTimestamp = lastHandedOut() + numberToHandOut; DebugLogger.logger.trace("Handing out timestamps, taking us to {}.", numberToHandOut, targetTimestamp); return handOutTimestamp(targetTimestamp); } }

Target:
public TimestampRange handOut(long numberToHandOut) { checkValidTimestampRangeRequest(numberToHandOut); long targetTimestamp; TimestampRange timestampRange; synchronized (this) { targetTimestamp = lastHandedOut() + numberToHandOut; timestampRange = handOutTimestamp(targetTimestamp); } DebugLogger.logger.trace("Handing out timestamps, taking us to {}.", numberToHandOut, targetTimestamp); return timestampRange; }
Source:
public boolean validate(String path) { boolean valid = false; if (fTrace != null) { valid = standardValidate(path); } else if (TmfTraceType.isCustomTraceId(getCanonicalName())) { valid = customValidate(path); } return valid; }

Target:
public boolean validate(String path) { boolean valid = false; if (fTrace != null) { valid = standardValidate(path); } return valid; }
Source:
public void addingTheSameTopicRepeatedlyDoesntLock() throws InterruptedException { this.controller.start(); String topic1 = "topic1"; for(int i = 0; i < 10; i++){ this.controller.addTopic(topic1); } assertTrue(true); }

Target:
public void addingTheSameTopicRepeatedlyDoesntLock() throws InterruptedException { ExecutorService executor = Executors.newSingleThreadExecutor(); this.controller.start(); String topic1 = "topic1"; AtomicInteger timesAdded = new AtomicInteger(0); int timesToAdd = 10; for (int i = 0; i < timesToAdd; i++) { executor.execute(() -> { try { this.controller.addTopic(topic1); timesAdded.incrementAndGet(); } catch (InterruptedException ignored) { } }); } executor.shutdown(); executor.awaitTermination(500, TimeUnit.MILLISECONDS); assertEquals(timesToAdd, timesAdded.get()); }
Source:
public void testHandleSchemesForOneScheme() { RegistrationWindows registrationWindows = new RegistrationWindows(registryWriter); SchemeInformation schemeInformation = new SchemeInformation("schemeToTest", "ThisSchemeisJustForTesting", System.getProperty("eclipse.launcher")); registrationWindows.handleSchemes(Arrays.asList(schemeInformation), Arrays.asList(schemeInformation)); assertEquals(null, registryWriter.getRegisteredHandlerPath("schemeToTest")); }

Target:
public void testHandleSchemesForOneScheme() { SchemeInformation schemeInformation = new SchemeInformation("schemeToTest", "ThisSchemeisJustForTesting", System.getProperty("eclipse.launcher")); registrationWindows.handleSchemes(Arrays.asList(schemeInformation), Arrays.asList(schemeInformation)); assertEquals(null, registryWriter.getRegisteredHandlerPath("schemeToTest")); }
Source:
public boolean hasChildren(Object element) { Predicate<Object> predicate = Stream.of(fViewer.getFilters()) .map(filter -> predicateFor(filter, element)) .reduce(t -> true, Predicate::and); return Stream.of(getChildren(element)) .filter(predicate) .findAny() .isPresent(); }

Target:
public boolean hasChildren(Object element) { return getChildren(element).length > 0; }
Source:
private Map<String, Object> toQueryMap (Object value) { if (value instanceof Map) { return (Map<String, Object>)value; } try { return ObjectParamMetadata.getMetadata(value.getClass()).toQueryMap(value); } catch (IllegalAccessException e) { throw new IllegalStateException(e); } }

Target:
private Map<String, Object> toQueryMap (Object value) { if (value instanceof Map) { return (Map<String, Object>)value; } try { return queryMapEncoder.encode(value); } catch (EncodeException e) { throw new IllegalStateException(e); } }
Source:
protected void buildEntryList(@NonNull ITmfTrace trace, @NonNull ITmfTrace parentTrace, @NonNull IProgressMonitor monitor) { if (monitor.isCanceled()) { return; } long start = trace.getStartTime().toNanos(); long end = start; TraceEntry traceEntry = new TraceEntry(trace); addToEntryList(parentTrace, Collections.singletonList(traceEntry)); Iterable<@NonNull ITmfAnalysisModuleWithStateSystems> modules = Iterables. filter(trace.getAnalysisModules(), ITmfAnalysisModuleWithStateSystems.class); modules.forEach(m -> waitForInitialization(trace, m)); boolean complete = false; while (!complete) { if (monitor.isCanceled()) { return; } complete = true; for (ITmfAnalysisModuleWithStateSystems module : modules) { if (monitor.isCanceled()) { return; } ModuleEntry moduleEntry = getOrCreateModuleEntry(traceEntry, module); for (ITmfStateSystem ss : module.getStateSystems()) { complete &= ss.waitUntilBuilt(0); end = Long.max(end, ss.getCurrentEndTime()); getOrCreateStateSystemEntry(moduleEntry, ss); } } traceEntry.updateEndTime(end); long resolution = Long.max(1, (end - start) / getDisplayWidth()); zoomEntries(Utils.flatten(traceEntry), start, end, resolution, monitor); if (parentTrace == getTrace()) { synchronized (this) { setStartTime(Long.min(getStartTime(), start)); setEndTime(Long.max(getEndTime(), end)); } refresh(); } if (!complete) { try { Thread.sleep(ITERATION_WAIT); } catch (InterruptedException e) { Activator.getDefault().logError("Failed to wait", e); } } } }

Target:
protected void buildEntryList(@NonNull ITmfTrace trace, @NonNull ITmfTrace parentTrace, @NonNull IProgressMonitor monitor) { if (monitor.isCanceled()) { return; } long start = trace.getStartTime().toNanos(); long end = start; TraceEntry traceEntry = new TraceEntry(trace); addToEntryList(parentTrace, Collections.singletonList(traceEntry)); Iterable<@NonNull ITmfAnalysisModuleWithStateSystems> modules = Iterables. filter(trace.getAnalysisModules(), ITmfAnalysisModuleWithStateSystems.class); modules.forEach(m -> waitForInitialization(trace, m)); boolean complete = false; while (!complete && !monitor.isCanceled()) { complete = true; for (ITmfAnalysisModuleWithStateSystems module : modules) { if (monitor.isCanceled()) { return; } ModuleEntry moduleEntry = getOrCreateModuleEntry(traceEntry, module); for (ITmfStateSystem ss : module.getStateSystems()) { complete &= ss.waitUntilBuilt(0); end = Long.max(end, ss.getCurrentEndTime()); getOrCreateStateSystemEntry(moduleEntry, ss); } } traceEntry.updateEndTime(end); long resolution = Long.max(1, (end - start) / getDisplayWidth()); zoomEntries(Utils.flatten(traceEntry), start, end, resolution, monitor); if (monitor.isCanceled()) { return; } if (parentTrace == getTrace()) { synchronized (this) { setStartTime(Long.min(getStartTime(), start)); setEndTime(Long.max(getEndTime(), end)); } refresh(); } if (monitor.isCanceled()) { return; } if (!complete) { try { Thread.sleep(ITERATION_WAIT); } catch (InterruptedException e) { Activator.getDefault().logError("Failed to wait", e); } } } }
Source:
public <T> CompletionStage<T> invokeCommand(Address target, ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions) { checkTopologyId(command); CacheRpcCommand cacheRpc = toCacheRpcCommand(command); if (!statisticsEnabled) { return t.invokeCommand(target, cacheRpc, collector, rpcOptions.deliverOrder(), rpcOptions.timeout(), rpcOptions.timeUnit()); } long startTimeNanos = timeService.time(); CompletionStage<T> invocation; try { invocation = t.invokeCommand(target, cacheRpc, collector, rpcOptions.deliverOrder(), rpcOptions.timeout(), rpcOptions.timeUnit()); } catch (Exception e) { return errorReplicating(e); } return invocation.handle((response, throwable) -> updateStatistics(startTimeNanos, response, throwable)); }

Target:
public <T> CompletionStage<T> invokeCommand(Address target, ReplicableCommand command, ResponseCollector<T> collector, RpcOptions rpcOptions) { CacheRpcCommand cacheRpc = toCacheRpcCommand(command); if (!statisticsEnabled) { return t.invokeCommand(target, cacheRpc, collector, rpcOptions.deliverOrder(), rpcOptions.timeout(), rpcOptions.timeUnit()); } long startTimeNanos = timeService.time(); CompletionStage<T> invocation; try { invocation = t.invokeCommand(target, cacheRpc, collector, rpcOptions.deliverOrder(), rpcOptions.timeout(), rpcOptions.timeUnit()); } catch (Exception e) { return errorReplicating(e); } return invocation.handle((response, throwable) -> updateStatistics(startTimeNanos, response, throwable)); }
Source:
private void doUnmarshal() { try { if(this.response != null && this.response.trim().startsWith("{")){ unmarshal(); } } catch (Exception e) { e.printStackTrace(); if(this.exception == null){ this.exception = e; } } }

Target:
private void doUnmarshal() { if (this.exception != null || this.response == null || !this.response.trim().startsWith("{")) { return; } try { unmarshal(); } catch (Exception e) { e.printStackTrace(); if (this.exception == null) { this.exception = e; } } }
Source:
public static void setup() { int[] availablePorts = AvailablePortHelper.getRandomAvailableTCPPorts(4); server1Port = availablePorts[0]; server2Port = availablePorts[1]; client1Port = availablePorts[2]; client2Port = availablePorts[3]; int localServer1Port = server1Port; int localServer2Port = server2Port; int localClient1Port = client1Port; int localClient2Port = client2Port; locator = cluster.startLocatorVM(indexOfLocator); redisPropsForServer1 = new Properties(); redisPropsForServer1.setProperty("redis-bind-address", "localHost"); redisPropsForServer1.setProperty("redis-port", Integer.toString(server1Port)); redisPropsForServer1.setProperty("log-level", "warn"); redisPropsForServer2 = new Properties(); redisPropsForServer2.setProperty("redis-bind-address", "localHost"); redisPropsForServer2.setProperty("redis-port", Integer.toString(server2Port)); redisPropsForServer2.setProperty("log-level", "warn"); cluster.startServerVM(indexOfServer1, redisPropsForServer1, locator.getPort()); cluster.startServerVM(indexOfServer2, redisPropsForServer2, locator.getPort()); client1 = cluster.getVM(indexOfClient1); client2 = cluster.getVM(indexOfClient2); client1.invoke("start a spring app", () -> { System.setProperty("server.port", Integer.toString(localClient1Port)); System.setProperty("spring.redis.port", Integer.toString(localServer1Port)); SpringApplication.run( RedisSpringTestApplication.class, "" + localServer1Port, "" + localServer2Port); }); client2.invoke("start a spring app", () -> { System.setProperty("server.port", Integer.toString(localClient2Port)); System.setProperty("spring.redis.port", Integer.toString(localServer2Port)); springApplicationContext = SpringApplication.run( RedisSpringTestApplication.class, "" + localServer1Port, "" + localServer2Port); }); restTemplate = new RestTemplate(); jedis = new Jedis("localHost", server1Port, JEDIS_TIMEOUT); }

Target:
public static void setup() { int[] availablePorts = AvailablePortHelper.getRandomAvailableTCPPorts(4); ports.put(SERVER1, availablePorts[0]); ports.put(SERVER2, availablePorts[1]); ports.put(APP1, availablePorts[2]); ports.put(APP2, availablePorts[3]); cluster.startLocatorVM(LOCATOR); startRedisServer(SERVER1); startRedisServer(SERVER2); startSpringApp(APP1, SERVER1, SERVER2); startSpringApp(APP2, SERVER2, SERVER1); jedis = new Jedis("localhost", ports.get(SERVER1), JEDIS_TIMEOUT); }
Source:
protected String getActiveTaskStatusString(int verbosity) { StringBuilder rv = new StringBuilder("Scheduler"); if (runCount > 0) { rv.append(", iteration ").append(runCount + 1); } if (recentRun != null) { Duration start = Duration.sinceUtc(recentRun.getStartTimeUtc()); rv.append(", last run ").append(start).append(" ms ago"); } if (truth(getNextScheduled())) { Duration untilNext = Duration.millis(getNextScheduled().getDelay(TimeUnit.MILLISECONDS)); if (untilNext.isPositive()) rv.append(", next in ").append(untilNext); else rv.append(", next imminent"); } return rv.toString(); }

Target:
protected String getActiveTaskStatusString(int verbosity) { StringBuilder rv = new StringBuilder("Scheduler"); if (runCount > 0) { rv.append(", iteration ").append(runCount + 1); } if (recentRun != null) { Duration start = Duration.sinceUtc(recentRun.getStartTimeUtc()); rv.append(", last run ").append(start).append(" ago"); } if (truth(getNextScheduled())) { Duration untilNext = Duration.millis(getNextScheduled().getDelay(TimeUnit.MILLISECONDS)); if (untilNext.isPositive()) rv.append(", next in ").append(untilNext); else rv.append(", next imminent"); } return rv.toString(); }
Source:
private String[] getSQLTypeNames(Class[] classes, Connection cx) throws SQLException { int[] sqlTypes = new int[classes.length]; String[] sqlTypeNames = new String[sqlTypes.length]; for (int i = 0; i < classes.length; i++) { Class clazz = classes[i]; Integer sqlType = getMapping(clazz); if (sqlType == null) { LOGGER.warning("No sql type mapping for: " + clazz); sqlType = Types.OTHER; } sqlTypes[i] = sqlType; if (Geometry.class.isAssignableFrom(clazz)) { String sqlTypeName = dialect.getGeometryTypeName(sqlType); if (sqlTypeName != null) { sqlTypeNames[i] = sqlTypeName; } } String sqlTypeName = getSqlTypeToSqlTypeNameOverrides().get(sqlType); if (sqlTypeName != null) { sqlTypeNames[i] = sqlTypeName; } } boolean allTypesFound = !ArrayUtils.contains(sqlTypeNames, null); if(allTypesFound) return sqlTypeNames; DatabaseMetaData metaData = cx.getMetaData(); ResultSet types = metaData.getTypeInfo(); try { while (types.next()) { int sqlType = types.getInt("DATA_TYPE"); String sqlTypeName = types.getString("TYPE_NAME"); for (int i = 0; i < sqlTypes.length; i++) { if (sqlTypeNames[i] != null) { continue; } if (sqlType == sqlTypes[i]) { sqlTypeNames[i] = sqlTypeName; } } } } finally { closeSafe(types); } Map<Integer, String> overrides = getSqlTypeToSqlTypeNameOverrides(); for (int i = 0; i < sqlTypes.length; i++) { String override = overrides.get(sqlTypes[i]); if (override != null) sqlTypeNames[i] = override; } return sqlTypeNames; }

Target:
private String[] getSQLTypeNames(Class[] classes, Connection cx) throws SQLException { int[] sqlTypes = new int[classes.length]; String[] sqlTypeNames = new String[sqlTypes.length]; for (int i = 0; i < classes.length; i++) { Class clazz = classes[i]; Integer sqlType = getMapping(clazz); if (sqlType == null) { LOGGER.warning("No sql type mapping for: " + clazz); sqlType = Types.OTHER; } sqlTypes[i] = sqlType; if (Geometry.class.isAssignableFrom(clazz)) { String sqlTypeName = dialect.getGeometryTypeName(sqlType); if (sqlTypeName != null) { sqlTypeNames[i] = sqlTypeName; } } String sqlTypeDBName = getDBsqlTypesCache().get(sqlType); if (sqlTypeDBName != null) { sqlTypeNames[i] = sqlTypeDBName; } } boolean allTypesFound = !ArrayUtils.contains(sqlTypeNames, null); if (!allTypesFound) { LOGGER.log(Level.WARNING, "Fetching fields from Database"); DatabaseMetaData metaData = cx.getMetaData(); ResultSet types = metaData.getTypeInfo(); try { while (types.next()) { int sqlType = types.getInt("DATA_TYPE"); String sqlTypeName = types.getString("TYPE_NAME"); for (int i = 0; i < sqlTypes.length; i++) { if (sqlTypeNames[i] != null) { continue; } if (sqlType == sqlTypes[i]) { sqlTypeNames[i] = sqlTypeName; getDBsqlTypesCache().putIfAbsent(sqlType, sqlTypeName); } } } } finally { closeSafe(types); } } Map<Integer, String> overrides = getSqlTypeToSqlTypeNameOverrides(); for (int i = 0; i < sqlTypes.length; i++) { String override = overrides.get(sqlTypes[i]); if (override != null) sqlTypeNames[i] = override; } return sqlTypeNames; }
Source:
public void testRollbackSelf() throws Exception { TestTransaction tx1 = new TestTransaction(env); tx1.set("bob", BALANCE, "10"); tx1.set("joe", BALANCE, "20"); tx1.set("jill", BALANCE, "60"); tx1.done(); TestTransaction tx2 = new TestTransaction(env, "jill", BALANCE, 1); TestTransaction tx3 = new TestTransaction(env); tx3.set("bob", BALANCE, "15"); tx3.set("joe", BALANCE, "15"); tx3.done(); tx2.set("bob", BALANCE, "14"); tx2.set("jill", BALANCE, "55"); try { tx2.commit(); Assert.fail("Expected commit exception"); } catch (CommitException ce) { } boolean sawExpected = wasRolledBackPrimary(tx2.getStartTimestamp(), "jill"); Assert.assertTrue(sawExpected); TestTransaction tx4 = new TestTransaction(env); Assert.assertEquals("15", tx4.gets("bob", BALANCE)); Assert.assertEquals("15", tx4.gets("joe", BALANCE)); Assert.assertEquals("60", tx4.gets("jill", BALANCE)); tx4.close(); }

Target:
public void testRollbackSelf() throws Exception { TestTransaction tx1 = new TestTransaction(env); tx1.set("bob", BALANCE, "10"); tx1.set("joe", BALANCE, "20"); tx1.set("jill", BALANCE, "60"); tx1.done(); TestTransaction tx2 = new TestTransaction(env, "jill", BALANCE, 1); TestTransaction tx3 = new TestTransaction(env); TestUtil.increment(tx3, "bob", BALANCE, 5); TestUtil.increment(tx3, "joe", BALANCE, -5); tx3.done(); TestUtil.increment(tx2, "bob", BALANCE, 5); TestUtil.increment(tx2, "jill", BALANCE, -5); try { tx2.commit(); Assert.fail("Expected commit exception"); } catch (CommitException ce) { } boolean sawExpected = wasRolledBackPrimary(tx2.getStartTimestamp(), "jill"); Assert.assertTrue(sawExpected); TestTransaction tx4 = new TestTransaction(env); Assert.assertEquals("15", tx4.gets("bob", BALANCE)); Assert.assertEquals("15", tx4.gets("joe", BALANCE)); Assert.assertEquals("60", tx4.gets("jill", BALANCE)); tx4.close(); }
Source:
public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_KERNEL); ICommandResult result = executeCommand(command, monitor, false); List<IBaseEventInfo> events = new ArrayList<>(); if (isError(result) && result.getErrorOutput().size() > 0) { if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN)) { return events; } throw new ExecutionException(Messages.TraceControl_CommandError + toCommandString(command)); } Document document = getDocumentFromStrings(result.getOutput()); NodeList rawEvents = document.getElementsByTagName(MIStrings.EVENT); getBaseEventInfo(rawEvents, events); return events; }

Target:
public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_KERNEL); ICommandResult result = executeCommand(command, monitor, false); List<IBaseEventInfo> events = new ArrayList<>(); if (isError(result)) { if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN)) { return events; } throw new ExecutionException(Messages.TraceControl_CommandError + toCommandString(command)); } Document document = getDocumentFromStrings(result.getOutput()); NodeList rawEvents = document.getElementsByTagName(MIStrings.EVENT); getBaseEventInfo(rawEvents, events); return events; }
Source:
protected void loadSchemasIntoSchemasDatabase(CommandContext context) { if (schemasLoader == null) { initializeDefaultSchemasLoader(context); } AppConfig config = context.getAppConfig(); DatabaseClient client = config.newSchemasDatabaseClient(); try { File baseDir = config.getConfigDir().getBaseDir(); logger.info("Loading schemas database data from dir: " + baseDir); schemasLoader.loadSchemas(baseDir, new DefaultSchemasFinder(), client); } finally { client.release(); } }

Target:
protected void loadSchemasIntoSchemasDatabase(CommandContext context) { if (schemasLoader == null) { initializeDefaultSchemasLoader(context); } AppConfig config = context.getAppConfig(); DatabaseClient client = config.newSchemasDatabaseClient(); try { String schemasPath = config.getSchemasPath(); logger.info("Loading schemas database data from path: " + schemasPath); schemasLoader.loadSchemas(new File(schemasPath), new DefaultSchemasFinder(), client); } finally { client.release(); } }
Source:
public void setAcceptableValues(Collection<List<T>> newValues) { if (newValues == null) { newValues = Collections.emptyList(); } List<T> val = newValues.isEmpty() ? null : newValues.iterator().next(); super.setValue(val, false); super.setAcceptableValues(newValues); typedItemList.clear(); for (List<T> value : newValues) { addToItems(value); } }

Target:
public void setAcceptableValues(Collection<List<T>> newValues) { if (newValues == null) { newValues = Collections.emptyList(); } List<T> val = newValues.isEmpty() ? Collections.<T>emptyList() : newValues.iterator().next(); super.setValue(val, false); super.setAcceptableValues(newValues); typedItemList.clear(); for (List<T> value : newValues) { addToItems(value); } }
Source:
public void validate(JobParameters parameters) throws JobParametersInvalidException { ParametersValidatorUtil.checkDirectory(parameters.getString(JobParametersNames.OUTPUT_DIR_ANNOTATION), JobParametersNames.OUTPUT_DIR_ANNOTATION); }

Target:
public void validate(JobParameters parameters) throws JobParametersInvalidException { ParametersValidatorUtil.checkDirectoryExists(parameters.getString(JobParametersNames.OUTPUT_DIR_ANNOTATION), JobParametersNames.OUTPUT_DIR_ANNOTATION); ParametersValidatorUtil.checkFileIsWritable(parameters.getString(JobParametersNames.OUTPUT_DIR_ANNOTATION), JobParametersNames.OUTPUT_DIR_ANNOTATION); }
Source:
public static void register() { try { final DeploymentStructureChangeListener listener = new DeploymentStructureChangeListener(); final IWorkspace ws = ResourcesPlugin.getWorkspace(); ws.addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_BUILD); } catch(Exception e) { ClasspathCorePlugin.log("Unable to add jboss-deployment-structure.xml change listener", e); } }

Target:
public static void register() { try { listener = new DeploymentStructureChangeListener(); final IWorkspace ws = ResourcesPlugin.getWorkspace(); ws.addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.PRE_BUILD); } catch(Exception e) { ClasspathCorePlugin.log("Unable to add jboss-deployment-structure.xml change listener", e); } }
Source:
private static int getUsedFlagBufferCapacity(int cardinalityWithMissingValue) { return (cardinalityWithMissingValue + 7) / 8; }

Target:
private static int getUsedFlagBufferCapacity(int cardinalityWithMissingValue) { return (cardinalityWithMissingValue + Byte.SIZE - 1) / Byte.SIZE; }
Source:
private Assignment forgeMapping(SourceRHS sourceRHS, Type sourceType, Type targetType) { ForgedMethodHistory forgedMethodHistory = null; if ( method instanceof ForgedMethod ) { forgedMethodHistory = ( (ForgedMethod) method ).getHistory(); } String name = getName( sourceType, targetType ); forgedMethod = new ForgedMethod( name, sourceType, targetType, method.getMapperConfiguration(), method.getExecutable(), forgedMethodHistory ); Assignment assignment = new MethodReference( forgedMethod, null, ParameterBinding.fromParameters( forgedMethod.getParameters() ) ); assignment.setAssignment( sourceRHS ); return assignment; }

Target:
private Assignment forgeMapping(SourceRHS sourceRHS, Type sourceType, Type targetType) { ForgedMethodHistory forgedMethodHistory = null; if ( method instanceof ForgedMethod ) { forgedMethodHistory = ( (ForgedMethod) method ).getHistory(); } String name = getName( sourceType, targetType ); forgedMethod = new ForgedMethod( name, sourceType, targetType, method.getMapperConfiguration(), method.getExecutable(), method.getContextParameters(), forgedMethodHistory ); Assignment assignment = new MethodReference( forgedMethod, null, ParameterBinding.fromParameters( forgedMethod.getParameters() ) ); assignment.setAssignment( sourceRHS ); return assignment; }
Source:
public AcknowledgementType auditLog(LogEventRequestType request, AssertionType assertion) { securedRequest.setAuditMessage(request.getAuditMessage()); securedRequest.setDirection(request.getDirection()); securedRequest.setRemoteHCID(request.getRemoteHCID()); securedRequest.setEventType(request.getEventType()); securedRequest.setEventID(request.getEventID()); securedRequest.setEventOutcomeIndicator(request.getEventOutcomeIndicator()); securedRequest.setEventTimestamp(request.getEventTimestamp()); securedRequest.setUserId(request.getUserId()); securedRequest.setRelatesTo(request.getRelatesTo()); securedRequest.setRequestMessageId(request.getRequestMessageId()); return getAuditRepositoryOrchImpl().logAudit(securedRequest, assertion); }

Target:
public AcknowledgementType auditLog(LogEventRequestType request, AssertionType assertion) { return getAuditRepositoryOrchImpl().logAudit(createLogSecureEventRequestType(request), assertion); }
Source:
private static boolean setConsumerSchema(final List<PlanFragmentEncoding> fragments, final Map<Integer, Operator> allOperators) { boolean done = true; for (PlanFragmentEncoding fragment : fragments) { for (OperatorEncoding<?> encoding : fragment.operators) { if (encoding instanceof AbstractConsumerEncoding<?>) { Consumer consumer = (Consumer) allOperators.get(encoding.opId); if (consumer.getSchema() != null) { continue; } Operator producingOp = allOperators.get(((AbstractConsumerEncoding<?>) encoding).argOperatorId); if (producingOp instanceof IDBController) { consumer.setSchema(IDBController.EOI_REPORT_SCHEMA); } else if (producingOp instanceof EOSController) { consumer.setSchema(EOSController.EOS_REPORT_SCHEMA); } else { consumer.setSchema(producingOp.getSchema()); } if (consumer.getSchema() == null) { done = false; } } } } return done; }

Target:
private static boolean setConsumerSchema(final List<PlanFragmentEncoding> fragments, final Map<Integer, Operator> allOperators) { boolean changed = false; for (PlanFragmentEncoding fragment : fragments) { for (OperatorEncoding<?> encoding : fragment.operators) { if (encoding instanceof AbstractConsumerEncoding<?>) { Consumer consumer = (Consumer) allOperators.get(encoding.opId); if (consumer.getSchema() != null) { continue; } Operator producingOp = allOperators.get(((AbstractConsumerEncoding<?>) encoding).argOperatorId); if (producingOp instanceof IDBController) { consumer.setSchema(IDBController.EOI_REPORT_SCHEMA); } else if (producingOp instanceof EOSController) { consumer.setSchema(EOSController.EOS_REPORT_SCHEMA); } else { consumer.setSchema(producingOp.getSchema()); } if (consumer.getSchema() != null) { changed = true; } } } } return changed; }
Source:
public void abort() throws IOException { close(); Files.deleteIfExists(tmpFile); }

Target:
public void abort() throws IOException { closeAndDeleteTempFile(); }
Source:
private void fireChildChangedEvents(final String path, Set<IZkChildListener> childListeners, boolean pathExists) { try { for (final IZkChildListener listener : childListeners) { _eventThread.send(new ZkEvent("Children of " + path + " changed sent to " + listener) { @Override public void run() throws Exception { List<String> children = null; if (pathExists) { try { children = getChildren(path); if (children != null) { for (String child : children) { watchForData(path + "/" + child); } } } catch (ZkNoNodeException e) { LOG.warn("Get children under path: failed.", path, e); } } listener.handleChildChange(path, children); } }); } } catch (Exception e) { LOG.error("Failed to fire child changed event. Unable to getChildren.", e); } }

Target:
private void fireChildChangedEvents(final String path, Set<IZkChildListener> childListeners, boolean pathExists) { try { final ZkPathStatRecord pathStatRecord = new ZkPathStatRecord(path); for (final IZkChildListener listener : childListeners) { _eventThread.send(new ZkEvent("Children of " + path + " changed sent to " + listener) { @Override public void run() throws Exception { if (!pathStatRecord.pathChecked()) { pathStatRecord.recordPathStat(getStat(path, hasListeners(path) && pathExists), OptionalLong.empty()); } List<String> children = null; if (pathStatRecord.pathExists()) { try { children = getChildren(path); } catch (ZkNoNodeException e) { LOG.warn("Get children under path: failed.", path, e); } } listener.handleChildChange(path, children); } }); } } catch (Exception e) { LOG.error("Failed to fire child changed event. Unable to getChildren.", e); } }
Source:
public static MaybeAliasedStatement analyze(AnalyzedRelation relation) { if (relation instanceof AliasedAnalyzedRelation) { return new MaybeAliasedStatement((AliasedAnalyzedRelation) relation); } return new NoopAliasedStatement(relation); }

Target:
public static MaybeAliasedStatement analyze(AnalyzedRelation relation) { if (relation instanceof AliasedAnalyzedRelation) { AliasedAnalyzedRelation aliasedAnalyzedRelation = (AliasedAnalyzedRelation) relation; return new MaybeAliasedStatement( aliasedAnalyzedRelation.relation(), FieldReplacer.bind(f -> f.relation().equals(aliasedAnalyzedRelation) ? f.pointer() : f) ); } return new MaybeAliasedStatement(relation, s -> s); }
Source:
public SizeCachedByteBufferKeyValue(ByteBuffer buf, int offset, int length, long seqId, int keyLen) { super(buf, offset, length); rowLen = super.getRowLength(); this.keyLen = keyLen; setSequenceId(seqId); }

Target:
public SizeCachedByteBufferKeyValue(ByteBuffer buf, int offset, int length, long seqId, int keyLen) { super(buf, offset, length); this.rowLen = super.getRowLength(); this.keyLen = keyLen; setSequenceId(seqId); }