auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void checkIfHit() { if (!spaceship.defeated()) { int hit = spaceship.ifHit(alienBullets); if (hit != -1) { alienBullets.removeElementAt(hit); } } else { end(); } Iterator iteralien = ConcreteAggregate.createIterator(aliens); while (iteralien.hasNext()) { Alien alien = (Alien) iteralien.next(); int hit = alien.ifHit(shipBullets); if (hit != -1) { if (alien.defeated()) { score = alien.addScore(score); aliens.removeElementAt(iteralien.position()); } shipBullets.removeElementAt(hit); } } Iterator iterbarrier = ConcreteAggregate.createIterator(barriers); while (iterbarrier.hasNext()) { Barrier barrier = (Barrier) iterbarrier.next(); int hit = barrier.ifHit(alienBullets); if (hit != -1) { alienBullets.removeElementAt(hit); if (barrier.destroyed()) { barriers.removeElementAt(iterbarrier.position()); } } } }

Target:
public void checkIfHit() { if (!spaceship.defeated()) { int hit = spaceship.ifHit(alienBullets); if (hit != -1) { alienBullets.removeElementAt(hit); } } else { end(); } Iterator iterAliens = ConcreteAggregate.createIterator(aliens); synchronized (aliens) { while (iterAliens.hasNext()) { Alien alien = (Alien) iterAliens.next(); int hit = alien.ifHit(shipBullets); if (hit != -1) { if (alien.defeated()) { score = alien.addScore(score); aliens.removeElementAt(iterAliens.position()); } shipBullets.removeElementAt(hit); } } } Iterator iterBarriers = ConcreteAggregate.createIterator(barriers); while (iterBarriers.hasNext()) { Barrier barrier = (Barrier) iterBarriers.next(); int hit = barrier.ifHit(alienBullets); if (hit != -1) { alienBullets.removeElementAt(hit); if (barrier.destroyed()) { barriers.removeElementAt(iterBarriers.position()); } } } }
Source:
protected Object evaluateLiteralExpression(String className, String value, ClassLoader classLoader) { throw new IllegalStateException(toString() + " operator cannot be used into a Given clause"); }

Target:
protected Object evaluateLiteralExpression(String className, String value, ClassLoader classLoader) { throw new IllegalStateException(toString() + " operator cannot be used in a GIVEN clause"); }
Source:
private static String encodeParameters(Map<String, String> map) { StringBuilder dataStringBuilder = new StringBuilder(); map.forEach((key, value) -> { dataStringBuilder.append(key + "=" + SanitizationHelper.sanitizeForUri(value) + "&"); }); return dataStringBuilder.toString(); }

Target:
private static String encodeParameters(Map<String, String> map) { StringBuilder dataStringBuilder = new StringBuilder(); map.forEach((key, value) -> dataStringBuilder.append(key + "=" + SanitizationHelper.sanitizeForUri(value) + "&")); return dataStringBuilder.toString(); }
Source:
protected Histogram<Integer> getUnfilteredDepthHistogram(){ return getHistogram(unfilteredDepthHistogramArray, "coverage", "count"); }

Target:
protected Histogram<Integer> getUnfilteredDepthHistogram(){ return getHistogram(unfilteredDepthHistogramArray, "coverage", "unfiltered_coverage_count"); }
Source:
private void updateMemoryBrowserView(final Object context, final IMemoryBlockRetrieval retrieval, final ILaunch launch) { if (retrieval != null && launch != null && !launch.isTerminated()) { if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { String[] memorySpaces={}; if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { ((IMemorySpaceAwareMemoryBlockRetrieval)retrieval).getMemorySpaces(context, new GetMemorySpacesRequest() { public void done() { updateTab(retrieval, context, isSuccess() ? getMemorySpaces() : new String[0]); if (fLaunching && launch != null) { ILaunchConfiguration launchConfig = launch .getLaunchConfiguration(); try { String attr = ATTR_MEMORY_TABS; String secondaryId = ((IViewSite)getSite()) .getSecondaryId(); if (secondaryId != null) { attr = attr + "." + secondaryId; } String memento = launchConfig.getAttribute(attr, ""); if (memento != null && memento.length() != 0) { createMemoryTabsFromMemento(memento, context); } fLaunching = false; } catch (Exception e) { } } } }); } updateTab(retrieval, context, memorySpaces); } else { updateTab(retrieval, context, new String[0]); } } else { fUnsupportedLabel.setText(""); handleUnsupportedSelection(); } }

Target:
private void updateMemoryBrowserView(final Object context, final IMemoryBlockRetrieval retrieval, final ILaunch launch) { if (retrieval != null && launch != null && !launch.isTerminated()) { if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { boolean suspended = false; if(context instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) context; IDMContext dmc = (IDMContext) adaptable.getAdapter(IDMContext.class); if (dmc != null) { IExecutionDMContext edmc = DMContexts.getAncestorOfType(dmc, IExecutionDMContext.class); if (edmc != null) { DsfServicesTracker tracker = new DsfServicesTracker(MemoryBrowserPlugin.getBundleContext(), dmc.getSessionId()); IRunControl rc = (IRunControl) tracker.getService(IRunControl.class); if (rc != null && rc.isSuspended(edmc)) { suspended = true; } tracker.dispose(); } } } boolean launching = false; if (suspended) { try { launching = launch.getLaunchConfiguration().getAttribute(ATTR_LAUNCHING, false); } catch (CoreException e1) { MemoryBrowserPlugin.getDefault().getLog().log(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID, "Could not get the launching attribute", e1)); } } if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { final boolean finalLaunching = launching; ((IMemorySpaceAwareMemoryBlockRetrieval)retrieval).getMemorySpaces(context, new GetMemorySpacesRequest() { public void done() { updateTab(retrieval, context, isSuccess() ? getMemorySpaces() : new String[0]); if (finalLaunching && launch != null) { loadMemoryTabs(launch, context); } } }); } else { updateTab(retrieval, context, new String[0]); if (launching && launch != null) { loadMemoryTabs(launch, context); } } } else { updateTab(retrieval, context, new String[0]); } } else { fUnsupportedLabel.setText(""); handleUnsupportedSelection(); } }
Source:
protected SftpFileSystem(final GenericFileName rootName, final Session session, final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); this.session = Objects.requireNonNull(session, "session"); this.connectTimeoutMillis = SftpFileSystemConfigBuilder.getInstance() .getConnectTimeoutMillis(fileSystemOptions); detectExecDisabled(); }

