auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static <T> List<T> getBaseClasses(final Class<T> desiredBase, final String packageName) throws URISyntaxException, IOException, IllegalArgumentException { if (desiredBase == null) { throw new IllegalArgumentException("desiredBase must not be null"); } if (StringUtils.isBlank(packageName)) { throw new IllegalArgumentException("packageName must not be blank"); } if (packageName.contains("/")) { throw new IllegalArgumentException("packageName is not properly formatted (i.e. 'java.lang.String')"); } ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL url = classLoader.getResource(packageName.replaceAll("[.]", "/")); if (url == null) { throw new URISyntaxException(packageName, "Supplied package not found"); } Path classesPath = Paths.get(url.toURI()); List<T> classes = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(classesPath)) { for (Path file: stream) { Path pathFileName = file.getFileName(); if (( ! Files.isDirectory(file)) && (pathFileName != null)) { String fullClassName = packageName + "." + pathFileName.toString().replace(".class", ""); try { Object obj = Class.forName(fullClassName).newInstance(); if (desiredBase.isInstance(obj)) { classes.add((T) obj); } } catch (Exception e) { } } } } return classes; }

Target:
public static <T> List<T> getBaseClasses(final Class<T> desiredBase, final String packageName) throws IllegalArgumentException, IOException, NullPointerException, URISyntaxException { return getBaseClasses(desiredBase, packageName, Thread.currentThread().getContextClassLoader()); }
Source:
private UpdateData createUpdateData() { final Object[] values = getValues(); Column[] columns = getColumns(); boolean[] explicitNulls = getExplicitNulls(); List<UpdateField> fields = new ArrayList<UpdateField>(); for (int i = 0; i < columns.length; i++) { final Object value = values[i]; if (value != null || explicitNulls[i]) { String columnName = columns[i].getName(); final UpdateField field = new UpdateField(columnName, value.toString()); fields.add(field); } } List<FilterItem> whereItems = getWhereItems(); if (!(whereItems.size() == 1 && whereItems.get(0).getSelectItem().getColumn().getName().equals("gr_id"))) { throw new IllegalArgumentException("Only gr_id is allowed as a select item"); } String grId = (String) whereItems.get(0).getOperand(); return new UpdateData(grId, fields.toArray(new UpdateField[fields.size()])); }

Target:
private UpdateData createUpdateData() { final Object[] values = getValues(); Column[] columns = getColumns(); boolean[] explicitNulls = getExplicitNulls(); List<UpdateField> fields = new ArrayList<UpdateField>(); for (int i = 0; i < columns.length; i++) { final Object value = values[i]; if (value != null || explicitNulls[i]) { String columnName = columns[i].getName(); final UpdateField field = new UpdateField(columnName, value.toString()); fields.add(field); } } List<FilterItem> whereItems = getWhereItems(); if (!(whereItems.size() == 1 && whereItems.get(0).getSelectItem().getColumn().getName().equals("gr_id"))) { throw new IllegalArgumentException("Updates are only allowed on individual records, identified by gr_id (golden record id)"); } String grId = (String) whereItems.get(0).getOperand(); return new UpdateData(grId, fields.toArray(new UpdateField[fields.size()])); }
Source:
private LNPResultsStatistics getResultsStatistics() throws IOException { Gson gson = new Gson(); JsonReader reader = new JsonReader(Files.newBufferedReader(Paths.get(getPathToTestStatisticsResultsFile()))); JsonObject jsonObject = gson.fromJson(reader, JsonObject.class); JsonObject endPointAnalysis = jsonObject.getAsJsonObject("Test Endpoint"); return gson.fromJson(endPointAnalysis, LNPResultsStatistics.class); }

Target:
private LNPResultsStatistics getResultsStatistics() throws IOException { Gson gson = new Gson(); JsonReader reader = new JsonReader(Files.newBufferedReader(Paths.get(getPathToTestStatisticsResultsFile()))); JsonObject jsonObject = gson.fromJson(reader, JsonObject.class); JsonObject endpointStats = jsonObject.getAsJsonObject("HTTP Request Sampler"); return gson.fromJson(endpointStats, LNPResultsStatistics.class); }
Source:
public void subscribe(EventService eventService) { if (pvcEnabled && !namespaceFactory.isPredefined()) eventService.subscribe( event -> { final String workspaceId = event.getWorkspace().getId(); try { if (!isEphemeral(event.getWorkspace())) { strategy.cleanup(workspaceId); } } catch (InfrastructureException ex) { LOG.error( "Failed to cleanup workspace '{}' data. Cause: {}", workspaceId, ex.getMessage()); } }, WorkspaceRemovedEvent.class); }

Target:
public void subscribe(EventService eventService) { if (pvcEnabled && !namespaceFactory.isPredefined()) eventService.subscribe( event -> { final Workspace workspace = event.getWorkspace(); try { strategy.cleanup(workspace); } catch (InfrastructureException ex) { LOG.error( "Failed to cleanup workspace '{}' data. Cause: {}", workspace.getId(), ex.getMessage()); } }, WorkspaceRemovedEvent.class); }
Source:
public void findModDirMods(File modsDir) { File[] modList = FileListHelper.sortFileList(modsDir, null); modList = FileListHelper.sortFileList(ObjectArrays.concat(modList, ModListHelper.additionalMods.values().toArray(new File[0]), File.class)); for (File modFile : modList) { if (CoreModManager.getLoadedCoremods().contains(modFile.getName())) { FMLLog.finer("Skipping already parsed coremod or tweaker %s", modFile.getName()); } else if (modFile.isDirectory()) { FMLLog.fine("Found a candidate mod directory %s", modFile.getName()); addCandidate(new ModCandidate(modFile, modFile, ContainerType.DIR)); } else { if (Files.getFileExtension(modFile.getName()).equals(".jar")) { FMLLog.fine("Found a candidate jar file %s", modFile.getName()); addCandidate(new ModCandidate(modFile, modFile, ContainerType.JAR)); } else { FMLLog.info("Ignoring non-mod file %s in mods directory", modFile.getName()); } } } }

