auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPushNotificationScheduler() { try { log.debug("Attempting to execute push notification task scheduler"); Mockito.doReturn(new TestNotificationStrategy()).when(this.deviceMgtProviderService) .getNotificationStrategyByDeviceType(Mockito.anyString()); Mockito.doReturn(new org.wso2.carbon.device.mgt.common.operation.mgt.Operation()) .when(this.deviceMgtProviderService).getOperation(Mockito.anyString(), Mockito.anyInt()); this.pushNotificationSchedulerTask.run(); OperationManagementDAOFactory.openConnection(); Map<Integer, List<OperationMapping>> operationMappingsTenantMap = operationDAO .getOperationMappingsByStatus(Operation.Status.PENDING, Operation.PushNotificationStatus.SCHEDULED, DeviceConfigurationManager.getInstance().getDeviceManagementConfig() .getPushNotificationConfiguration().getSchedulerBatchSize()); Assert.assertEquals(operationMappingsTenantMap.size(), 0); log.debug("Push notification task execution complete."); } catch (DeviceManagementException e) { Assert.fail("Unexpected exception occurred when getting the push notification strategy.", e); } catch (SQLException | OperationManagementDAOException e) { Assert.fail("Unexpected exception occurred retrieving the operation mapping list.", e); } catch (OperationManagementException e) { Assert.fail("Unexpected exception occurred when retrieving an operation.", e); } finally { OperationManagementDAOFactory.closeConnection(); } }

Target:
public void testPushNotificationScheduler() throws DeviceManagementException, OperationManagementException, SQLException, OperationManagementDAOException { try { log.info("Attempting to execute push notification task scheduler"); Mockito.doReturn(new TestNotificationStrategy()).when(this.deviceMgtProviderService) .getNotificationStrategyByDeviceType(Mockito.anyString()); Mockito.doReturn(new org.wso2.carbon.device.mgt.common.operation.mgt.Operation()) .when(this.deviceMgtProviderService).getOperation(Mockito.anyString(), Mockito.anyInt()); this.pushNotificationSchedulerTask.run(); OperationManagementDAOFactory.openConnection(); Map<Integer, List<OperationMapping>> operationMappingsTenantMap = operationDAO .getOperationMappingsByStatus(Operation.Status.PENDING, Operation.PushNotificationStatus.SCHEDULED, DeviceConfigurationManager.getInstance().getDeviceManagementConfig() .getPushNotificationConfiguration().getSchedulerBatchSize()); Assert.assertEquals(operationMappingsTenantMap.size(), 0); log.info("Push notification task execution complete."); } finally { OperationManagementDAOFactory.closeConnection(); } }
Source:
public FormIndex deleteRepeat(FormIndex index) { Vector indexes = new Vector(); Vector multiplicities = new Vector(); Vector elements = new Vector(); collapseIndex(index, indexes, multiplicities, elements); for (int i = elements.size() - 1; i >= 0; i--) { IFormElement e = (IFormElement)elements.elementAt(i); if (e instanceof GroupDef && ((GroupDef)e).getRepeat()) { break; } else { indexes.removeElementAt(i); multiplicities.removeElementAt(i); elements.removeElementAt(i); } } FormIndex newIndex = buildIndex(indexes, multiplicities, elements); TreeReference deleteRef = getChildInstanceRef(newIndex); TreeElement deleteElement = mainInstance.resolveReference(deleteRef); TreeReference parentRef = deleteRef.getParentRef(); TreeElement parentElement = mainInstance.resolveReference(parentRef); int childMult = deleteElement.getMult(); parentElement.removeChild(deleteElement); for (int i = 0; i < parentElement.getNumChildren(); i++) { TreeElement child = parentElement.getChildAt(i); if (child.doFieldsMatch(deleteElement) && child.getMult() > childMult) { child.setMult(child.getMult() - 1); } } this.getMainInstance().cleanCache(); triggerTriggerables(deleteRef); return newIndex; }

Target:
public FormIndex deleteRepeat(FormIndex index) { Vector indexes = new Vector(); Vector multiplicities = new Vector(); Vector elements = new Vector(); collapseIndex(index, indexes, multiplicities, elements); for (int i = elements.size() - 1; i >= 0; i--) { IFormElement e = (IFormElement)elements.elementAt(i); if (e instanceof GroupDef && ((GroupDef)e).getRepeat()) { break; } else { indexes.removeElementAt(i); multiplicities.removeElementAt(i); elements.removeElementAt(i); } } FormIndex newIndex = buildIndex(indexes, multiplicities, elements); TreeReference deleteRef = getChildInstanceRef(newIndex); TreeElement deleteElement = mainInstance.resolveReference(deleteRef); TreeReference parentRef = deleteRef.getParentRef(); TreeElement parentElement = mainInstance.resolveReference(parentRef); parentElement.removeChild(deleteElement); reduceTreeSiblingMultiplicities(parentElement, deleteElement); this.getMainInstance().cleanCache(); triggerTriggerables(deleteRef); return newIndex; }
Source:
public Future<?> submit(Runnable task) { if (task == null) { throw new NullPointerException(); } PicassoFutureTask ftask = new PicassoFutureTask((BitmapHunter) task); execute(ftask); return ftask; }

Target:
public Future<?> submit(Runnable task) { PicassoFutureTask ftask = new PicassoFutureTask((BitmapHunter) task); execute(ftask); return ftask; }
Source:
private Optional<Ref> getBestMatch(List<Ref> tags) { if (tags == null || tags.size() == 0) { return Optional.empty(); } else if (matchers.size() == 0) { Collections.sort(tags, TAG_TIE_BREAKER); return Optional.of(tags.get(0)); } else { Stream<Ref> matchingTags = Stream.empty(); for (IMatcher matcher : matchers) { Stream<Ref> m = tags.stream().filter( tag -> matcher.matches(tag.getName(), false, false)); matchingTags = Stream.of(matchingTags, m).flatMap(i -> i); } Optional<Ref> match = matchingTags.sorted(TAG_TIE_BREAKER) .findFirst(); if (match.isPresent()) { return match; } return Optional.empty(); } }

