auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPutNestedBinaryObject() throws Exception { IgniteBinary binary = grid(0).binary(); BinaryObjectBuilder nested = binary.builder("Nested"); nested.setField("str1", "stringValue"); nested.setField("sqlDate", java.sql.Date.valueOf("2019-01-01")); jcache().put(-1, nested.build()); BinaryObjectBuilder parent = binary.builder("Parent"); parent.setField("nested", nested.build()); parent.setField("id", Long.MAX_VALUE); parent.setField("byteVal", (byte)1); parent.setField("timestamp", new Timestamp(new java.util.Date().getTime())); BinaryObject obj = parent.build(); jcache().put(2, obj); JsonNode jsonNode = JSON_MAPPER.valueToTree(obj); ((ObjectNode)jsonNode).put("id", Long.MIN_VALUE); String jsonText = JSON_MAPPER.writeValueAsString(jsonNode); info("Put: " + jsonText); String ret = content(DEFAULT_CACHE_NAME, GridRestCommand.CACHE_PUT, "keyType", "int", "key", "3", "valueType", "Parent", "val", jsonText ); info("Put command result: " + ret); assertResponseSucceeded(ret, false); ret = content(DEFAULT_CACHE_NAME, GridRestCommand.CACHE_GET, "keyType", "int", "key", "3"); info("Get command result: " + ret); JsonNode res = assertResponseSucceeded(ret, false); assertEquals(jsonNode, res); }

