auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Shape getScalarShape(Shape shape) throws OdataMetadataFieldsException { if(shape instanceof UnionShape){ UnionShape unionShape = (UnionShape) shape; for(Shape unionSubShape : unionShape.anyOf()){ if(unionSubShape instanceof ScalarShape){ return (ScalarShape) unionSubShape; } } throw new OdataMetadataFieldsException(format("Property %s cannot be just null.", shape.name())); } return shape; }

Target:
private Shape getScalarShape(Shape shape) throws OdataMetadataFieldsException { if(shape instanceof UnionShape){ UnionShape unionShape = (UnionShape) shape; for(Shape unionSubShape : unionShape.anyOf()){ if(unionSubShape instanceof ScalarShape){ return unionSubShape; } } throw new OdataMetadataFieldsException(format("Property %s cannot be just null.", shape.name())); } return shape; }
Source:
private boolean allowedToEvict() { boolean allowed = evictionStrategy.allowedToEvict(expectedRegistrySize, eurekaRegistry.size()) >= 0; moveHealthTo(allowed ? Status.UP : Status.DOWN); return allowed; }

Target:
private boolean allowedToEvict() { boolean allowed = evictionStrategy.allowedToEvict(expectedRegistrySize, eurekaRegistry.size()) >= 0; return allowed; }
Source:
protected Pair<Q, E> pollNext() { Pair<Q, E> next = null; long startMillis = System.currentTimeMillis(); try { next = getPairQueue().poll(pollTimeout.getValue(), TimeUnit.MILLISECONDS); } catch (InterruptedException ignored) { } if (next == null) { throw new IllegalStateException(String.format("Didn't manage to poll the next pair. Timeout %s", pollTimeout)); } long endMillis = System.currentTimeMillis(); if (endMillis - startMillis > 1000) { log.warn("It took ms to poll the next pair for the load balancer", endMillis - startMillis); } return next; }

Target:
protected Pair<Q, E> pollNext() { Pair<Q, E> next = null; long startMillis = System.currentTimeMillis(); try { next = getPairQueue().poll(pollTimeout.getValue(), TimeUnit.MILLISECONDS); } catch (InterruptedException ignored) { } if (next == null) { throw new IllegalStateException(String.format("Didn't manage to poll the next pair. Timeout %s", pollTimeout)); } long endMillis = System.currentTimeMillis(); if (endMillis - startMillis > 1000) { log.warn( "It took ms to poll the next pair for the load balancer. Possible reason: not enough test data for selected load", endMillis - startMillis); } return next; }
Source:
public final boolean IsDynamicVariable(String strMessage) { final String startsWithVariableDefinitionRegex = "^\\$[^{}\\s]+ .*"; return strMessage.matches(startsWithVariableDefinitionRegex); }

Target:
public final boolean IsDynamicVariable(String strMessage) { return startsWithVariableDefinitionPattern.matcher(strMessage).matches(); }
Source:
public IrishSentenceBankDocument() { sentences = new ArrayList<IrishSentenceBankSentence>(); }

Target:
public IrishSentenceBankDocument() { sentences = new ArrayList<>(); }
Source:
private static Boolean interpret(String arg) { if ("on".equals(arg) || "true".equals(arg) || "yes".equals(arg)) return true; if ("off".equals(arg) || "false".equals(arg) || "no".equals(arg)) return false; throw new Error("Can't interpret the answer: " + arg); }

Target:
private static Boolean interpret(String arg) { return BooleanUtils.toBooleanObject(arg); }
Source:
public RefactoringStatus checkFinalConditions(IProgressMonitor monitor, CheckConditionsContext context) throws CoreException, OperationCanceledException { try { monitor.beginTask(RefactoringCoreMessages.PushDownRefactoring_checking, 5); clearCaches(); ICompilationUnit unit= getDeclaringType().getCompilationUnit(); if (fLayer) unit= unit.findWorkingCopy(fOwner); resetWorkingCopies(unit); final RefactoringStatus result= new RefactoringStatus(); result.merge(checkMembersInDestinationClasses(new SubProgressMonitor(monitor, 1))); result.merge(checkElementsAccessedByModifiedMembers(new SubProgressMonitor(monitor, 1))); result.merge(checkReferencesToPushedDownMembers(new SubProgressMonitor(monitor, 1))); if (!JdtFlags.isAbstract(getDeclaringType()) && getAbstractDeclarationInfos().length != 0) result.merge(checkConstructorCalls(getDeclaringType(), new SubProgressMonitor(monitor, 1))); else monitor.worked(1); if (result.hasFatalError()) return result; List<IMember> members= new ArrayList<>(fMemberInfos.length); for (MemberActionInfo fMemberInfo : fMemberInfos) { if (fMemberInfo.getAction() != MemberActionInfo.NO_ACTION) { members.add(fMemberInfo.getMember()); } } fMembersToMove= members.toArray(new IMember[members.size()]); fChangeManager= createChangeManager(new SubProgressMonitor(monitor, 1), result); if (result.hasFatalError()) return result; Checks.addModifiedFilesToChecker(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()), context); return result; } finally { monitor.done(); } }