Target:
protected SftpFileSystem(final GenericFileName rootName, final Session session, final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); this.session = Objects.requireNonNull(session, "session"); this.connectTimeoutMillis = SftpFileSystemConfigBuilder.getInstance() .getConnectTimeoutMillis(fileSystemOptions); this.execDisabled = detectExecDisabled(); }
Source:
private Collection<RefRight> getWildProjectRights() { final ProjectState s = projectCache.get(wildProject.getNameKey()); return s != null ? s.getLocalRights() : Collections.<RefRight> emptyList(); }

Target:
private Collection<RefRight> getWildProjectRights() { final ProjectState s = projectCache.get(wildProject.getId()); return s != null ? s.getLocalRights() : Collections.<RefRight> emptyList(); }
Source:
private ValidationResult validateSnapshotsLegality() { Optional<Snapshot> snapshot = getSnapshotDao().getSnapshotsByImageStatus(getVmId(), ImageStatus.ILLEGAL).stream().findFirst(); if (snapshot.isPresent() && !snapshot.get().getId().equals(getParameters().getSnapshotId())) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_SNAPSHOT_WITH_ILLEGAL_VOLUME_EXISTS, String.format("$snapshot %s", snapshot.get().getDescription())); } return ValidationResult.VALID; }

Target:
private ValidationResult validateSnapshotsLegality() { List<DiskImage> diskImages = getDiskImageDao().getAllSnapshotsForVmSnapshot(getParameters().getSnapshotId()); if (diskImages.stream().filter(img -> img.getImageStatus() == ImageStatus.ILLEGAL).findAny().isPresent()) { return ValidationResult.VALID; } List<Guid> otherSnapshotsId = getSnapshotDao().getAll(getVmId()). stream(). map(Snapshot::getId). filter(id -> !id.equals(getParameters().getSnapshotId())). collect(Collectors.toList()); for (Guid snapshotId : otherSnapshotsId) { diskImages = getDiskImageDao().getAllSnapshotsForVmSnapshot(snapshotId); if (diskImages.stream().filter(img -> img.getImageStatus() == ImageStatus.ILLEGAL).findAny().isPresent()) { return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_VM_SNAPSHOT_WITH_ILLEGAL_VOLUME_EXISTS, String.format("$snapshot %s", getSnapshotDao().get(getParameters().getSnapshotId()).getDescription())); } } return ValidationResult.VALID; }
Source:
public void runCommand(String[] args, boolean tsqlMode) throws Exception { CommandLineParser parser = new PosixParser(); if (args.length == 0) { printUsage(tsqlMode); return; } CommandLine cmd = parser.parse(options, args); String hostName = null; Integer port = null; if (cmd.hasOption("h")) { hostName = cmd.getOptionValue("h"); } if (cmd.hasOption("p")) { port = Integer.parseInt(cmd.getOptionValue("p")); } String param; if (cmd.getArgs().length > 1) { printUsage(tsqlMode); return; } else { param = cmd.getArgs()[0]; } if(hostName == null) { if (tajoConf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS) != null) { hostName = tajoConf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS).split(":")[0]; } } if (port == null) { if (tajoConf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS) != null) { port = Integer.parseInt(tajoConf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS).split(":")[1]); } } if ((hostName == null) ^ (port == null)) { return; } else if (hostName != null && port != null) { tajoConf.setVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS, hostName + ":" + port); tajoClient = new TajoClientImpl(ServiceTrackerFactory.get(tajoConf)); } else if (hostName == null && port == null) { tajoClient = new TajoClientImpl(ServiceTrackerFactory.get(tajoConf)); } if (!tajoClient.isConnected()) { System.out.println("ERROR: cannot connect Tajo server"); } processConfKey(writer, param); writer.flush(); }

Target:
public void runCommand(String[] args, boolean tsqlMode) throws Exception { CommandLineParser parser = new PosixParser(); if (args.length == 0) { printUsage(tsqlMode); return; } CommandLine cmd = parser.parse(options, args); String hostName = null; Integer port = null; if (cmd.hasOption("h")) { hostName = cmd.getOptionValue("h"); } if (cmd.hasOption("p")) { port = Integer.parseInt(cmd.getOptionValue("p")); } String param; if (cmd.getArgs().length > 1) { printUsage(tsqlMode); return; } else { param = cmd.getArgs()[0]; } if(hostName == null) { if (tajoConf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS) != null) { hostName = tajoConf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS).split(":")[0]; } } if (port == null) { if (tajoConf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS) != null) { port = Integer.parseInt(tajoConf.getVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS).split(":")[1]); } } if ((hostName == null) ^ (port == null)) { return; } else if (hostName != null && port != null) { tajoConf.setVar(TajoConf.ConfVars.TAJO_MASTER_CLIENT_RPC_ADDRESS, hostName + ":" + port); } processConfKey(writer, param); writer.flush(); }
Source:
void fetchPDF() throws IOException, FetcherException { Optional<URL> url = fetcher.findFullText(bibEntry); assertTrue(url.isPresent()); assertEquals(new URL("<LINK_0>"), url.get()); }

Target:
void fetchPDF() throws IOException, FetcherException { Optional<URL> url = fetcher.findFullText(bibEntry); assertEquals(Optional.of(new URL("<LINK_0>")), url); }
Source:
private List<String> getAllPathAncestors(final String path) { final List<String> segments = asList(path.split("/")); return range(1, segments.size()).boxed() .map(frameSize -> FEDORA_INTERNAL_PREFIX + "/" + String.join("/", segments.subList(1, frameSize))) .collect(toList()); }

Target:
private static List<String> getAllPathAncestors(final String path) { final List<String> segments = asList(path.split("/")); return range(1, segments.size()) .mapToObj(frameSize -> FEDORA_INTERNAL_PREFIX + "/" + String.join("/", segments.subList(1, frameSize))) .collect(toList()); }
Source:
public ParameterWorkerMetrics buildParameterWorkerMetrics() { throw new UnsupportedOperationException(); }

