auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void getPresignedObjectUrl_test1() throws Exception { String methodName = "getPresignedObjectUrl(GetPresignedObjectUrlArgs args)"; if (!mintEnv) { System.out.println("Test: presigned get object: " + methodName); } long startTime = System.currentTimeMillis(); try { String objectName = getRandomName(); try (final InputStream is = new ContentInputStream(1 * KB)) { client.putObject(bucketName, objectName, is, new PutObjectOptions(1 * KB, -1)); } byte[] inBytes; try (final InputStream is = new ContentInputStream(1 * KB)) { inBytes = readAllBytes(is); } String urlString = client.getPresignedObjectUrl( GetPresignedObjectUrlArgs.builder() .method(Method.GET) .bucket(bucketName) .object(objectName) .build()); byte[] outBytes = readObject(urlString); if (!Arrays.equals(inBytes, outBytes)) { throw new Exception("object content differs"); } client.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); mintSuccessLog(methodName, "presigned get object", startTime); } catch (Exception e) { handleException(methodName, "presigned get object", startTime, e); } }

Target:
public static void getPresignedObjectUrl_test1() throws Exception { String methodName = "getPresignedObjectUrl(GetPresignedObjectUrlArgs args)"; if (!mintEnv) { System.out.println("Test: " + methodName + "presigned get"); } long startTime = System.currentTimeMillis(); try { String objectName = getRandomName(); try (final InputStream is = new ContentInputStream(1 * KB)) { client.putObject(bucketName, objectName, is, new PutObjectOptions(1 * KB, -1)); } byte[] inBytes; try (final InputStream is = new ContentInputStream(1 * KB)) { inBytes = readAllBytes(is); } String urlString = client.getPresignedObjectUrl( GetPresignedObjectUrlArgs.builder() .method(Method.GET) .bucket(bucketName) .object(objectName) .build()); byte[] outBytes = readObject(urlString); if (!Arrays.equals(inBytes, outBytes)) { throw new Exception("object content differs"); } client.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build()); mintSuccessLog(methodName, null, startTime); } catch (Exception e) { handleException(methodName, null, startTime, e); } }
Source:
public static void switchUser(String user) { if(!kerberosEnabled) { return; } String keytab = CURRENT_USER_KEYTAB; if(user == null) { user = System.getProperty("user.name"); } else { Assert.assertEquals(user, user2_name, "Unexpected user."); keytab = user2_keytab; } if(user.equals(currentUser)) { logger.info("kerberos switching is not required."); return; } logger.info(String.format("Switching kerberos keytab from %s to %s", currentUser, user)); final String command = String.format("ls -al %s", keytab); final int exitVal = executeCommand(command); Assert.assertEquals(exitVal, 0, "Switching Kerberos credential did not succeed."); currentUser = user; }

Target:
public static void switchUser(String user) { if(!MerlinConstants.IS_SECURE) { logger.info("Kerberos is disabled, hence no user switching."); return; } if(user == null) { user = MerlinConstants.CURRENT_USER_NAME; } if(user.equals(currentKerberosUser)) { logger.info("kerberos switching is not required."); return; } final String keytab = MerlinConstants.getKeytabForUser(user); logger.info(String.format("Switching kerberos keytab from %s to %s", currentKerberosUser, user)); final String command = String.format("kinit -kt %s %s", keytab, user); final int exitVal = executeCommand(command); Assert.assertEquals(exitVal, 0, "Switching Kerberos credential did not succeed."); currentKerberosUser = user; }
Source:
private boolean matchesStringOrRegex( String paramName, String paramValue, boolean isRegex, String targetValue) { if (paramValue != null && paramValue.length() > 0) { if (isRegex) { Pattern p = Pattern.compile(paramValue); if (!p.matcher(targetValue).matches()) { log.debug( "Filter didnt match " + paramName + " regex: " + paramValue + " url: " + targetValue); return false; } } else if (!paramValue.equals(targetValue)) { log.debug("Filter didnt match " + paramName + ": " + paramValue); return false; } } return true; }

Target:
private static boolean matchesStringOrRegex( String paramName, String paramValue, boolean isRegex, String targetValue) { if (paramValue != null && paramValue.length() > 0) { if (isRegex) { if (!targetValue.matches(paramValue)) { if (log.isDebugEnabled()) { log.debug( "Filter didnt match " + paramName + " regex: " + paramValue + " : " + targetValue); } return false; } } else if (!paramValue.equals(targetValue)) { if (log.isDebugEnabled()) { log.debug( "Filter didnt match " + paramName + " : " + paramValue + " : " + targetValue); } return false; } } return true; }
Source:
public static Iterable<String> splitGlob(String path) { if (path.indexOf('{') < 0) { return Arrays.asList(path.split(",")); } return Iterables.transform(splitGlob(new CharStream(path)), Functions.toStringFunction()); }

Target:
public static Iterable<String> splitGlob(String path) { return Iterables.transform(splitGlob(new CharStream(path)), Functions.toStringFunction()); }
Source:
private Integer getLinkSpeedBandwidth(Guid clusterId) { final List<VdsNetworkInterface> migrationalClusterNics = getDbFacade().getInterfaceDao().getAllMigrationNetworkInterfacesInCluster(clusterId); return migrationalClusterNics.stream() .map(VdsNetworkInterface::getSpeed) .reduce(MigrateVmCommand::minIfExists) .map(speed -> speed == 0 ? null : speed) .orElse(null); }

