auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void sendKeys(String s, boolean enterAfter) { pressTime = System.currentTimeMillis(); for (char c : s.toCharArray()) { for (KeyEvent ke : createKeyClick(component, c)) { try { Thread.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } sendKeyEvent(ke); } } if (enterAfter) { clickKey(10); } }

Target:
public void sendKeys(String s, boolean enterAfter) { pressTime = System.currentTimeMillis(); for (char c : s.toCharArray()) { for (KeyEvent ke : createKeyClick(component, c)) { try { Thread.sleep(5); } catch (InterruptedException e) { e.printStackTrace(); } sendKeyEvent(ke); } } if (enterAfter) { clickKey(KeyEvent.VK_ENTER); } }
Source:
private boolean switchTopControl() { Control oldTop = layout.topControl; IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); if (projs.length > 0) { layout.topControl = control; } else { layout.topControl = emptyArea; } return oldTop != layout.topControl; }

Target:
private boolean switchTopControl() { if (control.isDisposed() || emptyArea.isDisposed()) { return false; } Control oldTop = layout.topControl; IProject[] projs = ResourcesPlugin.getWorkspace().getRoot().getProjects(); if (projs.length > 0) { layout.topControl = control; } else { layout.topControl = emptyArea; } return oldTop != layout.topControl; }
Source:
public void setDerivativeThreshold(double derivativeThreshold) { assertionManager.assertTrue(derivativeThreshold >= 0, "Thresholds won't work if they are negative!"); propDerivativeThreshold.set(derivativeThreshold); }

Target:
public void setDerivativeThreshold(double derivativeThreshold) { assertionManager.assertTrue(derivativeThreshold >= 0, "Thresholds won't work if they are negative!"); propDerivativeThreshold.set(Math.abs(derivativeThreshold)); }
Source:
public List<String> getPage(final String url, final Map<String, String> postData) throws IOException { return getPage(url, postData.entrySet().stream().map(Object::toString) .collect(Collectors.joining("&"))); }

Target:
public List<String> getPage(final String url, final Map<String, String> postData) throws IOException { return getPage(url, postData.entrySet().stream() .flatMap(CollectionFunctions::flattenAndEncodeKeyPair) .collect(Collectors.joining("&"))); }
Source:
public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { if (_idType == JsonTypeInfo.Id.NONE) { return null; } if (baseType.isPrimitive()) { return null; } TypeIdResolver idRes = idResolver(config, baseType, subtypes, false, true); JavaType defaultImpl; if (_defaultImpl == null) { defaultImpl = null; } else { if (_defaultImpl == Void.class) { defaultImpl = config.getTypeFactory().constructType(_defaultImpl); } else if (!baseType.getRawClass().isAssignableFrom(_defaultImpl)) { defaultImpl = null; } else { defaultImpl = config.getTypeFactory() .constructSpecializedType(baseType, _defaultImpl); } } switch (_includeAs) { case WRAPPER_ARRAY: return new AsArrayTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); case PROPERTY: case EXISTING_PROPERTY: return new AsPropertyTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl, _includeAs); case WRAPPER_OBJECT: return new AsWrapperTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); case EXTERNAL_PROPERTY: return new AsExternalTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); } throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: "+_includeAs); }

Target:
public TypeDeserializer buildTypeDeserializer(DeserializationConfig config, JavaType baseType, Collection<NamedType> subtypes) { if (_idType == JsonTypeInfo.Id.NONE) { return null; } if (baseType.isPrimitive()) { return null; } TypeIdResolver idRes = idResolver(config, baseType, subtypes, false, true); JavaType defaultImpl; if (_defaultImpl == null) { defaultImpl = null; } else { if (_defaultImpl == Void.class) { defaultImpl = config.getTypeFactory().constructType(_defaultImpl); } else if (!baseType.getRawClass().isAssignableFrom(_defaultImpl) && isBaseActuallySpecializedType(config, baseType)) { defaultImpl = null; } else { defaultImpl = config.getTypeFactory() .constructSpecializedType(baseType, _defaultImpl); } } switch (_includeAs) { case WRAPPER_ARRAY: return new AsArrayTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); case PROPERTY: case EXISTING_PROPERTY: return new AsPropertyTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl, _includeAs); case WRAPPER_OBJECT: return new AsWrapperTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); case EXTERNAL_PROPERTY: return new AsExternalTypeDeserializer(baseType, idRes, _typeProperty, _typeIdVisible, defaultImpl); } throw new IllegalStateException("Do not know how to construct standard type serializer for inclusion type: "+_includeAs); }
Source:
void configureShouldOnlyCreateSnifferInstance() { this.contextRunner.run( (context) -> assertThat(context).doesNotHaveBean(RestClient.class) .hasSingleBean(RestHighLevelClient.class)); this.contextRunner.run( (context) -> assertThat(context).hasSingleBean(Sniffer.class)); }

Target:
void configureShouldOnlyCreateSnifferInstance() { this.contextRunner.run((context) -> { assertThat(context).hasSingleBean(Sniffer.class); assertThat(context).doesNotHaveBean(RestClient.class).hasSingleBean(RestHighLevelClient.class); }); }
Source:
public ReadyMarkerFilter() { this.type = null; this.identifier = null; }

Target:
public ReadyMarkerFilter() { this(null, null); }
Source:
private <T extends Comparable<T>, U extends UserDefinedPredicate<T>> Boolean visit(UserDefined<T, U> ud, boolean inverted) { Column<T> filterColumn = ud.getColumn(); ColumnChunkMetaData meta = getColumnChunk(filterColumn.getColumnPath()); if (meta == null || hasNonDictionaryPages(meta)) { return BLOCK_MIGHT_MATCH; } try { Set<T> dictSet = expandDictionary(meta); if (dictSet == null) { return BLOCK_MIGHT_MATCH; } boolean allMatch = true; for(T entry : dictSet) { if (ud.getUserDefinedPredicate().keep(entry)) { if (!inverted) { return BLOCK_MIGHT_MATCH; } } else { allMatch = false; } } if (inverted && allMatch) { return BLOCK_CANNOT_MATCH; } else if (inverted) { return BLOCK_MIGHT_MATCH; } else { return BLOCK_CANNOT_MATCH; } } catch (IOException e) { LOG.warn("Failed to process dictionary for filter evaluation.", e); } return BLOCK_MIGHT_MATCH; }