Target:
public void testPutNestedBinaryObject() throws Exception { IgniteBinary binary = grid(0).binary(); BinaryObjectBuilder nested = binary.builder("Nested"); nested.setField("str1", "stringValue"); nested.setField("sqlDate", java.sql.Date.valueOf("2019-01-01")); jcache().put(-1, nested.build()); BinaryObjectBuilder parent = binary.builder("Parent"); parent.setField("nested", nested.build()); parent.setField("id", Long.MAX_VALUE); parent.setField("byteVal", (byte)1); parent.setField("timestamp", new Timestamp(new java.util.Date().getTime())); jcache().put(2, parent.build()); parent.setField("id", Long.MIN_VALUE); String jsonText = JSON_MAPPER.writeValueAsString(parent.build()); info("Put: " + jsonText); String ret = content(DEFAULT_CACHE_NAME, GridRestCommand.CACHE_PUT, "keyType", "int", "key", "3", "valueType", "Parent", "val", jsonText ); info("Put command result: " + ret); assertResponseSucceeded(ret, false); ret = content(DEFAULT_CACHE_NAME, GridRestCommand.CACHE_GET, "keyType", "int", "key", "3"); info("Get command result: " + ret); JsonNode res = assertResponseSucceeded(ret, false); assertEquals(jsonText, JSON_MAPPER.writeValueAsString(res)); }
Source:
public void testReloadCache() throws Exception { connector = new BugzillaRestConnectorLocal(new Duration(5, TimeUnit.SECONDS)); assertNotNull(connector); configuration = connector.getRepositoryConfiguration(actualFixture.repository()); assertNotNull(configuration); Thread.sleep(6000L); BugzillaRestConfiguration configuration_new = connector.getRepositoryConfiguration(actualFixture.repository()); assertEquals(configuration, configuration_new); mySync = this; synchronized (mySync) { try { mySync.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } mySync = null; BugzillaRestConfiguration configuration_new1 = connector.getRepositoryConfiguration(actualFixture.repository()); assertThat(configuration, not(configuration_new1)); }

Target:
public void testReloadCache() throws Exception { connector = new BugzillaRestConnectorLocal(new Duration(5, TimeUnit.SECONDS)); assertNotNull(connector); configuration = connector.getRepositoryConfiguration(actualFixture.repository()); assertNotNull(configuration); Thread.sleep(6000L); BugzillaRestConfiguration configuration_new = connector.getRepositoryConfiguration(actualFixture.repository()); assertEquals(configuration, configuration_new); waitForCacheRemoval(); BugzillaRestConfiguration configuration_new1 = connector.getRepositoryConfiguration(actualFixture.repository()); assertThat(configuration, not(configuration_new1)); }
Source:
public static void main(String[] args) { try { LoggingFactory.init(Level.INFO); Platform.setVirtual(false); boolean isDone = true; Runtime.start("gui", "SwingGui"); Arduino mega = (Arduino) Runtime.start("mega", "Arduino"); mega.setBoardMega(); mega.connect("COM7"); HobbyServo servo = (HobbyServo) Runtime.start("servo", "HobbyServo"); servo.attach(mega, 8); servo.moveTo(3); servo.moveTo(130); servo.moveTo(0); servo.invoke("moveTo", 3); if (isDone) { return; } } catch (Exception e) { log.error("main threw", e); } }

Target:
public static void main(String[] args) { try { LoggingFactory.init(Level.INFO); Platform.setVirtual(true); Runtime.start("gui", "SwingGui"); Arduino mega = (Arduino) Runtime.start("mega", "Arduino"); if (mega.isVirtual()) { VirtualArduino vmega = mega.getVirtual(); vmega.setBoardMega(); } mega.connect("COM7"); HobbyServo servo = (HobbyServo) Runtime.start("servo", "HobbyServo"); log.info("rest is {}", servo.getRest()); servo.save(); servo.attach(mega, 13); servo.moveTo(90.0); boolean isDone = true; if (isDone) { return; } } catch (Exception e) { log.error("main threw", e); } }
Source:
public GithubSecurityRealm(String githubWebUri, String githubApiUri, String clientID, String clientSecret, String oauthScopes, String emailDomains, Boolean forceGithubEmail) { super(); this.githubWebUri = Util.fixEmptyAndTrim(githubWebUri); this.githubApiUri = Util.fixEmptyAndTrim(githubApiUri); this.clientID = Util.fixEmptyAndTrim(clientID); setClientSecret(Util.fixEmptyAndTrim(clientSecret)); this.oauthScopes = Util.fixEmptyAndTrim(oauthScopes); this.emailDomains = Util.fixEmptyAndTrim(emailDomains); this.forceGithubEmail = forceGithubEmail; }

Target:
public GithubSecurityRealm(String githubWebUri, String githubApiUri, String clientID, String clientSecret, String oauthScopes, String emailDomains, Boolean forceGithubEmail) { super(); this.githubWebUri = Util.fixEmptyAndTrim(githubWebUri); this.githubApiUri = Util.fixEmptyAndTrim(githubApiUri); this.clientID = Util.fixEmptyAndTrim(clientID); setClientSecret(Util.fixEmptyAndTrim(clientSecret)); this.oauthScopes = Util.fixEmptyAndTrim(oauthScopes); this.emailDomains = emailDomains.trim(); this.forceGithubEmail = forceGithubEmail; }
Source:
public ToStringHelper string() { ToStringHelper toString = super.string(); if (groupNames.size() != 0) toString.add("groupNames", groupNames); if (noKeyPair) toString.add("noKeyPair", noKeyPair); toString.add("keyPair", keyPair); if (userData != null && userData.size() > 0) toString.add("userDataCksum", Hashing.crc32().hashBytes(Bytes.toArray(userData))); ImmutableSet<BlockDeviceMapping> mappings = blockDeviceMappings.build(); if (mappings.size() != 0) toString.add("blockDeviceMappings", mappings); if (maxCount != null) toString.add("maxCount", maxCount); if (clientToken != null) toString.add("clientToken", clientToken); return toString; }

Target:
public ToStringHelper string() { ToStringHelper toString = super.string(); if (groupNames.size() != 0) toString.add("groupNames", groupNames); if (noKeyPair) toString.add("noKeyPair", noKeyPair); toString.add("keyPair", keyPair); if (userData != null && userData.size() > 0) toString.add("userDataCksum", Hashing.crc32().hashBytes(Bytes.toArray(userData))); ImmutableSet<BlockDeviceMapping> mappings = blockDeviceMappings.build(); if (mappings.size() != 0) toString.add("blockDeviceMappings", mappings); if (maxCount != null && maxCount.intValue() > 0) toString.add("maxCount", maxCount); if (clientToken != null) toString.add("clientToken", clientToken); return toString; }
Source:
public void setUp() { parser = new CargoResultParser(); StringBuilder builder = new StringBuilder(); builder.append(" Compiling example version (path)\n"); builder.append(" Running target\\debug\\mod-hash.exe\n"); builder.append("\n"); builder.append("running 1 test\n"); builder.append("test name ... FAILED\n"); builder.append("\n"); builder.append("failures:\n"); builder.append("\n"); builder.append("---- name stdout ----\n"); builder.append("\tthread 'name' panicked at 'description', tests\\mod.rs:line\n"); builder.append("\n"); builder.append("\n"); builder.append("failures:\n"); builder.append(" name\n"); builder.append("\n"); builder.append("test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured"); fail = builder.toString(); }

Target:
public void setUp() { parser = new CargoResultParser(); failResult = new ProcessResult(0, fail, ""); }
Source:
private void verifyCommonValues() { verify(propertyWriterFactory).of(activityCaptor.capture()); assertEquals(UUID, activityCaptor.getValue().getId()); verify(propertyWriter).setName(NAME); verify(propertyWriter).setDocumentation(DOCUMENTATION); verify(propertyWriter).setOnEntryAction(ON_ENTRY_ACTION); verify(propertyWriter).setOnExitAction(ON_EXIT_ACTION); verify(propertyWriter).setCalledElement(CALLED_ELEMENT); verify(propertyWriter).setAsync(IS_ASYNC); verify(propertyWriter).setIndependent(INDEPENDENT); verify(propertyWriter).setWaitForCompletion(WAIT_FOR_COMPLETION); verify(propertyWriter).setAssignmentsInfo(ASSIGNMENTS_INFO); verify(propertyWriter).setSimulationSet(SIMULATION_SET); verify(propertyWriter).setBounds(BOUNDS); }

Target:
private void verifyCommonValues() { verify(propertyWriterFactory).of(activityCaptor.capture()); assertEquals(UUID, activityCaptor.getValue().getId()); verify(propertyWriter).setName(NAME); verify(propertyWriter).setDocumentation(DOCUMENTATION); verify(propertyWriter).setOnEntryAction(ON_ENTRY_ACTION); verify(propertyWriter).setOnExitAction(ON_EXIT_ACTION); verify(propertyWriter).setCalledElement(CALLED_ELEMENT); verify(propertyWriter).setAsync(IS_ASYNC); verify(propertyWriter).setIndependent(INDEPENDENT); verify(propertyWriter).setWaitForCompletion(WAIT_FOR_COMPLETION); verify(propertyWriter).setAssignmentsInfo(ASSIGNMENTS_INFO); verify(propertyWriter).setSimulationSet(SIMULATION_SET); verify(propertyWriter).setAbsoluteBounds(node); }
Source:
public Collection<AlarmFeedback> getFeedback(String situationKey) throws FeedbackException { Gson gson = new Gson(); String query = "{\n" + " \"query\": { \"match\": { \"situation_key\": " + gson.toJson(situationKey) + " } }\n" + "}"; return search(query); }

Target:
public Collection<AlarmFeedback> getFeedback(String situationKey) throws FeedbackException { String query = "{\n" + " \"query\": { \"match\": { \"situation_key\": " + gson.toJson(situationKey) + " } }\n" + "}"; return search(query); }
Source:
public void addCustomHeader(String name, String value) { if (customHeaders == null) { customHeaders = new ArrayList<Param>(2); } if (name.toLowerCase().equals(CONTENT_TYPE.toLowerCase())) { setCustomContentType(value); } else if (name.toLowerCase().equals(CONTENT_TRANSFER_ENCODING.toLowerCase())) { transferEncoding = value; } else if (name.toLowerCase().equals(CONTENT_ID.toLowerCase())) { contentId = value; } else if (name.toLowerCase().equals(CONTENT_DISPOSITION.toLowerCase())) { setCustomContentDisposition(value); } else { customHeaders.add(new Param(name, value)); } }

Target:
public void addCustomHeader(String name, String value) { if (customHeaders == null) { customHeaders = new ArrayList<Param>(2); } for (String header : SPECIAL_HEADERS) { if (name.equalsIgnoreCase(header)) { throw new IllegalArgumentException("Trying to add special header " + header + " as custom (use constructor instead)"); } } customHeaders.add(new Param(name, value)); }
Source:
private void loadFromFile() throws IOException { File settingFile = new File(conf.getInterpreterSettingPath()); if (!settingFile.exists()) { return; } FileInputStream fis = new FileInputStream(settingFile); InputStreamReader isr = new InputStreamReader(fis); BufferedReader bufferedReader = new BufferedReader(isr); StringBuilder sb = new StringBuilder(); InterpreterSetting interpreterSettingObject; String depClassPath = StringUtils.EMPTY; String line; while ((line = bufferedReader.readLine()) != null) { sb.append(line); } isr.close(); fis.close(); String json = sb.toString(); InterpreterInfoSaving info = gson.fromJson(json, InterpreterInfoSaving.class); for (String k : info.interpreterSettings.keySet()) { InterpreterSetting setting = info.interpreterSettings.get(k); setting.getOption().setRemote(true); interpreterSettingObject = interpreterSettingsRef.get(setting.getGroup()); if (interpreterSettingObject == null) { logger.info("can't get InterpreterSetting " + "Information From loaded Interrpeter Setting Ref - ", setting.getGroup()); continue; } depClassPath = interpreterSettingObject.getPath(); setting.setPath(depClassPath); setting.setInterpreterGroupFactory(this); loadInterpreterDependencies(setting); interpreterSettings.put(k, setting); } this.interpreterBindings = info.interpreterBindings; if (info.interpreterRepositories != null) { for (RemoteRepository repo : info.interpreterRepositories) { if (!depResolver.getRepos().contains(repo)) { this.interpreterRepositories.add(repo); } } } }

Target:
private void loadFromFile() throws IOException { File settingFile = new File(conf.getInterpreterSettingPath()); if (!settingFile.exists()) { return; } FileInputStream fis = new FileInputStream(settingFile); InputStreamReader isr = new InputStreamReader(fis); BufferedReader bufferedReader = new BufferedReader(isr); StringBuilder sb = new StringBuilder(); InterpreterSetting interpreterSettingObject; String depClassPath = StringUtils.EMPTY; String line; while ((line = bufferedReader.readLine()) != null) { sb.append(line); } isr.close(); fis.close(); String json = sb.toString(); InterpreterInfoSaving info = gson.fromJson(json, InterpreterInfoSaving.class); for (String k : info.interpreterSettings.keySet()) { InterpreterSetting setting = info.interpreterSettings.get(k); setting.getOption().setRemote(true); interpreterSettingObject = interpreterSettingsRef.get(setting.getGroup()); if (interpreterSettingObject == null) { logger.warn("can't get InterpreterSetting " + "Information From loaded Interpreter Setting Ref - ", setting.getGroup()); continue; } depClassPath = interpreterSettingObject.getPath(); setting.setPath(depClassPath); setting.setInterpreterGroupFactory(this); loadInterpreterDependencies(setting); interpreterSettings.put(k, setting); } this.interpreterBindings = info.interpreterBindings; if (info.interpreterRepositories != null) { for (RemoteRepository repo : info.interpreterRepositories) { if (!depResolver.getRepos().contains(repo)) { this.interpreterRepositories.add(repo); } } } }
Source:
public static OpenSpan startSpan(String operation, String parentSpanId) { Preconditions.checkState(currentTrace.get().isEmpty(), "Cannot start a span with explicit parent if the current thread's trace is non-empty"); OpenSpan span = OpenSpan.builder() .spanId(Traces.randomId()) .operation(operation) .parentSpanId(parentSpanId) .build(); currentTrace.get().push(span); return span; }

Target:
public static OpenSpan startSpan(String operation, String parentSpanId) { Preconditions.checkState(currentTrace.get().isEmpty(), "Cannot start a span with explicit parent if the current thread's trace is non-empty"); validateId(parentSpanId, "parentTraceId must be non-empty: %s"); OpenSpan span = OpenSpan.builder() .spanId(Traces.randomId()) .operation(operation) .parentSpanId(parentSpanId) .build(); currentTrace.get().push(span); return span; }
Source:
private BigtableTableAdminSettings.Builder buildBigtableTableAdminSettings() throws IOException { BigtableTableAdminSettings.Builder adminBuilder = BigtableTableAdminSettings.newBuilder() .setProjectId(getProjectId()) .setInstanceId(getInstanceId()); BigtableTableAdminStubSettings.Builder stubSettings = adminBuilder.stubSettings(); buildEndpoints(stubSettings, BIGTABLE_ADMIN_HOST_KEY); buildHeaderProvider(stubSettings); buildCredentialProvider(stubSettings); buildEmulatorSettings(stubSettings); return adminBuilder; }

Target:
private BigtableTableAdminSettings buildBigtableTableAdminSettings() throws IOException { BigtableTableAdminSettings.Builder adminBuilder = BigtableTableAdminSettings.newBuilder() .setProjectId(getProjectId()) .setInstanceId(getInstanceId()); BigtableTableAdminStubSettings.Builder stubSettings = adminBuilder.stubSettings(); configureConnection(stubSettings, BIGTABLE_ADMIN_HOST_KEY); configureHeaderProvider(stubSettings); configureCredentialProvider(stubSettings); configureEmulatorSettings(stubSettings); return adminBuilder.build(); }
Source:
public void retrievesForks() throws Exception { final RtForks forks = new RtForks(this.repo()); MatcherAssert.assertThat( forks.iterate("newest"), Matchers.notNullValue() ); }

Target:
public void retrievesForks() throws Exception { final Fork.Smart fork = new Fork.Smart(this.repo().forks().create()); MatcherAssert.assertThat( fork, Matchers.notNullValue() ); MatcherAssert.assertThat( this.repo().forks().iterate("newest"), Matchers.notNullValue() ); }
Source:
protected Command createDeleteViewCommand(GroupRequest deleteRequest) { CompositeCommand cc = new CompositeCommand(StringStatics.BLANK); List<?> toDel = deleteRequest.getEditParts(); if (toDel == null || toDel.isEmpty()) { cc.compose(new ViewDeleteCommand((View) getHost().getModel())); } else { for (int i = 0; i < toDel.size(); i++) { IGraphicalEditPart gep = (IGraphicalEditPart) toDel.get(i); cc.compose(new ViewDeleteCommand((View) gep.getModel())); } } return new ICommandProxy(cc.reduce()); }

Target:
protected Command createDeleteViewCommand(GroupRequest deleteRequest) { TransactionalEditingDomain editingDomain = getEditingDomain(); if (editingDomain == null) { return null; } CompositeTransactionalCommand cc = new CompositeTransactionalCommand(getEditingDomain(), StringStatics.BLANK); List<?> toDel = deleteRequest.getEditParts(); if (toDel == null || toDel.isEmpty()) { cc.compose(new ViewDeleteCommand(editingDomain, (View) getHost().getModel())); } else { for (int i = 0; i < toDel.size(); i++) { IGraphicalEditPart gep = (IGraphicalEditPart) toDel.get(i); cc.compose(new ViewDeleteCommand(editingDomain, (View) gep.getModel())); } } return new ICommandProxy(cc.reduce()); }
Source:
public void releaseTaskCmdExecutorTest() { ReleaseTaskCmd releaseTaskCmd = new ReleaseTaskCmd("taskId"); assertThat(releaseTaskCmdExecutor).isNotNull(); assertThat(releaseTaskCmdExecutor.getHandledType()).isEqualTo(ReleaseTaskCmd.class); releaseTaskCmdExecutor.execute(releaseTaskCmd); verify(processEngine).releaseTask(releaseTaskCmd); verify(commandResults).send(ArgumentMatchers.<Message<CompleteTaskResults>>any()); }

Target:
public void releaseTaskCmdExecutorTest() { ReleaseTaskCmd releaseTaskCmd = new ReleaseTaskCmd("taskId"); assertThat(releaseTaskCmdExecutor.getHandledType()).isEqualTo(ReleaseTaskCmd.class); releaseTaskCmdExecutor.execute(releaseTaskCmd); verify(processEngine).releaseTask(releaseTaskCmd); verify(commandResults).send(ArgumentMatchers.<Message<CompleteTaskResults>>any()); }
Source:
public RegionLocations(HRegionLocation... locations) { this(RegionInfo.DEFAULT_REPLICA_ID, locations); }

Target:
public RegionLocations(HRegionLocation... locations) { int numNonNullElements = 0; int maxReplicaId = -1; int maxReplicaIdIndex = -1; int index = 0; for (HRegionLocation loc : locations) { if (loc != null) { if (loc.getRegion().getReplicaId() >= maxReplicaId) { maxReplicaId = loc.getRegion().getReplicaId(); maxReplicaIdIndex = index; } } index++; } maxReplicaId = maxReplicaId + (locations.length - (maxReplicaIdIndex + 1) ); if (maxReplicaId + 1 == locations.length) { this.locations = locations; } else { this.locations = new HRegionLocation[maxReplicaId + 1]; for (HRegionLocation loc : locations) { if (loc != null) { this.locations[loc.getRegion().getReplicaId()] = loc; } } } for (HRegionLocation loc : this.locations) { if (loc != null && loc.getServerName() != null){ numNonNullElements++; } } this.numNonNullElements = numNonNullElements; }
Source:
public ByteBuf getCommandLineBytes() throws ImapAsyncClientException { final String base64Folder = BASE64MailboxEncoder.encode(folderName); int qResyncParamSize = 0; String qResyncParamStr = null; if (qResyncParameter != null) { qResyncParamStr = qResyncParameter.buildCommandLine(); qResyncParamSize = qResyncParamStr.length(); } final int len = 2 * base64Folder.length() + ImapClientConstants.PAD_LEN + qResyncParamSize; final ByteBuf sb = Unpooled.buffer(len); sb.writeBytes(op.getBytes(StandardCharsets.US_ASCII)); sb.writeByte(ImapClientConstants.SPACE); final ImapArgumentFormatter formatter = new ImapArgumentFormatter(); formatter.formatArgument(base64Folder, sb, false); if (qResyncParamStr != null) { sb.writeByte(ImapClientConstants.SPACE); sb.writeBytes(qResyncParamStr.getBytes(StandardCharsets.US_ASCII)); } sb.writeBytes(CRLF_B); return sb; }

Target:
public ByteBuf getCommandLineBytes() throws ImapAsyncClientException { final String base64Folder = BASE64MailboxEncoder.encode(folderName); int qResyncParameterSize = 0; StringBuilder sb = null; if (qResyncParameter != null) { sb = new StringBuilder(); sb.append("(QRESYNC (").append(qResyncParameter.getUidValidity()).append(ImapClientConstants.SPACE).append(qResyncParameter.getModSeq()); if (qResyncParameter.getKnownUids() != null) { sb.append(ImapClientConstants.SPACE); sb.append(MessageNumberSet.buildString(qResyncParameter.getKnownUids())); } if (qResyncParameter.getSeqMatchData() != null) { sb.append(ImapClientConstants.SPACE).append("("); sb.append(MessageNumberSet.buildString(qResyncParameter.getSeqMatchData().getKnownSequenceSet())); sb.append(ImapClientConstants.SPACE); sb.append(MessageNumberSet.buildString(qResyncParameter.getSeqMatchData().getKnownUidSet())); sb.append(")"); } sb.append("))"); qResyncParameterSize = sb.length(); } final int len = 2 * base64Folder.length() + ImapClientConstants.PAD_LEN + qResyncParameterSize; final ByteBuf byteBuf = Unpooled.buffer(len); byteBuf.writeBytes(op.getBytes(StandardCharsets.US_ASCII)); byteBuf.writeByte(ImapClientConstants.SPACE); final ImapArgumentFormatter formatter = new ImapArgumentFormatter(); formatter.formatArgument(base64Folder, byteBuf, false); if (qResyncParameterSize > 0) { byteBuf.writeByte(ImapClientConstants.SPACE); byteBuf.writeBytes(sb.toString().getBytes(StandardCharsets.US_ASCII)); } byteBuf.writeBytes(CRLF_B); return byteBuf; }
Source:
public Tile getTown() { return null; }

Target:
public Tile getTown() { for (Tile t : baseGrid) { if (t.getTerrain().equals(TerrainType.TOWN)) { return t; } } return null; }
Source:
private void checkVariantInformation(Variant variant, String fileId, String studyId) throws NonVariantException, IncompleteInformationException { VariantSourceEntry variantSourceEntry = variant.getSourceEntry(fileId, studyId); List<Map<String, String>> samplesData = variantSourceEntry.getSamplesData(); if (!samplesData.isEmpty()) { if (samplesData.stream().map(m -> m.get("GT")).noneMatch(this::genotypeHasAlternateAllele)) { throw new NonVariantException("TODO MESSAGE HERE"); } } else { boolean hasAC = checkAttributeIsNotZero(variantSourceEntry, "AC"); boolean hasAF = checkAttributeIsNotZero(variantSourceEntry, "AF"); boolean hasAN = checkAttributeIsNotZero(variantSourceEntry, "AN"); boolean hasGTC = checkAttributeIsNotZero(variantSourceEntry, "GTC"); if (!hasAC && !hasAF && !hasAN && !hasGTC) { throw new IncompleteInformationException(variant); } } }

Target:
protected void checkVariantInformation(Variant variant, String fileId, String studyId) throws NonVariantException, IncompleteInformationException { if (variant.getAlternate().equalsIgnoreCase(variant.getReference())) { throw new NonVariantException("The variant " + variant + " reference and alternate alleles are the same"); } if (variant.getAlternate().equals(".")) { throw new NonVariantException("The variant " + variant + " has no alternate allele"); } }
Source:
private void addCatalogSourceDescriptor(Set<SourceDescriptor> descriptors) { if (descriptors != null) { if (catalog != null) { final Set<ContentType> cachedContentTypes; final Optional<Set<ContentType>> contentTypesOptional = contentTypesCache.getCachedValueForSource(catalog); if (contentTypesOptional.isPresent()) { cachedContentTypes = contentTypesOptional.get(); } else { LOGGER.debug("Unknown ContentTypes for the local catalog"); cachedContentTypes = Collections.emptySet(); } SourceDescriptorImpl descriptor = new SourceDescriptorImpl( this.getId(), cachedContentTypes, sourceActionRegistry.list(catalog)); if (this.getVersion() != null) { descriptor.setVersion(this.getVersion()); } descriptor.setAvailable(isSourceAvailable(catalog)); descriptors.add(descriptor); } } }

Target:
private void addCatalogSourceDescriptor(Set<SourceDescriptor> descriptors) { if (descriptors != null) { if (catalog != null) { final SourceDescriptorImpl descriptor = new SourceDescriptorImpl( this.getId(), contentTypesCache .getCachedValueForSource(catalog) .orElseGet( () -> { LOGGER.debug("Unknown content types for the localSource"); return Collections.emptySet(); }), sourceActionRegistry.list(catalog)); if (this.getVersion() != null) { descriptor.setVersion(this.getVersion()); } descriptor.setAvailable(isSourceAvailable(catalog)); descriptors.add(descriptor); } } }
Source:
public void hasMimeType() throws Exception { matcher.init(FakeMatcherConfig.builder() .matcherName("HasMimeType") .condition(MIME_TYPES) .build()); assertNotNull(matcher.match(mail)); }

Target:
public void hasMimeType() throws MessagingException { matcher.init(FakeMatcherConfig.builder() .matcherName("HasMimeType") .condition(MIME_TYPES) .build()); assertThat(matcher.match(mail)).containsAll(mail.getRecipients()); }
Source:
public byte[][] getByteParams(byte[]... args) { ArrayList<byte[]> byteParams = new ArrayList<>(); for (byte[] arg : args) { byteParams.add(arg); } if (contains(NX)) { byteParams.add(SafeEncoder.encode(NX)); } if (contains(XX)) { byteParams.add(SafeEncoder.encode(XX)); } if (contains(GET)) { byteParams.add(SafeEncoder.encode(GET)); } if (contains(EX)) { byteParams.add(SafeEncoder.encode(EX)); byteParams.add(Protocol.toByteArray((int) getParam(EX))); } if (contains(PX)) { byteParams.add(SafeEncoder.encode(PX)); byteParams.add(Protocol.toByteArray((long) getParam(PX))); } return byteParams.toArray(new byte[byteParams.size()][]); }

Target:
public byte[][] getByteParams(byte[]... args) { ArrayList<byte[]> byteParams = new ArrayList<>(); for (byte[] arg : args) { byteParams.add(arg); } if (contains(NX)) { byteParams.add(SafeEncoder.encode(NX)); } if (contains(XX)) { byteParams.add(SafeEncoder.encode(XX)); } if (contains(EX)) { byteParams.add(SafeEncoder.encode(EX)); byteParams.add(Protocol.toByteArray((int) getParam(EX))); } if (contains(PX)) { byteParams.add(SafeEncoder.encode(PX)); byteParams.add(Protocol.toByteArray((long) getParam(PX))); } if (contains(GET)) { byteParams.add(SafeEncoder.encode(GET)); } return byteParams.toArray(new byte[byteParams.size()][]); }
Source:
public void testNull() { org.eclipse.papyrus.sysml14.nattable.requirement.tester.RequirementTableTester tableRequirementTester = new org.eclipse.papyrus.sysml14.nattable.requirement.tester.RequirementTableTester(); IStatus emptyNotAllowed = tableRequirementTester.isAllowed(null); Assert.assertEquals("The tester should not work on a null entry", IStatus.ERROR, emptyNotAllowed.getSeverity()); }

Target:
public void testNull() { RequirementTableTester tableRequirementTester = new RequirementTableTester(); IStatus emptyNotAllowed = tableRequirementTester.isAllowed(null); Assert.assertEquals("The tester should not work on a null entry", IStatus.ERROR, emptyNotAllowed.getSeverity()); }
Source:
ParametrizedTypeType(Symbol.TypeSymbol symbol, Map<TypeVariableType, Type> typeSubstitution) { super(symbol); this.rawType = symbol.getType(); this.typeSubstitution = typeSubstitution; if (rawType.isTagged(UNKNOWN)) { this.tag = UNKNOWN; } }

Target:
ParametrizedTypeType(Symbol.TypeSymbol symbol, Map<TypeVariableType, Type> typeSubstitution) { super(symbol); this.rawType = symbol.getType(); this.typeSubstitution = typeSubstitution; }
Source:
public void testWithTimerTask() { Task<?> task = delayedValue("value", 5, TimeUnit.SECONDS).withTimeout(2, TimeUnit.SECONDS); runAndWaitException(task, TimeoutException.class); Assert.assertTrue(_traceCaptureListener.isDone()); Trace trace = _traceCaptureListener.getTrace(); Assert.assertNotNull(trace); Optional<ShallowTrace> timerTrace = findTraceByName(trace, "withTimeout"); Assert.assertTrue(timerTrace.isPresent()); Assert.assertEquals(timerTrace.get().getResultType(), ResultType.ERROR); Optional<ShallowTrace> valueTrace = findTraceByName(trace, "value"); Assert.assertTrue(valueTrace.isPresent()); Assert.assertEquals(valueTrace.get().getResultType(), ResultType.EARLY_FINISH); }

Target:
public void testWithTimerTask() { Task<?> task = delayedValue("value", 1000, TimeUnit.MILLISECONDS).withTimeout(50, TimeUnit.MILLISECONDS); runAndWaitException(task, TimeoutException.class); Assert.assertTrue(_traceCaptureListener.isDone()); Trace trace = _traceCaptureListener.getTrace(); Assert.assertNotNull(trace); Optional<ShallowTrace> timerTrace = findTraceByName(trace, "withTimeout"); Assert.assertTrue(timerTrace.isPresent()); Assert.assertEquals(timerTrace.get().getResultType(), ResultType.ERROR); Optional<ShallowTrace> valueTrace = findTraceByName(trace, "value"); Assert.assertTrue(valueTrace.isPresent()); Assert.assertEquals(valueTrace.get().getResultType(), ResultType.EARLY_FINISH); }
Source:
public GatewayProxyFactoryBean itemReadEventsListener() { GatewayProxyFactoryBean factoryBean = new GatewayProxyFactoryBean(ItemReadListener.class); factoryBean.setDefaultRequestChannel(listenerChannels.itemReadEvents()); return factoryBean; }

Target:
public ItemReadListener itemReadEventsListener() { return new EventEmittingItemReadEventsListener(listenerChannels.itemReadEvents()); }
Source:
private void loadBuiltInJavaFunctions(ImmutableMap.Builder<Integer, UserDefinedFunctionRunner> builder) { builder.put(21025, new UserDefinedFunctionRunner("FORMAT_TIMESTAMP", 21025, "format_timestamp", new JavaBuiltInFunctions())); }

Target:
private void loadBuiltInJavaFunctions(ImmutableMap.Builder<Integer, UserDefinedFunctionRunner> builder) { String[] functionNames = {"format_timestamp"}; for (String functionName : functionNames) { int functionID = FunctionForVoltDB.getFunctionID(functionName); builder.put(functionID, new UserDefinedFunctionRunner(functionName, functionID, functionName, new JavaBuiltInFunctions())); } }
Source:
private boolean isAbruptFinallyBlock(Tree.Kind jumpKind) { if (isInFinally.isEmpty()) { return false; } Tree.Kind blockKind = isInFinally.peek(); switch (blockKind) { case BLOCK: return true; case FOR_STATEMENT: case FOR_EACH_STATEMENT: case WHILE_STATEMENT: case DO_STATEMENT: case SWITCH_STATEMENT: return handleControlFlowInFinally(jumpKind); case METHOD: default: return false; } }

Target:
private boolean isAbruptFinallyBlock(Tree.Kind jumpKind) { if (treeKindStack.isEmpty()) { return false; } Tree.Kind blockKind = treeKindStack.peek(); switch (blockKind) { case BLOCK: return true; case FOR_STATEMENT: case FOR_EACH_STATEMENT: case WHILE_STATEMENT: case DO_STATEMENT: case SWITCH_STATEMENT: return handleControlFlowInFinally(jumpKind); case METHOD: default: return false; } }
Source:
protected void executeCommand() { try { addVmToDb(); VM vm = getVm(); if (!vm.hasImages()) { endVmRelatedOps(); } else { processImages(); } } catch (RuntimeException e) { MacPoolManager.getInstance().freeMacs(macsAdded); throw e; } setSucceeded(true); }

Target:
protected void executeCommand() { try { addVmToDb(); VM vm = getVm(); if (vm.getImages().isEmpty()) { endVmRelatedOps(); } else { processImages(); } } catch (RuntimeException e) { MacPoolManager.getInstance().freeMacs(macsAdded); throw e; } setSucceeded(true); }
Source:
long webkit_download_decide_destination(long download, long suggested_filename) { int length = C.strlen (suggested_filename); byte[] bytes = new byte[length]; C.memmove (bytes, suggested_filename, length); final String fileName = new String (Converter.mbcsToWcs (bytes)); if (!browser.isDisposed ()) { FileDialog dialog = new FileDialog (browser.getShell (), SWT.SAVE); dialog.setFileName (fileName); String title = Compatibility.getMessage ("SWT_FileDownload"); dialog.setText (title); String path = dialog.open (); if (path != null) { path = URI_FILEROOT + path; byte[] uriBytes = Converter.wcsToMbcs (path, true); WebKitGTK.webkit_download_set_allow_overwrite (download, true); WebKitGTK.webkit_download_set_destination (download, uriBytes); OS.g_object_ref (download); browser.getDisplay().asyncExec(() -> { openDownloadWindow (download, fileName); }); } } return 0; }

Target:
long webkit_download_decide_destination(long download, long suggested_filename) { assert WEBKIT2 : WebKitGTK.Webkit2AssertMsg; final String fileName = getString(suggested_filename); if (!browser.isDisposed ()) { FileDialog dialog = new FileDialog (browser.getShell (), SWT.SAVE); dialog.setFileName (fileName); String title = Compatibility.getMessage ("SWT_FileDownload"); dialog.setText (title); String path = dialog.open (); if (path != null) { path = URI_FILEROOT + path; byte[] uriBytes = Converter.wcsToMbcs (path, true); WebKitGTK.webkit_download_set_allow_overwrite (download, true); WebKitGTK.webkit_download_set_destination (download, uriBytes); OS.g_object_ref (download); browser.getDisplay().asyncExec(() -> { openDownloadWindow (download, fileName); }); } } return 0; }
Source:
protected void onGooglePlayServicesReady() { SupportMapFragment fragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); map = fragment.getMap(); map.setMyLocationEnabled(true); map.getUiSettings().setZoomControlsEnabled(false); map.getUiSettings().setMyLocationButtonEnabled(false); ParseQuery<ParseObject> query = ParseQuery.getQuery("Request"); Intent i = getIntent(); String requestId = i.getStringExtra(Constants.REQUEST_ID); Request.getByObjectId(requestId, new ModelCallback<Request>() { @Override public void onModelFound(Request req) { request = req; RequestDetailActivity.this.updateRequestDetail(); } @Override public void onModelError(Throwable e) { RequestDetailActivity.this.onError(e); } }); }

