auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Configuration newMetastoreConf() { Configuration conf = new Configuration(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader == null) { classLoader = MetastoreConf.class.getClassLoader(); } hiveDefaultURL = classLoader.getResource("hive-default.xml"); hiveSiteURL = findConfigFile(classLoader, "hive-site.xml"); if (hiveSiteURL != null) conf.addResource(hiveSiteURL); hiveMetastoreSiteURL = findConfigFile(classLoader, "hivemetastore-site.xml"); if (hiveMetastoreSiteURL != null) conf.addResource(hiveMetastoreSiteURL); metastoreSiteURL = findConfigFile(classLoader, "metastore-site.xml"); if (metastoreSiteURL != null) conf.addResource(metastoreSiteURL); for (ConfVars var : ConfVars.values()) { if (System.getProperty(var.varname) != null) { LOG.debug("Setting conf value " + var.varname + " using value " + System.getProperty(var.varname)); conf.set(var.varname, System.getProperty(var.varname)); } else if (System.getProperty(var.hiveName) != null) { conf.set(var.hiveName, System.getProperty(var.hiveName)); } } if (getBoolVar(conf, ConfVars.SCHEMA_VERIFICATION)) { setBoolVar(conf, ConfVars.AUTO_CREATE_ALL, false); } if (getBoolVar(conf, ConfVars.DUMP_CONFIG_ON_CREATION) && LOG.isInfoEnabled()) { LOG.info(dumpConfig(conf)); } return conf; }

Target:
public static Configuration newMetastoreConf() { Configuration conf = new Configuration(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader == null) { classLoader = MetastoreConf.class.getClassLoader(); } hiveDefaultURL = classLoader.getResource("hive-default.xml"); hiveSiteURL = findConfigFile(classLoader, "hive-site.xml"); if (hiveSiteURL != null) conf.addResource(hiveSiteURL); hiveMetastoreSiteURL = findConfigFile(classLoader, "hivemetastore-site.xml"); if (hiveMetastoreSiteURL != null) conf.addResource(hiveMetastoreSiteURL); metastoreSiteURL = findConfigFile(classLoader, "metastore-site.xml"); if (metastoreSiteURL != null) conf.addResource(metastoreSiteURL); for (ConfVars var : ConfVars.values()) { if (System.getProperty(var.varname) != null) { LOG.debug("Setting conf value " + var.varname + " using value " + System.getProperty(var.varname)); conf.set(var.varname, System.getProperty(var.varname)); } else if (System.getProperty(var.hiveName) != null) { conf.set(var.hiveName, System.getProperty(var.hiveName)); } } if (getBoolVar(conf, ConfVars.SCHEMA_VERIFICATION)) { setBoolVar(conf, ConfVars.AUTO_CREATE_ALL, false); } if (!beenDumped.getAndSet(true) && getBoolVar(conf, ConfVars.DUMP_CONFIG_ON_CREATION) && LOG.isInfoEnabled()) { LOG.info(dumpConfig(conf)); } return conf; }
Source:
public final Object clone() { try { FieldData clone = (FieldData) super.clone(); if (unknownFieldData != null) { clone.unknownFieldData = new ArrayList<UnknownFieldData>(unknownFieldData); } if (value instanceof ExtendableMessageNano) { clone.value = ((ExtendableMessageNano) value).clone(); } else if (value instanceof byte[]) { clone.value = ((byte[]) value).clone(); } else if (value instanceof byte[][]) { clone.value = ((byte[][]) value).clone(); } else if (value instanceof boolean[]) { clone.value = ((boolean[]) value).clone(); } else if (value instanceof int[]) { clone.value = ((int[]) value).clone(); } else if (value instanceof long[]) { clone.value = ((long[]) value).clone(); } else if (value instanceof float[]) { clone.value = ((float[]) value).clone(); } else if (value instanceof double[]) { clone.value = ((double[]) value).clone(); } else if (value instanceof short[]) { clone.value = ((short[]) value).clone(); } else if (value instanceof char[]) { clone.value = ((char[]) value).clone(); } else if (value instanceof ExtendableMessageNano[]) { ExtendableMessageNano[] valueArray = (ExtendableMessageNano[]) value; ExtendableMessageNano[] cloneArray = (ExtendableMessageNano[]) clone.value; for (int i = 0; i < valueArray.length; i++) { cloneArray[i] = (ExtendableMessageNano) valueArray[i].clone(); } } return clone; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } }

Target:
public final FieldData clone() { FieldData clone = new FieldData(); try { clone.cachedExtension = cachedExtension; if (unknownFieldData == null) { clone.unknownFieldData = null; } else { clone.unknownFieldData.addAll(unknownFieldData); } if (value instanceof MessageNano) { clone.value = ((MessageNano) value).clone(); } else if (value instanceof byte[]) { clone.value = ((byte[]) value).clone(); } else if (value instanceof byte[][]) { clone.value = ((byte[][]) value).clone(); } else if (value instanceof boolean[]) { clone.value = ((boolean[]) value).clone(); } else if (value instanceof int[]) { clone.value = ((int[]) value).clone(); } else if (value instanceof long[]) { clone.value = ((long[]) value).clone(); } else if (value instanceof float[]) { clone.value = ((float[]) value).clone(); } else if (value instanceof double[]) { clone.value = ((double[]) value).clone(); } else if (value instanceof MessageNano[]) { MessageNano[] valueArray = (MessageNano[]) value; MessageNano[] cloneArray = new MessageNano[valueArray.length]; clone.value = cloneArray; for (int i = 0; i < valueArray.length; i++) { cloneArray[i] = valueArray[i].clone(); } } return clone; } catch (CloneNotSupportedException e) { throw new AssertionError(e); } }
Source:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { ModelNode names = operation.require(CacheContainerResource.PROTO_NAMES.getName()); ModelNode contents = operation.require(CacheContainerResource.PROTO_CONTENTS.getName()); final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); final String cacheContainerName = address.getElement(address.size() - 1).getValue(); final ServiceController<?> controller = context.getServiceRegistry(false).getService( EmbeddedCacheManagerService.getServiceName(cacheContainerName)); EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) controller.getValue(); ProtobufMetadataManager protoManager = cacheManager.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class); if (protoManager != null) { try { List<ModelNode> descriptorsNames = names.asList(); List<ModelNode> descriptorsContents = contents.asList(); String[] nameArray = new String[descriptorsNames.size()]; String[] contentArray = new String[descriptorsNames.size()]; int i = 0; for(ModelNode modelNode : descriptorsNames) { nameArray[i] = modelNode.asString(); contentArray[i] = descriptorsContents.get(i).asString(); i++; } protoManager.registerProtofiles(nameArray,contentArray); } catch (Exception e) { throw new OperationFailedException(new ModelNode().set(MESSAGES.failedToInvokeOperation(e.getLocalizedMessage()))); } } context.stepCompleted(); }