Target:
private <T extends Comparable<T>, U extends UserDefinedPredicate<T>> Boolean visit(UserDefined<T, U> ud, boolean inverted) { Column<T> filterColumn = ud.getColumn(); ColumnChunkMetaData meta = getColumnChunk(filterColumn.getColumnPath()); U udp = ud.getUserDefinedPredicate(); if (meta == null) { if (inverted) { return udp.keep(null); } else { return !udp.keep(null); } } if (hasNonDictionaryPages(meta)) { return BLOCK_MIGHT_MATCH; } try { Set<T> dictSet = expandDictionary(meta); if (dictSet == null) { return BLOCK_MIGHT_MATCH; } for (T entry : dictSet) { boolean keep = udp.keep(entry); if ((keep && !inverted) || (!keep && inverted)) return BLOCK_MIGHT_MATCH; } return BLOCK_CANNOT_MATCH; } catch (IOException e) { LOG.warn("Failed to process dictionary for filter evaluation.", e); } return BLOCK_MIGHT_MATCH; }
Source:
public String getNamespace() { if(namespace==null || "".equals(namespace)) { namespace=ConfigUtils.getNamespace(namespace); } return namespace; }

Target:
public String getNamespace() { if(StringUtils.isEmpty(namespace)) { namespace=ConfigUtils.getSystemNamespace(); } return namespace; }
Source:
public static int onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos) { boolean preCancelEvent = false; if (gameType.isCreative() && !entityPlayer.getHeldItemMainhand().isEmpty() && !entityPlayer.getHeldItemMainhand().getItem().canDestroyBlockInCreative(entityPlayer.getHeldItemMainhand(), world.getBlockState(pos), entityPlayer)) preCancelEvent = true; if (gameType.isAdventure()) { if (gameType == GameType.SPECTATOR) preCancelEvent = true; if (!entityPlayer.isAllowEdit()) { ItemStack itemstack = entityPlayer.getHeldItemMainhand(); if (itemstack.isEmpty() || !itemstack.canDestroy(world.getBlockState(pos).getBlock())) preCancelEvent = true; } } if (world.getTileEntity(pos) == null) { SPacketBlockChange packet = new SPacketBlockChange(world, pos); packet.blockState = Blocks.AIR.getDefaultState(); entityPlayer.connection.sendPacket(packet); } IBlockState state = world.getBlockState(pos); BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, state, entityPlayer); event.setCanceled(preCancelEvent); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { entityPlayer.connection.sendPacket(new SPacketBlockChange(world, pos)); TileEntity tileentity = world.getTileEntity(pos); if (tileentity != null) { Packet<?> pkt = tileentity.getUpdatePacket(); if (pkt != null) { entityPlayer.connection.sendPacket(pkt); } } } return event.isCanceled() ? -1 : event.getExpToDrop(); }

Target:
public static int onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos) { boolean preCancelEvent = false; ItemStack itemstack = entityPlayer.getHeldItemMainhand(); if (gameType.isCreative() && !itemstack.isEmpty() && !itemstack.getItem().canDestroyBlockInCreative(world, pos, itemstack, entityPlayer)) preCancelEvent = true; if (gameType.isAdventure()) { if (gameType == GameType.SPECTATOR) preCancelEvent = true; if (!entityPlayer.isAllowEdit()) { if (itemstack.isEmpty() || !itemstack.canDestroy(world.getBlockState(pos).getBlock())) preCancelEvent = true; } } if (world.getTileEntity(pos) == null) { SPacketBlockChange packet = new SPacketBlockChange(world, pos); packet.blockState = Blocks.AIR.getDefaultState(); entityPlayer.connection.sendPacket(packet); } IBlockState state = world.getBlockState(pos); BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, state, entityPlayer); event.setCanceled(preCancelEvent); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { entityPlayer.connection.sendPacket(new SPacketBlockChange(world, pos)); TileEntity tileentity = world.getTileEntity(pos); if (tileentity != null) { Packet<?> pkt = tileentity.getUpdatePacket(); if (pkt != null) { entityPlayer.connection.sendPacket(pkt); } } } return event.isCanceled() ? -1 : event.getExpToDrop(); }
Source:
public List<Span> getTrace(String tenant, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } QueryFactory<?> queryFactory = Search.getQueryFactory(spansCache); Query query = queryFactory.from(Span.class) .having("traceId") .eq(id) .toBuilder().build(); return query.list(); }

Target:
public Set<Span> getTrace(String tenant, String id) { if (id == null) { throw new NullPointerException("Id should not be null!"); } Set<Span> trace = traceCache.get(id); return trace == null ? null : Collections.unmodifiableSet(trace); }
Source:
public void testRecursiveUploadForYarnS3n() throws Exception { Assume.assumeTrue("This test is skipped for Hadoop versions above 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") <= 0); try { Class.forName("org.apache.hadoop.fs.s3native.NativeS3FileSystem"); } catch (ClassNotFoundException e) { String msg = "Skipping test because NativeS3FileSystem is not in the class path"; log.info(msg); assumeNoException(msg, e); } testRecursiveUploadForYarn("s3n", "testYarn-s3n"); }

Target:
public void testRecursiveUploadForYarnS3n() throws Exception { Assume.assumeTrue("This test is skipped for Hadoop versions above 3", VersionUtil.compareVersions(System.getProperty("hadoop.version"), "3.0.0") < 0); try { Class.forName("org.apache.hadoop.fs.s3native.NativeS3FileSystem"); } catch (ClassNotFoundException e) { String msg = "Skipping test because NativeS3FileSystem is not in the class path"; log.info(msg); assumeNoException(msg, e); } testRecursiveUploadForYarn("s3n", "testYarn-s3n"); }
Source:
private void closeQuietly(FileChannel channel) { if (channel != null) { try { channel.close(); } catch (IOException e) { LOG.warn("Exception during closing", e.getMessage()); } } }

Target:
private void closeQuietly(FileChannel channel) { if (channel != null) { try { channel.close(); } catch (IOException e) { LOG.warn("Exception during closing: {}", e.getMessage(), e); } } }
Source:
protected int getFullShots() { if (oneShot) { return 1; } return getType().getShots(); }

Target:
protected int getFullShots() { return oneShot ? 1 : getType().getShots(); }
Source:
public void fromCS(Vertx vertx, CompletionStage<String> completionStage) { Future.from(completionStage, vertx.getOrCreateContext()) .onSuccess(str -> { System.out.println("We have a result: " + str); }) .onFailure(err -> { System.err.println("We have a problem"); err.printStackTrace(); }); }