Target:
protected void onGooglePlayServicesReady() { SupportMapFragment fragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map); map = fragment.getMap(); map.setMyLocationEnabled(true); map.getUiSettings().setZoomControlsEnabled(false); map.getUiSettings().setMyLocationButtonEnabled(false); Intent i = getIntent(); String requestId = i.getStringExtra(REQUEST_ID); Request.getByObjectId(requestId, new ModelCallback<Request>() { @Override public void onModelFound(Request req) { request = req; RequestDetailActivity.this.updateRequestDetail(); } @Override public void onModelError(Throwable e) { RequestDetailActivity.this.onError(e); } }); }
Source:
public void testReleaseResource() throws Exception { final CompletableFuture<SlotRequest> slotRequestFuture = new CompletableFuture<>(); resourceManagerGateway.setRequestSlotConsumer(slotRequestFuture::complete); try (SlotPoolImpl slotPool = createAndSetUpSlotPool()) { slotPool.registerTaskManager(taskManagerLocation.getResourceID()); SlotRequestId requestId1 = new SlotRequestId(); CompletableFuture<PhysicalSlot> future1 = requestNewAllocatedSlot( slotPool, requestId1 ); final SlotRequest slotRequest = slotRequestFuture.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); CompletableFuture<PhysicalSlot> future2 = requestNewAllocatedSlot( slotPool, new SlotRequestId() ); final SlotOffer slotOffer = new SlotOffer( slotRequest.getAllocationId(), 0, DEFAULT_TESTING_PROFILE); assertTrue(slotPool.offerSlot(taskManagerLocation, taskManagerGateway, slotOffer)); PhysicalSlot slot1 = future1.get(1, TimeUnit.SECONDS); assertTrue(future1.isDone()); assertFalse(future2.isDone()); final CompletableFuture<?> releaseFuture = new CompletableFuture<>(); SingleLogicalSlot logicalSlot = SingleLogicalSlot.allocateFromPhysicalSlot( requestId1, slot1, Locality.UNKNOWN, new DummySlotOwner(), true ); logicalSlot.tryAssignPayload(new DummyPayload(releaseFuture)); slotPool.releaseTaskManager(taskManagerLocation.getResourceID(), null); releaseFuture.get(1, TimeUnit.SECONDS); assertFalse(logicalSlot.isAlive()); Thread.sleep(10); assertFalse(future2.isDone()); } }

