auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Optional<TimelineAlgorithmResult> getTimelinePrediction(final OneDaysSensorData oneDaysSensorData,final TimelineLog log,final long accountId,final boolean feedbackChanged) { try { final double [][] x = getSensorData(oneDaysSensorData); final Optional<NeuralNetAlgorithmOutput> outputOptional = endpoint.getNetOutput(DEFAULT_SLEEP_NET_ID,x); if (!outputOptional.isPresent()) { return Optional.absent(); } final NeuralNetAlgorithmOutput algorithmOutput = outputOptional.get(); final List<Sample> light = oneDaysSensorData.allSensorSampleList.get(Sensor.LIGHT); if (light.isEmpty()) { return Optional.absent(); } final TreeMap<Long,Integer> offsetMap = Maps.newTreeMap(); for (final Sample s : light) { offsetMap.put(s.dateTime,s.offsetMillis); } final long t0 = light.get(0).dateTime; final Optional<SleepProbabilityInterpreter.EventIndices> indicesOptional = SleepProbabilityInterpreter.getEventIndices(algorithmOutput.output[1],x[SensorIndices.MY_MOTION_DURATION.index()]); if (!indicesOptional.isPresent()) { LOGGER.warn("status=no_event_indices"); return Optional.absent(); } return Optional.of(new TimelineAlgorithmResult(AlgorithmType.NEURAL_NET,getAllEvents(offsetMap,t0,indicesOptional.get()))); } catch (Exception e) { e.printStackTrace(); } return Optional.absent(); }

Target:
public Optional<TimelineAlgorithmResult> getTimelinePrediction(final OneDaysSensorData oneDaysSensorData,final TimelineLog log,final long accountId,final boolean feedbackChanged) { try { final double [][] x = getSensorData(oneDaysSensorData); final Optional<NeuralNetAlgorithmOutput> outputOptional = endpoint.getNetOutput(DEFAULT_SLEEP_NET_ID,x); if (!outputOptional.isPresent()) { return Optional.absent(); } final NeuralNetAlgorithmOutput algorithmOutput = outputOptional.get(); final List<Sample> light = oneDaysSensorData.allSensorSampleList.get(Sensor.LIGHT); if (light.isEmpty()) { return Optional.absent(); } final TreeMap<Long,Integer> offsetMap = Maps.newTreeMap(); for (final Sample s : light) { offsetMap.put(s.dateTime,s.offsetMillis); } final long t0 = light.get(0).dateTime; final Optional<SleepProbabilityInterpreter.EventIndices> indicesOptional = SleepProbabilityInterpreter.getEventIndices(algorithmOutput.output[1],x[SensorIndices.MY_MOTION_DURATION.index()]); if (!indicesOptional.isPresent()) { LOGGER.warn("action=return_no_indices reason=no_event_indices_from_sleep_probability_interpreter"); return Optional.absent(); } return Optional.of(new TimelineAlgorithmResult(AlgorithmType.NEURAL_NET,getAllEvents(offsetMap,t0,indicesOptional.get()))); } catch (Exception e) { LOGGER.error("action=caught_exception exception=Exception error=invalid_index_calculation"); LOGGER.debug(e.getMessage()); } return Optional.absent(); }
Source:
void shutdown() throws InterruptedException { long startTimeMs = time.milliseconds(); try { running = false; compactionManager.disable(); diskIOScheduler.disable(); final AtomicInteger numFailures = new AtomicInteger(0); List<Thread> shutdownThreads = new ArrayList<>(); for (final Map.Entry<PartitionId, BlobStore> partitionAndStore : stores.entrySet()) { if (stoppedReplicas.contains(partitionAndStore.getKey().toPathString())) { continue; } Thread thread = Utils.newThread("store-shutdown-" + partitionAndStore.getKey(), () -> { try { partitionAndStore.getValue().shutdown(); } catch (Exception e) { numFailures.incrementAndGet(); metrics.totalStoreShutdownFailures.inc(); logger.error("Exception while shutting down store on disk {}", partitionAndStore.getKey(), disk, e); } }, false); thread.start(); shutdownThreads.add(thread); } for (Thread shutdownThread : shutdownThreads) { shutdownThread.join(); } if (numFailures.get() > 0) { logger.error( "Could not shutdown " + numFailures.get() + " out of " + stores.size() + " stores on the disk " + disk); } compactionManager.awaitTermination(); longLivedTaskScheduler.shutdown(); if (!longLivedTaskScheduler.awaitTermination(30, TimeUnit.SECONDS)) { logger.error("Could not terminate long live tasks after DiskManager shutdown"); } } finally { metrics.diskShutdownTimeMs.update(time.milliseconds() - startTimeMs); } }

Target:
void shutdown() throws InterruptedException { long startTimeMs = time.milliseconds(); try { running = false; compactionManager.disable(); diskIOScheduler.disable(); final AtomicInteger numFailures = new AtomicInteger(0); List<Thread> shutdownThreads = new ArrayList<>(); for (final Map.Entry<PartitionId, BlobStore> partitionAndStore : stores.entrySet()) { if (!partitionAndStore.getValue().isStarted()) { continue; } Thread thread = Utils.newThread("store-shutdown-" + partitionAndStore.getKey(), () -> { try { partitionAndStore.getValue().shutdown(); } catch (Exception e) { numFailures.incrementAndGet(); metrics.totalStoreShutdownFailures.inc(); logger.error("Exception while shutting down store on disk {}", partitionAndStore.getKey(), disk, e); } }, false); thread.start(); shutdownThreads.add(thread); } for (Thread shutdownThread : shutdownThreads) { shutdownThread.join(); } if (numFailures.get() > 0) { logger.error( "Could not shutdown " + numFailures.get() + " out of " + stores.size() + " stores on the disk " + disk); } compactionManager.awaitTermination(); longLivedTaskScheduler.shutdown(); if (!longLivedTaskScheduler.awaitTermination(30, TimeUnit.SECONDS)) { logger.error("Could not terminate long live tasks after DiskManager shutdown"); } } finally { metrics.diskShutdownTimeMs.update(time.milliseconds() - startTimeMs); } }
Source:
CloudConnectionConstants(final String value) { this.value = value; }