Target:
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); final String cacheContainerName = address.getElement(address.size() - 1).getValue(); final ServiceController<?> controller = context.getServiceRegistry(false).getService( EmbeddedCacheManagerService.getServiceName(cacheContainerName)); EmbeddedCacheManager cacheManager = (EmbeddedCacheManager) controller.getValue(); ProtobufMetadataManager protoManager = cacheManager.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class); if (protoManager != null) { try { String nameParameter = CacheContainerResource.PROTO_NAMES.getName(); String contentParameter = CacheContainerResource.PROTO_CONTENTS.getName(); ModelNode names = operation.require(nameParameter); ModelNode contents = operation.require(contentParameter); validateParameters(names, contents); List<ModelNode> descriptorsNames = names.asList(); List<ModelNode> descriptorsContents = contents.asList(); String[] nameArray = new String[descriptorsNames.size()]; String[] contentArray = new String[descriptorsNames.size()]; int i = 0; for (ModelNode modelNode : descriptorsNames) { nameArray[i] = modelNode.asString(); contentArray[i] = descriptorsContents.get(i).asString(); i++; } protoManager.registerProtofiles(nameArray, contentArray); } catch (Exception e) { throw new OperationFailedException(new ModelNode().set(MESSAGES.failedToInvokeOperation(e.getLocalizedMessage()))); } } context.stepCompleted(); }
Source:
public static void checkMapConfig(MapConfig mapConfig, NativeMemoryConfig nativeMemoryConfig, SplitBrainMergePolicyProvider mergePolicyProvider, HazelcastProperties properties) { if (getBuildInfo().isEnterprise()) { checkMapNativeConfig(mapConfig, nativeMemoryConfig); checkHotRestartSpecificConfig(mapConfig, properties); } checkMapEvictionConfig(mapConfig.getEvictionConfig()); checkMapMaxSizePolicyPerInMemoryFormat(mapConfig); if (mergePolicyProvider != null) { checkMapMergePolicy(mapConfig, mergePolicyProvider); } }

Target:
public static void checkMapConfig(MapConfig mapConfig, NativeMemoryConfig nativeMemoryConfig, SplitBrainMergePolicyProvider mergePolicyProvider, HazelcastProperties properties) { checkNotNativeWhenOpenSource(mapConfig.getInMemoryFormat()); if (getBuildInfo().isEnterprise()) { checkMapNativeConfig(mapConfig, nativeMemoryConfig); checkHotRestartSpecificConfig(mapConfig, properties); } checkMapEvictionConfig(mapConfig.getEvictionConfig()); checkMapMaxSizePolicyPerInMemoryFormat(mapConfig); if (mergePolicyProvider != null) { checkMapMergePolicy(mapConfig, mergePolicyProvider); } for (QueryCacheConfig queryCacheConfig : mapConfig.getQueryCacheConfigs()) { checkCacheEvictionConfig(queryCacheConfig.getEvictionConfig()); } }
Source:
public Container(Project project, String message) { this.project = project; this.bsn = "<unknown>"; this.version = "<unknown>"; this.warning = message; this.type = TYPE.ERROR; this.path = "unknown"; }

Target:
private Container(Project project, String message) { this.project = project; this.bsn = "<unknown>"; this.version = "<unknown>"; this.warning = message; this.type = TYPE.ERROR; this.path = "unknown"; }
Source:
public boolean checkNetwork() { AsyncFileEntry rootParent = parent; while (rootParent != null && rootParent.getParent().isPresent()) { rootParent = rootParent.getParent().get(); } if (rootParent == null) { return snapExist(); } return rootParent.getFile().exists(); }

Target:
public boolean checkNetwork() { AsyncFileEntry rootParent = parent; if (rootParent == null) { return snapExist(); } while (rootParent.getParent().isPresent()) { rootParent = rootParent.getParent().get(); } return rootParent.getFile().exists(); }
Source:
private static Iterable<ImmutableBitmap> makePredicateQualifyingBitmapIterable( final BitmapIndex bitmapIndex, final Predicate<String> predicate, final Indexed<String> dimValues ) { return new Iterable<ImmutableBitmap>() { @Override public Iterator<ImmutableBitmap> iterator() { return new Iterator<ImmutableBitmap>() { final Iterator<Integer> indexIterator = makePredicateQualifyingIndexIterable( bitmapIndex, predicate, dimValues ).iterator(); @Override public void remove() { throw new UnsupportedOperationException(); } @Override public boolean hasNext() { return indexIterator.hasNext(); } @Override public ImmutableBitmap next() { return bitmapIndex.getBitmap(indexIterator.next()); } }; } }; }

Target:
private static Iterable<ImmutableBitmap> makePredicateQualifyingBitmapIterable( final BitmapIndex bitmapIndex, final Predicate<String> predicate, final Indexed<String> dimValues ) { return bitmapsFromIndexes(makePredicateQualifyingIndexIterable(bitmapIndex, predicate, dimValues), bitmapIndex); }
Source:
public void update(ViewerCell cell) { Object element = cell.getElement(); int columnNumber = cell.getColumnIndex(); if (columnNumber == 0) { cell.setImage(getColumnImage(element, cell.getColumnIndex())); cell.setText(getColumnText(element, cell.getColumnIndex())); } else { if (columnNumber == 3) { cell.setText(getColumnText(element, cell.getColumnIndex())); } else { cell.setImage(getColumnImage(element, cell.getColumnIndex())); } } }

Target:
public void update(ViewerCell cell) { Object element = cell.getElement(); int columnNumber = cell.getColumnIndex(); if (columnNumber == 0) { cell.setImage(getColumnImage(element, columnNumber)); cell.setText(getColumnText(element, columnNumber)); } else { if (columnNumber == 3) { cell.setText(getColumnText(element, columnNumber)); } else { cell.setImage(getColumnImage(element, columnNumber)); } } }
Source:
public Multipart(String requestURL, String charset) throws IOException { this.charset = charset; boundary = createBoundary(); URL url = new URL(requestURL); httpConn = (HttpURLConnection) url.openConnection(); httpConn.setUseCaches(false); httpConn.setDoOutput(true); httpConn.setDoInput(true); httpConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); httpConn.setRequestProperty("User-Agent", "Java IPFS CLient"); out = httpConn.getOutputStream(); writer = new PrintWriter(new OutputStreamWriter(out, charset), true); }