Target:
public ParameterWorkerMetrics buildParameterWorkerMetrics() { throw new UnsupportedOperationException("SSP version of parameter worker currently does not support metrics."); }
Source:
public void handle(HttpExchange exchange) throws IOException { long t1 = System.currentTimeMillis(); DataInputStream din = new DataInputStream(exchange.getRequestBody()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(bout); String path = exchange.getRequestURI().getPath(); if (path.startsWith("/")) path = path.substring(1); String[] subComponents = path.substring(SOCIAL_URL.length()).split("/"); String method = subComponents[0]; try { switch (method) { case "followRequest": followRequest(din, dout); break; case "getFollowRequests": getFollowRequests(din, dout); break; case "removeFollowRequest": removeFollowRequest(din, dout); break; default: throw new IOException("Unknown method "+ method); } dout.flush(); dout.close(); byte[] b = bout.toByteArray(); exchange.sendResponseHeaders(200, b.length); exchange.getResponseBody().write(b); } catch (Exception e) { Throwable cause = e.getCause(); if (cause != null) exchange.getResponseHeaders().set("Trailer", cause.getMessage()); else exchange.getResponseHeaders().set("Trailer", e.getMessage()); exchange.sendResponseHeaders(400, 0); } finally { exchange.close(); long t2 = System.currentTimeMillis(); if (LOGGING) System.out.println("Corenode server handled " + method + " request in: " + (t2 - t1) + " mS"); } }

Target:
public void handle(HttpExchange exchange) throws IOException { long t1 = System.currentTimeMillis(); DataInputStream din = new DataInputStream(exchange.getRequestBody()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(bout); String path = exchange.getRequestURI().getPath(); if (path.startsWith("/")) path = path.substring(1); String[] subComponents = path.substring(SOCIAL_URL.length()).split("/"); String method = subComponents[0]; try { switch (method) { case "followRequest": followRequest(din, dout); break; case "getFollowRequests": getFollowRequests(din, dout); break; case "removeFollowRequest": removeFollowRequest(din, dout); break; default: throw new IOException("Unknown method "+ method); } dout.flush(); dout.close(); byte[] b = bout.toByteArray(); exchange.sendResponseHeaders(200, b.length); exchange.getResponseBody().write(b); } catch (Exception e) { Throwable cause = e.getCause(); if (cause != null) exchange.getResponseHeaders().set("Trailer", cause.getMessage()); else exchange.getResponseHeaders().set("Trailer", e.getMessage()); exchange.sendResponseHeaders(400, 0); } finally { exchange.close(); long t2 = System.currentTimeMillis(); if (LOGGING) System.out.println("Social Network server handled " + method + " request in: " + (t2 - t1) + " mS"); } }
Source:
public void run() { if (!directory.isDirectory() && !directory.mkdirs()) { GlowServer.logger .log(Level.SEVERE, "Could not create libraries directory: " + directory); } downloaderService.execute(new LibraryDownloader( "org.xerial", "sqlite-jdbc", "3.21.0", "347e4d1d3e1dff66d389354af8f0021e62344584", DEFAULT_HASH_ALGORITHM)); downloaderService.execute(new LibraryDownloader( "mysql", "mysql-connector-java", "5.1.44", "61b6b998192c85bb581c6be90e03dcd4b9079db4", DEFAULT_HASH_ALGORITHM)); downloaderService.execute(new LibraryDownloader( "org.apache.logging.log4j", "log4j-api", "2.8.1", "e801d13612e22cad62a3f4f3fe7fdbe6334a8e72", DEFAULT_HASH_ALGORITHM)); downloaderService.execute(new LibraryDownloader( "org.apache.logging.log4j", "log4j-core", "2.8.1", "4ac28ff2f1ddf05dae3043a190451e8c46b73c31", DEFAULT_HASH_ALGORITHM)); downloaderService.execute(new LibraryDownloader( "org.apache.commons", "commons-lang3", "3.5", "6c6c702c89bfff3cd9e80b04d668c5e190d588c6", DEFAULT_HASH_ALGORITHM)); downloaderService.shutdown(); try { if (!downloaderService.awaitTermination(1, TimeUnit.MINUTES)) { downloaderService.shutdownNow(); } } catch (InterruptedException e) { GlowServer.logger.log(Level.SEVERE, "Library Manager thread interrupted: ", e); } }

Target:
public void run() { if (!directory.isDirectory() && !directory.mkdirs()) { GlowServer.logger .log(Level.SEVERE, "Could not create libraries directory: " + directory); } downloaderService.execute(new LibraryDownloader( "org.xerial", "sqlite-jdbc", "3.21.0", "347e4d1d3e1dff66d389354af8f0021e62344584", HashAlgorithm.SHA1)); downloaderService.execute(new LibraryDownloader( "mysql", "mysql-connector-java", "5.1.44", "61b6b998192c85bb581c6be90e03dcd4b9079db4", HashAlgorithm.SHA1)); downloaderService.execute(new LibraryDownloader( "org.apache.logging.log4j", "log4j-api", "2.8.1", "e801d13612e22cad62a3f4f3fe7fdbe6334a8e72", HashAlgorithm.SHA1)); downloaderService.execute(new LibraryDownloader( "org.apache.logging.log4j", "log4j-core", "2.8.1", "4ac28ff2f1ddf05dae3043a190451e8c46b73c31", HashAlgorithm.SHA1)); downloaderService.execute(new LibraryDownloader( "org.apache.commons", "commons-lang3", "3.5", "6c6c702c89bfff3cd9e80b04d668c5e190d588c6", HashAlgorithm.SHA1)); downloaderService.shutdown(); try { if (!downloaderService.awaitTermination(1, TimeUnit.MINUTES)) { downloaderService.shutdownNow(); } } catch (InterruptedException e) { GlowServer.logger.log(Level.SEVERE, "Library Manager thread interrupted: ", e); } }
Source:
protected StreamTaskListener createListener() { File f = getLogFile(); if (!f.getParentFile().isDirectory()) { if (!f.getParentFile().mkdirs()) { logger.log(getErrorLoggingLevel(), "Could not create directory {0}", f.getParentFile()); } } if (f.isFile()) { if ((lastRotateMillis + logRotateMillis < System.currentTimeMillis()) || (logRotateSize > 0 && f.length() > logRotateSize)) { lastRotateMillis = System.currentTimeMillis(); File p = null; for (int i = 5; i >= 0; i--) { File o = i == 0 ? f : new File(f.getParentFile(), f.getName() + "." + i); if (o.isFile()) { if (p != null && !p.exists()) { if (!o.renameTo(p)) { logger.log(getErrorLoggingLevel(), "Could not rotate log files {0} to {1}", new Object[]{o, p}); } } else { if (!o.delete()) { logger.log(getErrorLoggingLevel(), "Could not delete log file {0} to enable rotation", o); } } } p = o; } } } else { lastRotateMillis = System.currentTimeMillis(); File oldFile = new File(Jenkins.getActiveInstance().getRootDir(), f.getName()); if (oldFile.isFile()) { File newFile = new File(f.getParentFile(), f.getName() + ".1"); if (!newFile.isFile()) { if (oldFile.renameTo(newFile)) { logger.log(getNormalLoggingLevel(), "Moved {0} to {1}.1", new Object[]{oldFile, f}); } else { logger.log(getErrorLoggingLevel(), "Could not move {0} to {1}.1", new Object[]{oldFile, f}); } } } } try { return new StreamTaskListener(f, true, null); } catch (IOException e) { throw new Error(e); } }

Target:
protected StreamTaskListener createListener() { File f = getLogFile(); if (!f.getParentFile().isDirectory()) { if (!f.getParentFile().mkdirs()) { logger.log(getErrorLoggingLevel(), "Could not create directory {0}", f.getParentFile()); } } if (f.isFile()) { if ((lastRotateMillis + logRotateMillis < System.currentTimeMillis()) || (logRotateSize > 0 && f.length() > logRotateSize)) { lastRotateMillis = System.currentTimeMillis(); File prev = null; for (int i = 5; i >= 0; i--) { File curr = i == 0 ? f : new File(f.getParentFile(), f.getName() + "." + i); if (curr.isFile()) { if (prev != null && !prev.exists()) { if (!curr.renameTo(prev)) { logger.log(getErrorLoggingLevel(), "Could not rotate log files {0} to {1}", new Object[]{curr, prev}); } } else { if (!curr.delete()) { logger.log(getErrorLoggingLevel(), "Could not delete log file {0} to enable rotation", curr); } } } prev = curr; } } } else { lastRotateMillis = System.currentTimeMillis(); File oldFile = new File(Jenkins.getActiveInstance().getRootDir(), f.getName()); if (oldFile.isFile()) { File newFile = new File(f.getParentFile(), f.getName() + ".1"); if (!newFile.isFile()) { if (oldFile.renameTo(newFile)) { logger.log(getNormalLoggingLevel(), "Moved {0} to {1}", new Object[]{oldFile, newFile}); } else { logger.log(getErrorLoggingLevel(), "Could not move {0} to {1}", new Object[]{oldFile, newFile}); } } } } try { return new StreamTaskListener(f, true, null); } catch (IOException e) { throw new Error(e); } }
Source:
public void size_rolling_policy_has_large_max_files_if_property_is_zero() throws IOException { File logDir = temporaryFolder.newFolder(); String logPattern = "foo"; String sizePattern = "1KB"; Log4JPropertiesBuilder underTest = newLog4JPropertiesBuilder( ROLLING_POLICY_PROPERTY, "size:" +sizePattern, PROPERTY_MAX_FILES, "0"); underTest.configureGlobalFileLog(esRootLoggerConfig, logDir, logPattern); verifySizeRollingPolicy(underTest, logDir, logPattern, sizePattern, 100_000); }

Target:
public void size_rolling_policy_has_large_max_files_if_property_is_zero() throws Exception { File logDir = temporaryFolder.newFolder(); String logPattern = "foo"; String sizePattern = "1KB"; Log4JPropertiesBuilder underTest = newLog4JPropertiesBuilder( ROLLING_POLICY_PROPERTY, "size:" + sizePattern, PROPERTY_MAX_FILES, "0"); underTest.configureGlobalFileLog(esRootLoggerConfig, logDir, logPattern); verifySizeRollingPolicy(underTest, logDir, logPattern, sizePattern, 100_000); }
Source:
protected void initWidget(IsWidget widget) { this.widget = Widget.asWidgetOrNull(widget); }

Target:
protected void initWidget(IsWidget widget) { if (widget == null) { throw new NullPointerException("Widget cannot be null."); } this.widget = widget.asWidget(); }
Source:
public static List<KiePMMLModel> getModels(final KieBase knowledgeBase) { logger.trace("getModels {}", knowledgeBase); List<KiePMMLModel> models = new ArrayList<>(); knowledgeBase.getKiePackages().forEach(kpkg -> { PMMLPackage pmmlPackage = (PMMLPackage) ((InternalKnowledgePackage) kpkg).getResourceTypePackages().get(ResourceType.PMML); if (pmmlPackage != null) { models.addAll(pmmlPackage.getAllModels().values()); } }); return models; }

Target:
public static List<KiePMMLModel> getModels(final KieBase knowledgeBase) { List<KiePMMLModel> models = new ArrayList<>(); knowledgeBase.getKiePackages().forEach(kpkg -> { PMMLPackage pmmlPackage = (PMMLPackage) ((InternalKnowledgePackage) kpkg).getResourceTypePackages().get(ResourceType.PMML); if (pmmlPackage != null) { models.addAll(pmmlPackage.getAllModels().values()); } }); return models; }
Source:
short getVersion() { return this.version; }

Target:
short getVersion() { return version; }
Source:
public DruidQueryGeneratorContext visitFilter(FilterNode node, DruidQueryGeneratorContext context) { context = node.getSource().accept(this, context); requireNonNull(context, "context is null"); LinkedHashMap<VariableReferenceExpression, Selection> selections = context.getSelections(); DruidFilterExpressionConverter druidFilterExpressionConverter = new DruidFilterExpressionConverter(typeManager, functionMetadataManager, standardFunctionResolution, session); String filter = node.getPredicate().accept(druidFilterExpressionConverter, selections::get).getDefinition(); return context.withFilter(filter).withOutputColumns(node.getOutputVariables()); }

Target:
public DruidQueryGeneratorContext visitFilter(FilterNode node, DruidQueryGeneratorContext context) { context = node.getSource().accept(this, context); requireNonNull(context, "context is null"); Map<VariableReferenceExpression, Selection> selections = context.getSelections(); DruidFilterExpressionConverter druidFilterExpressionConverter = new DruidFilterExpressionConverter(typeManager, functionMetadataManager, standardFunctionResolution, session); String filter = node.getPredicate().accept(druidFilterExpressionConverter, selections::get).getDefinition(); return context.withFilter(filter).withOutputColumns(node.getOutputVariables()); }
Source:
public Lazy<T> get() { return new Lazy<T>() { private final Object lock = new Object(); private volatile Object cacheValue = NOT_PRESENT; @SuppressWarnings("unchecked") @Override public T get() { if (cacheValue == NOT_PRESENT) { synchronized (lock) { if (cacheValue == NOT_PRESENT) { cacheValue = delegate.get(); } } } return (T) cacheValue; } }; }

Target:
public Lazy<T> get() { return new Lazy<T>() { private volatile Object cacheValue = NOT_PRESENT; @SuppressWarnings("unchecked") @Override public T get() { if (cacheValue == NOT_PRESENT) { synchronized (this) { if (cacheValue == NOT_PRESENT) { cacheValue = delegate.get(); } } } return (T) cacheValue; } }; }
Source:
public static boolean isJetpack(@NonNull ImmutablePluginModel plugin) { return checkNameOfPlugin(plugin, "jetpack/jetpack"); }

Target:
public static boolean isJetpack(@NonNull ImmutablePluginModel plugin) { return StringUtils.equals(plugin.getName(), JETPACK_PLUGIN_NAME); }
Source:
static ReplicationSourceInterface create(Configuration conf, String queueId, WALFactory walFactory) throws IOException { if (ReplicationSourceManager.META_REGION_REPLICA_REPLICATION_SOURCE.equals(queueId)) { return new HBaseMetaNoQueueStoreReplicationSource(walFactory == null? null: walFactory.getMetaProvider()); } ReplicationQueueInfo replicationQueueInfo = new ReplicationQueueInfo(queueId); boolean queueRecovered = replicationQueueInfo.isQueueRecovered(); String defaultReplicationSourceImpl = null; Class<?> c = null; WALProvider walProvider = walFactory == null? null: walFactory.getWALProvider(); try { defaultReplicationSourceImpl = queueRecovered? RecoveredReplicationSource.class.getCanonicalName(): ReplicationSource.class.getCanonicalName(); c = Class.forName(conf.get("replication.replicationsource.implementation", defaultReplicationSourceImpl)); return c.asSubclass(ReplicationSourceInterface.class).getDeclaredConstructor(). newInstance(walProvider); } catch (Exception e) { LOG.warn("Configured replication class failed construction, defaulting to {}", c.getName(), defaultReplicationSourceImpl, e); return queueRecovered? new RecoveredReplicationSource(walProvider): new ReplicationSource(walProvider); } }

Target:
static ReplicationSourceInterface create(Configuration conf, String queueId, WALFactory walFactory) throws IOException { if (ReplicationSourceManager.META_REGION_REPLICA_REPLICATION_SOURCE.equals(queueId)) { return new HBaseMetaNoQueueStoreReplicationSource(walFactory.getMetaProvider()); } ReplicationQueueInfo replicationQueueInfo = new ReplicationQueueInfo(queueId); boolean queueRecovered = replicationQueueInfo.isQueueRecovered(); String defaultReplicationSourceImpl = null; Class<?> c = null; try { defaultReplicationSourceImpl = queueRecovered? RecoveredReplicationSource.class.getCanonicalName(): ReplicationSource.class.getCanonicalName(); c = Class.forName(conf.get("replication.replicationsource.implementation", defaultReplicationSourceImpl)); return c.asSubclass(ReplicationSourceInterface.class).getDeclaredConstructor().newInstance(); } catch (Exception e) { LOG.warn("Configured replication class failed construction, defaulting to {}", c != null? c.getName(): "null", defaultReplicationSourceImpl, e); WALProvider walProvider = walFactory == null? null: walFactory.getWALProvider(); return queueRecovered? new RecoveredReplicationSource(walProvider): new ReplicationSource(walProvider); } }
Source:
private void clickTextboxAndCheck(int textboxIndex) { click(jq("@textbox").eq(textboxIndex)); waitResponse(); Assert.assertTrue("scrollbar position and view position should stay in sync.", jq(".z-listbox-header").scrollLeft() == jq(".z-listbox-body").scrollLeft() && jq(".z-listbox-body").scrollLeft() == jq(".z-frozen-inner").scrollLeft()); }

Target:
private void clickTextboxAndCheck(int textboxIndex) { click(jq("@textbox").eq(textboxIndex)); waitResponse(); Assert.assertEquals("head and body should stay sync.", jq(".z-listbox-header").scrollLeft(), jq(".z-listbox-body").scrollLeft()); Assert.assertEquals("scrollbar position and view position should stay sync.", jq(".z-listbox-body").scrollLeft(), jq(".z-frozen-inner").scrollLeft()); }
Source:
public static int findInColumnSortList(ColumnSortList sortList, AbstractTextColumn<?> column) { if (sortList == null || column == null) { return -1; } for (int i = 0; i < sortList.size(); i++) { ColumnSortList.ColumnSortInfo sortInfo = sortList.get(i); if (column == sortInfo.getColumn()) { return i; } } return -1; }

Target:
public static int findInColumnSortList(ColumnSortList sortList, AbstractTextColumn<?> column) { if (sortList == null || column == null) { return -1; } for (int i = 0; i < sortList.size(); i++) { ColumnSortList.ColumnSortInfo sortInfo = sortList.get(i); if (column.equals(sortInfo.getColumn())) { return i; } } return -1; }
Source:
public void verifyImageRemoval() { StoragePool pool = getStoragePoolDao().get(getParameters().getStoragePoolId()); if (pool.getStatus() != StoragePoolStatus.Up || pool.getSpmVdsId() == null) { log.info("Waiting on SPM availability to confirm image removal"); setSucceeded(true); return; } List<Guid> failedGuids = getFailedVolumeIds(pool.getSpmVdsId()); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setCommandStatus(CommandStatus.SUCCEEDED); persistCommand(getParameters().getParentCommand()); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } setSucceeded(true); }

Target:
public void verifyImageRemoval() { StoragePool pool = getStoragePoolDao().get(getParameters().getStoragePoolId()); if (pool.getStatus() != StoragePoolStatus.Up || pool.getSpmVdsId() == null) { log.info("Waiting on SPM availability to confirm image removal (timeout is minutes)", LIFETIME); setSucceeded(true); return; } List<Guid> failedGuids = getFailedVolumeIds(pool.getSpmVdsId()); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setCommandStatus(CommandStatus.SUCCEEDED); persistCommand(getParameters().getParentCommand()); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } setSucceeded(true); }
Source:
public WebSocketKieServerControllerImpl() { this.marshaller = MarshallerFactory.getMarshaller(MarshallingFormat.JSON, this.getClass().getClassLoader()); this.client = new KieServerMessageHandlerWebSocketClient((WebSocketClient client) -> { try { KieServerSetup kieServerSetup = new KieServerSetup(); CountDownLatch waitLatch = new CountDownLatch(1); ((KieServerMessageHandlerWebSocketClient) client).sendTextWithInternalHandler(serialize(serverInfo), new KieServerSetupMessageHandler(this.context, waitLatch, kieServerSetup)); boolean received = waitLatch.await(10, TimeUnit.SECONDS); if (received && kieServerSetup.getContainers() != null) { return; } } catch (Exception e) { logger.warn("Error when trying to reconnect to Web Socket server - {}", e.getMessage()); } }); }