Target:
private CloudConnectionConstants(final String value) { this.value = value; }
Source:
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeBeanDiscoveryEvent, final BeanManager beanManager) { Contracts.assertNotNull( beforeBeanDiscoveryEvent, "The BeforeBeanDiscovery event cannot be null" ); Contracts.assertNotNull( beanManager, "The BeanManager cannot be null" ); AnnotatedType<ValidationExtension> annotatedType = beanManager.createAnnotatedType( ValidationExtension.class ); beforeBeanDiscoveryEvent.addAnnotatedType( annotatedType ); }

Target:
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeBeanDiscoveryEvent, final BeanManager beanManager) { Contracts.assertNotNull( beforeBeanDiscoveryEvent, "The BeforeBeanDiscovery event cannot be null" ); Contracts.assertNotNull( beanManager, "The BeanManager cannot be null" ); AnnotatedType<ValidationInterceptor> annotatedType = beanManager.createAnnotatedType( ValidationInterceptor.class ); beforeBeanDiscoveryEvent.addAnnotatedType( annotatedType ); }
Source:
private synchronized void registerDirectoryInternal(AbstractWatchService service, Kind<?>[] kinds, Path directory) { if (watchService == null) { try { watchService = FileSystems.getDefault().newWatchService(); qr = new Thread(this, "Dir Watcher"); qr.start(); } catch (IOException e) { e.printStackTrace(); logger.error("Cannot activate watch service", e.getMessage()); return; } } WatchKey registrationKey = null; try { registrationKey = directory.register(this.watchService, kinds); } catch (IOException e) { e.printStackTrace(); logger.debug("The directory '{}' was not registered in the watch service", directory, e); } if (registrationKey != null) { registeredKeys.put(registrationKey, directory); keyToService.put(registrationKey, service); } else { logger.debug("The directory '{}' was not registered in the watch service", directory); } }

Target:
private synchronized void registerDirectoryInternal(AbstractWatchService service, Kind<?>[] kinds, Path directory) { if (watchService == null) { try { watchService = FileSystems.getDefault().newWatchService(); qr = new Thread(this, "Dir Watcher"); qr.start(); } catch (IOException e) { logger.debug("The directory '{}' was not registered in the watch service", directory, e); return; } } WatchKey registrationKey = null; try { registrationKey = directory.register(this.watchService, kinds); } catch (IOException e) { e.printStackTrace(); logger.debug("The directory '{}' was not registered in the watch service", directory, e); } if (registrationKey != null) { registeredKeys.put(registrationKey, directory); keyToService.put(registrationKey, service); } else { logger.debug("The directory '{}' was not registered in the watch service", directory); } }
Source:
public BaseServer(@Nonnull ServerContext context) { this.serverContext = context; executor = Executors.newFixedThreadPool(serverContext.getBaseServerThreadCount(), new ServerThreadFactory("baseServer-", new ServerThreadFactory.ExceptionHandler())); }

Target:
public BaseServer(@Nonnull ServerContext context) { serverContext = context; executor = serverContext.getExecutorService(serverContext.getBaseServerThreadCount(), "baseServer-"); }
Source:
public ValueMatcher makeMatcher(ColumnSelectorFactory factory){ if (filters.size() == 0) { return new BooleanValueMatcher(false); } final ValueMatcher[] matchers = new ValueMatcher[filters.size()]; for (int i = 0; i < filters.size(); i++) { matchers[i] = filters.get(i).makeMatcher(factory); } return makeMatcher(matchers); }

Target:
public ValueMatcher makeMatcher(ColumnSelectorFactory factory) { final ValueMatcher[] matchers = new ValueMatcher[filters.size()]; for (int i = 0; i < filters.size(); i++) { matchers[i] = filters.get(i).makeMatcher(factory); } return makeMatcher(matchers); }
Source:
public void checkSelectFilter(final String label, final String value) { selectInputs.computeIfPresent(label, (key, values) -> { values.forEach(i -> { if ((i.getValue().equals(value) || i.getValue() == value) && i.getChecked() == false) { i.setChecked(true); } }); return values; }); }

Target:
public void checkSelectFilter(final String label, final String value) { selectInputs.computeIfPresent(label, (key, values) -> { values.forEach(i -> { if (i.getValue().equals(value) && i.getChecked() == false) { i.setChecked(true); } }); return values; }); }
Source:
public void testNotification() throws InterruptedException { prepareLooper(); final CountDownLatch latch = new CountDownLatch(1); final MediaLibrarySessionCallback sessionCallback = new MediaLibrarySessionCallback() { @Override public SessionCommandGroup2 onConnect(@NonNull MediaSession2 session, @NonNull ControllerInfo controller) { if (Process.myUid() == controller.getUid()) { mSession = session; mPlayer = (MockPlayer) session.getPlayerConnector(); assertEquals(mContext.getPackageName(), controller.getPackageName()); assertFalse(controller.isTrusted()); latch.countDown(); } return super.onConnect(session, controller); } }; TestServiceRegistry.getInstance().setSessionCallback(sessionCallback); MediaController2 controller = createController(TestUtils.getServiceToken(mContext, MockMediaSessionService2.ID)); showToast("Notification will be shown"); mPlayer.notifyPlaybackState(MediaPlayerConnector.PLAYER_STATE_PLAYING); Thread.sleep(NOTIFICATION_SHOW_TIME_MS); showToast("Notification will be removed"); mPlayer.notifyPlaybackState(MediaPlayerConnector.PLAYER_STATE_ERROR); Thread.sleep(NOTIFICATION_SHOW_TIME_MS); }