Target:
public void testReleaseResource() throws Exception { final CompletableFuture<SlotRequest> slotRequestFuture = new CompletableFuture<>(); resourceManagerGateway.setRequestSlotConsumer(slotRequestFuture::complete); try (SlotPoolImpl slotPool = createAndSetUpSlotPool(resourceManagerGateway)) { final SlotRequestId requestId1 = new SlotRequestId(); final CompletableFuture<PhysicalSlot> future1 = requestNewAllocatedSlot( slotPool, requestId1); final SlotRequest slotRequest = slotRequestFuture.get(TIMEOUT.toMilliseconds(), TimeUnit.MILLISECONDS); final CompletableFuture<PhysicalSlot> future2 = requestNewAllocatedSlot( slotPool, new SlotRequestId()); assertTrue(registerAndOfferSlot(taskManagerLocation, slotPool, slotRequest.getAllocationId())); final PhysicalSlot slot1 = future1.get(1, TimeUnit.SECONDS); assertTrue(future1.isDone()); assertFalse(future2.isDone()); final CompletableFuture<?> releaseFuture = new CompletableFuture<>(); final SingleLogicalSlot logicalSlot = SingleLogicalSlot.allocateFromPhysicalSlot( requestId1, slot1, Locality.UNKNOWN, new DummySlotOwner(), true); logicalSlot.tryAssignPayload(new DummyPayload(releaseFuture)); slotPool.releaseTaskManager(taskManagerLocation.getResourceID(), null); releaseFuture.get(); assertFalse(logicalSlot.isAlive()); Thread.sleep(10); assertFalse(future2.isDone()); } }
Source:
protected void ExecuteVmCommand() { super.ExecuteVmCommand(); getParameters().OriginalTemplate = getVm().getvmt_guid(); VmTemplateHandler.lockVmTemplateInTransaction(getParameters().OriginalTemplate, getCompensationContext()); getVm().setvmt_guid(VmTemplateHandler.BlankVmTemplateId); getVm().getStaticData().setQuotaId(getParameters().getVmStaticData().getQuotaId()); DbFacade.getInstance().getVmStaticDAO().update(getVm().getStaticData()); if (getTaskIdList().isEmpty()) { EndSuccessfully(); } }