Target:
public Multipart(String requestURL, String charset) throws IOException { this.charset = charset; boundary = createBoundary(); URL url = new URL(requestURL); httpConn = (HttpURLConnection) url.openConnection(); httpConn.setUseCaches(false); httpConn.setDoOutput(true); httpConn.setDoInput(true); httpConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); httpConn.setRequestProperty("User-Agent", "Java IPFS Client"); out = httpConn.getOutputStream(); writer = new PrintWriter(new OutputStreamWriter(out, charset), true); }
Source:
public ExpressionTree EXPRESSION() { return b.<ExpressionTree>nonterminal(PHPLexicalGrammar.EXPRESSION) .is(f.expression(b.token(PHPGrammar.IDENTIFIER))); }

Target:
public ExpressionTree EXPRESSION() { return b.<ExpressionTree>nonterminal(PHPLexicalGrammar.EXPRESSION) .is(f.expression(b.token(PHPLexicalGrammar.VARIABLE_IDENTIFIER))); }
Source:
public int compareTo(SamzaResourceRequest o) { if (!isInFuture() && o.isInFuture()) { return -1; } if (isInFuture() && !o.isInFuture()) { return 1; } if (!StandbyTaskUtil.isStandbyContainer(processorId) && StandbyTaskUtil.isStandbyContainer(o.processorId)) { return -1; } if (StandbyTaskUtil.isStandbyContainer(processorId) && !StandbyTaskUtil.isStandbyContainer(o.processorId)) { return 1; } if (requestTimestampMs < o.requestTimestampMs) return -1; if (requestTimestampMs > o.requestTimestampMs) return 1; return 0; }

Target:
public int compareTo(SamzaResourceRequest o) { if (!StandbyTaskUtil.isStandbyContainer(processorId) && StandbyTaskUtil.isStandbyContainer(o.processorId)) { return -1; } if (StandbyTaskUtil.isStandbyContainer(processorId) && !StandbyTaskUtil.isStandbyContainer(o.processorId)) { return 1; } if (requestTimestamp.isBefore(o.requestTimestamp)) { return -1; } if (requestTimestamp.isAfter(o.requestTimestamp)) { return 1; } return 0; }
Source:
public boolean doesThemeNeedRestart(Theme theme) { try (Stream<Path> stream = Files.list(getThemeDirectory(theme))) { return stream.anyMatch(path -> Files.isRegularFile(path) && !path.endsWith(".css")); } }

Target:
public boolean doesThemeNeedRestart(Theme theme) { try (Stream<Path> stream = Files.list(getThemeDirectory(theme))) { return stream.anyMatch(path -> Files.isRegularFile(path) && !path.endsWith(".css") && !path.endsWith(".properties")); } }
Source:
public void update(Observable o, Object arg) { numTimesUpdated++; lastUpdateEdgeType = (Latch.EdgeType) arg; }

Target:
public void update(Observable o, Object arg) { assertTrue("Latch is the only class that should be observed", o instanceof Latch); assertTrue("Latch must provide an argument of type EdgeType", arg instanceof Latch.EdgeType); numTimesUpdated++; lastUpdateEdgeType = (Latch.EdgeType) arg; }
Source:
public Result<EventTypeSchema> getSchemaVersion(final String name, final String version) { final Matcher versionMatcher = VERSION_PATTERN.matcher(version); if (!versionMatcher.matches()) { return Result.problem(Problem.valueOf(Response.Status.BAD_REQUEST, "Invalid version number")); } try { final EventTypeSchema schema = schemaRepository.getSchemaVersion(name, version); return Result.ok(schema); } catch (final NoSuchSchemaException e) { LOG.debug("Could not find EventTypeSchema version: for EventType: {}", version, name); return Result.problem(Problem.valueOf(Response.Status.NOT_FOUND, "Could not find schema version " + version + " for event type " + name)); } }

Target:
public Result<EventTypeSchema> getSchemaVersion(final String name, final String version) { final Matcher versionMatcher = VERSION_PATTERN.matcher(version); if (!versionMatcher.matches()) { return Result.problem(Problem.valueOf(Response.Status.BAD_REQUEST, "Invalid version number")); } try { final EventTypeSchema schema = schemaRepository.getSchemaVersion(name, version); return Result.ok(schema); } catch (final NoSuchSchemaException e) { LOG.debug("Could not find EventTypeSchema version: for EventType: {}", version, name); return Result.problem(e.asProblem()); } }
Source:
public void theGetAssociationLnObjectsRequestIsReceivedAsPartOfABundledRequest() throws Throwable { this.setDeviceAndOrganisationProperties(); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, "526 Retrieve association objectlist bundle", TEST_SUITE_XML); }

Target:
public void theGetAssociationLnObjectsRequestIsReceivedAsPartOfABundledRequest() throws Throwable { this.setDeviceAndOrganisationProperties(); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML_526, TEST_SUITE_XML); }
Source:
void initializeInstantiationMetric(final boolean instantiated) { helixClusterManagerInstantiationFailed = new Gauge<Boolean>() { @Override public Boolean getValue() { return !instantiated; } }; registry.register(MetricRegistry.name(HelixClusterManager.class, "helixClusterManagerInstantiationFailed"), helixClusterManagerInstantiationFailed); }

