auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void placeNewMarketOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if (orderType == OrderType.BUY) { if ((price*volume) > this.cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money." + " Trader: " + this.name); } for(int i = 0; i < this.ordersPlaced.size(); i++) { if (this.ordersPlaced.get(i).getStockSymbol().equals(symbol)) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader already has" + "an order for this stock. Trader: " + this.name); } } Order order = new BuyOrder(symbol, volume, true, this); this.ordersPlaced.add(order); m.addOrder(order); } if (orderType == OrderType.SELL) { boolean owns = false; int numberStocksOwned = 0; for (int i = 0; i < this.position.size(); i++) { if (this.position.get(i).getStockSymbol() == symbol) { owns = true; numberStocksOwned = this.position.get(i).getSize(); } } if (!owns) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own this stock. Trader: " + this.name); } if (numberStocksOwned < volume){ throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own enough shares of this stock. Trader: " + this.name); } Order order = new SellOrder(symbol, volume, true, this); this.ordersPlaced.add(order); m.addOrder(order); } }

Target:
public void placeNewMarketOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { if (orderType == OrderType.BUY) { if ((price * volume) > this.cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money." + " Trader: " + this.name); } for(int i = 0; i < this.ordersPlaced.size(); i++) { if (this.ordersPlaced.get(i).getStockSymbol().equals(symbol)) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader already has" + "an order for this stock. Trader: " + this.name); } } Order order = new BuyOrder(symbol, volume, true, this); this.ordersPlaced.add(order); m.addOrder(order); } if (orderType == OrderType.SELL) { boolean owns = false; int numberStocksOwned = 0; for (int i = 0; i < this.position.size(); i++) { if (this.position.get(i).getStockSymbol().equals(symbol)) { owns = true; numberStocksOwned = this.position.get(i).getSize(); } } if (!owns) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own this stock. Trader: " + this.name); } if (numberStocksOwned < volume){ throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since this trader does not" + "own enough shares of this stock. Trader: " + this.name); } Order order = new SellOrder(symbol, volume, true, this); this.ordersPlaced.add(order); m.addOrder(order); } }
Source:
public static PaletteGroup getPaletteGroupWithAdd(Palette palette, IContainer groupDst) { String[] groups = groupDst.getProjectRelativePath().toString().split("/"); if ((0 == groups.length) || ((1 == groups.length) && (0 == groups[0].length()))) { return palette.getRootGroup(); } ArrayList<String> groupList = new ArrayList<String>(); groupList.addAll(Arrays.asList(groups)); if (TypeLibraryTags.TOOL_LIBRARY_PROJECT_NAME.equals(groupList.get(0))) { groupList.remove(0); } return palette.getGroup(groupList, false); }

Target:
public static PaletteGroup getPaletteGroupWithAdd(Palette palette, IContainer groupDst) { String[] groups = groupDst.getProjectRelativePath().toString().split("/"); if ((0 == groups.length) || ((1 == groups.length) && (0 == groups[0].length()))) { return palette.getRootGroup(); } List<String> groupList = new ArrayList<>(); groupList.addAll(Arrays.asList(groups)); if (TypeLibraryTags.TOOL_LIBRARY_PROJECT_NAME.equals(groupList.get(0))) { groupList.remove(0); } return palette.getGroup(groupList, false); }
Source:
private void deleteKubernetesVersionIso(long templateId) throws IllegalAccessException, NoSuchFieldException, IllegalArgumentException { DeleteIsoCmd deleteIsoCmd = new DeleteIsoCmd(); deleteIsoCmd = ComponentContext.inject(deleteIsoCmd); Field f = deleteIsoCmd.getClass().getDeclaredField("id"); f.setAccessible(true); f.set(deleteIsoCmd, templateId); templateService.deleteIso(deleteIsoCmd); }

Target:
private void deleteKubernetesVersionIso(long templateId) throws IllegalAccessException, NoSuchFieldException, IllegalArgumentException { DeleteIsoCmd deleteIsoCmd = new DeleteIsoCmd(); deleteIsoCmd = ComponentContext.inject(deleteIsoCmd); deleteIsoCmd.setId(templateId); templateService.deleteIso(deleteIsoCmd); }
Source:
public void testComplete() { assertFalse(TestUtils.getPropertyValue(this.splitter, "iterator", Boolean.class)); assertTrue(TestUtils.getPropertyValue(this.splitter, "markers", Boolean.class)); assertTrue(TestUtils.getPropertyValue(this.splitter, "requiresReply", Boolean.class)); assertTrue(TestUtils.getPropertyValue(this.splitter, "applySequence", Boolean.class)); assertEquals(Charset.forName("UTF-8"), TestUtils.getPropertyValue(this.splitter, "charset")); assertEquals(5L, TestUtils.getPropertyValue(this.splitter, "messagingTemplate.sendTimeout")); assertEquals(out, TestUtils.getPropertyValue(this.splitter, "outputChannel")); assertEquals(2, TestUtils.getPropertyValue(this.splitter, "order")); assertEquals(this.in, TestUtils.getPropertyValue(this.fullBoat, "inputChannel")); assertFalse(TestUtils.getPropertyValue(this.fullBoat, "autoStartup", Boolean.class)); assertEquals(1, TestUtils.getPropertyValue(this.fullBoat, "phase")); }

Target:
public void testComplete() { assertFalse(TestUtils.getPropertyValue(this.splitter, "iterator", Boolean.class)); assertTrue(TestUtils.getPropertyValue(this.splitter, "markers", Boolean.class)); assertTrue(TestUtils.getPropertyValue(this.splitter, "requiresReply", Boolean.class)); assertTrue(TestUtils.getPropertyValue(this.splitter, "applySequence", Boolean.class)); assertEquals(Charset.forName("UTF-8"), TestUtils.getPropertyValue(this.splitter, "charset")); assertEquals(5L, TestUtils.getPropertyValue(this.splitter, "messagingTemplate.sendTimeout")); assertEquals(this.out, TestUtils.getPropertyValue(this.splitter, "outputChannel")); assertEquals(2, TestUtils.getPropertyValue(this.splitter, "order")); assertEquals(this.in, TestUtils.getPropertyValue(this.fullBoat, "inputChannel")); assertFalse(TestUtils.getPropertyValue(this.fullBoat, "autoStartup", Boolean.class)); assertEquals(1, TestUtils.getPropertyValue(this.fullBoat, "phase")); }
Source:
public static String getConfigValue(String catalogName, String parameter) throws ParameterNotFoundException { HierarchicalConfiguration opacConfiguration = getCatalog(catalogName); if (Objects.isNull(opacConfiguration)) { throw new ParameterNotFoundException("No configuration foudn for catalog '" + catalogName + "'!"); } else { String parameterValue = opacConfiguration.getString(parameter); if (parameterValue.isEmpty()) { throw new ParameterNotFoundException("Parameter '" + parameter + "' not found in OPAC configuration for catalog '" + catalogName + "'!"); } return parameterValue; } }

