auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldSupportLimits() { final SObjectBatch batch = new SObjectBatch(version); batch.addLimits(); final SObjectBatchResponse response = testBatch(batch); final List<SObjectBatchResult> results = response.getResults(); final SObjectBatchResult batchResult = results.get(0); @SuppressWarnings("unchecked") final Map<String, Object> result = (Map<String, Object>) batchResult.getResult(); @SuppressWarnings("unchecked") final Map<String, Object> limits = (Map<String, Object>) result.getOrDefault("LimitsSnapshot", result); @SuppressWarnings("unchecked") final Map<String, String> apiRequests = (Map<String, String>) limits.get("DailyApiRequests"); assert(Integer.valueOf(String.valueOf(apiRequests.get("Max"))) > 0); }

Target:
public void shouldSupportLimits() { final SObjectBatch batch = new SObjectBatch(version); batch.addLimits(); final SObjectBatchResponse response = testBatch(batch); final List<SObjectBatchResult> results = response.getResults(); final SObjectBatchResult batchResult = results.get(0); @SuppressWarnings("unchecked") final Map<String, Object> result = (Map<String, Object>) batchResult.getResult(); @SuppressWarnings("unchecked") final Map<String, Object> limits = (Map<String, Object>) result.getOrDefault("LimitsSnapshot", result); @SuppressWarnings("unchecked") final Map<String, String> apiRequests = (Map<String, String>) limits.get("DailyApiRequests"); assertTrue(Integer.valueOf(String.valueOf(apiRequests.get("Max"))) > 0); }
Source:
protected final BasicInvocationStage handleNonTxWriteCommand(InvocationContext ctx, AbstractDataWriteCommand command) throws Throwable { if (ctx.isInTxScope()) { throw new CacheException("Attempted execution of non-transactional write command in a transactional invocation context"); } Object key = command.getKey(); CacheEntry entry = ctx.lookupEntry(key); if (entry == null) { if (isLocalModeForced(command)) { entryFactory.wrapExternalEntry(ctx, key, null, true, true); return invokeNext(ctx, command); } else { DistributionInfo info = new DistributionInfo(key, checkTopologyId(command).getWriteConsistentHash(), rpcManager.getAddress()); boolean load = shouldLoad(ctx, command, info); if (info.isPrimary()) { if (load) { CompletableFuture<?> getFuture = remoteGet(ctx, command, true); return invokeNextAsync(ctx, command, getFuture).thenCompose(this::primaryReturnHandler); } else { entryFactory.wrapExternalEntry(ctx, command, null, true, true); return invokeNext(ctx, command).thenCompose(this::primaryReturnHandler); } } else if (ctx.isOriginLocal()) { return invokeRemotely(command, info.primary()); } else { if (load) { CompletableFuture<?> getFuture = remoteGet(ctx, command, true); return invokeNextAsync(ctx, command, getFuture); } else { entryFactory.wrapExternalEntry(ctx, key, null, true, true); return invokeNext(ctx, command); } } } } else if (command.hasFlag(Flag.CACHE_MODE_LOCAL)) { return invokeNext(ctx, command); } else { DistributionInfo info = new DistributionInfo(key, checkTopologyId(command).getWriteConsistentHash(), rpcManager.getAddress()); if (info.isPrimary()) { return invokeNext(ctx, command).thenCompose(this::primaryReturnHandler); } else if (ctx.isOriginLocal()) { return invokeRemotely(command, info.primary()); } else { return invokeNext(ctx, command); } } }

Target:
protected final BasicInvocationStage handleNonTxWriteCommand(InvocationContext ctx, AbstractDataWriteCommand command) throws Throwable { Object key = command.getKey(); CacheEntry entry = ctx.lookupEntry(key); if (isLocalModeForced(command)) { if (entry == null) { entryFactory.wrapExternalEntry(ctx, key, null, true); } return invokeNext(ctx, command); } if (entry == null) { DistributionInfo info = new DistributionInfo(key, checkTopologyId(command).getWriteConsistentHash(), rpcManager.getAddress()); boolean load = shouldLoad(ctx, command, info); if (info.isPrimary()) { throw new IllegalStateException("Primary owner in writeCH should always be an owner in readCH as well."); } else if (ctx.isOriginLocal()) { return invokeRemotely(command, info.primary()); } else { if (load) { CompletableFuture<?> getFuture = remoteGet(ctx, command, command.getKey(), true); return invokeNextAsync(ctx, command, getFuture); } else { entryFactory.wrapExternalEntry(ctx, key, null, true); return invokeNext(ctx, command); } } } else { DistributionInfo info = new DistributionInfo(key, checkTopologyId(command).getWriteConsistentHash(), rpcManager.getAddress()); if (info.isPrimary()) { return invokeNext(ctx, command).thenCompose(this::primaryReturnHandler); } else if (ctx.isOriginLocal()) { return invokeRemotely(command, info.primary()); } else { return invokeNext(ctx, command); } } }
Source:
private Builder addValue(String memberName, Object value) { if (value instanceof Class<?>) { return addMember(memberName, "$T.class", value); } if (value instanceof Enum) { return addMember(memberName, "$T.$L", value.getClass(), ((Enum<?>) value).name()); } if (value instanceof String) { return addMember(memberName, "$S", value); } if (value instanceof Float) { return addMember(memberName, "$Lf", value); } if (value instanceof Character) { String format = Character.valueOf('\'').equals(value) ? "'\\\''" : "'$L'"; return addMember(memberName, format, value); } return addMember(memberName, "$L", value); }