Target:
public void testNotification() throws InterruptedException { prepareLooper(); final CountDownLatch latch = new CountDownLatch(1); final MediaLibrarySessionCallback sessionCallback = new MediaLibrarySessionCallback() { @Override public SessionCommandGroup2 onConnect(@NonNull MediaSession2 session, @NonNull ControllerInfo controller) { if (Process.myUid() == controller.getUid()) { mSession = session; mPlayer = (MockPlayer) session.getPlayerConnector(); assertEquals(mContext.getPackageName(), controller.getPackageName()); assertFalse(controller.isTrusted()); latch.countDown(); } return super.onConnect(session, controller); } }; TestServiceRegistry.getInstance().setSessionCallback(sessionCallback); MediaController2 controller = createController(TestUtils.getServiceToken(mContext, MockMediaSessionService2.ID)); showToast("Notification will be shown"); mPlayer.notifyPlaybackState(MediaPlayerConnector.PLAYER_STATE_PLAYING); Thread.sleep(NOTIFICATION_SHOW_TIME_MS); showToast("Notification can be removable shortly"); mPlayer.notifyPlaybackState(MediaPlayerConnector.PLAYER_STATE_ERROR); Thread.sleep(NOTIFICATION_SHOW_TIME_MS); showToast("Notification will be removed"); }
Source:
private void checkDuplicate(UDF udf) { List<QueryParam> qps = QueryParam.params(UDF.NAME, udf.getName(), UDF.CLASSNAME, udf.getClassName(), UDF.TYPE, udf.getType().toString()); Collection<UDF> existing = catalogService.listUDFs(qps); if (!existing.isEmpty()) { LOG.warn("UDF with same (name, classname, type) already exists", udf); throw EntityAlreadyExistsException.byName(udf.getName()); } }

Target:
private void checkDuplicate(UDF udf) { List<QueryParam> qps = QueryParam.params(UDF.NAME, udf.getName(), UDF.CLASSNAME, udf.getClassName(), UDF.TYPE, udf.getType().toString()); Collection<UDF> existing = catalogService.listUDFs(qps); if (!existing.isEmpty()) { LOG.warn("UDF with same (name, classname, type) already exists, udf: {}", udf); throw EntityAlreadyExistsException.byName(udf.getName()); } }
Source:
public void canDecodeExceptionOfKnownType() throws JsonProcessingException { SerializableError serializableError = SerializableError.of(EXCEPTION_MESSAGE, KNOWN_ERROR_NAME); Response response = createResponseForEntity(serializableError); Exception exception = decoder.decode(SOME_METHOD_KEY, response); assertThat(exception).isInstanceOf(AtlasDbRemoteException.class) .satisfies(remoteException -> assertHasErrorName(remoteException, KNOWN_ERROR_NAME)); }

Target:
public void canDecodeExceptionOfKnownType() throws JsonProcessingException { assertCanSerializeAndDeserializeErrorWithName(KNOWN_ERROR_NAME); }
Source:
public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { try { getUserFromPreferences( (name, email) -> { if (isNullOrEmpty(name) && isNullOrEmpty(email)) { try { getUserFromUserManager( (uName, uEmail) -> prepareAndProvisionGitConfiguration(uName, uEmail, k8sEnv, identity)); } catch (NotFoundException | ServerException e) { reportWarning( k8sEnv, Warnings.EXCEPTION_IN_USER_MANAGER_DURING_GIT_PROVISION_WARNING_CODE, format( Warnings.EXCEPTION_IN_USER_MANAGER_DURING_GIT_PROVISION_MESSAGE_FMT, e.getMessage())); } return; } prepareAndProvisionGitConfiguration(name, email, k8sEnv, identity); }); } catch (ServerException e) { reportWarning( k8sEnv, Warnings.EXCEPTION_IN_USER_PREFERENCES_MANAGER_DURING_GIT_PROVISION_WARNING_CODE, format( Warnings.EXCEPTION_IN_USER_PREFERENCES_MANAGER_DURING_GIT_PROVISION_MESSAGE_FMT, e.getMessage())); } catch (JsonSyntaxException e) { reportWarning( k8sEnv, Warnings.JSON_IS_NOT_A_VALID_REPRESENTATION_FOR_AN_OBJECT_OF_TYPE_WARNING_CODE, format( Warnings.JSON_IS_NOT_A_VALID_REPRESENTATION_FOR_AN_OBJECT_OF_TYPE_MESSAGE_FMT, e.getMessage())); } }

Target:
public void provision(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { try { Pair<String, String> userAndEmail = getUserFromPreferences(); if (userAndEmail == null) { userAndEmail = getUserFromUserManager(); } prepareAndProvisionGitConfiguration( userAndEmail.first, userAndEmail.second, k8sEnv, identity); } catch (ServerException | NotFoundException e) { reportWarning( k8sEnv, Warnings.EXCEPTION_IN_USER_MANAGEMENT_DURING_GIT_PROVISION_WARNING_CODE, format( Warnings.EXCEPTION_IN_USER_MANAGEMENT_DURING_GIT_PROVISION_MESSAGE_FMT, e.getMessage())); } catch (JsonSyntaxException e) { reportWarning( k8sEnv, Warnings.JSON_IS_NOT_A_VALID_REPRESENTATION_FOR_AN_OBJECT_OF_TYPE_WARNING_CODE, format( Warnings.JSON_IS_NOT_A_VALID_REPRESENTATION_FOR_AN_OBJECT_OF_TYPE_MESSAGE_FMT, e.getMessage())); } }
Source:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RequestCodes.PICTURE_LIBRARY: case RequestCodes.VIDEO_LIBRARY: if (resultCode == Activity.RESULT_OK) { if (data != null) { Uri imageUri = data.getData(); String mimeType = getContentResolver().getType(imageUri); fetchMedia(imageUri, mimeType); } } break; case RequestCodes.TAKE_PHOTO: if (resultCode == Activity.RESULT_OK) { if (data != null) { Uri uri = Uri.parse(mMediaCapturePath); mMediaCapturePath = null; queueFileForUpload(uri, getContentResolver().getType(uri)); } } break; case RequestCodes.TAKE_VIDEO: if (resultCode == Activity.RESULT_OK) { Uri uri = MediaUtils.getLastRecordedVideoUri(this); queueFileForUpload(uri, getContentResolver().getType(uri)); } break; } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case RequestCodes.PICTURE_LIBRARY: case RequestCodes.VIDEO_LIBRARY: if (resultCode == Activity.RESULT_OK && data != null) { Uri imageUri = data.getData(); String mimeType = getContentResolver().getType(imageUri); fetchMedia(imageUri, mimeType); } break; case RequestCodes.TAKE_PHOTO: if (resultCode == Activity.RESULT_OK) { Uri uri = Uri.parse(mMediaCapturePath); mMediaCapturePath = null; queueFileForUpload(uri, getContentResolver().getType(uri)); } break; case RequestCodes.TAKE_VIDEO: if (resultCode == Activity.RESULT_OK) { Uri uri = MediaUtils.getLastRecordedVideoUri(this); queueFileForUpload(uri, getContentResolver().getType(uri)); } break; } }
Source:
void execute(WorkflowExecutor workflowExecutor) throws IOException; enum WorkflowName { LOAD_SEQUENCER { @Override public Workflow createWorkflow() { return new LoadSequencerWorkflow(); } }; public Workflow createWorklow(Progress progress) { Workflow workflow = createWorkflow(); workflow.setProgress(progress); return workflow; } protected abstract Workflow createWorkflow(); }

