auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitDeferStatement(@NotNull GoDeferStatement o) { PsiElement parent = o.getParent(); while (!((parent instanceof GoFunctionDeclaration) || parent instanceof GoMethodDeclaration) || parent instanceof GoFile) { if (parent instanceof GoForStatement) { holder.registerProblem(o, "Possible resource leak, \"defer\" is called in a for loop.", ProblemHighlightType.WEAK_WARNING); return; } parent = parent.getParent(); } } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitDeferStatement(@NotNull GoDeferStatement o) { PsiElement parent = PsiTreeUtil .getParentOfType(o, GoForStatement.class, GoFunctionLit.class); if (parent instanceof GoForStatement) { holder.registerProblem(o, "Possible resource leak, \"defer\" is called in a for loop.", ProblemHighlightType.WEAK_WARNING); } } }; }
Source:
private void handleCheckbox(CheckStateChangedEvent event) { UiSchemeInformation schemeInformation = (UiSchemeInformation) event.getElement(); if (operatingSystemRegistration.canOverwriteOtherApplicationsRegistration() == false && event.getChecked() && schemeIsHandledByOther(schemeInformation.information)) { schemeInformation.checked = false; tableViewer.setChecked(schemeInformation, schemeInformation.checked); messageDialogWrapper.openWarning(getShell(), UriHandlerPreferencePage_Warning_OtherApp, NLS.bind(UriHandlerPreferencePage_Warning_OtherApp_Description, schemeInformation.information.getHandlerInstanceLocation(), schemeInformation.information.getName())); return; } schemeInformation.checked = event.getChecked(); setSchemeDetails(schemeInformation); tableViewer.update(schemeInformation, null); }

Target:
private void handleCheckbox(CheckStateChangedEvent event) { UiSchemeInformation schemeInformation = (UiSchemeInformation) event.getElement(); if (event.getChecked() && schemeIsHandledByOther(schemeInformation.information)) { if (operatingSystemRegistration.canOverwriteOtherApplicationsRegistration()) { boolean answer = messageDialogWrapper.openQuestion(getShell(), UriHandlerPreferencePage_Warning_OtherApp_Confirmation, NLS.bind(UriHandlerPreferencePage_Warning_OtherApp_Confirmation_Description, schemeInformation.information.getHandlerInstanceLocation(), schemeInformation.information.getName())); if (answer == false) { schemeInformation.checked = false; tableViewer.setChecked(schemeInformation, schemeInformation.checked); return; } } else { schemeInformation.checked = false; tableViewer.setChecked(schemeInformation, schemeInformation.checked); messageDialogWrapper.openWarning(getShell(), UriHandlerPreferencePage_Warning_OtherApp, NLS.bind(UriHandlerPreferencePage_Warning_OtherApp_Description, schemeInformation.information.getHandlerInstanceLocation(), schemeInformation.information.getName())); return; } } schemeInformation.checked = event.getChecked(); setSchemeDetails(schemeInformation); tableViewer.update(schemeInformation, null); }
Source:
public void executeAsync() { ReplicaList initialReplicas = targetReplicas.subList(0, targetReplicas.size() - 1); Replicas.checkFull(initialReplicas); if (handler.blockfor < initialReplicas.size()) { makeDataRequests(initialReplicas.subList(0, 2).asEndpoints()); if (initialReplicas.size() > 2) makeDigestRequests(initialReplicas.subList(2, initialReplicas.size()).asEndpoints()); } else { makeDataRequests(initialReplicas.subList(0, 1).asEndpoints()); if (initialReplicas.size() > 1) makeDigestRequests(initialReplicas.subList(1, initialReplicas.size()).asEndpoints()); } }

Target:
public void executeAsync() { ReplicaList initialReplicas = targetReplicas.subList(0, targetReplicas.size() - 1); Replicas.checkFull(initialReplicas); if (handler.blockfor < initialReplicas.size()) { makeDataRequests(initialReplicas.subList(0, 2)); if (initialReplicas.size() > 2) makeDigestRequests(initialReplicas.subList(2, initialReplicas.size())); } else { makeDataRequests(initialReplicas.subList(0, 1)); if (initialReplicas.size() > 1) makeDigestRequests(initialReplicas.subList(1, initialReplicas.size())); } }
Source:
public List<DeribitInstrument> getDeribitActiveInstruments(String currency) throws IOException { DeribitInstrumentsResponse response = null; try { response = deribit.getInstruments(currency); } catch (HttpStatusIOException ex) { DeribitErrorAdapter.adapt(ex); } return response.getResult(); }

Target:
public List<DeribitInstrument> getDeribitActiveInstruments(String currency) throws IOException { return deribit.getInstruments(currency).getResult(); }
Source:
public JobRecordListener(JobPersister persister, boolean failOnCounterFetch) { this.persister = persister; this.failOnCounterFetch = failOnCounterFetch; taskSummaries = Lists.newArrayList(); }

Target:
public JobRecordListener(JobPersister persister, boolean failOnCounterFetch) { this.persister = persister; this.failOnCounterFetch = failOnCounterFetch; this.taskSummaries = Maps.newHashMap(); }
Source:
public void testRowLiteral() { RowExpression rowExpression = getRoundTrip("ROW(1, 1.1)", true); assertTrue(rowExpression instanceof ConstantExpression); Object value = ((ConstantExpression) rowExpression).getValue(); assertTrue(value instanceof SingleRowBlock); SingleRowBlock block = (SingleRowBlock) value; assertEquals(block.getPositionCount(), 2); assertEquals(block.getInt(0), 1); assertEquals(Double.longBitsToDouble(block.getLong(1)), 1.1); }

Target:
public void testRowLiteral() { assertEquals(getRoundTrip("ROW(1, 1.1)", false), specialForm( ROW_CONSTRUCTOR, RowType.anonymous( ImmutableList.of( INTEGER, DOUBLE)), constant(1L, INTEGER), constant(1.1, DOUBLE))); }
Source:
public static PageMode get(final HttpSession ses) { PageMode mode = (ses != null && ses.getAttribute(com.dotmarketing.util.WebKeys.PAGE_MODE_SESSION) != null && ses.getAttribute("tm_date") == null) ? (PageMode) ses.getAttribute(com.dotmarketing.util.WebKeys.PAGE_MODE_SESSION) : ANON; return mode; }