Target:
void initializeInstantiationMetric(final boolean instantiated) { helixClusterManagerInstantiationFailed = new Gauge<Boolean>() { @Override public Boolean getValue() { return !instantiated; } }; registry.register(MetricRegistry.name(HelixClusterManager.class, "instantiationFailed"), helixClusterManagerInstantiationFailed); }
Source:
public Optional<List<String>> getPartitionNamesByParts(String databaseName, String tableName, List<String> parts) { try { List<PartitionInfo> partitionInfos = ProtoUtils.toPartitionInfoList( client.readTable(databaseName, tableName, Constraint.getDefaultInstance())); partitionInfos = partitionInfos.stream().filter(p -> p.getTableName().equals(tableName)) .filter(partition -> { List<String> values = partition.getValuesList(); if (values.size() != parts.size()) { return false; } for (int i = 0; i < values.size(); i++) { String constraintPart = parts.get(i); if (!constraintPart.isEmpty() && !values.get(i).equals(constraintPart)) { return false; } } return true; }) .collect(Collectors.toList()); List<String> partitionNames = partitionInfos.stream().map(PartitionInfo::getPartitionName).collect(Collectors.toList()); return Optional.of(partitionNames); } catch (AlluxioStatusException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }

Target:
public Optional<List<String>> getPartitionNamesByParts(String databaseName, String tableName, List<String> parts) { try { List<PartitionInfo> partitionInfos = AlluxioProtoUtils.toPartitionInfoList(client.readTable(databaseName, tableName, Constraint.getDefaultInstance())); partitionInfos = partitionInfos.stream().filter(p -> p.getTableName().equals(tableName)) .filter(partition -> { List<String> values = partition.getValuesList(); if (values.size() != parts.size()) { return false; } for (int i = 0; i < values.size(); i++) { String constraintPart = parts.get(i); if (!constraintPart.isEmpty() && !values.get(i).equals(constraintPart)) { return false; } } return true; }) .collect(toImmutableList()); List<String> partitionNames = partitionInfos.stream().map(PartitionInfo::getPartitionName).collect(toImmutableList()); return Optional.of(partitionNames); } catch (AlluxioStatusException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }
Source:
public void clientFailed(HttpPageBufferClient client, Throwable cause) { requireNonNull(client, "client is null"); requireNonNull(cause, "cause is null"); if (cancelledClients.contains(client)) { return; } ExchangeClient.this.clientFailed(cause); }

Target:
public void clientFailed(HttpPageBufferClient client, Throwable cause) { requireNonNull(client, "client is null"); requireNonNull(cause, "cause is null"); ExchangeClient.this.clientFailed(client, cause); }
Source:
private void stopNodeRecycleThread() { if (nodeRecycleThread != null) { try { proxyLogger.fine("Shutting down NodeRecycleThread for " + getId()); nodeRecycleThread.shutdown(); nodeRecycleThread.join(2000); } catch (InterruptedException e) { } } }

Target:
private void stopNodeRecycleThread() { if (nodeRecycleThread.isAlive()) { try { nodeRecycleThread.shutdown(); nodeRecycleThread.join(2000); } catch (InterruptedException e) { } } }
Source:
public Iterable<Request> part(final CharSequence name) { final List<Request> values = this.map .get(name.toString().toLowerCase(Locale.ENGLISH)); final Iterable<Request> iter; if (values == null) { iter = new VerboseIterable<>( Collections.<Request>emptyList(), String.format( "there are no parts by name \"%s\" among %d others: %s", name, this.map.size(), this.map.keySet() ) ); } else { iter = new VerboseIterable<>( values, String.format( "there are just %d parts by name \"%s\"", values.size(), name ) ); } return iter; }

Target:
public Iterable<Request> part(final CharSequence name) { final List<Request> values = this.map .get(name.toString().toLowerCase(Locale.ENGLISH)); final Iterable<Request> iter; if (values == null) { iter = new VerboseIterable<>( Collections.<Request>emptyList(), new Sprintf( "there are no parts by name \"%s\" among %d others: %s", name, this.map.size(), this.map.keySet() ) ); } else { iter = new VerboseIterable<>( values, new Sprintf( "there are just %d parts by name \"%s\"", values.size(), name ) ); } return iter; }
Source:
private void deleteContent(String spaceId, String contentId, ContentStore store) { try { store.deleteContent(spaceId, contentId); log.info("Deleted content ({}/{})", spaceId, contentId); } catch (Exception ex) { final String message = MessageFormat.format( "Failed to delete content ({0}/{1}) due to {2}. As this is a non-critical failure, processing will " + "continue on.", spaceId, contentId, ex.getMessage()); log.error(message, ex); } }

Target:
private void deleteContent(String spaceId, String contentId, ContentStore store) { try { store.deleteContent(spaceId, contentId); log.debug("Deleted content ({}/{})", spaceId, contentId); } catch (Exception ex) { final String message = format("Failed to delete content ({0}/{1}) due to {2}." + " As this is a non-critical failure, processing will " + "continue on.", spaceId, contentId, ex.getMessage()); log.error(message, ex); } }
Source:
public static byte[] getResource(String path, String type, String name) { Kernel32 kernel32 = Kernel32.INSTANCE; final HMODULE target = kernel32.LoadLibraryEx(path, null, Kernel32.LOAD_LIBRARY_AS_DATAFILE); Pointer t = null; try { t = new Pointer(Long.parseLong(type)); } catch (Exception e) { t = new Memory(Native.WCHAR_SIZE * (type.length() + 1)); t.setWideString(0, type); } Pointer n = null; try { n = new Pointer(Long.parseLong(name)); } catch (Exception e) { n = new Memory(Native.WCHAR_SIZE * (name.length() + 1)); n.setWideString(0, name); } HRSRC hRsrc = kernel32.FindResource(target, n, t); if (hRsrc == null) { return null; } HANDLE loaded = kernel32.LoadResource(target, hRsrc); DWORD length = kernel32.SizeofResource(target, hRsrc); Pointer start = kernel32.LockResource(loaded); byte[] buf = start.getByteArray(0, length.intValue()); return buf; }

Target:
public static byte[] getResource(String path, String type, String name) { final HMODULE target = Kernel32.INSTANCE.LoadLibraryEx(path, null, Kernel32.LOAD_LIBRARY_AS_DATAFILE); Pointer t = null; try { t = new Pointer(Long.parseLong(type)); } catch (Exception e) { t = new Memory(Native.WCHAR_SIZE * (type.length() + 1)); t.setWideString(0, type); } Pointer n = null; try { n = new Pointer(Long.parseLong(name)); } catch (Exception e) { n = new Memory(Native.WCHAR_SIZE * (name.length() + 1)); n.setWideString(0, name); } HRSRC hRsrc = Kernel32.INSTANCE.FindResource(target, n, t); if (hRsrc == null) { return null; } HANDLE loaded = Kernel32.INSTANCE.LoadResource(target, hRsrc); int length = Kernel32.INSTANCE.SizeofResource(target, hRsrc); Pointer start = Kernel32.INSTANCE.LockResource(loaded); return start.getByteArray(0, length); }
Source:
private Optional<Pattern> joinWordsToPattern(EscapeMode escapeMode) { List<String> words = getSearchWords(); if ((words == null) || words.isEmpty() || words.get(0).isEmpty()) { return Optional.empty(); } StringJoiner joiner = new StringJoiner(")|(", "(", ")"); for (String word : words) { if (regularExpression) { joiner.add(word); } else { switch (escapeMode) { case JAVA: joiner.add(Pattern.quote(word)); break; case JAVASCRIPT: joiner.add(JAVASCRIPT_ESCAPED_CHARS_PATTERN.matcher(word).replaceAll("\\\\$0")); break; default: throw new IllegalArgumentException("Unknown special characters escape method: " + escapeMode); } } } String searchPattern = joiner.toString(); if (caseSensitive) { return Optional.of(Pattern.compile(searchPattern)); } else { return Optional.of(Pattern.compile(searchPattern, Pattern.CASE_INSENSITIVE)); } }

Target:
private Optional<Pattern> joinWordsToPattern(EscapeMode escapeMode) { List<String> words = getSearchWords(); if ((words == null) || words.isEmpty() || words.get(0).isEmpty()) { return Optional.empty(); } StringJoiner joiner = new StringJoiner(")|(", "(", ")"); for (String word : words) { if (regularExpression) { joiner.add(word); } else { switch (escapeMode) { case JAVA: joiner.add(Pattern.quote(word)); break; case JAVASCRIPT: joiner.add(JAVASCRIPT_ESCAPED_CHARS_PATTERN.matcher(word).replaceAll("\\\\$0")); break; default: throw new IllegalArgumentException("Unknown special characters escape mode: " + escapeMode); } } } String searchPattern = joiner.toString(); if (caseSensitive) { return Optional.of(Pattern.compile(searchPattern)); } else { return Optional.of(Pattern.compile(searchPattern, Pattern.CASE_INSENSITIVE)); } }
Source:
public void saveGame() { if (mGameEngine.isThreadRunnging() && mGameEngine.isThreadChangeNeeded()) { mGameEngine.post(new Message() { @Override public void execute() { saveGame(); } }); return; } saveGame("", false); }

Target:
public void saveGame() { if (mGameEngine.isThreadRunning() && mGameEngine.isThreadChangeNeeded()) { mGameEngine.post(new Message() { @Override public void execute() { saveGame(); } }); return; } saveGame("", false); }
Source:
public boolean ceationCommandClassExists(DiagnosticChain diagnostics, Map<Object, Object> context) { if (creationCommandClass != null) { Class<?> theClass = ClassLoaderHelper.loadClass(creationCommandClass); if (theClass == null) { if (diagnostics != null) { diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, ArchitectureValidator.DIAGNOSTIC_SOURCE, ArchitectureValidator.ARCHITECTURE_CONTEXT__CEATION_COMMAND_CLASS_EXISTS, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "ceationCommandClassExists " + creationCommandClass + " cannot be loaded", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } } return true; }

Target:
public boolean ceationCommandClassExists(DiagnosticChain diagnostics, Map<Object, Object> context) { if (creationCommandClass != null) { Class<?> theClass = ClassLoaderHelper.loadClass(creationCommandClass); if (theClass == null) { if (diagnostics != null) { diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, ArchitectureValidator.DIAGNOSTIC_SOURCE, ArchitectureValidator.ARCHITECTURE_CONTEXT__CEATION_COMMAND_CLASS_EXISTS, EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "creationCommandClassExists " + creationCommandClass + " cannot be loaded", EObjectValidator.getObjectLabel(this, context) }), new Object[] { this })); } return false; } } return true; }
Source:
public String getVoltDBRootPath(PathsType.Voltdbroot path) { if (isRunningWithOldVerbs()) { return path.getPath(); } try { return m_nodeSettings.getVoltDBRoot().getCanonicalPath(); } catch (IOException e) { throw new SettingsException("failed to canonicalize voltdbroot"); } }