Target:
void execute(WorkflowExecutor workflowExecutor) throws IOException; enum WorkflowName { LOAD_SEQUENCER { @Override public Workflow createWorkflow() { return new LoadSequencerWorkflow(); } }; public Workflow createWorkflow(Progress progress) { Workflow workflow = createWorkflow(); workflow.setProgress(progress); return workflow; } protected abstract Workflow createWorkflow(); }
Source:
public void validate(BulkCommand command) throws IllegalArgumentException { for (String param : command.getParams().keySet()) { if (!PARAM_DISABLE_AUDIT.equals(param) && !PARAM_VERSIONING_OPTION.equals(param)) { Field field = Framework.getService(SchemaManager.class).getField(param); if (field == null) { throw new IllegalArgumentException(unknownValueMessage("xpath " + param, command)); } } } Serializable disableAudit = command.getParam(PARAM_DISABLE_AUDIT); if (disableAudit != null && !Boolean.TRUE.equals(disableAudit) && !Boolean.FALSE.equals(disableAudit)) { throw new IllegalArgumentException(invalidParameterMessage(PARAM_DISABLE_AUDIT, command)); } Serializable versioningOption = command.getParam(PARAM_VERSIONING_OPTION); if (versioningOption != null && (!(versioningOption instanceof String) || Stream.of(VersioningOption.values()).noneMatch(op -> versioningOption.equals(op.name())))) { throw new IllegalArgumentException(invalidParameterMessage(PARAM_VERSIONING_OPTION, command)); } }

Target:
public void validate(BulkCommand command) throws IllegalArgumentException { Set<String> params = new HashSet<>(command.getParams().keySet()); params.removeAll(getParametersToValidate()); for (String param : params) { validateXpath(null, param, command); } validateCommand(command); }
Source:
public boolean equals(Object obj) { if (obj instanceof CachedMethodInfo) { if (!((CachedMethodInfo) obj).getMethodName().equals(this._methodName)) return false; Class<?>[] targetParamTypes = ((CachedMethodInfo) obj).getParamTypes(); int len = _paramTypes != null ? _paramTypes.length : 0; int len2 = targetParamTypes != null ? targetParamTypes.length : 0; if (len != len2) return false; for (int j = 0; j < len; ++j) { if (!Objects.equals(_paramTypes[j], targetParamTypes[j])) return false; } return true; } return false; }

Target:
public boolean equals(Object obj) { if (!(obj instanceof CachedMethodInfo)) return false; if (!((CachedMethodInfo) obj).getMethodName().equals(this._methodName)) return false; Class<?>[] targetParamTypes = ((CachedMethodInfo) obj).getParamTypes(); int len = _paramTypes != null ? _paramTypes.length : 0; int len2 = targetParamTypes != null ? targetParamTypes.length : 0; if (len != len2) return false; for (int j = 0; j < len; ++j) { if (!Objects.equals(_paramTypes[j], targetParamTypes[j])) return false; } return true; }
Source:
public Embedding deserialize(JsonNode rootNode, Configuration configuration) { String data = rootNode.get("data").asText(); String mimeType = findMimeType(rootNode); String name = null; if (rootNode.has("name")) { name = rootNode.get("name").asText(); } Embedding embedding = new Embedding(mimeType, data, name); storeEmbedding(embedding, configuration.getEmbeddingDirectory()); return embedding; }

Target:
public Embedding deserialize(JsonNode rootNode, Configuration configuration) { String data = rootNode.get("data").asText(); String mimeType = findMimeType(rootNode); Embedding embedding; String nameField = "name"; if (rootNode.has(nameField)) { String name = rootNode.get(nameField).asText(); embedding = new Embedding(mimeType, data, name); } else { embedding = new Embedding(mimeType, data); } storeEmbedding(embedding, configuration.getEmbeddingDirectory()); return embedding; }
Source:
public void promptLogin() { if (serverProperties.isInactive()) { SwingComponents.showDialogWithLinks( DialogWithLinksParams.builder() .title("Lobby Not Available") .dialogText( String.format( "Your version of TripleA is too old, please download the latest: <a>%s</a>", UrlConstants.DOWNLOAD_WEBSITE)) .dialogType(DialogWithLinksTypes.ERROR) .build()); return; } loginToServer() .ifPresent( lobbyClient -> { final LobbyFrame lobbyFrame = new LobbyFrame(lobbyClient, serverProperties); GameRunner.hideMainFrame(); lobbyFrame.setVisible(true); if (lobbyClient.isPasswordChangeRequired()) { try { final boolean passwordChanged = ChangePasswordPanel.doPasswordChange( lobbyFrame, lobbyClient.getHttpLobbyClient(), ChangePasswordPanel.AllowCancelMode.DO_NOT_SHOW_CANCEL_BUTTON); if (passwordChanged) { DialogBuilder.builder() .parent(lobbyFrame) .title("Success") .infoMessage("Password successfully updated!") .showDialog(); } else { notifyTempPasswordInvalid(lobbyFrame, null); } } catch (final HttpInteractionException e) { notifyTempPasswordInvalid(lobbyFrame, e); } } }); }