Target:
public WebSocketKieServerControllerImpl() { this.marshaller = MarshallerFactory.getMarshaller(MarshallingFormat.JSON, this.getClass().getClassLoader()); this.client = new KieServerMessageHandlerWebSocketClient((WebSocketClient client) -> { try { ((KieServerMessageHandlerWebSocketClient) client).sendTextWithInternalHandler(serialize(serverInfo), new WebSocketKieServerControllerReconnectHandler(context)); } catch (IOException e) { logger.warn("Error when trying to reconnect to Web Socket server - {}", e.getMessage()); } }); }
Source:
private TransactionalRequestResult beginCompletingTransaction(TransactionResult transactionResult) { if (!newPartitionsInTransaction.isEmpty()) enqueueRequest(addPartitionsToTransactionHandler()); if (shouldBumpEpoch()) { return initializeTransactions(); } else { EndTxnRequest.Builder builder = new EndTxnRequest.Builder( new EndTxnRequestData() .setTransactionalId(transactionalId) .setProducerId(producerIdAndEpoch.producerId) .setProducerEpoch(producerIdAndEpoch.epoch) .setCommitted(transactionResult.id)); EndTxnHandler handler = new EndTxnHandler(builder); enqueueRequest(handler); return handler.result; } }

Target:
private TransactionalRequestResult beginCompletingTransaction(TransactionResult transactionResult) { if (!newPartitionsInTransaction.isEmpty()) enqueueRequest(addPartitionsToTransactionHandler()); if (!(lastError instanceof InvalidPidMappingException)) { EndTxnRequest.Builder builder = new EndTxnRequest.Builder( new EndTxnRequestData() .setTransactionalId(transactionalId) .setProducerId(producerIdAndEpoch.producerId) .setProducerEpoch(producerIdAndEpoch.epoch) .setCommitted(transactionResult.id)); EndTxnHandler handler = new EndTxnHandler(builder); enqueueRequest(handler); if (!shouldBumpEpoch()) { return handler.result; } } return initializeTransactions(this.producerIdAndEpoch); }
Source:
public Method getMethod() { return javaMethod; }

