auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected <T> CompletableFuture<T> invokeAsync(InvocationContext ctx, VisitableCommand cmd) { CompletableFuture<T> cf; boolean isImplicitTx = ctx.isInTxScope() && ((TxInvocationContext) ctx).isImplicitTransaction(); final Transaction implicitTransaction; try { cf = (CompletableFuture<T>) fmap.chain.invokeAsync(ctx, cmd); if (isImplicitTx) { implicitTransaction = transactionManager.suspend(); } else { implicitTransaction = null; } } catch (SystemException e) { throw new CacheException("Cannot suspend implicit transaction", e); } catch (Throwable t) { if (isImplicitTx) { try { if (transactionManager != null) transactionManager.rollback(); } catch (Throwable t2) { log.trace("Could not rollback", t2); t.addSuppressed(t2); } } throw t; } if (isImplicitTx) { return cf.handle((result, throwable) -> { if (throwable != null) { try { implicitTransaction.rollback(); } catch (SystemException e) { log.trace("Could not rollback", e); throwable.addSuppressed(e); } throw CompletableFutures.asCompletionException(throwable); } try { implicitTransaction.commit(); } catch (Exception e) { log.couldNotCompleteInjectedTransaction(e); throw CompletableFutures.asCompletionException(e); } return result; }); } else { return cf; } }

Target:
protected <T> CompletableFuture<T> invokeAsync(InvocationContext ctx, VisitableCommand cmd) { CompletableFuture<T> cf; boolean isImplicitTx = ctx.isInTxScope() && ((TxInvocationContext) ctx).isImplicitTransaction(); final Transaction implicitTransaction; try { if (isImplicitTx) { implicitTransaction = transactionManager.suspend(); assert implicitTransaction != null; } else { implicitTransaction = null; } cf = (CompletableFuture<T>) fmap.chain.invokeAsync(ctx, cmd); } catch (SystemException e) { throw new CacheException("Cannot suspend implicit transaction", e); } catch (Throwable t) { if (isImplicitTx) { try { if (transactionManager != null) transactionManager.rollback(); } catch (Throwable t2) { log.trace("Could not rollback", t2); t.addSuppressed(t2); } } throw t; } if (isImplicitTx) { return cf.handle((result, throwable) -> { if (throwable != null) { try { implicitTransaction.rollback(); } catch (SystemException e) { log.trace("Could not rollback", e); throwable.addSuppressed(e); } throw CompletableFutures.asCompletionException(throwable); } try { implicitTransaction.commit(); } catch (Exception e) { log.couldNotCompleteInjectedTransaction(e); throw CompletableFutures.asCompletionException(e); } return result; }); } else { return cf; } }
Source:
public Mono<Void> downloadToFile(String downloadFilePath, FileRange range) { AsynchronousFileChannel channel = channelSetup(downloadFilePath); return sliceFileRange(range) .flatMap(chunk -> downloadWithProperties(chunk, false) .map(dar -> dar.value().body()) .subscribeOn(Schedulers.elastic()) .flatMap(fbb -> FluxUtil.bytebufStreamToFile(fbb, channel, chunk.start() - (range == null ? 0 : range.start())) .subscribeOn(Schedulers.elastic()) .timeout(Duration.ofSeconds(300)) .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException)) .doOnTerminate(() -> LOGGER.asInfo().log("Saved " + chunk.toString() + " on thread " + Thread.currentThread().getName()))) .then() .doOnTerminate(() -> channelCleanUp(channel)); }

Target:
public Mono<Void> downloadToFile(String downloadFilePath, FileRange range) { AsynchronousFileChannel channel = channelSetup(downloadFilePath); return sliceFileRange(range) .flatMap(chunk -> downloadWithProperties(chunk, false) .map(dar -> dar.value().body()) .subscribeOn(Schedulers.elastic()) .flatMap(fbb -> FluxUtil.bytebufStreamToFile(fbb, channel, chunk.start() - (range == null ? 0 : range.start())) .subscribeOn(Schedulers.elastic()) .timeout(Duration.ofSeconds(DOWNLOAD_UPLOAD_CHUNK_TIMEOUT)) .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException))) .then() .doOnTerminate(() -> channelCleanUp(channel)); }
Source:
public ResponseEntity<?> getCursors(@PathVariable("subscriptionId") final String subscriptionId, final NativeWebRequest request, final Client client) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } try { final List<SubscriptionCursor> cursors = cursorsService.getSubscriptionCursors(subscriptionId, client) .stream() .map(cursor -> cursor.withToken(cursorTokenService.generateToken())) .collect(Collectors.toList()); return status(OK).body(new ItemsWrapper<>(cursors)); } catch (final NakadiException e) { return create(e.asProblem(), request); } }