Target:
public static PageMode get(final HttpSession ses) { PageMode mode = (ses != null && ses.getAttribute(com.dotmarketing.util.WebKeys.PAGE_MODE_SESSION) != null && ses.getAttribute("tm_date") == null) ? (PageMode) ses.getAttribute(com.dotmarketing.util.WebKeys.PAGE_MODE_SESSION) : LIVE; return mode; }
Source:
public static List<PathComponent> parseSchemaMapping(String schemaMapping) { List<PathComponent> path = new LinkedList<PathComponent>(); StringTokenizer tok = new StringTokenizer(schemaMapping, delims, true); while (tok.hasMoreTokens()) { String part = tok.nextToken(); if (".".equals(part)) { continue; } else if ("[".equals(part)) { String indexStr = tok.nextToken(); int index = Integer.parseInt(indexStr); if (!"]".equals(tok.nextToken())) { throw new IllegalArgumentException("Illegal array syntax in schema mapping value: " + schemaMapping); } path.add(new PathComponent(PathComponent.PathComponentType.ARRAY, index)); } else if ("(".equals(part)) { String keyStr = tok.nextToken(); if (!")".equals(tok.nextToken())) { throw new IllegalArgumentException("Illegal map syntax in schema mapping value: " + schemaMapping); } path.add(new PathComponent(PathComponent.PathComponentType.MAP, new String(keyStr))); } else { path.add(new PathComponent(PathComponent.PathComponentType.FIELD, part)); } } return path; }

Target:
public static List<PathComponent> parseSchemaMapping(String schemaMapping) { List<PathComponent> path = new LinkedList<PathComponent>(); StringTokenizer tok = new StringTokenizer(schemaMapping, delims, true); while (tok.hasMoreTokens()) { String part = tok.nextToken(); if (".".equals(part)) { continue; } else if ("[".equals(part)) { String indexStr = tok.nextToken(); int index = Integer.parseInt(indexStr); if (!"]".equals(tok.nextToken())) { throw new IllegalArgumentException("Illegal array syntax in schema mapping value: " + schemaMapping); } path.add(new PathComponent(PathComponent.PathComponentType.ARRAY, index)); } else if ("(".equals(part)) { String keyStr = tok.nextToken(); if (!")".equals(tok.nextToken())) { throw new IllegalArgumentException("Illegal map syntax in schema mapping value: " + schemaMapping); } path.add(new PathComponent(PathComponent.PathComponentType.MAP, keyStr)); } else { path.add(new PathComponent(PathComponent.PathComponentType.FIELD, part)); } } return path; }
Source:
protected Object doWork() { final boolean doTumorPulldown; if (tumorHetOutputFile != null && tumorBAMFile != null) { doTumorPulldown = true; } else if ((tumorHetOutputFile == null) != (tumorBAMFile == null)) { throw new UserException.CommandLineException("Must specify both BAM and output files for tumor pulldown."); } else { doTumorPulldown = false; } final HetPulldownCalculator hetPulldown = new HetPulldownCalculator(REFERENCE_ARGUMENTS.getReferenceFile(), snpFile, minimumMappingQuality, minimumBaseQuality, VALIDATION_STRINGENCY); logger.info("Getting normal het pulldown..."); final Pulldown normalHetPulldown = hetPulldown.getNormal(normalBAMFile, pvalThreshold, minimumRawReads); normalHetPulldown.write(normalHetOutputFile, AllelicCountTableColumns.AllelicCountTableVerbosity.BASIC); logger.info("Normal het pulldown written to " + normalHetOutputFile.toString()); if (doTumorPulldown) { final IntervalList normalHetIntervals = normalHetPulldown.getIntervals(); logger.info("Getting tumor het pulldown..."); final Pulldown tumorHetPulldown = hetPulldown.getTumor(tumorBAMFile, normalHetIntervals, minimumRawReads); tumorHetPulldown.write(tumorHetOutputFile, AllelicCountTableColumns.AllelicCountTableVerbosity.BASIC); logger.info("Tumor het pulldown written to " + tumorHetOutputFile.toString()); } return "SUCCESS"; }

Target:
protected Object doWork() { final boolean doTumorPulldown; if (tumorHetOutputFile != null && tumorBAMFile != null) { doTumorPulldown = true; } else if ((tumorHetOutputFile == null) != (tumorBAMFile == null)) { throw new UserException.CommandLineException("Must specify both BAM and output files for tumor pulldown."); } else { doTumorPulldown = false; } final HetPulldownCalculator hetPulldown = new HetPulldownCalculator(REFERENCE_ARGUMENTS.getReferenceFile(), snpFile, minimumMappingQuality, minimumBaseQuality, VALIDATION_STRINGENCY); logger.info("Getting normal het pulldown..."); final Pulldown normalHetPulldown = hetPulldown.getNormal(normalBAMFile, pvalThreshold, minimumRawReads); normalHetPulldown.write(normalHetOutputFile, AllelicCountTableVerbosity.BASIC); logger.info("Normal het pulldown written to " + normalHetOutputFile.toString()); if (doTumorPulldown) { final IntervalList normalHetIntervals = normalHetPulldown.getIntervals(); logger.info("Getting tumor het pulldown..."); final Pulldown tumorHetPulldown = hetPulldown.getTumor(tumorBAMFile, normalHetIntervals, minimumRawReads); tumorHetPulldown.write(tumorHetOutputFile, AllelicCountTableVerbosity.BASIC); logger.info("Tumor het pulldown written to " + tumorHetOutputFile.toString()); } return "SUCCESS"; }
Source:
public int hashCode() { return 1; }

Target:
public int hashCode() { return getClass().hashCode(); }
Source:
protected List<MimeMessage> prepareMailToBeSent() throws MessagingException, IOException, EntityDoesNotExistException { Emails emailManager = new Emails(); FeedbackSessionAttributes feedbackObject = FeedbackSessionsLogic.inst() .getFeedbackSession(feedbackSessionName, courseId); log.info("Fetching feedback session object for feedback session name : " + feedbackSessionName + " and course : " + courseId); if (feedbackObject == null) { log.severe("Feedback session object for feedback session name : " + feedbackSessionName + " for course : " + courseId + " could not be fetched"); return null; } else { return emailManager.generateFeedbackSessionOpeningEmails(feedbackObject); } }