Target:
private Optional<Ref> getBestMatch(List<Ref> tags) { if (tags == null || tags.size() == 0) { return Optional.empty(); } else if (matchers.size() == 0) { Collections.sort(tags, TAG_TIE_BREAKER); return Optional.of(tags.get(0)); } else { Stream<Ref> matchingTags = Stream.empty(); for (IMatcher matcher : matchers) { Stream<Ref> m = tags.stream().filter( tag -> matcher.matches(tag.getName(), false, false)); matchingTags = Stream.of(matchingTags, m).flatMap(i -> i); } return matchingTags.sorted(TAG_TIE_BREAKER).findFirst(); } }
Source:
private boolean isCurrentNetworkSufficient(WifiInfo wifiInfo, boolean is5GHzAvailable) { WifiConfiguration network = mWifiConfigManager.getConfiguredNetwork(wifiInfo.getNetworkId()); if (network == null) { localLog("No current connected network."); return false; } else { localLog("Current connected network: " + network.SSID + " , ID: " + network.networkId); } if (network.ephemeral) { localLog("Current network is an ephemeral one."); return false; } if (WifiConfigurationUtil.isConfigForOpenNetwork(network)) { localLog("Current network is a open one."); return false; } int currentRssi = wifiInfo.getRssi(); if (wifiInfo.is24GHz()) { if (is5GHzAvailable) { localLog("Current network is 2.4GHz. No 5GHz networks available."); return false; } if (currentRssi < mThresholdQualifiedRssi24) { localLog("Current network band=2.4GHz, RSSI[" + currentRssi + "]-acceptable but not qualified."); return false; } } else if (wifiInfo.is5GHz()) { if (currentRssi < mThresholdQualifiedRssi5) { localLog("Current network band=5GHz, RSSI[" + currentRssi + "]-acceptable but not qualified."); return false; } } else { Log.wtf(TAG, "We're on a wifi network that's neither 2.4 or 5GHz... aliens!"); } return true; }

Target:
private boolean isCurrentNetworkSufficient(WifiInfo wifiInfo, boolean is5GHzAvailable) { WifiConfiguration network = mWifiConfigManager.getConfiguredNetwork(wifiInfo.getNetworkId()); if (network == null) { localLog("No current connected network."); return false; } else { localLog("Current connected network: " + network.SSID + " , ID: " + network.networkId); } if (network.ephemeral) { localLog("Current network is an ephemeral one."); return false; } if (WifiConfigurationUtil.isConfigForOpenNetwork(network)) { localLog("Current network is a open one."); return false; } int currentRssi = wifiInfo.getRssi(); if (wifiInfo.is24GHz()) { if (is5GHzAvailable) { localLog("Current network is 2.4GHz. 5GHz networks available."); return false; } if (currentRssi < mThresholdQualifiedRssi24) { localLog("Current network band=2.4GHz, RSSI[" + currentRssi + "]-acceptable but not qualified."); return false; } } else if (wifiInfo.is5GHz()) { if (currentRssi < mThresholdQualifiedRssi5) { localLog("Current network band=5GHz, RSSI[" + currentRssi + "]-acceptable but not qualified."); return false; } } else { Log.e(TAG, "We're on a wifi network that's neither 2.4 or 5GHz... aliens!"); } return true; }
Source:
public FeedbackResponseCommentRow(FeedbackResponseCommentAttributes frc, String giverDisplay, Map<String, String> instructorEmailNameTable) { this.instructorEmailNameTable = instructorEmailNameTable; this.commentId = frc.getId(); this.giverDisplay = giverDisplay; this.createdAt = TimeHelper.formatDateTimeForComments(frc.createdAt); this.commentText = frc.commentText.getValue(); setCommentGiverName(giverDisplay); setCommentLastEditorName(frc.lastEditorEmail); this.questionId = frc.feedbackQuestionId; this.editedAt = setEditedAtText(frc.createdAt, frc.lastEditedAt); }

Target:
public FeedbackResponseCommentRow(FeedbackResponseCommentAttributes frc, String giverDisplay, Map<String, String> instructorEmailNameTable) { this.instructorEmailNameTable = instructorEmailNameTable; this.commentId = frc.getId(); this.giverDisplay = giverDisplay; this.createdAt = TimeHelper.formatDateTimeForComments(frc.createdAt); this.commentText = frc.commentText.getValue(); this.commentGiverName = getCommentGiverNameFromEmail(giverDisplay); this.editedAt = getEditedAtText(frc.lastEditorEmail, frc.createdAt, frc.lastEditedAt); }
Source:
public Value valueOf(@Nullable String string) { if(string == null) { return nullValue(); } List<Coordinate> line; Coordinate coordinate; try { JSONArray array = new JSONArray(string.trim()); line = new ArrayList<Coordinate>(array.length()); for(int i = 0; i < array.length(); i++) { coordinate = Coordinate.valueOf(array.getString(i)); line.add(coordinate); } } catch(JSONException e) { throw new MagmaRuntimeException("Invalid Polygon format", e); } if(line.isEmpty()) { throw new MagmaRuntimeException("The polygon can't be empty"); } return Factory.newValue(this, (Serializable) line); }

Target:
public Value valueOf(@Nullable String string) { if(string == null) { return nullValue(); } try { JSONArray array = new JSONArray(string.trim()); return valueOf(array); } catch(JSONException e) { throw new MagmaRuntimeException("Invalid Line format", e); } }
Source:
public void setup() { mockRunLoop = mock(RunLoop.class); mockOnSignal = mock(Runnable.class); container = StreamProcessorTestUtils.getDummyContainer(mockRunLoop, Mockito.mock(StreamTask.class)); processorLifecycleListener = mock(ProcessorLifecycleListener.class); clusterBasedProcessorLifecycleListener = spy(new ClusterBasedProcessorLifecycleListener(new MapConfig(ImmutableMap.of(TaskConfig.TASK_SHUTDOWN_MS, "1")), processorLifecycleListener, mockOnSignal)); container.setContainerListener(clusterBasedProcessorLifecycleListener); doNothing().when(clusterBasedProcessorLifecycleListener).addJVMShutdownHook(); doNothing().when(clusterBasedProcessorLifecycleListener).removeJVMShutdownHook(); }