Target:
private Integer getLinkSpeedBandwidth(Guid clusterId) { final List<VdsNetworkInterface> migrationClusterNics = getInterfaceDao().getAllMigrationNetworkInterfacesInCluster(clusterId); return migrationClusterNics.stream() .map(VdsNetworkInterface::getSpeed) .reduce(MigrateVmCommand::minIfExists) .map(speed -> speed == 0 ? null : speed) .orElse(null); }
Source:
private void fetchFromCatalogAndWriteResponse(String bucketName, String workflowName, String sessionId, HttpServletResponse response) { String encodedWorkflowName; try { encodedWorkflowName = URLEncoder.encode(workflowName, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { encodedWorkflowName = workflowName; } String url = URL_CATALOG + "/buckets/" + bucketName + "/resources/" + encodedWorkflowName + "/raw"; LOGGER.info("Sending request to catalog: {}", url); HttpGet httpget = new HttpGet(url); httpget.addHeader(PARAMS_SESSION_ID, sessionId); try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse httpResponse = httpClient.execute(httpget);) { HttpEntity responseBody = httpResponse.getEntity(); File job = File.createTempFile("job_upload", ".xml"); FileUtils.copyInputStreamToFile(responseBody.getContent(), job); LOGGER.info("job file={}", job); writeResponse(job, response); } catch (Exception e) { LOGGER.error("Error when sending the request to catalog", e); } }

Target:
private void fetchFromCatalogAndWriteResponse(String bucketName, String workflowName, String sessionId, HttpServletResponse response) { String encodedWorkflowName; try { encodedWorkflowName = URLEncoder.encode(workflowName, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { encodedWorkflowName = workflowName; } String url = URL_CATALOG + "/buckets/" + bucketName + "/resources/" + encodedWorkflowName + "/raw"; LOGGER.info("Sending request to catalog: {}", url); HttpGet httpGet = new HttpGet(url); httpGet.addHeader(PARAMS_SESSION_ID, sessionId); try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse httpResponse = httpClient.execute(httpGet)) { HttpEntity responseBody = httpResponse.getEntity(); File job = File.createTempFile("job_upload", ".xml"); FileUtils.copyInputStreamToFile(responseBody.getContent(), job); LOGGER.info("job file={}", job); writeResponse(job, response); } catch (Exception e) { LOGGER.error("Error when sending the request to catalog", e); } }
Source:
private void refreshAndStartQueries() { long nanoTime = System.nanoTime(); long elapsedSeconds = NANOSECONDS.toSeconds(nanoTime - lastCpuQuotaGenerationNanos.get()); if (elapsedSeconds > 0) { lastCpuQuotaGenerationNanos.addAndGet(elapsedSeconds * 1_000_000_000L); } else if (elapsedSeconds < 0) { lastCpuQuotaGenerationNanos.set(nanoTime); } for (RootInternalResourceGroup group : rootGroups) { while (group != null) { try { if (elapsedSeconds > 0) { group.generateCpuQuota(elapsedSeconds); } } catch (RuntimeException e) { log.error(e, "Exception while generation cpu quota for %s", group); } try { group.processQueuedQueries(); } catch (RuntimeException e) { log.error(e, "Exception while processing queued queries for %s version %s", group, group.getVersion()); } if (group.getNext().isPresent()) { group = (RootInternalResourceGroup) group.getNext().get(); } else { group = null; } } } }

Target:
private void refreshAndStartQueries() { long nanoTime = System.nanoTime(); long elapsedSeconds = NANOSECONDS.toSeconds(nanoTime - lastCpuQuotaGenerationNanos.get()); if (elapsedSeconds > 0) { lastCpuQuotaGenerationNanos.addAndGet(elapsedSeconds * 1_000_000_000L); } else if (elapsedSeconds < 0) { lastCpuQuotaGenerationNanos.set(nanoTime); } if (maxTotalRunningTaskCountToNotExecuteNewQuery != Integer.MAX_VALUE) { taskLimitExceeded.set(getTotalRunningTaskCount() > maxTotalRunningTaskCountToNotExecuteNewQuery); } for (RootInternalResourceGroup group : rootGroups) { while (group != null) { try { if (elapsedSeconds > 0) { group.generateCpuQuota(elapsedSeconds); } } catch (RuntimeException e) { log.error(e, "Exception while generating cpu quota for %s", group); } try { group.setTaskLimitExceeded(taskLimitExceeded.get()); group.processQueuedQueries(); } catch (RuntimeException e) { log.error(e, "Exception while processing queued queries for %s version %s", group, group.getVersion()); } if (group.getNext().isPresent()) { group = (RootInternalResourceGroup) group.getNext().get(); } else { group = null; } } } }
Source:
private void onReplaceBrick() { ReplaceBrickModel replaceBrickModel = (ReplaceBrickModel) getWindow(); if (replaceBrickModel == null) { return; } if (!replaceBrickModel.validate()) { return; } GlusterVolumeEntity volumeEntity = getEntity(); if (volumeEntity == null) { return; } GlusterBrickEntity existingBrick = getSelectedItem(); if (existingBrick == null) { return; } VDS server = replaceBrickModel.getServers().getSelectedItem(); GlusterBrickEntity newBrick = new GlusterBrickEntity(); newBrick.setVolumeId(volumeEntity.getId()); newBrick.setServerId(server.getId()); newBrick.setServerName(server.getHostName()); newBrick.setBrickDirectory(replaceBrickModel.getBrickDirectory().getEntity()); replaceBrickModel.startProgress(null); GlusterVolumeReplaceBrickActionParameters parameter = new GlusterVolumeReplaceBrickActionParameters(volumeEntity.getId(), GlusterTaskOperation.COMMIT, existingBrick, newBrick, true); Frontend.getInstance().runAction(VdcActionType.ReplaceGlusterVolumeBrick, parameter, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { ReplaceBrickModel localModel = (ReplaceBrickModel) result.getState(); localModel.stopProgress(); setWindow(null); } }, replaceBrickModel); }

Target:
private void onReplaceBrick() { ReplaceBrickModel replaceBrickModel = (ReplaceBrickModel) getWindow(); if (replaceBrickModel == null) { return; } if (!replaceBrickModel.validate()) { return; } GlusterVolumeEntity volumeEntity = getEntity(); if (volumeEntity == null) { return; } GlusterBrickEntity existingBrick = getSelectedItem(); if (existingBrick == null) { return; } VDS server = replaceBrickModel.getServers().getSelectedItem(); GlusterBrickEntity newBrick = new GlusterBrickEntity(); newBrick.setVolumeId(volumeEntity.getId()); newBrick.setServerId(server.getId()); newBrick.setServerName(server.getHostName()); newBrick.setBrickDirectory(replaceBrickModel.getBrickDirectory().getEntity()); replaceBrickModel.startProgress(null); GlusterVolumeReplaceBrickActionParameters parameter = new GlusterVolumeReplaceBrickActionParameters(volumeEntity.getId(), existingBrick, newBrick); Frontend.getInstance().runAction(VdcActionType.ReplaceGlusterVolumeBrick, parameter, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { ReplaceBrickModel localModel = (ReplaceBrickModel) result.getState(); localModel.stopProgress(); setWindow(null); } }, replaceBrickModel); }
Source:
public void testGetJobs() throws Exception { RestfulHudsonClient client = harness.connect(PrivilegeLevel.ANONYMOUS); harness.ensureHasRun(harness.getPlanFailing()); harness.ensureHasRun(harness.getPlanSucceeding()); List<HudsonModelJob> jobs = client.getJobs(null, null); HudsonTestUtil.assertContains(jobs, harness.getPlanFailing()); HudsonTestUtil.assertContains(jobs, harness.getPlanSucceeding()); HudsonTestUtil.assertContainsNot(jobs, harness.getPlanFolder()); HudsonTestUtil.assertHealthReport(jobs); }