Target:
public void fromCS(Vertx vertx, CompletionStage<String> completionStage) { Future.fromCompletionStage(completionStage, vertx.getOrCreateContext()) .flatMap(str -> { String key = UUID.randomUUID().toString(); return storeInDb(key, str); }) .onSuccess(str -> { System.out.println("We have a result: " + str); }) .onFailure(err -> { System.err.println("We have a problem"); err.printStackTrace(); }); }
Source:
private void addExecutorHelper(String host, int port) throws ExecutorManagerException { final String INSERT = "INSERT INTO executors " + "(host, port) values (?,?)"; QueryRunner runner = createQueryRunner(); String errString = String.format("Error adding %s:%d ", host, port); try { int rows = runner.update(INSERT, host, port); if (rows == 0) { throw new ExecutorManagerException(errString); } } catch (SQLException e) { throw new ExecutorManagerException(errString, e); } }

Target:
private void addExecutorHelper(String host, int port) throws ExecutorManagerException { final String INSERT = "INSERT INTO executors (host, port) values (?,?)"; QueryRunner runner = createQueryRunner(); try { runner.update(INSERT, host, port); } catch (SQLException e) { throw new ExecutorManagerException(String.format("Error adding %s:%d ", host, port), e); } }
Source:
public Receive createReceive() { return receiveBuilder() .matchEquals(FETCH_MSG, work -> fetchMetricsForRollup()) .match(KairosMetricNamesQueryResponse.class, this::updateMetricsSet) .match(Status.Failure.class, failure -> LOGGER.warn("Failed to get metrics from Kairo", failure.cause())) .match(MetricFetch.class, work -> { final Optional<String> metricName = getNextMetric(); if (metricName.isPresent()) { getSender().tell(metricName.get(), getSelf()); } else { getSender().tell(NoMoreMetrics.getInstance(), getSelf()); } }) .build(); }

Target:
public Receive createReceive() { return receiveBuilder() .matchEquals( FETCH_MSG, work -> { getTimers().startSingleTimer(REFRESH_TIMER, FETCH_MSG, _fetchInterval); _refreshDeadline = _fetchInterval.fromNow(); fetchMetricsForRollup(); }) .match(KairosMetricNamesQueryResponse.class, this::updateMetricsSet) .match( Status.Failure.class, failure -> LOGGER.warn("Failed to get metrics from Kairos", failure.cause())) .match( MetricFetch.class, work -> { final Optional<String> metricName = getNextMetric(); if (metricName.isPresent()) { getSender().tell(metricName.get(), getSelf()); } else { getSender().tell(new NoMoreMetrics(_refreshDeadline), getSelf()); } }) .build(); }
Source:
static void calculateProbes(Map<InetAddressAndPort, AnnotatedMeasurement> samples, long intervalMillis) { for (Map.Entry<InetAddressAndPort, AnnotatedMeasurement> entry: samples.entrySet()) { if (entry.getKey().equals(FBUtilities.getBroadcastAddressAndPort())) continue; AnnotatedMeasurement measurement = entry.getValue(); long lastMeasure = measurement.millisSinceLastMeasure.getAndAdd(intervalMillis); long lastRequest = measurement.millisSinceLastRequest.getAndAdd(intervalMillis); if (lastMeasure >= MIN_PROBE_INTERVAL_MS && lastRequest < MAX_PROBE_INTERVAL_MS) { if (measurement.probeTimerMillis == 0) { measurement.probeTimerMillis = intervalMillis; } else if (measurement.probeFuture != null && measurement.probeFuture.isDone()) { measurement.probeTimerMillis = Math.min(MAX_PROBE_INTERVAL_MS, measurement.probeTimerMillis * 2); } } else { measurement.probeTimerMillis = 0; } } }

Target:
protected static void calculateProbes(Map<InetAddressAndPort, AnnotatedMeasurement> samples, long intervalMillis) { for (Map.Entry<InetAddressAndPort, AnnotatedMeasurement> entry: samples.entrySet()) { AnnotatedMeasurement measurement = entry.getValue(); long lastMeasure = measurement.millisSinceLastMeasure.addAndGet(intervalMillis); long lastRequest = measurement.millisSinceLastRequest.addAndGet(intervalMillis); if (lastMeasure >= MIN_PROBE_INTERVAL_MS && lastRequest < MAX_PROBE_INTERVAL_MS) { if (measurement.nextProbeDelayMillis == 0) { measurement.nextProbeDelayMillis = intervalMillis; } else if (measurement.probeFuture != null && measurement.probeFuture.isDone()) { measurement.nextProbeDelayMillis = Math.min(MAX_PROBE_INTERVAL_MS, measurement.nextProbeDelayMillis * 2); } } else { measurement.nextProbeDelayMillis = 0; } } }
Source:
protected boolean isFileExist(HttpMessage msg) { boolean isFileExist = isPage200(msg); return isFileExist ? isFileExist : parent.getAnalyser().isFileExist(msg); }

Target:
protected boolean isFileExist(HttpMessage msg) { return isPage200(msg); }
Source:
protected void doRun() throws Exception { Double cpuLoad; try { VMMetricProviderImpl vmMetricProvider = ExtensionList.lookup(MetricProvider.class).get(VMMetricProviderImpl.class); MetricSet vmProviderMetricSet = vmMetricProvider.getMetricSet(); Gauge cpu = (Gauge) vmProviderMetricSet.getMetrics().get("vm.cpu.load"); cpuLoad = new Double(cpu.getValue().toString()); } catch (NullPointerException nullPointerException) { LOGGER.log(WARNING, "Support Core plugin can't generate thread dumps. Metrics plugin does not seem to be available", nullPointerException); return; } if (Double.compare(Runtime.getRuntime().availableProcessors() * CPU_USAGE_THRESHOLD, cpuLoad) < 0) { countConsequtivePositives++; if (countConsequtivePositives >= HIGH_CPU_CONSECUTIVE_TIMES) { countConsequtivePositives = 0; File threadDumpFile = logs.file(format.format(new Date()) + ".txt"); try (FileOutputStream fileOutputStream = new FileOutputStream(threadDumpFile)) { ThreadDumps.threadDump(fileOutputStream); logs.add(threadDumpFile); } } } else { countConsequtivePositives = 0; } }