Target:
public void setup() { mockShutdownHookCallback = mock(Runnable.class); processorLifecycleListener = mock(ProcessorLifecycleListener.class); clusterBasedProcessorLifecycleListener = spy(new ClusterBasedProcessorLifecycleListener(new MapConfig(ImmutableMap.of(TaskConfig.TASK_SHUTDOWN_MS, "1")), processorLifecycleListener, mockShutdownHookCallback)); doNothing().when(clusterBasedProcessorLifecycleListener).addJVMShutdownHook(any(Thread.class)); doNothing().when(clusterBasedProcessorLifecycleListener).removeJVMShutdownHook(any(Thread.class)); }
Source:
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { ErlangFunctionCallExpression callExpr = PsiTreeUtil.getParentOfType( descriptor.getPsiElement(), ErlangFunctionCallExpression.class); if (callExpr == null) return; callExpr.replace(ErlangElementFactory.createFunctionWithModuleCallExpression(project, myModuleName, callExpr.getText())); }

Target:
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { ErlangFunctionCallExpression callExpr = PsiTreeUtil.getParentOfType( descriptor.getPsiElement(), ErlangFunctionCallExpression.class); if (callExpr != null) { callExpr.replace(ErlangElementFactory.createFunctionWithModuleCallExpression(project, myModuleName, callExpr.getText())); } }
Source:
public PatchSetInserter setValidatePolicy(ValidatePolicy validate) { this.validatePolicy = validate; return this; }

Target:
public PatchSetInserter setValidatePolicy(ValidatePolicy validate) { this.validatePolicy = checkNotNull(validate); return this; }
Source:
public void use_statements() throws Exception { SymbolTableImpl symbolTable = symbolTableFor("<?php \n" + "namespace N1 { class A }\n" + "use N1\\A as Alias;\n" + "$a = new Alias();"); assertSymbolUsages(symbolTable, "\\N1\\A", 4); }

Target:
public void use_statements() throws Exception { SymbolTableImpl symbolTable = symbolTableFor("<?php \n" + "namespace N1 { class A }\n" + "use N1\\A as Alias;\n" + "$a = new Alias();"); assertSymbolUsages(symbolTable, "\\n1\\a", 4); symbolTable = symbolTableFor("<?php \n" + "namespace N1 { class A }\n" + "use N1\\A;\n" + "$a = new A();"); assertSymbolUsages(symbolTable, "\\n1\\a", 4); }
Source:
private Interpreter getInterpreter(String noteId, InterpreterSetting setting, String name, String userName) { Preconditions.checkNotNull(noteId, "noteId should be not null"); Preconditions.checkNotNull(setting, "setting should be not null"); Preconditions.checkNotNull(name, "name should be not null"); String className; if (null != (className = getInterpreterClassFromInterpreterSetting(setting, name))) { List<Interpreter> interpreterGroup = createOrGetInterpreterList(noteId + userName, setting); for (Interpreter interpreter : interpreterGroup) { if (className.equals(interpreter.getClassName())) { return interpreter; } } } return null; }

Target:
private Interpreter getInterpreter(String noteId, InterpreterSetting setting, String name, String userName) { Preconditions.checkNotNull(noteId, "noteId should be not null"); Preconditions.checkNotNull(setting, "setting should be not null"); Preconditions.checkNotNull(name, "name should be not null"); String className; if (null != (className = getInterpreterClassFromInterpreterSetting(setting, name))) { List<Interpreter> interpreterGroup = createOrGetInterpreterList(noteId, setting, userName); for (Interpreter interpreter : interpreterGroup) { if (className.equals(interpreter.getClassName())) { return interpreter; } } } return null; }
Source:
public Object[][] validValues() { return new Object[][] { {"2048", 2048L}, {"1gb", 1073741824L}, {"2g", 2147483648L}, {"1073741824", 1073741824L}, {"8m", 8388608L}, {"200mb", 209715200L}, {"5k", 5120L}, {"10kb", 10240L}, }; }

Target:
public Object[][] validValues() { return new Object[][] { {"2048", 2048L}, {"1gb", 1 * G}, {"2g", 2 * G}, {"1073741824", 1 * G}, {"8m", 8 * M}, {"200mb", 200 * M}, {"5k", 5 * K}, {"10kb", 10 * K}, }; }
Source:
private void addToLog(final String logItem) { argumentLog.append(" | " + logItem) ; }

Target:
private void addToLog(final String logItem) { argumentLog.append(" | " ).append(logItem) ; }
Source:
public <E extends SQLEntity> void computeBatches(Class<E> type, @Nullable Consumer<SmartQuery<E>> queryExtender, int batchSize, Consumer<JSONObject> batchConsumer) { TaskContext taskContext = TaskContext.get(); ValueHolder<Long> lastLimit = ValueHolder.of(0L); while (taskContext.isActive()) { ValueHolder<Long> nextLimit = ValueHolder.of(lastLimit.get()); SmartQuery<E> query = oma.selectFromSecondary(type) .fields(SQLEntity.ID) .where(OMA.FILTERS.gt(SQLEntity.ID, lastLimit.get())); if (queryExtender != null) { queryExtender.accept(query); } query.orderAsc(SQLEntity.ID).limit(batchSize).iterateAll(e -> { nextLimit.set(e.getId()); }); JSONObject batch = new JSONObject(); batch.put(START_ID, lastLimit.get()); batch.put(END_ID, nextLimit.get()); batchConsumer.accept(batch); if (lastLimit.get().equals(nextLimit.get())) { return; } lastLimit.set(nextLimit.get()); } }

Target:
public <E extends SQLEntity> void computeBatches(Class<E> type, @Nullable Consumer<SmartQuery<E>> queryExtender, int batchSize, Consumer<JSONObject> batchConsumer) { TaskContext taskContext = TaskContext.get(); ValueHolder<Long> lastLimit = ValueHolder.of(0L); while (taskContext.isActive()) { ValueHolder<Long> nextLimit = ValueHolder.of(lastLimit.get()); SmartQuery<E> query = oma.selectFromSecondary(type) .fields(SQLEntity.ID) .where(OMA.FILTERS.gt(SQLEntity.ID, lastLimit.get())); if (queryExtender != null) { queryExtender.accept(query); } query.orderAsc(SQLEntity.ID).limit(batchSize).iterateAll(e -> { nextLimit.set(e.getId()); }); JSONObject batch = new JSONObject(); batch.put(TYPE, Mixing.getNameForType(type)); batch.put(START_ID, lastLimit.get()); batch.put(END_ID, nextLimit.get()); batchConsumer.accept(batch); if (lastLimit.get().equals(nextLimit.get())) { return; } lastLimit.set(nextLimit.get()); } }
Source:
public void testGetEventType() { Set<ITmfEventType> result = fixture.getEventTypes(); assertNotNull(result); }