Target:
public void promptLogin() { if (serverProperties.isInactive()) { SwingComponents.showDialogWithLinks( DialogWithLinksParams.builder() .title("Lobby Not Available") .dialogText( String.format( "Your version of TripleA is too old, please download the latest:" + "<br><a href=\"%s\">%s</a>", UrlConstants.DOWNLOAD_WEBSITE, UrlConstants.DOWNLOAD_WEBSITE)) .dialogType(DialogWithLinksTypes.ERROR) .build()); return; } loginToServer() .ifPresent( lobbyClient -> { final LobbyFrame lobbyFrame = new LobbyFrame(lobbyClient, serverProperties); GameRunner.hideMainFrame(); lobbyFrame.setVisible(true); if (lobbyClient.isPasswordChangeRequired()) { try { final boolean passwordChanged = ChangePasswordPanel.doPasswordChange( lobbyFrame, lobbyClient.getHttpLobbyClient(), ChangePasswordPanel.AllowCancelMode.DO_NOT_SHOW_CANCEL_BUTTON); if (passwordChanged) { DialogBuilder.builder() .parent(lobbyFrame) .title("Success") .infoMessage("Password successfully updated!") .showDialog(); } else { notifyTempPasswordInvalid(lobbyFrame, null); } } catch (final HttpInteractionException e) { notifyTempPasswordInvalid(lobbyFrame, e); } } }); }
Source:
public void testOrphanTasksDeletion() { DocumentModel route = session.createDocumentModel("/default-domain/workspaces", "dummyRoute", DOCUMENT_ROUTE_DOCUMENT_TYPE); route.setPropertyValue(TITLE_PROPERTY_NAME, "dummyRoute"); route = session.createDocument(route); DocumentModel taskDocument = session.createDocumentModel("/default-domain/workspaces", "dummyTask", TASK_TYPE_NAME); taskDocument.setPropertyValue(TASK_PROCESS_ID_PROPERTY_NAME, route.getId()); taskDocument = session.createDocument(taskDocument); session.save(); session.removeDocument(route.getRef()); if (session.exists(taskDocument.getRef())) { fail(); } }

Target:
public void testOrphanTasksDeletion() { DocumentModel route = session.createDocumentModel("/default-domain/workspaces", "dummyRoute", DOCUMENT_ROUTE_DOCUMENT_TYPE); route = session.createDocument(route); DocumentModel task = session.createDocumentModel("/default-domain/workspaces", "dummyTask", TASK_TYPE_NAME); task.setPropertyValue(TASK_PROCESS_ID_PROPERTY_NAME, route.getId()); task = session.createDocument(task); session.removeDocument(route.getRef()); txFeature.nextTransaction(); assertFalse(session.exists(task.getRef())); }
Source:
public void stop() { LOG.info("Stopping the container process manager"); containerAllocator.stop(); containerPlacementHandler.stop(); try { allocatorThread.join(); LOG.info("Stopped container allocator"); } catch (InterruptedException ie) { LOG.error("Allocator thread join threw an interrupted exception", ie); Thread.currentThread().interrupt(); } if (diagnosticsManager.isDefined()) { try { diagnosticsManager.get().stop(); } catch (InterruptedException e) { LOG.error("InterruptedException while stopping diagnosticsManager", e); } } try { if (metricsReporters != null) { metricsReporters.values().forEach(reporter -> reporter.stop()); } if (jvmMetrics != null) { jvmMetrics.stop(); } LOG.info("Stopped containerProcessManagerMetrics reporters"); } catch (Throwable e) { LOG.error("Exception while stopping containerProcessManagerMetrics", e); } try { clusterResourceManager.stop(state.status); LOG.info("Stopped the cluster resource manager"); } catch (Throwable e) { LOG.error("Exception while stopping cluster resource manager", e); } LOG.info("Stopped the container process manager"); }

Target:
public void stop() { LOG.info("Stopping the container process manager"); containerAllocator.stop(); try { allocatorThread.join(); LOG.info("Stopped container allocator"); } catch (InterruptedException ie) { LOG.error("Allocator thread join threw an interrupted exception", ie); Thread.currentThread().interrupt(); } if (diagnosticsManager.isDefined()) { try { diagnosticsManager.get().stop(); } catch (InterruptedException e) { LOG.error("InterruptedException while stopping diagnosticsManager", e); } } try { if (metricsReporters != null) { metricsReporters.values().forEach(reporter -> reporter.stop()); } if (jvmMetrics != null) { jvmMetrics.stop(); } LOG.info("Stopped containerProcessManagerMetrics reporters"); } catch (Throwable e) { LOG.error("Exception while stopping containerProcessManagerMetrics", e); } try { clusterResourceManager.stop(state.status); LOG.info("Stopped the cluster resource manager"); } catch (Throwable e) { LOG.error("Exception while stopping cluster resource manager", e); } LOG.info("Stopped the container process manager"); }
Source:
private void init(PName name, PName familyName, PDataType dataType, Integer maxLength, Integer scale, boolean nullable, int position) { this.dataType = dataType; if (familyName == null) { Preconditions.checkArgument(!nullable || !dataType.isFixedWidth() || name.getString().equals(SALTING_COLUMN_NAME), "PK columns may not be both fixed width and nullable: " + name.getString()); } this.name = name; this.familyName = familyName == null ? null : familyName; this.maxLength = maxLength; this.scale = scale; this.nullable = nullable; this.position = position; }

Target:
private void init(PName name, PName familyName, PDataType dataType, Integer maxLength, Integer scale, boolean nullable, int position) { this.dataType = dataType; if (familyName == null) { Preconditions.checkArgument(!nullable || !dataType.isFixedWidth(), "PK columns may not be both fixed width and nullable: " + name.getString()); } this.name = name; this.familyName = familyName == null ? null : familyName; this.maxLength = maxLength; this.scale = scale; this.nullable = nullable; this.position = position; }
Source:
protected org.ovirt.engine.core.common.businessentities.VmPool getEntity(int index) { return setUpEntityExpectations(control.createMock(org.ovirt.engine.core.common.businessentities.VmPool.class), index); }

