auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static <T> T adapt(Object sourceObject, Class<T> adapter, boolean allowActivation) { if (sourceObject == null) { return null; } if (adapter.isInstance(sourceObject)) { return (T) sourceObject; } if (sourceObject instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) sourceObject; Object result = adaptable.getAdapter(adapter); if (result != null) { if (!adapter.isInstance(result)) { throw new AssertionFailedException(adaptable.getClass().getName() + ".getAdapter(" + adapter.getName() + ".class) returned " + result.getClass().getName() + " that is not an instance of " + adapter.getName()); } return (T) result; } } if ((sourceObject instanceof PlatformObject) && !allowActivation) { return null; } String adapterId = adapter.getName(); Object result = queryAdapterManager(sourceObject, adapterId, allowActivation); if (result != null) { if (!adapter.isInstance(result)) { throw new AssertionFailedException(result.getClass().getName() + ", returned as an adapter for " + sourceObject.getClass().getName() + ", is not an instance of " + adapter.getName()); } return (T) result; } return null; }

Target:
public static <T> T adapt(Object sourceObject, Class<T> adapter, boolean allowActivation) { if (sourceObject == null) { return null; } if (adapter.isInstance(sourceObject)) { return (T) sourceObject; } if (sourceObject instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) sourceObject; Object result = adaptable.getAdapter(adapter); if (result != null) { if (!adapter.isInstance(result)) { throw new AssertionFailedException(adaptable.getClass().getName() + ".getAdapter(" + adapter.getName() + ".class) returned " + result.getClass().getName() + " that is not an instance the requested type"); } return (T) result; } } if ((sourceObject instanceof PlatformObject) && !allowActivation) { return null; } String adapterId = adapter.getName(); Object result = queryAdapterManager(sourceObject, adapterId, allowActivation); if (result != null) { if (!adapter.isInstance(result)) { throw new AssertionFailedException(result.getClass().getName() + ", returned by the AdapterManager for " + sourceObject.getClass().getName() + ", is not an instance of " + adapter.getName()); } return (T) result; } return null; }
Source:
private void refreshClusterHeavyWeightData(VDSGroup cluster) { VDS upServer = getClusterUtils().getRandomUpServer(cluster.getId()); if (upServer == null) { log.debug("No server UP in cluster '{}'. Can't refresh it's data at this point.", cluster.getName()); return; } for (GlusterVolumeEntity volume : getVolumeDao().getByClusterId(cluster.getId())) { log.debug("Refreshing brick statuses for volume '{}' of cluster '{}'", volume.getName(), cluster.getName()); if (volume.isOnline()) { acquireLock(cluster.getId()); try { refreshVolumeDetails(upServer, volume); } catch (Exception e) { log.error("Error while refreshing brick statuses for volume '{}' of cluster '{}': {}", volume.getName(), cluster.getName(), e.getMessage()); log.debug("Exception", e); } finally { releaseLock(cluster.getId()); } disableCliSnapshotSchedulingFlag(cluster, volume); } } }

Target:
private void refreshClusterHeavyWeightData(VDSGroup cluster) { VDS upServer = getClusterUtils().getRandomUpServer(cluster.getId()); if (upServer == null) { log.debug("No server UP in cluster '{}'. Can't refresh it's data at this point.", cluster.getName()); return; } for (GlusterVolumeEntity volume : getVolumeDao().getByClusterId(cluster.getId())) { log.debug("Refreshing brick statuses for volume '{}' of cluster '{}'", volume.getName(), cluster.getName()); if (volume.isOnline()) { acquireLock(cluster.getId()); try { refreshVolumeDetails(upServer, volume); } catch (Exception e) { log.error("Error while refreshing brick statuses for volume '{}' of cluster '{}': {}", volume.getName(), cluster.getName(), e.getMessage()); log.debug("Exception", e); } finally { releaseLock(cluster.getId()); } runVdsCommand(VDSCommandType.OverrideGlusterVolumeSnapshotSchedule, new GlusterVolumeActionVDSParameters(upServer.getId(), volume.getName(), false)); } } }
Source:
void deleteQueue() { String queueName = testResourceNamer.randomName("test", 7); QueueDescription description = new QueueDescription().setMaxDeliveryCount(15); CreateQueueBody createEntity = new CreateQueueBody(); CreateQueueBodyContent content = new CreateQueueBodyContent() .setType("application/xml") .setQueueDescription(description); createEntity.setContent(content); logger.info("Creating queue: {}", queueName); Response<Object> response = queuesClient.putWithResponseAsync(queueName, createEntity, null, Context.NONE) .block(timeout); assertNotNull(response); StepVerifier.create(queuesClient.deleteWithResponseAsync(queueName, Context.NONE)) .assertNext(deletedResponse -> assertEquals(200, deletedResponse.getStatusCode())) .verifyComplete(); }

Target:
void deleteQueue() { String queueName = testResourceNamer.randomName("test", 7); QueueDescription description = new QueueDescription().setMaxDeliveryCount(15); CreateQueueBody createEntity = new CreateQueueBody(); CreateQueueBodyContent content = new CreateQueueBodyContent() .setType("application/xml") .setQueueDescription(description); createEntity.setContent(content); logger.info("Creating queue: {}", queueName); Response<Object> response = queuesClient.putWithResponseAsync(queueName, createEntity, null, Context.NONE) .block(timeout); assertNotNull(response); StepVerifier.create(queuesClient.deleteWithResponseAsync(queueName, Context.NONE)) .assertNext(deletedResponse -> { assertEquals(200, deletedResponse.getStatusCode()); }) .verifyComplete(); }
Source:
private Map<Long, Boolean> getResultForPutList(final List<Long> inputKeys, final List<LongRange> failedKeyRanges) { final Map<Long, Boolean> resultMap = new HashMap<>(inputKeys.size()); if (failedKeyRanges.isEmpty()) { for (final long key : inputKeys) { resultMap.put(key, true); } return resultMap; } Collections.sort(failedKeyRanges, LongRangeUtils.LONG_RANGE_COMPARATOR); Collections.sort(inputKeys); final Iterator<LongRange> rangeIterator = failedKeyRanges.iterator(); LongRange range = rangeIterator.next(); int keyIdx; for (keyIdx = 0; keyIdx < inputKeys.size(); keyIdx++) { final long key = inputKeys.get(keyIdx); if (range.getMinimumLong() > key) { resultMap.put(key, false); continue; } if (range.getMaximumLong() < key) { if (rangeIterator.hasNext()) { range = rangeIterator.next(); keyIdx--; continue; } else { break; } } resultMap.put(key, true); } for (; keyIdx < inputKeys.size(); keyIdx++) { resultMap.put(inputKeys.get(keyIdx), false); } return resultMap; }