Target:
public ResponseEntity<?> getCursors(@PathVariable("subscriptionId") final String subscriptionId, final NativeWebRequest request, final Client client) { featureToggleService.checkFeatureOn(HIGH_LEVEL_API); try { final List<SubscriptionCursor> cursors = cursorsService.getSubscriptionCursors(subscriptionId, client) .stream() .map(cursor -> cursor.withToken(cursorTokenService.generateToken())) .collect(Collectors.toList()); return status(OK).body(new ItemsWrapper<>(cursors)); } catch (final NakadiException e) { return create(e.asProblem(), request); } }
Source:
public static Path getSomePemFile() { Path pemFile; try { pemFile = Paths.get(Files.createTempFile("private-key_", ".pem").toUri()); File f = new File("test/resources/private-key.pem"); Files.copy(f.toPath(), pemFile, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { throw new RuntimeException(e); } return pemFile; }

Target:
public static Path getSomePemFile() { Path pemFile; try { pemFile = Paths.get(Files.createTempFile("private-key_", ".pem").toUri()); File f = new File("test/resources/private-key.pem"); Files.copy(f.toPath(), pemFile, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); pemFile.toFile().deleteOnExit(); } catch (IOException e) { throw new RuntimeException(e); } return pemFile; }
Source:
public void visitMethod(MethodTree method) { if (!method.is(Tree.Kind.CONSTRUCTOR) && returnsOptional(method)) { ModifiersTree modifiers = method.modifiers(); for (AnnotationTree annotation : modifiers.annotations()) { Type type = annotation.annotationType().symbolType(); if (type.is(NULLABLE)) { context.reportIssue(this, annotation, "Methods with an \"Optional\" return type should not be \"@Nullable\"."); } } method.accept(new ReturnNullVisitor()); } super.visitMethod(method); }

Target:
public void visitMethod(MethodTree method) { if (!method.is(Tree.Kind.CONSTRUCTOR) && returnsOptional(method)) { checkNullableAnnotation(method.modifiers(), "Methods with an \"Optional\" return type should not be \"@Nullable\"."); method.accept(new ReturnNullVisitor()); } super.visitMethod(method); }
Source:
private static Long parseMaxMemory( String maxMemoryString ) { if ( maxMemoryString != null ) { if ( maxMemoryString.endsWith( "%" ) ) { int percent = Integer.parseInt( maxMemoryString.substring( 0, maxMemoryString.length() - 1 ) ); return calculateMaxMemoryFromPercent( percent ); } return Settings.parseLongWithUnit( maxMemoryString ); } return null; }

Target:
private static Long parseMaxMemory( String maxMemoryString ) { if ( maxMemoryString != null ) { maxMemoryString = maxMemoryString.trim(); if ( maxMemoryString.endsWith( "%" ) ) { int percent = Integer.parseInt( maxMemoryString.substring( 0, maxMemoryString.length() - 1 ) ); return calculateMaxMemoryFromPercent( percent ); } return Settings.parseLongWithUnit( maxMemoryString ); } return null; }
Source:
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final ClassLoader initialContextClassLoader = Thread.currentThread().getContextClassLoader(); final Meter errors = errorMeter(method); final Context timerContext = timer(method).time(); try { Thread.currentThread().setContextClassLoader(serviceClass.getClassLoader()); final String serviceInterfaceName = serviceInterface.getSimpleName(); final String methodName = method.getName(); final Profiling<Object> prof = new Profiling<Object>(); final String profilingId = DOT_JOINER.join(serviceInterfaceName, methodName); return prof.executeWithProfiling(ProfilingFeatureType.PLUGIN, profilingId, new WithProfilingCallback() { @Override public Object execute() throws Throwable { return method.invoke(service, args); } }); } catch (final InvocationTargetException e) { errors.mark(); if (e.getCause() != null) { throw e.getCause(); } else { throw new RuntimeException(e); } } finally { timerContext.stop(); Thread.currentThread().setContextClassLoader(initialContextClassLoader); } }

Target:
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final ClassLoader initialContextClassLoader = Thread.currentThread().getContextClassLoader(); final Context timerContext = timer(method).time(); try { Thread.currentThread().setContextClassLoader(serviceClass.getClassLoader()); final String methodName = method.getName(); final Profiling<Object> prof = new Profiling<Object>(); final String profilingId = serviceInterfaceName + "." + methodName; return prof.executeWithProfiling(ProfilingFeatureType.PLUGIN, profilingId, new WithProfilingCallback() { @Override public Object execute() throws Throwable { return method.invoke(service, args); } }); } catch (final InvocationTargetException e) { final Meter errors = errorMeter(method); errors.mark(); if (e.getCause() != null) { throw e.getCause(); } else { throw new RuntimeException(e); } } finally { timerContext.stop(); Thread.currentThread().setContextClassLoader(initialContextClassLoader); } }
Source:
public void testSlaveAttributesFromLabel() throws Exception { Mesos.SlaveRequest request = mockSlaveRequestWithSlaveLabelAttributes(Boolean.TRUE, false, null, "testLabelString:docker-container-name"); jenkinsScheduler.requestJenkinsSlave(request, null); ArrayList<Protos.Offer> offers = new ArrayList<Protos.Offer>(); Protos.Offer rejectedOffer = createOfferWithAttributes("rack", "jenkins-master"); offers.add(rejectedOffer); offers.add(createOfferWithAttributes("rack", "jenkins-slave")); List<MesosSlaveInfo> mesosSlaveInfos = mockSlaveInfos(); Mockito.when(mesosCloud.getSlaveInfos()).thenReturn(mesosSlaveInfos); MesosComputer computer = Mockito.mock(MesosComputer.class); Mockito.when(jenkins.getComputers()).thenReturn(new Computer[] { computer }); SchedulerDriver driver = Mockito.mock(SchedulerDriver.class); jenkinsScheduler.setDriver(driver); jenkinsScheduler.resourceOffers(driver, offers); Mockito.verify(driver, Mockito.atLeastOnce()).declineOffer(rejectedOffer.getId(), Protos.Filters.newBuilder().setRefuseSeconds(5).build()); Mockito.verify(driver, Mockito.atLeastOnce()).suppressOffers(); }

Target:
public void testSlaveAttributesFromLabel() throws Exception { Mesos.SlaveRequest request = mockSlaveRequestWithSlaveLabelAttributes(Boolean.TRUE, false, null, "testLabelString:docker-container-name"); jenkinsScheduler.requestJenkinsSlave(request, null); ArrayList<Protos.Offer> offers = new ArrayList<Protos.Offer>(); Protos.Offer rejectedOffer = createOfferWithAttributes("rack", "jenkins-master"); offers.add(rejectedOffer); offers.add(createOfferWithAttributes("rack", "jenkins-slave")); List<MesosSlaveInfo> mesosSlaveInfos = mockSlaveInfos(); Mockito.when(mesosCloud.getSlaveInfos()).thenReturn(mesosSlaveInfos); MesosComputer computer = Mockito.mock(MesosComputer.class); Mockito.when(jenkins.getComputers()).thenReturn(new Computer[] { computer }); SchedulerDriver driver = Mockito.mock(SchedulerDriver.class); jenkinsScheduler.setDriver(driver); jenkinsScheduler.resourceOffers(driver, offers); Mockito.verify(driver, Mockito.atMost(1)).declineOffer(rejectedOffer.getId(), Protos.Filters.newBuilder().setRefuseSeconds(5).build()); Mockito.verify(driver, Mockito.atLeastOnce()).suppressOffers(); assertEquals(0, jenkinsScheduler.getUnmatchedLabels().size()); }
Source:
public void nullToEmptyString() { if (this.email == null) { this.email = ""; } if (this.name == null) { this.name = ""; } if (this.googleId == null) { this.googleId = ""; } if (this.team == null) { this.team = ""; } if (this.comments == null) { this.comments = ""; } if (this.section == null) { this.section = ""; } }