Target:
private Builder addValue(String memberName, Object value) { if (value instanceof Class<?>) { return addMember(memberName, "$T.class", value); } if (value instanceof Enum) { return addMember(memberName, "$T.$L", value.getClass(), ((Enum<?>) value).name()); } if (value instanceof String) { return addMember(memberName, "$S", value); } if (value instanceof Float) { return addMember(memberName, "$Lf", value); } if (value instanceof Character) { String literal = CodeWriter.stringLiteral(value.toString(), ""); literal = literal.substring(1, literal.length() - 1); if (literal.equals("\\\"")) literal = "\""; if (literal.equals("'")) literal = "\\'"; return addMember(memberName, "'$L'", literal); } return addMember(memberName, "$L", value); }
Source:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptyTopEvent = getCatchingIntermediateNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptyTopEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptyTopEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptyTopEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
private boolean parseLongFlag(CommandSource source, String longFlag, CommandArgs args, CommandContext context) throws ArgumentParseException { String[] flagSplit = longFlag.split("=", 2); CommandElement element = this.longFlags.get(flagSplit[0].toLowerCase()); if (element == null) { switch (this.unknownLongFlagBehavior) { case ERROR: throw args.createError(t("Unknown long flag %s specified", flagSplit[0])); case ACCEPT_NONVALUE: context.putArg(flagSplit[0], flagSplit.length == 2 ? flagSplit[1] : true); return true; case ACCEPT_VALUE: context.putArg(flagSplit[0], flagSplit.length == 2 ? flagSplit[1] : args.next()); return true; case IGNORE: return false; default: throw new Error("New UnknownFlagBehavior added without corresponding case clauses"); } } else if (flagSplit.length == 2) { args.insertArg(flagSplit[1]); } element.parse(source, args, context); return true; }

Target:
private boolean parseLongFlag(CommandSource source, String longFlag, CommandArgs args, CommandContext context) throws ArgumentParseException { String[] flagSplit = longFlag.split("=", 2); String flag = flagSplit[0].toLowerCase(); CommandElement element = this.longFlags.get(flag); if (element == null) { switch (this.unknownLongFlagBehavior) { case ERROR: throw args.createError(t("Unknown long flag %s specified", flagSplit[0])); case ACCEPT_NONVALUE: context.putArg(flag, flagSplit.length == 2 ? flagSplit[1] : true); return true; case ACCEPT_VALUE: context.putArg(flag, flagSplit.length == 2 ? flagSplit[1] : args.next()); return true; case IGNORE: return false; default: throw new Error("New UnknownFlagBehavior added without corresponding case clauses"); } } else if (flagSplit.length == 2) { args.insertArg(flagSplit[1]); } element.parse(source, args, context); return true; }
Source:
BasicListBuilder(String delimiter, Transform<T> transform) { this.delimiter = delimiter; this.transform = transform != null ? transform : (builder, input) -> builder.append(input); }

Target:
BasicListBuilder(String delimiter, Transform<T> transform) { this.delimiter = delimiter; this.transform = transform != null ? transform : ExpressionBuilder::append; }
Source:
private TransactionParser buildUserParser(KXmlParser parser) { return new UserXmlParser(parser) { @Override protected void commit(User parsed) throws IOException, UnfullfilledRequirementsException { if (!parsed.getUserType().equals(User.TYPE_DEMO)) { throw new UnfullfilledRequirementsException( "Demo user restore file must be for a user with user_type set to demo", CommCareElementParser.SEVERITY_PROMPT); } if ("".equals(parsed.getUsername()) || parsed.getUsername() == null) { throw new UnfullfilledRequirementsException( "Demo user restore file must specify a username in the Registration block", CommCareElementParser.SEVERITY_PROMPT); } else { OfflineUserRestore.this.username = parsed.getUsername(); } } @Override public User retrieve(String entityId) { return null; } }; }

Target:
private TransactionParser buildUserParser(KXmlParser parser) { return new UserXmlParser(parser) { @Override protected void commit(User parsed) throws IOException, InvalidStructureException { if (!parsed.getUserType().equals(User.TYPE_DEMO)) { throw new InvalidStructureException( "Demo user restore file must be for a user with user_type set to demo"); } if ("".equals(parsed.getUsername()) || parsed.getUsername() == null) { throw new InvalidStructureException( "Demo user restore file must specify a username in the Registration block"); } else { OfflineUserRestore.this.username = parsed.getUsername(); } } @Override public User retrieve(String entityId) { return null; } }; }
Source:
public final byte[] getByteArray(final Message message) { if (message == null) { throw new NullPointerException("message must not be null!"); } DatagramWriter messageWriter = new DatagramWriter(); if (message.getRawCode() == 0) { if (message.getType() == Type.NON) { throw new IllegalArgumentException("NON message must not use code 0 (empty message)!"); } if (!message.getToken().isEmpty()) { throw new IllegalArgumentException("Empty messages must not use a token!"); } MessageHeader header = new MessageHeader(CoAP.VERSION, message.getType(), message.getToken(), 0, message.getMID(), 0); serializeHeader(messageWriter, header); messageWriter.writeCurrentByte(); } else { DatagramWriter optionsAndPayloadWriter = new DatagramWriter(); serializeOptionsAndPayload(optionsAndPayloadWriter, message.getOptions(), message.getPayload()); optionsAndPayloadWriter.writeCurrentByte(); MessageHeader header = new MessageHeader(CoAP.VERSION, message.getType(), message.getToken(), message.getRawCode(), message.getMID(), optionsAndPayloadWriter.size()); serializeHeader(messageWriter, header); messageWriter.writeCurrentByte(); messageWriter.write(optionsAndPayloadWriter); } return messageWriter.toByteArray(); }

Target:
public final byte[] getByteArray(final Message message) { if (message == null) { throw new NullPointerException("message must not be null!"); } DatagramWriter messageWriter = new DatagramWriter(); if (message.getRawCode() == 0) { if (message.getType() == Type.NON) { throw new IllegalArgumentException("NON message must not use code 0 (empty message)!"); } else if (!message.getToken().isEmpty()) { throw new IllegalArgumentException("Empty messages must not use a token!"); } else if (message.getPayloadSize() > 0) { throw new IllegalArgumentException("Empty messages must not contain payload!"); } MessageHeader header = new MessageHeader(CoAP.VERSION, message.getType(), message.getToken(), 0, message.getMID(), 0); serializeHeader(messageWriter, header); messageWriter.writeCurrentByte(); } else { DatagramWriter optionsAndPayloadWriter = new DatagramWriter(); serializeOptionsAndPayload(optionsAndPayloadWriter, message.getOptions(), message.getPayload()); optionsAndPayloadWriter.writeCurrentByte(); MessageHeader header = new MessageHeader(CoAP.VERSION, message.getType(), message.getToken(), message.getRawCode(), message.getMID(), optionsAndPayloadWriter.size()); serializeHeader(messageWriter, header); messageWriter.writeCurrentByte(); messageWriter.write(optionsAndPayloadWriter); } return messageWriter.toByteArray(); }
Source:
public void testSTIsEmpty() throws Exception { assertQuery("select st_is_empty(st_geometry_from_text('POINT (1.5 2.5)'))", "select false"); }