Target:
Method getMethod() { return javaMethod; }
Source:
private void openMainMenu() { userMenuLink.click(); info("Clicked main menu"); try { Thread.sleep(500); } catch (InterruptedException e) if (!isDropdownOpened()) { info("Couldn't open main menu. Trying again."); openMainMenu(); } }

Target:
private void openMainMenu() { userMenuLink.click(); info("Clicked main menu"); if (!mainPage.isDropdownMenuOpened()) { userMenuLink.click(); info("Clicked main menu"); if (!mainPage.isDropdownMenuOpened()) { throw new NoSuchElementException("Tried to open main menu 2 times without any success"); } } }
Source:
public Map<Integer, List<TradeOfferGenerator>> getTradeOffers(final Career career) { checkNotNull(career, "career"); checkArgument(career instanceof SpongeCareer, "Unsupported Career: %s (%s)", career.getClass().getName()); final Profession profession = checkNotNull(career.getProfession(), "profession"); checkArgument(profession instanceof SpongeProfession, "Unsupported Profession: %s (%s)", profession.getName(), profession.getClass() .getName()); final SpongeCareer spongeCareer = (SpongeCareer) career; final SpongeProfession spongeProfession = (SpongeProfession) profession; final int careerType = spongeCareer.type; final int professionType = spongeProfession.type; final ITradeList[][][][] defaultTrades = EntityVillager.DEFAULT_TRADE_LIST_MAP; if (defaultTrades == null || defaultTrades.length <= professionType) { throw new IllegalStateException("Could not find valid entry in default trade offer generators"); } final ITradeList[][][] professionTrades = defaultTrades[professionType]; if (professionTrades == null || professionTrades.length <= careerType) { throw new IllegalStateException("Could not find valid entry in profession trade offer generators " + profession.getName()); } final ITradeList[][] careerTrades = professionTrades[careerType - 1]; if (careerTrades == null) { throw new IllegalStateException("Could not find valid entry in career trade offer generators " + career.getName()); } final ImmutableMap.Builder<Integer, List<TradeOfferGenerator>> result = ImmutableMap.builder(); for (int level = 1; level < careerTrades.length + 1; level++) { final ITradeList[] levelTrades = careerTrades[level - 1]; if (levelTrades == null || levelTrades.length == 0) { continue; } final ImmutableList.Builder<TradeOfferGenerator> offers = ImmutableList.builder(); for (final Object trade : levelTrades) { offers.add((TradeOfferGenerator) trade); } result.put(level, offers.build()); } return result.build(); }