Target:
protected List<MimeMessage> prepareMailToBeSent() throws MessagingException, IOException, EntityDoesNotExistException { FeedbackSessionAttributes feedbackObject = FeedbackSessionsLogic.inst() .getFeedbackSession(feedbackSessionName, courseId); log.info("Fetching feedback session object for feedback session name : " + feedbackSessionName + " and course : " + courseId); if (feedbackObject == null) { log.severe("Feedback session object for feedback session name : " + feedbackSessionName + " for course : " + courseId + " could not be fetched"); return null; } else { return new Emails().generateFeedbackSessionOpeningEmails(feedbackObject); } }
Source:
private synchronized BridgeHandler getDssBridgeHandler() { if (this.dssBridgeHandler == null) { Bridge bridge = getBridge(); if (bridge == null) { logger.debug("Bride cannot be found"); return null; } ThingHandler handler = bridge.getHandler(); if (handler instanceof BridgeHandler) { dssBridgeHandler = (BridgeHandler) handler; dssBridgeHandler.registerDeviceStatusListener(this); } else { return null; } } if (circuit == null) { dssBridgeHandler.registerDeviceStatusListener(this); } return dssBridgeHandler; }

Target:
private synchronized BridgeHandler getDssBridgeHandler() { if (this.dssBridgeHandler == null) { Bridge bridge = getBridge(); if (bridge == null) { logger.debug("Bride cannot be found"); return null; } ThingHandler handler = bridge.getHandler(); if (handler instanceof BridgeHandler) { dssBridgeHandler = (BridgeHandler) handler; } else { return null; } } return dssBridgeHandler; }
Source:
public List<Callable<DocumentRevsList>> createTasks(List<String> ids, Map<String, Collection<String>> revisions) { List<Callable<DocumentRevsList>> tasks = new ArrayList<Callable<DocumentRevsList>>(); for(String id : ids) { if(id.isEmpty()){ continue; } HashSet<String> possibleAncestors = new HashSet<String>(); for (String revId : revisions.get(id)) { List<String> thesePossibleAncestors = targetDb.getDbCore().getPossibleAncestorRevisionIDs(id, revId, 50); if (thesePossibleAncestors != null) { possibleAncestors.addAll(thesePossibleAncestors); } } tasks.add(GetRevisionTask.createGetRevisionTask(this.sourceDb, id, revisions.get(id), possibleAncestors, config.pullAttachmentsInline)); } return tasks; }

Target:
public List<Callable<DocumentRevsList>> createTasks(List<String> ids, Map<String, Collection<String>> revisions) { List<Callable<DocumentRevsList>> tasks = new ArrayList<Callable<DocumentRevsList>>(); for(String id : ids) { if(id.isEmpty()){ logger.info("Found document with empty ID in change feed, skipping"); continue; } HashSet<String> possibleAncestors = new HashSet<String>(); for (String revId : revisions.get(id)) { List<String> thesePossibleAncestors = targetDb.getDbCore().getPossibleAncestorRevisionIDs(id, revId, 50); if (thesePossibleAncestors != null) { possibleAncestors.addAll(thesePossibleAncestors); } } tasks.add(GetRevisionTask.createGetRevisionTask(this.sourceDb, id, revisions.get(id), possibleAncestors, config.pullAttachmentsInline)); } return tasks; }
Source:
public void onTimeout(Continuation self) { WorkQueue.Executor executor; if (userProvider.get().isBatchUser()) { executor = queue.getBatchQueue(); } else { executor = queue.getInteractiveQueue(); } executor.remove(this); }

Target:
public void onTimeout(Continuation self) { WorkQueue.Executor executor = getExecutor(); executor.remove(this); }
Source:
public void buildObject_disapproved_candidates() throws Exception { ProjectToOrganizationConverter converter = new ProjectToOrganizationConverter( new ResultApprover() { @Override public boolean approveBeforeBuilding(Oaf oaf) { return false; } }, relationColumnFamilyBytes); String projectId = "someProjectId"; String organizationId = "someOrgId"; NavigableMap<byte[],byte[]> navigableMap = new TreeMap<byte[],byte[]>( UnsignedBytes.lexicographicalComparator()); navigableMap.put(organizationId.getBytes(), createOafObject(projectId, organizationId).toByteArray()); when(result.getFamilyMap(relationColumnFamilyBytes)).thenReturn(navigableMap); Collection<ProjectToOrganization> projOrgs = converter.buildObject(result, oaf); assertNotNull(projOrgs); assertTrue(projOrgs.isEmpty()); }

Target:
public void buildObject_disapproved_candidates() throws Exception { when(defaultApprover.approveBeforeBuilding(any())).thenReturn(false); ProjectToOrganizationConverter converter = new ProjectToOrganizationConverter(defaultApprover, relationColumnFamilyBytes); String projectId = "someProjectId"; String organizationId = "someOrgId"; NavigableMap<byte[], byte[]> navigableMap = new TreeMap<byte[], byte[]>( UnsignedBytes.lexicographicalComparator()); navigableMap.put(organizationId.getBytes(), createOafObject(projectId, organizationId).toByteArray()); when(result.getFamilyMap(relationColumnFamilyBytes)).thenReturn(navigableMap); Collection<ProjectToOrganization> projOrgs = converter.buildObject(result, oaf); assertNotNull(projOrgs); assertTrue(projOrgs.isEmpty()); }
Source:
public SearchParameterMap getSearchParameterMapFromCriteria(String theTargetType, String theCriteria) { SearchParameterMap spMap; if (!StringUtils.isBlank(theCriteria)) { spMap = mapFromCriteria(theTargetType, theCriteria); } else { spMap = new SearchParameterMap(); } return spMap; }

Target:
public SearchParameterMap getSearchParameterMapFromCriteria(String theTargetType, String theCriteria) { SearchParameterMap spMap; if (StringUtils.isBlank(theCriteria)) { spMap = new SearchParameterMap(); } else { spMap = mapFromCriteria(theTargetType, theCriteria); } return spMap; }
Source:
public BruteForce (ScanTarget target, File file, BruteForceListenner listenner, BruteForceParam bruteForceParam) { this.target = target; this.file = file; this.directory = null; this.listenner = listenner; this.threads = bruteForceParam.getThreadPerScan(); this.recursive = bruteForceParam.getRecursive(); this.onlyUnderDirectory = false; this.tableModel = new BruteForceTableModel(); log.info("BruteForce : " + target.getURI() + "/" + directory + " threads: " + threads); manager = new DirBusterManager(this); manager.setDefaultNoThreads(threads); ConnectionParam conParam = Model.getSingleton().getOptionsParam().getConnectionParam(); if (conParam.isUseProxy(target.getHost())) { manager.setProxyRealm(Model.getSingleton().getOptionsParam().getConnectionParam().getProxyChainRealm()); manager.setProxyHost(conParam.getProxyChainName()); manager.setProxyPort(conParam.getProxyChainPort()); manager.setProxyUsername(conParam.getProxyChainUserName()); manager.setProxyPassword(conParam.getProxyChainPassword()); manager.setUseProxy(true); manager.setUseProxyAuth(true); log.debug("BruteForce : set proxy to " + manager.getProxyHost() + ":" + manager.getProxyPort()); } if (bruteForceParam.isBrowseFiles()) { extensions = bruteForceParam.getFileExtensionsList(); } else { extensions = Collections.emptyList(); } extsToMissVector = new Vector<>(bruteForceParam.getExtensionsToMissSet()); }