Target:
public RefactoringStatus checkFinalConditions(IProgressMonitor monitor, CheckConditionsContext context) throws CoreException, OperationCanceledException { try { monitor.beginTask(RefactoringCoreMessages.PushDownRefactoring_checking, 5); clearCaches(); ICompilationUnit unit= getDeclaringType().getCompilationUnit(); if (fLayer) unit= unit.findWorkingCopy(fOwner); resetWorkingCopies(unit); final RefactoringStatus result= new RefactoringStatus(); result.merge(checkMembersInDestinationClasses(new SubProgressMonitor(monitor, 1))); result.merge(checkElementsAccessedByModifiedMembers(new SubProgressMonitor(monitor, 1))); result.merge(checkReferencesToPushedDownMembers(new SubProgressMonitor(monitor, 1))); if (!JdtFlags.isAbstract(getDeclaringType()) && getAbstractDeclarationInfos().length != 0) result.merge(checkConstructorCalls(getDeclaringType(), new SubProgressMonitor(monitor, 1))); else monitor.worked(1); if (result.hasFatalError()) return result; List<IMember> members= new ArrayList<>(fMemberInfos.length); for (MemberActionInfo memberInfo : fMemberInfos) { if (memberInfo.getAction() != MemberActionInfo.NO_ACTION) { members.add(memberInfo.getMember()); } } fMembersToMove= members.toArray(new IMember[members.size()]); fChangeManager= createChangeManager(new SubProgressMonitor(monitor, 1), result); if (result.hasFatalError()) return result; Checks.addModifiedFilesToChecker(ResourceUtil.getFiles(fChangeManager.getAllCompilationUnits()), context); return result; } finally { monitor.done(); } }
Source:
private void testNettyMessageClientDecoding( boolean hasEmptyBuffer, boolean hasBufferForReleasedChannel, boolean hasBufferForRemovedChannel) throws Exception { ByteBuf[] encodedMessages = null; List<NettyMessage> decodedMessages = null; try { List<BufferResponse> messages = createMessageList( hasEmptyBuffer, hasBufferForRemovedChannel, hasBufferForReleasedChannel ); encodedMessages = encodeMessages(messages); List<ByteBuf> partitionedBuffers = repartitionMessages(encodedMessages); decodedMessages = decodeMessages(channel, partitionedBuffers); verifyDecodedMessages(messages, decodedMessages); } finally { releaseBuffers(encodedMessages); if (decodedMessages != null) { for (NettyMessage nettyMessage : decodedMessages) { if (nettyMessage instanceof BufferResponse) { ((BufferResponse) nettyMessage).releaseBuffer(); } } } } }

Target:
private void testNettyMessageClientDecoding( boolean hasEmptyBuffer, boolean hasBufferForReleasedChannel, boolean hasBufferForRemovedChannel) throws Exception { ByteBuf[] encodedMessages = null; List<NettyMessage> decodedMessages = null; try { List<BufferResponse> messages = createMessageList( hasEmptyBuffer, hasBufferForReleasedChannel, hasBufferForRemovedChannel); encodedMessages = encodeMessages(messages); List<ByteBuf> partitionedBuffers = repartitionMessages(encodedMessages); decodedMessages = decodeMessages(channel, partitionedBuffers); verifyDecodedMessages(messages, decodedMessages); } finally { releaseBuffers(encodedMessages); if (decodedMessages != null) { for (NettyMessage nettyMessage : decodedMessages) { if (nettyMessage instanceof BufferResponse) { ((BufferResponse) nettyMessage).releaseBuffer(); } } } } }
Source:
public Entry(Map.Entry<String,String> e) { this(e.getKey(), e.getValue()); }

Target:
private Entry(Map.Entry<String,String> e) { this(e.getKey(), e.getValue()); }
Source:
public void close(TaskAttemptContext context) throws IOException, InterruptedException { try { if (!documentList.isEmpty()) { solrClient.add(documentList); solrClient.commit(); } } catch (SolrServerException e) { e.printStackTrace(); } finally { documentList.clear(); } solrClient.shutdown(); }

Target:
public void close(TaskAttemptContext context) throws IOException, InterruptedException { try { if (!documentList.isEmpty()) { solrClient.add(documentList); solrClient.commit(); } } catch (SolrServerException e) { throw new IllegalArgumentException("Exception while indexing the documents to Solr. For more details, Please " + "check the logs.", e); } finally { documentList.clear(); solrClient.shutdown(); } }
Source:
private Collection<Task<Void>> launchTasksWithRandomCompletions(int numberOfTasksToLaunch ) { final Exception error = new RuntimeException("This task failed."); final ArrayList<Task<Void>> tasks = new ArrayList<>(); for (int i=0; i < numberOfTasksToLaunch; i++) { Task<Void> task = Task.callInBackground(new Callable<Void>() { @Override public Void call() throws Exception { Thread.sleep((long) (500 + (Math.random() * 100))); double rand = Math.random(); if (rand >= 0.7) { throw error; } else if (rand >= 0.4) { throw new CancellationException(); } return null; } }); tasks.add(task); } return tasks; }

Target:
private Collection<Task<Integer>> launchTasksWithRandomCompletions(int numberOfTasksToLaunch ) { final ArrayList<Task<Integer>> tasks = new ArrayList<>(); for (int i=0; i < numberOfTasksToLaunch; i++) { Task<Integer> task = Task.callInBackground(new Callable<Integer>() { @Override public Integer call() throws Exception { Thread.sleep((long) (500 + (Math.random() * 100))); double rand = Math.random(); if (rand >= 0.7) { throw new RuntimeException("This task failed."); } else if (rand >= 0.4) { throw new CancellationException(); } return (int)(Math.random() * 1000); } }); tasks.add(task); } return tasks; }
Source:
public Dialog onCreateDialog(Bundle bundle) { View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_send_report, null); CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkBoxSendReportAutomatically); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { SettingsActivity.setAutoCrashReportingEnabled(getActivity(), isChecked); } }); Dialog reportDialog = new AlertDialog.Builder(getActivity()).setView(view).setTitle(getString(R.string .pocket_code_has_crashed)) .setPositiveButton(R.string.crash_dialog_send, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { Utils.sendCaughtException(); } }) .setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().remove( CrashReporter.EXCEPTION_FOR_REPORT).commit(); } }).create(); reportDialog.setCanceledOnTouchOutside(false); return reportDialog; }

Target:
public Dialog onCreateDialog(Bundle bundle) { View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_send_report, null); CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkBoxSendReportAutomatically); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { SettingsActivity.setAutoCrashReportingEnabled(getActivity(), isChecked); } }); Dialog reportDialog = new AlertDialog.Builder(getActivity()).setView(view).setTitle(getString(R.string .pocket_code_has_crashed)) .setPositiveButton(R.string.crash_dialog_send, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { CrashReporter.sendUnhandledCaughtException(); } }) .setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().remove( CrashReporter.EXCEPTION_FOR_REPORT).commit(); } }).create(); reportDialog.setCanceledOnTouchOutside(false); return reportDialog; }
Source:
public boolean isNull(ByteBuffer buf, int position) { return buf.get() == IS_NULL_BYTE; }