Target:
public Map<Integer, List<TradeOfferGenerator>> getTradeOffers(final Career career) { final ITradeList[][] careerTrades = getFor(career); final ImmutableMap.Builder<Integer, List<TradeOfferGenerator>> result = ImmutableMap.builder(); for (int level = 0; level < careerTrades.length; level++) { final ITradeList[] levelTrades = careerTrades[level]; if (levelTrades == null || levelTrades.length == 0) { continue; } final ImmutableList.Builder<TradeOfferGenerator> offers = ImmutableList.builder(); for (final Object trade : levelTrades) { offers.add((TradeOfferGenerator) trade); } result.put(level + 1, offers.build()); } return result.build(); }
Source:
private static Set<String> convertToString(Set<Object> collection, CommandParameter parameter) { Set<String> result = Sets.newHashSetWithExpectedSize(collection.size()); result.addAll(collection.stream().map(parameter::convertToString).collect(Collectors.toList())); return result; }

Target:
private static Set<String> convertToString(Set<Object> collection, CommandParameter parameter) { return collection.stream().map(parameter::convertToString).collect(Collectors.toCollection(HashSet::new)); }
Source:
public SqlIOConfig(String systemName, String streamName, List<String> sourceParts, Config systemConfig, TableDescriptor tableDescriptor) { HashMap<String, String> streamConfigs = new HashMap<>(systemConfig); this.source = getSourceFromSourceParts(sourceParts); this.sourceParts = sourceParts; this.systemStream = new SystemStream(systemName, streamName); this.tableDescriptor = Optional.ofNullable(tableDescriptor); this.streamId = String.format("%s-%s", systemName, streamName); samzaRelConverterName = streamConfigs.get(CFG_SAMZA_REL_CONVERTER); Validate.notEmpty(samzaRelConverterName, String.format("%s is not set or empty for system %s", CFG_SAMZA_REL_CONVERTER, systemName)); if (isRemoteTable()) { samzaRelTableKeyConverterName = streamConfigs.get(CFG_SAMZA_REL_TABLE_KEY_CONVERTER); Validate.notEmpty(samzaRelTableKeyConverterName, String.format("%s is not set or empty for system %s", CFG_SAMZA_REL_CONVERTER, systemName)); } else { samzaRelTableKeyConverterName = ""; } relSchemaProviderName = streamConfigs.get(CFG_REL_SCHEMA_PROVIDER); streamConfigs.remove(CFG_SAMZA_REL_CONVERTER); streamConfigs.remove(CFG_REL_SCHEMA_PROVIDER); if (!isRemoteTable()) { streamConfigs.put(String.format(StreamConfig.PHYSICAL_NAME_FOR_STREAM_ID(), streamId), streamName); } if (tableDescriptor != null && !isRemoteTable()) { streamConfigs.put(String.format(StreamConfig.BOOTSTRAP_FOR_STREAM_ID(), streamId), "true"); streamConfigs.put(String.format(StreamConfig.CONSUMER_OFFSET_DEFAULT_FOR_STREAM_ID(), streamId), "oldest"); } config = new MapConfig(streamConfigs); }