Target:
public void nullToEmptyString() { if (this.email == null) { this.email = ""; } if (this.name == null) { this.name = ""; } if (this.googleId == null) { this.googleId = ""; } if (this.comments == null) { this.comments = ""; } }
Source:
public void replaceUnderscores() { String badText = "I think _ on balance _ that people should use dashes. ___________ Never use underscores to separate text."; String cleanText = TextCleaner.replaceUnderscores(badText); boolean isGood = !(cleanText.contains("_")); logger.error(cleanText); assertEquals(true, isGood); }

Target:
public void replaceUnderscores() { String badText = "I think _ on balance _ that people should use dashes. ___________ Never use underscores to separate text."; String cleanText = TextCleaner.replaceUnderscores(badText); boolean isGood = !(cleanText.contains("_")); logger.info(cleanText); assertEquals(true, isGood); }
Source:
public Action deserialize(JsonElement jsonElement, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if (jsonElement == null || !jsonElement.isJsonObject()) return null; Map.Entry<String, JsonElement> firstEntry = jsonElement.getAsJsonObject().entrySet().iterator().next(); JsonElement actionValue = firstEntry.getValue(); String fieldName = null; if (this.actionClass.getEnclosingClass() != null && !Modifier.isStatic(this.actionClass.getModifiers())) { throw new JsonParseException("non static inner class is not allowed"); } else if (this.actionClass.getDeclaredFields().length == 1){ fieldName = this.actionClass.getDeclaredFields()[0].getName(); } JsonObject actionJson = new JsonObject(); if (fieldName == null) { throw new JsonParseException("can not find a user defined field"); } if (actionValue.isJsonPrimitive()) { JsonPrimitive primValue = actionValue.getAsJsonPrimitive(); if (primValue.isNumber()) { actionJson.addProperty(fieldName, primValue.getAsNumber()); }else if (primValue.isBoolean()) { actionJson.addProperty(fieldName, primValue.getAsBoolean()); }else if (primValue.isString()) { actionJson.addProperty(fieldName, primValue.getAsString()); } }else{ actionJson.add(fieldName, actionValue); } return new Gson().fromJson(actionJson, this.actionClass); }

Target:
public Action deserialize(JsonElement jsonElement, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if (jsonElement == null || !jsonElement.isJsonObject()) return null; Map.Entry<String, JsonElement> firstEntry = jsonElement.getAsJsonObject().entrySet().iterator().next(); JsonElement actionValue = firstEntry.getValue(); String fieldName = this.actionClass.getDeclaredFields()[0].getName(); JsonObject actionJson = new JsonObject(); if (actionValue.isJsonPrimitive()) { JsonPrimitive primValue = actionValue.getAsJsonPrimitive(); if (primValue.isNumber()) { actionJson.addProperty(fieldName, primValue.getAsNumber()); }else if (primValue.isBoolean()) { actionJson.addProperty(fieldName, primValue.getAsBoolean()); }else if (primValue.isString()) { actionJson.addProperty(fieldName, primValue.getAsString()); } }else{ actionJson.add(fieldName, actionValue); } return new Gson().fromJson(actionJson, this.actionClass); }
Source:
public void testReadUUIDMissingLogicalTypeUnsafe() throws IOException { System.clearProperty("avro.disable.unsafe"); Assume.assumeTrue( ReflectionUtil.getFieldAccess() instanceof FieldAccessUnsafe); Schema uuidSchema = SchemaBuilder.record(RecordWithUUID.class.getName()) .fields().requiredString("uuid").endRecord(); LogicalTypes.uuid().addToSchema(uuidSchema.getField("uuid").schema()); UUID u1 = UUID.randomUUID(); RecordWithStringUUID r1 = new RecordWithStringUUID(); r1.uuid = u1.toString(); File test = write( ReflectData.get().getSchema(RecordWithStringUUID.class), r1); RecordWithUUID datum = (RecordWithUUID) read( ReflectData.get().createDatumReader(uuidSchema), test).get(0); Object uuid = datum.uuid; Assert.assertTrue("UUID should be a String (unsafe)", uuid instanceof String); }

Target:
public void testReadUUIDMissingLogicalTypeUnsafe() throws IOException { String unsafeValue = System.getProperty("avro.disable.unsafe"); try { System.clearProperty("avro.disable.unsafe"); Assume.assumeTrue( ReflectionUtil.getFieldAccess() instanceof FieldAccessUnsafe); Schema uuidSchema = SchemaBuilder.record(RecordWithUUID.class.getName()) .fields().requiredString("uuid").endRecord(); LogicalTypes.uuid().addToSchema(uuidSchema.getField("uuid").schema()); UUID u1 = UUID.randomUUID(); RecordWithStringUUID r1 = new RecordWithStringUUID(); r1.uuid = u1.toString(); File test = write( ReflectData.get().getSchema(RecordWithStringUUID.class), r1); RecordWithUUID datum = (RecordWithUUID) read( ReflectData.get().createDatumReader(uuidSchema), test).get(0); Object uuid = datum.uuid; Assert.assertTrue("UUID should be a String (unsafe)", uuid instanceof String); } finally { if (unsafeValue != null) { System.setProperty("avro.disable.unsafe", unsafeValue); } } }
Source:
public void onReceive(final Context context, Intent intent) { Log.d(TAG, "Package changed: " + intent); if ((ACTION_PACKAGE_REMOVED.contains(intent.getAction()) && intent.getBooleanExtra(EXTRA_DATA_REMOVED, false) && intent.getBooleanExtra(EXTRA_REPLACING, true)) || ACTION_PACKAGE_FULLY_REMOVED.contains(intent.getAction()) || ACTION_PACKAGE_DATA_CLEARED.contains(intent.getAction())) { final GcmDatabase database = new GcmDatabase(context); final String packageName = intent.getData().getSchemeSpecificPart(); Log.d(TAG, "Package removed or data cleared: " + packageName); final GcmDatabase.App app = database.getApp(packageName); if (app != null) { new Thread(new Runnable() { @Override public void run() { List<GcmDatabase.Registration> registrations = database.getRegistrationsByApp(packageName); boolean deletedAll = true; for (GcmDatabase.Registration registration : registrations) { deletedAll &= PushRegisterManager.unregister(context, registration.packageName, registration.signature, null, null).deleted != null; } if (deletedAll) { database.removeApp(packageName); } database.close(); } }).start(); } else { database.close(); } } }