Target:
public static String getConfigValue(String catalogName, String parameter) throws ParameterNotFoundException { HierarchicalConfiguration opacConfiguration = getCatalog(catalogName); if (Objects.isNull(opacConfiguration)) { throw new ParameterNotFoundException("No configuration found for catalog '" + catalogName + "'!"); } else { String parameterValue = opacConfiguration.getString(parameter); if (StringUtils.isBlank(parameterValue)) { throw new ParameterNotFoundException("Parameter '" + parameter + "' not found in OPAC configuration for catalog '" + catalogName + "'!"); } return parameterValue; } }
Source:
public String getInlineComments(int lines) { StringBuilder cmts = new StringBuilder(); final Repository repo = getRepository(); try { final PatchList patchList = repo != null ? getPatchList() : null; Patch.Key currentFileKey = null; PatchFile currentFileData = null; for (final PatchLineComment c : inlineComments) { final Patch.Key pk = c.getKey().getParentKey(); final int lineNbr = c.getLine(); final short side = c.getSide(); if (!pk.equals(currentFileKey)) { cmts.append("....................................................\n"); if (Patch.COMMIT_MSG.equals(pk.get())) { cmts.append("Commit Message\n"); } else { cmts.append("File "); cmts.append(pk.get()); cmts.append("\n"); } currentFileKey = pk; if (patchList != null) { try { currentFileData = new PatchFile(repo, patchList, pk.getFileName()); } catch (IOException e) { } } else { currentFileData = null; } } if (currentFileData != null) { int maxLines; try { maxLines = currentFileData.getLineCount(side); } catch (Throwable e) { maxLines = Integer.MAX_VALUE; } final int startLine = Math.max(1, lineNbr - lines + 1); final int stopLine = Math.min(maxLines, lineNbr + lines); for (int line = startLine; line <= lineNbr; ++line) { appendFileLine(cmts, currentFileData, side, line); } cmts.append(c.getMessage().trim()); cmts.append("\n"); for (int line = lineNbr + 1; line < stopLine; ++line) { appendFileLine(cmts, currentFileData, side, line); } } cmts.append("\n\n"); } } finally { if (repo != null) { repo.close(); } } return cmts.toString(); }

Target:
public String getInlineComments(int lines) { StringBuilder cmts = new StringBuilder(); final Repository repo = getRepository(); try { final PatchList patchList = repo != null ? getPatchList() : null; Patch.Key currentFileKey = null; PatchFile currentFileData = null; for (final PatchLineComment c : inlineComments) { final Patch.Key pk = c.getKey().getParentKey(); final int lineNbr = c.getLine(); final short side = c.getSide(); if (!pk.equals(currentFileKey)) { cmts.append("....................................................\n"); if (Patch.COMMIT_MSG.equals(pk.get())) { cmts.append("Commit Message\n"); } else { cmts.append("File "); cmts.append(pk.get()); cmts.append("\n"); } currentFileKey = pk; if (patchList != null) { try { currentFileData = new PatchFile(repo, patchList, pk.getFileName()); } catch (IOException e) { } } else { currentFileData = null; } } if (currentFileData != null) { int maxLines; try { maxLines = currentFileData.getLineCount(side); } catch (Throwable e) { maxLines = lineNbr; } final int startLine = Math.max(1, lineNbr - lines + 1); final int stopLine = Math.min(maxLines, lineNbr + lines); for (int line = startLine; line <= lineNbr; ++line) { appendFileLine(cmts, currentFileData, side, line); } cmts.append(c.getMessage().trim()); cmts.append("\n"); for (int line = lineNbr + 1; line < stopLine; ++line) { appendFileLine(cmts, currentFileData, side, line); } } cmts.append("\n\n"); } } finally { if (repo != null) { repo.close(); } } return cmts.toString(); }
Source:
protected boolean isCPOEValid() { for (String crit : CPOE_CRITERIA) { if (null != criteriaMet.get(crit)) { this.counts.put("criteriaCpoeRequiredMet", 1); return true; } } ArrayList<String> missing1 = new ArrayList<String>(); missing1.addAll(CPOE_CRITERIA); missingOr.add(missing1); return false; }

Target:
protected boolean isCPOEValid() { for (String crit : CPOE_CRITERIA) { if (null != criteriaMet.get(crit)) { this.counts.put("criteriaCpoeRequiredMet", 1); return true; } } ArrayList<String> missing = new ArrayList<String>(); missing.addAll(CPOE_CRITERIA); missingOr.add(missing); return false; }
Source:
public static void main(String[] args) { final AmbryServer ambryServer; int exitCode = 0; try { InvocationOptions options = new InvocationOptions(args); Properties properties = Utils.loadProps(options.serverPropsFilePath); properties.setProperty("clustermap.cluster.name", "dev"); properties.setProperty("clustermap.datacenter.name", "DataCenter"); properties.setProperty("clustermap.host.name", "localhost"); VerifiableProperties verifiableProperties = new VerifiableProperties(properties); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties); ClusterAgentsFactory clusterAgentsFactory = Utils.getObj(clusterMapConfig.clusterMapClusterAgentsFactory, clusterMapConfig, options.hardwareLayoutFilePath, options.partitionLayoutFilePath); logger.info("Bootstrapping AmbryServer"); ambryServer = new AmbryServer(verifiableProperties, clusterAgentsFactory, SystemTime.getInstance()); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { logger.info("Received shutdown signal. Shutting down AmbryServer"); ambryServer.shutdown(); } }); ambryServer.startup(); ambryServer.awaitShutdown(); } catch (Exception e) { logger.error("Exception during bootstrap of AmbryServer", e); exitCode = 1; } logger.info("Exiting AmbryMain"); System.exit(exitCode); }