Target:
public void testGetJobs() throws Exception { RestfulHudsonClient client = harness.connect(PrivilegeLevel.ANONYMOUS); harness.ensureHasRun(harness.getPlanFailing()); harness.ensureHasRun(harness.getPlanSucceeding()); List<HudsonModelJob> jobs = client.getJobs(null, null); HudsonTestUtil.assertContains(jobs, harness.getPlanFailing()); HudsonTestUtil.assertContains(jobs, harness.getPlanSucceeding()); HudsonTestUtil.assertContainsNot(jobs, harness.getPlanFolder()); HudsonTestUtil.assertContainsNot(jobs, harness.getPlanNestedOne()); HudsonTestUtil.assertContainsNot(jobs, harness.getPlanSubFolder()); HudsonTestUtil.assertContainsNot(jobs, harness.getPlanNestedTwo()); HudsonTestUtil.assertHealthReport(jobs); }
Source:
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { MigrationResponse response = _imageStoreService.migrateData(this); response.setObjectName("imagestore"); this.setResponseObject(response); }

Target:
public void execute() { MigrationResponse response = _imageStoreService.migrateData(this); response.setObjectName("imagestore"); this.setResponseObject(response); }
Source:
public Optional<VirtualFile> tryResolve(String relativePath) { if (relativePath != null && relativePath.startsWith("/")) { relativePath = relativePath.substring(1); } if (Strings.isEmpty(relativePath)) { return Optional.empty(); } Tuple<String, String> nameAndRest = Strings.split(relativePath, "/"); Optional<VirtualFile> child = findChild(nameAndRest.getFirst()); if (Strings.isFilled(nameAndRest.getSecond())) { return child.flatMap(subChild -> subChild.tryResolve(nameAndRest.getSecond())); } return child; }

Target:
public Optional<VirtualFile> tryResolve(String relativePath) { String effectivePath = ensureRelativePath(relativePath); if (Strings.isEmpty(effectivePath)) { return Optional.empty(); } Tuple<String, String> nameAndRest = Strings.split(effectivePath, "/"); Optional<VirtualFile> child = findChild(nameAndRest.getFirst()); if (Strings.isFilled(nameAndRest.getSecond())) { return child.flatMap(subChild -> subChild.tryResolve(nameAndRest.getSecond())); } return child; }
Source:
public static void init() throws Exception { IEclipsePreferences preferences = SourceLookupActivator.getPreferences(); preferences.putBoolean( SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER, true); SourceLookupActivator.getDefault().savePreferences(); IRuntimeDetectorDelegate delegate = new JBossASHandler(); String home = System.getProperty("jbosstools.test.jboss.home.7.1.1", "C:/jboss-as-7.1.1.Final"); RuntimeDefinition runtimeDefinition = delegate.getRuntimeDefinition(new File(home), new NullProgressMonitor()); List<RuntimeDefinition> runtimeDefinitions = new ArrayList<RuntimeDefinition>(); runtimeDefinitions.add(runtimeDefinition); delegate.initializeRuntimes(runtimeDefinitions); }

Target:
public static void init() throws Exception { IEclipsePreferences preferences = SourceLookupActivator.getPreferences(); preferences.putBoolean( SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER, true); SourceLookupActivator.getDefault().savePreferences(); IRuntimeDetectorDelegate delegate = new JBossASHandler(); String home = System.getProperty("jbosstools.test.jboss.home.7.1.1", "C:/jboss-as-7.1.1.Final"); File homeFile = new File(home); if (!homeFile.exists()) { homeFile = new File(FileLocator.getBundleFile(Platform.getBundle(Activator.PLUGIN_ID)), "/target/requirements/jboss-as-7.1.1.Final"); } RuntimeDefinition runtimeDefinition = delegate.getRuntimeDefinition(homeFile, new NullProgressMonitor()); List<RuntimeDefinition> runtimeDefinitions = new ArrayList<RuntimeDefinition>(); runtimeDefinitions.add(runtimeDefinition); delegate.initializeRuntimes(runtimeDefinitions); }
Source:
public static final int get2DigitYearStart() { int yearStart = 1929; try { Object o = Library.getProperty(Attributes.PREFERRED_2DIGITYEARSTART); if (o instanceof Integer) yearStart = ((Integer) o).intValue(); else if (o instanceof String) yearStart = Integer.parseInt((String) o); } catch (Throwable ex) { } return yearStart; }

Target:
public static final int get2DigitYearStart() throws NumberFormatException { String value = Library.getProperty(Attributes.PREFERRED_2DIGITYEARSTART, "1929"); int yearStart = Integer.parseInt(value); if (yearStart < 0) { throw new IllegalArgumentException("Library property: 2DigitYearStart should not be negative"); } return yearStart; }
Source:
public Response putImage(@FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataBodyPart body) { try { SelfServiceMetaDataUtils.ensureDataXmlExists(this.id); } catch (IOException e) { throw new WebApplicationException(e); } RepositoryFileReference ref = new RepositoryFileReference(this.id, "image.jpg"); Response response = RestUtils.putContentToFile(ref, uploadedInputStream, body.getMediaType()); Application data = getData(); if (StringUtils.isEmpty(data.getImageUrl())) { data.setImageUrl("image.jpg"); onPutXML(data); } return response; }