Target:
public void onReceive(final Context context, Intent intent) { Log.d(TAG, "Package changed: " + intent); if ((ACTION_PACKAGE_REMOVED.contains(intent.getAction()) && intent.getBooleanExtra(EXTRA_DATA_REMOVED, false) && !intent.getBooleanExtra(EXTRA_REPLACING, false)) || ACTION_PACKAGE_FULLY_REMOVED.contains(intent.getAction()) || ACTION_PACKAGE_DATA_CLEARED.contains(intent.getAction())) { final GcmDatabase database = new GcmDatabase(context); final String packageName = intent.getData().getSchemeSpecificPart(); Log.d(TAG, "Package removed or data cleared: " + packageName); final GcmDatabase.App app = database.getApp(packageName); if (app != null) { new Thread(new Runnable() { @Override public void run() { List<GcmDatabase.Registration> registrations = database.getRegistrationsByApp(packageName); boolean deletedAll = true; for (GcmDatabase.Registration registration : registrations) { deletedAll &= PushRegisterManager.unregister(context, registration.packageName, registration.signature, null, null).deleted != null; } if (deletedAll) { database.removeApp(packageName); } database.close(); } }).start(); } else { database.close(); } } }
Source:
public Armcc5CompilerParser() { super(Messages._Warnings_Armcc5_ParserName(), Messages._Warnings_Armcc5_LinkName(), Messages._Warnings_Armcc5_TrendName(), ARMCC5_WARNING_PATTERN); }

Target:
public Armcc5CompilerParser() { super(Messages._Warnings_Armcc_ParserName(), Messages._Warnings_Armcc_LinkName(), Messages._Warnings_Armcc_TrendName(), ARMCC5_WARNING_PATTERN); }
Source:
public void setVisible (boolean visible) { checkWidget(); Canvas canvas = getParent(); canvas.blink = true; canvas.drawFlag = visible; getDisplay().resetCaretTiming(); if (visible == isVisible) return; isVisible = visible; if (!isFocusCaret ()) return; if (isVisible) { showCaret (); } else { hideCaret (); } }

Target:
public void setVisible (boolean visible) { checkWidget(); Canvas canvas = getParent(); canvas.blink = true; canvas.drawFlag = visible; display.resetCaretTiming(); if (visible == isVisible) return; isVisible = visible; if (!isFocusCaret ()) return; if (isVisible) { showCaret (); } else { hideCaret (); } }
Source:
public void tearDown(final ManagementClient managementClient, final String containerId) { if (elytronDomainSetup != null) { servletElytronDomainSetup.tearDown(managementClient, containerId); ejbElytronDomainSetup.tearDown(managementClient, containerId); elytronDomainSetup.tearDown(managementClient, containerId); } else { super.tearDown(managementClient, containerId); } }

Target:
public void tearDown(final ManagementClient managementClient, final String containerId) { if (elytronDomainSetup != null) { Exception ex = null; try { servletElytronDomainSetup.tearDown(managementClient, containerId); } catch (Exception e) { ex = e; } try { ejbElytronDomainSetup.tearDown(managementClient, containerId); } catch (Exception e) { if (ex == null) ex = e; } try { elytronDomainSetup.tearDown(managementClient, containerId); } catch (Exception e) { if (ex == null) ex = e; } if (ex != null) throw new RuntimeException(ex); } else { super.tearDown(managementClient, containerId); } }
Source:
private void loadFunctionNamespaceManager(File file) throws Exception { String functionNamespaceManagerId = getNameWithoutExtension(file.getName()); log.info("-- Loading function namespace manager from %s --", file); Map<String, String> properties = new HashMap<>(loadProperties(file)); String functionNamespaceManagerName = properties.remove("function-namespace-manager.name"); checkState(functionNamespaceManagerName != null, "Function namespace configuration %s does not contain function-namespace-manager.name", file.getAbsoluteFile()); String functionNamespaces = properties.get("serving-namespaces"); checkState(functionNamespaces != null, "Function namespace configuration %s does not contain serving-namespaces", file.getAbsoluteFile()); functionManager.loadFunctionNamespaceManager(functionNamespaceManagerName, functionNamespaceManagerId, SPLITTER.splitToList(functionNamespaces), properties); log.info("-- Added function namespaces [%s] using function namespace manager [%s] --", functionNamespaces, functionNamespaceManagerId); }

Target:
private void loadFunctionNamespaceManager(File file) throws Exception { String catalogName = getNameWithoutExtension(file.getName()); log.info("-- Loading function namespace manager from %s --", file); Map<String, String> properties = new HashMap<>(loadProperties(file)); String functionNamespaceManagerName = properties.remove("function-namespace-manager.name"); checkState(functionNamespaceManagerName != null, "Function namespace configuration %s does not contain function-namespace-manager.name", file.getAbsoluteFile()); functionManager.loadFunctionNamespaceManager(functionNamespaceManagerName, catalogName, properties); log.info("-- Added function namespace manager [%s] --", catalogName); }
Source:
public static void addURL(URL u) throws IOException { if (!(ClassLoader.getSystemClassLoader() instanceof URLClassLoader)) { return; } URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); URL[] urls = sysLoader.getURLs(); for (URL url : urls) { if (StringUtils.equalsIgnoreCase(url.toString(), u.toString())) { if (log.isDebugEnabled()) { log.debug("URL " + u + " is already in the CLASSPATH"); } return; } } Class<URLClassLoader> sysclass = URLClassLoader.class; try { Method method = sysclass.getDeclaredMethod("addURL", parameters); method.setAccessible(true); method.invoke(sysLoader, new Object[] {u}); } catch (Throwable t) { t.printStackTrace(); throw new IOException("Error, could not add URL to system classloader"); } }