Target:
public String getVoltDBRootPath(PathsType.Voltdbroot path) { if (isRunningWithOldVerbs()) { return path.getPath(); } return getVoltDBRootPath(); }
Source:
public TableScanNode tableScan(List<Symbol> symbols, Map<Symbol, ColumnHandle> assignments) { TableHandle tableHandle = new TableHandle(new ConnectorId("testConnector"), new TestingMetadata.TestingTableHandle()); return tableScan(tableHandle, symbols, assignments); }

Target:
public TableScanNode tableScan(List<Symbol> symbols, Map<Symbol, ColumnHandle> assignments) { TableHandle tableHandle = new TableHandle(new ConnectorId("testConnector"), new TestingTableHandle()); return tableScan(tableHandle, symbols, assignments); }
Source:
public static void setup() { Properties p = new Properties(); String servers = p.getProperty("voltdb.servers", "localhost"); String user = p.getProperty("voltdb.user", ""); String password = p.getProperty("voltdb.password", ""); String strLimit = p.getProperty("voltdb.ratelimit", "70000"); p.setProperty("voltdb.servers", servers); p.setProperty("voltdb.user", user); p.setProperty("voltdb.password", password); p.setProperty("voltdb.ratelimit", strLimit); try { voltClient = new VoltClient4(); voltClient.setProperties(p); if (ConnectionHelper.checkDBServers(servers)) { voltClient.init(); haveDb = true; removeExistingData(); } } catch (Exception e) { e.printStackTrace(); fail("Could not create Database Client"); } }