Target:
public boolean isNull(ByteBuffer buf, int position) { return buf.get(position) == IS_NULL_BYTE || delegate.isNull(buf, position + Byte.BYTES); }
Source:
public void onPlayerSlotChange(PlayerItemHeldEvent event) { Player player = event.getPlayer(); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); int slot = event.getNewSlot() + 1; CoreAbility ability = CoreAbility.getAbility(bPlayer.getAbilities().get(slot)); GeneralMethods.displayMovePreview(player, ability); WaterArms waterArms = CoreAbility.getAbility(player, WaterArms.class); if (waterArms != null) { waterArms.displayBoundMsg(event.getNewSlot() + 1); return; } }

Target:
public void onPlayerSlotChange(PlayerItemHeldEvent event) { Player player = event.getPlayer(); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); int slot = event.getNewSlot() + 1; if (bPlayer != null && bPlayer.getAbilities() != null) { CoreAbility ability = CoreAbility.getAbility(bPlayer.getAbilities().get(slot)); GeneralMethods.displayMovePreview(player, ability); } WaterArms waterArms = CoreAbility.getAbility(player, WaterArms.class); if (waterArms != null) { waterArms.displayBoundMsg(event.getNewSlot() + 1); return; } }
Source:
public void frameworkMessage(ExecutorDriver driver, byte[] data) { if(Arrays.equals(data, "FORCE_SHUTDOWN".getBytes())){ forceShutdown = true; } }

Target:
public void frameworkMessage(ExecutorDriver driver, byte[] data) { try { CrateMessage crateMessage = CrateMessage.fromStream(data); if (crateMessage != null) { if(crateMessage.type().equals(CrateMessage.Type.MESSAGE_CLUSTER_SHUTDOWN)) { forceShutdown = true; } } } catch (IOException e) { LOGGER.error("Could not process message", e); } }
Source:
private void createCloudStackUserAccount(final LdapUser user, final long domainId, final short accountType) { final String username = user.getUsername(); final Account account = _accountManager.getActiveAccountByName(ldapGroupName, domainId); if (account == null) { s_logger.info("Account (" + ldapGroupName + ") for LDAP group does not exist. Creating account and user (" + username + ")."); _accountManager.createUserAccount(username, "", user.getFirstname(), user.getLastname(), user.getEmail(), null, ldapGroupName, accountType, domainId, username, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP); } else { s_logger.debug("Account (" + ldapGroupName + ") for LDAP group already exists not exist. Creating user (" + username + ")."); _accountManager.createUser(username, "", user.getFirstname(), user.getLastname(), user.getEmail(), null, ldapGroupName, domainId, UUID.randomUUID().toString(), User.Source.LDAP); } }

Target:
private void createCloudStackUserAccount(final LdapUser user, final long domainId, final short accountType) { final String username = user.getUsername(); final Account account = _accountManager.getActiveAccountByName(ldapGroupName, domainId); if (account == null) { s_logger.info("Account (" + ldapGroupName + ") for LDAP group does not exist. Creating account and user (" + username + ")."); _accountManager.createUserAccount(username, "", user.getFirstname(), user.getLastname(), user.getEmail(), null, ldapGroupName, accountType, domainId, username, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), User.Source.LDAP); } else { s_logger.debug("Account (" + ldapGroupName + ") for LDAP group already exists. Creating user (" + username + ")."); _accountManager.createUser(username, "", user.getFirstname(), user.getLastname(), user.getEmail(), null, ldapGroupName, domainId, UUID.randomUUID().toString(), User.Source.LDAP); } }
Source:
public static ColumnInfo getColumnInfo(PColumn pColumn) throws SQLException { if (pColumn == null) { throw new SQLException("pColumn must not be null."); } int sqlType = pColumn.getDataType().getSqlType(); if (pColumn.getMaxLength() == null) { return new ColumnInfo(pColumn.toString(), sqlType); } if (sqlType == Types.CHAR || sqlType == Types.VARCHAR) { int maxLength = pColumn.getMaxLength(); return new ColumnInfo(pColumn.toString(), sqlType, maxLength); } if (sqlType == Types.DECIMAL) { int precision = pColumn.getMaxLength(); int scale = pColumn.getScale() == null ? 0 : Math.min(precision, pColumn.getScale()); return new ColumnInfo(pColumn.toString(), sqlType, precision, scale); } return new ColumnInfo(pColumn.toString(), sqlType); }