Target:
protected void doRun() throws Exception { Double cpuLoad; try { VMMetricProviderImpl vmMetricProvider = ExtensionList.lookup(MetricProvider.class).get(VMMetricProviderImpl.class); MetricSet vmProviderMetricSet = vmMetricProvider.getMetricSet(); Gauge cpu = (Gauge) vmProviderMetricSet.getMetrics().get("vm.cpu.load"); cpuLoad = new Double(cpu.getValue().toString()); } catch (NullPointerException nullPointerException) { LOGGER.log(WARNING, "Support Core plugin can't generate automatically thread dumps on high cpu load. Metrics plugin does not seem to be available", nullPointerException); return; } if (cpuLoad != null && Double.compare(Runtime.getRuntime().availableProcessors() * CPU_USAGE_THRESHOLD, cpuLoad) < 0) { countConsecutivePositives++; if (countConsecutivePositives >= HIGH_CPU_CONSECUTIVE_TIMES) { countConsecutivePositives = 0; File threadDumpFile = logs.file(format.format(new Date()) + ".txt"); try (FileOutputStream fileOutputStream = new FileOutputStream(threadDumpFile)) { ThreadDumps.threadDump(fileOutputStream); logs.add(threadDumpFile); } } } else { countConsecutivePositives = 0; } }
Source:
public boolean equals(Object obj) { return obj instanceof ProgramInformation && ((ProgramInformation)obj).title.equals(this.title) && ((ProgramInformation)obj).source.equals(this.source) && ((ProgramInformation)obj).copyright.equals(this.copyright) && validateEvents(((ProgramInformation)obj).customEvents); }

Target:
public boolean equals(Object obj) { if (!(obj instanceof ProgramInformation)) { return false; } ProgramInformation other = (ProgramInformation) obj; return Util.areEqual(this.title, other.title) && Util.areEqual(this.source, other.source) && Util.areEqual(this.copyright, other.copyright) && Util.areEqual(this.moreInformationURL, other.moreInformationURL) && Util.areEqual(this.lang, other.lang); }
Source:
public boolean checkFileExistsInUserSpace(Session session, String pathname) throws NotConnectedException, PermissionException { try { return fileSystem(session).resolveFileInUserspace(pathname).exists(); } catch (FileSystemException e) { return false; } }

Target:
public boolean checkFileExistsInUserSpace(Session session, String pathname) throws NotConnectedException, PermissionException { try { return fileSystem(session).resolveFileInUserspace(pathname).exists(); } catch (FileSystemException e) { logger.debug(String.format("Can't parse the file name [%s] in the user space.", pathname), e); return false; } }
Source:
public static Version fromVersionString(String versionString) { if(StringUtils.isEmpty(versionString)) { return null; } String[] parts = versionString.split("\\."); Version version = new Version(); if(parts.length < 1) { return null; } try { version.setMajor(Integer.parseInt(StringUtils.stripStart(parts[0], "0"))); } catch(NumberFormatException e) { log.error("Failed to map version string major component", e); return null; } if (parts.length > 1) { try { version.setMinor(Integer.parseInt(StringUtils.stripStart(parts[1], "0"))); } catch(NumberFormatException e) { log.error("Failed to map version string minor component", e); return version; } } if (parts.length > 2) { try { version.setBuild(Integer.parseInt(StringUtils.stripStart(parts[2], "0"))); } catch(NumberFormatException e) { log.error("Failed to map version string build component", e); return version; } } if (parts.length > 3) { try { version.setRevision(Integer.parseInt(StringUtils.stripStart(parts[3], "0"))); } catch(NumberFormatException e) { log.error("Failed to map version string revision component", e); return version; } } return version; }

Target:
public static Version fromVersionString(String versionString) { if (versionString == null) { return null; } Version version = new Version(); version.setFullVersion(versionString); Matcher match = VERSION_PATTERN.matcher(versionString); if (match.matches()) { String major = match.group("major"); String minor = match.group("minor"); String build = match.group("build"); String revision = match.group("revision"); if (major != null) { version.setMajor(Integer.parseInt(major)); } if (minor != null) { version.setMinor(Integer.parseInt(minor)); } if (build != null) { version.setBuild(Integer.parseInt(build)); } if (revision != null) { version.setRevision(Integer.parseInt(revision)); } } else { log.warn( "The version string \"{}\" doesn't match the expected pattern, only the full version will be reported.", versionString ); } return version; }
Source:
public void testStitchPointsEquals() { DSTFileGenerator.StitchPoint stitchPoint1 = new DSTFileGenerator.StitchPoint(new PointF(1, 2), true); DSTFileGenerator.StitchPoint stitchPoint2 = new DSTFileGenerator.StitchPoint(new PointF(2, 1), true); DSTFileGenerator.StitchPoint stitchPoint3 = new DSTFileGenerator.StitchPoint(new PointF(1, 2)); DSTFileGenerator.StitchPoint stitchPoint4 = stitchPoint1; assertFalse(stitchPoint1.equals(stitchPoint2)); assertFalse(stitchPoint1.equals(stitchPoint3)); assertEquals(stitchPoint1, stitchPoint4); }

Target:
public void testStitchPointsEquals() { DSTFileGenerator.StitchPoint stitchPoint1 = new DSTFileGenerator.StitchPoint(new PointF(1, 2), true); DSTFileGenerator.StitchPoint stitchPoint2 = new DSTFileGenerator.StitchPoint(new PointF(2, 1), true); DSTFileGenerator.StitchPoint stitchPoint3 = new DSTFileGenerator.StitchPoint(new PointF(1, 2)); DSTFileGenerator.StitchPoint stitchPoint4 = stitchPoint1; assertNotEquals(stitchPoint1, stitchPoint2); assertNotEquals(stitchPoint1, stitchPoint3); assertEquals(stitchPoint1, stitchPoint4); }
Source:
public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { System.out.println("InjectClientHeadersFactory update"); MultivaluedMap<String, String> updatedHeaders = new MultivaluedHashMap<>(); updatedHeaders.putSingle("REQUEST_METHOD", jaxrsRequest == null ? "NOT_INJECTED" : jaxrsRequest.getMethod()); return updatedHeaders; }