Target:
protected org.ovirt.engine.core.common.businessentities.VmPool getEntity(int index) { org.ovirt.engine.core.common.businessentities.VmPool entity = control.createMock(org.ovirt.engine.core.common.businessentities.VmPool.class); expect(entity.getVmPoolId()).andReturn(GUIDS[index]).anyTimes(); expect(entity.getName()).andReturn(NAMES[index]).anyTimes(); expect(entity.getVmPoolDescription()).andReturn(DESCRIPTIONS[index]).anyTimes(); expect(entity.getVmPoolType()).andReturn(VmPoolType.Automatic).anyTimes(); expect(entity.getVdsGroupId()).andReturn(GUIDS[2]).anyTimes(); return entity; }
Source:
protected void dispose() { for (Iterator< RuntimeRule>it = rules.values().iterator(); it.hasNext();) { RuntimeRule r = it.next(); removeRuleEntry(r); it.remove(); } if (compositeFactory != null) { compositeFactory.dispose(); compositeFactory = null; } for (Future f : scheduleTasks.values()) { f.cancel(true); } if (scheduleTasks.isEmpty()) { if (executor != null) { executor.shutdown(); executor = null; } } scheduleTasks = null; if (contextMap != null) { contextMap.clear(); contextMap = null; } statusInfoCallback = null; }

Target:
public synchronized void dispose() { if (!isDisposed) { isDisposed = true; for (Iterator< RuntimeRule>it = rules.values().iterator(); it.hasNext();) { RuntimeRule r = it.next(); removeRuleEntry(r); it.remove(); } if (compositeFactory != null) { compositeFactory.dispose(); compositeFactory = null; } } for (Future f : scheduleTasks.values()) { f.cancel(true); } if (scheduleTasks.isEmpty()) { if (executor != null) { executor.shutdown(); executor = null; } } scheduleTasks = null; if (contextMap != null) { contextMap.clear(); contextMap = null; } statusInfoCallback = null; }
Source:
public String getTrustStorePath() { String path = getString(ConfVars.ZEPPELIN_SSL_TRUSTSTORE_PATH); if (path == null) { path = getKeyStorePassword(); } if (path != null && path.startsWith("/") || isWindowsPath(path)) { return path; } else { return getRelativeDir( String.format("%s/%s", getConfDir(), getString(path))); } }

Target:
public String getTrustStorePath() { String path = getString(ConfVars.ZEPPELIN_SSL_TRUSTSTORE_PATH); if (path == null) { path = getKeyStorePath(); } if (path != null && path.startsWith("/") || isWindowsPath(path)) { return path; } else { return getRelativeDir( String.format("%s/%s", getConfDir(), path)); } }
Source:
public ViewerDescriptor[] findStructureViewerDescriptor(Viewer oldViewer, ICompareInput input, CompareConfiguration configuration) { if (input == null) return null; if (input == null || input.getLeft() == null || input.getRight() == null) return null; Set<ViewerDescriptor> result = new LinkedHashSet<ViewerDescriptor>(); IContentType ctype= getCommonType(input); if (ctype != null) { initializeRegistries(); List<ViewerDescriptor> list = fStructureMergeViewers.searchAll(ctype); if (list != null) result.addAll(list); } String[] types= getTypes(input); String type= null; if (isHomogenous(types)) { type= normalizeCase(types[0]); initializeRegistries(); List<ViewerDescriptor> list = fStructureMergeViewers.searchAll(type); if (list != null) result.addAll(list); String alias= getStructureViewerAlias(type); if (alias != null) { list = fStructureMergeViewers.searchAll(alias); if (list != null) result.addAll(list); } } return result.size() > 0 ? result.toArray(new ViewerDescriptor[0]) : null; }

Target:
public ViewerDescriptor[] findStructureViewerDescriptor(Viewer oldViewer, ICompareInput input, CompareConfiguration configuration) { if (input == null) return null; if (input == null || input.getLeft() == null || input.getRight() == null) return null; Set<ViewerDescriptor> result = new LinkedHashSet<>(); IContentType ctype= getCommonType(input); if (ctype != null) { initializeRegistries(); List<ViewerDescriptor> list = fStructureMergeViewers.searchAll(ctype); if (list != null) result.addAll(list); } String[] types= getTypes(input); String type= null; if (isHomogenous(types)) { type= normalizeCase(types[0]); initializeRegistries(); List<ViewerDescriptor> list = fStructureMergeViewers.searchAll(type); if (list != null) result.addAll(list); String alias= getStructureViewerAlias(type); if (alias != null) { list = fStructureMergeViewers.searchAll(alias); if (list != null) result.addAll(list); } } return result.size() > 0 ? result.toArray(new ViewerDescriptor[0]) : null; }
Source:
private void commitRemoveBricks() { if (getSelectedItems() == null || getSelectedItems().isEmpty()) { return; } if (getConfirmWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksTitle()); model.setMessage(ConstantsManager.getInstance().getConstants().commitRemoveBricksMessage()); model.setHashName("volume_remove_bricks_commit"); GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getEntity(); ArrayList<String> list = new ArrayList<String>(); for (GlusterBrickEntity brick : volumeEntity.getBricks()) { if (brick.getAsyncTask() != null && brick.getAsyncTask().getStatus() == JobExecutionStatus.STARTED) { list.add(brick.getQualifiedName()); } } model.setItems(list); UICommand okCommand = new UICommand("OnCommitRemoveBricks", this); okCommand.setTitle(ConstantsManager.getInstance().getConstants().ok()); okCommand.setIsDefault(true); model.getCommands().add(okCommand); UICommand cancelCommand = new UICommand("CancelConfirmation", this); cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close()); cancelCommand.setIsCancel(true); model.getCommands().add(cancelCommand); }

Target:
private void commitRemoveBricks() { if (getSelectedItems() == null || getSelectedItems().isEmpty()) { return; } if (getConfirmWindow() != null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksTitle()); model.setMessage(ConstantsManager.getInstance().getConstants().commitRemoveBricksMessage()); model.setHashName("volume_remove_bricks_commit"); GlusterVolumeEntity volumeEntity = (GlusterVolumeEntity) getEntity(); GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask(); ArrayList<String> list = new ArrayList<String>(); for (GlusterBrickEntity brick : volumeEntity.getBricks()) { if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null && volumeTask != null && volumeTask.getStatus() == JobExecutionStatus.FINISHED) { list.add(brick.getQualifiedName()); } } model.setItems(list); UICommand okCommand = new UICommand("OnCommitRemoveBricks", this); okCommand.setTitle(ConstantsManager.getInstance().getConstants().ok()); okCommand.setIsDefault(true); model.getCommands().add(okCommand); UICommand cancelCommand = new UICommand("CancelConfirmation", this); cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close()); cancelCommand.setIsCancel(true); model.getCommands().add(cancelCommand); }
Source:
public static File createTempDeployment(final String configFile) throws IOException { final String current = System.getProperty("user.dir"); File tempDeploy = Files.createTempDirectory("tempdeploy").toFile(); String tempDeployPath = tempDeploy.getAbsolutePath(); System.out.println("generating temp deployment at " + tempDeployPath); Files.createSymbolicLink(Paths.get(tempDeployPath, "libs"), Paths.get(current, "libs")); Files.createSymbolicLink(Paths.get(tempDeployPath, "conf"), Paths.get(current, "conf")); Files.createSymbolicLink(Paths.get(tempDeployPath, "sqlite4java-392"), Paths.get(current, "sqlite4java-392")); Files.createSymbolicLink(Paths.get(tempDeployPath, MyriaConstants.DEPLOYMENT_CONF_FILE), Paths.get(current, configFile)); return tempDeploy; }