Target:
public void findModDirMods(File modsDir) { File[] modsDirMods = modsDir.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.getName().endsWith(".jar") || pathname.isDirectory(); } }); File[] additionalMods = ModListHelper.additionalMods.values().toArray(new File[ModListHelper.additionalMods.size()]); File[] sortedModsList = FileListHelper.sortFileList(ObjectArrays.concat(modsDirMods, additionalMods, File.class)); for (File modFile : sortedModsList) { if (CoreModManager.getLoadedCoremods().contains(modFile.getName())) { FMLLog.finer("Skipping already parsed coremod or tweaker %s", modFile.getName()); } else if (modFile.isDirectory()) { FMLLog.fine("Found a candidate mod directory %s", modFile.getName()); addCandidate(new ModCandidate(modFile, modFile, ContainerType.DIR)); } else { FMLLog.fine("Found a candidate jar file %s", modFile.getName()); addCandidate(new ModCandidate(modFile, modFile, ContainerType.JAR)); } } }
Source:
public String evaluate(TransactionContext txnCtx, Input[] args) { assert args.length == 2 : String.format(Locale.ENGLISH, "number of arguments must be 2, got %d instead", args.length); String str = (String) args[0].value(); Number len = (Number) args[1].value(); if (str == null || len == null) { return null; } switch (info.ident().name()) { case LEFT_NAME: return left(str, len.intValue()); case RIGHT_NAME: return right(str, len.intValue()); default: throw new UnsupportedOperationException(String.format(Locale.ENGLISH, "not yet implemented: %s", info.ident().name())); } }

Target:
public String evaluate(TransactionContext txnCtx, Input[] args) { assert args.length == 2 : String.format(Locale.ENGLISH, "number of arguments must be 2, got %d instead", args.length); String str = (String) args[0].value(); Number len = (Number) args[1].value(); if (str == null || len == null) { return null; } return len.intValue() == 0 || str.isEmpty() ? "" : func.apply(str, len.intValue()); }
Source:
static StringStatistics toStringStatistics(HiveWriterVersion hiveWriterVersion, DwrfProto.StringStatistics stringStatistics, boolean isRowGroup) { if (hiveWriterVersion == ORIGINAL && !isRowGroup) { return null; } if (!stringStatistics.hasMinimum() && !stringStatistics.hasMaximum()) { return null; } Slice maximum; Slice minimum; if (hiveWriterVersion != ORIGINAL) { maximum = stringStatistics.hasMaximum() ? maxStringTruncateAtFirstReplacementCharacter(toSlice(stringStatistics.getMaximumBytes())) : null; minimum = stringStatistics.hasMinimum() ? minStringTruncateAtFirstReplacementCharacter(toSlice(stringStatistics.getMinimumBytes())) : null; } else { minimum = stringStatistics.hasMinimum() ? getMinSlice(stringStatistics.getMinimum()) : null; maximum = stringStatistics.hasMaximum() ? getMaxSlice(stringStatistics.getMaximum()) : null; } long sum = stringStatistics.hasSum() ? stringStatistics.getSum() : 0; return new StringStatistics(minimum, maximum, sum); }

Target:
static StringStatistics toStringStatistics(HiveWriterVersion hiveWriterVersion, DwrfProto.StringStatistics stringStatistics, boolean isRowGroup) { if (hiveWriterVersion == ORIGINAL && !isRowGroup) { return null; } if (!stringStatistics.hasMinimum() && !stringStatistics.hasMaximum()) { return null; } Slice maximum = stringStatistics.hasMaximum() ? maxStringTruncateToValidRange(byteStringToSlice(stringStatistics.getMaximumBytes()), hiveWriterVersion) : null; Slice minimum = stringStatistics.hasMinimum() ? minStringTruncateToValidRange(byteStringToSlice(stringStatistics.getMinimumBytes()), hiveWriterVersion) : null; long sum = stringStatistics.hasSum() ? stringStatistics.getSum() : 0; return new StringStatistics(minimum, maximum, sum); }
Source:
public void visitString(VisitableXmlElement<String> visitable) { JAXBElement<String> element = visitable.getElement(); LOGGER.debug(element.getName().getLocalPart()); LOGGER.debug(element.getValue()); builder.setProperty(element.getValue()); }

Target:
public void visitString(VisitableXmlElement<String> visitable) { JAXBElement<String> element = visitable.getElement(); traceLocalPart(element.getName().getLocalPart()); traceValue(element.getValue()); builder.setProperty(element.getValue()); }
Source:
public void start() throws SQLException, SchemaGenerationException { if (_initialized) { close(); } _metrics = new DatabaseChunkedReaderMetrics(_chunkingTable, _readerId); initializeChunkingKeyInfo(); _chunkedQuery = _chunkedQueryManager.generateChunkedQuery(_sourceQuery, new ArrayList<>(_chunkingKeys.keySet()), _chunkSize, _maxChunkIndex, _chunkIndex); _tableSchema = _databaseSource.getTableSchema(_chunkingTable); _initialized = true; }

Target:
public void start() throws SQLException, SchemaGenerationException { if (_initialized) { close(); } _metrics = new DatabaseChunkedReaderMetrics(String.join(".", _database , _chunkingTable), _readerId); initializeChunkingKeyInfo(); _chunkedQuery = _chunkedQueryManager.generateChunkedQuery(_sourceQuery, new ArrayList<>(_chunkingKeys.keySet()), _rowCountLimit, _maxChunkIndex, _chunkIndex); _tableSchema = _databaseSource.getTableSchema(_chunkingTable); _initialized = true; }
Source:
public String toString() { return "SearchDto{" + "searchResultDbId=" + this.searchResultDbId + '}'; }

Target:
public String toString() { return Pojomatic.toString(this); }
Source:
public HoneybadgerReporter(final ConfigContext config) { this.setConfig(config); if (config.getApiKey() == null) { throw new IllegalArgumentException("API key must be set"); } if (config.getApiKey().isEmpty()) { throw new IllegalArgumentException("API key must not be empty"); } if (config.getHoneybadgerUrl() == null) { throw new IllegalArgumentException("Honeybadger URL must be set"); } if (config.getMaximumErrorReportingRetries() == null) { throw new IllegalArgumentException("Honeybadger property getMaximumErrorReportingRetries must be set"); } if (config.getMaximumErrorReportingRetries() < 0) { throw new IllegalArgumentException("Honeybadger property getMaximumErrorReportingRetries must be an integer greater than or equal to 0"); } }