Target:
public static ColumnInfo getColumnInfo(PColumn pColumn) throws SQLException { if (pColumn == null) { throw new SQLException("pColumn must not be null."); } return ColumnInfo.create(pColumn.toString(), pColumn.getDataType().getSqlType(), pColumn.getMaxLength(), pColumn.getScale()); }
Source:
public void requestReturnsBuildInfo() throws Exception { mockMvc.perform(get("/json/build")) .andExpect(status().isOk()).andDo(print()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$.bambooBuildVersion", isA(String.class))) .andExpect(jsonPath("$.gitBranch", isA(String.class))) .andExpect(jsonPath("$.gitCommitID", isA(String.class))) .andExpect(jsonPath("$.tomcatHostname", isA(String.class))); }

Target:
public void requestReturnsBuildInfo() throws Exception { mockMvc.perform(get("/json/build")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$.bambooBuildVersion", isA(String.class))) .andExpect(jsonPath("$.gitBranch", isA(String.class))) .andExpect(jsonPath("$.gitCommitID", isA(String.class))) .andExpect(jsonPath("$.tomcatHostname", isA(String.class))); }
Source:
private void storeSortTestMessages(Session session, MailFolder folder, Flags flags) throws Exception { MimeMessage message1 = new MimeMessage(session); message1.setSubject("testSearch"); message1.setText("content"); setRecipients(message1, Message.RecipientType.TO, "to", 1, 2); setRecipients(message1, Message.RecipientType.CC, "cc", 1, 2); setRecipients(message1, Message.RecipientType.BCC, "bcc", 1, 2); message1.setFrom(new InternetAddress("from2@localhost")); message1.setFlag(Flags.Flag.ANSWERED, true); message1.setFlags(flags, true); folder.store(message1); MimeMessage message2 = new MimeMessage(session); message2.setSubject("testSearch"); message2.setText("content"); setRecipients(message2, Message.RecipientType.TO, "to", 2, 3); setRecipients(message2, Message.RecipientType.CC, "cc", 2, 3); setRecipients(message2, Message.RecipientType.BCC, "bcc", 2, 3); message2.setFrom(new InternetAddress("from3@localhost")); message2.setFlag(Flags.Flag.ANSWERED, false); folder.store(message2); }

Target:
private void storeSortTestMessages(Session session, MailFolder folder, Flags flags) throws Exception { MimeMessage message1 = new MimeMessage(session); message1.setSubject("testSearch"); message1.setText("content"); int[] message1RecipientsSuffixes = new int[]{1, 2}; setRecipients(message1, Message.RecipientType.TO, "to", message1RecipientsSuffixes); setRecipients(message1, Message.RecipientType.CC, "cc", message1RecipientsSuffixes); setRecipients(message1, Message.RecipientType.BCC, "bcc", message1RecipientsSuffixes); message1.setFrom(new InternetAddress("from2@localhost")); message1.setFlag(Flags.Flag.ANSWERED, true); message1.setFlags(flags, true); folder.store(message1); MimeMessage message2 = new MimeMessage(session); message2.setSubject("testSearch"); message2.setText("content"); int[] message2RecipientsSuffixes = new int[]{2, 3}; setRecipients(message2, Message.RecipientType.TO, "to", message2RecipientsSuffixes); setRecipients(message2, Message.RecipientType.CC, "cc", message2RecipientsSuffixes); setRecipients(message2, Message.RecipientType.BCC, "bcc", message2RecipientsSuffixes); message2.setFrom(new InternetAddress("from3@localhost")); message2.setFlag(Flags.Flag.ANSWERED, false); folder.store(message2); }
Source:
public StreamInfo<Object, Object> decode(List<Object> parts, State state) { StreamInfoWrapper fields = new StreamInfoWrapper(parts); StreamInfo<Object, Object> info = new StreamInfo<>(); info.setLength(((Long) fields.get(StreamInfoWrapper.Key.LENGTH)).intValue()); info.setRadixTreeKeys(((Long) fields.get(StreamInfoWrapper.Key.RADIX_TREE_KEYS)).intValue()); info.setRadixTreeNodes(((Long) fields.get(StreamInfoWrapper.Key.RADIX_TREE_NODES)).intValue()); info.setGroups(((Long) fields.get(StreamInfoWrapper.Key.GROUPS)).intValue()); info.setLastGeneratedId(StreamIdConvertor.INSTANCE.convert(fields.get(StreamInfoWrapper.Key.LAST_GENERATED_ID))); List<?> firstEntry = (List<?>) fields.get(StreamInfoWrapper.Key.FIRST_ENTRY); if (firstEntry != null) { StreamInfo.Entry<Object, Object> first = createStreamInfoEntry(firstEntry); info.setFirstEntry(first); } List<?> lastEntry = (List<?>) fields.get(StreamInfoWrapper.Key.LAST_ENTRY); if (lastEntry != null) { StreamInfo.Entry<Object, Object> last = createStreamInfoEntry(lastEntry); info.setLastEntry(last); } return info; }

Target:
public StreamInfo<Object, Object> decode(List<Object> parts, State state) { Map<String, Object> map = IntStream.range(0, parts.size()).boxed().collect( Collectors.groupingBy(e -> e / 2, Collectors.mapping(e -> parts.get(e), Collectors.toList()))) .values().stream().collect(Collectors.toMap(e -> (String) e.get(0), e -> e.get(1))); StreamInfo<Object, Object> info = new StreamInfo<>(); info.setLength(((Long) map.get(LENGTH_KEY)).intValue()); info.setRadixTreeKeys(((Long) map.get(RADIX_TREE_KEYS_KEY)).intValue()); info.setRadixTreeNodes(((Long) map.get(RADIX_TREE_NODES_KEY)).intValue()); info.setGroups(((Long) map.get(GROUPS_KEY)).intValue()); info.setLastGeneratedId(StreamIdConvertor.INSTANCE.convert(map.get(LAST_GENERATED_ID_KEY))); List<?> firstEntry = (List<?>) map.get(FIRST_ENTRY_KEY); if (firstEntry != null) { StreamInfo.Entry<Object, Object> first = createStreamInfoEntry(firstEntry); info.setFirstEntry(first); } List<?> lastEntry = (List<?>) map.get(LAST_ENTRY_KEY); if (lastEntry != null) { StreamInfo.Entry<Object, Object> last = createStreamInfoEntry(lastEntry); info.setLastEntry(last); } return info; }
Source:
public boolean accept(GranuleDescriptor granuleDescriptor) { String granuleCRSCode = (String) granuleDescriptor.getOriginator() .getAttribute(CRSExtractor.DEFAULT_ATTRIBUTE_NAME); CoordinateReferenceSystem granuleCRS; try { granuleCRS = CRS.decode(granuleCRSCode); } catch (FactoryException e) { throw new IllegalStateException(e); } CRSBoundMosaicProducer submosaicProducer = this.perCrsMosaicProducers.get(granuleCRSCode); if (submosaicProducer == null) { submosaicProducer = new CRSBoundMosaicProducer(response, dryRun, granuleCRS); perCrsMosaicProducers.put(granuleCRSCode, submosaicProducer); } return submosaicProducer.accept(granuleDescriptor); }

Target:
public boolean accept(GranuleDescriptor granuleDescriptor) { if (this.currentCRS == null) { this.currentCRS = granuleDescriptor.getGranuleEnvelope().getCoordinateReferenceSystem(); this.currentSubmosaicProducer = new CRSBoundMosaicProducer( rasterLayerResponse, dryRun, currentCRS, granuleDescriptor); perMosaicProducers.add(currentSubmosaicProducer); return true; } else { boolean accepted = currentSubmosaicProducer.accept(granuleDescriptor); if (!accepted) { this.currentSubmosaicProducer = new CRSBoundMosaicProducer( rasterLayerResponse, dryRun, currentCRS, granuleDescriptor); perMosaicProducers.add(currentSubmosaicProducer); accepted = currentSubmosaicProducer.acceptGranule(granuleDescriptor); } return accepted; } }
Source:
public static void assertOnlyContains(final Set<Issue> result, final String... expected) { if (result.isEmpty()) { fail("Data is empty."); } for (final Issue issue : result) { String title = ExplanationProvider.toTitle(issue); if (!contains(expected, title)) { fail("Should not find: " + title); } } }

Target:
public static void assertOnlyContains(final Set<Issue> result, final String... expected) { if (result.isEmpty()) { fail("Data is empty."); } Set<String> resultTitles = result.stream() .map(issue -> ExplanationProvider.toTitle(issue)) .collect(Collectors.toSet()); assertThat(resultTitles).containsOnly(expected); }
Source:
public void testRequestorUid() { final NetworkCapabilities nc = new NetworkCapabilities(); nc.setRequestorUid(1314); assertEquals(1314, new NetworkRequest.Builder().setCapabilities(nc).build() .getRequestorUid()); }

Target:
public void testRequestorUid() { final NetworkCapabilities nc = new NetworkCapabilities(); assertEquals(Process.INVALID_UID, new NetworkRequest.Builder() .setCapabilities(nc).build().getRequestorUid()); nc.setRequestorUid(1314); final NetworkRequest nr = new NetworkRequest.Builder().setCapabilities(nc).build(); assertNotEquals(2628, nr.getRequestorUid()); assertEquals(1314, nr.getRequestorUid()); }
Source:
public List<Installer> getOrderedInstallers(List<String> installerKeys) throws InstallerException { Map<InstallerFqn, Installer> sorted = new LinkedHashMap<>(); Set<InstallerFqn> pending = new HashSet<>(); for (String installer : installerKeys) { InstallerFqn installerFqn = InstallerFqn.parse(installer); doSort(stripOffLatestTag(installerFqn), sorted, pending); } return new ArrayList<>(sorted.values()); }

Target:
public List<Installer> getOrderedInstallers(List<String> installerKeys) throws InstallerException { LinkedHashMap<InstallerFqn, Installer> sorted = new LinkedHashMap<>(); Set<InstallerFqn> pending = new HashSet<>(); for (String installer : installerKeys) { InstallerFqn installerFqn = InstallerFqn.parse(installer); doSort(stripOffLatestTag(installerFqn), sorted, pending); } return new ArrayList<>(sorted.values()); }
Source:
public void test() { List<Class> checks = CheckRepository.getCheckClasses(); for (Class cls : checks) { if (!cls.getSimpleName().equals("ParsingErrorCheck")) { String testName = '/' + cls.getName().replace('.', '/') + "Test.class"; assertThat(getClass().getResource(testName)) .overridingErrorMessage("No test for " + cls.getSimpleName()) .isNotNull(); } } }

Target:
public void test() { List<Class> checks = CheckRepository.getCheckClasses(); for (Class cls : checks) { if (!cls.getSimpleName().equals(ParsingErrorCheck.class.getSimpleName())) { String testName = '/' + cls.getName().replace('.', '/') + "Test.class"; assertThat(getClass().getResource(testName)) .overridingErrorMessage("No test for " + cls.getSimpleName()) .isNotNull(); } } }
Source:
DataLakePathAsyncClient getPathAsyncClient(String destinationFileSystem, String destinationPath) { if (CoreUtils.isNullOrEmpty(destinationFileSystem)) { throw logger.logExceptionAsError(new IllegalArgumentException( "'destinationFileSystem' can not be set to null")); } if (CoreUtils.isNullOrEmpty(destinationPath)) { throw logger.logExceptionAsError(new IllegalArgumentException("'destinationPath' can not be set to null")); } String newDfsEndpoint = BlobUrlParts.parse(getPathUrl()) .setBlobName(destinationPath).setContainerName(destinationFileSystem).toUrl().toString(); return new DataLakePathAsyncClient(getHttpPipeline(), newDfsEndpoint, serviceVersion, accountName, destinationFileSystem, destinationPath, pathResourceType, prepareBuilderReplacePath(destinationFileSystem, destinationPath).buildBlockBlobAsyncClient()); }

Target:
DataLakePathAsyncClient getPathAsyncClient(String destinationFileSystem, String destinationPath) { if (destinationFileSystem == null) { destinationFileSystem = getFileSystemName(); } if (CoreUtils.isNullOrEmpty(destinationPath)) { throw logger.logExceptionAsError(new IllegalArgumentException("'destinationPath' can not be set to null")); } String newDfsEndpoint = BlobUrlParts.parse(getPathUrl()) .setBlobName(destinationPath).setContainerName(destinationFileSystem).toUrl().toString(); return new DataLakePathAsyncClient(getHttpPipeline(), newDfsEndpoint, serviceVersion, accountName, destinationFileSystem, destinationPath, pathResourceType, prepareBuilderReplacePath(destinationFileSystem, destinationPath).buildBlockBlobAsyncClient()); }
Source:
public Response delete(@PathParam("path") String path) { ServerContext _serverContext = (ServerContext) _application.getProperties().get(ContextPropertyKeys.SERVER_CONTEXT.name()); _zkBaseDataAccessor = _serverContext.getByteArrayZkBaseDataAccessor(); path = prependPath(path); if (!ZkValidationUtil.isPathValid(path)) { String errMsg = "The given path is not a valid ZooKeeper path: " + path; LOG.info(errMsg); return badRequest(errMsg); } return delete(_zkBaseDataAccessor, path); }

Target:
public Response delete(@PathParam("path") String path) { ServerContext _serverContext = (ServerContext) _application.getProperties().get(ContextPropertyKeys.SERVER_CONTEXT.name()); _zkBaseDataAccessor = _serverContext.getByteArrayZkBaseDataAccessor(); if (!ZkValidationUtil.isPathValid(path)) { String errMsg = "The given path is not a valid ZooKeeper path: " + path; LOG.info(errMsg); return badRequest(errMsg); } return delete(_zkBaseDataAccessor, path); }
Source:
private static SavingsAccount makeSavingsAccountForLoanWithSettlements(LoanAccount loanAccount, SavingsProduct savingsProduct) { SavingsAccount savingsAccount = new SavingsAccount(); savingsAccount.setInterestSettings(new InterestAccountSettings()); savingsAccount.setAccountHolderKey(loanAccount.getAccountHolderKey()); savingsAccount.setAccountHolderType(loanAccount.getAccountHolderType()); savingsAccount.setCurrencyCode(loanAccount.getCurrencyCode()); savingsAccount.setProductTypeKey(savingsProduct.getEncodedKey()); savingsAccount.setAccountType(savingsProduct.getProductType()); savingsAccount.setAccountState(AccountState.PENDING_APPROVAL); if(!savingsProduct.isAllowOffset()){ savingsAccount.setInterestRate(new BigDecimal(1.50)); } final long time = new Date().getTime(); savingsAccount.setId(apiTestIdPrefix + time); savingsAccount.setNotes("Created by API on " + new Date()); return savingsAccount; }

Target:
private static SavingsAccount makeSavingsAccountForLoanWithSettlements(LoanAccount loanAccount, SavingsProduct savingsProduct) { SavingsAccount savingsAccount = new SavingsAccount(); savingsAccount.setInterestSettings(new InterestAccountSettings()); savingsAccount.setAccountHolderKey(loanAccount.getAccountHolderKey()); savingsAccount.setAccountHolderType(loanAccount.getAccountHolderType()); savingsAccount.setCurrencyCode(loanAccount.getCurrencyCode()); savingsAccount.setProductTypeKey(savingsProduct.getEncodedKey()); savingsAccount.setAccountType(savingsProduct.getProductType()); savingsAccount.setAccountState(AccountState.PENDING_APPROVAL); savingsAccount.setInterestRate(new BigDecimal(1.50)); final long time = new Date().getTime(); savingsAccount.setId(apiTestIdPrefix + time); savingsAccount.setNotes("Created by API on " + new Date()); return savingsAccount; }
Source:
private void lockImageInDb() { updateImageStatus(ImageStatus.LOCKED); }

Target:
private void lockImageInDb() { final DiskImage diskImage = (DiskImage) getOldDisk(); final ImageStatus imgStatus = diskImage.getImageStatus(); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getCompensationContext().snapshotEntityStatus(diskImage.getImage(), imgStatus); getCompensationContext().stateChanged(); diskImage.setImageStatus(ImageStatus.LOCKED); ImagesHandler.updateImageStatus(diskImage.getImageId(), ImageStatus.LOCKED); return null; } }); }
Source:
public Bullet shoot() { final SpriteSheet spritesheet = new SpriteSheet(getGame().getSpriteSheet()); final Bullet newBullet = new Bullet(getX() + 5, getY() + 2, spritesheet); Game.logfile.writeShoot("Alien", getX(), getY()); newBullet.setDownSpeed(6.6); newBullet.setSpritesheet(200,605,6,12); return newBullet; }

Target:
public Bullet shoot() { final SpriteSheet spritesheet = new SpriteSheet(getGame().getSpriteSheet()); final Bullet newBullet = new Bullet(getX() + 5, getY() + 2, spritesheet); Game.logfile.writeShoot("AlienType3", getX(), getY()); newBullet.setDownSpeed(6.6); newBullet.setSpritesheet(200,605,6,12); return newBullet; }
Source:
public void testNetCDFFromAfinch() throws IOException, XMLStreamException { RunMetadata runMeta = new RunMetadata(ModelType.AFINCH, "1", "test", "1", "1", "2012-07-10T00:00:00Z", "Special", "comments", "jiwalker@usgs.gov", "<LINK_0>", "NWC:Dense1", "site_no"); ReturnInfo info = CreateDSGFromZip.create(sampleFile, runMeta); File ncFile = new File(new File(outputDir), info.filename); assertEquals(info.filename, "AFINCH.nc"); NetcdfFile dataFile = null; try { dataFile = NetcdfFile.open(ncFile.getPath(), null); assertEquals(dataFile.getLocation(), "/var/folders/nt/486jzvcj5d3g9bgwg5x1kv_c0000gp/T/afinch/AFINCH.nc"); } catch (java.io.IOException e) { e.printStackTrace(); fail(); } finally { if (dataFile != null) { try { dataFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } } FileUtils.deleteQuietly(ncFile); }

Target:
public void testNetCDFFromAfinch() throws IOException, XMLStreamException { RunMetadata runMeta = new RunMetadata(ModelType.AFINCH, "1", "test", "1", "1", "2012-07-10T00:00:00Z", "Special", "comments", "jiwalker@usgs.gov", "<LINK_0>", "NWC:Dense1", "site_no"); ReturnInfo info = CreateDSGFromZip.create(sampleFile, runMeta); File ncFile = new File(new File(outputDir), info.filename); assertEquals(info.filename, "AFINCH.nc"); NetcdfFile dataFile = null; try { dataFile = NetcdfFile.open(ncFile.getPath(), null); Variable record = dataFile.findVariable("record"); int[] shape = record.getShape(); if(shape.length > 0) { int shapeValue = shape[0]; assertEquals(shapeValue, 6169); } } catch (java.io.IOException e) { e.printStackTrace(); fail(); } finally { if (dataFile != null) { try { dataFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } } FileUtils.deleteQuietly(ncFile); }
Source:
public void connect() throws IOException { synchronized (lock) { if (!connected) { socket = createSocket(); writeChannel = Channels.newChannel(socket.getOutputStream()); readChannel = socket.getInputStream(); connected = true; logger.debug( "Connection established to {}({}):{}", host, socket.getRemoteSocketAddress(), socket.getPort() ); } } }

Target:
public void connect() throws IOException { synchronized (this) { if (!connected) { socket = createSocket(); writeChannel = Channels.newChannel(socket.getOutputStream()); readChannel = socket.getInputStream(); connected = true; logger.debug("Connection established to {}({}):{}", host, socket.getRemoteSocketAddress(), socket.getPort()); } } }
Source:
public boolean create(Address addressRecord) { LOG.trace("AddressDAO.create() - Begin"); boolean result = true; if (addressRecord != null) { result = super.create(addressRecord); } LOG.trace("AddressDAO.create() - End"); return result; }

Target:
public boolean create(Address addressRecord) { LOG.trace("AddressDAO.create()"); return addressRecord != null ? super.create(addressRecord) : true; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Insert insert = (Insert) o; if (columns != null ? !columns.equals(insert.columns) : insert.columns != null) return false; if (table != null ? !table.equals(insert.table) : insert.table != null) return false; if (subQuery != null ? !subQuery.equals(insert.subQuery) : insert.subQuery != null) return false; return true; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Insert<?> insert = (Insert<?>) o; return table.equals(insert.table) && columns.equals(insert.columns) && insertSource.equals(insert.insertSource); }
Source:
public void testPutSingleRowFirstColumn() { AbstractTransaction transaction = mock(AbstractTransaction.class); putSingleRowFirstColumn(transaction, TEST_ROW_KEY, TEST_VALUE); ArgumentCaptor<Map> argument = ArgumentCaptor.forClass(Map.class); Mockito.verify(transaction, times(1)).put(eq(tableRef), argument.capture()); Cell expectedCell = Cell.create(PtBytes.toBytes(TEST_ROW_KEY), PtBytes.toBytes(FIRST_COL_SHORT_NAME)); assertThat(argument.getValue().entrySet().size()).isEqualTo(1); assertThat(argument.getValue().keySet().toArray()[0]).isEqualTo(expectedCell); assertThat((byte[]) argument.getValue().values().toArray()[0]) .usingComparator(UnsignedBytes.lexicographicalComparator()) .isEqualTo(EncodingUtils.encodeUnsignedVarLong(TEST_VALUE)); }

Target:
public void testPutSingleRowFirstColumn() { AbstractTransaction transaction = mock(AbstractTransaction.class); putSingleRowFirstColumn(transaction, TEST_ROW_KEY, TEST_VALUE); ArgumentCaptor<Map> argument = ArgumentCaptor.forClass(Map.class); verify(transaction, times(1)).put(eq(tableRef), argument.capture()); Map<Cell, byte[]> foundMap = argument.getValue(); Cell expectedCell = Cell.create(PtBytes.toBytes(TEST_ROW_KEY), PtBytes.toBytes(FIRST_COL_SHORT_NAME)); assertThat(Iterables.getOnlyElement(foundMap.keySet())).isEqualTo(expectedCell); assertThat(Iterables.getOnlyElement(foundMap.values())) .usingComparator(UnsignedBytes.lexicographicalComparator()) .isEqualTo(EncodingUtils.encodeUnsignedVarLong(TEST_VALUE)); }
Source:
public MapLoader<String, Object> newMapStore(String mapName, Properties properties) { LOGGER.trace("INSIDE: newMapStore()"); return new FileSystemPersistenceProvider(mapName, properties); }

Target:
public MapLoader<String, Object> newMapStore(String mapName, Properties properties) { String persistencePath = properties.getProperty(PERSISTENCE_PATH_KEY); LOGGER.trace( "INSIDE: newMapStore(). Creating new for map stored in {}", FileSystemPersistenceProvider.class.getName(), mapName, persistencePath); return new FileSystemPersistenceProvider(mapName, persistencePath); }
Source:
private void handleScreenTurnedOn() { final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onScreenTurnedOn(); } } updateIrisListeningState(); }

Target:
private void handleScreenTurnedOn() { final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onScreenTurnedOn(); } } }
Source:
HttpURLConnection getRequest(ParseHttpRequest parseRequest) throws IOException { HttpURLConnection connection; URL url = new URL(parseRequest.getUrl()); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod(parseRequest.getMethod().toString()); connection.setConnectTimeout(socketOperationTimeout); connection.setReadTimeout(socketOperationTimeout); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); for (Map.Entry<String, String> entry : parseRequest.getAllHeaders().entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue()); } if (disableHttpLibraryAutoUncompress()) { connection.setRequestProperty("Accept-encoding", "gzip"); } ParseHttpBody body = parseRequest.getBody(); if (body != null) { connection.setRequestProperty("Content-Length", String.valueOf(body.getContentLength())); connection.setRequestProperty("Content-Type", body.getContentType()); connection.setFixedLengthStreamingMode(body.getContentLength()); connection.setDoOutput(true); } return connection; }