Target:
public static File createTempDeployment(final String configFile) throws IOException { final String current = System.getProperty("user.dir"); File tempDeploy = Files.createTempDirectory("tempdeploy").toFile(); String tempDeployPath = tempDeploy.getAbsolutePath(); LOGGER.debug("generating temp deployment at " + tempDeployPath); Files.createSymbolicLink(Paths.get(tempDeployPath, "libs"), Paths.get(current, "libs")); Files.createSymbolicLink(Paths.get(tempDeployPath, "conf"), Paths.get(current, "conf")); Files.createSymbolicLink(Paths.get(tempDeployPath, "sqlite4java-392"), Paths.get(current, "sqlite4java-392")); Files.createSymbolicLink(Paths.get(tempDeployPath, MyriaConstants.DEPLOYMENT_CONF_FILE), Paths.get(current, configFile)); return tempDeploy; }
Source:
if (executor != null) { executor.scheduleAtFixedRate(new Runnable() { @Override public void run() { cache.trim(); } }, DEFAULT_CACHE_TRIM_RATE, DEFAULT_CACHE_TRIM_RATE, TimeUnit.MILLISECONDS); }

Target:
if (executor != null) { executor.scheduleAtFixedRate(trimTask, DEFAULT_CACHE_TRIM_INTERVAL_MILLIS, DEFAULT_CACHE_TRIM_INTERVAL_MILLIS, TimeUnit.MILLISECONDS); }
Source:
public int compareTo(Prerelease that) { int size = Math.min(this.identifiers.size(), that.identifiers.size()); for (int i = 0; i < size; i += 1) { int cmp = identifiers.get(i).compareTo(that.identifiers.get(i)); if (cmp != 0) { return cmp; } } return this.identifiers.size() - that.identifiers.size(); }

Target:
public int compareTo(Prerelease that) { int size = Math.min(this.identifiers.size(), that.identifiers.size()); for (int i = 0; i < size; i += 1) { int cmp = identifiers.get(i).compareTo(that.identifiers.get(i)); if (cmp != 0) { return cmp; } } return compareIntegers(this.identifiers.size(), that.identifiers.size()); }
Source:
void clean() throws IOException { Project rootProject = getProject(); Path rootProjectPath = rootProject.getProjectDir().toPath(); File okbuckState = rootProject.file(OkBuckGradlePlugin.OKBUCK_STATE); Set<String> lastProjectPaths; if (okbuckState.exists()) { lastProjectPaths = Files.lines(okbuckState.toPath()) .map(String::trim) .filter(s -> s != null && s.length() > 0) .collect(Collectors.toSet()); } else { lastProjectPaths = new HashSet<>(); okbuckState.getParentFile().mkdirs(); okbuckState.createNewFile(); } Set<String> currentProjectPaths = projects.stream() .map(project -> rootProjectPath .relativize(project.getProjectDir().toPath()).toString() ) .collect(Collectors.toSet()); Sets.difference(lastProjectPaths, currentProjectPaths) .stream() .map(p -> rootProjectPath.resolve(p).resolve("BUCK")) .collect(Collectors.toSet()) .forEach(OkBuckCleanTask::deleteQuietly); Files.write( okbuckState.toPath(), currentProjectPaths .stream() .sorted() .collect(Collectors.toList()) ); }

Target:
void clean() throws IOException { Project rootProject = getProject(); Path rootProjectPath = rootProject.getProjectDir().toPath(); File okbuckState = rootProject.file(OkBuckGradlePlugin.OKBUCK_STATE); Set<String> lastProjectPaths; if (okbuckState.exists()) { lastProjectPaths = Files.lines(okbuckState.toPath()) .map(String::trim) .filter(s -> s != null && s.length() > 0) .collect(Collectors.toSet()); } else { lastProjectPaths = new HashSet<>(); okbuckState.getParentFile().mkdirs(); okbuckState.createNewFile(); } Set<String> currentProjectPaths = projects.stream() .map(project -> rootProjectPath .relativize(project.getProjectDir().toPath()).toString() ) .collect(Collectors.toSet()); Sets.difference(lastProjectPaths, currentProjectPaths) .stream() .map(p -> rootProjectPath.resolve(p).resolve(OkBuckGradlePlugin.BUCK)) .forEach(OkBuckCleanTask::deleteQuietly); Files.write( okbuckState.toPath(), currentProjectPaths .stream() .sorted() .collect(Collectors.toList()) ); }
Source:
public User(@NonNull String username, @NonNull String password) { this(username, password, new HashMap<String, Integer>(), null); }

Target:
public User(@NonNull String username, @NonNull String password) { this(username, password, null, null); }
Source:
private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = asyncTaskDao.getAll(); Set<Guid> asyncTaskManagerManagedCommands = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getCommandId()).collect(Collectors.toSet())); ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled()) .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); getCommands(false).stream() .filter(x -> x.isCallbackEnabled()) .filter(x -> !x.isCallbackNotified()) .filter(x -> x.getCommandStatus().isDuringExecution()) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> { CommandBase<?> cmd = retrieveCommand(x.getId()); if (cmd != null) { cmd.reacquireLocks(); } }); }