Target:
public static void main(String[] args) { final AmbryServer ambryServer; int exitCode = 0; try { InvocationOptions options = new InvocationOptions(args); Properties properties = Utils.loadProps(options.serverPropsFilePath); VerifiableProperties verifiableProperties = new VerifiableProperties(properties); ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties); ClusterAgentsFactory clusterAgentsFactory = Utils.getObj(clusterMapConfig.clusterMapClusterAgentsFactory, clusterMapConfig, options.hardwareLayoutFilePath, options.partitionLayoutFilePath); logger.info("Bootstrapping AmbryServer"); ambryServer = new AmbryServer(verifiableProperties, clusterAgentsFactory, SystemTime.getInstance()); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { logger.info("Received shutdown signal. Shutting down AmbryServer"); ambryServer.shutdown(); } }); ambryServer.startup(); ambryServer.awaitShutdown(); } catch (Exception e) { logger.error("Exception during bootstrap of AmbryServer", e); exitCode = 1; } logger.info("Exiting AmbryMain"); System.exit(exitCode); }
Source:
public File getFile(File workingDir) throws IOException { File file = new File(path); String name = file.getName(); if (path.equals(DiffEntry.DEV_NULL)) { file = new File(workingDir, "nul"); } else if ((stream != null)) { tempFile = File.createTempFile(".__", "__" + name); try (OutputStream outStream = new FileOutputStream(tempFile)) { int read = 0; byte[] bytes = new byte[8 * 1024]; while ((read = stream.read(bytes)) != -1) { outStream.write(bytes, 0, read); } } return tempFile; } return file; }

Target:
public File getFile(File workingDir) throws IOException { File file = new File(path); String name = file.getName(); if (path.equals(DiffEntry.DEV_NULL)) { file = new File(workingDir, "nul"); } else if (stream != null) { tempFile = File.createTempFile(".__", "__" + name); try (OutputStream outStream = new FileOutputStream(tempFile)) { int read = 0; byte[] bytes = new byte[8 * 1024]; while ((read = stream.read(bytes)) != -1) { outStream.write(bytes, 0, read); } } return tempFile; } return file; }
Source:
public void onNext(final AggregationMessage aggregationMessage) { final String slaveId = aggregationMessage.getSourceId().toString(); if (blockedWorkerIds.contains(slaveId)) { LOG.log(Level.INFO, "Multiple synchronization requests from {0}", slaveId); } else { blockedWorkerIds.add(slaveId); } if (blockedWorkerIds.size() == numWorkers) { LOG.log(Level.INFO, "{0} workers are blocked. Sending response messages to awake them", numWorkers); broadcastResponseMessages(); } }

Target:
public void onNext(final AggregationMessage aggregationMessage) { final String slaveId = aggregationMessage.getSourceId().toString(); if (blockedWorkerIds.contains(slaveId)) { LOG.log(Level.WARNING, "Multiple synchronization requests from {0}", slaveId); } else { blockedWorkerIds.add(slaveId); } if (blockedWorkerIds.size() == numWorkers) { LOG.log(Level.INFO, "{0} workers are blocked. Sending response messages to awake them", numWorkers); broadcastResponseMessages(); } }
Source:
private PgClassTable.Entry primaryKeyToPgClassEntry(RelationInfo info) { return new PgClassTable.Entry(OidHash.primaryKeyOid(info), OidHash.schemaOid(info.ident().schema()), info.ident(), info.ident().name() + "_pkey", info.relationType(), info.columns().size(), info.primaryKey().size() > 0); }