Target:
public SqlIOConfig(String systemName, String streamName, List<String> sourceParts, Config systemConfig, TableDescriptor tableDescriptor) { HashMap<String, String> streamConfigs = new HashMap<>(systemConfig); this.source = getSourceFromSourceParts(sourceParts); this.sourceParts = sourceParts; this.systemStream = new SystemStream(systemName, streamName); this.tableDescriptor = Optional.ofNullable(tableDescriptor); this.streamId = String.format("%s-%s", systemName, streamName); samzaRelConverterName = streamConfigs.get(CFG_SAMZA_REL_CONVERTER); Validate.notEmpty(samzaRelConverterName, String.format("%s is not set or empty for system %s", CFG_SAMZA_REL_CONVERTER, systemName)); if (isRemoteTable()) { samzaRelTableKeyConverterName = streamConfigs.get(CFG_SAMZA_REL_TABLE_KEY_CONVERTER); Validate.notEmpty(samzaRelTableKeyConverterName, String.format("%s is not set or empty for system %s", CFG_SAMZA_REL_CONVERTER, systemName)); } else { samzaRelTableKeyConverterName = ""; } relSchemaProviderName = streamConfigs.get(CFG_REL_SCHEMA_PROVIDER); streamConfigs.remove(CFG_SAMZA_REL_CONVERTER); streamConfigs.remove(CFG_REL_SCHEMA_PROVIDER); if (!isRemoteTable()) { streamConfigs.put(String.format(StreamConfig.PHYSICAL_NAME_FOR_STREAM_ID(), streamId), streamName); if (tableDescriptor != null) { streamConfigs.put(String.format(StreamConfig.BOOTSTRAP_FOR_STREAM_ID(), streamId), "true"); streamConfigs.put(String.format(StreamConfig.CONSUMER_OFFSET_DEFAULT_FOR_STREAM_ID(), streamId), "oldest"); } } config = new MapConfig(streamConfigs); }
Source:
public OutRequest(@NotNull SubChannel subChannel, @NotNull Request request) { if (subChannel == null) { throw new NullPointerException("`subChannel` cannot be null"); } if (request == null) { throw new NullPointerException("`request` cannot be null"); } this.subChannel = subChannel; this.request = request; this.future = TFuture.<V>create(request.getArgScheme()); this.retryLimit = request.getRetryLimit(); }