Target:
private Map<Long, Boolean> getResultForPutList(final List<Long> inputKeys, final List<LongRange> failedKeyRanges) { final Map<Long, Boolean> resultMap = new HashMap<>(inputKeys.size()); if (failedKeyRanges.isEmpty()) { for (final long key : inputKeys) { resultMap.put(key, true); } return resultMap; } Collections.sort(failedKeyRanges, LongRangeUtils.LONG_RANGE_COMPARATOR); Collections.sort(inputKeys); final Iterator<LongRange> rangeIterator = failedKeyRanges.iterator(); LongRange range = rangeIterator.next(); int keyIdx; for (keyIdx = 0; keyIdx < inputKeys.size(); keyIdx++) { final long key = inputKeys.get(keyIdx); if (range.getMinimumLong() > key) { resultMap.put(key, true); continue; } if (range.getMaximumLong() < key) { if (rangeIterator.hasNext()) { range = rangeIterator.next(); keyIdx--; continue; } else { break; } } resultMap.put(key, false); } for (; keyIdx < inputKeys.size(); keyIdx++) { resultMap.put(inputKeys.get(keyIdx), true); } return resultMap; }
Source:
public GlobalContext( FileSystem fs, boolean deterministicFunctions, GlobalOptions globalOptions, KRunOptions krunOptions, KExceptionManager kem, SMTOptions smtOptions, Map<String, MethodHandle> hookProvider, FileUtil files, Stage stage) { this.fs = fs; this.globalOptions = globalOptions; this.krunOptions = krunOptions; this.kem = kem; this.hookProvider = hookProvider; this.files = files; this.equalityOps = new EqualityOperations(() -> def); this.constraintOps = new SMTOperations(() -> def, smtOptions, new Z3Wrapper(smtOptions, kem, globalOptions, files), globalOptions); this.kItemOps = new KItemOperations(stage, deterministicFunctions, kem, this::builtins, globalOptions); this.stage = stage; }

Target:
public GlobalContext( FileSystem fs, boolean deterministicFunctions, GlobalOptions globalOptions, KRunOptions krunOptions, KExceptionManager kem, SMTOptions smtOptions, Map<String, MethodHandle> hookProvider, FileUtil files, Stage stage) { this.fs = fs; this.globalOptions = globalOptions; this.krunOptions = krunOptions; this.kem = kem; this.hookProvider = hookProvider; this.files = files; this.equalityOps = new EqualityOperations(() -> def); this.constraintOps = new SMTOperations(() -> def, smtOptions, new Z3Wrapper(smtOptions, kem, globalOptions, files), kem, globalOptions); this.kItemOps = new KItemOperations(stage, deterministicFunctions, kem, this::builtins, globalOptions); this.stage = stage; }
Source:
public void tearDown() throws Throwable { server.stop(); server.shutdown(); }

Target:
public void tearDown() throws Throwable { if ( server != null ) { server.stop(); server.shutdown(); } if ( channel != null ) { channel.close(); } }
Source:
private static String getModules(Map<String, ModuleService> modules) { StringBuilder sb = new StringBuilder("Available Modules:\n"); for(ModuleService entry : modules.values()) { sb.append(String.format(" %-10s - %s", entry.getName(), entry.getDescription())); } return sb.toString(); }

Target:
private static String getModules(Map<String, ModuleService> modules) { StringBuilder sb = new StringBuilder(String.format("Available Modules:%n")); for(ModuleService entry : modules.values()) { sb.append( String.format(" %-10s - %s", entry.getName(), entry.getDescription()) ); } return sb.toString(); }
Source:
private List<PhdCandidacyPeriod> getCandidacyPeriods() { List<PhdCandidacyPeriod> candidacyPeriodList = new ArrayList<>(); CollectionUtils.select(Bennu.getInstance().getCandidacyPeriodsSet(), new Predicate() { @Override public boolean evaluate(Object arg0) { return arg0 instanceof PhdCandidacyPeriod; } }, candidacyPeriodList); return candidacyPeriodList; }

Target:
private List<PhdCandidacyPeriod> getCandidacyPeriods() { List<PhdCandidacyPeriod> candidacyPeriodList = new ArrayList<PhdCandidacyPeriod>(); CollectionUtils.select(Bennu.getInstance().getCandidacyPeriodsSet(), new Predicate() { @Override public boolean evaluate(Object arg0) { return arg0 instanceof PhdCandidacyPeriod; } }, candidacyPeriodList); return candidacyPeriodList; }
Source:
public void initialise() { super.initialise(); playerCamera = worldRenderer.getActiveCamera(); requireDynamicFBO(new FBOConfig(REFRACTIVE_REFLECTIVE_URN, 1.0f, FBO.Type.HDR).useNormalBuffer()); }

Target:
public void initialise() { super.initialise(); playerCamera = worldRenderer.getActiveCamera(); requiresFBO(new FBOConfig(REFRACTIVE_REFLECTIVE, FULL_SCALE, FBO.Type.HDR).useNormalBuffer(), displayResolutionDependentFBOs); }
Source:
public boolean writeGuestbookAndShowPreview(GuestbookResponse guestbookResponse) { boolean valid = validateGuestbookResponse(guestbookResponse); if (!valid) { return false; } else { guestbookResponse.setDownloadtype("Explore"); fileDownloadService.writeGuestbookResponseRecord(guestbookResponse); return true; } }

Target:
public boolean writeGuestbookAndShowPreview(GuestbookResponse guestbookResponse) { guestbookResponse.setDownloadtype("Explore"); fileDownloadService.writeGuestbookResponseRecord(guestbookResponse); return true; }
Source:
public void theSetAlarmNotificationsRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }

Target:
public void theSetAlarmNotificationsRequestIsReceived() throws Throwable { PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
protected @NonNull Iterable<ITmfTrace> getTracesToBuild(@NonNull ITmfTrace trace) { return NonNullUtils.checkNotNull(Arrays.asList(TmfTraceManager.getTraceSet(trace))); }

Target:
protected @NonNull Iterable<ITmfTrace> getTracesToBuild(@NonNull ITmfTrace trace) { return checkNotNull(Arrays.asList(TmfTraceManager.getTraceSet(trace))); }
Source:
private void updateShiftStateNow() { boolean keyboardAutoCap; AnyKeyboard alphabetKeyboard = getCurrentAlphabetKeyboard(); keyboardAutoCap = alphabetKeyboard.autoCap; final InputConnection ic = getCurrentInputConnection(); EditorInfo ei = getCurrentInputEditorInfo(); final int caps; if (keyboardAutoCap && mAutoCap && ic != null && ei != null && ei.inputType != EditorInfo.TYPE_NULL) { caps = ic.getCursorCapsMode(ei.inputType); } else { caps = 0; } final boolean inputSaysCaps = caps != 0; Logger.d(TAG, "shift updateShiftStateNow inputSaysCaps=%s", inputSaysCaps); mShiftKeyState.setActiveState(inputSaysCaps); handleShift(); }

Target:
private void updateShiftStateNow() { final InputConnection ic = getCurrentInputConnection(); EditorInfo ei = getCurrentInputEditorInfo(); final int caps; if (mKeyboardAutoCap && mAutoCap && ic != null && ei != null && ei.inputType != EditorInfo.TYPE_NULL) { caps = ic.getCursorCapsMode(ei.inputType); } else { caps = 0; } final boolean inputSaysCaps = caps != 0; Logger.d(TAG, "shift updateShiftStateNow inputSaysCaps=%s", inputSaysCaps); mShiftKeyState.setActiveState(inputSaysCaps); handleShift(); }
Source:
public void testBitUtil() { Assert.assertTrue(BitUtil.isPowerOfTwo(64)); Assert.assertFalse(BitUtil.isPowerOfTwo(63)); Assert.assertTrue(BitUtil.isPowerOfTwo(4096L)); Assert.assertFalse(BitUtil.isPowerOfTwo(4097L)); Assert.assertEquals(BitUtil.nextHighestPowerOfTwo(62), 64); Assert.assertEquals(BitUtil.nextHighestPowerOfTwo(4092L), 4096); Assert.assertEquals(BitUtil.ntz(36), 2); Assert.assertEquals(BitUtil.ntz(4096L), 12); Assert.assertEquals(BitUtil.ntz2(4096L), 12); Assert.assertEquals(BitUtil.ntz3(4096L), 12); Assert.assertEquals(BitUtil.pop(4096), 1); long[] words1 = new long[2]; words1[0] = 1266; words1[1] = 1876; long[] words2 = new long[2]; words2[0] = 7654; words2[1] = 2567; Assert.assertEquals(BitUtil.pop_andnot(words1, words2, 0, 2), 5); Assert.assertEquals(BitUtil.pop_array(words1, 0, 2), 12); Assert.assertEquals(BitUtil.pop_intersect(words1, words2, 0, 2), 7); Assert.assertEquals(BitUtil.pop_union(words1, words2, 0, 2), 19); Assert.assertEquals(BitUtil.pop_xor(words1, words2, 0, 2), 12); }

Target:
public void testBitUtil() { Assert.assertTrue(BitUtil.isPowerOfTwo(32)); Assert.assertFalse(BitUtil.isPowerOfTwo(37)); Assert.assertTrue(BitUtil.isPowerOfTwo(4096L)); Assert.assertFalse(BitUtil.isPowerOfTwo(4097L)); Assert.assertEquals(BitUtil.nextHighestPowerOfTwo(62), 64); Assert.assertEquals(BitUtil.nextHighestPowerOfTwo(4092L), 4096); Assert.assertEquals(BitUtil.ntz(0x24), 2); Assert.assertEquals(BitUtil.ntz(0x1000), 12); Assert.assertEquals(BitUtil.ntz2(0x1000), 12); Assert.assertEquals(BitUtil.ntz3(0x1000), 12); Assert.assertEquals(BitUtil.pop(0x1000), 1); long[] words1 = new long[2]; words1[0] = 0x4f2; words1[1] = 0x754; long[] words2 = new long[2]; words2[0] = 0x1de6; words2[1] = 0xa07; Assert.assertEquals(BitUtil.pop_andnot(words1, words2, 0, 2), 5); Assert.assertEquals(BitUtil.pop_array(words1, 0, 2), 12); Assert.assertEquals(BitUtil.pop_intersect(words1, words2, 0, 2), 7); Assert.assertEquals(BitUtil.pop_union(words1, words2, 0, 2), 19); Assert.assertEquals(BitUtil.pop_xor(words1, words2, 0, 2), 12); }
Source:
private void createArtifactSubdirectory(MavenJarArtifact artifact, File repositoryDir) { File artifactDirectory = new File(repositoryDir, artifact.jarPath()).getParentFile(); artifactDirectory.mkdirs(); }

Target:
private boolean createArtifactSubdirectory(MavenJarArtifact artifact, File repositoryDir) { File artifactDirectory = new File(repositoryDir, artifact.jarPath()).getParentFile(); return artifactDirectory.mkdirs(); }
Source:
public void handle(ContainerEvent event) { String reason = event.getReason(); String message = event.getMessage(); if (isUnrecoverable(reason)) { LOG.error("Unrecoverable event occured {}, {}", reason, message); eventPublisher.sendRuntimeStoppedEvent( format("Unrecoverable event occured: '%s', '%s'", reason, message), getContext().getIdentity()); } }

Target:
public void handle(ContainerEvent event) { if (isUnrecoverable(event)) { String reason = event.getReason(); String message = event.getMessage(); String podName = event.getPodName(); try { internalStop(emptyMap()); } catch (InfrastructureException e) { String workspaceId = getContext().getIdentity().getWorkspaceId(); LOG.error( "Unrecoverable event occured during workspace '{}' startup: {}, {}, {}", workspaceId, reason, message, podName); } finally { eventPublisher.sendRuntimeStoppedEvent( format("Unrecoverable event occured: '%s', '%s', '%s'", reason, message, podName), getContext().getIdentity()); } } }
Source:
public void validateCantLiveMigrateToBackupDomain() { StorageDomain srcStorageDomain = initStorageDomain(srcStorageId); srcStorageDomain.setStatus(StorageDomainStatus.Active); srcStorageDomain.setBackup(true); initDiskImage(diskImageGroupId, diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageGroupId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_VM_DISKS_ON_BACKUP_STORAGE); }

Target:
public void validateCantLiveMigrateToBackupDomain() { StorageDomain srcStorageDomain = initStorageDomain(srcStorageId); srcStorageDomain.setStatus(StorageDomainStatus.Active); StorageDomain dstStorageDomain = initStorageDomain(dstStorageId); dstStorageDomain.setStatus(StorageDomainStatus.Active); dstStorageDomain.setBackup(true); initDiskImage(diskImageGroupId, diskImageId); initVm(VMStatus.Up, Guid.newGuid(), diskImageGroupId); ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_VM_DISKS_ON_BACKUP_STORAGE); }
Source:
public ListConfigKey(Class<V> subType, String name, String description, List<? extends V> defaultValue) { super((Class)List.class, name, description, (List<? extends V>) defaultValue); this.subType = subType; }