Target:
protected void ExecuteVmCommand() { VmTemplateHandler.lockVmTemplateInTransaction(getParameters().OriginalTemplate, getCompensationContext()); super.ExecuteVmCommand(); getParameters().OriginalTemplate = getVm().getvmt_guid(); getVm().setvmt_guid(VmTemplateHandler.BlankVmTemplateId); getVm().getStaticData().setQuotaId(getParameters().getVmStaticData().getQuotaId()); DbFacade.getInstance().getVmStaticDAO().update(getVm().getStaticData()); if (getTaskIdList().isEmpty()) { EndSuccessfully(); } }
Source:
EditorActivityDelayer() { display = SWTUtils.getDisplay(); Objects.requireNonNull(display, "CTOR invoked from non SWT Thread"); }

Target:
EditorActivityDelayer() { display = SWTUtils.getDisplay(); }
Source:
public static void failTaskWithoutVdsmId(final AsyncTasks task) { task.getTaskParameters().setTaskGroupSuccess(false); ExecutionHandler.endTaskStep(task.getStepId(), JobExecutionStatus.FAILED); removeTaskFromDbByTaskId(task.getTaskId()); if (task.getTaskType() == AsyncTaskType.unknown) { return; } ThreadPoolUtil.execute(new Runnable() { @SuppressWarnings("synthetic-access") @Override public void run() { NGuid stepId = task.getStepId(); ExecutionContext context = null; if (stepId != null) { context = ExecutionHandler.createFinalizingContext(stepId.getValue()); } Backend.getInstance().endAction(task.getaction_type(), task.getActionParameters(), new CommandContext(context)); } }); }