Target:
private PgClassTable.Entry primaryKeyToPgClassEntry(RelationInfo info) { return new PgClassTable.Entry( OidHash.primaryKeyOid(info), OidHash.schemaOid(info.ident().schema()), info.ident(), info.ident().name() + "_pkey", PgClassTable.Entry.Type.INDEX, info.columns().size(), info.primaryKey().size() > 0); }
Source:
private ApplicationManager createSourceAndDeployApp(String appName, File file, String format, String outputDatasetName, Schema schema) throws Exception { String schemaString = null; if (schema != null) { schemaString = schema.toString(); } ETLStage source; if (schema != null) { source = new ETLStage( "source", new ETLPlugin("File", BatchSource.PLUGIN_TYPE, ImmutableMap.<String, String>builder() .put(Constants.Reference.REFERENCE_NAME, "TestFile") .put(Properties.File.FILESYSTEM, "Text") .put(Properties.File.PATH, file.getAbsolutePath()) .put(Properties.File.FORMAT, format) .put(Properties.File.IGNORE_NON_EXISTING_FOLDERS, "false") .put("pathField", "file") .put(Properties.File.SCHEMA, schemaString) .build(), null)); } else { source = new ETLStage( "source", new ETLPlugin("File", BatchSource.PLUGIN_TYPE, ImmutableMap.<String, String>builder() .put(Constants.Reference.REFERENCE_NAME, "TestFile") .put(Properties.File.FILESYSTEM, "Text") .put(Properties.File.PATH, file.getAbsolutePath()) .put(Properties.File.FORMAT, format) .put(Properties.File.IGNORE_NON_EXISTING_FOLDERS, "false") .put("pathField", "file") .build(), null)); } ETLStage sink = new ETLStage("sink", MockSink.getPlugin(outputDatasetName)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(BATCH_ARTIFACT, etlConfig); ApplicationId appId = NamespaceId.DEFAULT.app(appName); ApplicationManager appManager = deployApplication(appId, appRequest); return appManager; }

Target:
private ApplicationManager createSourceAndDeployApp(String appName, File file, String format, String outputDatasetName, Schema schema) throws Exception { ImmutableMap.Builder<String, String> sourceProperties = ImmutableMap.<String, String>builder() .put(Constants.Reference.REFERENCE_NAME, "TestFile") .put(Properties.File.FILESYSTEM, "Text") .put(Properties.File.PATH, file.getAbsolutePath()) .put(Properties.File.FORMAT, format) .put(Properties.File.IGNORE_NON_EXISTING_FOLDERS, "false") .put("pathField", "file"); if (schema != null) { String schemaString = schema.toString(); sourceProperties.put(Properties.File.SCHEMA, schemaString); } ETLStage source = new ETLStage( "source", new ETLPlugin("File", BatchSource.PLUGIN_TYPE, sourceProperties.build(), null)); ETLStage sink = new ETLStage("sink", MockSink.getPlugin(outputDatasetName)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(BATCH_ARTIFACT, etlConfig); ApplicationId appId = NamespaceId.DEFAULT.app(appName); ApplicationManager appManager = deployApplication(appId, appRequest); return appManager; }
Source:
private static ClassSymbolImpl classSymbol(String name, String fullyQualifiedName) { ClassSymbolImpl djangoHttpResponseRedirect = new ClassSymbolImpl(name, fullyQualifiedName); djangoHttpResponseRedirect.setHasUnresolvedTypeHierarchy(false); return djangoHttpResponseRedirect; }

Target:
private static ClassSymbolImpl classSymbol(String name, String fullyQualifiedName) { ClassSymbolImpl classSymbol = new ClassSymbolImpl(name, fullyQualifiedName); classSymbol.setHasUnresolvedTypeHierarchy(false); return classSymbol; }
Source:
public void deleteBlobsByDirectory(String containerName, String directoryName, boolean recursive) { List<BlobEntity> blobs = findBlobsByDirectory(containerName, directoryName, false); for (BlobEntity blob : blobs) { if (!blob.isDirectory()) { deleteBlob(containerName, blob.getKey()); } else { if (recursive) { deleteBlob(containerName, blob.getKey()); deleteBlobsByDirectory(containerName, blob.getKey(), true); } } } }

Target:
public void deleteBlobsByDirectory(String containerName, String directoryName, boolean recursive) { List<BlobEntity> blobs = findBlobsByDirectory(containerName, directoryName, false); for (BlobEntity blob : blobs) { if (!blob.isDirectory()) { deleteBlob(containerName, blob.getKey()); } else { if (recursive) { deleteBlobsByDirectory(containerName, blob.getKey(), true); deleteBlob(containerName, blob.getKey()); } } } }
Source:
public FileSystem getFileSystem(URI uri) { String accountName = extractAccountName(uri); if (!this.openFileSystems.containsKey(accountName)) { throw new FileSystemNotFoundException(); } return this.openFileSystems.get(accountName); }

Target:
public FileSystem getFileSystem(URI uri) { String accountName = extractAccountName(uri); if (!this.openFileSystems.containsKey(accountName)) { throw Utility.logError(this.logger, new FileSystemNotFoundException("Name: " + accountName)); } return this.openFileSystems.get(accountName); }
Source:
public int getRetryAspectOrder() { return Ordered.LOWEST_PRECEDENCE - 3; }

Target:
public int getRetryAspectOrder() { return retryAspectOrder; }
Source:
public String toString() { if (mVars.size() == 0) { return null; } JSONObject jsonObject; synchronized (mConcurrentLock) { jsonObject = new JSONObject(mVars); } return jsonObject.toString(); }

Target:
public String toString() { JSONObject json = new JSONObject(mVars); return json.length() > 0 ? json.toString() : null; }
Source:
private int readWithFilter(int[] positions, int positionCount) throws IOException { int streamPosition = 0; outputPositionCount = 0; for (int i = 0; i < positionCount; i++) { int position = positions[i]; if (position > streamPosition) { skip(position - streamPosition); streamPosition = position; } if (presentStream != null && !presentStream.nextBit()) { if (nullsAllowed) { if (outputRequired) { nulls[outputPositionCount] = true; } outputPositions[outputPositionCount] = position; outputPositionCount++; } } else { double value = dataStream.next(); if (filter.testDouble(value)) { if (outputRequired) { values[outputPositionCount] = doubleToLongBits(value); if (nullsAllowed && presentStream != null) { nulls[outputPositionCount] = false; } } outputPositions[outputPositionCount] = position; outputPositionCount++; } } streamPosition++; } return streamPosition; }

Target:
private int readWithFilter(int[] positions, int positionCount) throws IOException { int streamPosition = 0; outputPositionCount = 0; for (int i = 0; i < positionCount; i++) { int position = positions[i]; if (position > streamPosition) { skip(position - streamPosition); streamPosition = position; } if (presentStream != null && !presentStream.nextBit()) { if ((nonDeterministicFilter && filter.testNull()) || nullsAllowed) { if (outputRequired) { nulls[outputPositionCount] = true; } outputPositions[outputPositionCount] = position; outputPositionCount++; } } else { double value = dataStream.next(); if (filter.testDouble(value)) { if (outputRequired) { values[outputPositionCount] = doubleToLongBits(value); if (nullsAllowed && presentStream != null) { nulls[outputPositionCount] = false; } } outputPositions[outputPositionCount] = position; outputPositionCount++; } } streamPosition++; if (filter != null) { outputPositionCount -= filter.getPrecedingPositionsToFail(); int succeedingPositionsToFail = filter.getSucceedingPositionsToFail(); if (succeedingPositionsToFail > 0) { int positionsToSkip = 0; for (int j = 0; j < succeedingPositionsToFail; j++) { i++; int nextPosition = positions[i]; positionsToSkip += 1 + nextPosition - streamPosition; streamPosition = nextPosition + 1; } skip(positionsToSkip); } } } return streamPosition; }
Source:
public void run() { InetSocketAddress publicInetAddress = null; try { publicInetAddress = performStunDiscovery( new InetSocketAddress(stunAddress, stunPort), new InetSocketAddress(localAddress, 0), timeout); } catch (PortUnreachableException e) { log.info("Aborted stun discovery - ICMP port unreachable: " + e.getMessage()); return; } catch (IOException e) { log.error("an error occurred while performing a STUN discovery: " + e.getMessage(), e); return; } catch (Exception e) { log.error( "an internal error occurred while performing a STUN discovery: " + e.getMessage(), e); return; } if (publicInetAddress.getAddress().isAnyLocalAddress()) return; synchronized (StunServiceImpl.this) { if (publicInetAddress.getAddress().equals(localAddress)) isDirectConnection = true; log.debug( "discovered public WAN-IP: " + publicInetAddress.getAddress().getHostAddress() + " through interface " + localAddress.getHostAddress()); publicIPAddresses.add(publicInetAddress); } }

Target:
public void run() { InetSocketAddress publicInetAddress = null; try { publicInetAddress = performStunDiscovery( new InetSocketAddress(stunAddress, stunPort), new InetSocketAddress(localAddress, 0), timeout); } catch (PortUnreachableException e) { log.warn("aborted STUN discovery: " + e.getMessage()); return; } catch (IOException e) { log.error("an error occurred while performing a STUN discovery: " + e.getMessage(), e); return; } catch (Exception e) { log.error( "an internal error occurred while performing a STUN discovery: " + e.getMessage(), e); return; } if (publicInetAddress.getAddress().isAnyLocalAddress()) return; synchronized (StunServiceImpl.this) { if (publicInetAddress.getAddress().equals(localAddress)) isDirectConnection = true; log.debug( "discovered public WAN-IP: " + publicInetAddress.getAddress().getHostAddress() + " through interface " + localAddress.getHostAddress()); publicIPAddresses.add(publicInetAddress); } }
Source:
public void close() { for (BufferAggregator aggregator : aggregators) { try { aggregator.close(); } catch (Exception e) { log.warn(e, "Could not close aggregator, skipping."); } } }

Target:
public void close() { for (BufferAggregator aggregator : aggregators) { try { aggregator.close(); } catch (Exception e) { log.warn(e, "Could not close aggregator [%s], skipping.", aggregator); } } }
Source:
@NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalStateException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(scheme) && !"http".equals(scheme)) { return request; } if (!request.hasSize() && !alwaysTransform) { return request; } Request.Builder newRequest = request.newBuilder(); ThumborUrlBuilder urlBuilder = thumbor.buildImage(uri.toString()); if (request.hasSize()) { urlBuilder.resize(request.targetWidth, request.targetHeight); newRequest.clearResize(); } if (request.centerInside) { urlBuilder.fitIn(); newRequest.clearCenterInside(); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { urlBuilder.filter(format(ImageFormat.WEBP)); } newRequest.setUri(Uri.parse(urlBuilder.toUrl())); return newRequest.build(); }

Target:
@NonNull @Override public Request transformRequest(@NonNull Request request) { if (request.resourceId != 0) { return request; } Uri uri = request.uri; if (uri == null) { throw new IllegalArgumentException("Null uri passed to " + getClass().getCanonicalName()); } String scheme = uri.getScheme(); if (!"https".equals(scheme) && !"http".equals(scheme)) { return request; } if (!request.hasSize() && !alwaysTransform) { return request; } Request.Builder newRequest = request.newBuilder(); ThumborUrlBuilder urlBuilder = thumbor.buildImage(uri.toString()); if (request.hasSize()) { urlBuilder.resize(request.targetWidth, request.targetHeight); newRequest.clearResize(); } if (request.centerInside) { urlBuilder.fitIn(); newRequest.clearCenterInside(); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { urlBuilder.filter(format(ImageFormat.WEBP)); } newRequest.setUri(Uri.parse(urlBuilder.toUrl())); return newRequest.build(); }
Source:
public void TwitterWidgetTest_002_areLoaded() { TwitterWidgetPageObject twitterWidget = new TwitterWidgetPageObject(driver); twitterWidget.createMultiple().navigate(wikiURL); Assertion.assertTrue( twitterWidget.areAllValidSwappedForIFrames(), MercuryMessages.SOME_VALID_WIDGETS_WERE_NOT_SWAPPED_MSG ); Assertion.assertTrue( twitterWidget.areLoaded(), MercuryMessages.INVISIBLE_MSG ); }

Target:
public void TwitterWidgetTest_002_areLoaded() { TwitterWidgetPageObject widget = new TwitterWidgetPageObject(driver); widget.createMultiple().navigate(wikiURL); Assertion.assertTrue( widget.areAllValidSwappedForIFrames(), MercuryMessages.SOME_VALID_WIDGETS_WERE_NOT_SWAPPED_MSG ); Assertion.assertTrue(widget.areLoaded(), MercuryMessages.INVISIBLE_MSG); }
Source:
Mono<ServiceBusReceiverAsyncClient> createConsumerWithReceiveLink() { return Mono.defer(() -> { getOrCreateConsumer(); return Mono.just(this); }); }

Target:
Mono<ServiceBusAsyncConsumer> createConsumerWithReceiveLink() { return Mono.fromCallable(this::getOrCreateConsumer); }
Source:
protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); if (attachEvent.isInitialAttach()) { if (!getUI().isPresent()) { throw new IllegalStateException( "The component needs to be attached to an UI."); } addClassName("tablesorter"); getUI().get().getPage().executeJavaScript( "jQuery($0).tablesorter({ theme : 'bootstrap', widgets : [ 'group', 'filter', 'columns', 'zebra' ] });", getElement()); } if (!updated) { updateContent(); } }