Target:
public static void addURL(URL u) throws IOException { if (!(ClassLoader.getSystemClassLoader() instanceof URLClassLoader)) { return; } URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); URL[] urls = sysLoader.getURLs(); for (int i = 0; i < urls.length; i++) { if (StringUtils.equalsIgnoreCase(urls[i].toString(), u.toString())) { if (log.isDebugEnabled()) { log.debug("URL " + u + " is already in the CLASSPATH"); } return; } } Class<URLClassLoader> sysclass = URLClassLoader.class; try { Method method = sysclass.getDeclaredMethod("addURL", parameters); method.setAccessible(true); method.invoke(sysLoader, new Object[] {u}); } catch (Throwable t) { t.printStackTrace(); throw new IOException("Error, could not add URL to system classloader"); } }
Source:
public void testGroupByQuery() throws Exception { insertPeopleDocuments(); final Table table = dataContext.getDefaultSchema().getTableByName(DEFAULT_TABLE_NAME); final Query q = new Query(); q.from(table); q.groupBy(table.getColumnByName("gender")); q .select(new SelectItem(table.getColumnByName("gender")), new SelectItem(FunctionType.MAX, table .getColumnByName("age")), new SelectItem(FunctionType.MIN, table.getColumnByName("age")), new SelectItem(FunctionType.COUNT, "*", "total"), new SelectItem(FunctionType.MIN, table .getColumnByName("id")).setAlias("firstId")); q.orderBy("gender"); final DataSet data = dataContext.executeQuery(q); assertEquals("[" + DEFAULT_TABLE_NAME + ".gender, MAX(" + DEFAULT_TABLE_NAME + ".age), MIN(" + DEFAULT_TABLE_NAME + ".age), COUNT(*) AS total, MIN(" + DEFAULT_TABLE_NAME + ".id) AS firstId]", Arrays.toString(data.getSelectItems().toArray())); assertTrue(data.next()); assertEquals("Row[values=[female, 20, 17, 5, 5]]", data.getRow().toString()); assertTrue(data.next()); assertEquals("Row[values=[male, 19, 17, 4, 1]]", data.getRow().toString()); assertFalse(data.next()); }

Target:
public void testGroupByQuery() throws Exception { insertPeopleDocuments(); final Table table = dataContext.getDefaultSchema().getTableByName(DEFAULT_TABLE_NAME); final Query query = new Query(); query.from(table); query.groupBy(table.getColumnByName("gender")); query .select(new SelectItem(table.getColumnByName("gender")), new SelectItem(FunctionType.MAX, table .getColumnByName("age")), new SelectItem(FunctionType.MIN, table.getColumnByName("age")), new SelectItem(FunctionType.COUNT, "*", "total"), new SelectItem(FunctionType.MIN, table .getColumnByName("id")).setAlias("firstId")); query.orderBy("gender"); final DataSet data = dataContext.executeQuery(query); assertEquals("[" + DEFAULT_TABLE_NAME + ".gender, MAX(" + DEFAULT_TABLE_NAME + ".age), MIN(" + DEFAULT_TABLE_NAME + ".age), COUNT(*) AS total, MIN(" + DEFAULT_TABLE_NAME + ".id) AS firstId]", Arrays.toString(data.getSelectItems().toArray())); assertTrue(data.next()); assertEquals("Row[values=[female, 20, 17, 5, 5]]", data.getRow().toString()); assertTrue(data.next()); assertEquals("Row[values=[male, 19, 17, 4, 1]]", data.getRow().toString()); assertFalse(data.next()); }
Source:
public int compareTo(CostBenefitInfo that) { if (costBenefitRatio.compareTo(that.costBenefitRatio) != 0) { return costBenefitRatio.compareTo(that.costBenefitRatio); } if (benefit != that.benefit) { return benefit > that.benefit ? -1 : 1; } return 0; }

Target:
public int compareTo(CostBenefitInfo that) { int compareToVal = costBenefitRatio.compareTo(that.costBenefitRatio); if (compareToVal != 0) { return compareToVal; } return Integer.compare(that.benefit, benefit); }
Source:
public AllelicCount(final AllelicCount count) { this.interval = count.getInterval(); this.refReadCount = count.getRefReadCount(); this.altReadCount = count.getAltReadCount(); Nucleotide tempNucleotide; try { tempNucleotide = count.getRefNucleotide(); } catch (final IllegalArgumentException e) { tempNucleotide = null; } this.refNucleotide = tempNucleotide; try { tempNucleotide = count.getAltNucleotide(); } catch (final IllegalArgumentException e) { tempNucleotide = null; } this.altNucleotide = tempNucleotide; Integer tempInteger; try { tempInteger = count.getReadDepth(); } catch (final IllegalArgumentException e) { tempInteger = null; } this.readDepth = tempInteger; Double tempDouble; try { tempDouble = count.getHetLogOdds(); } catch (final IllegalArgumentException e) { tempDouble = null; } this.hetLogOdds = tempDouble; }

Target:
public AllelicCount(final AllelicCount count) { Utils.nonNull(count, "AllelicCount cannot be null."); interval = count.interval; refReadCount = count.refReadCount; altReadCount = count.altReadCount; refNucleotide = count.refNucleotide; altNucleotide = count.altNucleotide; readDepth = count.readDepth; hetLogOdds = count.hetLogOdds; }
Source:
public Set<String> getModelNames() { return this.models.keySet(); }

Target:
public ImmutableSet<String> getModelNames() { return ImmutableSet.copyOf(models.keySet()); }
Source:
String validateFoundNode(CuratorFrameworkImpl client, CreateMode createMode, String foundNode) throws Exception { if ( doProtected && createMode.isEphemeral() ) { if ( sessionId != client.getZooKeeper().getSessionId() ) { log.info("Session has changed during protected mode with ephemeral. old: new: {}", sessionId, client.getZooKeeper().getSessionId()); if ( foundNode != null ) { log.info("Deleted old session's found node: {}", foundNode); client.getFailedDeleteManager().executeGuaranteedOperationInBackground(foundNode); foundNode = null; } sessionId = client.getZooKeeper().getSessionId(); } } return foundNode; }

Target:
String validateFoundNode(CuratorFrameworkImpl client, CreateMode createMode, String foundNode) throws Exception { if ( doProtected && createMode.isEphemeral() ) { long clientSessionId = client.getZooKeeper().getSessionId(); if ( this.sessionId != clientSessionId ) { log.info("Session has changed during protected mode with ephemeral. old: new: {}", this.sessionId, clientSessionId); if ( foundNode != null ) { log.info("Deleted old session's found node: {}", foundNode); client.getFailedDeleteManager().executeGuaranteedOperationInBackground(foundNode); foundNode = null; } this.sessionId = clientSessionId; } } return foundNode; }
Source:
private String createTopic(Datastream datastream) { Properties datastreamProperties = new Properties(); datastreamProperties.putAll(datastream.getMetadata()); Properties topicProperties = new VerifiableProperties(datastreamProperties).getDomainProperties("topic"); return _transportProvider.createTopic(datastream.getName(), DEFAULT_NUMBER_PARTITIONS, topicProperties); }