Target:
public void testSTIsEmpty() throws Exception { assertFunction("ST_IsEmpty(ST_GeometryFromText('POINT (1.5 2.5)'))", BOOLEAN, false); assertFunction("ST_IsEmpty(ST_GeometryFromText('POLYGON EMPTY'))", BOOLEAN, true); }
Source:
public Boolean isNewUser() { return newUser; }

Target:
public boolean isNewUser() { return newUser; }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getNewCommand()) { newSubnet(); } else if (command == getRemoveCommand()) { remove(); } else if ("Cancel".equals(command.getName())) { cancel(); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getNewCommand()) { newSubnet(); } else if (command == getRemoveCommand()) { remove(); } }
Source:
public void testCompletedFuturesContext() { waitFor(4); Thread testThread = Thread.currentThread(); ContextInternal context = (ContextInternal) vertx.getOrCreateContext(); Future.succeededFuture().onSuccess(v -> { assertSame(testThread, Thread.currentThread()); assertNull(Vertx.currentContext()); complete(); }); context.succeededFuture().onSuccess(v -> { assertNotSame(testThread, Thread.currentThread()); assertSame(context, Vertx.currentContext()); complete(); }); Future.failedFuture(new Exception()).onFailure(v -> { assertSame(testThread, Thread.currentThread()); assertNull(Vertx.currentContext()); complete(); }); context.failedFuture(new Exception()).onFailure(v -> { assertNotSame(testThread, Thread.currentThread()); assertSame(context, Vertx.currentContext()); complete(); }); await(); }

Target:
public void testCompletedFuturesContext() throws Exception { waitFor(4); Thread testThread = Thread.currentThread(); ContextInternal context = (ContextInternal) vertx.getOrCreateContext(); CompletableFuture<Thread> cf = new CompletableFuture<>(); context.runOnContext(v -> cf.complete(Thread.currentThread())); Thread contextThread = cf.get(); Future.succeededFuture().onSuccess(v -> { assertSame(testThread, Thread.currentThread()); assertNull(Vertx.currentContext()); complete(); }); context.succeededFuture().onSuccess(v -> { assertNotSame(testThread, Thread.currentThread()); assertSame(context, Vertx.currentContext()); assertSame(contextThread, Thread.currentThread()); complete(); }); Future.failedFuture(new Exception()).onFailure(v -> { assertSame(testThread, Thread.currentThread()); assertNull(Vertx.currentContext()); complete(); }); context.failedFuture(new Exception()).onFailure(v -> { assertNotSame(testThread, Thread.currentThread()); assertSame(context, Vertx.currentContext()); assertSame(contextThread, Thread.currentThread()); complete(); }); await(); }
Source:
public void redeployAll() { Map<String, String> wars = MutableMap.copyOf(getConfig(WARS_BY_CONTEXT)); String redeployPrefix = "Redeploy all WARs (count "+wars.size()+")"; log.debug("Redeplying all WARs across cluster "+this+": "+getConfig(WARS_BY_CONTEXT)); Iterable<CanDeployAndUndeploy> targets = Iterables.filter(getChildren(), CanDeployAndUndeploy.class); TaskBuilder<Void> tb = Tasks.<Void>builder().parallel(true).name(redeployPrefix+" across cluster (size "+Iterables.size(targets)+")"); for (Entity target: targets) { TaskBuilder<Void> redeployAllToTarget = Tasks.<Void>builder().name(redeployPrefix+" at "+target+" (after ready check)"); for (String targetName: wars.keySet()) { redeployAllToTarget.add(Effectors.invocation(target, DEPLOY, MutableMap.of("url", wars.get(targetName), "targetName", targetName))); } tb.add(whenServiceUp(target, redeployAllToTarget.build(), redeployPrefix+" at "+target+" when ready")); } DynamicTasks.queueIfPossible(tb.build()).orSubmitAsync(this).asTask().getUnchecked(); }

Target:
public void redeployAll() { Map<String, String> wars = MutableMap.copyOf(getConfig(WARS_BY_CONTEXT)); String redeployPrefix = "Redeploy all WARs (count "+wars.size()+")"; log.debug("Redeplying all WARs across cluster "+this+": "+getConfig(WARS_BY_CONTEXT)); Iterable<CanDeployAndUndeploy> targetEntities = Iterables.filter(getChildren(), CanDeployAndUndeploy.class); TaskBuilder<Void> tb = Tasks.<Void>builder().parallel(true).name(redeployPrefix+" across cluster (size "+Iterables.size(targetEntities)+")"); for (Entity targetEntity: targetEntities) { TaskBuilder<Void> redeployAllToTarget = Tasks.<Void>builder().name(redeployPrefix+" at "+targetEntity+" (after ready check)"); for (String warContextPath: wars.keySet()) { redeployAllToTarget.add(Effectors.invocation(targetEntity, DEPLOY, MutableMap.of("url", wars.get(warContextPath), "targetName", warContextPath))); } tb.add(whenServiceUp(targetEntity, redeployAllToTarget.build(), redeployPrefix+" at "+targetEntity+" when ready")); } DynamicTasks.queueIfPossible(tb.build()).orSubmitAsync(this).asTask().getUnchecked(); }
Source:
public FileBasedConfig openUserConfig(Config parent, FS fs) { final File home = fs.userHome(); File userConfig = new File(home, ".gitconfig"); try { userConfig.canRead(); } catch (AccessControlException e) { return new FileBasedConfig(null, fs) { public void load() { } public boolean isOutdated() { return false; } }; } return new FileBasedConfig(parent, userConfig, fs); }