Target:
protected void onAttach(AttachEvent attachEvent) { super.onAttach(attachEvent); if (attachEvent.isInitialAttach()) { if (!getUI().isPresent()) { throw new IllegalStateException( "The component needs to be attached to an UI."); } addClassName("tablesorter"); getUI().get().getPage().executeJavaScript( "jQuery($0).tablesorter({ theme : 'bootstrap', widgets : [ 'group', 'filter', 'columns', 'zebra' ] });", getElement()); updateContentIfAttached(); } }
Source:
private void exit() { if (serviceContainer != null) { try { serviceContainer.shutdown(); serviceContainer.awaitTermination(); } catch (RuntimeException rte) { throw rte; } catch (InterruptedException ite) { ServerLogger.ROOT_LOGGER.error(ite.getLocalizedMessage(), ite); Thread.currentThread().interrupt(); } catch (Exception ex) { ServerLogger.ROOT_LOGGER.error(ex.getLocalizedMessage(), ex); } } if (controlledProcessStateService != null) { controlledProcessStateService.removePropertyChangeListener(processStateListener); controlledProcessStateService = null; } if (executorService != null) { try { executorService.shutdown(); executorService.awaitTermination(10, TimeUnit.SECONDS); } catch (RuntimeException rte) { throw rte; } catch (InterruptedException ite) { ServerLogger.ROOT_LOGGER.error(ite.getLocalizedMessage(), ite); Thread.currentThread().interrupt(); } catch (Exception ex) { ServerLogger.ROOT_LOGGER.error(ex.getLocalizedMessage(), ex); } } if (uninstallStdIo) { try { StdioContext.uninstall(); } catch (IllegalStateException ignored) { } } SystemExiter.initialize(SystemExiter.Exiter.DEFAULT); }