Target:
public Response putImage(@FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataBodyPart body) { try { SelfServiceMetaDataUtils.ensureDataXmlExists(this.id); } catch (IOException e) { throw new WebApplicationException(e); } RepositoryFileReference ref = new RepositoryFileReference(this.id, "image.jpg"); Response response = RestUtils.putContentToFile(ref, uploadedInputStream, body.getMediaType()); if (StringUtils.isEmpty(this.application.getImageUrl())) { this.application.setImageUrl("image.jpg"); persist(); } return response; }
Source:
public InputStream getInputStream() throws IOException { if (inputStreamDataCache == null) { inputStreamDataCache = new TemporaryFileBackedOutputStream(32 * 1024); IOUtils.copyLarge(inputStream, inputStreamDataCache); IOUtils.closeQuietly(inputStream); } return inputStreamDataCache.asByteSource().openStream(); }

Target:
public synchronized InputStream getInputStream() throws IOException { if (resourceDataCache == null) { resourceDataCache = new TemporaryFileBackedOutputStream(FILE_BACKED_OUTPUT_STREAM_THRESHOLD); IOUtils.copyLarge(inputStream, resourceDataCache); IOUtils.closeQuietly(inputStream); streamCloser.register(resourceDataCache); } InputStream newInputStream = resourceDataCache.asByteSource().openStream(); streamCloser.register(newInputStream); return newInputStream; }
Source:
public void validate(URL beansXml, ErrorHandler errorHandler) { if (beansXml == null) { throw XmlLogger.LOG.loadError("unknown", null); } if (errorHandler == null) { errorHandler = this; } Schema schema = cdi20Schema; try (InputStream in = beansXml.openStream()) { if (in.available() == 0) { return; } try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, Charset.forName(StandardCharsets.UTF_8.name())))) { String line; while ((line = reader.readLine()) != null) { if (line.contains(XmlSchema.CDI11.getFileName())) { schema = cdi11Schema; break; } else if (line.contains(XmlSchema.CDI20.getFileName())) { break; } } } } catch (IOException e) { throw XmlLogger.LOG.loadError(beansXml, e); } if (schema == null) { return; } Validator validator = schema.newValidator(); validator.setErrorHandler(errorHandler); try { validator.validate(new StreamSource(beansXml.toExternalForm())); } catch (SAXException | IOException e) { } }

Target:
public void validate(URL beansXml, ErrorHandler errorHandler) { if (beansXml == null) { throw XmlLogger.LOG.loadError("unknown", null); } if (errorHandler == null) { errorHandler = this; } Schema schema = cdi20Schema; try (InputStream in = beansXml.openStream()) { if (in.available() == 0) { return; } try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, Charset.forName(StandardCharsets.UTF_8.name())))) { String line; while ((line = reader.readLine()) != null) { if (line.contains(XmlSchema.CDI11.getFileName())) { schema = cdi11Schema; break; } else if (line.contains(XmlSchema.CDI20.getFileName())) { break; } } } } catch (IOException e) { throw XmlLogger.LOG.loadError(beansXml, e); } if (schema == null) { return; } Validator validator = schema.newValidator(); validator.setErrorHandler(errorHandler); try (InputStream in = beansXml.openStream()) { validator.validate(new StreamSource(in)); } catch (SAXException | IOException e) { } }
Source:
public void doesNotSendMailToAuthor() throws Exception { final Postman postman = Mockito.mock(Postman.class); final MkBase base = new MkBase(); final Alias author = new EmAlias(base.randomAlias(), postman); final Alias friend = new EmAlias(base.randomAlias(), postman); final Bout bout = author.inbox().bout(author.inbox().start()); bout.friends().invite(author.name()); bout.friends().invite(friend.name()); bout.messages().post("hello"); final ArgumentCaptor<Envelope> captor = ArgumentCaptor.forClass(Envelope.class); Mockito.verify(postman, Mockito.times(1)).send(captor.capture()); final Message msg = captor.getValue().unwrap(); MatcherAssert.assertThat( msg.getAllRecipients().length, Matchers.is(1) ); final InternetAddress recipientAddress = (InternetAddress) msg.getAllRecipients()[0]; MatcherAssert.assertThat( recipientAddress.getAddress(), Matchers.is(friend.email()) ); }