Target:
public void testGetEventType() { Class<?> result = fixture.getEventType(); assertNotNull(result); assertEquals(CtfTmfEvent.class, result); }
Source:
public void copyDirectoryToDirectoryThrowsIllegalExceptionWithCorrectMessageWhenSrcDirIsNotDirectory() throws IOException { File srcDir = temporaryFolder.newFile("notadirectory"); File destDir = temporaryFolder.newFolder("destinationDirectory"); String expectedMessage = String.format("Source '%s' is not a directory", srcDir); assertExceptionTypeAndMessage(srcDir, destDir, IllegalArgumentException.class, expectedMessage); }

Target:
public void copyDirectoryToDirectoryThrowsIllegalExceptionWithCorrectMessageWhenSrcDirIsNotDirectory() throws IOException { final File srcDir = temporaryFolder.newFile("notadirectory"); final File destDir = temporaryFolder.newFolder("destinationDirectory"); final String expectedMessage = String.format("Source '%s' is not a directory", srcDir); assertExceptionTypeAndMessage(srcDir, destDir, IllegalArgumentException.class, expectedMessage); }
Source:
public List<String> getMoreStable(String branch) { int i = order.indexOf(fullName(branch)); if (0 <= i) { return order.subList(i + 1, order.size()); } else { return Collections.emptyList(); } }

Target:
public List<String> getMoreStable(String branch) { int i = order.indexOf(fullName(branch)); if (0 <= i) { return order.subList(i + 1, order.size()); } else { return ImmutableList.of(); } }
Source:
public void removeUserTuneListener(UserTuneListener listener) { synchronized (listener) { userTuneListeners.remove(listener); } }

Target:
public void removeUserTuneListener(UserTuneListener listener) { synchronized (userTuneListeners) { userTuneListeners.remove(listener); } }
Source:
private static void runPrepareSandboxTask() { Path exercisePath = getExercisePathFromArgs(); Path submissionPath = getSubmissionPathFromArgs(); Path outputPath = getOutputPathFromArgs(); Path tmcRunPath = getTmcRunPathFromArgs(); Path tmcLangsPath = getTmcLangsPathFromArgs(); try { executor.prepareSandboxTask(exercisePath, submissionPath, outputPath, tmcRunPath, tmcLangsPath); } catch (NoLanguagePluginFoundException ex) { logger.error( "No suitable language plugin for project at {}", exercisePath, ex); printErrAndExit( "ERROR: Could not find suitable language plugin for the given " + "exercise path."); } catch (IOException e) { logger.error( "An error occurred while preparing task.", e); printErrAndExit( "ERROR: Could not prepare task." ); } }