Target:
public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { MultivaluedMap<String, String> updatedHeaders = new MultivaluedHashMap<>(); updatedHeaders.putSingle("REQUEST_METHOD", jaxrsRequest == null ? "NOT_INJECTED" : jaxrsRequest.getMethod()); return updatedHeaders; }
Source:
public void enableTableReplication(String tableName) throws IOException { TableName tn = tableInfoFactory.getTableInfo(tableName); try { HTableDescriptor htd = admin.getTableDescriptor(tn); if (admin.isTableEnabled(tn)) { admin.disableTable(tn); } for (HColumnDescriptor hcd : htd.getFamilies()) { hcd.setScope(HConstants.REPLICATION_SCOPE_GLOBAL); } admin.modifyTable(tn, htd); SpliceLogUtils.info(LOG, "enabled replication for table %s", tn); } finally { if (tn != null && !admin.isTableEnabled(tn)) { admin.enableTable(tn); } } }

Target:
public void enableTableReplication(String tableName) throws IOException { TableName tn = tableInfoFactory.getTableInfo(tableName); boolean tableEnabled = admin.isTableEnabled(tn); try { HTableDescriptor htd = admin.getTableDescriptor(tn); if (tableEnabled) { admin.disableTable(tn); } for (HColumnDescriptor hcd : htd.getFamilies()) { hcd.setScope(HConstants.REPLICATION_SCOPE_GLOBAL); } admin.modifyTable(tn, htd); SpliceLogUtils.info(LOG, "enabled replication for table %s", tn); } finally { if (tn != null && !admin.isTableEnabled(tn) && tableEnabled) { admin.enableTable(tn); } } }
Source:
public static boolean isRetryable(Throwable t) { if (t instanceof GoogleJsonResponseException) { final GoogleJsonResponseException e = (GoogleJsonResponseException) t; return e.getStatusCode() == 429; } return t instanceof IOException; }

Target:
public static boolean isRetryable(Throwable t) { if (t instanceof HttpResponseException) { final HttpResponseException e = (HttpResponseException) t; return e.getStatusCode() == 429 || (e.getStatusCode() / 500 == 1); } return t instanceof IOException; }
Source:
public Sequence<T> run(QueryPlus<T> queryPlus, ResponseContext responseContext) { Query<T> query = queryPlus.getQuery(); final CacheStrategy strategy = toolChest.getCacheStrategy(query); final boolean populateCache = CacheUtil.populateCacheOnDataNodes(query, strategy, cacheConfig); final boolean useCache = CacheUtil.useCacheOnDataNodes(query, strategy, cacheConfig); final Cache.NamedKey key; if (strategy != null && (useCache || populateCache)) { key = CacheUtil.computeSegmentCacheKey( cacheId, segmentDescriptor, strategy.computeCacheKey(query) ); } else { key = null; } if (useCache) { close(); final Function cacheFn = strategy.pullFromSegmentLevelCache(); final byte[] cachedResult = cache.get(key); if (cachedResult != null) { final TypeReference cacheObjectClazz = strategy.getCacheObjectClazz(); return Sequences.map( new BaseSequence<>( new BaseSequence.IteratorMaker<T, Iterator<T>>() { @Override public Iterator<T> make() { try { if (cachedResult.length == 0) { return Collections.emptyIterator(); } return mapper.readValues( mapper.getFactory().createParser(cachedResult), cacheObjectClazz ); } catch (IOException e) { throw new RuntimeException(e); } } @Override public void cleanup(Iterator<T> iterFromMake) { } } ), cacheFn ); } } if (populateCache) { final Function cacheFn = strategy.prepareForSegmentLevelCache(); return cachePopulator.wrap(base.run(queryPlus, responseContext), value -> cacheFn.apply(value), cache, key); } else { return base.run(queryPlus, responseContext); } }

Target:
public Sequence<T> run(QueryPlus<T> queryPlus, ResponseContext responseContext) { Query<T> query = queryPlus.getQuery(); final CacheStrategy strategy = toolChest.getCacheStrategy(query); final boolean populateCache = CacheUtil.populateCacheOnDataNodes(query, strategy, cacheConfig); final boolean useCache = CacheUtil.useCacheOnDataNodes(query, strategy, cacheConfig); final Cache.NamedKey key; if (strategy != null && (useCache || populateCache)) { key = CacheUtil.computeSegmentCacheKey( cacheId, segmentDescriptor, strategy.computeCacheKey(query) ); } else { key = null; } if (useCache) { final Function cacheFn = strategy.pullFromSegmentLevelCache(); final byte[] cachedResult = cache.get(key); if (cachedResult != null) { final TypeReference cacheObjectClazz = strategy.getCacheObjectClazz(); return Sequences.map( new BaseSequence<>( new BaseSequence.IteratorMaker<T, Iterator<T>>() { @Override public Iterator<T> make() { try { if (cachedResult.length == 0) { return Collections.emptyIterator(); } return mapper.readValues( mapper.getFactory().createParser(cachedResult), cacheObjectClazz ); } catch (IOException e) { throw new RuntimeException(e); } } @Override public void cleanup(Iterator<T> iterFromMake) { } } ), cacheFn ); } } if (populateCache) { final Function cacheFn = strategy.prepareForSegmentLevelCache(); return cachePopulator.wrap(base.run(queryPlus, responseContext), value -> cacheFn.apply(value), cache, key); } else { return base.run(queryPlus, responseContext); } }
Source:
public List<FeedbackQuestionAttributes> getQuestionsWithRecipients( List<FeedbackQuestionAttributes> questions, String giver) throws EntityDoesNotExistException { List<FeedbackQuestionAttributes> questionsWithRecipients = new ArrayList<FeedbackQuestionAttributes>(); for (FeedbackQuestionAttributes question : questions) { if (question.numberOfEntitiesToGiveFeedbackTo == Const.MAX_POSSIBLE_RECIPIENTS) { question.numberOfEntitiesToGiveFeedbackTo = this .getRecipientsForQuestion(question, giver).size(); } if (question.numberOfEntitiesToGiveFeedbackTo > 0) { questionsWithRecipients.add(question); } } return questionsWithRecipients; }

Target:
public List<FeedbackQuestionAttributes> getQuestionsWithRecipients( List<FeedbackQuestionAttributes> questions, String giver) throws EntityDoesNotExistException { List<FeedbackQuestionAttributes> questionsWithRecipients = new ArrayList<FeedbackQuestionAttributes>(); for (FeedbackQuestionAttributes question : questions) { int numRecipients = question.numberOfEntitiesToGiveFeedbackTo; if (numRecipients == Const.MAX_POSSIBLE_RECIPIENTS) { numRecipients = this.getRecipientsForQuestion(question, giver) .size(); } if (numRecipients > 0) { questionsWithRecipients.add(question); } } return questionsWithRecipients; }
Source:
public List<Long> getSizeOfTasksForNotTemplateProcessesForProjectIdOrderByOrdering(Integer projectId) { return getCount("SELECT COUNT(t.id) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " + "WITH pr.id = " + projectId + " GROUP BY t.title ORDER BY t.ordering"); }