Target:
public static void failTaskWithoutVdsmId(final AsyncTasks task) { ThreadPoolUtil.execute(new Runnable() { @SuppressWarnings("synthetic-access") @Override public void run() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { logAndFailTaskWithoutVdsmId(task); return null; } }); } }); }
Source:
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) { long totalHits = response.getHits().getTotalHits().value; float maxScore = response.getHits().getMaxScore(); List<T> results = new ArrayList<>(); for (SearchHit hit : response.getHits()) { if (hit != null) { T result = null; String hitSourceAsString = hit.getSourceAsString(); if (!StringUtils.isEmpty(hitSourceAsString)) { result = mapEntity(hitSourceAsString, clazz); } else { result = mapEntity(hit.getFields().values(), clazz); } setPersistentEntityId(result, hit.getId(), clazz); setPersistentEntityVersion(result, hit.getVersion(), clazz); setPersistentEntityScore(result, hit.getScore(), clazz); populateScriptFields(result, hit); results.add(result); } } return new AggregatedPageImpl<T>(results, pageable, totalHits, response.getAggregations(), response.getScrollId(), maxScore); }

Target:
public <T> AggregatedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable) { long totalHits = SearchHitsUtil.getTotalCount(response.getHits()); float maxScore = response.getHits().getMaxScore(); List<T> results = new ArrayList<>(); for (SearchHit hit : response.getHits()) { if (hit != null) { T result = null; String hitSourceAsString = hit.getSourceAsString(); if (!StringUtils.isEmpty(hitSourceAsString)) { result = mapEntity(hitSourceAsString, clazz); } else { result = mapEntity(hit.getFields().values(), clazz); } setPersistentEntityId(result, hit.getId(), clazz); setPersistentEntityVersion(result, hit.getVersion(), clazz); setPersistentEntityScore(result, hit.getScore(), clazz); populateScriptFields(result, hit); results.add(result); } } return new AggregatedPageImpl<T>(results, pageable, totalHits, response.getAggregations(), response.getScrollId(), maxScore); }
Source:
public long getMaxTime() { Long maxTime = extractTimeValue(_maxValueMap.get(_timeColumnName)); if (maxTime != null) { return maxTime; } return Long.MIN_VALUE; }