Target:
public void doesNotSendMailToAuthor() throws Exception { final Postman postman = Mockito.mock(Postman.class); final MkBase base = new MkBase(); final Alias author = new EmAlias(base.randomAlias(), postman); final Alias friend = new EmAlias(base.randomAlias(), postman); final Bout bout = author.inbox().bout(author.inbox().start()); bout.friends().invite(author.name()); bout.friends().invite(friend.name()); bout.messages().post("hello"); final ArgumentCaptor<Envelope> captor = ArgumentCaptor.forClass(Envelope.class); Mockito.verify(postman, Mockito.times(1)).send(captor.capture()); final Message msg = captor.getValue().unwrap(); MatcherAssert.assertThat( (InternetAddress[]) msg.getAllRecipients(), Matchers.is( Matchers.array( Matchers.equalTo(new InternetAddress(friend.email())) ) ) ); }
Source:
public void onNext(INDArray array) { if (!bypassMode.get()) { if (accumulator != null) { try { log.info("Putting update to the queue, current size: [{}]", updatesBuffer.size()); updatesBuffer.put(array); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } else if (params != null && stepFunction != null) { synchronized (this) { int encoding = array.data().getInt(3); if (encoding == ThresholdCompression.FLEXIBLE_ENCODING) { Nd4j.getExecutioner().thresholdDecode(array, updates); sparseCounter.incrementAndGet(); } else if (encoding == ThresholdCompression.BITMAP_ENCODING) { Nd4j.getExecutioner().bitmapDecode(array, updates); denseCounter.incrementAndGet(); } else throw new DL4JInvalidConfigException("Unknown compression header received: " + encoding); hasSomething.set(true); if (updatesCount.incrementAndGet() % 32 == 0) { flush(); } } } else throw new ND4JIllegalStateException("Accumulator & StepFunction is null at the same time"); } }

Target:
public void onNext(INDArray array) { if (!bypassMode.get()) { if (accumulator != null) { try { log.debug("Putting update to the queue, current size: [{}]", updatesBuffer.size()); updatesBuffer.put(array); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } else if (params != null && stepFunction != null) { synchronized (this) { int encoding = array.data().getInt(3); if (encoding == ThresholdCompression.FLEXIBLE_ENCODING) { Nd4j.getExecutioner().thresholdDecode(array, updates); sparseCounter.incrementAndGet(); } else if (encoding == ThresholdCompression.BITMAP_ENCODING) { Nd4j.getExecutioner().bitmapDecode(array, updates); denseCounter.incrementAndGet(); } else throw new DL4JInvalidConfigException("Unknown compression header received: " + encoding); hasSomething.set(true); if (updatesCount.incrementAndGet() % 32 == 0) { flush(); } } } else throw new ND4JIllegalStateException("Accumulator & StepFunction is null at the same time"); } }
Source:
public void verifyDefaultConfigurationParamsAreNotUploadedIfConfigurationFileIsSpecified() throws Exception { Path tempdir = folder.getRoot().toPath().toAbsolutePath(); Path configDir = folder.getRoot().toPath().toAbsolutePath(); Path projectDir = tempdir.resolve("py"); Path scriptsDir = projectDir.resolve("scripts"); CommandStatus initStatus = main("init", "-c", config.toString(), projectDir.toString()); assertThat(initStatus.code(), is(0)); Files.createDirectories(scriptsDir); copyResource("acceptance/echo_params/echo_params.dig", projectDir.resolve("echo_params.dig")); copyResource("acceptance/echo_params/scripts/__init__.py", scriptsDir.resolve("__init__.py")); copyResource("acceptance/echo_params/scripts/echo_params.py", scriptsDir.resolve("echo_params.py")); CommandStatus pushStatus = main("push", "--project", projectDir.toString(), "py", "-c", config.toString(), "-e", server.endpoint(), "-r", "4711"); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); Id attemptId; { CommandStatus startStatus = main("start", "-c", config.toString(), "-e", server.endpoint(), "py", "echo_params", "--session", "now"); assertThat(startStatus.code(), is(0)); attemptId = getAttemptId(startStatus); } { RestSessionAttempt attempt = null; for (int i = 0; i < 30; i++) { attempt = client.getSessionAttempt(attemptId); if (attempt.getDone()) { break; } Thread.sleep(1000); } assertThat(attempt.getSuccess(), is(true)); } String logs = getAttemptLogs(client, attemptId); assertThat(logs, containsString("digdag params")); }

Target:
public void verifyDefaultConfigurationParamsAreNotUploadedIfConfigurationFileIsSpecified() throws Exception { Path tempdir = folder.getRoot().toPath().toAbsolutePath(); Path projectDir = tempdir.resolve("py"); Path scriptsDir = projectDir.resolve("scripts"); CommandStatus initStatus = main("init", "-c", config.toString(), projectDir.toString()); assertThat(initStatus.code(), is(0)); Files.createDirectories(scriptsDir); copyResource("acceptance/echo_params/echo_params.dig", projectDir.resolve("echo_params.dig")); copyResource("acceptance/echo_params/scripts/__init__.py", scriptsDir.resolve("__init__.py")); copyResource("acceptance/echo_params/scripts/echo_params.py", scriptsDir.resolve("echo_params.py")); CommandStatus pushStatus = main("push", "--project", projectDir.toString(), "py", "-c", config.toString(), "-e", server.endpoint(), "-r", "4711"); assertThat(pushStatus.errUtf8(), pushStatus.code(), is(0)); Id attemptId; { CommandStatus startStatus = main("start", "-c", config.toString(), "-e", server.endpoint(), "py", "echo_params", "--session", "now"); assertThat(startStatus.code(), is(0)); attemptId = getAttemptId(startStatus); } { RestSessionAttempt attempt = null; for (int i = 0; i < 30; i++) { attempt = client.getSessionAttempt(attemptId); if (attempt.getDone()) { break; } Thread.sleep(1000); } assertThat(attempt.getSuccess(), is(true)); } String logs = getAttemptLogs(client, attemptId); assertThat(logs, containsString("digdag params")); }
Source:
void terminateJobHandling(final JobId jobId, final Map<String, String> jobGenericInfo) { try { listenJobLogsSupport.cleanLoggers(jobId); jlogger.close(jobId); long removeDelay = Long.MAX_VALUE; if (SchedulingService.SCHEDULER_AUTO_REMOVED_JOB_DELAY > 0) { removeDelay = SchedulingService.SCHEDULER_AUTO_REMOVED_JOB_DELAY; } if (jobGenericInfo != null && jobGenericInfo.containsKey(GENERIC_INFO_REMOVAL_DELAY)) { try { removeDelay = Math.min(removeDelay, Tools.formatDate(jobGenericInfo.get(GENERIC_INFO_REMOVAL_DELAY))); } catch (Exception e) { logger.error("Error when parsing generic information " + GENERIC_INFO_REMOVAL_DELAY + " for job " + jobId, e); } } if (removeDelay < Long.MAX_VALUE) { long timeToRemove = System.currentTimeMillis() + removeDelay; scheduleJobRemove(jobId, timeToRemove); } } catch (Throwable t) { logger.warn("", t); } }

Target:
void terminateJobHandling(final JobId jobId, final Map<String, String> jobGenericInfo) { try { listenJobLogsSupport.cleanLoggers(jobId); jlogger.close(jobId); long removeDelay = Long.MAX_VALUE; if (SchedulingService.SCHEDULER_AUTO_REMOVED_JOB_DELAY > 0) { removeDelay = SchedulingService.SCHEDULER_AUTO_REMOVED_JOB_DELAY; } if (jobGenericInfo != null && jobGenericInfo.containsKey(GENERIC_INFO_REMOVE_DELAY)) { try { removeDelay = Tools.formatDate(jobGenericInfo.get(GENERIC_INFO_REMOVE_DELAY)); } catch (Exception e) { logger.error("Error when parsing generic information " + GENERIC_INFO_REMOVE_DELAY + " for job " + jobId, e); } } if (removeDelay < Long.MAX_VALUE) { long timeToRemove = System.currentTimeMillis() + removeDelay; scheduleJobRemove(jobId, timeToRemove); } } catch (Throwable t) { logger.warn("", t); } }
Source:
public void visitMethodInvocation(MethodInvocationTree tree) { for (MethodMatcher methodMatcher : getMethodInvocationMatchers()) { if (methodMatcher.matches(tree)) { onMethodInvocationFound(tree); break; } } }

Target:
public void visitMethodInvocation(MethodInvocationTree tree) { if (LAZY_ARG_METHODS.anyMatch(tree) && !insideCatchStatement() && !insideLevelTest()) { onMethodInvocationFound(tree); } }
Source:
private String getByAccountName(CodeReviewCommit codeReviewCommit) { Account account = getAccount(codeReviewCommit); if (account != null && account.getFullName() != null) { return " by " + account.getUserName(); } return ""; }

Target:
private String getByAccountName(CodeReviewCommit codeReviewCommit) { Account account = getAccount(codeReviewCommit); if (account != null && account.getFullName() != null) { return " by " + account.getFullName(); } return ""; }
Source:
protected void onPostExecute(RectF[] rect) { if (rect != null) { if (mMode == Mode.ARABIC && rect.length == 2) { if (mRightImageView != null && mLeftImageView != null) { mRightImageView.setPageBounds(rect[0]); mLeftImageView.setPageBounds(rect[1]); if (mOverlayText) { Context context = getContext(); String suraText = QuranInfo.getSuraNameFromPage(context, mPageNumber - 1, true); String juzText = QuranInfo.getJuzString(context, mPageNumber - 1); String pageText = QuranUtils.getLocalizedNumber(context, mPageNumber - 1); String rub3Text =QuranDisplayHelper.displayRub3(context,mPageNumber - 1); mRightImageView.setOverlayText(suraText, juzText, pageText, rub3Text); suraText = QuranInfo.getSuraNameFromPage(context, mPageNumber, true); juzText = QuranInfo.getJuzString(context, mPageNumber); pageText = QuranUtils.getLocalizedNumber(context, mPageNumber); rub3Text = QuranDisplayHelper.displayRub3(context,mPageNumber); mLeftImageView.setOverlayText(suraText, juzText, pageText, rub3Text); } } } } }

Target:
protected void onPostExecute(RectF[] rect) { if (rect != null) { if (mMode == Mode.ARABIC && rect.length == 2) { if (mRightImageView != null && mLeftImageView != null) { mRightImageView.setPageBounds(rect[0]); mLeftImageView.setPageBounds(rect[1]); if (mOverlayText && isAdded()) { Context context = getContext(); String suraText = QuranInfo.getSuraNameFromPage(context, mPageNumber - 1, true); String juzText = QuranInfo.getJuzString(context, mPageNumber - 1); String pageText = QuranUtils.getLocalizedNumber(context, mPageNumber - 1); String rub3Text =QuranDisplayHelper.displayRub3(context,mPageNumber - 1); mRightImageView.setOverlayText(suraText, juzText, pageText, rub3Text); suraText = QuranInfo.getSuraNameFromPage(context, mPageNumber, true); juzText = QuranInfo.getJuzString(context, mPageNumber); pageText = QuranUtils.getLocalizedNumber(context, mPageNumber); rub3Text = QuranDisplayHelper.displayRub3(context,mPageNumber); mLeftImageView.setOverlayText(suraText, juzText, pageText, rub3Text); } } } } }
Source:
public ExecutorService getIOExecutor() { return ioExecutor; }

Target:
public Executor getIOExecutor() { return ioExecutor; }
Source:
public Response consumerExistsBulk(Set<String> consumerUuids) throws BadRequestException { if (!CollectionUtils.isEmpty(consumerUuids)) { Set<String> nonExistingUuids = consumerCurator.getNonExistingConsumer(consumerUuids); if (nonExistingUuids.isEmpty()) { return Response.status(Response.Status.NO_CONTENT).build(); } else { return Response.status(Response.Status.NOT_FOUND).entity(nonExistingUuids).build(); } } else { throw new BadRequestException(i18n.tr("No UUIDs provided.")); } }

Target:
public Response consumerExistsBulk(Set<String> consumerUuids) throws BadRequestException { if (consumerUuids != null && !consumerUuids.isEmpty()) { Set<String> existingUuids = consumerCurator.getExistingConsumerUuids(consumerUuids); consumerUuids.removeAll(existingUuids); if (consumerUuids.isEmpty()) { return Response.status(Response.Status.NO_CONTENT).build(); } else { return Response.status(Response.Status.NOT_FOUND) .entity(consumerUuids).build(); } } else { throw new BadRequestException(i18n.tr("No UUIDs provided.")); } }
Source:
public void update(OnmsTopologyUpdater updater, OnmsTopologyMessage message) { final OnmsTopologyProtocol protocol = updater.getProtocol(); if (!m_updatersMap.containsKey(protocol)) { throw new IllegalArgumentException(String.format("cannot update message with id: %s. Protocol %s not " + "supported for message status %s", message.getMessagebody().getId(), protocol, message.getMessagestatus())); } if (m_updatersMap.get(protocol) != updater) { throw new IllegalArgumentException(String.format("cannot update message with id: %s, protocol: %s and " + "message status: %s. Updater not registered", message.getMessagebody().getId(), protocol, message.getMessagestatus())); } synchronized (m_consumers) { m_consumers .stream() .filter(consumer -> consumer.getProtocols().contains(protocol)) .forEach(consumer -> consumer.consume(message)); } }

Target:
public void update(OnmsTopologyUpdater updater, OnmsTopologyMessage message) { final OnmsTopologyProtocol protocol = updater.getProtocol(); if (!m_updatersMap.containsKey(protocol)) { throw new IllegalArgumentException(String.format("cannot update message with id: %s. Protocol %s not " + "supported for message status %s", message.getMessagebody().getId(), protocol, message.getMessagestatus())); } if (m_updatersMap.get(protocol) != updater) { throw new IllegalArgumentException(String.format("cannot update message with id: %s, protocol: %s and " + "message status: %s. Updater not registered", message.getMessagebody().getId(), protocol, message.getMessagestatus())); } synchronized (m_consumers) { m_consumers .stream() .filter(consumer -> { if (consumer.getProtocols() == null) { return false; } return consumer.getProtocols().contains(protocol); }) .forEach(consumer -> consumer.consume(message)); } }
Source:
public CuratorFramework makeCurator( CuratorConfig config, EnsembleProvider ensembleProvider, Lifecycle lifecycle) { final Builder builder = CuratorFrameworkFactory.builder(); if (null != config.getZkUser() && null != config.getZkPwd()) { builder.authorization(config.getAuthScheme(), (config.getZkUser() + ":" + config.getZkPwd()).getBytes(StandardCharsets.UTF_8)); } final CuratorFramework framework = builder .ensembleProvider(ensembleProvider) .sessionTimeoutMs(config.getZkSessionTimeoutMs()) .retryPolicy(new BoundedExponentialBackoffRetry( BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES)) .compressionProvider(new PotentiallyGzippedCompressionProvider(config.getEnableCompression())) .aclProvider(config.getEnableAcl() ? new SecuredACLProvider() : new DefaultACLProvider()) .build(); lifecycle.addHandler( new Lifecycle.Handler() { @Override public void start() { log.info("Starting Curator"); framework.start(); } @Override public void stop() { log.info("Stopping Curator"); framework.close(); } }); return framework; }

Target:
public CuratorFramework makeCurator( CuratorConfig config, EnsembleProvider ensembleProvider, Lifecycle lifecycle ) { final Builder builder = CuratorFrameworkFactory.builder(); if (!Strings.isNullOrEmpty(config.getZkUser()) && !Strings.isNullOrEmpty(config.getZkPwd())) { builder.authorization( config.getAuthScheme(), StringUtils.format("%s:%s", config.getZkUser(), config.getZkPwd()).getBytes(StandardCharsets.UTF_8) ); } final CuratorFramework framework = builder .ensembleProvider(ensembleProvider) .sessionTimeoutMs(config.getZkSessionTimeoutMs()) .retryPolicy(new BoundedExponentialBackoffRetry(BASE_SLEEP_TIME_MS, MAX_SLEEP_TIME_MS, MAX_RETRIES)) .compressionProvider(new PotentiallyGzippedCompressionProvider(config.getEnableCompression())) .aclProvider(config.getEnableAcl() ? new SecuredACLProvider() : new DefaultACLProvider()) .build(); lifecycle.addHandler( new Lifecycle.Handler() { @Override public void start() { log.info("Starting Curator"); framework.start(); } @Override public void stop() { log.info("Stopping Curator"); framework.close(); } } ); return framework; }
Source:
public static Map<Integer, API> getAllApis() { Map<Integer, API> apiMap = new HashMap<>(); try ( Connection conn = APIMgtDBUtil.getConnection(); PreparedStatement ps = conn.prepareStatement(InMemorySubscriptionValidationConstants.APIS_LOAD_SQL); ResultSet resultSet = ps.executeQuery(); ) { while (resultSet.next()) { API api = new API(); api.setApiId(resultSet.getInt("API_ID")); api.setProvider(resultSet.getString("API_PROVIDER")); api.setName(resultSet.getString("API_NAME")); api.setPolicy(resultSet.getString("API_TIER")); api.setVersion(resultSet.getString("API_VERSION")); api.setContext(resultSet.getString("CONTEXT")); apiMap.put(api.getApiId(), api); } } catch (SQLException e) { log.error("Error in loading Applications : ", e); } return apiMap; }

Target:
public List<API> getAllApis() { List<API> apiList = new ArrayList<>(); try ( Connection conn = APIMgtDBUtil.getConnection(); PreparedStatement ps = conn.prepareStatement(SubscriptionValidationSQLConstants.GET_ALL_APIS_SQL); ResultSet resultSet = ps.executeQuery(); ) { populateAPIList(resultSet, apiList); } catch (SQLException e) { log.error("Error in loading Apis : ", e); } return apiList; }
Source:
public UUID getIdOfFirstCastSpell(UUID playerId) { return playerFirstSpellCast.getOrDefault(playerId, playerFirstSpellCast.get(playerId)); }

Target:
public UUID getIdOfFirstCastSpell(UUID playerId) { return playerFirstSpellCast.getOrDefault(playerId, playerFirstCastSpell.get(playerId)); }
Source:
public void sitemapContentChanged() { for (SitemapSubscriptionCallback callback : distinctCallbacks) { SitemapChangedEvent changeEvent = new SitemapChangedEvent(); changeEvent.pageId = pageId; changeEvent.sitemapName = sitemapName; callback.onEvent(changeEvent); } }

Target:
public void sitemapContentChanged() { SitemapChangedEvent changeEvent = new SitemapChangedEvent(); changeEvent.pageId = pageId; changeEvent.sitemapName = sitemapName; for (SitemapSubscriptionCallback callback : distinctCallbacks) { callback.onEvent(changeEvent); } }
Source:
public static void main(String[] argv) throws IOException, InvalidArgumentException { int ret = 0; InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults()); conf.set(PropertyKey.USER_RPC_RETRY_MAX_DURATION, "5s", Source.DEFAULT); CollectInfo shell = new CollectInfo(conf); if (argv.length < 2) { shell.printUsage(); throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_INSUFFICIENT .getMessage("collectInfo", 2, argv.length)); } String subCommand = argv[0]; String targetDirPath = argv[1]; List<File> filesToCollect = new ArrayList<>(); if (subCommand.equals("all")) { System.out.println("Execute all child commands"); for (Command cmd : shell.getCommands()) { System.out.format("Executing %s", cmd.getCommandName()); String[] replacementArgv = (String[]) ArrayUtils.addAll(new String[]{cmd.getCommandName()}, ArrayUtils.subarray(argv, 1, argv.length)); int childRet = shell.executeAndAddFile(replacementArgv, filesToCollect); if (ret == 0 && childRet != 0) { ret = childRet; } } } else { int childRet = shell.executeAndAddFile(argv, filesToCollect); if (ret == 0 && childRet != 0) { ret = childRet; } } System.out.format("Archiving dir %s", targetDirPath); String tarballPath = Paths.get(targetDirPath, TARBALL_NAME).toAbsolutePath().toString(); if (filesToCollect.size() == 0) { System.err.format("No files to add. Tarball %s will be empty!", tarballPath); } TarUtils.compress(tarballPath, filesToCollect.toArray(new File[0])); System.out.println("Archiving finished"); System.exit(ret); }