Target:
public List<Long> getSizeOfTasksForNotTemplateProcessesForProjectIdOrderByOrdering(Integer projectId) { Map<String, Object> parameters = new HashMap<>(); parameters.put("projectId", projectId); return getCount("SELECT COUNT(t.id) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " + "WITH pr.id = :projectId GROUP BY t.title ORDER BY t.ordering", parameters); }
Source:
public PageableResult search(RequestContext context) throws ResponseException { String identifier = context.getRequest().getParameter("identifier"); String searchType = context.getParameter("searchType"); if (StringUtils.isNotBlank(identifier)) { if("start".equals(searchType)){ List<Patient> patients = restHelperService.findPatientsByIdentifierStartingWith(identifier, false); if (patients != null && patients.size() > 0) { return new NeedsPaging<Patient>(patients, context); } } else { List<Patient> patients = Context.getPatientService().getPatients(null, identifier, null, true); if (patients != null && patients.size() > 0) { return new NeedsPaging<Patient>(patients, context); } } } return new EmptySearchResult(); }

Target:
public PageableResult search(RequestContext context) throws ResponseException { String identifier = context.getRequest().getParameter("identifier"); String searchType = context.getParameter("searchType"); if (StringUtils.isNotBlank(identifier)) { if ("start".equals(searchType)) { List<Patient> patients = restHelperService.findPatientsByIdentifierStartingWith(identifier, context.getIncludeAll()); if (patients != null && patients.size() > 0) { return new NeedsPaging<Patient>(patients, context); } } else { List<Patient> patients = Context.getPatientService().getPatients(null, identifier, null, true); if (patients != null && patients.size() > 0) { return new NeedsPaging<Patient>(patients, context); } } } return new EmptySearchResult(); }
Source:
private void openWindow(Stage mainStage) { GUIGlobals.init(); LOGGER.debug("Initializing frame"); mainFrame.init(); if (Globals.prefs.getBoolean(JabRefPreferences.WINDOW_MAXIMISED)) { mainStage.setMaximized(true); } else { mainStage.setX(Globals.prefs.getDouble(JabRefPreferences.POS_X)); mainStage.setY(Globals.prefs.getDouble(JabRefPreferences.POS_Y)); mainStage.setWidth(Globals.prefs.getDouble(JabRefPreferences.SIZE_X)); mainStage.setHeight(Globals.prefs.getDouble(JabRefPreferences.SIZE_Y)); } DecorationPane root = new DecorationPane(); root.getChildren().add(JabRefGUI.mainFrame); Scene scene = new Scene(root, 800, 800); Globals.getThemeLoader().installCss(scene, Globals.prefs); mainStage.setTitle(JabRefFrame.FRAME_TITLE); mainStage.getIcons().addAll(IconTheme.getLogoSetFX()); mainStage.setScene(scene); mainStage.show(); mainStage.setOnCloseRequest(event -> { saveWindowState(mainStage); boolean reallyQuit = mainFrame.quit(); if (!reallyQuit) { event.consume(); } }); this.openDatabases(); }

Target:
private void openWindow(Stage mainStage) { GUIGlobals.init(); LOGGER.debug("Initializing frame"); mainFrame.init(); if (Globals.prefs.getBoolean(JabRefPreferences.WINDOW_MAXIMISED)) { mainStage.setMaximized(true); } else { mainStage.setX(Globals.prefs.getDouble(JabRefPreferences.POS_X)); mainStage.setY(Globals.prefs.getDouble(JabRefPreferences.POS_Y)); mainStage.setWidth(Globals.prefs.getDouble(JabRefPreferences.SIZE_X)); mainStage.setHeight(Globals.prefs.getDouble(JabRefPreferences.SIZE_Y)); } DecorationPane root = new DecorationPane(); root.getChildren().add(JabRefGUI.mainFrame); Scene scene = new Scene(root, 800, 800); Globals.getThemeLoader().installCss(scene, Globals.prefs); mainStage.setTitle(JabRefFrame.FRAME_TITLE); mainStage.getIcons().addAll(IconTheme.getLogoSetFX()); mainStage.setScene(scene); mainStage.show(); mainStage.setOnCloseRequest(event -> { saveWindowState(mainStage); boolean reallyQuit = mainFrame.quit(); if (!reallyQuit) { event.consume(); } }); Platform.runLater(this::openDatabases); }
Source:
protected CompletableFuture<Boolean> subscribeRaw(String topic) { logger.trace("Unsubscribing message consumer for topic '{}' from broker '{}'", topic, host); CompletableFuture<Boolean> future = new CompletableFuture<Boolean>(); try { MqttAsyncClient client = this.client; if (client != null && client.isConnected()) { client.subscribe(topic, qos, future, actionCallbacks); } else { future.complete(false); } } catch (org.eclipse.paho.client.mqttv3.MqttException e) { logger.info("Error subscribing to topic {}", topic, e); future.completeExceptionally(e); } return future; }

Target:
protected CompletableFuture<Boolean> subscribeRaw(String topic) { logger.trace("subscribeRaw message consumer for topic '{}' from broker '{}'", topic, host); CompletableFuture<Boolean> future = new CompletableFuture<Boolean>(); try { MqttAsyncClient client = this.client; if (client != null && client.isConnected()) { client.subscribe(topic, qos, future, actionCallback); } else { future.complete(false); } } catch (org.eclipse.paho.client.mqttv3.MqttException e) { logger.info("Error subscribing to topic {}", topic, e); future.completeExceptionally(e); } return future; }
Source:
public ModelAndView receiveBulkLibraries(@RequestParam("quantity") Integer quantity, @RequestParam(value = "sampleClassId", required = false) Long aliquotClassId, @RequestParam(value = "projectId", required = false) Long projectId, ModelMap model) throws IOException { LibraryDto libDto = null; Project project = null; if (projectId != null) { project = projectService.getProjectById(projectId); if (project == null) throw new NotFoundException("No project found for ID " + projectId.toString()); } SampleClass aliquotClass = null; if (isDetailedSampleEnabled()) { if (aliquotClassId == null) throw new NotFoundException("Sample Class ID is required"); aliquotClass = sampleClassService.get(aliquotClassId); if (aliquotClass == null) throw new NotFoundException("Requested sample class not found"); DetailedLibraryDto detailedDto = new DetailedLibraryDto(); libDto = detailedDto; SampleAliquotDto samDto = new SampleAliquotDto(); detailedDto.setSample(samDto); samDto.setSampleClassId(aliquotClassId); detailedDto.setParentSampleClassId(aliquotClassId); } else { libDto = new LibraryDto(); libDto.setSample(new SampleDto()); } return new BulkReceiveLibraryBackend(libDto, quantity, project, aliquotClass, defaultSciName).create(model); }