Target:
public HoneybadgerReporter(final ConfigContext config) { this.setConfig(config); if (config.getApiKey() == null) { throw new IllegalArgumentException("API key must be set"); } if (config.getApiKey().isEmpty()) { throw new IllegalArgumentException("API key must not be empty"); } if (config.getHoneybadgerUrl() == null) { throw new IllegalArgumentException("Honeybadger URL must be set"); } if (config.getMaximumErrorReportingRetries() == null) { throw new IllegalArgumentException("Honeybadger property honeybadger.maximum_retry_attempts must be set"); } if (config.getMaximumErrorReportingRetries() < 0) { throw new IllegalArgumentException("Honeybadger property honeybadger.maximum_retry_attempts must be an " + "integer greater than or equal to 0"); } }
Source:
public void setCustomParams(final Map<String, Object> customParams) { this.customParams = customParams; }

Target:
public void setCustomParams(final Map<String, Object> customParams) { CommonHelper.assertNotNull("customParams", customParams); this.customParams = customParams; }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("JavaClass"); if (typeFilterRegex != null) { builder.append(".inFile(" + typeFilterRegex + ")"); } if (regex != null) { builder.append(".references(" + regex + ")"); } if (!locations.isEmpty()) { builder.append(".at(" + locations + ")"); } builder.append(".as(" + variable + ")"); return builder.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("JavaClass"); if (typeFilterRegex != null) { builder.append(".inType(" + typeFilterRegex + ")"); } if (regex != null) { builder.append(".references(" + regex + ")"); } if (!locations.isEmpty()) { builder.append(".at(" + locations + ")"); } builder.append(".as(" + variable + ")"); return builder.toString(); }
Source:
private static void checkAddress(String address, AddressFamily addrFamily) { ObjectUtil.checkNotNull(addrFamily, "addrFamily"); switch (addrFamily) { case AF_UNSPEC: if (address != null) { throw new IllegalArgumentException("unable to validate an AF_UNSPEC address: " + address); } return; case AF_UNIX: if (address == null || address.getBytes(CharsetUtil.US_ASCII).length > 108) { throw new IllegalArgumentException("invalid AF_UNIX address: " + address); } return; } ObjectUtil.checkNotNull(address, "address"); switch (addrFamily) { case AF_IPv4: if (!NetUtil.isValidIpV4Address(address)) { throw new IllegalArgumentException("invalid IPv4 address: " + address); } break; case AF_IPv6: if (!NetUtil.isValidIpV6Address(address)) { throw new IllegalArgumentException("invalid IPv6 address: " + address); } break; default: throw new IllegalArgumentException("unexpected addrFamily: " + addrFamily); } }

Target:
private static void checkAddress(String address, AddressFamily addrFamily) { ObjectUtil.checkNotNull(addrFamily, "addrFamily"); switch (addrFamily) { case AF_UNSPEC: if (address != null) { throw new IllegalArgumentException("unable to validate an AF_UNSPEC address: " + address); } return; case AF_UNIX: ObjectUtil.checkNotNull(address, "address"); if (address.getBytes(CharsetUtil.US_ASCII).length > 108) { throw new IllegalArgumentException("invalid AF_UNIX address: " + address); } return; } ObjectUtil.checkNotNull(address, "address"); switch (addrFamily) { case AF_IPv4: if (!NetUtil.isValidIpV4Address(address)) { throw new IllegalArgumentException("invalid IPv4 address: " + address); } break; case AF_IPv6: if (!NetUtil.isValidIpV6Address(address)) { throw new IllegalArgumentException("invalid IPv6 address: " + address); } break; default: throw new IllegalArgumentException("unexpected addrFamily: " + addrFamily); } }
Source:
@SuppressWarnings("UnusedDeclaration") @Deprecated public void setDebugging(boolean debugging) { setIndicatorsEnabled(debugging); setLoggingEnabled(debugging); }

Target:
@SuppressWarnings("UnusedDeclaration") @Deprecated public void setDebugging(boolean debugging) { setIndicatorsEnabled(debugging); }
Source:
public void testDomainSocketClosedByDN() throws Exception { BlockReaderTestUtil.enableShortCircuitShmTracing(); TemporarySocketDirectory sockDir = new TemporarySocketDirectory(); Configuration conf = createShortCircuitConf("testDomainSocketClosedByDN", sockDir); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); cluster.waitActive(); DistributedFileSystem fs = cluster.getFileSystem(); final ShortCircuitCache cache = fs.getClient().getClientContext().getShortCircuitCache(); DomainPeer peer = getDomainPeerToDn(conf); MutableBoolean usedPeer = new MutableBoolean(false); ExtendedBlockId blockId = new ExtendedBlockId(123, "xyz"); final DatanodeInfo datanode = new DatanodeInfo.DatanodeInfoBuilder() .setNodeID(cluster.getDataNodes().get(0).getDatanodeId()).build(); Slot slot1 = cache.allocShmSlot(datanode, peer, usedPeer, blockId, "testReleaseSlotReuseDomainSocket_client"); cluster.getDataNodes().get(0).getShortCircuitRegistry() .registerSlot(blockId, slot1.getSlotId(), false); Slot slot2 = cache.allocShmSlot(datanode, peer, usedPeer, blockId, "testReleaseSlotReuseDomainSocket_client"); cluster.getDataNodes().get(0).getShortCircuitRegistry() .registerSlot(blockId, slot2.getSlotId(), false); cache.scheduleSlotReleaser(slot1); Thread.sleep(5000); cache.scheduleSlotReleaser(slot2); Thread.sleep(10000); Assert.assertTrue(cluster.getDataNodes().get(0).getShortCircuitRegistry() .getShmNum() == 0); Assert.assertTrue(cache.getDfsClientShmManager().getShmNum() == 0); cluster.shutdown(); }