Target:
public BruteForce (ScanTarget target, File file, BruteForceListenner listenner, BruteForceParam bruteForceParam) { this.target = target; this.file = file; this.directory = null; this.listenner = listenner; this.threads = bruteForceParam.getThreadPerScan(); this.recursive = bruteForceParam.getRecursive(); this.onlyUnderDirectory = false; this.tableModel = new BruteForceTableModel(); log.info("BruteForce : " + target.getURI() + "/" + directory + " threads: " + threads); manager = new DirBusterManager(this); manager.setDefaultNoThreads(threads); ConnectionParam conParam = Model.getSingleton().getOptionsParam().getConnectionParam(); if (conParam.isUseProxy(target.getHost())) { manager.setProxyRealm(Model.getSingleton().getOptionsParam().getConnectionParam().getProxyChainRealm()); manager.setProxyHost(conParam.getProxyChainName()); manager.setProxyPort(conParam.getProxyChainPort()); manager.setProxyUsername(conParam.getProxyChainUserName()); manager.setProxyPassword(conParam.getProxyChainPassword()); manager.setUseProxy(true); manager.setUseProxyAuth(true); log.debug("BruteForce : set proxy to " + manager.getProxyHost() + ":" + manager.getProxyPort()); } if (bruteForceParam.isBrowseFiles()) { extensions = bruteForceParam.getFileExtensionsList(); } else { extensions = Collections.emptyList(); } manager.extsToMiss.addAll(bruteForceParam.getExtensionsToMissSet()); }
Source:
public byte[] getCacheKey() { byte[] dimensionBytes = StringUtils.toUtf8(this.getDimension()); byte[] lowerBytes = this.getLower() == null ? new byte[0] : StringUtils.toUtf8(this.getLower()); byte[] upperBytes = this.getUpper() == null ? new byte[0] : StringUtils.toUtf8(this.getUpper()); byte boundType = 0x1; if (this.getLower() == null) { boundType = 0x2; } else if (this.getUpper() == null) { boundType = 0x3; } byte lowerStrictByte = (this.isLowerStrict() == false) ? 0x0 : (byte) 1; byte upperStrictByte = (this.isUpperStrict() == false) ? 0x0 : (byte) 1; byte AlphaNumericByte = (this.isAlphaNumeric() == false) ? 0x0 : (byte) 1; byte[] extractionFnBytes = extractionFn.getCacheKey(); ByteBuffer boundCacheBuffer = ByteBuffer.allocate( 9 + dimensionBytes.length + upperBytes.length + lowerBytes.length + extractionFnBytes.length ); boundCacheBuffer.put(DimFilterCacheHelper.BOUND_CACHE_ID) .put(boundType) .put(upperStrictByte) .put(lowerStrictByte) .put(AlphaNumericByte) .put(DimFilterCacheHelper.STRING_SEPARATOR) .put(dimensionBytes) .put(DimFilterCacheHelper.STRING_SEPARATOR) .put(upperBytes) .put(DimFilterCacheHelper.STRING_SEPARATOR) .put(lowerBytes) .put(DimFilterCacheHelper.STRING_SEPARATOR) .put(extractionFnBytes); return boundCacheBuffer.array(); }

Target:
public byte[] getCacheKey() { byte[] dimensionBytes = StringUtils.toUtf8(this.getDimension()); byte[] lowerBytes = this.getLower() == null ? new byte[0] : StringUtils.toUtf8(this.getLower()); byte[] upperBytes = this.getUpper() == null ? new byte[0] : StringUtils.toUtf8(this.getUpper()); byte boundType = 0x1; if (this.getLower() == null) { boundType = 0x2; } else if (this.getUpper() == null) { boundType = 0x3; } byte lowerStrictByte = (this.isLowerStrict() == false) ? 0x0 : (byte) 1; byte upperStrictByte = (this.isUpperStrict() == false) ? 0x0 : (byte) 1; byte AlphaNumericByte = (this.isAlphaNumeric() == false) ? 0x0 : (byte) 1; byte[] extractionFnBytes = extractionFn == null ? new byte[0] : extractionFn.getCacheKey(); ByteBuffer boundCacheBuffer = ByteBuffer.allocate( 9 + dimensionBytes.length + upperBytes.length + lowerBytes.length + extractionFnBytes.length ); boundCacheBuffer.put(DimFilterCacheHelper.BOUND_CACHE_ID) .put(boundType) .put(upperStrictByte) .put(lowerStrictByte) .put(AlphaNumericByte) .put(DimFilterCacheHelper.STRING_SEPARATOR) .put(dimensionBytes) .put(DimFilterCacheHelper.STRING_SEPARATOR) .put(upperBytes) .put(DimFilterCacheHelper.STRING_SEPARATOR) .put(lowerBytes) .put(DimFilterCacheHelper.STRING_SEPARATOR) .put(extractionFnBytes); return boundCacheBuffer.array(); }
Source:
public boolean check(VM vm) { if (vm.getStatus() == VMStatus.Suspended || vm.getStatus() == VMStatus.SavingState || vm.getStatus() == VMStatus.RestoringState) { Version vmCustomCompatibilityVersion = vm.getCustomCompatibilityVersion(); return vmCustomCompatibilityVersion == null ? false : vmCustomCompatibilityVersion.greaterOrEquals(newClusterVersion); } return true; }

Target:
public boolean check(VM vm) { if (vm.getStatus() == VMStatus.Suspended || vm.getStatus() == VMStatus.SavingState || vm.getStatus() == VMStatus.RestoringState) { return vm.getCustomCompatibilityVersion() == null; } return true; }
Source:
public synchronized void destroy() { logger.debug("Destroying CoAP endpoint.", new Exception("Endpoint destroyed")); super.destroy(); }