Target:
public long getMaxTime() { Long maxTime = extractTimeValue(getMaxVal(_timeColumnName)); if (maxTime != null) { return maxTime; } return Long.MIN_VALUE; }
Source:
private Scenario giveResourcesToPlayerForRoadBuilding(int moveOrder) { return scenario .nextRandomDiceValues(asList(moveOrder, moveOrder, 6, 6, 6, 6)) .THROW_DICE(moveOrder) .END_TURN(moveOrder) .THROW_DICE(moveOrder == 1 ? 2 : moveOrder == 2 ? 3 : 1) .END_TURN(moveOrder == 1 ? 2 : moveOrder == 2 ? 3 : 1) .THROW_DICE(moveOrder == 1 ? 3 : moveOrder == 2 ? 1 : 2) .END_TURN(moveOrder == 1 ? 3 : moveOrder == 2 ? 1 : 2); }

Target:
private Scenario giveResourcesToPlayerForRoadBuilding(int moveOrder) { return scenario .nextRandomDiceValues(asList(moveOrder, moveOrder)) .THROW_DICE(moveOrder) .END_TURN(moveOrder) .nextRandomDiceValues(asList(6, 6)) .THROW_DICE(moveOrder == 1 ? 2 : moveOrder == 2 ? 3 : 1) .END_TURN(moveOrder == 1 ? 2 : moveOrder == 2 ? 3 : 1) .nextRandomDiceValues(asList(6, 6)) .THROW_DICE(moveOrder == 1 ? 3 : moveOrder == 2 ? 1 : 2) .END_TURN(moveOrder == 1 ? 3 : moveOrder == 2 ? 1 : 2); }
Source:
protected void parseConfiguration(ServerConfiguration conf) { tableIdToTableName = new HashMap<>(); poolNameToRegexPattern = new HashMap<>(); for (Entry<String,String> table : getTableOperations().tableIdMap().entrySet()) { tableIdToTableName.put(table.getValue(), table.getKey()); Map<String,String> customProps = conf.getTableConfiguration(table.getValue()).getAllPropertiesWithPrefix(Property.TABLE_ARBITRARY_PROP_PREFIX); if (null != customProps && customProps.size() > 0) { for (Entry<String,String> customProp : customProps.entrySet()) { String tableName = customProp.getKey().substring(HOST_BALANCER_PREFIX.length()); String regex = customProp.getValue(); poolNameToRegexPattern.put(tableName, Pattern.compile(regex)); } } } String oobProperty = conf.getConfiguration().get(HOST_BALANCER_OOB_CHECK); if (null != oobProperty) { oobCheckMillis = AccumuloConfiguration.getTimeInMillis(oobProperty); } String poolRecheckProperty = conf.getConfiguration().get(HOST_BALANCER_POOL_RECHECK_KEY); if (null != poolRecheckProperty) { poolRecheckMillis = AccumuloConfiguration.getTimeInMillis(poolRecheckProperty); } String ipBased = conf.getConfiguration().get(HOST_BALANCER_REGEX_USING_IPS); if (null != ipBased) { isIpBasedRegex = Boolean.parseBoolean(ipBased); } }