Target:
private void exit() { if (serviceContainer != null) { try { serviceContainer.shutdown(); serviceContainer.awaitTermination(); } catch (RuntimeException rte) { throw rte; } catch (InterruptedException ite) { EmbeddedLogger.ROOT_LOGGER.error(ite.getLocalizedMessage(), ite); Thread.currentThread().interrupt(); } catch (Exception ex) { EmbeddedLogger.ROOT_LOGGER.error(ex.getLocalizedMessage(), ex); } } if (controlledProcessStateService != null) { controlledProcessStateService.removePropertyChangeListener(processStateListener); controlledProcessStateService = null; } if (executorService != null) { try { executorService.shutdown(); executorService.awaitTermination(10, TimeUnit.SECONDS); } catch (RuntimeException rte) { throw rte; } catch (InterruptedException ite) { EmbeddedLogger.ROOT_LOGGER.error(ite.getLocalizedMessage(), ite); Thread.currentThread().interrupt(); } catch (Exception ex) { EmbeddedLogger.ROOT_LOGGER.error(ex.getLocalizedMessage(), ex); } } if (uninstallStdIo) { try { StdioContext.uninstall(); } catch (IllegalStateException ignored) { } } SystemExiter.initialize(SystemExiter.Exiter.DEFAULT); }
Source:
public void failsOnUnsupportedAcceptHeader() throws IOException { final TkProduces produces = new TkProduces( new TkEmpty(), "text/json,application/json" ); produces.act( new RqFake( Arrays.asList( "GET /hz0", "Host: as0.example.com", "Accept: text/xml" ), "" ) ).head(); }

Target:
public void failsOnUnsupportedAcceptHeader() throws IOException { final Take produces = new TkProduces( new TkEmpty(), "text/json,application/json" ); produces.act( new RqFake( Arrays.asList( "GET /hz0", "Host: as0.example.com", "Accept: text/xml" ), "" ) ).head(); }
Source:
@Override public IgniteCache<K, V> withReadRepair() { CacheOperationGate opGate = onEnter(); try { if (context().mvccEnabled()) { throw new UnsupportedOperationException( "The TRANSACTIONAL_SNAPSHOT mode does not support the read-repair feature."); } if (context().isNear()) throw new UnsupportedOperationException("Read-repair is not supported by near caches."); if (context().readThrough()) { throw new UnsupportedOperationException("Read-repair is not supported by caches with readThrough enabled."); } if (context().isLocal()) throw new UnsupportedOperationException("Read-repair is not supported by local caches."); if (context().config().getBackups() == 0) { throw new UnsupportedOperationException("Read-repair is suitable only in case " + "at least 1 backup configured for cache."); } boolean readRepair = opCtx.readRepair(); if (readRepair) return this; return new GatewayProtectedCacheProxy<>(delegate, opCtx.setReadRepair(true), lock); } finally { onLeave(opGate); } }

Target:
@Override public IgniteCache<K, V> withReadRepair() { CacheOperationGate opGate = onEnter(); try { if (context().mvccEnabled()) { throw new UnsupportedOperationException( "The TRANSACTIONAL_SNAPSHOT mode is incompatible with the read-repair feature."); } if (context().isNear()) throw new UnsupportedOperationException("Read-repair is incompatible with near caches."); if (context().readThrough()) { throw new UnsupportedOperationException("Read-repair is incompatible with caches that use readThrough."); } if (context().isLocal()) throw new UnsupportedOperationException("Read-repair is incompatible with local caches."); if (context().config().getBackups() == 0) { throw new UnsupportedOperationException("Read-repair is suitable only in case " + "at least 1 backup configured for cache."); } boolean readRepair = opCtx.readRepair(); if (readRepair) return this; return new GatewayProtectedCacheProxy<>(delegate, opCtx.setReadRepair(true), lock); } finally { onLeave(opGate); } }
Source:
Object getPrimitiveTypeObject(PrimitiveType.PrimitiveTypeName primitiveTypeName, int field, int index, Group row, Type fieldType) { switch (primitiveTypeName) { case INT96: byte[] bytes = row.getInt96(field, index).getBytesUnsafe(); BigInteger bigInteger = new BigInteger(bytes); return bigInteger; case INT64: return row.getLong(field, index); case INT32: return row.getInteger(field, index); case BOOLEAN: return row.getBoolean(field, index); case FLOAT: return row.getFloat(field, index); case DOUBLE: return row.getDouble(field, index); case BINARY: if ("STRING".equals(fieldType.getLogicalTypeAnnotation().toString())) { return row.getBinary(field, index).toStringUsingUTF8(); } return row.getBinary(field, index); } return null; }

Target:
Object getPrimitiveTypeObject(PrimitiveType.PrimitiveTypeName primitiveTypeName, int field, int index, Group row, Type fieldType) { switch (primitiveTypeName) { case INT96: byte[] bytes = row.getInt96(field, index).getBytesUnsafe(); BigInteger bigInteger = new BigInteger(bytes); return bigInteger; case INT64: return row.getLong(field, index); case INT32: return row.getInteger(field, index); case BOOLEAN: return row.getBoolean(field, index); case FLOAT: return row.getFloat(field, index); case DOUBLE: return row.getDouble(field, index); case BINARY: if ("STRING".equals(fieldType.getLogicalTypeAnnotation().toString())) { return row.getBinary(field, index).toStringUsingUTF8(); } bytes = row.getBinary(field, index).getBytesUnsafe(); return bytes; case FIXED_LEN_BYTE_ARRAY: bytes = row.getBinary(field, index).getBytesUnsafe(); return bytes; } return null; }
Source:
public List<String> getCountries(String startsWith) { String[] countries = Locale.getISOCountries(); if(startsWith == null) { return Arrays.asList(countries); } startsWith = startsWith.toLowerCase(); ArrayList<String> result = new ArrayList(countries.length); for(String country : countries) { if(country.toLowerCase().startsWith(startsWith)) result.add(country); } return result; }