Target:
public synchronized void destroy() { if (logger.isDebugEnabled()) { logger.debug("Destroying CoAP endpoint.", new RuntimeException("Endpoint destroyed")); } super.destroy(); }
Source:
public void shouldNotCaptureIfPaymentProviderReturnsNon200HttpStatusCode() { Either<GatewayError, GatewayClient.Response> response = left(genericGatewayError("Unexpected HTTP status code 400 from gateway")); when(client.postRequestFor(anyString(), any(GatewayAccountEntity.class), any(GatewayOrder.class))).thenReturn(response); CaptureResponse gatewayResponse = epdqCaptureHandler.capture(buildTestCaptureRequest()); assertThat(gatewayResponse.isSuccessful(), is(false)); assertThat(gatewayResponse.getError().isPresent(), is(true)); assertThat(gatewayResponse.getError().get().getMessage(), is("Unexpected HTTP status code 400 from gateway")); assertThat(gatewayResponse.getError().get().getErrorType(), is(GENERIC_GATEWAY_ERROR)); }

Target:
public void shouldNotCaptureIfPaymentProviderReturnsNon200HttpStatusCode() { Either<GatewayError, GatewayClient.Response> response = left(gatewayConnectionError("Unexpected HTTP status code 400 from gateway")); when(client.postRequestFor(anyString(), any(GatewayAccountEntity.class), any(GatewayOrder.class))).thenReturn(response); CaptureResponse gatewayResponse = epdqCaptureHandler.capture(buildTestCaptureRequest()); assertThat(gatewayResponse.isSuccessful(), is(false)); assertThat(gatewayResponse.getError().isPresent(), is(true)); assertThat(gatewayResponse.getError().get().getMessage(), is("Unexpected HTTP status code 400 from gateway")); assertThat(gatewayResponse.getError().get().getErrorType(), is(GATEWAY_CONNECTION_ERROR)); }
Source:
@Override public void unparseCall(final SqlWriter writer, final SqlCall call, final int leftPrec, final int rightPrec) { switch (call.getKind()) { case POSITION: final SqlWriter.Frame frame = writer.startFunCall("STRPOS"); writer.sep(","); call.operand(1).unparse(writer, leftPrec, rightPrec); writer.sep(","); call.operand(0).unparse(writer, leftPrec, rightPrec); if (3 == call.operandCount()) { throw new RuntimeException("3rd operand Not Supported for Function STRPOS in Big Query"); } writer.endFunCall(frame); break; case UNION: if (!((SqlSetOperator) call.getOperator()).isAll()) { SqlSyntax.BINARY.unparse(writer, UNION_DISTINCT, call, leftPrec, rightPrec); } else { super.unparseCall(writer, call, leftPrec, rightPrec); } break; case EXCEPT: if (!((SqlSetOperator) call.getOperator()).isAll()) { SqlSyntax.BINARY.unparse(writer, EXCEPT_DISTINCT, call, leftPrec, rightPrec); } else { super.unparseCall(writer, call, leftPrec, rightPrec); } break; case INTERSECT: if (!((SqlSetOperator) call.getOperator()).isAll()) { SqlSyntax.BINARY.unparse(writer, INTERSECT_DISTINCT, call, leftPrec, rightPrec); } else { super.unparseCall(writer, call, leftPrec, rightPrec); } break; default: super.unparseCall(writer, call, leftPrec, rightPrec); } }

Target:
@Override public void unparseCall(final SqlWriter writer, final SqlCall call, final int leftPrec, final int rightPrec) { switch (call.getKind()) { case POSITION: final SqlWriter.Frame frame = writer.startFunCall("STRPOS"); writer.sep(","); call.operand(1).unparse(writer, leftPrec, rightPrec); writer.sep(","); call.operand(0).unparse(writer, leftPrec, rightPrec); if (3 == call.operandCount()) { throw new RuntimeException("3rd operand Not Supported for Function STRPOS in Big Query"); } writer.endFunCall(frame); break; case UNION: if (!((SqlSetOperator) call.getOperator()).isAll()) { SqlSyntax.BINARY.unparse(writer, UNION_DISTINCT, call, leftPrec, rightPrec); } else { super.unparseCall(writer, call, leftPrec, rightPrec); } break; case EXCEPT: SqlSyntax.BINARY.unparse(writer, EXCEPT_DISTINCT, call, leftPrec, rightPrec); break; case INTERSECT: SqlSyntax.BINARY.unparse(writer, INTERSECT_DISTINCT, call, leftPrec, rightPrec); break; default: super.unparseCall(writer, call, leftPrec, rightPrec); } }
Source:
public Cost getCost() throws SQLException { Long byteCount = getEstimatedBytesToScan(); if (byteCount == null) { return Cost.ZERO; } int parallelLevel = 10; Cost cost = CostUtil.estimateAggregateCost(byteCount, !groupBy.isUngroupedAggregate(), aggregators.getEstimatedByteSize(), parallelLevel); if (!orderBy.getOrderByExpressions().isEmpty()) { double outputBytes = CostUtil.estimateAggregateOutputBytes( byteCount, !groupBy.isUngroupedAggregate(), aggregators.getEstimatedByteSize()); Cost orderByCost = CostUtil.estimateOrderByCost(outputBytes, parallelLevel); cost = cost.plus(orderByCost); } return cost; }

Target:
public Cost getCost() { Long byteCount = null; try { byteCount = getEstimatedBytesToScan(); } catch (SQLException e) { } if (byteCount == null) { return Cost.UNKNOWN; } int parallelLevel = CostUtil.estimateParallelLevel( true, context.getConnection().getQueryServices()); Cost cost = CostUtil.estimateAggregateCost(byteCount, groupBy, aggregators.getEstimatedByteSize(), parallelLevel); if (!orderBy.getOrderByExpressions().isEmpty()) { double outputBytes = CostUtil.estimateAggregateOutputBytes( byteCount, groupBy, aggregators.getEstimatedByteSize()); Cost orderByCost = CostUtil.estimateOrderByCost(outputBytes, parallelLevel); cost = cost.plus(orderByCost); } return cost; }
Source:
public void shouldThrowNullPointerExceptionWhenSchemaIsNull() { updateSplitSchema(null, EMPTY_LIST); }