Target:
public void testDomainSocketClosedByDN() throws Exception { TemporarySocketDirectory sockDir = new TemporarySocketDirectory(); Configuration conf = createShortCircuitConf("testDomainSocketClosedByDN", sockDir); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); try { cluster.waitActive(); DistributedFileSystem fs = cluster.getFileSystem(); final ShortCircuitCache cache = fs.getClient().getClientContext().getShortCircuitCache(); DomainPeer peer = getDomainPeerToDn(conf); MutableBoolean usedPeer = new MutableBoolean(false); ExtendedBlockId blockId = new ExtendedBlockId(123, "xyz"); final DatanodeInfo datanode = new DatanodeInfo.DatanodeInfoBuilder() .setNodeID(cluster.getDataNodes().get(0).getDatanodeId()).build(); Slot slot1 = cache.allocShmSlot(datanode, peer, usedPeer, blockId, "testReleaseSlotReuseDomainSocket_client"); cluster.getDataNodes().get(0).getShortCircuitRegistry() .registerSlot(blockId, slot1.getSlotId(), false); Slot slot2 = cache.allocShmSlot(datanode, peer, usedPeer, blockId, "testReleaseSlotReuseDomainSocket_client"); cluster.getDataNodes().get(0).getShortCircuitRegistry() .registerSlot(blockId, slot2.getSlotId(), false); cache.scheduleSlotReleaser(slot1); Thread.sleep(2000); cache.scheduleSlotReleaser(slot2); Thread.sleep(2000); Assert.assertEquals(0, cluster.getDataNodes().get(0).getShortCircuitRegistry().getShmNum()); Assert.assertEquals(0, cache.getDfsClientShmManager().getShmNum()); } finally { cluster.shutdown(); } }
Source:
public int getInt(String name, int defaultValue) { return getValue(name, new Function<String, Integer>() { @Override public Integer apply(String stringVal) { return Integer.parseInt(stringVal); } }, defaultValue); }

Target:
public int getInt(String name, int defaultValue) { return cfg.getInt(PLUGIN, pluginName, name, defaultValue); }
Source:
public void onChunkExecStateChanged(ChunkExecStateChangedEvent event) { if (event.getDocId() != docId_ || !outputs_.containsKey(event.getChunkId())) return; ChunkInlineOutput output = outputs_.get(event.getChunkId()); if (event.getExecState() == NotebookDocQueue.CHUNK_EXEC_STARTED) { output.setState(ChunkInlineOutput.State.Started); } else if (event.getExecState() == NotebookDocQueue.CHUNK_EXEC_FINISHED) { output.setState(ChunkInlineOutput.State.Finished); final ScreenCoordinates pos = computePopupPosition( output.range(), output.getOffsetWidth()); output.setPopupPosition(pos.getPageX(), pos.getPageY()); output.show(); } }