Target:
protected void parseConfiguration(ServerConfiguration conf) { TableOperations t = getTableOperations(); if (null == t) { throw new RuntimeException("Table Operations cannot be null"); } tableIdToTableName = new HashMap<>(); poolNameToRegexPattern = new HashMap<>(); for (Entry<String,String> table : t.tableIdMap().entrySet()) { tableIdToTableName.put(table.getValue(), table.getKey()); Map<String,String> customProps = conf.getTableConfiguration(table.getValue()).getAllPropertiesWithPrefix(Property.TABLE_ARBITRARY_PROP_PREFIX); if (null != customProps && customProps.size() > 0) { for (Entry<String,String> customProp : customProps.entrySet()) { if (customProp.getKey().startsWith(HOST_BALANCER_PREFIX)) { String tableName = customProp.getKey().substring(HOST_BALANCER_PREFIX.length()); String regex = customProp.getValue(); poolNameToRegexPattern.put(tableName, Pattern.compile(regex)); } } } } String oobProperty = conf.getConfiguration().get(HOST_BALANCER_OOB_CHECK); if (null != oobProperty) { oobCheckMillis = AccumuloConfiguration.getTimeInMillis(oobProperty); } String poolRecheckProperty = conf.getConfiguration().get(HOST_BALANCER_POOL_RECHECK_KEY); if (null != poolRecheckProperty) { poolRecheckMillis = AccumuloConfiguration.getTimeInMillis(poolRecheckProperty); } String ipBased = conf.getConfiguration().get(HOST_BALANCER_REGEX_USING_IPS); if (null != ipBased) { isIpBasedRegex = Boolean.parseBoolean(ipBased); } }
Source:
public static Object[] inject(final Parameter[] parameters, final Set<InjectableParameter> filters, final Object[] args, final Method injectionMethod, final ITestContext context, final ITestResult testResult) { if (filters != null && !filters.isEmpty()) { final ArrayList<Object> arguments = new ArrayList<Object>(args.length); final Queue<ObjectHolder> queue = new ArrayDeque<ObjectHolder>(args.length); for (int i = 0; i < args.length; i++) { queue.add(new ObjectHolder(args[i])); } final boolean currentTestMethod = filters.contains(InjectableParameter.CURRENT_TEST_METHOD); final boolean iTestContext = filters.contains(InjectableParameter.ITEST_CONTEXT); final boolean iTestResult = filters.contains(InjectableParameter.ITEST_RESULT); final boolean xmlTest = filters.contains(InjectableParameter.XML_TEST); boolean firstMethodInjected = false; for (final Parameter parameter : parameters) { boolean injected = false; if (currentTestMethod && !firstMethodInjected) { if (canInject(parameter, InjectableParameter.CURRENT_TEST_METHOD)) { arguments.add(injectionMethod); firstMethodInjected = true; injected = true; } } if (!injected && iTestContext) { if (canInject(parameter, InjectableParameter.ITEST_CONTEXT)) { arguments.add(context); injected = true; } } if (!injected && iTestResult) { if (canInject(parameter, InjectableParameter.ITEST_RESULT)) { arguments.add(testResult); injected = true; } } if (!injected && xmlTest) { if (canInject(parameter, InjectableParameter.XML_TEST)) { arguments.add(context != null ? context.getCurrentXmlTest() : null); injected = true; } } if (!injected) { arguments.add(queue.poll().get()); } } final Object[] injectedArray = new Object[arguments.size()]; return arguments.toArray(injectedArray); } else { return args; } }

Target:
public static Object[] inject(final Parameter[] parameters, final Set<InjectableParameter> filters, final Object[] args, final Method injectionMethod, final ITestContext context, final ITestResult testResult) { if (filters != null && !filters.isEmpty()) { final ArrayList<Object> arguments = new ArrayList<>(args.length); final ListBackedImmutableQueue<Object> queue = new ListBackedImmutableQueue<>(args); boolean firstMethodInjected = false; for (final Parameter parameter : parameters) { boolean inject = false; Object injectObject = null; for (final InjectableParameter injectableParameter : filters) { inject = canInject(parameter, injectableParameter); switch (injectableParameter) { case CURRENT_TEST_METHOD: injectObject = injectionMethod; if (inject && !firstMethodInjected) { firstMethodInjected = true; } else { inject = false; } break; case ITEST_CONTEXT: injectObject = context; break; case ITEST_RESULT: injectObject = testResult; break; case XML_TEST: injectObject = context != null ? context.getCurrentXmlTest() : null; break; default: break; } if (inject) { arguments.add(injectObject); break; } } if (!inject) { arguments.add(queue.poll()); } } final Object[] injectedArray = new Object[arguments.size()]; return arguments.toArray(injectedArray); } else { return args; } }