Target:
HttpURLConnection getRequest(ParseHttpRequest parseRequest) throws IOException { HttpURLConnection connection; URL url = new URL(parseRequest.getUrl()); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod(parseRequest.getMethod().toString()); connection.setConnectTimeout(socketOperationTimeout); connection.setReadTimeout(socketOperationTimeout); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); for (Map.Entry<String, String> entry : parseRequest.getAllHeaders().entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue()); } if (disableHttpLibraryAutoDecompress()) { connection.setRequestProperty(ACCEPT_ENCODING_HEADER, GZIP_ENCODING); } ParseHttpBody body = parseRequest.getBody(); if (body != null) { connection.setRequestProperty(CONTENT_LENGTH_HEADER, String.valueOf(body.getContentLength())); connection.setRequestProperty(CONTENT_TYPE_HEADER, body.getContentType()); connection.setFixedLengthStreamingMode(body.getContentLength()); connection.setDoOutput(true); } return connection; }
Source:
void findTexts(IngestJobContext context) { blackboard = Case.getCurrentCase().getServices().getBlackboard(); try { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); absFiles = skCase.findAllFilesWhere("name ='mmssms.db'"); if (absFiles.isEmpty()) { return; } for (AbstractFile file : absFiles) { try { jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), file.getName().replaceAll("[<>%|\"/:*\\\\]", "")); dbPath = jFile.toString(); ContentUtils.writeToFile(file, jFile, context::dataSourceIngestIsCancelled); fileId = file.getId(); findTextsInDB(dbPath, fileId); } catch (ReadContentInputStream.ReadContentInputStreamException ex) { logger.log(Level.WARNING, String.format("Error reading content from file '%s' (id=%d).", file.getName(), fileId), ex); } catch (Exception ex) { logger.log(Level.SEVERE, String.format("Error writing content from file '%s' (id=%d) to '%s'.", file.getName(), fileId, dbPath), ex); } } } catch (TskCoreException e) { logger.log(Level.SEVERE, "Error finding text messages", e); } }