Target:
public void onChunkExecStateChanged(ChunkExecStateChangedEvent event) { if (event.getDocId() != docId_ || !outputs_.containsKey(event.getChunkId())) return; ChunkInlineOutput output = outputs_.get(event.getChunkId()); if (event.getExecState() == NotebookDocQueue.CHUNK_EXEC_STARTED) { output.setState(ChunkInlineOutput.State.Started); } else if (event.getExecState() == NotebookDocQueue.CHUNK_EXEC_FINISHED) { output.setState(ChunkInlineOutput.State.Finished); output.positionNearRange(display_, output.range()); output.show(); } }
Source:
private Supplier<CharReadable> fileAsCharReadable( File file ) { return () -> { try { return Readables.wrap( fs.openAsReader( file, Charset.defaultCharset() ) ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }; }

Target:
private Supplier<CharReadable> fileAsCharReadable( File file ) { return () -> { try { return Readables.wrap( fs.openAsReader( file, StandardCharsets.UTF_8 ) ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }; }
Source:
public void testWriteAndReadObject() throws Exception { InternalSerializationService serializationService = new DefaultSerializationServiceBuilder().build(); String expected = "test input"; String actual = (String) writeAndReadObject(serializationService, expected); assertNotNull(actual); assertEquals(expected, actual); }

Target:
public void testWriteAndReadObject() throws Exception { String expected = "test input"; String actual = (String) writeAndReadObject(expected); assertNotNull(actual); assertEquals(expected, actual); }
Source:
private static File asTemp(InputStream in, String prefix, String suffix, File dir) throws IOException { File tmp = File.createTempFile(prefix, suffix, dir); boolean keep = false; try { FileOutputStream out = new FileOutputStream(tmp); try { byte[] data = new byte[8192]; int n; while ((n = in.read(data)) > 0) { out.write(data, 0, n); } keep = true; return tmp; } finally { out.close(); } } finally { if (!keep) { tmp.delete(); } } }

Target:
static File asTemp(InputStream in, String prefix, String suffix, File dir) throws IOException { File tmp = File.createTempFile(prefix, suffix, dir); boolean keep = false; try (FileOutputStream out = new FileOutputStream(tmp)) { byte[] data = new byte[8192]; int n; while ((n = in.read(data)) > 0) { out.write(data, 0, n); } keep = true; return tmp; } finally { if (!keep) { tmp.delete(); } } }
Source:
public void open() throws Exception { userDefinedFunctionOutputType = new RowType( outputType.getFields().subList(groupingSet.length, outputType.getFieldCount() - namedProperties.length)); super.open(); inputKeyAndWindow = new LinkedList<>(); windowProperty = new GenericRowData(namedProperties.length); windowAggResult = new JoinedRowData(); windowsGrouping = new HeapWindowsGrouping( maxLimitSize, windowSize, slideSize, inputTimeFieldIndex, false); }

Target:
public void open() throws Exception { userDefinedFunctionOutputType = new RowType( outputType.getFields().subList(groupingSet.length, outputType.getFieldCount() - namedProperties.length)); inputKeyAndWindow = new LinkedList<>(); windowProperty = new GenericRowData(namedProperties.length); windowAggResult = new JoinedRowData(); windowsGrouping = new HeapWindowsGrouping( maxLimitSize, windowSize, slideSize, inputTimeFieldIndex, false); super.open(); }
Source:
void init(String url, String cookie, ConfigurationContext configCtxt) throws UserStoreException { try { stub = new RemoteUserRealmServiceStub(configCtxt, url + REALM_SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, this .getSessionCookie()); } catch (AxisFault e) { if (log.isDebugEnabled()) { log.debug(CONNECTION_ERROR_MESSAGE, e); } throw new UserStoreException(); } userStoreMan = new WSUserStoreManager(url, cookie, configCtxt); authzMan = new WSAuthorizationManager(url, cookie, configCtxt); claimManager = new WSClaimManager(url, cookie, configCtxt); profileManager = new WSProfileConfigurationManager(url, cookie, configCtxt); }

Target:
void init(String url, String cookie, ConfigurationContext configCtxt) throws UserStoreException { try { stub = new RemoteUserRealmServiceStub(configCtxt, url + REALM_SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, this .getSessionCookie()); } catch (AxisFault e) { throw new UserStoreException("Axis error occurred while creating service client stub"); } userStoreMan = new WSUserStoreManager(url, cookie, configCtxt); authzMan = new WSAuthorizationManager(url, cookie, configCtxt); claimManager = new WSClaimManager(url, cookie, configCtxt); profileManager = new WSProfileConfigurationManager(url, cookie, configCtxt); }
Source:
public Parts split(SymbolAllocator symbolAllocator, FunctionRegistry functionRegistry) { ImmutableMap.Builder<Symbol, Aggregation> intermediateAggregation = ImmutableMap.builder(); ImmutableMap.Builder<Symbol, Aggregation> finalAggregation = ImmutableMap.builder(); for (Map.Entry<Symbol, Aggregation> entry : aggregations.entrySet()) { Aggregation originalAggregation = entry.getValue(); Signature signature = originalAggregation.getSignature(); InternalAggregationFunction function = functionRegistry.getAggregateFunctionImplementation(signature); Symbol intermediateSymbol = symbolAllocator.newSymbol(signature.getName(), function.getIntermediateType()); intermediateAggregation.put(intermediateSymbol, new Aggregation(originalAggregation.getCall(), signature, originalAggregation.getMask())); finalAggregation.put(entry.getKey(), new Aggregation( new FunctionCall(QualifiedName.of(signature.getName()), ImmutableList.of(intermediateSymbol.toSymbolReference())), signature, Optional.empty())); } return new Parts( new StatisticAggregations(intermediateAggregation.build(), groupingSymbols), new StatisticAggregations(finalAggregation.build(), groupingSymbols)); }

Target:
public Parts split(SymbolAllocator symbolAllocator, FunctionRegistry functionRegistry) { ImmutableMap.Builder<Symbol, Aggregation> intermediateAggregation = ImmutableMap.builder(); ImmutableMap.Builder<Symbol, Aggregation> finalAggregation = ImmutableMap.builder(); ImmutableMap.Builder<Symbol, Symbol> mappings = ImmutableMap.builder(); for (Map.Entry<Symbol, Aggregation> entry : aggregations.entrySet()) { Aggregation originalAggregation = entry.getValue(); Signature signature = originalAggregation.getSignature(); InternalAggregationFunction function = functionRegistry.getAggregateFunctionImplementation(signature); Symbol intermediateSymbol = symbolAllocator.newSymbol(signature.getName(), function.getIntermediateType()); mappings.put(entry.getKey(), intermediateSymbol); intermediateAggregation.put(intermediateSymbol, new Aggregation(originalAggregation.getCall(), signature, originalAggregation.getMask())); finalAggregation.put(entry.getKey(), new Aggregation( new FunctionCall(QualifiedName.of(signature.getName()), ImmutableList.of(intermediateSymbol.toSymbolReference())), signature, Optional.empty())); } groupingSymbols.forEach(symbol -> mappings.put(symbol, symbol)); return new Parts( new StatisticAggregations(intermediateAggregation.build(), groupingSymbols), new StatisticAggregations(finalAggregation.build(), groupingSymbols), mappings.build()); }
Source:
private List<Type> getImplementz(GraphqlParser.ImplementsInterfacesContext implementsInterfacesContext) { List<Type> implementz = new ArrayList<>(); while (implementsInterfacesContext != null) { List<TypeName> typeNames = implementsInterfacesContext.typeName().stream().map(this::createTypeName).collect(toList()); implementz.addAll(0, typeNames); implementsInterfacesContext = implementsInterfacesContext.implementsInterfaces(); } return implementz; }

Target:
private List<Type> getImplementz(GraphqlParser.ImplementsInterfacesContext implementsInterfacesContext) { List<Type> implementz = new ArrayList<>(); while (implementsInterfacesContext != null) { List<TypeName> typeNames = FpKit.map(implementsInterfacesContext.typeName(), this::createTypeName); implementz.addAll(0, typeNames); implementsInterfacesContext = implementsInterfacesContext.implementsInterfaces(); } return implementz; }
Source:
public void post(Object entity, InputStream stdin, ResultCallback<Frame> resultCallback) { Request request = requestBuilder .post(RequestBody.create(MediaType.parse("application/json"), objectMapper.writeValueAsBytes(entity))) .build(); OkHttpClient okHttpClient = this.okHttpClient; if (stdin != null) { okHttpClient = okHttpClient.newBuilder() .hostnameVerifier(new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } }) .addNetworkInterceptor(chain -> { Response response = chain.proceed(chain.request()); if (response.isSuccessful()) { Thread thread = new Thread() { @Override @SneakyThrows public void run() { Field sinkField = RealConnection.class.getDeclaredField("sink"); sinkField.setAccessible(true); try ( BufferedSink sink = (BufferedSink) sinkField.get(chain.connection()); Source source = Okio.source(stdin); ) { sink.writeAll(source); } } }; thread.start(); } return response; }) .build(); } executeAndStream( okHttpClient, request, resultCallback, new FramedSink(resultCallback) ); }

Target:
public void post(Object entity, InputStream stdin, ResultCallback<Frame> resultCallback) { Request request = requestBuilder .post(RequestBody.create(MediaType.parse("application/json"), objectMapper.writeValueAsBytes(entity))) .build(); OkHttpClient okHttpClient = this.okHttpClient; if (stdin != null) { okHttpClient = okHttpClient.newBuilder() .hostnameVerifier((hostname, sslSession) -> true) .addNetworkInterceptor(chain -> { Response response = chain.proceed(chain.request()); if (response.isSuccessful()) { Thread thread = new Thread() { @Override @SneakyThrows public void run() { Field sinkField = RealConnection.class.getDeclaredField("sink"); sinkField.setAccessible(true); try ( BufferedSink sink = (BufferedSink) sinkField.get(chain.connection()); Source source = Okio.source(stdin); ) { sink.writeAll(source); } } }; thread.start(); } return response; }) .build(); } executeAndStream( okHttpClient, request, resultCallback, new FramedSink(resultCallback) ); }
Source:
public void deleteReferencedBlobs(String referencingEntity, String referenceDesignator, @Nullable String excludedBlobKey) { if (Strings.isEmpty(referencingEntity)) { return; } if (Strings.isEmpty(referenceDesignator)) { return; } SmartQuery<SQLBlob> qry = oma.select(SQLBlob.class) .eq(SQLBlob.SPACE_NAME, spaceName) .eq(SQLBlob.REFERENCE, referencingEntity) .eq(SQLBlob.REFERENCE_DESIGNATOR, referenceDesignator); if (Strings.isFilled(excludedBlobKey)) { qry.ne(SQLBlob.BLOB_KEY, excludedBlobKey); } qry.delete(); }

Target:
public void deleteReferencedBlobs(String referencingEntity, String referenceDesignator, @Nullable String excludedBlobKey) { if (Strings.isEmpty(referencingEntity)) { return; } if (Strings.isEmpty(referenceDesignator)) { return; } SmartQuery<SQLBlob> query = oma.select(SQLBlob.class) .eq(SQLBlob.SPACE_NAME, spaceName) .eq(SQLBlob.REFERENCE, referencingEntity) .eq(SQLBlob.REFERENCE_DESIGNATOR, referenceDesignator); if (Strings.isFilled(excludedBlobKey)) { query.ne(SQLBlob.BLOB_KEY, excludedBlobKey); } query.delete(); }
Source:
private String getSources() { if ( parsedSources == null ) { parsedSources = project.getBuild().getSourceDirectory(); } return parsedSources; }

Target:
private String getSources() { if ( parsedSources == null ) { parsedSources = new File( project.getBuild().getSourceDirectory() ).getAbsolutePath(); } return parsedSources; }
Source:
public SearchEventRest createSearchEvent() throws AuthorizeException, SQLException { Context context = obtainContext(); HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); List<SearchFilter> result = new LinkedList<>(); ObjectMapper mapper = new ObjectMapper(); SearchEventRest searchEventRest = null; try { ServletInputStream input = req.getInputStream(); searchEventRest = mapper.readValue(input, SearchEventRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body", e1); } checkSearchEventRestValidity(searchEventRest); RestUsageSearchEvent restUsageSearchEvent = searchEventConverter.convert(context, req, searchEventRest); eventService.fireEvent(restUsageSearchEvent); return searchEventRest; }

Target:
public SearchEventRest createSearchEvent() { Context context = obtainContext(); HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); ObjectMapper mapper = new ObjectMapper(); SearchEventRest searchEventRest = null; try { ServletInputStream input = req.getInputStream(); searchEventRest = mapper.readValue(input, SearchEventRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body", e1); } checkSearchEventRestValidity(searchEventRest); UsageSearchEvent usageSearchEvent = searchEventConverter.convert(context, req, searchEventRest); eventService.fireEvent(usageSearchEvent); return searchEventRest; }
Source:
public void run() { try { this.acceptKey = acceptSocket.register(selector, SelectionKey.OP_ACCEPT); while (!stopped && !acceptSocket.socket().isClosed()) { try { select(); } catch (RuntimeException e) { LOG.warn("Ignoring unexpected runtime exception", e); } catch (Exception e) { LOG.warn("Ignoring unexpected exception", e); } } } catch (IOException e) { LOG.error("Exception when running accept thread. Unable to register selector?", e); } finally { closeSelector(); if (!reconfiguring) { NIOServerCnxnFactory.this.stop(); } LOG.info("accept thread exitted run method"); } }

Target:
public void run() { try { while (!stopped && !acceptSocket.socket().isClosed()) { try { select(); } catch (RuntimeException e) { LOG.warn("Ignoring unexpected runtime exception", e); } catch (Exception e) { LOG.warn("Ignoring unexpected exception", e); } } } finally { closeSelector(); if (!reconfiguring) { NIOServerCnxnFactory.this.stop(); } LOG.info("accept thread exitted run method"); } }
Source:
WebDriver create(final Proxy proxy) { System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "/dev/null"); return createFirefoxDriver(proxy); }

Target:
WebDriver create(final Proxy proxy) { String logFilePath = System.getProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "/dev/null"); System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, logFilePath); return createFirefoxDriver(proxy); }
Source:
protected Response invokeGet(String docsUri) { logger.info("[GET] " + docsUri); WebTarget clientRequest = httpClient.target(docsUri); return clientRequest.request().get(); }

Target:
protected Response invokeGet(String docsUri) { logger.debug("[GET] " + docsUri); WebTarget clientRequest = httpClient.target(docsUri); return clientRequest.request().get(); }
Source:
public MutationException(Row mutation, Throwable throwable) { this.mutation = mutation; this.throwable = throwable; }

Target:
private MutationException(Row mutation, Throwable throwable) { this.mutation = mutation; this.throwable = throwable; }
Source:
private void addNewGroup(long groupId, Block block, int position, long count) { checkState(isEmpty(), "bucket %s not empty, points to %s", bucketId, buckets.get(bucketId)); int nextValuePosition = valueStore.getPosition(type, block, position, valueOnlyRawHash); valuePositions.set(nodePointerToUse, nextValuePosition); valueRawHashList.set(nodePointerToUse, valueRawHash); buckets.set(bucketId, nodePointerToUse); counts.set(nodePointerToUse, count); groupIds.set(nodePointerToUse, groupId); int currentHead = (int) headPointers.get(groupId); headPointers.set(groupId, nodePointerToUse); nextPointers.set(nodePointerToUse, currentHead); }

Target:
private void addNewGroup(long groupId, Block block, int position, long count) { checkState(isEmpty(), "bucket %s not empty, points to %s", bucketId, buckets.get(bucketId)); int nextValuePosition = valueStore.addAndGetPosition(type, block, position, valueHash); valuePositions.set(nodePointerToUse, nextValuePosition); valueAndGroupHashes.set(nodePointerToUse, valueAndGroupHash); buckets.set(bucketId, nodePointerToUse); counts.set(nodePointerToUse, count); groupIds.set(nodePointerToUse, groupId); int currentHead = (int) headPointers.get(groupId); headPointers.set(groupId, nodePointerToUse); nextPointers.set(nodePointerToUse, currentHead); }
Source:
public static List<Pair<SizeUnit, Double>> getMathOperationSafeOperands(Pair<SizeUnit, Double>... operands) { List<Pair<SizeUnit, Double>> operatoinReadyOperands = new ArrayList<>(); SizeUnit finalUnit = leastUnitInList(operands); for(Pair<SizeUnit, Double> operand : operands) { if(operand.getFirst() != finalUnit) { operand.setSecond(convert(operand.getSecond().longValue(), operand.getFirst(), finalUnit).doubleValue()); operand.setFirst(finalUnit); } } return operatoinReadyOperands; }

Target:
public static List<Pair<SizeUnit, Double>> getMathOperationSafeOperands(Pair<SizeUnit, Double>... operands) { List<Pair<SizeUnit, Double>> operationReadyOperands = new ArrayList<>(); List<Pair<SizeUnit, Double>> convertedOperands = new ArrayList<>(); for (Pair<SizeUnit, Double> operand : operands) { convertedOperands.add(autoConvert(operand.getSecond().longValue(), operand.getFirst())); } SizeUnit finalUnit = leastUnitInList(convertedOperands); for (Pair<SizeUnit, Double> operand : convertedOperands) { if(operand.getFirst() != finalUnit) { operationReadyOperands.add(new Pair<SizeConverter.SizeUnit, Double>(finalUnit, convert(operand.getSecond().longValue(), operand.getFirst(), finalUnit).doubleValue())); } else { operationReadyOperands.add(operand); } } return operationReadyOperands; }
Source:
public Callable<ProbeResult> createRequest() { return () -> { try { ConnectionPoolMonitor pool = context.getConnectionPoolMonitor(); List<String> infoList = Lists.newArrayList(); infoList.add("Socket timeouts: " + Long.toString(pool.getSocketTimeoutCount())); infoList.add("Transport errors: " + Long.toString(pool.getTransportErrorCount())); infoList.add("Pool-exhausted timeouts: " + Long.toString(pool.getPoolExhaustedTimeoutCount())); infoList.add("Connections opened: " + Long.toString(pool.getConnectionCreatedCount())); infoList.add("Connections closed: " + Long.toString(pool.getConnectionClosedCount())); infoList.add("Active hosts: " + Long.toString(pool.getHostActiveCount())); if (isUnhealthy(pool)) { return ProbeResult.unhealthy(identifier, Strings.join(infoList, ", ")); } return ProbeResult.healthy(identifier); } catch (Exception e) { return ProbeResult.unhealthy(identifier, e); } }; }

Target:
public Callable<ProbeResult> createRequest() { return () -> { try { ConnectionPoolMonitor pool = context.getConnectionPoolMonitor(); if (pool.getHostActiveCount() <= 0) { return ProbeResult.unhealthy(identifier, "No active hosts"); } return ProbeResult.healthy(identifier); } catch (Exception e) { return ProbeResult.unhealthy(identifier, e); } }; }
Source:
private void enqueueExceptionalPaths(ProgramState ps, SymbolicValue.ExceptionalSymbolicValue exceptionSV) { Set<CFG.Block> exceptionBlocks = node.programPoint.block.exceptions(); List<CFG.Block> catchBlocks = exceptionBlocks.stream().filter(CFG.Block.IS_CATCH_BLOCK).collect(Collectors.toList()); Optional<CFG.Block> firstMatchingCatchBlock = catchBlocks.stream() .filter(b -> isValidCatchBlock(b, exceptionSV.exceptionType())) .sorted((b1, b2) -> Integer.compare(b2.id(), b1.id())) .findFirst(); if (firstMatchingCatchBlock.isPresent()) { enqueue(new ExplodedGraph.ProgramPoint(firstMatchingCatchBlock.get(), 0), ps); return; } catchBlocks.stream() .filter(ExplodedGraphWalker::isCatchingUncheckedException) .forEach(b -> enqueue(new ExplodedGraph.ProgramPoint(b, 0), ps)); exceptionBlocks.stream() .filter(CFG.Block.IS_CATCH_BLOCK.negate()) .forEach(b -> enqueue(new ExplodedGraph.ProgramPoint(b, 0), ps, true)); ProgramState newPs = ps.clearStack().stackValue(exceptionSV); newPs.storeExitValue(); node.programPoint.block.successors().stream() .filter(CFG.Block::isMethodExitBlock) .forEach(b -> enqueue(new ExplodedGraph.ProgramPoint(b, 0), newPs, true)); }

Target:
private void enqueueExceptionalPaths(ProgramState ps, SymbolicValue.ExceptionalSymbolicValue exceptionSV) { Set<CFG.Block> exceptionBlocks = node.programPoint.block.exceptions(); List<CFG.Block> catchBlocks = exceptionBlocks.stream().filter(CFG.Block.IS_CATCH_BLOCK).collect(Collectors.toList()); Optional<CFG.Block> firstMatchingCatchBlock = catchBlocks.stream() .filter(b -> isCaughtByBlock(exceptionSV.exceptionType(), b)) .sorted((b1, b2) -> Integer.compare(b2.id(), b1.id())) .findFirst(); if (firstMatchingCatchBlock.isPresent()) { enqueue(new ExplodedGraph.ProgramPoint(firstMatchingCatchBlock.get(), 0), ps); return; } catchBlocks.stream() .filter(ExplodedGraphWalker::isCatchingUncheckedException) .forEach(b -> enqueue(new ExplodedGraph.ProgramPoint(b, 0), ps)); ProgramState newPs = ps.clearStack().stackValue(exceptionSV); newPs.storeExitValue(); exceptionBlocks.stream() .filter(CFG.Block.IS_CATCH_BLOCK.negate()) .forEach(b -> enqueue(new ExplodedGraph.ProgramPoint(b, 0), newPs, true)); node.programPoint.block.successors().stream() .filter(CFG.Block::isMethodExitBlock) .forEach(b -> enqueue(new ExplodedGraph.ProgramPoint(b, 0), newPs, true)); }
Source:
private ChargeStatus determineTerminalState(GatewayResponse<BaseCancelResponse> cancelResponse, StatusFlow statusFlow) { if (!cancelResponse.isSuccessful() && !cancelResponse.getBaseResponse().isPresent()) { return statusFlow.getFailureTerminalState(); } switch (cancelResponse.getBaseResponse().get().cancelStatus()) { case CANCELLED: return statusFlow.getSuccessTerminalState(); case SUBMITTED: return statusFlow.getSubmittedState(); } return statusFlow.getFailureTerminalState(); }

Target:
private ChargeStatus determineTerminalState(GatewayResponse<BaseCancelResponse> cancelResponse, StatusFlow statusFlow) { return cancelResponse.getBaseResponse().map(response -> { switch (response.cancelStatus()) { case CANCELLED: return statusFlow.getSuccessTerminalState(); case SUBMITTED: return statusFlow.getSubmittedState(); default: return statusFlow.getFailureTerminalState(); } }).orElse(statusFlow.getFailureTerminalState()); }
Source:
public void shouldEditAnAutoGenerationOptionByAnyNumberOFArguments() throws Exception { assertTrue( identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isAutomaticGenerationEnabled()); assertTrue(identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isManualEntryEnabled()); SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("manualEntryEnabled", false); autoGenerationOption.add("automaticGenerationEnabled", false); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI() + "/" + getUuid()); req.setContent(json.getBytes()); handle(req); assertFalse( identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isAutomaticGenerationEnabled()); assertFalse(identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isManualEntryEnabled()); }

Target:
public void shouldEditAnAutoGenerationOptionByAnyNumberOFArguments() throws Exception { AutoGenerationOption autogenerationOption = identifierSourceService.getAutoGenerationOption(getId()); assertTrue(autogenerationOption.isAutomaticGenerationEnabled()); assertTrue(autogenerationOption.isManualEntryEnabled()); SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("manualEntryEnabled", false); autoGenerationOption.add("automaticGenerationEnabled", false); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI() + "/" + getUuid()); req.setContent(json.getBytes()); handle(req); AutoGenerationOption updatedAutogenerationOption = identifierSourceService.getAutoGenerationOption(getId()); assertFalse(updatedAutogenerationOption.isAutomaticGenerationEnabled()); assertFalse(updatedAutogenerationOption.isManualEntryEnabled()); }
Source:
private static void storeGroups(String groupFilePath, Multimap<String, String> groups) throws ManageUsersException { try { try (PrintWriter writer = new PrintWriter(new FileWriter(groupFilePath))) { for (Map.Entry<String, String> userEntry : groups.entries()) { writer.println(userEntry.getKey() + ":" + userEntry.getValue()); } } } catch (IOException e) { exitWithErrorMessage("could not write group file : " + groupFilePath, null, e); } System.out.println("Stored group file in " + groupFilePath); }

Target:
private static void storeGroups(String groupFilePath, Multimap<String, String> groups) throws ManageUsersException { try { try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(groupFilePath)))) { for (Map.Entry<String, String> userEntry : groups.entries()) { writer.println(userEntry.getKey() + ":" + userEntry.getValue()); } } } catch (IOException e) { exitWithErrorMessage("could not write group file : " + groupFilePath, null, e); } System.out.println("Stored group file in " + groupFilePath); }
Source:
public void statusRedundancyWithExcludeRegionArgumentReturnsStatusForAllExceptThatRegion() { createAndPopulateRegions(); String command = new CommandStringBuilder(COMMAND_NAME) .addOption(EXCLUDE_REGION, ZERO_COPIES_REGION) .getCommandString(); CommandResultAssert commandResult = gfsh.executeAndAssertThat(command); commandResult.statusIsSuccess() .hasNoSection(ZERO_REDUNDANCY_SECTION) .doesNotContainOutput(ZERO_COPIES_REGION); verifySummarySection(commandResult, 0, 1, 2); InfoResultModelAssert underRedundancy = commandResult.hasInfoSection(UNDER_REDUNDANCY_SECTION); underRedundancy.hasHeader().isEqualTo(REDUNDANCY_NOT_SATISFIED_FOR_REGIONS); underRedundancy.hasOutput().contains(UNSATISFIED_REGION); InfoResultModelAssert satisfiedRedundancy = commandResult.hasInfoSection(SATISFIED_REDUNDANCY_SECTION); satisfiedRedundancy.hasHeader().isEqualTo(REDUNDANCY_SATISFIED_FOR_REGIONS); satisfiedRedundancy.hasOutput().contains(SATISFIED_REGION, NO_CONFIGURED_REDUNDANCY_REGION); }