Target:
public ModelAndView receiveBulkLibraries(@RequestParam("quantity") Integer quantity, @RequestParam(value = "sampleClassId", required = false) Long aliquotClassId, @RequestParam(value = "projectId", required = false) Long projectId, ModelMap model) throws IOException { LibraryDto libDto = null; Project project = null; if (projectId != null) { project = projectService.getProjectById(projectId); if (project == null) throw new InvalidParameterException("No project found for ID " + projectId.toString()); } SampleClass aliquotClass = null; if (isDetailedSampleEnabled()) { if (aliquotClassId == null) throw new InvalidParameterException("Sample Class ID is required"); aliquotClass = sampleClassService.get(aliquotClassId); if (aliquotClass == null) throw new InvalidParameterException("Requested sample class not found"); DetailedLibraryDto detailedDto = new DetailedLibraryDto(); libDto = detailedDto; SampleAliquotDto samDto = new SampleAliquotDto(); detailedDto.setSample(samDto); samDto.setSampleClassId(aliquotClassId); detailedDto.setParentSampleClassId(aliquotClassId); } else { libDto = new LibraryDto(); libDto.setSample(new SampleDto()); } return new BulkReceiveLibraryBackend(libDto, quantity, project, aliquotClass, defaultSciName).create(model); }
Source:
protected void validateJoinFilters(List<RexNode> aboveFilters, List<RexNode> joinFilters, Join join, JoinRelType joinType) { final Iterator<RexNode> filterIter = joinFilters.iterator(); while (filterIter.hasNext()) { RexNode exp = filterIter.next(); int maxIndex = -1; ImmutableList<RexInputRef> inputRefs = RexUtil.getAllInputRef(exp); for (RexInputRef rexInputRef: inputRefs) { if (rexInputRef.getIndex() > maxIndex) { maxIndex = rexInputRef.getIndex(); } } if (!predicate.apply(join, joinType, exp) && maxIndex < join.getRowType().getFieldCount()) { aboveFilters.add(exp); filterIter.remove(); } } }

Target:
protected void validateJoinFilters(List<RexNode> aboveFilters, List<RexNode> joinFilters, Join join, JoinRelType joinType) { final Iterator<RexNode> filterIter = joinFilters.iterator(); while (filterIter.hasNext()) { RexNode exp = filterIter.next(); if (!predicate.apply(join, joinType, exp) && joinType.projectsRight()) { aboveFilters.add(exp); filterIter.remove(); } } }
Source:
public TagUserRules(Context context) { super("Tag rules which are not builtin with 'symbolic' tag", context); notSymbolicTags = ImmutableSet.of( Constants.MACRO, Constants.FUNCTION, Constants.STRUCTURAL, Constants.ANYWHERE, SymbolicBackend.NOTSYMBOLIC); if (!kompileOptions.experimental.nonSymbolicTags.isEmpty()) { notSymbolicTags.addAll(kompileOptions.experimental.nonSymbolicTags); } }

Target:
public TagUserRules(Context context) { super("Tag rules which are not builtin with 'symbolic' tag", context); notSymbolicTags = ImmutableSet.of( Constants.MACRO, Constants.FUNCTION, Constants.STRUCTURAL, Constants.ANYWHERE, SymbolicBackend.NOTSYMBOLIC); if (!kompileOptions.experimental.nonSymbolicRules.isEmpty()) { notSymbolicTags.addAll(kompileOptions.experimental.nonSymbolicRules); } }
Source:
public void testQueryTimeout() throws Exception { try (Connection connection = createConnection("blackhole", "blackhole"); Statement statement = connection.createStatement()) { statement.executeUpdate("CREATE TABLE test_query_timeout (key BIGINT) " + "WITH (" + " split_count = 1, " + " pages_per_split = 1, " + " rows_per_page = 1, " + " page_processing_delay = '1m'" + ")"); } CountDownLatch queryStarted = new CountDownLatch(1); CountDownLatch queryFinished = new CountDownLatch(1); AtomicReference<String> queryId = new AtomicReference<>(); AtomicReference<Throwable> queryFailure = new AtomicReference<>(); Future<?> queryFuture = executorService.submit(() -> { try (Connection connection = createConnection("blackhole", "default"); Statement statement = connection.createStatement()) { statement.setQueryTimeout(1); try (ResultSet resultSet = statement.executeQuery("SELECT * FROM test_query_timeout")) { queryId.set(resultSet.unwrap(PrestoResultSet.class).getQueryId()); queryStarted.countDown(); try { resultSet.next(); } catch (SQLException t) { queryFailure.set(t); } finally { queryFinished.countDown(); } } } return null; }); assertTrue(queryStarted.await(2, SECONDS)); assertNotNull(queryId.get()); assertFalse(getQueryState(queryId.get()).isDone()); assertTrue(queryFinished.await(2, SECONDS)); assertTrue(queryFailure.get().getMessage().contains("Query exceeded maximum time limit of 1.00s")); assertEquals(getQueryState(queryId.get()), FAILED); try (Connection connection = createConnection("blackhole", "blackhole"); Statement statement = connection.createStatement()) { statement.executeUpdate("DROP TABLE test_query_timeout"); } }