Target:
public static void setup() { Properties p = new Properties(); String servers = p.getProperty("voltdb.servers", "localhost"); String user = p.getProperty("voltdb.user", ""); String password = p.getProperty("voltdb.password", ""); String strLimit = p.getProperty("voltdb.ratelimit", "70000"); p.setProperty("voltdb.servers", servers); p.setProperty("voltdb.user", user); p.setProperty("voltdb.password", password); p.setProperty("voltdb.ratelimit", strLimit); try { voltClient = new VoltClient4(); voltClient.setProperties(p); if (ConnectionHelper.checkDBServers(servers)) { voltClient.init(); haveDb = true; removeExistingData(); } } catch (Exception e) { assumeNoException("Something was running on VoltDB's port but it wasn't a usable copy of VoltDB", e); } }
Source:
public void run() { while (!testContext.isStopped()) { double chance = random.nextDouble(); if ((chance -= mapReduceProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(basename); JobTracker tracker = targetInstance.getJobTracker(Thread.currentThread().getName() + basename); Job<Integer, Employee> job = tracker.newJob(KeyValueSource.fromMap(map)); ICompletableFuture< Map< Integer, Set<Employee>> > future = job .mapper( new ModIdMapper(2) ) .combiner(new RangeIdCombinerFactory(10, 30)) .reducer(new IdReducerFactory(10,20,30)) .submit(); try { Map<Integer, Set<Employee>> result = future.get(); for(Set<Employee> s : result.values() ){ if(s!=null){ System.out.println(s); for(Employee e : s ){ assertTrue(e.getId()%2 == 0); assertTrue(e.getId() >= 10 && e.getId() <= 30); assertTrue(e.getId() != 10); assertTrue(e.getId() != 20); assertTrue(e.getId() != 30); } } } } catch (Exception e) { throw new RuntimeException(e);} counter.mapReduce++; } else if ((chance -= getMapEntryProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(basename); map.get(random.nextInt(keyCount)); counter.getMapEntry++; } else if ((chance -= modifyEntryProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(basename); Employee e = map.get(random.nextInt(keyCount)); e.randomizeProperties(); map.put(e.getId(), e); counter.modifyMapEntry++; } } targetInstance.getList(basename).add(counter); }

Target:
public void run() { while (!testContext.isStopped()) { double chance = random.nextDouble(); if ((chance -= mapReduceProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(baseName); JobTracker tracker = targetInstance.getJobTracker(Thread.currentThread().getName() + baseName); Job<Integer, Employee> job = tracker.newJob(KeyValueSource.fromMap(map)); ICompletableFuture< Map< Integer, Set<Employee>> > future = job .mapper( new ModIdMapper(2) ) .combiner(new RangeIdCombinerFactory(10, 30)) .reducer(new IdReducerFactory(10,20,30)) .submit(); try { Map<Integer, Set<Employee>> result = future.get(); for(Set<Employee> s : result.values() ){ for(Employee e : s ){ assertTrue(e.getId()%2 == 0); assertTrue(e.getId() >= 10 && e.getId() <= 30); assertTrue(e.getId() != 10); assertTrue(e.getId() != 20); assertTrue(e.getId() != 30); } } } catch (Exception e) { throw new RuntimeException(e);} counter.mapReduce++; } else if ((chance -= getMapEntryProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(baseName); map.get(random.nextInt(keyCount)); counter.getMapEntry++; } else if ((chance -= modifyEntryProb) < 0) { IMap<Integer, Employee> map = targetInstance.getMap(baseName); Employee e = map.get(random.nextInt(keyCount)); e.randomizeProperties(); map.put(e.getId(), e); counter.modifyMapEntry++; } } targetInstance.getList(baseName).add(counter); }
Source:
public void onThumbClick(@Nullable ReadingListPage item) { beginMultiSelect(); }

Target:
public void onThumbClick(@Nullable ReadingListPage item) { onClick(item); }
Source:
public int countTuples(IInputKey key, TupleMask seedMask, ITuple seed) { return countTuples(key, seedMask.transform(seed)); }

Target:
public int countTuples(IInputKey key, TupleMask seedMask, ITuple seed) { return countTuples(key, seedMask.transform(seed, key.getArity())); }
Source:
public Response remove(Action action) { get(); boolean forceRemove = action != null && action.isSetForce() ? action.isForce() : false; RemoveVmParameters params = new RemoveVmParameters(asGuid(id), forceRemove); if (action != null && action.isSetVm() && action.getVm().isSetDisks() && action.getVm().getDisks().isSetDetachOnly()) { params.setRemoveDisks(false); } return performAction(VdcActionType.RemoveVm, params); }

Target:
public Response remove(Action action) { get(); boolean forceRemove = action != null && action.isSetForce() ? action.isForce() : false; RemoveVmParameters params = new RemoveVmParameters(guid, forceRemove); if (action != null && action.isSetVm() && action.getVm().isSetDisks() && action.getVm().getDisks().isSetDetachOnly()) { params.setRemoveDisks(false); } return performAction(VdcActionType.RemoveVm, params); }
Source:
public FilterExpression visit(ComparisonNode node, Class entityType) { ComparisonOperator op = node.getOperator(); String relationship = node.getSelector(); List<String> arguments = node.getArguments(); Path path = buildPath(entityType, relationship); if (FilterPredicate.toManyInPath(dictionary, path) && !allowNestedToManyAssociations) { throw new RSQLParseException(String.format("Invalid association %s", relationship)); } if (op.equals(ISNULL_OP)) { return buildIsNullOperator(path, arguments); } Class<?> relationshipType = path.lastElement() .map(Path.PathElement::getFieldType) .orElseThrow(() -> new IllegalStateException("Path must not be empty")); if (Number.class.isAssignableFrom(relationshipType)) { for (int i = 0; i < arguments.size(); i++) { arguments.set(i, arguments.get(i).replace("*", "")); } } List<Object> values = arguments.stream() .map((argument) -> (Object) CoerceUtil.coerce(argument, relationshipType)) .collect(Collectors.toList()); if (op.equals(RSQLOperators.EQUAL) || op.equals(RSQLOperators.IN)) { return equalityExpression(arguments.get(0), path, values); } if (op.equals(RSQLOperators.NOT_EQUAL) || op.equals(RSQLOperators.NOT_IN)) { return new NotFilterExpression(equalityExpression(arguments.get(0), path, values)); } if (OPERATOR_MAP.containsKey(op)) { return new FilterPredicate(path, OPERATOR_MAP.get(op), values); } throw new RSQLParseException(String.format("Invalid Operator %s", op.getSymbol())); }

Target:
public FilterExpression visit(ComparisonNode node, Class entityType) { ComparisonOperator op = node.getOperator(); String relationship = node.getSelector(); List<String> arguments = node.getArguments(); Path path = buildPath(entityType, relationship); if (FilterPredicate.toManyInPath(dictionary, path) && !allowNestedToManyAssociations) { throw new RSQLParseException(String.format("Invalid association %s", relationship)); } if (op.equals(ISNULL_OP)) { return buildIsNullOperator(path, arguments); } Class<?> relationshipType = path.lastElement() .map(Path.PathElement::getFieldType) .orElseThrow(() -> new IllegalStateException("Path must not be empty")); List<Object> values = arguments.stream() .map(argument -> Number.class.isAssignableFrom(relationshipType) ? argument.replace("*", "") : argument ) .map((argument) -> (Object) CoerceUtil.coerce(argument, relationshipType)) .collect(Collectors.toList()); if (op.equals(RSQLOperators.EQUAL) || op.equals(RSQLOperators.IN)) { return equalityExpression(arguments.get(0), path, values); } if (op.equals(RSQLOperators.NOT_EQUAL) || op.equals(RSQLOperators.NOT_IN)) { return new NotFilterExpression(equalityExpression(arguments.get(0), path, values)); } if (OPERATOR_MAP.containsKey(op)) { return new FilterPredicate(path, OPERATOR_MAP.get(op), values); } throw new RSQLParseException(String.format("Invalid Operator %s", op.getSymbol())); }
Source:
private Optional<String> createJsonQueryPlan(QueryInfo queryInfo) { try { if (queryInfo.getOutputStage().isPresent()) { JsonCodec<JsonRenderer.JsonRenderedNode> planCodec = JsonCodec.jsonCodec(JsonRenderer.JsonRenderedNode.class); JsonCodec<Map<PlanFragmentId, JsonRenderer.JsonRenderedNode>> mapCodec = JsonCodec.mapJsonCodec(PlanFragmentId.class, JsonRenderer.JsonRenderedNode.class); ImmutableMap.Builder<PlanFragmentId, JsonRenderer.JsonRenderedNode> fragmentJsonMap = ImmutableMap.builder(); for (StageInfo stage : getAllStages(queryInfo.getOutputStage())) { PlanFragmentId fragmentId = stage.getPlan().getId(); if (!stage.getPlan().getJsonRepresentation().isPresent()) { log.warn("Error creating json plan for query %s: json representation is not present for fragment %s", queryInfo.getQueryId(), fragmentId); return Optional.empty(); } String jsonRepresentation = stage.getPlan().getJsonRepresentation().get(); JsonRenderer.JsonRenderedNode node = planCodec.fromJson(jsonRepresentation); fragmentJsonMap.put(fragmentId, node); } return Optional.of(mapCodec.toJson(fragmentJsonMap.build())); } } catch (Exception e) { log.warn(e, "Error creating json plan for query %s: %s", queryInfo.getQueryId(), e); } return Optional.empty(); }

Target:
private Optional<String> createJsonQueryPlan(QueryInfo queryInfo) { try { if (queryInfo.getOutputStage().isPresent()) { ImmutableSortedMap.Builder<PlanFragmentId, JsonPlanFragment> fragmentJsonMap = ImmutableSortedMap.naturalOrder(); for (StageInfo stage : getAllStages(queryInfo.getOutputStage())) { PlanFragmentId fragmentId = stage.getPlan().getId(); JsonPlanFragment jsonPlanFragment = new JsonPlanFragment(stage.getPlan().getJsonRepresentation().get()); fragmentJsonMap.put(fragmentId, jsonPlanFragment); } return Optional.of(PLAN_MAP_CODEC.toJson(fragmentJsonMap.build())); } } catch (Exception e) { log.warn(e, "Error creating json plan for query %s: %s", queryInfo.getQueryId(), e); } return Optional.empty(); }
Source:
public Response getViews(@BeanParam PaginationParam paginationParam) { Set<ApiEntity> apis = apiService.findPublishedByUser(getAuthenticatedUserOrNull()); List<View> viewsList = viewService.findAll() .stream() .filter(v -> !ALL_ID.equals(v.getId())) .filter(v -> !v.isHidden()) .sorted(Comparator.comparingInt(ViewEntity::getOrder)) .map(v-> viewMapper.convert(v, uriInfo.getBaseUriBuilder())) .collect(Collectors.toList()); return createListResponse(viewsList, paginationParam); }

Target:
public Response getViews(@BeanParam PaginationParam paginationParam) { final List<View> viewsList = viewService.findAll() .stream() .filter(v -> !ALL_ID.equals(v.getId())) .filter(v -> !v.isHidden()) .sorted(Comparator.comparingInt(ViewEntity::getOrder)) .map(v-> viewMapper.convert(v, uriInfo.getBaseUriBuilder())) .collect(Collectors.toList()); return createListResponse(viewsList, paginationParam); }
Source:
public void theDeviceSendsARegisterDeviceRequestToThePlatform(final String protocol, final Map<String, String> settings) throws IOException, DeviceSimulatorException { try { final OslpEnvelope request = this .createEnvelopeBuilder(getString(settings, PlatformPubliclightingKeys.KEY_DEVICE_UID, PlatformPubliclightingDefaults.DEVICE_UID), this.oslpMockServer.getSequenceNumber()) .withPayloadMessage( Message.newBuilder() .setRegisterDeviceRequest(Oslp.RegisterDeviceRequest.newBuilder() .setDeviceIdentification(getString(settings, PlatformPubliclightingKeys.KEY_DEVICE_IDENTIFICATION, PlatformPubliclightingDefaults.DEFAULT_DEVICE_IDENTIFICATION)) .setIpAddress(ByteString.copyFrom(InetAddress .getByName( getString(settings, PlatformPubliclightingKeys.IP_ADDRESS, PlatformPubliclightingDefaults.LOCALHOST)) .getAddress())) .setDeviceType(getEnum(settings, PlatformPubliclightingKeys.KEY_DEVICE_TYPE, DeviceType.class, DeviceType.PSLD)) .setHasSchedule( getBoolean(settings, PlatformPubliclightingKeys.KEY_HAS_SCHEDULE, PlatformPubliclightingDefaults.DEFAULT_HASSCHEDULE)) .setRandomDevice( getInteger(settings, PlatformPubliclightingKeys.RANDOM_DEVICE, PlatformPubliclightingDefaults.RANDOM_DEVICE))) .build()) .build(); this.send(request, settings); } catch (final IOException | IllegalArgumentException ioe) { ScenarioContext.current().put("Error", ioe); } }

Target:
public void theDeviceSendsARegisterDeviceRequestToThePlatform(final String protocol, final Map<String, String> settings) throws IOException, DeviceSimulatorException { try { final OslpEnvelope request = this .createEnvelopeBuilder(getString(settings, PlatformPubliclightingKeys.KEY_DEVICE_UID, PlatformPubliclightingDefaults.DEVICE_UID), this.oslpMockServer.getSequenceNumber()) .withPayloadMessage( Message.newBuilder() .setRegisterDeviceRequest(Oslp.RegisterDeviceRequest.newBuilder() .setDeviceIdentification(getString(settings, PlatformPubliclightingKeys.KEY_DEVICE_IDENTIFICATION, PlatformPubliclightingDefaults.DEFAULT_DEVICE_IDENTIFICATION)) .setIpAddress(ByteString.copyFrom(InetAddress .getByName( getString(settings, PlatformPubliclightingKeys.IP_ADDRESS, PlatformPubliclightingDefaults.LOCALHOST)) .getAddress())) .setDeviceType(getEnum(settings, PlatformPubliclightingKeys.KEY_DEVICE_TYPE, DeviceType.class, DeviceType.PSLD)) .setHasSchedule( getBoolean(settings, PlatformPubliclightingKeys.KEY_HAS_SCHEDULE, PlatformPubliclightingDefaults.DEFAULT_HASSCHEDULE)) .setRandomDevice( getInteger(settings, PlatformPubliclightingKeys.RANDOM_DEVICE, PlatformPubliclightingDefaults.RANDOM_DEVICE))) .build()) .build(); this.send(request, settings); } catch (final IOException | IllegalArgumentException e) { ScenarioContext.current().put("Error", e); } }
Source:
protected void configure() { bind(PersonIdent.class).annotatedWith(GerritPersonIdent.class).toProvider( GerritPersonIdentProvider.class); bind(Gson.class).toInstance(new Gson()); bind(DegradedManager.class).in(Scopes.SINGLETON); bind(Peer.class).annotatedWith(Self.class).toInstance(new Peer()); bindConstant().annotatedWith(OutdatedThreshold.class).to(60000L); bind(AllProjectsName.class).toProvider(AllProjectsNameProvider.class).in( Scopes.SINGLETON); bind(String.class).annotatedWith(RefNameBase.class).toProvider( RefNameBaseProvider.class); bind(GitRefManager.class).in(Scopes.SINGLETON); bind(PeerRegistry.class).to(GitRefPeerRegistry.class).in(Scopes.SINGLETON); bindConstant().annotatedWith(MaxSenders.class).to(4); bindConstant().annotatedWith(MaxMessageSize.class).to(2048); bindConstant().annotatedWith(MaxTimeout.class).to(10000L); bindConstant().annotatedWith(BaseRetryTime.class).to(500L); bind(ReceivePortProvider.class); bind(String.class).annotatedWith(ReceiveHost.class).toProvider( ReceiveHostProvider.class); bind(Integer.class).annotatedWith(ReceivePort.class).toProvider( ReceivePortProvider.class); bind(UDPMessageSender.class).in(Scopes.SINGLETON); bind(UDPMessageReceiver.class); bind(Evictor.class).to(UDPEvictor.class).in(Scopes.SINGLETON); bind(CacheManager.class); bind(CacheRemovalListenerImpl.class); DynamicSet.bind(binder(), CacheRemovalListener.class).to( CacheRemovalListenerImpl.class); bind(DataAggregator.class).in(Scopes.SINGLETON); bind(StateMachine.class).in(Scopes.SINGLETON); bind(LifecycleListener.class).annotatedWith(UniqueAnnotations.create()).to( OnStartStop.class); }

Target:
protected void configure() { bind(ConfigProvider.class).in(Scopes.SINGLETON); bind(Config.class).annotatedWith(MultiMasterConfig.class).toProvider( ConfigProvider.class); install(new GitRefModule()); install(new UDPModule()); bind(PersonIdent.class).annotatedWith(GerritPersonIdent.class).toProvider( GerritPersonIdentProvider.class); bind(Gson.class).toInstance(new Gson()); bind(DegradedManager.class).in(Scopes.SINGLETON); bind(Peer.class).annotatedWith(Self.class).toInstance(new Peer()); bind(CacheManager.class); bind(CacheRemovalListenerImpl.class); DynamicSet.bind(binder(), CacheRemovalListener.class).to( CacheRemovalListenerImpl.class); bind(StateMachine.class).in(Scopes.SINGLETON); bind(LifecycleListener.class).annotatedWith(UniqueAnnotations.create()).to( OnStartStop.class); }
Source:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type, LUNs lun, Guid storagePoolId) { Guid poolId = storagePoolId; if (storageDomain != null && storageDomain.getStoragePoolId() != null) { poolId = storageDomain.getStoragePoolId(); } if (FeatureSupported.refreshLunSupported(DbFacade.getInstance().getStoragePoolDao().get(poolId).getCompatibilityVersion())) { boolean isSuccess = true; VDSReturnValue returnValue = null; List<StorageServerConnections> list = new ArrayList<>(); list.add(getFCPConnection()); returnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.forValue(type), new StorageServerConnectionManagementVDSParameters(vdsId, poolId, StorageType.FCP, list)); isSuccess = returnValue.getSucceeded(); EngineFault engineFault = null; if (!isSuccess && returnValue.getVdsError() != null) { engineFault = new EngineFault(); engineFault.setError(returnValue.getVdsError().getCode()); } return new Pair<>(isSuccess, engineFault); } else { return new Pair<>(true, null); } }

Target:
protected Pair<Boolean, EngineFault> runConnectionStorageToDomain(StorageDomain storageDomain, Guid vdsId, int type, LUNs lun, Guid storagePoolId) { if (FeatureSupported.refreshLunSupported(DbFacade.getInstance() .getStoragePoolDao() .get(storagePoolId) .getCompatibilityVersion())) { List<StorageServerConnections> list = new ArrayList<>(); list.add(getFCPConnection()); VDSReturnValue returnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.forValue(type), new StorageServerConnectionManagementVDSParameters(vdsId, storagePoolId, StorageType.FCP, list)); boolean isSuccess = returnValue.getSucceeded(); EngineFault engineFault = null; if (!isSuccess && returnValue.getVdsError() != null) { engineFault = new EngineFault(); engineFault.setError(returnValue.getVdsError().getCode()); } return new Pair<>(isSuccess, engineFault); } else { return new Pair<>(true, null); } }
Source:
public void initialise() { pomWizardPage.setPom( new POMBuilder() .build() ); }

Target:
public void initialise() { pomWizardPage.setPom( new POMBuilder() .setGroupId( context.getActiveOrganizationalUnit().getDefaultGroupId() ) .build() ); }
Source:
public void testSpecialVariables() throws Exception { List<Integer> primes = new ArrayList<>(Arrays.asList(2, 3, 5, 7, 11, 13, 17)); ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext context = new StandardEvaluationContext(); context.setVariable("primes",primes); List<Integer> primesGreaterThanTen = (List<Integer>) parser.parseExpression("#primes.?[#this>10]").getValue(context); assertThat(primesGreaterThanTen.toString()).isEqualTo("[11, 13, 17]"); }

Target:
public void testSpecialVariables() throws Exception { List<Integer> primes = Arrays.asList(2, 3, 5, 7, 11, 13, 17); ExpressionParser parser = new SpelExpressionParser(); StandardEvaluationContext context = new StandardEvaluationContext(); context.setVariable("primes",primes); List<Integer> primesGreaterThanTen = (List<Integer>) parser.parseExpression("#primes.?[#this>10]").getValue(context); assertThat(primesGreaterThanTen.toString()).isEqualTo("[11, 13, 17]"); }