Target:
private static void runPrepareSandboxTask() { Path exercisePath = getExercisePathFromArgs(); Path submissionPath = getSubmissionPathFromArgs(); Path outputPath = getOutputPathFromArgs(); Path tmcRunPath = getTmcRunPathFromArgs(); Path tmcLangsPath = getTmcLangsPathFromArgs(); try { executor.prepareSandboxTask(exercisePath, submissionPath, outputPath, tmcRunPath, tmcLangsPath); } catch (NoLanguagePluginFoundException ex) { logger.error("No suitable language plugin for project at {}", exercisePath, ex); printErrAndExit("ERROR: Could not find suitable language plugin for the given exercise path."); } catch (IOException e) { logger.error("An error occurred while preparing task.", e); printErrAndExit("ERROR: Could not prepare task."); } }
Source:
protected String buildURI() { try { return super.buildURI() + "/_scripts/" + scriptLanguage.pathParameterName + "/" + URLEncoder.encode(scriptName, CHARSET); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }

Target:
protected String buildURI() { String finalUri = super.buildURI() + "/_scripts/" + scriptLanguage.pathParameterName + "/"; try { finalUri += encode(scriptName, CHARSET); } catch (UnsupportedEncodingException e) { log.error("Error occurred while adding parameters to uri.", e); } return finalUri; }
Source:
public void registerIdentityChangeListener(Consumer<Principal> listener) { DirContext dirContext = null; try { dirContext = obtainContext(); registerIdentityChangeListener(dirContext,listener); } catch (Exception cause) { synchronized (this.listenersPendingRegistration) { listenersPendingRegistration.add(listener); } log.ldapRealmDeferRegistration(); if(log.isDebugEnabled()){ log.debug("Listener registration failure: ", cause); } } finally { if (dirContext != null) { closeContext(dirContext); } } }

Target:
public void registerIdentityChangeListener(Consumer<Principal> listener) { synchronized (this.listenersPendingRegistration) { DirContext dirContext = null; try { dirContext = obtainContext(); registerIdentityChangeListener(dirContext, listener); } catch (Exception cause) { listenersPendingRegistration.add(listener); log.ldapRealmDeferRegistration(); if (log.isDebugEnabled()) { log.debug("Listener registration failure: ", cause); } } finally { if (dirContext != null) { closeContext(dirContext); } } } }
Source:
private void createRemoteDirectory(FTPClient ftpClient, String remoteDirPath) throws IOException { ArrayList folderList = new ArrayList<>(Arrays.asList(ftpClient.listDirectories())); ArrayList<String> folderNames = new ArrayList(); for (int i = 0; i < folderList.size(); i++) { folderNames.add(((FTPFile) (folderList.get(i))).getName()); } if (!folderNames.contains(remoteDirPath)) { if (ftpClient.makeDirectory(remoteDirPath)) { getOut().println("CREATED the directory: " + remoteDirPath); } else { throw new IOException("Error: COULD NOT create the directory: " + remoteDirPath); } } else { throw new IOException("Error: COULD NOT create an existing directory: " + remoteDirPath); } }

Target:
private void createRemoteDirectory(FTPClient ftpClient, String remoteDirPath) throws IOException { ArrayList<FTPFile> folderList = new ArrayList(Arrays.asList(ftpClient.listDirectories())); ArrayList<String> folderNames = new ArrayList(); for (int i = 0; i < folderList.size(); i++) { folderNames.add(folderList.get(i).getName()); } if (!folderNames.contains(remoteDirPath)) { if (ftpClient.makeDirectory(remoteDirPath)) { getOut().println("CREATED the directory: " + remoteDirPath); } else { throw new IOException("Error: COULD NOT create the directory: " + remoteDirPath); } } else { throw new IOException("Error: COULD NOT create an existing directory: " + remoteDirPath); } }
Source:
private NumericExprEval(@Nullable Number value) { super(value == null ? NullHandling.defaultDoubleValue() : value); }

Target:
private NumericExprEval(@Nullable Number value) { super(value); }
Source:
protected void setUploadSizeMax(final ServletFileUpload serviceFileUpload, final HttpServletRequest request) { serviceFileUpload.setFileSizeMax(getConsoleProperties(getAPISession(request).getTenantId()).getMaxSize() * 1048576); }

Target:
protected void setUploadSizeMax(final ServletFileUpload serviceFileUpload, final HttpServletRequest request) { serviceFileUpload.setFileSizeMax(getConsoleProperties(getAPISession(request).getTenantId()).getMaxSize() * MEGABYTE); }
Source:
public void groupBy(StructuredRecord record, Emitter<String> emitter) throws Exception { if (record.get(keyField) == null) { if (record.getSchema().getField(keyField) == null) { throw new IllegalArgumentException( String.format("Keyfield '%s' does not exist in input schema %s", keyField, record.getSchema())); } StructuredRecord.Builder droppedRecordBuilder = StructuredRecord.builder(errorRecordSchema); droppedRecordBuilder.set(KEY, recordCounter++); droppedRecordBuilder.set(RECORD, StructuredRecordStringConverter.toJsonString(record)); Table errorTable = batchRuntimeContext.getDataset(conf.getErrorDataset()); errorTable.write(droppedRecordBuilder.build()); return; } if (record.get(nameField) == null && record.getSchema().getField(nameField) == null) { throw new IllegalArgumentException( String.format("Namefield '%s' does not exist in input schema %s", nameField, record.getSchema())); } if (record.get(valueField) == null && record.getSchema().getField(valueField) == null) { throw new IllegalArgumentException( String.format("Valuefield '%s' does not exist in input schema %s", valueField, record.getSchema())); } emitter.emit((String) record.get(keyField)); }

Target:
public void groupBy(StructuredRecord record, Emitter<String> emitter) throws Exception { if (record.get(keyField) == null) { if (record.getSchema().getField(keyField) == null) { throw new IllegalArgumentException( String.format("Keyfield '%s' does not exist in input schema %s", keyField, record.getSchema())); } StructuredRecord.Builder droppedRecordBuilder = StructuredRecord.builder(errorRecordSchema); droppedRecordBuilder.set(TS, System.currentTimeMillis()); droppedRecordBuilder.set(RECORD, StructuredRecordStringConverter.toJsonString(record)); Table errorTable = batchRuntimeContext.getDataset(conf.getErrorDataset()); errorTable.write(droppedRecordBuilder.build()); return; } if (record.get(nameField) == null && record.getSchema().getField(nameField) == null) { throw new IllegalArgumentException( String.format("Namefield '%s' does not exist in input schema %s", nameField, record.getSchema())); } if (record.get(valueField) == null && record.getSchema().getField(valueField) == null) { throw new IllegalArgumentException( String.format("Valuefield '%s' does not exist in input schema %s", valueField, record.getSchema())); } emitter.emit((String) record.get(keyField)); }
Source:
static Throwable getExceptionDetails(ITestContext context, Object instance) { Set<ITestResult> configResults = context.getFailedConfigurations().getAllResults(); if (configResults.isEmpty()) { configResults = context.getSkippedConfigurations().getAllResults(); } for (ITestResult configResult : configResults) { if (sameInstance(configResult, instance)) { return configResult.getThrowable(); } } if (configResults.isEmpty()) { return getConfigFailureException(context); } else { return configResults.iterator().next().getThrowable(); } }

Target:
static Throwable getExceptionDetails(ITestContext context, Object instance) { Set<ITestResult> configResults = context.getFailedConfigurations().getAllResults(); if (configResults.isEmpty()) { configResults = context.getSkippedConfigurations().getAllResults(); } if (configResults.isEmpty()) { return getConfigFailureException(context); } for (ITestResult configResult : configResults) { if (sameInstance(configResult, instance)) { return configResult.getThrowable(); } } return configResults.iterator().next().getThrowable(); }
Source:
public void changeDiscoveryMode(){ prepareBeanXml("all", true); setBeansXmlTags(Arrays.asList("alternatives", "decorators", "interceptors","scan")); }

Target:
public void changeDiscoveryMode(){ prepareBeanXml("all", true); setBeansXmlTags(Arrays.asList("alternatives", "decorators", "interceptors","scan", "trim")); }
Source:
public void applyTransformer(CompoundTransformer transformer) { if (transformer!=null) transformers.add(transformer); }

Target:
public void applyTransformer(CompoundTransformer transformer) { transformers.add(Preconditions.checkNotNull(transformer, "transformer")); }
Source:
public ResponseEntity<Object> syndicate(HttpServletRequest request, @RequestParam(value = "revision", required = false) Integer revisionNumber) throws IOException { ArticleVersionIdentifier versionId = getArticleVersionIdentifier(request, revisionNumber); SyndicationInputView input = readJsonFromRequest(request, SyndicationInputView.class); SyndicationTarget syndicationTarget = getSyndicationTarget(input); String queue = input.getQueue(); if (Strings.isNullOrEmpty(queue)) { queue = "activemq:plos." + syndicationTarget.getLabel().toLowerCase(); } Syndication created = syndicationCrudService.syndicate(versionId, syndicationTarget, queue); return reportOk(created.toString()); }

Target:
public ResponseEntity<Object> syndicate(HttpServletRequest request, @RequestParam(value = "revision", required = false) Integer revisionNumber) throws IOException { ArticleVersionIdentifier versionId = getArticleVersionIdentifier(request, revisionNumber); SyndicationInputView input = readJsonFromRequest(request, SyndicationInputView.class); Syndication created = syndicationCrudService.syndicate(versionId, input.getTargetQueue()); return reportOk(created.toString()); }
Source:
public Shard getShard(String docId) { assertNotEmpty(docId, "docId"); return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards/") .path(docId).build(), Shard.class); }

Target:
public Shard getShard(String docId) { assertNotEmpty(docId, "docId"); return client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards") .path(docId).build(), Shard.class); }
Source:
public Response button() { final String build = RestTester.start( UriBuilder.fromUri("<LINK_0>").path(this.stand) .build() ) .header("Accept", MediaType.APPLICATION_XML_UTF_8.toString()) .get("retrieve stand") .getBody(); final SimpleXml xml = new SimpleXml(build); final String head = String.format( "/page/widgets/widget[@class='com.rultor.widget.BuildHealth']/builds/build[coordinates/rule='%s'][1]", this.rule ); final String code = xml .xpath(String.format("%s/code/text()", head)).get(0); final String duration = xml .xpath(String.format("%s/duration/text()", head)).get(0); final String health = xml .xpath(String.format("%s/health/text()", head)).get(0); final BufferedImage img; try { img = ImageIO .read(this.getClass().getResourceAsStream("/build_health.png")); } catch (IOException ex) { throw new IllegalStateException(ex); } final BufferedImage image = new BufferedImage( img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_ARGB ); final Graphics2D gfx = image.createGraphics(); gfx.drawImage(img, 0, 0, null); gfx.setFont(new Font("Serif", Font.PLAIN, 10)); drawString(gfx, Arrays.asList(code, duration, health)); gfx.dispose(); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { ImageIO.write(image, "png", stream); } catch (IOException ex) { throw new IllegalStateException(ex); } return Response.ok(stream.toByteArray(), MediaType.PNG.toString()) .build(); }

Target:
public Response button() throws Exception { final List<String> health = this.info( this.build.info( this.uriInfo().getBaseUri(), this.stand ) ); return Response.ok(draw(health), MediaType.PNG.toString()).build(); }
Source:
private void setDefaultCategoryIcons(List<CategoryDTO> categoryDTOS) { try { StringBuilder cssBuilder = new StringBuilder(); for (CategoryDTO category : categoryDTOS) { cssBuilder.append("#" + category.getName().toLowerCase() + "Button{\n"); String categoryIcon = category.getIcon(); if (StringUtils.isEmpty(categoryIcon)) { cssBuilder.append("-fx-background-image: url('/org/phoenicis/javafx/views/common/phoenicis.png');\n"); } else { cssBuilder.append("-fx-background-image: url('" + categoryIcon + "');\n"); } cssBuilder.append("}\n"); } String css = cssBuilder.toString(); Path temp = Files.createTempFile("defaultCategoryIcons", ".css").toAbsolutePath(); Files.write(temp, css.getBytes()); String defaultCategoryIconsCss = temp.toUri().toString(); themeManager.setDefaultCategoryIconsCss(defaultCategoryIconsCss); final String shortName = themeManager.getCurrentTheme().getShortName(); final String url = String.format("/org/phoenicis/javafx/themes/%s/main.css", shortName); final URL style = this.getClass().getResource(url); this.view.getTabPane().getScene().getStylesheets().clear(); this.view.getTabPane().getScene().getStylesheets().addAll(defaultCategoryIconsCss, themeManager.getDefaultEngineIconsCss(), style.toExternalForm()); } catch (Exception e) { LOGGER.warn("Could not set default category icons.", e); } }

Target:
private void setDefaultCategoryIcons(List<CategoryDTO> categoryDTOS) { try { StringBuilder cssBuilder = new StringBuilder(); for (CategoryDTO category : categoryDTOS) { cssBuilder.append("#" + category.getName().toLowerCase() + "Button{\n"); String categoryIcon = category.getIcon(); if (StringUtils.isEmpty(categoryIcon)) { cssBuilder.append("-fx-background-image: url('/org/phoenicis/javafx/views/common/phoenicis.png');\n"); } else { cssBuilder.append("-fx-background-image: url('" + categoryIcon + "');\n"); } cssBuilder.append("}\n"); } String css = cssBuilder.toString(); Path temp = Files.createTempFile("defaultCategoryIcons", ".css").toAbsolutePath(); File tempFile = temp.toFile(); tempFile.deleteOnExit(); Files.write(temp, css.getBytes()); String defaultCategoryIconsCss = temp.toUri().toString(); themeManager.setDefaultCategoryIconsCss(defaultCategoryIconsCss); final String shortName = themeManager.getCurrentTheme().getShortName(); final String url = String.format("/org/phoenicis/javafx/themes/%s/main.css", shortName); final URL style = this.getClass().getResource(url); this.view.getTabPane().getScene().getStylesheets().clear(); this.view.getTabPane().getScene().getStylesheets().addAll(defaultCategoryIconsCss, themeManager.getDefaultEngineIconsCss(), style.toExternalForm()); } catch (IOException e) { LOGGER.warn("Could not set default category icons.", e); } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } LogisticRegressionSpamMessageModel that = (LogisticRegressionSpamMessageModel) o; if (!text.equals(that.text)) { return false; } if (!read.equals(that.read)) { return false; } return spamPrediction.equals(that.spamPrediction); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } LogisticRegressionSpamMessageModel that = (LogisticRegressionSpamMessageModel) o; return Objects.equals(text, that.text) && Objects.equals(read, that.read) && Objects.equals(spamPrediction, that.spamPrediction); }
Source:
public void scanCurrentRowStates(Set<ImmutableBytesPtr> rows, Collection<? extends ColumnReference> columns, long ts) throws IOException { Scan s = IndexManagementUtil.newLocalStateScan(Collections.singletonList(columns)); FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE); for (ImmutableBytesPtr row : rows) { filterList.addFilter(new RowFilter(CompareOperator.EQUAL, new BinaryComparator(row.get()))); } s.setFilter(filterList); s.setTimeRange(0, ts); Region region = this.env.getRegion(); try (RegionScanner scanner = region.getScanner(s)) { boolean more; do { List<Cell> kvs = new ArrayList<Cell>(1); more = scanner.next(kvs); if (kvs.isEmpty()) { return; } Result r = Result.create(kvs); Cell cell = kvs.get(0); byte[] rowKey = new byte[cell.getRowLength()]; System.arraycopy(cell.getRowArray(), cell.getRowOffset(), rowKey, 0, cell.getRowLength()); results.put(new ImmutableBytesPtr(rowKey), r); } while (more); } }