Target:
public void statusRedundancyWithExcludeRegionArgumentReturnsStatusForAllExceptThatRegion() { createAndPopulateRegions(); String excludedRegion = ZERO_COPIES_REGION; String command = new CommandStringBuilder(STATUS_REDUNDANCY) .addOption(REDUNDANCY_EXCLUDE_REGION, excludedRegion) .getCommandString(); CommandResultAssert commandResult = gfsh.executeAndAssertThat(command).statusIsSuccess() .doesNotContainOutput(excludedRegion); List<String> satisfiedRegions = Arrays.asList(SATISFIED_REGION, NO_CONFIGURED_REDUNDANCY_REGION); verifyGfshOutput(commandResult, new ArrayList<>(), Collections.singletonList(UNSATISFIED_REGION), satisfiedRegions); }
Source:
private static String readMapping() { ClassLoader classloader = Thread.currentThread().getContextClassLoader(); try (InputStream inputStream = classloader.getResourceAsStream("mapping.json")) { String mapping = IOUtils.toString(inputStream, "UTF-8"); JsonObject jsonObject = Json.createReader(new StringReader(mapping)).readObject(); return jsonObject.toString(); } catch (IOException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); return ""; } }

Target:
private static String readMapping() { ClassLoader classloader = Thread.currentThread().getContextClassLoader(); try (InputStream inputStream = classloader.getResourceAsStream("mapping.json")) { String mapping = IOUtils.toString(inputStream, "UTF-8"); try (JsonReader jsonReader = Json.createReader(new StringReader(mapping))) { JsonObject jsonObject = jsonReader.readObject(); return jsonObject.toString(); } } catch (IOException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); return ""; } }
Source:
private Composite createFillComp(Composite parent) { Composite comp = createComposite(parent); comp.setLayout(GridLayoutFactory.fillDefaults().create()); Label l = createLabel(comp, longText); l.setLayoutData(GridDataFactory.swtDefaults().grab(true, false).align(SWT.FILL, SWT.BEGINNING).create()); return comp; }

Target:
private Composite createFillComp(Composite parent) { Composite comp = createComposite(parent); GridLayoutFactory.fillDefaults().applyTo(comp); Label l = createLabel(comp, longText); GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.BEGINNING).applyTo(l); return comp; }