Target:
public ListConfigKey(Class<V> subType, String name, String description, List<? extends V> defaultValue) { super((Class)List.class, name, description, defaultValue); this.subType = subType; }
Source:
public final Observable<T> takeLast(final int count) { if (count == 1 ) return lift(OperatorTakeLastOne.<T>instance()); else return lift(new OperatorTakeLast<T>(count)); }

Target:
public final Observable<T> takeLast(final int count) { if (count == 0) return ignoreElements(); else if (count == 1 ) return lift(OperatorTakeLastOne.<T>instance()); else return lift(new OperatorTakeLast<T>(count)); }
Source:
public void processBuilder() { List<String> commands = Arrays.asList("myCommand", "myArg1", "myArg2"); ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1", "myArg2"); ProcessBuilder pb2 = new ProcessBuilder(commands); pb.command(); pb.command(commands); pb.command("myCommand", "myArg1", "myArg2"); ProcessBuilder pb3 = new ProcessBuilder(); pb3.command("myCommand"); }

Target:
public void processBuilder() { List<String> commands = Arrays.asList("myCommand", "myArg1", "myArg2"); ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1", "myArg2"); ProcessBuilder pb2 = new ProcessBuilder(commands); pb.command(); pb.command(commands); pb.command("myCommand", "myArg1", "myArg2"); ProcessBuilder pb3 = new ProcessBuilder(); }
Source:
public void createDirectory(OmKeyArgs args) throws IOException { Preconditions.checkNotNull(args, "Key args can not be null"); String volumeName = args.getVolumeName(); String bucketName = args.getBucketName(); String keyName = args.getKeyName(); try { metadataManager.getLock().acquireBucketLock(volumeName, bucketName); if (keyName.length() == 0) { return; } Path keyPath = Paths.get(keyName); OzoneFileStatus status = verifyNoFilesInPath(volumeName, bucketName, keyPath, false); if (status != null && OzoneFSUtils.pathToKey(status.getPath()) .equals(keyPath.toString())) { return; } OmKeyInfo dirDbKeyInfo = createDirectoryKey(volumeName, bucketName, keyName); String dirDbKey = metadataManager .getOzoneKey(volumeName, bucketName, dirDbKeyInfo.getKeyName()); metadataManager.getKeyTable().put(dirDbKey, dirDbKeyInfo); } finally { metadataManager.getLock().releaseBucketLock(volumeName, bucketName); } }

Target:
public void createDirectory(OmKeyArgs args) throws IOException { Preconditions.checkNotNull(args, "Key args can not be null"); String volumeName = args.getVolumeName(); String bucketName = args.getBucketName(); String keyName = args.getKeyName(); metadataManager.getLock().acquireBucketLock(volumeName, bucketName); try { if (keyName.length() == 0) { return; } Path keyPath = Paths.get(keyName); OzoneFileStatus status = verifyNoFilesInPath(volumeName, bucketName, keyPath, false); if (status != null && OzoneFSUtils.pathToKey(status.getPath()) .equals(keyName)) { return; } OmKeyInfo dirDbKeyInfo = createDirectoryKey(volumeName, bucketName, keyName); String dirDbKey = metadataManager .getOzoneKey(volumeName, bucketName, dirDbKeyInfo.getKeyName()); metadataManager.getKeyTable().put(dirDbKey, dirDbKeyInfo); } finally { metadataManager.getLock().releaseBucketLock(volumeName, bucketName); } }
Source:
public void onReadError(Exception exception) { if (logger.isDebugEnabled()) { logger.debug("Executing onReadError: " + exception.getMessage(), exception); } final Message<Exception> message = MessageBuilder.withPayload(exception) .setHeader(BatchJobHeaders.BATCH_LISTENER_EVENT_TYPE, BatchListenerEventType.ITEM_LISTENER_ON_READ_ERROR) .build(); notificationsChannel.send(message); }

Target:
public void onReadError(Exception exception) { if (logger.isDebugEnabled()) { logger.debug("Executing onReadError: " + exception.getMessage(), exception); } final Message<Exception> message = MessageBuilder.withPayload(exception) .setHeader(BatchJobHeaders.BATCH_LISTENER_EVENT_TYPE, BatchListenerEventType.ITEM_LISTENER_ON_READ_ERROR.name()) .build(); notificationsChannel.send(message); }
Source:
public void testNotEquals() { ValueHolder<Integer> vh = new OnHeapStoreValueHolder<Integer>(10); assertThat(new OnHeapStoreValueHolder<Integer>(101), new Not(is(vh))); }

Target:
public void testNotEquals() { ValueHolder<Integer> vh = new OnHeapStoreValueHolder<Integer>(10); assertThat(new OnHeapStoreValueHolder<Integer>(101), not(vh)); }
Source:
public Object result(@PathParam("executionId") String executionId) throws IOException, MessagingException { if (isCompleted(executionId)) { Object output = getResult(executionId); String error = getError(executionId); cleanup(executionId); if (error != null) { throw new NuxeoException(error, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (output instanceof Map) { Map map = (Map) output; Object url = ((Map<?, ?>) output).get(RESULT_URL_KEY); if (url instanceof String) { map = new HashMap((Map) output); try { boolean isAbsolute = new URI((String) url).isAbsolute(); String baseUrl = VirtualHostHelper.getBaseURL(ctx.getRequest()); map.put(RESULT_URL_KEY, isAbsolute ? url : baseUrl + url); } catch (URISyntaxException e) { log.error("Failed to parse result url {}", url); } } return Response.status(HttpServletResponse.SC_OK).entity(MAPPER.writeValueAsString(map)).build(); } return ResponseHelper.getResponse(output, request, HttpServletResponse.SC_OK); } throw new WebResourceNotFoundException("Execution with id=" + executionId + " not found"); }

Target:
public Object result(@PathParam("executionId") String executionId) throws IOException, MessagingException { if (isCompleted(executionId)) { Object output = getResult(executionId); String error = getError(executionId); cleanup(executionId); if (error != null) { throw new NuxeoException(error, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (output instanceof Map) { Map map = (Map) output; Object url = ((Map<?, ?>) output).get(RESULT_URL_KEY); if (url instanceof String) { map = new HashMap(map); try { boolean isAbsolute = new URI((String) url).isAbsolute(); String baseUrl = VirtualHostHelper.getBaseURL(ctx.getRequest()); map.put(RESULT_URL_KEY, isAbsolute ? url : baseUrl + url); } catch (URISyntaxException e) { log.error("Failed to parse result url {}", url); } } return Response.status(HttpServletResponse.SC_OK).entity(MAPPER.writeValueAsString(map)).build(); } return ResponseHelper.getResponse(output, request, HttpServletResponse.SC_OK); } throw new WebResourceNotFoundException("Execution with id=" + executionId + " not found"); }
Source:
public PolicyResponse processPreUpdate(Metacard input, Map<String, Serializable> properties) throws StopProcessingException { if (!Requests.isLocal(properties)) { return new PolicyResponseImpl(); } PolicyResponseImpl policyResponse = new PolicyResponseImpl( null, Permissions.parsePermissionsFromString(getUpdatePermissions())); List<Metacard> previousStateMetacards = ((OperationTransaction) properties.get(OPERATION_TRANSACTION_KEY)) .getPreviousStateMetacards(); Metacard previous; previous = previousStateMetacards .stream() .filter((x) -> x.getId().equals(input.getId())) .findFirst() .orElse(null); if (previous == null) { LOGGER.debug( "Cannot locate metacard for update. Applying permissions to the item", input.getId()); return policyResponse; } return requiresPermission(input.getResourceURI(), previous.getResourceURI()) ? policyResponse : new PolicyResponseImpl(); }

Target:
public PolicyResponse processPreUpdate(Metacard input, Map<String, Serializable> properties) throws StopProcessingException { if (!Requests.isLocal(properties)) { return new PolicyResponseImpl(); } PolicyResponseImpl policyResponse = new PolicyResponseImpl( null, Permissions.parsePermissionsFromString(getUpdatePermissions())); List<Metacard> previousStateMetacards = ((OperationTransaction) properties.get(OPERATION_TRANSACTION_KEY)) .getPreviousStateMetacards(); Metacard previous = previousStateMetacards .stream() .filter((x) -> x.getId().equals(input.getId())) .findFirst() .orElse(null); if (previous == null) { LOGGER.debug( "Cannot locate metacard for update. Applying permissions to the item", input.getId()); return policyResponse; } return requiresPermission(input.getResourceURI(), previous.getResourceURI()) ? policyResponse : new PolicyResponseImpl(); }
Source:
public void testHalt() { Sensor<File> sensor = Sensor.create( FileSensor::create, SensorParams.create( Keys::path, "", ResourceLocator.path("rec-center-hourly-small.csv"))); Parameters p = NetworkTestHarness.getParameters().copy(); p = p.union(NetworkTestHarness.getHotGymTestEncoderParams()); p.set(KEY.RANDOM, new MersenneTwister(42)); p.set(KEY.AUTO_CLASSIFY, false); HTMSensor<File> htmSensor = (HTMSensor<File>)sensor; Network n = Network.create("test network", p); final Layer<int[]> l = new Layer<>(n); l.add(htmSensor); TestObserver<Inference> tester; l.subscribe(tester = new TestObserver<Inference>() { @Override public void onCompleted() { assertTrue(l.isHalted()); isHalted = true; } @Override public void onNext(Inference output) }); l.start(); try { l.halt(); l.getLayerThread().join(); assertTrue(isHalted); }catch(Exception e) { e.printStackTrace(); fail(); } checkObserver(tester); }

Target:
public void testHalt() { Sensor<File> sensor = Sensor.create( FileSensor::create, SensorParams.create( Keys::path, "", ResourceLocator.path("rec-center-hourly-small.csv"))); Parameters p = NetworkTestHarness.getParameters().copy(); p = p.union(NetworkTestHarness.getHotGymTestEncoderParams()); p.set(KEY.RANDOM, new MersenneTwister(42)); p.set(KEY.AUTO_CLASSIFY, Boolean.TRUE); p.set(KEY.INFERRED_FIELDS, getInferredFieldsMap("consumption", CLAClassifier.class)); HTMSensor<File> htmSensor = (HTMSensor<File>)sensor; Network n = Network.create("test network", p); final Layer<int[]> l = new Layer<>(n); l.add(htmSensor); TestObserver<Inference> tester; l.subscribe(tester = new TestObserver<Inference>() { @Override public void onCompleted() { assertTrue(l.isHalted()); isHalted = true; } @Override public void onNext(Inference output) }); l.start(); try { l.halt(); l.getLayerThread().join(); assertTrue(isHalted); }catch(Exception e) { e.printStackTrace(); fail(); } checkObserver(tester); }
Source:
public void close() { try { outputStream.close(); if (indexer != null) { if (indexer instanceof TribbleIndexCreator) { ((TribbleIndexCreator)indexer).setIndexSequenceDictionary(refDict); } final Index index = indexer.finalizeIndex(locationSource.getPosition()); index.writeBasedOnFeatureFile(location); } } catch (final IOException e) { throw new RuntimeIOException("Unable to close index for " + getStreamName(), e); } }

Target:
public void close() { try { outputStream.close(); if (indexer != null) { indexer.setIndexSequenceDictionary(refDict); final Index index = indexer.finalizeIndex(locationSource.getPosition()); index.writeBasedOnFeatureFile(location); } } catch (final IOException e) { throw new RuntimeIOException("Unable to close index for " + getStreamName(), e); } }
Source:
String[] getProgramArguments() throws IOException { LOGGER.entering(); List<String> args = new LinkedList<String>(); for (int i = 0; i < commands.size(); i++) { args.add(commands.get(i)); } if (InstanceType.SELENIUM_NODE.equals(type)) { args.addAll(Arrays.asList(getNodeProgramArguments())); } if (InstanceType.SELENIUM_HUB.equals(type)) { args.addAll(Arrays.asList(getHubProgramArguments())); } if ((!InstanceType.SELENIUM_STANDALONE.equals(type)) && (!commands.contains(SELION_CONFIG_ARG))) { args.add(SELION_CONFIG_ARG); args.add(SELION_CONFIG_FILE); } LOGGER.exiting(args.toString()); return args.toArray(new String[args.size()]); }

Target:
String[] getProgramArguments() throws IOException { LOGGER.entering(); InstanceType type = getType(); List<String> args = new LinkedList<String>(commands); if (InstanceType.SELENIUM_NODE.equals(type)) { args.addAll(Arrays.asList(getNodeProgramArguments())); } if (InstanceType.SELENIUM_HUB.equals(type)) { args.addAll(Arrays.asList(getHubProgramArguments())); } if ((!InstanceType.SELENIUM_STANDALONE.equals(type)) && (!commands.contains(SELION_CONFIG_ARG))) { args.add(SELION_CONFIG_ARG); args.add(SELION_CONFIG_FILE); } LOGGER.exiting(args.toString()); return args.toArray(new String[args.size()]); }
Source:
public void testPartialQueryLoads() throws XPathSyntaxException, UnfullfilledRequirementsException, XmlPullParserException, IOException, InvalidStructureException { ParseUtils.parseIntoSandbox(getClass().getResourceAsStream("/indexed_fixture/partial_lookup_load_body.xml"), sandbox); EvaluationContext ec = MockDataUtils.buildContextWithInstance(sandbox, "testfixture", "jr://fixture/testfixture"); EvaluationContext ecForTest = ec.spawnWithCleanLifecycle(); QueryContext context = ecForTest.getCurrentQueryContext(); ScopeLimitedReferenceRequestCache cache = context.getQueryCache(ScopeLimitedReferenceRequestCache.class); String exprString = "instance('testfixture')/test/entry[@filter_attribute = 'pass'][true() and filter_one = 'pass']/name"; XPathExpression expr = XPathParseTool.parseXPath(exprString); cache.addTreeReferencesToLimitedScope(new TreeReferenceAccumulatingAnalyzer(ecForTest).accumulate(expr)); CaseTestUtils.xpathEvalAndAssert(ecForTest, exprString, "succeed"); }

Target:
public void testPartialQueryLoads() throws XPathSyntaxException, UnfullfilledRequirementsException, XmlPullParserException, IOException, InvalidStructureException { ParseUtils.parseIntoSandbox(getClass().getResourceAsStream("/indexed_fixture/partial_lookup_load_body.xml"), sandbox); doPartialLookupTest(); }
Source:
public static void startRequestDetailActivity(Context ctx, Request request) { Intent i = ActivityUtil.newIntent(ctx, RequestDetailActivity.class); i.putExtra(RequestDetailActivity.REQUEST_ID, request.getObjectId()); i.putExtra(RequestDetailActivity.REQUEST_STATE, request.getState().toString()); ctx.startActivity(i); ActivityUtil.transitionRight((Activity)ctx); }

Target:
public static void startRequestDetailActivity(Context ctx, Request request) { Intent i = ActivityUtil.newIntent(ctx, RequestDetailActivity.class); i.putExtra(RequestDetailActivity.REQUEST_ID, request.getObjectId()); i.putExtra(RequestDetailActivity.REQUEST_STATE, request.getState()); ctx.startActivity(i); ActivityUtil.transitionRight((Activity)ctx); }
Source:
private boolean pingSession( @Nonnull final String sessionId ) { boolean touchResult; try { touchResult = _memcached.add( _storageKeyFormat.format(sessionId), 1, BYTE_1 ); } catch ( final IOException e ) { _log.warn( "An exception occurred when trying to ping session " + sessionId, e ); return false; } if ( touchResult ) { _stats.nonStickySessionsPingFailed(); _log.warn( "The session " + sessionId + " should be touched in memcached, but it does not exist therein." ); return false; } else { _log.debug( "The session was ping'ed successfully." ); return true; } }

Target:
private boolean pingSession( @Nonnull final String sessionId ) throws InterruptedException { final Future<Boolean> touchResult = _memcached.add( _storageKeyFormat.format(sessionId), 1, BYTE_1 ); try { if ( touchResult.get() ) { _stats.nonStickySessionsPingFailed(); _log.warn( "The session " + sessionId + " should be touched in memcached, but it does not exist therein." ); return false; } _log.debug( "The session was ping'ed successfully." ); return true; } catch ( final ExecutionException e ) { _log.warn( "An exception occurred when trying to ping session " + sessionId, e ); return false; } }
Source:
private void waitUntilServerIsAlive( ) { int timeout = 600000; final int sleep_time = 5000; boolean isAlive = false; while ( !isAlive ) { int statusCode = pingIsAlive(); if ( statusCode == HttpStatus.SC_OK ) { isAlive = true; } else { if ( timeout == 0 ) { placeBreadcrumbFile( getSolutionPath(), false ); } else { try { Thread.sleep( sleep_time ); } catch ( InterruptedException e ) { logger.error( e.getMessage() ); } timeout = timeout - sleep_time; } } } }

Target:
private void waitUntilServerIsAlive( ) { int timeout = 600000; final int sleep_time = 5000; if ( logger.isDebugEnabled() ) { logger.debug( "Waiting until the server is alive..." ); } boolean isAlive = false; while ( !isAlive ) { int statusCode = pingIsAlive(); if ( statusCode == HttpStatus.SC_OK ) { isAlive = true; } else { if ( timeout == 0 ) { placeBreadcrumbFile( getSolutionPath(), false ); break; } else { try { Thread.sleep( sleep_time ); } catch ( InterruptedException e ) { logger.error( e.getMessage() ); } timeout = timeout - sleep_time; } } } }
Source:
private OrcColumnarRowFileInputFormat<?, HiveSourceSplit> createOrcFormat() { return hiveVersion.startsWith("1.") ? OrcColumnarRowFileInputFormat.createPartitionedFormat( OrcShim.createShim(hiveVersion), jobConfWrapper.conf(), tableRowType(), partitionKeys, PARTITION_FIELD_EXTRACTOR, projectedFields(), new ArrayList<>(), DEFAULT_SIZE) : OrcNoHiveColumnarRowInputFormat.createPartitionedFormat( jobConfWrapper.conf(), tableRowType(), partitionKeys, PARTITION_FIELD_EXTRACTOR, projectedFields(), new ArrayList<>(), DEFAULT_SIZE); }

Target:
private OrcColumnarRowFileInputFormat<?, HiveSourceSplit> createOrcFormat() { return hiveVersion.startsWith("1.") ? OrcNoHiveColumnarRowInputFormat.createPartitionedFormat( jobConfWrapper.conf(), tableRowType(), partitionKeys, PARTITION_FIELD_EXTRACTOR, computeSelectedFields(), Collections.emptyList(), DEFAULT_SIZE) : OrcColumnarRowFileInputFormat.createPartitionedFormat( OrcShim.createShim(hiveVersion), jobConfWrapper.conf(), tableRowType(), partitionKeys, PARTITION_FIELD_EXTRACTOR, computeSelectedFields(), Collections.emptyList(), DEFAULT_SIZE); }
Source:
protected Object execute(Object[] data) { if (data == null) { throw new ExecutionPlanRuntimeException("Data can not be null."); } if (data.length < 2) { throw new ExecutionPlanRuntimeException("Number of values for data should be a multiple of 2"); } for (int i = 0; i < data.length; i += 2) { hashMap.put(data[i], data[i + 1]); } return hashMap; }

Target:
protected Object execute(Object[] data) { if (data == null) { throw new ExecutionPlanRuntimeException("Data can not be null."); } if ((data.length % 2) == 1) { throw new ExecutionPlanRuntimeException("Number of values for data should be a multiple of 2"); } for (int i = 0; i < data.length; i += 2) { hashMap.put(data[i], data[i + 1]); } return hashMap; }
Source:
public void invoke() { if (!CommandLine.executableExists(COMPOSE_EXECUTABLE)) { throw new ContainerLaunchException("Local Docker Compose not found. Is " + COMPOSE_EXECUTABLE + " on the PATH?"); } final Map<String, String> environment = Maps.newHashMap(env); environment.put(ENV_PROJECT_NAME, identifier); final List<String> absoluteDockerComposeFiles = composeFiles.stream() .map(File::getAbsolutePath) .map(Objects::toString) .collect(toList()); final String composeFileEnvVariableValue = absoluteDockerComposeFiles.stream() .collect(joining(File.pathSeparator + "")); logger().debug("Set env COMPOSE_FILE={}", composeFileEnvVariableValue); final File pwd = composeFiles.get(0).getAbsoluteFile().getParentFile().getAbsoluteFile(); environment.put(ENV_COMPOSE_FILE, composeFileEnvVariableValue); logger().info("Local Docker Compose is running command: {}", cmd); final List<String> command = Splitter.onPattern(" ") .omitEmptyStrings() .splitToList(COMPOSE_EXECUTABLE + " " + cmd); try { new ProcessExecutor().command(command) .redirectOutput(Slf4jStream.of(logger()).asInfo()) .redirectError(Slf4jStream.of(logger()).asError()) .environment(environment) .directory(pwd) .exitValueNormal() .executeNoTimeout(); logger().info("Docker Compose has finished running"); } catch (InvalidExitValueException e) { throw new ContainerLaunchException("Local Docker Compose exited abnormally with code " + e.getExitValue() + " whilst running command: " + cmd); } catch (Exception e) { throw new ContainerLaunchException("Error running local Docker Compose command: " + cmd, e); } }

Target:
public void invoke() { if (!CommandLine.executableExists(COMPOSE_EXECUTABLE)) { throw new ContainerLaunchException("Local Docker Compose not found. Is " + COMPOSE_EXECUTABLE + " on the PATH?"); } final Map<String, String> environment = Maps.newHashMap(env); environment.put(ENV_PROJECT_NAME, identifier); final Stream<String> absoluteDockerComposeFilePaths = composeFiles.stream() .map(File::getAbsolutePath) .map(Objects::toString); final String composeFileEnvVariableValue = absoluteDockerComposeFilePaths.collect( joining(File.pathSeparator + "")); logger().debug("Set env COMPOSE_FILE={}", composeFileEnvVariableValue); final File pwd = composeFiles.get(0).getAbsoluteFile().getParentFile().getAbsoluteFile(); environment.put(ENV_COMPOSE_FILE, composeFileEnvVariableValue); logger().info("Local Docker Compose is running command: {}", cmd); final List<String> command = Splitter.onPattern(" ") .omitEmptyStrings() .splitToList(COMPOSE_EXECUTABLE + " " + cmd); try { new ProcessExecutor().command(command) .redirectOutput(Slf4jStream.of(logger()).asInfo()) .redirectError(Slf4jStream.of(logger()).asError()) .environment(environment) .directory(pwd) .exitValueNormal() .executeNoTimeout(); logger().info("Docker Compose has finished running"); } catch (InvalidExitValueException e) { throw new ContainerLaunchException("Local Docker Compose exited abnormally with code " + e.getExitValue() + " whilst running command: " + cmd); } catch (Exception e) { throw new ContainerLaunchException("Error running local Docker Compose command: " + cmd, e); } }
Source:
public void setAttributes(Map<String, ? extends Object> map, boolean validate) { if (map == null) attributes = null; else { attributes = new MarkerAttributeMap<>(map.size()); for (Entry<String, ?> i : map.entrySet()) { Object key = i.getKey(); Assert.isTrue(key instanceof String); Object value = i.getValue(); setAttribute((String) key, value, validate); } } }

Target:
public void setAttributes(Map<String, ? extends Object> map, boolean validate) { if (map == null) attributes = null; else { attributes = new MarkerAttributeMap<>(map.size()); for (Entry<String, ?> entry : map.entrySet()) { Object key = entry.getKey(); Assert.isTrue(key instanceof String); Object value = entry.getValue(); setAttribute((String) key, value, validate); } } }
Source:
private void addMenuButton() { final ToolButton menuToolButton = new ToolButton(FontAwesome.COG); menuToolButton.getElement().setAttribute("name", "workBenchIconPartStackOptions"); menuButton.add(menuToolButton); menuToolButton.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { Scheduler.get().scheduleDeferred(() -> { int left = getAbsoluteLeft(menuToolButton.getElement()); int top = getAbsoluteTop(menuToolButton.getElement()); delegate.onPartStackMenu(left + 10, top + 21 - 8); }); } }); if (menuButton.getElement() instanceof elemental.dom.Element) { Tooltip.create((elemental.dom.Element) menuButton.getElement(), PositionController.VerticalAlign.BOTTOM, PositionController.HorizontalAlign.MIDDLE, localizationConstant.partStackOptionsTitle()); } }

Target:
private void addMenuButton() { final ToolButton menuToolButton = new ToolButton(FontAwesome.COG); menuToolButton.getElement().setAttribute("name", "workBenchIconPartStackOptions"); menuButton.add(menuToolButton); menuToolButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Scheduler.get().scheduleDeferred(() -> { int left = getAbsoluteLeft(menuToolButton.getElement()); int top = getAbsoluteTop(menuToolButton.getElement()); delegate.onPartStackMenu(left + 10, top + 21 - 8); }); } }); if (menuButton.getElement() instanceof elemental.dom.Element) { Tooltip.create((elemental.dom.Element) menuButton.getElement(), PositionController.VerticalAlign.BOTTOM, PositionController.HorizontalAlign.MIDDLE, localizationConstant.partStackOptionsTitle()); } }
Source:
public void preInitialise(Context rootContext) { config = new Config(); config.load(); FlexibleConfigManager flexibleConfigManager = new FlexibleConfigManagerImpl(); rootContext.put(FlexibleConfigManager.class, flexibleConfigManager); FlexibleConfig renderingFlexibleConfig = new FlexibleConfigImpl(); flexibleConfigManager.addFlexibleConfig(new SimpleUri("engine:rendering"), renderingFlexibleConfig); flexibleConfigManager.load(); String serverPortProperty = System.getProperty(SERVER_PORT_PROPERTY); if (serverPortProperty != null) { try { config.getNetwork().setServerPort(Integer.parseInt(serverPortProperty)); } catch (NumberFormatException e) { logger.error("Failed to set server port to invalid value: {}", serverPortProperty); } } if (Iterables.isEmpty(config.getDefaultModSelection().listModules())) { config.getDefaultModSelection().addModule(TerasologyConstants.CORE_GAMEPLAY_MODULE); } checkServerIdentity(); logger.info("Video Settings: {}", config.renderConfigAsJson(config.getRendering())); rootContext.put(Config.class, config); }

Target:
public void preInitialise(Context rootContext) { config = new Config(rootContext); config.load(); FlexibleConfigManager flexibleConfigManager = new FlexibleConfigManagerImpl(); rootContext.put(FlexibleConfigManager.class, flexibleConfigManager); FlexibleConfig renderingFlexibleConfig = new FlexibleConfigImpl(); flexibleConfigManager.addConfig(new SimpleUri("engine:rendering"), renderingFlexibleConfig); flexibleConfigManager.loadAllConfigs(); String serverPortProperty = System.getProperty(SERVER_PORT_PROPERTY); if (serverPortProperty != null) { try { config.getNetwork().setServerPort(Integer.parseInt(serverPortProperty)); } catch (NumberFormatException e) { logger.error("Failed to set server port to invalid value: {}", serverPortProperty); } } if (Iterables.isEmpty(config.getDefaultModSelection().listModules())) { config.getDefaultModSelection().addModule(TerasologyConstants.CORE_GAMEPLAY_MODULE); } checkServerIdentity(); logger.info("Video Settings: {}", config.renderConfigAsJson(config.getRendering())); rootContext.put(Config.class, config); rootContext.put(InputDeviceConfiguration.class, new InputDeviceConfigurationImpl(config)); rootContext.put(BindsConfiguration.class, new BindsConfigurationImpl(config)); }
Source:
public boolean checkQuotaNameReserved(Quota quota, List<String> messages) { String defaultQuotaForDCName = getDefaultQuotaName(getStoragePoolNameForQuota(quota)); if (!quota.getIsDefaultQuota() && quota.getQuotaName().equals(defaultQuotaForDCName)) { messages.add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_NAME_RESERVED_FOR_DEFAULT.toString()); return false; } return true; }