Target:
public FileBasedConfig openUserConfig(Config parent, FS fs) { final File home = fs.userHome(); File userConfig = new File(home, ".gitconfig"); try { userConfig.canRead(); } catch (AccessControlException e) { return new FileBasedConfig(parent, null, fs) { public void load() { } public boolean isOutdated() { return false; } }; } return new FileBasedConfig(parent, userConfig, fs); }
Source:
protected void executeCommand() { updateQuotaCache(); copyUnchangedStoragePoolProperties(getStoragePool(), oldStoragePool); TransactionSupport.executeInScope(TransactionScopeOption.RequiresNew, () -> { getStoragePoolDao().updatePartial(getStoragePool()); moveMacsFromOldMacPoolToNewOne(); return null; }); updateStoragePoolFormatType(); setSucceeded(true); }

Target:
protected void executeCommand() { Guid oldMacPoolId = getOldMacPoolId(); Guid newMacPoolId = getNewMacPoolId(); Objects.requireNonNull(oldMacPoolId); Objects.requireNonNull(newMacPoolId); boolean needToMigrateMacs = !oldMacPoolId.equals(newMacPoolId); updateQuotaCache(); copyUnchangedStoragePoolProperties(getStoragePool(), oldStoragePool); List<String> vmInterfaceMacs = null; if (needToMigrateMacs) { vmInterfaceMacs = vmNicDao.getAllMacsByDataCenter(getParameters().getStoragePoolId()); } getStoragePoolDao().updatePartial(getStoragePool()); if (needToMigrateMacs) { moveMacsOfUpdatedDataCenter(oldMacPoolId, newMacPoolId, vmInterfaceMacs); } updateStoragePoolFormatType(); setSucceeded(true); }
Source:
public static ThrottleLimitDTO getThrottleLimitType(ThrottleLimitTypeDTO dto) throws UnsupportedThrottleLimitTypeException { if (dto.getBandwidth() != null && dto.getRequestCount() != null) { String msg = "Throttle limit types " + dto.getBandwidth().getClass().getName() + " and " + dto.getRequestCount().getClass().getName() + " cannot be specified at once"; log.error(msg); throw new UnsupportedThrottleLimitTypeException(msg); } else if (dto.getBandwidth() != null) { return dto.getBandwidth(); } else if (dto.getRequestCount() != null) { return dto.getRequestCount(); } else { String msg = "A Throttle limit type has not been specified"; log.error(msg); throw new UnsupportedThrottleLimitTypeException(msg); } }

Target:
public static ThrottleLimitDTO getThrottleLimitType(ThrottleLimitTypeDTO dto) throws UnsupportedThrottleLimitTypeException { if (dto.getBandwidth() != null && dto.getRequestCount() != null) { String msg = "Throttle limit types " + dto.getBandwidth().getClass().getName() + " and " + dto.getRequestCount().getClass().getName() + " cannot be specified at once"; throw new UnsupportedThrottleLimitTypeException(msg); } else if (dto.getBandwidth() != null) { return dto.getBandwidth(); } else if (dto.getRequestCount() != null) { return dto.getRequestCount(); } else { throw new UnsupportedThrottleLimitTypeException("A Throttle limit type has not been specified"); } }
Source:
XmlManifest(RepoCommand command, InputStream inputStream, String filename, String baseUrl, String groups) { this.command = command; this.inputStream = inputStream; this.filename = filename; int lastIndex = baseUrl.length() - 1; while (baseUrl.charAt(lastIndex) == '/') lastIndex--; this.baseUrl = baseUrl.substring(0, lastIndex + 1); remotes = new HashMap<String, String>(); projects = new ArrayList<Project>(); plusGroups = new HashSet<String>(); minusGroups = new HashSet<String>(); if (groups == null || groups.length() == 0 || groups.equals("default")) { minusGroups.add("notdefault"); } else { for (String group : groups.split(",")) { if (group.startsWith("-")) minusGroups.add(group.substring(1)); else plusGroups.add(group); } } }

Target:
XmlManifest(RepoCommand command, InputStream inputStream, String filename, String baseUrl, String groups) { this.command = command; this.inputStream = inputStream; this.filename = filename; int lastIndex = baseUrl.length() - 1; while (lastIndex >= 0 && baseUrl.charAt(lastIndex) == '/') lastIndex--; this.baseUrl = baseUrl.substring(0, lastIndex + 1); remotes = new HashMap<String, String>(); projects = new ArrayList<Project>(); plusGroups = new HashSet<String>(); minusGroups = new HashSet<String>(); if (groups == null || groups.length() == 0 || groups.equals("default")) { minusGroups.add("notdefault"); } else { for (String group : groups.split(",")) { if (group.startsWith("-")) minusGroups.add(group.substring(1)); else plusGroups.add(group); } } }
Source:
public void changeUserPasswordUsingActivationKey_shouldNotUpdatePasswordIfActivationKeyIsIncorrect() { User u = new User(); u.setPerson(new Person()); u.addName(new PersonName("Benjamin", "A", "Wolfe")); u.setUsername("bwolfe"); u.getPerson().setGender("M"); User createdUser = userService.createUser(u, "Openmr5xy"); String key = "wrongactivationkeyin"; int validTime = 10 * 60 * 1000; Long tokenTime = System.currentTimeMillis() + validTime; LoginCredential credentials = dao.getLoginCredential(createdUser); credentials.setActivationKey( "b071c88d6d877922e35af2e6a90dd57d37ac61143a03bb986c5f353566f3972a86ce9b2604c31a22dfa467922dcfd54fa7d18b0a7c7648d94ca3d97a88ea2fd0:" + tokenTime); dao.updateLoginCredential(credentials); Context.authenticate(createdUser.getUsername(), "Openmr5xy"); expectedException.expect(UserNotFoundException.class); expectedException.expectMessage(messages.getMessage("activation.key.not.correct")); userService.changeUserPasswordUsingActivationKey(key, "Pa55w0rd"); }