Target:
public void shouldThrowNullPointerExceptionWhenSchemaIsNull() { updateSplitSchema(null, ImmutableList.of()); }
Source:
SshFetchConnection() throws TransportException { super(TransportGitSsh.this); try { process = getSession().exec(commandFor(getOptionUploadPack()), getTimeout()); final MessageWriter msg = new MessageWriter(); setMessageWriter(msg); final InputStream upErr = process.getErrorStream(); errorThread = new StreamCopyThread(upErr, msg.getRawStream()); errorThread.start(); init(process.getInputStream(), process.getOutputStream()); } catch (TransportException err) { try { close(); } catch (Exception e) { } throw err; } catch (Throwable err) { try { close(); } catch (Error e) { } throw new TransportException(uri, JGitText.get().remoteHungUpUnexpectedly, err); } try { readAdvertisedRefs(); } catch (NoRemoteRepositoryException notFound) { final String msgs = getMessages(); checkExecFailure(process.exitValue(), getOptionUploadPack(), msgs); throw cleanNotFound(notFound, msgs); } }

Target:
SshFetchConnection() throws TransportException { super(TransportGitSsh.this); try { process = getSession().exec(commandFor(getOptionUploadPack()), getTimeout()); final MessageWriter msg = new MessageWriter(); setMessageWriter(msg); final InputStream upErr = process.getErrorStream(); errorThread = new StreamCopyThread(upErr, msg.getRawStream()); errorThread.start(); init(process.getInputStream(), process.getOutputStream()); } catch (TransportException err) { close(); throw err; } catch (Throwable err) { close(); throw new TransportException(uri, JGitText.get().remoteHungUpUnexpectedly, err); } try { readAdvertisedRefs(); } catch (NoRemoteRepositoryException notFound) { final String msgs = getMessages(); checkExecFailure(process.exitValue(), getOptionUploadPack(), msgs); throw cleanNotFound(notFound, msgs); } }
Source:
private ColumnStatisticsAggregation createColumnAggregation(ColumnStatisticType statisticType, Symbol input, Type inputType) { switch (statisticType) { case MIN_VALUE: return createAggregation(QualifiedName.of("min"), input.toSymbolReference(), inputType, inputType); case MAX_VALUE: return createAggregation(QualifiedName.of("max"), input.toSymbolReference(), inputType, inputType); case NUMBER_OF_DISTINCT_VALUES: return createAggregation(QualifiedName.of("approx_distinct"), input.toSymbolReference(), inputType, BIGINT); case NUMBER_OF_NON_NULL_VALUES: return createAggregation(QualifiedName.of("count"), input.toSymbolReference(), inputType, BIGINT); case NUMBER_OF_TRUE_VALUES: return createAggregation(QualifiedName.of("count_if"), input.toSymbolReference(), BOOLEAN, BIGINT); case TOTAL_VALUES_SIZE_IN_BYTES: return createAggregation(QualifiedName.of("$internal$sum_data_size_for_stats"), input.toSymbolReference(), inputType, BIGINT); case MAX_VALUE_SIZE_IN_BYTES: return createAggregation(QualifiedName.of("$internal$max_data_size_for_stats"), input.toSymbolReference(), inputType, BIGINT); default: throw new IllegalArgumentException("Unsupported statistic type: " + statisticType); } }

Target:
private ColumnStatisticsAggregation createColumnAggregation(ColumnStatisticType statisticType, Symbol input, Type inputType) { switch (statisticType) { case MIN_VALUE: return createAggregation(QualifiedName.of("min"), input.toSymbolReference(), inputType, inputType); case MAX_VALUE: return createAggregation(QualifiedName.of("max"), input.toSymbolReference(), inputType, inputType); case NUMBER_OF_DISTINCT_VALUES: return createAggregation(QualifiedName.of("approx_distinct"), input.toSymbolReference(), inputType, BIGINT); case NUMBER_OF_NON_NULL_VALUES: return createAggregation(QualifiedName.of("count"), input.toSymbolReference(), inputType, BIGINT); case NUMBER_OF_TRUE_VALUES: return createAggregation(QualifiedName.of("count_if"), input.toSymbolReference(), BOOLEAN, BIGINT); case TOTAL_SIZE_IN_BYTES: return createAggregation(QualifiedName.of(SumDataSizeForStats.NAME), input.toSymbolReference(), inputType, BIGINT); case MAX_VALUE_SIZE_IN_BYTES: return createAggregation(QualifiedName.of(MaxDataSizeForStats.NAME), input.toSymbolReference(), inputType, BIGINT); default: throw new IllegalArgumentException("Unsupported statistic type: " + statisticType); } }
Source:
public void setUp() throws Exception { context = RuntimeEnvironment.application; BinaryTempFileBody.setTempDirectory(context.getCacheDir()); imapStore = mock(ImapStore.class); storeConfig = mock(StoreConfig.class); when(storeConfig.getInboxFolderName()).thenReturn("INBOX"); when(imapStore.getCombinedPrefix()).thenReturn(""); when(imapStore.getStoreConfig()).thenReturn(storeConfig); imapConnection = mock(ImapConnection.class); }

Target:
public void setUp() throws Exception { BinaryTempFileBody.setTempDirectory(RuntimeEnvironment.application.getCacheDir()); imapStore = mock(ImapStore.class); storeConfig = mock(StoreConfig.class); when(storeConfig.getInboxFolderName()).thenReturn("INBOX"); when(imapStore.getCombinedPrefix()).thenReturn(""); when(imapStore.getStoreConfig()).thenReturn(storeConfig); imapConnection = mock(ImapConnection.class); }
Source:
public String getSeedAmount() { if (this.getInventoryInfo() != null && this.getInventoryInfo().getTotalAvailableBalance() != null) { if (this.getInventoryInfo().getDistinctScaleCountForGermplsm() > 1) { return "MIXED"; } else { if (!this.getInventoryInfo().getTotalAvailableBalance().equals(0D)) { return Double.toString(this.getInventoryInfo().getTotalAvailableBalance()) + this.getInventoryInfo() .getScaleForGermplsm(); } } } return ""; }