Target:
public boolean checkQuotaNameReserved(Quota quota, List<String> messages) { if (!quota.getIsDefaultQuota() && quota.getQuotaName().startsWith(DEFAULT_QUOTA_NAME_PERFIX)) { messages.add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_NAME_RESERVED_FOR_DEFAULT.toString()); return false; } return true; }
Source:
private boolean idleTimeout(Throwable failure) { Callback callback; boolean timeout; synchronized (this) { switch (_state) { case PENDING: { _state = State.FAILED; _failure = failure; callback = _callback; timeout = true; break; } case IDLE: case SENDING: case SUCCEEDING: case FAILING: case FAILED: { callback = null; timeout = false; break; } default: { _state = State.FAILED; _failure = new IllegalStateException("Invalid transport state: " + _state, failure); callback = _callback; if (callback == null) callback = Callback.NOOP; timeout = true; failure = _failure; break; } } } idleTimeout(callback, timeout, failure); return timeout; }

Target:
private boolean idleTimeout(Throwable failure) { Callback callback; boolean timeout; synchronized (this) { switch (_state) { case PENDING: { callback = _callback; timeout = true; reset(failure); break; } case IDLE: case SENDING: case SUCCEEDING: case FAILING: case FAILED: { callback = null; timeout = false; break; } default: { callback = _callback; if (callback == null) callback = Callback.NOOP; timeout = true; failure = new IllegalStateException("Invalid transport state: " + _state, failure); reset(failure); break; } } } idleTimeout(callback, timeout, failure); return timeout; }
Source:
private static boolean isDefaultConstructorForJpa(MethodTree methodTree) { if (!methodTree.block().body().isEmpty()) { return false; } ClassTree classTree = (ClassTree) methodTree.parent(); return classTree.modifiers().annotations().stream() .map(annotationTree -> annotationTree.annotationType().symbolType()) .anyMatch(symbol -> Stream.of(JPA_ANNOTATIONS).anyMatch(symbol::is)); }

Target:
private static boolean isDefaultConstructorForJpa(MethodTree methodTree) { if (!methodTree.block().body().isEmpty()) { return false; } SymbolMetadata symbolMetadata = ((ClassTree) methodTree.parent()).symbol().metadata(); return Stream.of(JPA_ANNOTATIONS).anyMatch(symbolMetadata::isAnnotatedWith); }