Target:
public static void main(String[] argv) throws IOException { CommandLineParser parser = new DefaultParser(); CommandLine cmd; try { cmd = parser.parse(OPTIONS, argv, true ); } catch (ParseException e) { return; } String[] args = cmd.getArgs(); InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults()); conf.set(PropertyKey.USER_RPC_RETRY_MAX_DURATION, "5s", Source.DEFAULT); CollectInfo shell = new CollectInfo(conf); if (args.length < 2) { System.out.format("Command %s requires at least %s arguments (%s provided)%n", 2, argv.length); shell.printUsage(); System.exit(-1); } int ret; if (cmd.hasOption(LOCAL_OPTION_NAME)) { System.out.println("Executing collectInfo locally"); ret = shell.collectInfoLocal(cmd); } else { System.out.println("Executing collectInfo on all nodes in the cluster"); ret = shell.collectInfoRemote(cmd); } shell.close(); System.exit(ret); }
Source:
private static boolean storedInStaticFinal(MethodInvocationTree mit) { Tree tree = mit.parent(); while (!tree.is(Kind.VARIABLE, Kind.CLASS, Kind.ASSIGNMENT, Kind.METHOD, Kind.ENUM)) { tree = tree.parent(); } return isConstant(tree); }

Target:
private static boolean storedInStaticFinal(MethodInvocationTree mit) { Tree tree = mit.parent(); while (!tree.is(Kind.VARIABLE, Kind.ASSIGNMENT, Kind.COMPILATION_UNIT)) { tree = tree.parent(); } return isConstant(tree); }
Source:
private String getCurrentKnownLeader(final boolean cached) throws IOException { final String leader = currentKnownLeader.accumulateAndGet( null, (current, given) -> current == null || !cached ? pickOneHost() : current ); if (leader == null) { throw new IOE("No known leader"); } else { return leader; } }