Target:
public String getSeedAmount() { if (this.getInventoryInfo() != null && this.getInventoryInfo().getTotalAvailableBalance() != null) { if (this.getInventoryInfo().getDistinctScaleCountForGermplsm() > 1) { return "MIXED"; } else if (!this.getInventoryInfo().getTotalAvailableBalance().equals(0D)) { return Double.toString(this.getInventoryInfo().getTotalAvailableBalance()) + this.getInventoryInfo().getScaleForGermplsm(); } } return ""; }
Source:
protected boolean canDoAction() { boolean retValue = true; if (getVm() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); retValue = false; } if (retValue && !getVm().isRunningOrPaused()) { setSucceeded(false); retValue = false; addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM); if (!StringUtils.isEmpty(cdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); } else { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__EJECT_CD); } failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } else if (retValue && !canRunActionOnNonManagedVm()) { retValue = false; } else if ((IsoDomainListSyncronizer.getInstance().findActiveISODomain(getVm().getStoragePoolId()) == null) && !StringUtils.isEmpty(cdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); addCanDoActionMessage(VdcBllMessages.VM_CANNOT_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); setSucceeded(false); retValue = false; } else if (StringUtils.isNotEmpty(cdImagePath) && !cdImagePath.endsWith(ValidationUtils.ISO_SUFFIX)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_CDROM_DISK_FORMAT); setSucceeded(false); retValue = false; } else { cdImagePath = ImagesHandler.cdPathWindowsToLinux(getParameters().getCdImagePath(), getVm().getStoragePoolId(), getVm().getRunOnVds()); } return retValue; }

Target:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (!getVm().isRunningOrPaused()) { setSucceeded(false); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM); if (!StringUtils.isEmpty(cdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); } else { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__EJECT_CD); } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } if (!canRunActionOnNonManagedVm()) { return false; } if ((IsoDomainListSyncronizer.getInstance().findActiveISODomain(getVm().getStoragePoolId()) == null) && !StringUtils.isEmpty(cdImagePath)) { setSucceeded(false); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.VM_CANNOT_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } if (StringUtils.isNotEmpty(cdImagePath) && !cdImagePath.endsWith(ValidationUtils.ISO_SUFFIX)) { setSucceeded(false); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_CDROM_DISK_FORMAT); } cdImagePath = ImagesHandler.cdPathWindowsToLinux(getParameters().getCdImagePath(), getVm().getStoragePoolId(), getVm().getRunOnVds()); return true; }
Source:
@Override public BootstrappedDatasetPartition build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, EmptyContext ctx) { BootstrappedVector[] dataset = (BootstrappedVector[]) Array.newInstance(BootstrappedVector.class, Math.toIntExact(upstreamDataSize)); AtomicInteger ptr = new AtomicInteger(); PoissonDistribution poissonDistribution = new PoissonDistribution(subsampleSize); poissonDistribution.reseedRandomGenerator(seed); upstreamData.forEachRemaining(entry -> { Vector features = featureExtractor.apply(entry.getKey(), entry.getValue()); Double label = lbExtractor.apply(entry.getKey(), entry.getValue()); int[] repetitionCounters = new int[samplesCount]; Arrays.setAll(repetitionCounters, i -> poissonDistribution.sample()); dataset[ptr.getAndIncrement()] = new BootstrappedVector(features, label, repetitionCounters); }); return new BootstrappedDatasetPartition(dataset); }

Target:
@Override public BootstrappedDatasetPartition build(Iterator<UpstreamEntry<K, V>> upstreamData, long upstreamDataSize, EmptyContext ctx) { BootstrappedVector[] dataset = new BootstrappedVector[Math.toIntExact(upstreamDataSize)]; int cntr = 0; PoissonDistribution poissonDistribution = new PoissonDistribution(subsampleSize); while(upstreamData.hasNext()) { UpstreamEntry<K, V> nextRow = upstreamData.next(); Vector features = featureExtractor.apply(nextRow.getKey(), nextRow.getValue()); Double lb = lbExtractor.apply(nextRow.getKey(), nextRow.getValue()); int[] repetitionCounters = new int[samplesCnt]; Arrays.setAll(repetitionCounters, i -> poissonDistribution.sample()); dataset[cntr++] = new BootstrappedVector(features, lb, repetitionCounters); } return new BootstrappedDatasetPartition(dataset); }
Source:
private List<StorageType> getStorageTypesList(String storageTypesString) { List<String> splitTypes = split(storageTypesString); if (splitTypes == null) { return null; } List<StorageType> types = new ArrayList<>(splitTypes.size()); for (String typeStr : splitTypes) { try { types.add(StorageType.forValue(Integer.parseInt(typeStr))); } catch (NumberFormatException e) { continue; } } return types; }

Target:
private ArrayList<StorageType> getStorageTypesList(String storageTypesString) throws SQLException { List<String> splitTypes = split(storageTypesString); if (splitTypes == null) { return null; } ArrayList<StorageType> types = new ArrayList<>(splitTypes.size()); for (String typeStr : splitTypes) { try { types.add(StorageType.forValue(Integer.parseInt(typeStr))); } catch (NumberFormatException e) { throw new SQLException("Could not parse disk image storage domain type " + typeStr); } } return types; }
Source:
private static boolean checkServiceEndpoint(Logger log, Element organization, String serviceName, String serviceUrl, String matchEndpointVersion) { boolean serviceNodeFound = false; NodeList endpointList = getElementsByTagNameOf(log, organization, "endpointList", "endpoint"); if (endpointList != null) { for (int epIndex = 0; epIndex < endpointList.getLength(); epIndex++) { Element endpoint = (Element) endpointList.item(epIndex); String endpointName = getFirstElementOf(endpoint, "name").getTextContent(); if (endpointName.equals(serviceName)) { log.info(MessageFormat.format("Found service: {0}", serviceName)); serviceNodeFound = true; Element epConfigurationLatestVersion = getEndpointConfigurationBy(log, endpoint, matchEndpointVersion); if (epConfigurationLatestVersion != null) { Element url = getFirstElementOf(epConfigurationLatestVersion, "url"); if (url != null) { if (!serviceUrl.equals(url.getTextContent())) { url.setTextContent(serviceUrl); log.info(MessageFormat.format("setting the endpoint-configuration-url: {0}", serviceUrl)); } } else { createElementBy(epConfigurationLatestVersion, "url", serviceUrl); log.info(MessageFormat.format("created the endpoint-configuration-url: {0}", serviceUrl)); } } log.debug(getCheckpoint(MessageFormat.format("checkServiceEndpoint-found: {0}", serviceName))); break; } } } return serviceNodeFound; }