Target:
void findTexts(IngestJobContext context) { blackboard = Case.getCurrentCase().getServices().getBlackboard(); try { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); absFiles = skCase.findAllFilesWhere("name ='mmssms.db'"); if (absFiles.isEmpty()) { return; } for (AbstractFile file : absFiles) { try { jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), file.getName().replaceAll("[<>%|\"/:*\\\\]", "")); dbPath = jFile.toString(); fileId = file.getId(); ContentUtils.writeToFile(file, jFile, context::dataSourceIngestIsCancelled); findTextsInDB(dbPath, fileId); } catch (ReadContentInputStream.ReadContentInputStreamException ex) { logger.log(Level.WARNING, String.format("Error reading content from file '%s' (id=%d).", file.getName(), fileId), ex); } catch (Exception ex) { logger.log(Level.SEVERE, String.format("Error writing content from file '%s' (id=%d) to '%s'.", file.getName(), fileId, dbPath), ex); } } } catch (TskCoreException e) { logger.log(Level.SEVERE, "Error finding text messages", e); } }
Source:
public void should_fail_if_spliterator_does_not_have_characteristic() { Spliterator<?> actual = createSpliterator(Spliterator.SORTED); Throwable thrown = catchThrowable(() -> assertThat(actual).hasCharacteristics(Spliterator.DISTINCT)); assertThat(thrown).isInstanceOf(AssertionError.class); }