Target:
private String createTopic(Datastream datastream) { Properties datastreamProperties = new Properties(); datastreamProperties.putAll(datastream.getMetadata()); Properties topicProperties = new VerifiableProperties(datastreamProperties).getDomainProperties("topic"); return _transportProvider.createTopic(getTopicName(datastream), DEFAULT_NUMBER_PARTITIONS, topicProperties); }
Source:
protected void addMouseListener(final Table table, final Shell dialog) { table.addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent e) { ok(dialog, table); } @Override public void mouseDown(MouseEvent e) { if (e.button == 3) { } else { ok(dialog, table); } } @Override public void mouseUp(MouseEvent e) { if (e.button == 3) { if (table.equals(e.getSource())) { TableItem ti = table.getItem(new Point(e.x, e.y)); if (ti != null) { Menu menu = new Menu(table); MenuItem mi = new MenuItem(menu, SWT.NONE); mi.setText(WorkbenchMessages.FilteredTableBaseHandler_Close); mi.addListener(SWT.Selection, se -> { close(ti); }); menu.setVisible(true); } } } else { ok(dialog, table); } } }); }

Target:
protected void addMouseListener(final Table table, final Shell dialog) { table.addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent e) { ok(dialog, table); } @Override public void mouseDown(MouseEvent e) { if (e.button == 3) { } else { ok(dialog, table); } } @Override public void mouseUp(MouseEvent e) { if (e.button == 3) { if (table.equals(e.getSource())) { TableItem ti = table.getItem(new Point(e.x, e.y)); if (ti != null && ti.getData() instanceof EditorReference) { Menu menu = new Menu(table); MenuItem mi = new MenuItem(menu, SWT.NONE); mi.setText(WorkbenchMessages.FilteredTableBaseHandler_Close); mi.addListener(SWT.Selection, se -> close(ti)); menu.setVisible(true); } } } else { ok(dialog, table); } } }); }
Source:
private static void loadRulesFromFile(IgnoreNode r, File exclude) throws FileNotFoundException, IOException { try { if (FS.DETECTED.exists(exclude)) { FileInputStream in = new FileInputStream(exclude); try { r.parse(in); } finally { in.close(); } } } catch (AccessControlException ignored) { } }

Target:
private static void loadRulesFromFile(IgnoreNode r, File exclude) throws FileNotFoundException, IOException { if (FS.DETECTED.exists(exclude)) { FileInputStream in = new FileInputStream(exclude); try { r.parse(in); } finally { in.close(); } } }
Source:
BookieNettyServer(ServerConfiguration conf, RequestProcessor processor) throws IOException, KeeperException, InterruptedException, BookieException { this.conf = conf; this.requestProcessor = processor; ThreadFactoryBuilder tfb = new ThreadFactoryBuilder(); String base = "bookie-" + conf.getBookiePort() + "-netty"; serverChannelFactory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(tfb.setNameFormat(base + "-boss-%d").build()), Executors.newCachedThreadPool(tfb.setNameFormat(base + "-worker-%d").build())); if (conf.isEnableLocalTransport()) { jvmServerChannelFactory = new DefaultLocalServerChannelFactory(); } else { jvmServerChannelFactory = null; } bookieAddress = Bookie.getBookieAddress(conf); InetSocketAddress bindAddress; if (conf.getListeningInterface() == null) { bindAddress = new InetSocketAddress(conf.getBookiePort()); } else { bindAddress = bookieAddress.getSocketAddress(); } listenOn(bindAddress,bookieAddress); }

Target:
BookieNettyServer(ServerConfiguration conf, RequestProcessor processor) throws IOException, KeeperException, InterruptedException, BookieException { this.conf = conf; this.requestProcessor = processor; ExtensionRegistry registry = ExtensionRegistry.newInstance(); authProviderFactory = AuthProviderFactoryFactory.newBookieAuthProviderFactory(conf, registry); responseEncoder = new BookieProtoEncoding.ResponseEncoder(registry); requestDecoder = new BookieProtoEncoding.RequestDecoder(registry); ThreadFactoryBuilder tfb = new ThreadFactoryBuilder(); String base = "bookie-" + conf.getBookiePort() + "-netty"; serverChannelFactory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(tfb.setNameFormat(base + "-boss-%d").build()), Executors.newCachedThreadPool(tfb.setNameFormat(base + "-worker-%d").build())); if (conf.isEnableLocalTransport()) { jvmServerChannelFactory = new DefaultLocalServerChannelFactory(); } else { jvmServerChannelFactory = null; } bookieAddress = Bookie.getBookieAddress(conf); InetSocketAddress bindAddress; if (conf.getListeningInterface() == null) { bindAddress = new InetSocketAddress(conf.getBookiePort()); } else { bindAddress = bookieAddress.getSocketAddress(); } listenOn(bindAddress, bookieAddress); }
Source:
public void sendJSONMessage(String message) { player.spigot().sendMessage(ComponentSerializer.parse(message)); }

Target:
public void sendJSONMessage(String message) { getPlayer().spigot().sendMessage(ComponentSerializer.parse(message)); }
Source:
protected LogicalProcessor[] initProcessorCounts() { Map<Integer, Integer> numaNodeMap = mapNumaNodes(); List<String> procCpu = FileUtil.readFile("/proc/cpuinfo"); List<LogicalProcessor> logProcs = new ArrayList<>(); int currentProcessor = 0; int currentCore = 0; int currentPackage = 0; boolean first = true; for (String cpu : procCpu) { if (cpu.startsWith("processor")) { if (!first) { logProcs.add(new LogicalProcessor(currentProcessor, currentCore, currentPackage, numaNodeMap.getOrDefault(currentProcessor, 0))); } else { first = false; } currentProcessor = ParseUtil.parseLastInt(cpu, 0); } else if (cpu.startsWith("core id") || cpu.startsWith("cpu number")) { currentCore = ParseUtil.parseLastInt(cpu, 0); } else if (cpu.startsWith("physical id")) { currentPackage = ParseUtil.parseLastInt(cpu, 0); } } logProcs.add(new LogicalProcessor(currentProcessor, currentCore, currentPackage, numaNodeMap.getOrDefault(currentProcessor, 0))); Set<String> physProcPkgs = new HashSet<>(); Set<Integer> physPkgs = new HashSet<>(); for (LogicalProcessor logProc : logProcs) { int pkg = logProc.getPhysicalPackageNumber(); physProcPkgs.add("" + logProc.getPhysicalProcessorNumber() + ":" + pkg); physPkgs.add(pkg); } this.logicalProcessorCount = logProcs.size(); this.physicalProcessorCount = physProcPkgs.size(); this.physicalPackageCount = physPkgs.size(); return logProcs.toArray(new LogicalProcessor[0]); }