Target:
private static boolean checkServiceEndpoint(Logger log, Element organization, String serviceName, String serviceUrl, String matchEndpointVersion) { boolean serviceNodeFound = false; NodeList endpointList = getElementsByTagNameOf(log, organization, "endpointList", "endpoint"); if (endpointList != null) { for (int epIndex = 0; epIndex < endpointList.getLength(); epIndex++) { Element endpoint = (Element) endpointList.item(epIndex); String endpointName = getFirstElementOf(endpoint, "name").getTextContent(); if (endpointName.equalsIgnoreCase(serviceName)) { log.info(MessageFormat.format("Found service: {0}", serviceName)); serviceNodeFound = true; Element epConfigurationLatestVersion = getEndpointConfigurationBy(log, endpoint, matchEndpointVersion); if (epConfigurationLatestVersion != null) { Element url = getFirstElementOf(epConfigurationLatestVersion, "url"); if (url != null) { if (!serviceUrl.equalsIgnoreCase(url.getTextContent())) { url.setTextContent(serviceUrl); log.info( MessageFormat.format("setting the endpoint-configuration-url: {0}", serviceUrl)); } } else { createElementBy(epConfigurationLatestVersion, "url", serviceUrl); log.info(MessageFormat.format("created the endpoint-configuration-url: {0}", serviceUrl)); } } log.debug(getCheckpoint(MessageFormat.format("checkServiceEndpoint-found: {0}", serviceName))); break; } } } return serviceNodeFound; }
Source:
public void stop() { newScript(STOPPING). body.append( "${runDir}/bin/stop" ).execute(); }

Target:
public void stop() { newScript(STOPPING). body.append( format("%s/bin/stop",getRunDir()) ).execute(); }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pathInfo = req.getPathInfo(); if (pathInfo == null) { resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND); } URL resource = bundle.getResource(resourceDirPath + pathInfo); if (resource == null) { resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND); } try (InputStream stream = resource.openStream()) { IOUtils.copy(stream, resp.getOutputStream()); } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String pathInfo = req.getPathInfo(); if (pathInfo == null) { resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND); return; } URL resource = bundle.getResource(resourceDirPath + pathInfo); if (resource == null) { resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND); return; } try (InputStream stream = resource.openStream()) { IOUtils.copy(stream, resp.getOutputStream()); } }
Source:
private void storeNetwork() throws UnsupportedEncodingException { if (sourceProtocol.equals(NetConfigSourceProtocol.OPENSTACK_METADATA)) { networkData = new VmInitToOpenStackMetadata(vmInit).asMap(); } else { storeNetworkAsEni(); } }

Target:
private void storeNetwork() throws UnsupportedEncodingException { if (sourceProtocol == NetConfigSourceProtocol.OPENSTACK_METADATA) { networkData = new VmInitToOpenStackMetadata(vmInit).asMap(); } else { storeNetworkAsEni(); } }
Source:
public EJBContainer createEJBContainer(Map<?, ?> map) { if (map == null) { map = new HashMap<Object, Object>(); } if (isOtherProvider(map)) { return null; } if (instance != null || OpenEJB.isInitialized()) { if (!isSingleClose()) { logger().info("EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization"); } return instance; } try { this.resetUrlPackages(); final Properties properties = new Properties(); properties.putAll(map); this.doInitialize(properties); AppContext appContext = this.createAppContext(map); final OpenEjbContainer openEjbContainer = instance = new OpenEjbContainer(map, appContext); if (isSingleClose()) { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { if (instance != null) { instance.doClose(); } } }); } return openEjbContainer; } catch (final OpenEJBException | MalformedURLException e) { throw new EJBException(e); } catch (final ValidationException ve) { throw ve; } catch (final Exception e) { if (e instanceof EJBException) { throw (EJBException) e; } throw new InitializationException(e); } finally { if (instance == null && OpenEJB.isInitialized()) { try { OpenEJB.destroy(); } catch (final Exception e) { } } } }

Target:
public EJBContainer createEJBContainer(Map<?, ?> map) { if (map == null) { map = new HashMap<>(); } if (isOtherProvider(map)) { return null; } if (instance != null || OpenEJB.isInitialized()) { if (!isSingleClose()) { logger().info("EJBContainer already initialized. Call ejbContainer.close() to allow reinitialization"); } return instance; } try { this.resetUrlPackages(); final Properties properties = new Properties(); properties.putAll(map); this.doInitialize(properties); AppContext appContext = this.createAppContext(map); final OpenEjbContainer openEjbContainer = instance = new OpenEjbContainer(map, appContext); if (isSingleClose()) { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { if (instance != null) { instance.doClose(); } } }); } return openEjbContainer; } catch (final OpenEJBException | MalformedURLException e) { throw new EJBException(e); } catch (final ValidationException ve) { throw ve; } catch (final Exception e) { if (e instanceof EJBException) { throw (EJBException) e; } throw new InitializationException(e); } finally { if (instance == null && OpenEJB.isInitialized()) { try { OpenEJB.destroy(); } catch (final Exception e) { } } } }
Source:
public BSONObject convert(EntityInfo info) { Error.push("convert[info|bson]"); try { BSONObject doc = (BSONObject) super.convert(info); List<DBObject> indexes = (List<DBObject>) getMapProperty(doc, "indexes"); if (indexes != null) { for (DBObject index: indexes) { DBObject partialFilterExpression = (DBObject) index.get(MongoCRUDController.PARTIAL_FILTER_EXPRESSION_OPTION_NAME); if (partialFilterExpression != null) { index.put(MongoCRUDController.PARTIAL_FILTER_EXPRESSION_OPTION_NAME, partialFilterExpression.toString()); } } } putValue(doc, "_id", getStringProperty(doc, "name") + DELIMITER_ID); return doc; } catch (Error e) { throw e; } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage()); } finally { Error.pop(); } }

Target:
public BSONObject convert(EntityInfo info) { Error.push("convert[info|bson]"); try { BSONObject doc = (BSONObject) super.convert(info); putValue(doc, "_id", getStringProperty(doc, "name") + DELIMITER_ID); return doc; } catch (Error e) { throw e; } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage()); } finally { Error.pop(); } }
Source:
public void aclSetUser(final byte[] name, byte[][] parameters) { final byte[][] cmdParams = new byte[2 + parameters.length][]; int index = 0; cmdParams[index++] = Keyword.SETUSER.raw; cmdParams[index++] = name; for (final byte[] key : parameters) { cmdParams[index++] = key; } sendCommand(ACL, cmdParams); }

Target:
public void aclSetUser(final byte[] name, byte[][] parameters) { sendCommand(ACL, joinParameters(Keyword.SETUSER.raw,name, parameters)); }