Target:
public void should_fail_if_spliterator_does_not_have_characteristic() { Spliterator<?> actual = createSpliterator(Spliterator.SORTED); expectAssertionError(() -> spliterators.assertHasCharacteristics(INFO, actual, Spliterator.DISTINCT)); verify(failures).failure(INFO, shouldContain(Collections.singleton("SORTED"), new String[] {"DISTINCT"}, Collections.singleton("DISTINCT"))); }
Source:
private void handleMessage(final Message m, final OutputStream output) throws IOException, ValidationException { m.validate(); if (!canAcceptMessage(m)) { LOGGER.log(Level.WARNING, "Message dropped: {0} - too many messages in the system", m.getTags()); output.write(Message.DeliveryStatus.OVER_LIMIT.getStatusCode()); return; } Response response; try { response = processMessage(m); } catch (Exception ex) { LOGGER.log(Level.WARNING, String.format("Message dropped: %s - message error", m), ex); output.write(Message.DeliveryStatus.ERROR.getStatusCode()); output.write(ex.getMessage().getBytes()); return; } LOGGER.log(Level.FINER, "Message received: {0}", m.getTags()); LOGGER.log(Level.FINER, "Messages in the system: {0}", getMessagesInTheSystem()); output.write(Message.DeliveryStatus.OK.getStatusCode()); output.write(gson.toJson(response).getBytes()); output.flush(); }