Target:
protected LogicalProcessor[] initProcessorCounts() { Map<Integer, Integer> numaNodeMap = mapNumaNodes(); List<String> procCpu = FileUtil.readFile("/proc/cpuinfo"); List<LogicalProcessor> logProcs = new ArrayList<>(); int currentProcessor = 0; int currentCore = 0; int currentPackage = 0; boolean first = true; for (String cpu : procCpu) { if (cpu.startsWith("processor")) { if (!first) { logProcs.add(new LogicalProcessor(currentProcessor, currentCore, currentPackage, numaNodeMap.getOrDefault(currentProcessor, 0))); } else { first = false; } currentProcessor = ParseUtil.parseLastInt(cpu, 0); } else if (cpu.startsWith("core id") || cpu.startsWith("cpu number")) { currentCore = ParseUtil.parseLastInt(cpu, 0); } else if (cpu.startsWith("physical id")) { currentPackage = ParseUtil.parseLastInt(cpu, 0); } } logProcs.add(new LogicalProcessor(currentProcessor, currentCore, currentPackage, numaNodeMap.getOrDefault(currentProcessor, 0))); Set<String> physProcPkgs = new HashSet<>(); Set<Integer> physPkgs = new HashSet<>(); for (LogicalProcessor logProc : logProcs) { int pkg = logProc.getPhysicalPackageNumber(); physProcPkgs.add(logProc.getPhysicalProcessorNumber() + ":" + pkg); physPkgs.add(pkg); } this.logicalProcessorCount = logProcs.size(); this.physicalProcessorCount = physProcPkgs.size(); this.physicalPackageCount = physPkgs.size(); return logProcs.toArray(new LogicalProcessor[0]); }
Source:
public void roundTrip_full() throws IOException { InspectContainerResponse[] responses = testRoundTrip(CommandJSONSamples.inspectContainerResponse_full, InspectContainerResponse[].class); assertEquals(1, responses.length); final InspectContainerResponse response = responses[0]; assertEquals(response.getVolumes().length, 2); assertEquals(response.getVolumesRW().length, 2); assertEquals(response.getVolumes()[1].getContainerPath(), "/bar/foo/myvol2"); assertEquals(response.getVolumes()[1].getHostPath(), "/path2"); assertEquals(response.getVolumesRW()[1].getVolume().getPath(), "/bar/foo/myvol2"); assertFalse(response.getVolumesRW()[1].getAccessMode().toBoolean()); assertTrue(response.getVolumesRW()[0].getAccessMode().toBoolean()); assertEquals(response.getLogPath(), "/mnt/sda1/var/lib/docker/containers/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1-json.log"); }

Target:
public void roundTrip_full() throws IOException { InspectContainerResponse[] responses = testRoundTrip(CommandJSONSamples.inspectContainerResponse_full, InspectContainerResponse[].class); assertEquals(1, responses.length); final InspectContainerResponse response = responses[0]; assertEquals(response.getVolumes().length, 2); assertEquals(response.getVolumesRW().length, 2); assertEquals(response.getVolumes()[1].getContainerPath(), "/bar/foo/myvol2"); assertEquals(response.getVolumes()[1].getHostPath(), "/path2"); assertEquals(response.getVolumesRW()[1].getVolume().getPath(), "/bar/foo/myvol2"); assertFalse(response.getVolumesRW()[1].getAccessMode().toBoolean()); assertTrue(response.getVolumesRW()[0].getAccessMode().toBoolean()); assertThat(response.getLogPath(), is("/mnt/sda1/var/lib/docker/containers/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1-json.log")); }
Source:
public void validate(ValidationContext validationContext) { if (!isValidTypeValue()) { errors.add(TYPE, String.format("You have defined approval type as '%s'. Approval can only be of the type '%s' or '%s'.", type, MANUAL, SUCCESS)); } if (validationContext.isWithinPipelines()) { PipelineConfigs group = validationContext.getPipelineGroup(); if (!group.hasOperationPermissionDefined()) { return; } AdminsConfig adminsConfig = group.getAuthorization().getOperationConfig(); for (Admin user : authConfig) { RolesConfig roles = validationContext.getServerSecurityConfig().getRoles(); if (!validationContext.getServerSecurityConfig().isAdmin(user) && !adminsConfig.has(user, roles.memberRoles(user))) { user.addError(String.format("%s \"%s\" who is not authorized to operate pipeline group can not be authorized to approve stage", user.describe(), user)); } } } }

Target:
public void validate(ValidationContext validationContext) { if (!isValidTypeValue()) { errors.add(TYPE, String.format("You have defined approval type as '%s'. Approval can only be of the type '%s' or '%s'.", type, MANUAL, SUCCESS)); } if (validationContext.isWithinPipelines()) { PipelineConfigs group = validationContext.getPipelineGroup(); if (!group.hasOperationPermissionDefined()) { return; } AdminsConfig adminsConfig = group.getAuthorization().getOperationConfig(); RolesConfig roles = validationContext.getServerSecurityConfig().getRoles(); for (Admin user : authConfig) { if (!validationContext.getServerSecurityConfig().isAdmin(user) && !adminsConfig.has(user, roles.memberRoles(user))) { user.addError(String.format("%s \"%s\" who is not authorized to operate pipeline group can not be authorized to approve stage", user.describe(), user)); } } } }
Source:
@Override public int hashCode() { return new HashCodeBuilder().append(clusterId).toHashCode(); }

Target:
public int hashCode() { return Objects.hashCode(clusterId); }
Source:
public void scanAndApply( final ManipulationSession session ) throws ManipulationException { final List<Project> projects = pomIO.parseProject( session.getPom() ); scan( projects, session ); for ( final Project project : projects ) { logger.debug( "Got " + project + " (POM: " + project.getPom() + ")" ); } Set<Project> changed = applyManipulations( projects, session ); if ( !changed.isEmpty() ) { logger.info( "Maven-Manipulation-Extension: Rewrite changed: " + projects ); pomIO.rewritePOMs( changed ); try { new File( session.getTargetDir().getParentFile(), ManipulationManager.MARKER_PATH ).mkdirs(); new File( session.getTargetDir().getParentFile(), ManipulationManager.MARKER_FILE ).createNewFile(); } catch ( IOException e ) { throw new ManipulationException( "Marker file creation failed", e ); } } applyAfterManipulations( projects, session ); try { File resultFile = new File( session.getTargetDir(), ManipulationManager.RESULT_FILE ); boolean recreated = true; resultFile.getParentFile().mkdirs(); if ( resultFile.exists() ) { recreated = recreated && resultFile.delete(); } recreated = recreated && resultFile.createNewFile(); if ( !recreated ) { throw new ManipulationException( "Could not (re)create " + resultFile.getCanonicalPath() ); } try (FileWriter writer = new FileWriter( resultFile )) { writer.write( collectResults( session ) ); } } catch ( IOException e ) { throw new ManipulationException( "Result file creation failed", e ); } for (ExtensionInfrastructure e : infrastructure.values()) { e.finish(); } logger.info( "Maven-Manipulation-Extension: Finished." ); }