Target:
public void changeUserPasswordUsingActivationKey_shouldNotUpdatePasswordIfActivationKeyIsIncorrect() { User u = new User(); u.setPerson(new Person()); u.addName(new PersonName("Benjamin", "A", "Wolfe")); u.setUsername("bwolfe"); u.getPerson().setGender("M"); User createdUser = userService.createUser(u, "Openmr5xy"); String key = "wrongactivationkeyin"; Context.authenticate(createdUser.getUsername(), "Openmr5xy"); expectedException.expect(InvalidActivationKeyException.class); expectedException.expectMessage(messages.getMessage("activation.key.not.correct")); userService.changeUserPasswordUsingActivationKey(key, "Pa55w0rd"); }
Source:
private static boolean overlaps(SAMRecord r, List<Locatable> intervals) { if (intervals == null) { return true; } for (Locatable interval : intervals) { if (r.getReadUnmappedFlag()) { if (r.getAlignmentStart() != SAMRecord.NO_ALIGNMENT_START && interval.getStart() <= r.getStart() && interval.getEnd() >= r.getStart()) { return true; } } else if (r.getContig().equals(interval.getContig()) && CoordMath.overlaps(r.getStart(), r.getEnd(), interval.getStart(), interval.getEnd())) { return true; } } return false; }

Target:
private static boolean overlaps(SAMRecord r, List<Locatable> intervals) { if (intervals == null || (r.getReadUnmappedFlag() && r.getAlignmentStart() == SAMRecord.NO_ALIGNMENT_START)) { return true; } for (Locatable interval : intervals) { if (r.getReadUnmappedFlag()) { if (interval.getStart() <= r.getStart() && interval.getEnd() >= r.getStart()) { return true; } } else if (r.getContig().equals(interval.getContig()) && CoordMath.overlaps(r.getStart(), r.getEnd(), interval.getStart(), interval.getEnd())) { return true; } } return false; }
Source:
public boolean repeatUntilResponseStatusIs(final int expectedStatus) { doNotThrowExceptionOnHttpRequestFailure(); return repeatUntil( new RepeatLastCall() { @Override public boolean isFinished() { return responseStatus() == expectedStatus; } }); }

Target:
public boolean repeatUntilResponseStatusIs(final int expectedStatus) { return repeatUntil( new RepeatLastCall() { @Override public boolean isFinished() { return responseStatus() == expectedStatus; } }); }
Source:
private PlatformSession platformLogin() throws BonitaException, IOException { PlatformLoginAPI platformLoginAPI = PlatformAPIAccessor.getPlatformLoginAPI(); if (isLocal()) { try { Class<?> api = Class.forName("org.bonitasoft.engine.api.impl.PlatformLoginAPIImpl"); return (PlatformSession) api.getDeclaredMethod("localLogin").invoke(api.newInstance()); } catch (Exception e) { throw new ServerAPIException("unable to do the local login", e); } } else { return platformLoginAPI.login(System.getProperty("org.bonitasoft.platform.username"), System.getProperty("org.bonitasoft.platform.password")); } }

Target:
private PlatformSession platformLogin() throws BonitaException, IOException { if (isLocal()) { try { Class<?> api = Class.forName("org.bonitasoft.engine.api.impl.PlatformLoginAPIImpl"); return (PlatformSession) api.getDeclaredMethod("localLogin").invoke(api.newInstance()); } catch (Exception e) { throw new ServerAPIException("unable to do the local login", e); } } else { return PlatformAPIAccessor.getPlatformLoginAPI().login(System.getProperty("org.bonitasoft.platform.username"), System.getProperty("org.bonitasoft.platform.password")); } }
Source:
public @CheckForNull Permission getRequiredPermission() { return Jenkins.ADMINISTER; }

Target:
public @Nonnull Permission getRequiredPermission() { return Jenkins.ADMINISTER; }
Source:
public static String sanitizeKey(final Contentlet vanityUrl) throws DotDataException, DotRuntimeException, DotSecurityException { Host host = hostAPI.find(vanityUrl.getStringProperty(VanityUrlContentType.SITE_FIELD_VAR), APILocator.systemUser(), false); return sanitizeKey(host.getIdentifier(), fixURI(vanityUrl.getStringProperty(VanityUrlContentType.URI_FIELD_VAR)), vanityUrl.getLanguageId()); }

Target:
public static String sanitizeKey(final Contentlet vanityUrl) throws DotDataException, DotSecurityException { Host host = hostAPI.find(vanityUrl.getStringProperty(VanityUrlContentType.SITE_FIELD_VAR), APILocator.systemUser(), false); return sanitizeKey(host.getIdentifier(), fixURI(vanityUrl.getStringProperty(VanityUrlContentType.URI_FIELD_VAR)), vanityUrl.getLanguageId()); }
Source:
public void submitCategory() { pressEnter(categoryInput); }

Target:
public void submitCategory() { pressEnter(categoryInput); PageObjectLogging.log("submitCategory", "category submitted", true); }
Source:
public Content readme() { return new RtReadme(this.request); }