Target:
private void handleMessage(final Message m, final OutputStream output) throws IOException, ValidationException { m.validate(); if (isMessageLimitExceeded()) { LOGGER.log(Level.WARNING, "Message dropped: {0} - too many messages in the system", m); output.write(Message.DeliveryStatus.OVER_LIMIT.getStatusCode()); return; } Response response; try { response = processMessage(m); } catch (Exception ex) { LOGGER.log(Level.WARNING, String.format("Message dropped: %s - message error", m), ex); output.write(Message.DeliveryStatus.ERROR.getStatusCode()); output.write(ex.getMessage().getBytes()); return; } LOGGER.log(Level.FINER, "Message received: {0}", m); LOGGER.log(Level.FINER, "Messages in the system: {0}", getMessagesInTheSystem()); output.write(Message.DeliveryStatus.OK.getStatusCode()); output.write(gson.toJson(response).getBytes()); output.flush(); }
Source:
void writeMessage(final DataOutput output, final short invocationId, final EJBClientInvocationContext invocationContext) throws IOException { if (output == null) { throw new IllegalArgumentException("Cannot write to null output"); } final Method invokedMethod = invocationContext.getInvokedMethod(); final Object[] methodParams = invocationContext.getParameters(); output.writeByte(METHOD_INVOCATION_HEADER); output.writeShort(invocationId); output.writeUTF(invokedMethod.getName()); final Class<?>[] methodParamTypes = invokedMethod.getParameterTypes(); final StringBuilder methodSignature = new StringBuilder(); for (int i = 0; i < methodParamTypes.length; i++) { methodSignature.append(methodParamTypes[i].getName()); if (i != methodParamTypes.length - 1) { methodSignature.append(METHOD_PARAM_TYPE_SEPARATOR); } } output.writeUTF(methodSignature.toString()); final Marshaller marshaller = this.prepareForMarshalling(this.marshallerFactory, output); final EJBLocator locator = invocationContext.getLocator(); marshaller.writeObject(locator.getAppName()); marshaller.writeObject(locator.getModuleName()); marshaller.writeObject(locator.getDistinctName()); marshaller.writeObject(locator.getBeanName()); marshaller.writeObject(locator); if (methodParams != null && methodParams.length > 0) { for (final Object methodParam : methodParams) { try { marshaller.writeObject(methodParam); } catch (IOException e) { throw new UnmarshalException(e.getMessage() + ", issue regarding unmarshalling of EJB parameters (possible Out of Memory issue).", e); } } } this.writeAttachments(marshaller, invocationContext); marshaller.finish(); }

Target:
void writeMessage(final DataOutput output, final short invocationId, final EJBClientInvocationContext invocationContext) throws IOException { if (output == null) { throw new IllegalArgumentException("Cannot write to null output"); } final Method invokedMethod = invocationContext.getInvokedMethod(); final Object[] methodParams = invocationContext.getParameters(); output.writeByte(METHOD_INVOCATION_HEADER); output.writeShort(invocationId); output.writeUTF(invokedMethod.getName()); final Class<?>[] methodParamTypes = invokedMethod.getParameterTypes(); final StringBuilder methodSignature = new StringBuilder(); for (int i = 0; i < methodParamTypes.length; i++) { methodSignature.append(methodParamTypes[i].getName()); if (i != methodParamTypes.length - 1) { methodSignature.append(METHOD_PARAM_TYPE_SEPARATOR); } } output.writeUTF(methodSignature.toString()); final Marshaller marshaller = this.prepareForMarshalling(this.marshallerFactory, output); final EJBLocator locator = invocationContext.getLocator(); marshaller.writeObject(locator.getAppName()); marshaller.writeObject(locator.getModuleName()); marshaller.writeObject(locator.getDistinctName()); marshaller.writeObject(locator.getBeanName()); marshaller.writeObject(locator); if (methodParams != null && methodParams.length > 0) { for (final Object methodParam : methodParams) { try { marshaller.writeObject(methodParam); } catch (IOException e) { throw log.ejbClientInvocationParamsException(e); } } } this.writeAttachments(marshaller, invocationContext); marshaller.finish(); }
Source:
public void add(ITicket ticket){ list.add(ticket); list.sort(ORDER); }

Target:
public void add(ITicket ticket){ if(tickets.contains(ticket)){ return; } tickets.add(ticket); tick |= ticket.shouldTick(); }