Target:
public void scanCurrentRowStates(Set<ImmutableBytesPtr> rows, Collection<? extends ColumnReference> columns, long ts) throws IOException { if (results == null) { results = new ConcurrentHashMap<>(); } Scan s = IndexManagementUtil.newLocalStateScan(Collections.singletonList(columns)); List<MultiRowRangeFilter.RowRange> ranges = new ArrayList<>(); for (ImmutableBytesPtr row : rows) { ranges.add(new MultiRowRangeFilter.RowRange(row.get(), true, row.get(), true)); } s.setFilter(new MultiRowRangeFilter(ranges)); s.setTimeRange(0, ts); Region region = this.env.getRegion(); try (RegionScanner scanner = region.getScanner(s)) { boolean more; do { List<Cell> kvs = new ArrayList<Cell>(1); more = scanner.next(kvs); if (kvs.isEmpty()) { return; } Result r = Result.create(kvs); Cell cell = kvs.get(0); byte[] rowKey = new byte[cell.getRowLength()]; System.arraycopy(cell.getRowArray(), cell.getRowOffset(), rowKey, 0, cell.getRowLength()); results.put(new ImmutableBytesPtr(rowKey), r); } while (more); } }
Source:
public void initialize(ResourceManager rm) { try { Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig()); String modelFile; String lexFile; if (type.equals("ACE")) { File modelDir = ds.getDirectory("org.cogcomp.re", "ACE_GOLD_BI", 1.0, false); modelFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lc"; lexFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lex"; } else { File modelDir = ds.getDirectory("org.cogcomp.re", "SEMEVAL", 1.1, false); modelFile = modelDir.getPath() + File.separator + "SEMEVAL" + File.separator + "SEMEVAL.lc"; lexFile = modelDir.getPath() + File.separator + "SEMEVAL" + File.separator + "SEMEVAL.lex"; } relationClassifier = new relation_classifier(); relationClassifier.readModel(modelFile); relationClassifier.readLexicon(lexFile); constrainedClassifier = new ACERelationConstrainedClassifier(relationClassifier); File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.6, false); GazetteersFactory.init(5, gazetteersResource.getPath() + File.separator + "gazetteers", true); WordNetManager.loadConfigAsClasspathResource(true); wordNet = WordNetManager.getInstance(); gazetteers = GazetteersFactory.get(); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void initialize(ResourceManager rm) { try { Datastore ds = new Datastore(new ResourceConfigurator().getDefaultConfig()); File modelDir = ds.getDirectory("org.cogcomp.re", "ACE_GOLD_BI", 1.0, false); String modelFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lc"; String lexFile = modelDir.getPath() + File.separator + "ACE_GOLD_BI" + File.separator + "ACE_GOLD_BI.lex"; relationClassifier = new relation_classifier(); relationClassifier.readModel(modelFile); relationClassifier.readLexicon(lexFile); constrainedClassifier = new ACERelationConstrainedClassifier(relationClassifier); File gazetteersResource = ds.getDirectory("org.cogcomp.gazetteers", "gazetteers", 1.6, false); GazetteersFactory.init(5, gazetteersResource.getPath() + File.separator + "gazetteers", true); WordNetManager.loadConfigAsClasspathResource(true); wordNet = WordNetManager.getInstance(); gazetteers = GazetteersFactory.get(); } catch (Exception e) { e.printStackTrace(); } }
Source:
public void fillTo(int size) { if (size <= 0) return; if (!pool.getConfiguration().isPrefill()) return; if (!credential.equals(pool.getPrefillCredential())) return; while (!pool.isFull()) { try { if (pool.getRequestSemaphore() .tryAcquire(pool.getConfiguration().getBlockingTimeout(), TimeUnit.MILLISECONDS)) { try { if (pool.isShutdownInProgress()) { return; } if (listeners.size() >= size) { return; } try { ConnectionListener cl = pool.createConnectionListener(credential); boolean added = false; synchronized (listeners) { if (listeners.size() < size) { listeners.add(cl); added = true; } } if (!added) { pool.destroyConnectionListener(cl); return; } } catch (ResourceException re) { return; } } finally { pool.getRequestSemaphore().release(); } } } catch (InterruptedException ignored) { Thread.interrupted(); } } }

Target:
public void fillTo(int size) { if (size <= 0) return; while (!pool.isFull()) { if (pool.isShutdown()) { return; } if (listeners.size() >= size) { return; } try { ConnectionListener cl = pool.createConnectionListener(credential); boolean added = false; if (listeners.size() < size) { listeners.add(cl); added = true; } if (!added) { pool.destroyConnectionListener(cl); return; } } catch (ResourceException re) { return; } } }
Source:
public void testAdd() throws CoreException { TaskReviewsMappingsStore taskReviewsMappingStore = getEmptyTaskReviewStore(); TaskData reviewData1 = addReviewData(review1, descriptionWithTaskUrl1); TaskContainerDelta delta = new TaskContainerDelta(review1, Kind.ADDED); taskReviewsMappingStore.addTaskAssocation(review1, reviewData1); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); when(review1.getAttribute(TaskReviewsMappingsStore.ATTR_ASSOCIATED_TASK)).thenReturn(taskUrl1); assertTrue(taskReviewsMappingStore.getTaskUrl(review1).equals(taskUrl1)); }

Target:
public void testAdd() throws CoreException { TaskReviewsMappingsStore taskReviewsMappingStore = getEmptyTaskReviewStore(); TaskData reviewData1 = addReviewData(review1, descriptionWithTaskUrl1); TaskContainerDelta delta = new TaskContainerDelta(review1, Kind.ADDED); taskReviewsMappingStore.addTaskAssocation(review1, reviewData1); taskReviewsMappingStore.containersChanged(ImmutableSet.of(delta)); assertTrue(taskReviewsMappingStore.getReviewUrls(taskUrl1).contains(reviewUrl1)); assertTrue(taskReviewsMappingStore.getTaskUrl(review1).equals(taskUrl1)); }
Source:
public String getSystemPort() { return (String) getCapability(AndroidMobileCapabilityType.SYSTEM_PORT); }

Target:
public Integer getSystemPort() { return (Integer) getCapability(AndroidMobileCapabilityType.SYSTEM_PORT); }
Source:
public Resolver<Boolean> getRegisterEnabledResolver() { String key = "stormpath.web.register.enabled.resolver"; if (containsKey(key)) { try { return getInstance(key); } catch (ServletException e) { throw new RuntimeException("Couldn't instantiate stormpath.web.register.enabled.resolver", e); } } else { boolean enabled = CFG.getBoolean("stormpath.web.register.enabled"); RegisterEnabledResolver resolver = new RegisterEnabledResolver(enabled, ApplicationResolver.INSTANCE, getRegisterEnabledPredicate()); SINGLETONS.put(key, resolver); return resolver; } }

Target:
public Resolver<Boolean> getRegisterEnabledResolver() { String key = "stormpath.web.register.enabled.resolver"; if (containsKey(key)) { try { return getInstance(key); } catch (ServletException e) { throw new RuntimeException("Couldn't instantiate stormpath.web.register.enabled.resolver", e); } } else { boolean enabled = CFG.getBoolean("stormpath.web.register.enabled"); ApplicationResolver appResolver = getApplicationResolver(); BiPredicate<Boolean,Application> regEnabledPredicate = getRegisterEnabledPredicate(); RegisterEnabledResolver resolver = new RegisterEnabledResolver(enabled, appResolver, regEnabledPredicate); SINGLETONS.put(key, resolver); return resolver; } }
Source:
private void map(final RepositoryMapping m) { final IResource r; final File git; final IResource dotGit; IContainer c = null; m.clear(); r = getProject().findMember(m.getContainerPath()); if (r instanceof IContainer) { c = (IContainer) r; } else if (r != null) { c = (IContainer) r.getAdapter(IContainer.class); } if (c == null) { Activator.logError(CoreText.GitProjectData_mappedResourceGone, new FileNotFoundException(m.getContainerPath().toString())); m.clear(); return; } m.setContainer(c); git = c.getLocation().append(m.getGitDirPath()).toFile(); if (!git.isDirectory() || !new File(git, "config").isFile()) { String path = m.getContainerPath().toString(); Activator.logError(MessageFormat.format( CoreText.GitProjectData_mappedResourceGone, path), new FileNotFoundException(path)); m.clear(); return; } try { m.setRepository(Activator.getDefault().getRepositoryCache() .lookupRepository(git)); } catch (IOException ioe) { Activator.logError(CoreText.GitProjectData_mappedResourceGone, new FileNotFoundException(m.getContainerPath().toString())); m.clear(); return; } m.fireRepositoryChanged(); trace("map " + c + " -> " + m.getRepository()); try { c.setSessionProperty(MAPPING_KEY, m); } catch (CoreException err) { Activator.logError( CoreText.GitProjectData_failedToCacheRepoMapping, err); } dotGit = c.findMember(Constants.DOT_GIT); if (dotGit != null && dotGit.getLocation().toFile().equals(git)) { protect(dotGit); } }

Target:
private void map(final RepositoryMapping m) { final IResource r; final File git; final IResource dotGit; IContainer c = null; m.clear(); r = getProject().findMember(m.getContainerPath()); if (r instanceof IContainer) { c = (IContainer) r; } else if (r != null) { c = (IContainer) r.getAdapter(IContainer.class); } if (c == null) { logGoneMappedResource(m); m.clear(); return; } m.setContainer(c); git = c.getLocation().append(m.getGitDirPath()).toFile(); if (!git.isDirectory() || !new File(git, "config").isFile()) { logGoneMappedResource(m); m.clear(); return; } try { m.setRepository(Activator.getDefault().getRepositoryCache() .lookupRepository(git)); } catch (IOException ioe) { logGoneMappedResource(m); m.clear(); return; } m.fireRepositoryChanged(); trace("map " + c + " -> " + m.getRepository()); try { c.setSessionProperty(MAPPING_KEY, m); } catch (CoreException err) { Activator.logError( CoreText.GitProjectData_failedToCacheRepoMapping, err); } dotGit = c.findMember(Constants.DOT_GIT); if (dotGit != null && dotGit.getLocation().toFile().equals(git)) { protect(dotGit); } }
Source:
public PlanNode visitValues(ValuesNode node, RewriteContext<Void> context) { ValuesNode intermediate = new ValuesNode( planNodeIdAllocationStrategy.getId(node), node.getOutputSymbols(), node.getRows().stream() .map(SymbolMapper.this::map) .collect(toImmutableList())); Set<Symbol> added = new HashSet<>(); return pruneValuesNode(intermediate, planNodeIdAllocationStrategy.getId(intermediate), added::add); }

Target:
public PlanNode visitValues(ValuesNode node, RewriteContext<Void> context) { ValuesNode intermediate = new ValuesNode( node.getId(), node.getOutputSymbols().stream() .map(SymbolMapper.this::map) .collect(toImmutableList()), node.getRows().stream() .map(SymbolMapper.this::map) .collect(toImmutableList())); Set<Symbol> added = new HashSet<>(); return pruneValuesNode(intermediate, planNodeIdGenerationStrategy.getPlanNodeId(node), added::add); }
Source:
public void setUp() { em = new BasicExecutionManager("mycontext"); ec = new BasicExecutionContext(em); ex = Executors.newCachedThreadPool(); data = Collections.synchronizedMap(new LinkedHashMap<Object,Object>()); data.clear(); cancelledWhileSleeping = new Semaphore(0); }

Target:
public void setUp() { em = new BasicExecutionManager("mycontext"); ec = new BasicExecutionContext(em); ex = Executors.newCachedThreadPool(); data = Collections.synchronizedMap(new LinkedHashMap<Object,Object>()); started = new Semaphore(0); waitInTask = new Semaphore(0); cancelledWhileSleeping = new Semaphore(0); }