Target:
public Content readme() { return new RtReadme(this.entry, this.owner); }
Source:
public Map<Long, String> getFirmwareHistory(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @PathParam("device_id") final String deviceId) { if(deviceId == null) { LOGGER.error("Missing device_id parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } final Jedis jedis = jedisPool.getResource(); final TreeMap<Long, String> fwHistory = new TreeMap<>(); try { final Set<Tuple> seenFirmwares = jedis.zrangeWithScores(REDIS_SEEN_FIRMWARE_KEY, 0, -1); for (final Tuple fwInfo:seenFirmwares) { final long lastSeen = (long) fwInfo.getScore(); fwHistory.put(lastSeen, fwInfo.getElement()); } } catch (Exception e) { LOGGER.error("Failed retrieving fw history for device.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return fwHistory; }

Target:
public TreeMap<Long, String> getFirmwareHistory(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @PathParam("device_id") final String deviceId) { if(deviceId == null) { LOGGER.error("Missing device_id parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } final Jedis jedis = jedisPool.getResource(); final TreeMap<Long, String> fwHistory = Maps.newTreeMap(); try { final Set<Tuple> seenFirmwares = jedis.zrangeWithScores(REDIS_SEEN_FIRMWARE_KEY, 0, -1); for (final Tuple fwInfo:seenFirmwares) { final long lastSeen = (long) fwInfo.getScore(); fwHistory.put(lastSeen, fwInfo.getElement()); } } catch (Exception e) { LOGGER.error("Failed retrieving fw history for device.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return fwHistory; }
Source:
public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); v.setBackgroundColor(Color.TRANSPARENT); if (mSelection.get(position) != null) { v.setBackgroundColor(parent.getResources().getColor(R.color.emphasis)); } return v; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); if (mSelection.get(position) != null) { v.setBackgroundColor(parent.getResources().getColor(R.color.emphasis)); } else { v.setBackgroundColor(Color.TRANSPARENT); } return v; }
Source:
public List<String> getParentNames() { if (parents == null || parents.size() == 0) return null; List<String> st = new ArrayList<String>(); for (Project.NameKey name : parents) st.add(name.get()); return st; }

Target:
public List<String> getParentNames() { if (parents == null || parents.size() == 0) { return Collections.emptyList(); } List<String> st = new ArrayList<String>(parents.size()); for (Project.NameKey name : parents) { st.add(name.get()); } return st; }
Source:
public boolean isFlattened() { int n = numGeometries(); if (n > 3) return false; for (int i = 0; i < n; ++i) { OGCGeometry g = geometryN(i); if (g.isEmpty()) return false; String t = g.geometryType(); if (t != OGCMultiPoint.TYPE && t != OGCMultiPolygon.TYPE && t != OGCMultiLineString.TYPE) return false; } return true; }

Target:
public boolean isFlattened() { int n = numGeometries(); if (n > 3) return false; int dimension = -1; for (int i = 0; i < n; ++i) { OGCGeometry g = geometryN(i); if (g.isEmpty()) return false; String t = g.geometryType(); if (t != OGCMultiPoint.TYPE && t != OGCMultiPolygon.TYPE && t != OGCMultiLineString.TYPE) return false; int d = g.dimension(); if (d <= dimension) return false; dimension = d; } return true; }
Source:
public String getTitle() { return "Empty Project Screen"; }

Target:
public String getTitle() { return ts.getTranslation( LibraryConstants.EmptyLibraryScreen ); }
Source:
private void assertValid(float num) { if(num == Float.NaN) { throw new RuntimeException("Direction can not take a NaN float as an argument"); } else if (num == Float.NEGATIVE_INFINITY || num == Float.POSITIVE_INFINITY) { throw new RuntimeException("Direction can not take +/- infinity as an argument"); } }

Target:
private void assertValid(float num) { if(Float.isNaN(num)) { throw new RuntimeException("Direction can not take a NaN float as an argument"); } else if (Float.isInfinite(num)) { throw new RuntimeException("Direction can not take +/- infinity as an argument"); } }
Source:
private void initMetadataMap(EntityMetadata emd, String entityName, String rootRequestVersion) { metadataMap.put(entityName, emd); Set<String> deferred = new HashSet<>(); FieldCursor cursor = emd.getFieldCursor(); while (cursor.next()) { FieldTreeNode node = cursor.getCurrentNode(); if (node instanceof ReferenceField) { ReferenceField ref = (ReferenceField) node; String name = ref.getEntityName(); String ver = ref.getVersionValue(); EntityMetadata refMd; if (ver == emd.getEntityInfo().getDefaultVersion()) { refMd = metadataMap.get(entityName); } else { refMd = md.getEntityMetadata(name, ver); } if (refMd == null || refMd.getEntitySchema() == null) { throw Error.get(CrudConstants.ERR_UNKNOWN_ENTITY, name + ":" + ver); } else if (refMd.getEntitySchema().getStatus() == MetadataStatus.DISABLED) { throw Error.get(CrudConstants.ERR_DISABLED_METADATA, name + ":" + ver); } String defaultVer = refMd.getEntityInfo().getDefaultVersion(); EntityMetadata found = metadataMap.get(name); if (found != null) { String foundVer = found.getVersion().getValue(); if (isValidReference(foundVer, rootRequestVersion, defaultVer)) { if (ver != defaultVer) { metadataMap.put(name, refMd); } else { deferred.add(name); } } else { throw Error.get(CrudConstants.ERR_METADATA_APPEARS_TWICE, name + ":" + ver + " and " + foundVer); } } else { if (ver != defaultVer) { metadataMap.put(name, refMd); } else { deferred.add(name); } } } } deferred.forEach(n -> { String def = md.getEntityInfo(n).getDefaultVersion(); metadataMap.put(n, md.getEntityMetadata(n, def)); }); }

Target:
private void initMetadataMap(EntityMetadata emd, String entityName, String rootRequestVersion) { metadataMap.put(entityName, emd); Set<String> deferred = new HashSet<>(); FieldCursor cursor = emd.getFieldCursor(); while (cursor.next()) { FieldTreeNode node = cursor.getCurrentNode(); if (node instanceof ReferenceField) validateRefField(emd, entityName, rootRequestVersion, deferred, (ReferenceField) node); } deferred.forEach(n -> { String def = md.getEntityInfo(n).getDefaultVersion(); if (def == null) { throw Error.get(CrudConstants.ERR_UNKNOWN_ENTITY, n + ":default"); } metadataMap.put(n, md.getEntityMetadata(n, def)); }); }
Source:
public String convertToDatabaseColumn(Map<String, String> attribute) { ObjectMapper mapper = new ObjectMapper(); try { return (mapper.writeValueAsString(attribute)); } catch (Exception e) { LOG.warn("Could not convert JSON value to PostgreSQL format: " + e.getMessage()); LOG.debug("Stack trace: " + e.toString()); } return "{}"; }

Target:
public String convertToDatabaseColumn(Map<String, String> attribute) { Shogun2JsonObjectMapper mapper = new Shogun2JsonObjectMapper(); try { return (mapper.writeValueAsString(attribute)); } catch (Exception e) { LOG.warn("Could not convert JSON value to PostgreSQL format: " + e.getMessage()); LOG.debug("Stack trace: " + e.toString()); } return "{}"; }
Source:
public FeedbackQuestionDetails getQuestionDetails() { if (questionType == FeedbackQuestionType.TEXT && !isJsonValid(questionMetaData.getValue())) { return new FeedbackTextQuestionDetails(questionMetaData.getValue()); } Gson gson = Utils.getTeammatesGson(); return gson.fromJson(questionMetaData.getValue(), getFeedbackQuestionDetailsClass()); }

Target:
public FeedbackQuestionDetails getQuestionDetails() { final String questionMetaDataValue = questionMetaData.getValue(); if (questionType == FeedbackQuestionType.TEXT && !isValidJsonString(questionMetaDataValue)) { return new FeedbackTextQuestionDetails(questionMetaDataValue); } Gson gson = Utils.getTeammatesGson(); return gson.fromJson(questionMetaDataValue, getFeedbackQuestionDetailsClass()); }
Source:
protected T query(Uri uri) { Cursor cursor = contentResolver.query(uri, SerializedJsonContract.PROJECTION, null, null, null); T gitHubRepository = null; if (cursor.moveToFirst()) { final String json = cursor.getString(cursor.getColumnIndex(GitHubRepositoryContract.JSON)); gitHubRepository = new Gson().fromJson(json, type); } else { Log.e(TAG, "Could not find with id: " + uri); } cursor.close(); Log.d(TAG, "" + gitHubRepository); return gitHubRepository; }

Target:
protected T query(Uri uri) { Cursor cursor = contentResolver.query(uri, SerializedJsonContract.PROJECTION, null, null, null); T value = null; if (cursor.moveToFirst()) { final String json = cursor.getString(cursor.getColumnIndex(SerializedJsonContract.JSON)); value = new Gson().fromJson(json, type); } else { Log.e(TAG, "Could not find with id: " + uri); } cursor.close(); Log.d(TAG, "" + value); return value; }
Source:
public Object invoke(MethodInvocation invocation) throws Throwable { Object[] args = invocation.getArguments(); if (args.length > 0) { arguments.add(args); } Object result = invocation.proceed(); if (args.length > 0 && result != null) { this.returns.put(result); } return result; }

Target:
public Object invoke(MethodInvocation invocation) throws Throwable { Object result = null; boolean isListenerMethod = AnnotationUtils.findAnnotation(invocation.getMethod(), RabbitListener.class) != null || AnnotationUtils.findAnnotation(invocation.getMethod(), RabbitHandler.class) != null; try { result = invocation.proceed(); if (isListenerMethod) { this.invocationData.put(new InvocationData(invocation, result)); } } catch (Throwable t) { if (isListenerMethod) { this.invocationData.put(new InvocationData(invocation, t)); } throw t; } return result; }
Source:
public void onFoldChange(FoldChangeEvent event) { checkForRemove_ = true; }

Target:
public void onFoldChange(FoldChangeEvent event) { if (folded_ != folded()) { folded_ = folded(); if (folded_) { widget_.setVisible(false); } else { widget_.setVisible(true); } return; } checkForRemove_ = true; }
Source:
@Deprecated public RequestCreator skipMemoryCache() { return memoryPolicy(NO_CACHE); }

Target:
@Deprecated public RequestCreator skipMemoryCache() { return memoryPolicy(NO_CACHE, NO_STORE); }
Source:
public void testCanEditTransientAttribute() throws InterruptedException { final String serviceName = createUniqueBusinessServiceName(); BsmAdminPageEditWindow bsmAdminPageEditWindow = bsmAdminPage.openNewDialog(serviceName).addAttribute("foo", "bar"); wait.until(pageContainsText("foo=bar")); bsmAdminPageEditWindow.cancel(); }

Target:
public void testCanEditTransientAttribute() throws InterruptedException { final String serviceName = createUniqueBusinessServiceName(); BsmAdminPageEditWindow bsmAdminPageEditWindow = bsmAdminPage.openNewDialog(serviceName).addAttribute("foo", "bar"); wait.until(pageContainsText("foo=bar")); bsmAdminPageEditWindow.save(); bsmAdminPageEditWindow = bsmAdminPage.openEditDialog(serviceName).editAttribute("foo=bar", "123"); verifyElementPresent("foo=123"); bsmAdminPageEditWindow.cancel(); bsmAdminPageEditWindow = bsmAdminPage.openEditDialog(serviceName); verifyElementNotPresent("foo=123"); bsmAdminPageEditWindow.cancel(); bsmAdminPage.delete(serviceName); }
Source:
public abstract MultiEnvironment bind(@Nonnull Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException; public abstract Set<String> variables(); protected final @Nonnull C getCredentials(@Nonnull Run<?,?> build) throws IOException { IdCredentials cred = CredentialsProvider.findCredentialById(credentialsId, IdCredentials.class, build); CredentialsProvider.track(build, cred); if (cred==null) throw new CredentialNotFoundException(credentialsId); if (type().isInstance(cred)) return type().cast(cred); Descriptor expected = Jenkins.getActiveInstance().getDescriptor(type()); throw new CredentialNotFoundException("Credentials '"+credentialsId+"' is of type '"+ cred.getDescriptor().getDisplayName()+"' where '"+ (expected!=null ? expected.getDisplayName() : type().getName())+ "' was expected"); }

Target:
public abstract MultiEnvironment bind(@Nonnull Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException; public abstract Set<String> variables(); protected final @Nonnull C getCredentials(@Nonnull Run<?,?> build) throws IOException { IdCredentials cred = CredentialsProvider.findCredentialById(credentialsId, IdCredentials.class, build); if (cred==null) throw new CredentialNotFoundException(credentialsId); if (type().isInstance(cred)) { CredentialsProvider.track(build, cred); return type().cast(cred); } Descriptor expected = Jenkins.getActiveInstance().getDescriptor(type()); throw new CredentialNotFoundException("Credentials '"+credentialsId+"' is of type '"+ cred.getDescriptor().getDisplayName()+"' where '"+ (expected!=null ? expected.getDisplayName() : type().getName())+ "' was expected"); }
Source:
private void createOpenShiftConnectionControl(Composite parent, DataBindingContext dbc) { Label lblConnection = new Label(parent, SWT.NONE); lblConnection.setText("OpenShift Connection: "); GridDataFactory.fillDefaults() .align(SWT.FILL, SWT.CENTER) .applyTo(lblConnection); final Text connectionText = new Text(parent, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.fillDefaults() .align(SWT.FILL, SWT.CENTER) .span(2, 1) .grab(true, false) .applyTo(connectionText); final IObservableValue connnectionTextObservable = WidgetProperties.text(SWT.None).observe(connectionText); final IObservableValue connnectionObservable = BeanProperties.value(IDeployImagePageModel.PROPERTY_CONNECTION).observe(model); ValueBindingBuilder.bind(connnectionTextObservable) .to(connnectionObservable) .converting(new ObjectToStringConverter(Connection.class) { ConnectionColumLabelProvider labelProvider = new ConnectionColumLabelProvider(); @Override public Object convert(Object source) { return source == null ? "" : labelProvider.getText(source); } }) .in(dbc); }

Target:
private void createOpenShiftConnectionControl(Composite parent, DataBindingContext dbc) { Label lblConnection = new Label(parent, SWT.NONE); lblConnection.setText("OpenShift Connection: "); GridDataFactory.fillDefaults() .align(SWT.FILL, SWT.CENTER) .applyTo(lblConnection); final Text connectionText = new Text(parent, SWT.BORDER | SWT.READ_ONLY); connectionText.setBackground(lblConnection.getBackground()); GridDataFactory.fillDefaults() .align(SWT.FILL, SWT.CENTER) .span(2, 1) .grab(true, false) .applyTo(connectionText); final IObservableValue connnectionTextObservable = WidgetProperties.text(SWT.None).observe(connectionText); final IObservableValue connnectionObservable = BeanProperties.value(IDeployImagePageModel.PROPERTY_CONNECTION).observe(model); ValueBindingBuilder.bind(connnectionTextObservable) .notUpdatingParticipant() .to(connnectionObservable) .converting(new ObjectToStringConverter(Connection.class) { ConnectionColumLabelProvider labelProvider = new ConnectionColumLabelProvider(); @Override public Object convert(Object source) { return source == null ? "" : labelProvider.getText(source); } }) .in(dbc); }
Source:
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException { TskData.FileKnown knownStatus = TskData.FileKnown.UNKNOWN; if (getNotableTagDisplayNames().contains(displayName)) { knownStatus = TskData.FileKnown.BAD; } return addTagName(displayName, description, color, knownStatus); }

Target:
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException { return addTagName(displayName, description, color, knownStatus,TskData.FileKnown.UNKNOWN); }
Source:
public void setUp() throws Exception { domainList = new MemoryDomainList(new InMemoryDNSService() .registerMxRecord(Domain.LOCALHOST.asString(), "127.0.0.1") .registerMxRecord(LOCAL_DOMAIN, "127.0.0.1") .registerMxRecord("examplebis.local", "127.0.0.1") .registerMxRecord("127.0.0.1", "127.0.0.1")); domainList.setAutoDetect(false); domainList.setAutoDetectIP(false); domainList.addDomain(Domain.LOCALHOST); domainList.addDomain(Domain.of(LOCAL_DOMAIN)); domainList.addDomain(Domain.of("examplebis.local")); usersRepository = MemoryUsersRepository.withVirtualHosting(domainList); createMailRepositoryStore(); setUpFakeLoader(); hashedWheelTimer = new HashedWheelTimer(); setUpSMTPServer(); }

Target:
public void setUp() throws Exception { domainList = new MemoryDomainList(new InMemoryDNSService() .registerMxRecord(Domain.LOCALHOST.asString(), "127.0.0.1") .registerMxRecord(Domain.LOCALHOST.asString(), "127.0.0.1") .registerMxRecord(LOCAL_DOMAIN, "127.0.0.1") .registerMxRecord("examplebis.local", "127.0.0.1") .registerMxRecord("127.0.0.1", "127.0.0.1")); domainList.configure(DomainListConfiguration.DEFAULT); domainList.addDomain(Domain.of(LOCAL_DOMAIN)); domainList.addDomain(Domain.of("examplebis.local")); usersRepository = MemoryUsersRepository.withVirtualHosting(domainList); usersRepository.addUser(BOB, PASSWORD); createMailRepositoryStore(); setUpFakeLoader(); hashedWheelTimer = new HashedWheelTimer(); setUpSMTPServer(); }
Source:
public IChromosome[] readChromosomes(ISpeciesRoot speciesRoot){ IChromosomeType[] chromosomeTypes = speciesRoot.getKaryotype(); int types = readVarInt(); IChromosome[] chromosomes = new IChromosome[chromosomeTypes.length]; String primarySpeciesUid = null; String secondarySpeciesUid = null; for (IChromosomeType type : chromosomeTypes) { int index = type.ordinal(); int bit = (1 << chromosomeTypes.length - index - 1); if ((bit & types) != bit) { continue; } Chromosome chromosome = Chromosome.create(primarySpeciesUid, secondarySpeciesUid, type, readAllele(), readAllele()); chromosomes[index] = chromosome; if (index == speciesRoot.getSpeciesChromosomeType().ordinal()) { primarySpeciesUid = chromosome.getPrimaryAllele().getUID(); secondarySpeciesUid = chromosome.getSecondaryAllele().getUID(); } } return chromosomes; }

Target:
public IChromosome[] readChromosomes(ISpeciesRoot speciesRoot){ IChromosomeType[] chromosomeTypes = speciesRoot.getKaryotype(); IChromosome[] chromosomes = new IChromosome[chromosomeTypes.length]; String primarySpeciesUid = null; String secondarySpeciesUid = null; for (IChromosomeType type : chromosomeTypes) { int index = type.ordinal(); Chromosome chromosome = readChromosome(type, primarySpeciesUid, secondarySpeciesUid); chromosomes[index] = chromosome; if (type == speciesRoot.getSpeciesChromosomeType()) { primarySpeciesUid = chromosome.getActiveAllele().getUID(); secondarySpeciesUid = chromosome.getInactiveAllele().getUID(); } } return chromosomes; }