Target:
public OutRequest(@NotNull SubChannel subChannel, @NotNull Request request) { this.subChannel = subChannel; this.request = request; this.future = TFuture.<V>create(request.getArgScheme()); this.retryLimit = request.getRetryLimit(); }
Source:
protected Collection<Event> analyzePosition(Position position) { Device device = Context.getIdentityManager().getDeviceById(position.getDeviceId()); if (device == null || !Context.getIdentityManager().isLatestPosition(position)) { return null; } double maintenanceInterval = Context.getDeviceManager() .lookupServerDouble(device.getId(), ATTRIBUTE_MAINTENANCE_INTERVAL, 0); if (maintenanceInterval == 0) { return null; } double maintenanceStart = Context.getDeviceManager() .lookupServerDouble(device.getId(), ATTRIBUTE_MAINTENANCE_START, 0); Collection<Event> events = new ArrayList<>(); double oldTotalDistance = 0.0; double newTotalDistance = 0.0; Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId()); if (lastPosition != null && lastPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { oldTotalDistance = ((Number) lastPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); } if (position.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { newTotalDistance = ((Number) position.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); } oldTotalDistance -= maintenanceStart; newTotalDistance -= maintenanceStart; if ((long) (oldTotalDistance / maintenanceInterval) < (long) (newTotalDistance / maintenanceInterval)) { events.add(new Event(Event.TYPE_MAINTENANCE_NEED, position.getDeviceId(), position.getId())); } return events; }

Target:
protected Collection<Event> analyzePosition(Position position) { Device device = Context.getIdentityManager().getDeviceById(position.getDeviceId()); if (device == null || !Context.getIdentityManager().isLatestPosition(position)) { return null; } double maintenanceInterval = Context.getDeviceManager() .lookupServerDouble(device.getId(), ATTRIBUTE_MAINTENANCE_INTERVAL, 0); if (maintenanceInterval == 0) { return null; } double maintenanceStart = Context.getDeviceManager() .lookupServerDouble(device.getId(), ATTRIBUTE_MAINTENANCE_START, 0); Collection<Event> events = new ArrayList<>(); double oldTotalDistance = 0.0; double newTotalDistance = 0.0; Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId()); if (lastPosition != null && lastPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { oldTotalDistance = ((Number) lastPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); } if (position.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { newTotalDistance = ((Number) position.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); } oldTotalDistance -= maintenanceStart; newTotalDistance -= maintenanceStart; if ((long) (oldTotalDistance / maintenanceInterval) < (long) (newTotalDistance / maintenanceInterval)) { events.add(new Event(Event.TYPE_MAINTENANCE_NEEDED, position.getDeviceId(), position.getId())); } return events; }
Source:
private static boolean validateYearByAdult(String idCard){ System.out.print(Integer.parseInt(sdf.format(new Date())) - Integer.parseInt(idCard.substring(6,10))); if((Integer.parseInt(sdf.format(new Date())) - Integer.parseInt(idCard.substring(6,10)) >= 18)){ return true; } return false; }

Target:
private static boolean validateYearByAdult(String idCard){ if(((Integer.parseInt(sdf.format(new Date())) - Integer.parseInt(idCard.substring(6,14))) / 10000 >= 18)){ return true; } return false; }
Source:
public void getNumberOfResults() { TestSubscriber<Changes> changesTestSubscriber = new TestSubscriber<Changes>(); storIOContentResolver .observeChangesOfUri(TestItem.CONTENT_URI) .take(1) .subscribe(changesTestSubscriber); for (int i = 0; i < 8; ++i) { TestItem testItemToInsert = TestItem.create(null, "value"); contentResolver.insert(TestItem.CONTENT_URI, testItemToInsert.toContentValues()); } Integer numberOfResults = storIOContentResolver .get() .numberOfResults() .withQuery(Query.builder() .uri(TestItem.CONTENT_URI) .build()) .prepare() .executeAsBlocking(); assertThat(numberOfResults).isEqualTo(8); changesTestSubscriber.awaitTerminalEvent(60, SECONDS); changesTestSubscriber.assertNoErrors(); changesTestSubscriber.assertValue(Changes.newInstance(TestItem.CONTENT_URI)); }

Target:
public void getNumberOfResults() { TestSubscriber<Changes> changesTestSubscriber = new TestSubscriber<Changes>(); storIOContentResolver .observeChangesOfUri(TestItem.CONTENT_URI) .take(1) .subscribe(changesTestSubscriber); final int testItemsQuantity = 8; ContentValues[] contentValues = new ContentValues[testItemsQuantity]; for (int i = 0; i < testItemsQuantity; ++i) { TestItem testItemToInsert = TestItem.create(null, "value"); contentValues[i] = testItemToInsert.toContentValues(); } contentResolver.bulkInsert(TestItem.CONTENT_URI, contentValues); Integer numberOfResults = storIOContentResolver .get() .numberOfResults() .withQuery(Query.builder() .uri(TestItem.CONTENT_URI) .build()) .prepare() .executeAsBlocking(); assertThat(numberOfResults).isEqualTo(testItemsQuantity); changesTestSubscriber.awaitTerminalEvent(60, SECONDS); changesTestSubscriber.assertNoErrors(); changesTestSubscriber.assertValue(Changes.newInstance(TestItem.CONTENT_URI)); }
Source:
public List<List<ChangeInfo>> formatList2(List<List<ChangeData>> in) throws OrmException { accountLoader = accountLoaderFactory.create(has(DETAILED_ACCOUNTS)); List<List<ChangeInfo>> res = Lists.newArrayListWithCapacity(in.size()); for (List<ChangeData> changes : in) { ChangeData.ensureChangeLoaded(db, changes); if (has(ALL_REVISIONS)) { ChangeData.ensureAllPatchSetsLoaded(db, changes); } else { ChangeData.ensureCurrentPatchSetLoaded(db, changes); } ChangeData.ensureCurrentApprovalsLoaded(db, changes); res.add(toChangeInfo(changes)); } accountLoader.fill(); return res; }

Target:
public List<List<ChangeInfo>> formatList2(List<List<ChangeData>> in) throws OrmException { accountLoader = accountLoaderFactory.create(has(DETAILED_ACCOUNTS)); List<List<ChangeInfo>> res = Lists.newArrayListWithCapacity(in.size()); for (List<ChangeData> changes : in) { ChangeData.ensureChangeLoaded(db, changes); ChangeData.ensureCurrentPatchSetLoaded(db, changes); ChangeData.ensureCurrentApprovalsLoaded(db, changes); res.add(toChangeInfo(changes)); } accountLoader.fill(); return res; }
Source:
private String getApiPath(ApiDefinition apiDefinition, String objectId, String relatedEntityId) { if (apiDefinition == null) { throw new IllegalArgumentException("Api definition cannot be null"); } String urlPath = apiDefinition.getEndPoint(); if (apiDefinition.isObjectIdNeeded()) { if (objectId == null || objectId.trim().isEmpty()) { throw new IllegalArgumentException("Object ID cannot be null or empty"); } urlPath = urlPath + "/" + objectId; } String relatedEntity = apiDefinition.getRelatedEntity(); if (relatedEntity != null && relatedEntity.length() > 0) { urlPath = urlPath + "/" + relatedEntity; if (relatedEntityId != null && relatedEntityId.length() > 0) { urlPath = urlPath + "/" + relatedEntityId; } } return mambuAPIService.createUrl(urlPath); }

Target:
private String getApiPath(ApiDefinition apiDefinition, String objectId, String relatedEntityId) { if (apiDefinition == null) { throw new IllegalArgumentException("Api definition cannot be null"); } String urlPath = apiDefinition.getEndPoint(); if (apiDefinition.isObjectIdNeeded()) { if (objectId == null || objectId.trim().isEmpty()) { throw new IllegalArgumentException("Object ID cannot be null or empty"); } urlPath = urlPath + "/" + objectId; } String relatedEntity = apiDefinition.getRelatedEntity(); if (relatedEntity != null && !relatedEntity.isEmpty()) { urlPath = urlPath + "/" + relatedEntity; if (relatedEntityId != null && relatedEntityId.length() > 0) { urlPath = urlPath + "/" + relatedEntityId; } } return mambuAPIService.createUrl(urlPath); }