Target:
private void handleUnmanagedCommands() { List<AsyncTask> asyncTasks = asyncTaskDao.getAll(); Set<Guid> asyncTaskManagerManagedCommands = asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getRootCommandId()).collect(Collectors.toSet()); asyncTaskManagerManagedCommands.addAll(asyncTasks.stream().filter(x -> x.getVdsmTaskId() != null) .map(x -> x.getCommandId()).collect(Collectors.toSet())); ENDED_WITH_FAILURE. getCommands(false).stream() .filter(x -> !x.isCallbackEnabled()) .filter(x -> x.getCommandStatus() == CommandStatus.ACTIVE) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .forEach(x -> commandsCache.updateCommandStatus(x.getId(), CommandStatus.ENDED_WITH_FAILURE)); getCommands(false).stream() .filter(x -> x.isCallbackEnabled()) .filter(x -> !x.isCallbackNotified()) .filter(x -> x.getCommandStatus().isDuringExecution()) .filter(x -> !asyncTaskManagerManagedCommands.contains(x.getId())) .map(x -> retrieveCommand(x.getId())) .filter(Objects::nonNull) .forEach(CommandBase::reacquireLocks); }
Source:
public int hashCode() { return Objects.hash(super.hashCode()); }

Target:
public int hashCode() { return Objects.hash(id, name, reference); }
Source:
private void startFailed(StartException e, ServiceName serviceName, StartContextImpl context) { ServiceLogger.FAIL.startFailed(e, serviceName); synchronized (context.lock) { final ContextState oldState = context.state; if (oldState != ContextState.SYNC && oldState != ContextState.ASYNC) { ServiceLogger.FAIL.exceptionAfterComplete(e, serviceName); return; } context.state = ContextState.FAILED; } synchronized (ServiceControllerImpl.this) { startException = e; failCount++; } final ArrayList<Runnable> tasks; synchronized (ServiceControllerImpl.this) { final boolean leavingRestState = isStableRestState(); decrementAsyncTasks(); transition(tasks = new ArrayList<Runnable>()); addAsyncTasks(tasks.size()); updateStabilityState(leavingRestState); } doExecute(tasks); }

Target:
private boolean startFailed(StartException e, ServiceName serviceName, StartContextImpl context) { ServiceLogger.FAIL.startFailed(e, serviceName); synchronized (context.lock) { final ContextState oldState = context.state; if (oldState != ContextState.SYNC && oldState != ContextState.ASYNC) { ServiceLogger.FAIL.exceptionAfterComplete(e, serviceName); return false; } context.state = ContextState.FAILED; } synchronized (ServiceControllerImpl.this) { startException = e; failCount++; } return true; }
Source:
public void reset() { if (pidSource == PIDSourceType.kDisplacement) { truePosition = encoder.getPosition(); } else { trueVelocity = encoder.getVelocity(); } }

Target:
public void reset() { truePosition = encoder.getPosition(); trueVelocity = encoder.getVelocity(); }
Source:
public FileSystemStorage(ZeppelinConfiguration zConf, String path) throws IOException { this.zConf = zConf; this.hadoopConf = new Configuration(); this.hadoopConf.set("fs.file.impl", RawLocalFileSystem.class.getName()); this.isSecurityEnabled = UserGroupInformation.isSecurityEnabled(); if (isSecurityEnabled) { String keytab = zConf.getString( ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_KERBEROS_KEYTAB); String principal = zConf.getString( ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_KERBEROS_PRINCIPAL); if (StringUtils.isBlank(keytab) || StringUtils.isBlank(principal)) { throw new IOException("keytab and principal can not be empty, keytab: " + keytab + ", principal: " + principal); } UserGroupInformation.loginUserFromKeytab(principal, keytab); this.ugi = UserGroupInformation.getLoginUser(); } try { this.fs = FileSystem.get(new URI(path), this.hadoopConf); } catch (URISyntaxException e) { throw new IOException(e); } }

Target:
public FileSystemStorage(ZeppelinConfiguration zConf, String path) throws IOException { this.zConf = zConf; this.hadoopConf = new Configuration(); this.hadoopConf.set("fs.file.impl", RawLocalFileSystem.class.getName()); this.isSecurityEnabled = UserGroupInformation.isSecurityEnabled(); if (isSecurityEnabled) { String keytab = zConf.getString( ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_KERBEROS_KEYTAB); String principal = zConf.getString( ZeppelinConfiguration.ConfVars.ZEPPELIN_SERVER_KERBEROS_PRINCIPAL); if (StringUtils.isBlank(keytab) || StringUtils.isBlank(principal)) { throw new IOException("keytab and principal can not be empty, keytab: " + keytab + ", principal: " + principal); } UserGroupInformation.loginUserFromKeytab(principal, keytab); } try { this.fs = FileSystem.get(new URI(path), this.hadoopConf); } catch (URISyntaxException e) { throw new IOException(e); } }
Source:
public Folder findFolderByPath(final String path, final Host host, final User user, final boolean respectFrontEndPermissions) throws DotStateException, DotDataException, DotSecurityException { final Folder folder = folderFactory.findFolderByPath(path, host); if (folder != null && InodeUtils.isSet(folder.getInode()) && !permissionAPI.doesUserHavePermission(folder, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { if(FolderAPI.SYSTEM_FOLDER.equals(folder.getInode())) { if(!Host.SYSTEM_HOST.equals(host.getIdentifier())){ if(!permissionAPI.doesUserHavePermission(host, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { throw new DotSecurityException("User " + user.getUserId() != null?user.getUserId():"" + " does not have permission to read folder " + folder.getPath()); } } } } return folder; }

Target:
public Folder findFolderByPath(final String path, final Host host, final User user, final boolean respectFrontEndPermissions) throws DotStateException, DotDataException, DotSecurityException { final Folder folder = folderFactory.findFolderByPath(path, host); if (folder != null && InodeUtils.isSet(folder.getInode()) && !doesUserHavePermissions(folder, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { if(FolderAPI.SYSTEM_FOLDER.equals(folder.getInode()) && !Host.SYSTEM_HOST.equals(host.getIdentifier()) && !permissionAPI.doesUserHavePermission(host, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { throw new DotSecurityException("User " + user.getUserId() != null?user.getUserId():"" + " does not have permission to read folder " + folder.getPath()); } } return folder; }