Target:
public void testQueryTimeout() throws Exception { try (Connection connection = createConnection("blackhole", "blackhole"); Statement statement = connection.createStatement()) { statement.executeUpdate("CREATE TABLE test_query_timeout (key BIGINT) " + "WITH (" + " split_count = 1, " + " pages_per_split = 1, " + " rows_per_page = 1, " + " page_processing_delay = '1m'" + ")"); } CountDownLatch queryFinished = new CountDownLatch(1); AtomicReference<Throwable> queryFailure = new AtomicReference<>(); executorService.submit(() -> { try (Connection connection = createConnection("blackhole", "default"); Statement statement = connection.createStatement()) { statement.setQueryTimeout(1); try (ResultSet resultSet = statement.executeQuery("SELECT * FROM test_query_timeout")) { try { resultSet.next(); } catch (SQLException t) { queryFailure.set(t); } finally { queryFinished.countDown(); } } } return null; }); assertTrue(queryFinished.await(2, SECONDS)); assertNotNull(queryFailure.get()); assertContains(queryFailure.get().getMessage(), "Query exceeded maximum time limit of 1.00s"); try (Connection connection = createConnection("blackhole", "blackhole"); Statement statement = connection.createStatement()) { statement.executeUpdate("DROP TABLE test_query_timeout"); } }
Source:
private static void printClass( @BinaryName String classname, AClass aClass, BaseTypeChecker checker, PrintWriter printWriter) { String basename = basenamePart(classname); String innermostClassname = basename.contains("$") ? basename.substring(basename.lastIndexOf('$') + 1) : basename; String pkg = packagePart(classname); if (pkg != null) { printWriter.println("package " + pkg + ";"); } int curlyCount = printClassDefinitions(basename, aClass, printWriter); String indentLevel = indents(curlyCount); List<VariableElement> enumConstants = aClass.getEnumConstants(); if (enumConstants != null) { StringJoiner sj = new StringJoiner(", "); for (VariableElement enumConstant : enumConstants) { sj.add(enumConstant.getSimpleName()); } printWriter.println(indentLevel + " printWriter.println(); printWriter.println(indentLevel + sj.toString() + ";"); printWriter.println(); } printFields(aClass, printWriter, indentLevel); if (!aClass.getMethods().isEmpty()) { printWriter.println(indentLevel + " printWriter.println(); for (Map.Entry<String, AMethod> methodEntry : aClass.getMethods().entrySet()) { printMethodDeclaration( methodEntry.getValue(), innermostClassname, printWriter, indentLevel, checker.getTypeFactory()); } } for (int i = 0; i < curlyCount; i++) { printWriter.println(indents(curlyCount - i - 1) + "}"); } }

Target:
private static void printClass( @BinaryName String classname, AClass aClass, BaseTypeChecker checker, PrintWriter printWriter) { String basename = basenamePart(classname); String innermostClassname = basename.contains("$") ? basename.substring(basename.lastIndexOf('$') + 1) : basename; String pkg = packagePart(classname); if (pkg != null) { printWriter.println("package " + pkg + ";"); } int curlyCount = printClassDefinitions(basename, aClass, printWriter, checker); String indentLevel = indents(curlyCount); List<VariableElement> enumConstants = aClass.getEnumConstants(); if (enumConstants != null) { StringJoiner sj = new StringJoiner(", "); for (VariableElement enumConstant : enumConstants) { sj.add(enumConstant.getSimpleName()); } printWriter.println(indentLevel + " printWriter.println(); printWriter.println(indentLevel + sj.toString() + ";"); printWriter.println(); } printFields(aClass, printWriter, indentLevel); if (!aClass.getMethods().isEmpty()) { printWriter.println(indentLevel + " printWriter.println(); for (Map.Entry<String, AMethod> methodEntry : aClass.getMethods().entrySet()) { printMethodDeclaration( methodEntry.getValue(), innermostClassname, printWriter, indentLevel, checker.getTypeFactory()); } } for (int i = 0; i < curlyCount; i++) { printWriter.println(indents(curlyCount - i - 1) + "}"); } }
Source:
public void addNotification(Notification notification) { if(this.notifications != null) { this.notifications.add(notification); } }

Target:
public void addNotification(Notification notification) { if(notification != null) { this.notifications.add(notification); } }
Source:
private ProcessHandler startTestProcess(IJavaProject javaProject, TestExecutionContext context) { JavaParameters parameters = new JavaParameters(); parameters.setJavaExecutable(System.getProperties().getProperty("java.home") + "/bin/java"); parameters.setMainClassName(MAIN_CLASS_NAME); parameters.setWorkingDirectory(workspacePath + javaProject.getPath()); List<String> classPath = new ArrayList<>(); Set<String> projectClassPath = classpathProvider.getProjectClassPath(javaProject); classPath.addAll(projectClassPath); classPath.add(ClasspathUtil.getJarPathForClass(CheJUnitCoreRunner.class)); parameters.getClassPath().addAll(classPath); List<String> suite = createTestSuite( context, javaProject, JavaTestAnnotations.JUNIT4X_TEST.getName(), JavaTestAnnotations.JUNIT4X_RUN_WITH.getName()); for (String element : suite) { parameters.getParametersList().add(element); } if (context.isDebugModeEnable()) { generateDebuggerPort(); parameters.getVmParameters().add("-Xdebug"); parameters .getVmParameters() .add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + getDebugPort()); } CommandLine command = parameters.createCommand(); try { return new ProcessHandler(command.createProcess()); } catch (ExecutionException e) { LOG.error("Can't run JUnit JVM", e); } return null; }

Target:
private ProcessHandler startTestProcess(IJavaProject javaProject, TestExecutionContext context) { JavaParameters parameters = new JavaParameters(); parameters.setJavaExecutable(System.getProperty("java.home") + "/bin/java"); parameters.setMainClassName(MAIN_CLASS_NAME); parameters.setWorkingDirectory(workspacePath + javaProject.getPath()); List<String> classPath = new ArrayList<>(); Set<String> projectClassPath = classpathProvider.getProjectClassPath(javaProject); classPath.addAll(projectClassPath); classPath.add(ClasspathUtil.getJarPathForClass(CheJUnitCoreRunner.class)); parameters.getClassPath().addAll(classPath); List<String> suite = createTestSuite( context, javaProject, JavaTestAnnotations.JUNIT4X_TEST.getName(), JavaTestAnnotations.JUNIT4X_RUN_WITH.getName()); for (String element : suite) { parameters.getParametersList().add(element); } if (context.isDebugModeEnable()) { generateDebuggerPort(); parameters.getVmParameters().add("-Xdebug"); parameters .getVmParameters() .add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + getDebugPort()); } CommandLine command = parameters.createCommand(); try { return new ProcessHandler(command.createProcess()); } catch (ExecutionException e) { LOG.error("Can't run JUnit JVM", e); } return null; }