Target:
private String getCurrentKnownLeader(final boolean cached) throws IOException { final String leader = currentKnownLeader.accumulateAndGet( null, (current, given) -> current == null || !cached ? pickOneHost() : current ); if (leader == null) { throw new IOE("No known server"); } else { return leader; } }
Source:
private static Response wrap(final Response res, final Fallback fbk, final Request req) { return new RsOf( () -> { final long start = System.currentTimeMillis(); Iterable<String> head; try { head = res.head(); } catch (final Throwable ex) { try { head = fbk.route( TkFallback.fallback( req, start, ex, new TkFallback.HtErrCodeOf(ex).get() ) ).get().head(); } catch (final Exception exx) { throw (IOException) new IOException(exx).initCause(ex); } } return head; }, () -> { final long start = System.currentTimeMillis(); InputStream body; try { body = res.body(); } catch (final Throwable ex) { try { body = fbk.route( TkFallback.fallback( req, start, ex, new TkFallback.HtErrCodeOf(ex).get() ) ).get().body(); } catch (final Exception exx) { throw (IOException) new IOException(exx).initCause(ex); } } return body; } ); }

Target:
private static Response wrap(final Response res, final Fallback fbk, final Request req) { return new ResponseOf( () -> { final long start = System.currentTimeMillis(); Iterable<String> head; try { head = res.head(); } catch (final HttpException ex) { try { head = fbk.route( TkFallback.fallback(req, start, ex, ex.code()) ).get().head(); } catch (final Exception exx) { throw (IOException) new IOException(exx).initCause(ex); } } catch (final Throwable ex) { try { head = fbk.route( TkFallback.fallback( req, start, ex, HttpURLConnection.HTTP_INTERNAL_ERROR ) ).get().head(); } catch (final Exception exx) { throw (IOException) new IOException(exx).initCause(ex); } } return head; }, () -> { final long start = System.currentTimeMillis(); InputStream body; try { body = res.body(); } catch (final HttpException ex) { try { body = fbk.route( TkFallback.fallback(req, start, ex, ex.code()) ).get().body(); } catch (final Exception exx) { throw (IOException) new IOException(exx).initCause(ex); } } catch (final Throwable ex) { try { body = fbk.route( TkFallback.fallback( req, start, ex, HttpURLConnection.HTTP_INTERNAL_ERROR ) ).get().body(); } catch (final Exception exx) { throw (IOException) new IOException(exx).initCause(ex); } } return body; } ); }
Source:
public void stateTransition(Status from, Status to) { switch (to) { case AVAILABLE: { ManagementAgentEntity managementAgentEntity; try { managementAgentEntity = managementAgentEntityFactory.retrieve(); } catch (EntityNotFoundException e) { try { managementAgentEntityFactory.create(); } catch (EntityAlreadyExistsException ignored) { } try { managementAgentEntity = managementAgentEntityFactory.retrieve(); } catch (EntityNotFoundException bigFailure) { throw new AssertionError(bigFailure); } } managementAgentService = new ManagementAgentService(managementAgentEntity); managementAgentService.setTags(managementRegistryService.getConfiguration().getTags()); managementRegistryService.addManagementProvider(new ManagementProviderAdapter<Object>(DefaultClusteringManagementService.class.getSimpleName(), Object.class) { @Override public void register(Object managedObject) { ManagementAgentService service = managementAgentService; ManagementRegistryService registry = managementRegistryService; if (service != null && registry != null) { service.setCapabilities(registry.getContextContainer(), registry.getCapabilities()); } } @Override public void unregister(Object managedObject) { ManagementAgentService service = managementAgentService; ManagementRegistryService registry = managementRegistryService; if (service != null && registry != null) { service.setCapabilities(registry.getContextContainer(), registry.getCapabilities()); } } }); managementAgentService.setCapabilities(managementRegistryService.getContextContainer(), managementRegistryService.getCapabilities()); break; } case UNINITIALIZED: { this.cacheManager.deregisterListener(this); break; } case MAINTENANCE: break; default: throw new AssertionError(to); } }

Target:
public void stateTransition(Status from, Status to) { switch (to) { case AVAILABLE: { ManagementAgentEntity managementAgentEntity; try { managementAgentEntity = managementAgentEntityFactory.retrieve(); } catch (EntityNotFoundException e) { try { managementAgentEntityFactory.create(); } catch (EntityAlreadyExistsException ignored) { } try { managementAgentEntity = managementAgentEntityFactory.retrieve(); } catch (EntityNotFoundException bigFailure) { throw (AssertionError) new AssertionError("Entity " + ManagementAgentEntity.class.getSimpleName() + " cannot be retrieved even after being created.").initCause(bigFailure.getCause()); } } managementAgentService = new ManagementAgentService(managementAgentEntity); managementAgentService.bridge(managementRegistryService); managementAgentService.setTags(managementRegistryService.getConfiguration().getTags()); break; } case UNINITIALIZED: { this.cacheManager.deregisterListener(this); break; } case MAINTENANCE: break; default: throw new AssertionError("Unsupported state: " + to); } }