Target:
public void scanAndApply( final ManipulationSession session ) throws ManipulationException { final List<Project> projects = pomIO.parseProject( session.getPom() ); scan( projects, session ); for ( final Project project : projects ) { logger.debug( "Got " + project + " (POM: " + project.getPom() + ")" ); } Set<Project> changed = applyManipulations( projects, session ); if ( !changed.isEmpty() ) { logger.info( "Maven-Manipulation-Extension: Rewrite changed: " + projects ); pomIO.rewritePOMs( changed ); try { new File( session.getTargetDir().getParentFile(), ManipulationManager.MARKER_PATH ).mkdirs(); new File( session.getTargetDir().getParentFile(), ManipulationManager.MARKER_FILE ).createNewFile(); try (FileWriter writer = new FileWriter( new File ( session.getTargetDir().getParentFile(), RESULT_FILE ) ) ) { writer.write( collectResults( session ) ); } } catch ( IOException e ) { logger.error( "Unable to create marker or result file", e ); throw new ManipulationException( "Marker/result file creation failed", e ); } } for (ExtensionInfrastructure e : infrastructure.values()) { e.finish(); } logger.info( "Maven-Manipulation-Extension: Finished." ); }
Source:
public void testDefaultConfiguration() { ServerConfiguration configuration = new ServerConfiguration(); Assert.assertEquals(configuration.getBooleanProperty(USE_CROSS_SITE_ORIGIN_FILTER, USE_CROSS_SITE_ORIGIN_FILTER_DEFAULT_VALUE), true); }

Target:
public void testDefaultConfiguration() { final ServerConfiguration configuration = new ServerConfiguration(); Assert.assertEquals(configuration.getBooleanProperty(USE_CROSS_SITE_ORIGIN_FILTER, USE_CROSS_SITE_ORIGIN_FILTER_DEFAULT_VALUE), true); }
Source:
private void enqueueExceptionalPaths(ProgramState ps, @Nullable MethodYield methodYield) { Set<CFG.Block> exceptionBlocks = node.programPoint.block.exceptions(); List<CFG.Block> catchBlocks = exceptionBlocks.stream().filter(CFG.Block.IS_CATCH_BLOCK).collect(Collectors.toList()); SymbolicValue peekValue = ps.peekValue(); Preconditions.checkState(peekValue instanceof SymbolicValue.ExceptionalSymbolicValue, "Top of stack should always contains exceptional SV"); SymbolicValue.ExceptionalSymbolicValue exceptionSV = (SymbolicValue.ExceptionalSymbolicValue) peekValue; Type thrownType = exceptionSV.exceptionType(); Optional<CFG.Block> firstMatchingCatchBlock = catchBlocks.stream() .filter(b -> isCaughtByBlock(thrownType, b)) .sorted((b1, b2) -> Integer.compare(b2.id(), b1.id())) .findFirst(); if (firstMatchingCatchBlock.isPresent()) { enqueue(new ProgramPoint(firstMatchingCatchBlock.get()), ps, methodYield); return; } if (thrownType == null || thrownType.isUnknown()) { catchBlocks.stream() .filter(ExplodedGraphWalker::isCatchingUncheckedException) .forEach(b -> enqueue(new ProgramPoint(b), ps, methodYield)); } ps.storeExitValue(); List<CFG.Block> otherBlocks = exceptionBlocks.stream() .filter(CFG.Block.IS_CATCH_BLOCK.negate()).collect(Collectors.toList()); if (!otherBlocks.isEmpty()) { otherBlocks.forEach(b -> enqueue(new ProgramPoint(b), ps, true, methodYield)); } else { CFG.Block methodExit = node.programPoint.block.successors() .stream() .filter(CFG.Block::isMethodExitBlock) .findFirst() .orElse(exitBlock); enqueue(new ProgramPoint(methodExit), ps, true, methodYield); } }

Target:
private void enqueueExceptionalPaths(ProgramState ps, @Nullable MethodYield methodYield) { Set<CFG.Block> exceptionBlocks = node.programPoint.block.exceptions(); List<CFG.Block> catchBlocks = exceptionBlocks.stream().filter(CFG.Block.IS_CATCH_BLOCK).collect(Collectors.toList()); SymbolicValue peekValue = ps.peekValue(); Preconditions.checkState(peekValue instanceof SymbolicValue.ExceptionalSymbolicValue, "Top of stack should always contains exceptional SV"); SymbolicValue.ExceptionalSymbolicValue exceptionSV = (SymbolicValue.ExceptionalSymbolicValue) peekValue; Optional<CFG.Block> firstMatchingCatchBlock = catchBlocks.stream() .filter(b -> isCaughtByBlock(exceptionSV.exceptionType(), b)) .sorted((b1, b2) -> Integer.compare(b2.id(), b1.id())) .findFirst(); if (firstMatchingCatchBlock.isPresent()) { enqueue(new ProgramPoint(firstMatchingCatchBlock.get()), ps, methodYield); return; } catchBlocks.stream() .filter(ExplodedGraphWalker::isCatchingUncheckedException) .forEach(b -> enqueue(new ProgramPoint(b), ps, methodYield)); ps.storeExitValue(); List<CFG.Block> otherBlocks = exceptionBlocks.stream() .filter(CFG.Block.IS_CATCH_BLOCK.negate()) .collect(Collectors.toList()); if (otherBlocks.isEmpty()) { CFG.Block methodExit = node.programPoint.block.successors() .stream() .filter(CFG.Block::isMethodExitBlock) .findFirst() .orElse(exitBlock); enqueue(new ProgramPoint(methodExit), ps, true, methodYield); } else { otherBlocks.forEach(b -> enqueue(new ProgramPoint(b), ps, true, methodYield)); } }