Target:
public List<String> getCountries(String startsWith) { if (startsWith == null) { return Arrays.stream(Locale.getISOCountries()).collect(Collectors.toList()); } final String startsWithLowered = startsWith.toLowerCase(); return Arrays.stream(Locale.getISOCountries()) .filter(country -> matchCountry(country, startsWithLowered)) .collect(Collectors.toList()); }
Source:
public boolean validateBillingFrequency(ContractsAndGrantsBillingAward award) { String awardInvoiceOption = award.getInvoicingOptionCode(); Date lastBilledDateToUse; if (StringUtils.equals(awardInvoiceOption, ArConstants.INV_CONTRACT_CONTROL_ACCOUNT) || StringUtils.equals(awardInvoiceOption, ArConstants.INV_ACCOUNT)) { lastBilledDateToUse = award.getActiveAwardAccounts().get(0).getCurrentLastBilledDate(); } else { lastBilledDateToUse = award.getLastBilledDate(); } return validateBillingFrequency(award, lastBilledDateToUse); }

Target:
public boolean validateBillingFrequency(ContractsAndGrantsBillingAward award) { String awardInvoiceOption = award.getInvoicingOptionCode(); Date lastBilledDateToUse; if (StringUtils.equals(awardInvoiceOption, ArConstants.INV_CONTRACT_CONTROL_ACCOUNT) || StringUtils.equals(awardInvoiceOption, ArConstants.INV_ACCOUNT)) { if (CollectionUtils.isNotEmpty(award.getActiveAwardAccounts())) { lastBilledDateToUse = award.getActiveAwardAccounts().get(0).getCurrentLastBilledDate(); } else { LOG.error("validateBillingFrequency: NO active award accounts on Award with invoice option of Account or Contract Control Account. Award lastBilledDate being used for CINV creation."); lastBilledDateToUse = award.getLastBilledDate(); } } else { lastBilledDateToUse = award.getLastBilledDate(); } return validateBillingFrequency(award, lastBilledDateToUse); }
Source:
public void set( long index, byte[] value ) { assert value.length == entrySize; long pageId = pageId( index ); int offset = offset( index ); try ( PageCursor cursor = pagedFile.io( pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW ); ) { cursor.next(); for ( int i = 0; i < value.length; i++ ) { cursor.putByte( offset + i, value[i] ); } checkBounds( cursor ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }

Target:
public void set( long index, byte[] value ) { assert value.length == entrySize; long pageId = pageId( index ); int offset = offset( index ); try ( PageCursor cursor = pagedFile.io( pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW ) ) { cursor.next(); for ( int i = 0; i < value.length; i++ ) { cursor.putByte( offset + i, value[i] ); } checkBounds( cursor ); } catch ( IOException e ) { throw new UncheckedIOException( e ); } }
Source:
public InternalPushConnection(PackTransport transport, final ReceivePackFactory<C> receivePackFactory, final C req, final Repository remote) throws TransportException { super(transport); final PipedInputStream in_r; final PipedOutputStream in_w; final PipedInputStream out_r; final PipedOutputStream out_w; try { in_r = new PipedInputStream(); in_w = new PipedOutputStream(in_r); out_r = new PipedInputStream(); out_w = new PipedOutputStream(out_r); } catch (IOException err) { remote.close(); throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } worker = new Thread("JGit-Receive-Pack") { @Override public void run() { try { final ReceivePack rp = receivePackFactory.create(req, remote); rp.receive(out_r, in_w, System.err); } catch (ServiceNotEnabledException e) { } catch (ServiceNotAuthorizedException e) { } catch (IOException e) { throw new RuntimeException(e); } finally { try { out_r.close(); } catch (IOException e2) { } try { in_w.close(); } catch (IOException e2) { } remote.close(); } } }; worker.start(); init(in_r, out_w); readAdvertisedRefs(); }

Target:
public InternalPushConnection(PackTransport transport, final ReceivePackFactory<C> receivePackFactory, final C req, final Repository remote) throws TransportException { super(transport); final PipedInputStream in_r; final PipedOutputStream in_w; final PipedInputStream out_r; final PipedOutputStream out_w; try { in_r = new PipedInputStream(); in_w = new PipedOutputStream(in_r); out_r = new PipedInputStream(); out_w = new PipedOutputStream(out_r); } catch (IOException err) { remote.close(); throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } worker = new Thread("JGit-Receive-Pack") { @Override public void run() { try { final ReceivePack rp = receivePackFactory.create(req, remote); rp.receive(out_r, in_w, System.err); } catch (ServiceNotEnabledException e) { } catch (ServiceNotAuthorizedException e) { } catch (IOException e) { throw new UncheckedIOException(e); } finally { try { out_r.close(); } catch (IOException e2) { } try { in_w.close(); } catch (IOException e2) { } remote.close(); } } }; worker.start(); init(in_r, out_w); readAdvertisedRefs(); }
Source:
public <T> T construct(Class<T> componentType) { if (!configuration.getCacheMode().isClustered()) return null; if (globalConfiguration.getTransportClass() == null) throw new IllegalStateException("Transport should be configured in order to use clustered caches"); return super.construct(componentType); }

Target:
public <T> T construct(Class<T> componentType) { if (!configuration.getCacheMode().isClustered()) return null; if (globalConfiguration.getTransportClass() == null) throw new ConfigurationException("Transport should be configured in order to use clustered caches"); return super.construct(componentType); }
Source:
private Map<Guid, GlusterAsyncTask> updateTasksInCluster(VDSGroup cluster) { if (!supportsGlusterAsyncTasksFeature(cluster)) { return null; } Map<Guid, GlusterAsyncTask> runningTasks = getProvider().getTaskListForCluster(cluster.getId()); if (runningTasks == null) { return null; } Iterator<Entry<Guid, GlusterAsyncTask>> iter = runningTasks.entrySet().iterator(); while (iter.hasNext()) { Entry<Guid, GlusterAsyncTask> entry = iter.next(); Guid taskId = entry.getKey(); GlusterAsyncTask task = entry.getValue(); List<Step> steps = getStepDao().getStepsByExternalId(taskId); for (Step step: steps) { if (step.getEndTime() != null) { continue; } step.setDescription(getTaskMessage(cluster,step,task)); if (hasTaskCompleted(task)) { step.markStepEnded(task.getStatus()); endStepJob(step); releaseVolumeLock(task.getTaskId()); } else { getJobRepository().updateStep(step); } } } return runningTasks; }

Target:
private Map<Guid, GlusterAsyncTask> updateTasksInCluster(VDSGroup cluster) { if (!supportsGlusterAsyncTasksFeature(cluster)) { return null; } Map<Guid, GlusterAsyncTask> runningTasks = getProvider().getTaskListForCluster(cluster.getId()); if (runningTasks == null) { return null; } for (Entry<Guid, GlusterAsyncTask> entry : runningTasks.entrySet()) { Guid taskId = entry.getKey(); GlusterAsyncTask task = entry.getValue(); List<Step> steps = getStepDao().getStepsByExternalId(taskId); for (Step step: steps) { if (step.getEndTime() != null) { continue; } step.setDescription(getTaskMessage(cluster,step,task)); if (hasTaskCompleted(task)) { step.markStepEnded(task.getStatus()); endStepJob(step); releaseVolumeLock(task.getTaskId()); } else { getJobRepository().updateStep(step); } } } return runningTasks; }
Source:
public void testDetermineMaxQuipHistorySize(){ assertEquals(manager.determineMaxQuipHistorySize(16),8); assertEquals(manager.determineMaxQuipHistorySize(10),5); assertEquals(manager.determineMaxQuipHistorySize(4),2); }

Target:
public void testDetermineMaxQuipHistorySize(){ assertEquals(QuipManager.determineMaxQuipHistorySize(2*QuipManager.MAXIMUM_QUIP_HISTORY_SIZE+10),QuipManager.MAXIMUM_QUIP_HISTORY_SIZE); assertEquals(QuipManager.determineMaxQuipHistorySize(2*QuipManager.MAXIMUM_QUIP_HISTORY_SIZE),QuipManager.MAXIMUM_QUIP_HISTORY_SIZE); assertEquals(QuipManager.determineMaxQuipHistorySize(2*QuipManager.MAXIMUM_QUIP_HISTORY_SIZE-1),QuipManager.MAXIMUM_QUIP_HISTORY_SIZE-1); assertEquals(QuipManager.determineMaxQuipHistorySize(QuipManager.MAXIMUM_QUIP_HISTORY_SIZE),(int)(QuipManager.MAXIMUM_QUIP_HISTORY_SIZE*QuipManager.MAXIMUM_QUIP_HISTORY_PERCENT)); assertEquals(QuipManager.determineMaxQuipHistorySize(0),0); }
Source:
public Person(String name, Campaign c, String factionCode) { this.name = name; callsign = ""; portraitCategory = Crew.ROOT_PORTRAIT; portraitFile = Crew.PORTRAIT_NONE; portraitCategoryOverride = null; portraitFileOverride = null; xp = 0; acquisitions = 0; gender = G_MALE; birthday = new GregorianCalendar(3042, Calendar.JANUARY, 1); rank = 0; rankLevel = 0; status = S_ACTIVE; hits = 0; skills = new Hashtable<String, Skill>(); salary = -1; campaign = c; doctorId = null; unitId = null; oldDoctorId = -1; oldUnitId = -1; toughness = 0; biography = ""; nTasks = 0; personnelLog = new ArrayList<LogEntry>(); awards = new ArrayList<Award>(); idleMonths = -1; daysToWaitForHealing = 15; resetMinutesLeft(); prisonerStatus = PRISONER_NOT; dependent = false; commander = false; isClanTech = false; techUnitIds = new ArrayList<UUID>(); salary = -1; phenotype = PHENOTYPE_NONE; clan = Faction.getFaction(factionCode).isClan(); bloodname = ""; primaryDesignator = DESIG_NONE; secondaryDesignator = DESIG_NONE; awardsFactory = AwardsFactory.getInstance(); }

Target:
public Person(String name, Campaign c, String factionCode) { this.name = name; callsign = ""; portraitCategory = Crew.ROOT_PORTRAIT; portraitFile = Crew.PORTRAIT_NONE; portraitCategoryOverride = null; portraitFileOverride = null; xp = 0; acquisitions = 0; gender = G_MALE; birthday = new GregorianCalendar(3042, Calendar.JANUARY, 1); rank = 0; rankLevel = 0; status = S_ACTIVE; hits = 0; skills = new Hashtable<String, Skill>(); salary = -1; campaign = c; doctorId = null; unitId = null; oldDoctorId = -1; oldUnitId = -1; toughness = 0; biography = ""; nTasks = 0; personnelLog = new ArrayList<LogEntry>(); awards = new ArrayList<Award>(); idleMonths = -1; daysToWaitForHealing = 15; resetMinutesLeft(); prisonerStatus = PRISONER_NOT; dependent = false; commander = false; isClanTech = false; techUnitIds = new ArrayList<UUID>(); salary = -1; phenotype = PHENOTYPE_NONE; clan = Faction.getFaction(factionCode).isClan(); bloodname = ""; primaryDesignator = DESIG_NONE; secondaryDesignator = DESIG_NONE; }
Source:
private void addOrUpdateAddtionalClusterFeatures() { Set<SupportedAdditionalClusterFeature> supportedFeatures = clusterFeatureDao.getSupportedFeaturesByClusterId(getVdsGroup().getId()); supportedFeatures.removeAll(getVdsGroup().getAddtionalFeaturesSupported()); if (!supportedFeatures.isEmpty()) { for (SupportedAdditionalClusterFeature feature : supportedFeatures) { if (feature.isEnabled()) { feature.setEnabled(false); clusterFeatureDao.updateSupportedClusterFeature(feature); } } } Set<SupportedAdditionalClusterFeature> additionalClusterFeaturesAdded = getAdditionalClusterFeaturesAdded(); if (CollectionUtils.isNotEmpty(additionalClusterFeaturesAdded)) { clusterFeatureDao.addAllSupportedClusterFeature(additionalClusterFeaturesAdded); } }

Target:
private void addOrUpdateAddtionalClusterFeatures() { Set<SupportedAdditionalClusterFeature> supportedFeatures = clusterFeatureDao.getSupportedFeaturesByClusterId(getVdsGroup().getId()); supportedFeatures.removeAll(getVdsGroup().getAddtionalFeaturesSupported()); for (SupportedAdditionalClusterFeature feature : supportedFeatures) { if (feature.isEnabled()) { feature.setEnabled(false); clusterFeatureDao.updateSupportedClusterFeature(feature); } } Set<SupportedAdditionalClusterFeature> additionalClusterFeaturesAdded = getAdditionalClusterFeaturesAdded(); if (CollectionUtils.isNotEmpty(additionalClusterFeaturesAdded)) { clusterFeatureDao.addAllSupportedClusterFeature(additionalClusterFeaturesAdded); } }