auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void loadApns(SQLiteDatabase db, XmlPullParser parser) { if (parser != null) { try { db.beginTransaction(); while (parser.getEventType() != XmlPullParser.END_DOCUMENT) { XmlUtils.nextElement(parser); ContentValues row = getRow(parser); if (row == null) { <START> if (parser.getName() == null) { <END> continue; } else { throw new XmlPullParserException("Expected 'apn' tag", parser, null); } } insertAddingDefaults(db, CARRIERS_TABLE, row); } db.setTransactionSuccessful(); } catch (XmlPullParserException e) { Log.e(TAG, "Got XmlPullParserException while loading apns.", e); } catch (IOException e) { Log.e(TAG, "Got IOException while loading apns.", e); } catch (SQLException e) { Log.e(TAG, "Got SQLException while loading apns.", e); } finally { db.endTransaction(); } } }</code><technical_language>is strange, do apns-conf.xml used? I need fix "source" file, try duplicate here</technical_language>

Target:
private void loadApns(SQLiteDatabase db, XmlPullParser parser) { if (parser != null) { try { db.beginTransaction(); while (true) { XmlUtils.nextElement(parser); if (parser.getEventType() != XmlPullParser.END_DOCUMENT) { ContentValues row = getRow(parser); if (row == null) { throw new XmlPullParserException("Expected 'apn' tag", parser, null); } insertAddingDefaults(db, CARRIERS_TABLE, row); } else { break; } } db.setTransactionSuccessful(); } catch (XmlPullParserException e) { Log.e(TAG, "Got XmlPullParserException while loading apns.", e); } catch (IOException e) { Log.e(TAG, "Got IOException while loading apns.", e); } catch (SQLException e) { Log.e(TAG, "Got SQLException while loading apns.", e); } finally { db.endTransaction(); } } }
Source:
<code>private void addEmail() { Handler returnHandler = new Handler() { @Override public void handleMessage(Message message) { if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) { Bundle data = message.getData(); String email = data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL); if (email.length() > 0 && mEmailEdit.getText().length() > 0 && email.equals(mEmailEdit.getText().toString())) { notifyUser(getString(R.string.create_key_email_already_exists_text)); return; } for (EmailAdapter.ViewModel model : mAdditionalEmailModels) { if (email.equals(model.email)) { notifyUser(getString(R.string.create_key_email_already_exists_text)); return; } } <START> mEmailAdapter.add( <END> data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL) ); } } }; Messenger messenger = new Messenger(returnHandler); AddEmailDialogFragment addEmailDialog = AddEmailDialogFragment.newInstance(messenger); addEmailDialog.show(getActivity().getSupportFragmentManager(), "addEmailDialog"); }</code><technical_language>please defined variable email</technical_language>

Target:
private void addEmail() { Handler returnHandler = new Handler() { @Override public void handleMessage(Message message) { if (message.what == SetPassphraseDialogFragment.MESSAGE_OKAY) { Bundle data = message.getData(); String email = data.getString(AddEmailDialogFragment.MESSAGE_DATA_EMAIL); if (email.length() > 0 && mEmailEdit.getText().length() > 0 && email.equals(mEmailEdit.getText().toString())) { Notify.create(getActivity(), getString(R.string.create_key_email_already_exists_text), Notify.LENGTH_LONG, Notify.Style.ERROR).show(); return; } for (EmailAdapter.ViewModel model : mAdditionalEmailModels) { if (email.equals(model.email)) { Notify.create(getActivity(), getString(R.string.create_key_email_already_exists_text), Notify.LENGTH_LONG, Notify.Style.ERROR).show(); return; } } mEmailAdapter.add(email); } } }; Messenger messenger = new Messenger(returnHandler); AddEmailDialogFragment addEmailDialog = AddEmailDialogFragment.newInstance(messenger); addEmailDialog.show(getActivity().getSupportFragmentManager(), "addEmailDialog"); }
Source:
<code>public void handleData(ITmfEvent event) { super.handleData(event); if (event != null) { if (!(event instanceof ITmfLostEvent)) { long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fHistogram.countEvent(getNbRead(), timestamp); } else { ITmfLostEvent lostEvents = (ITmfLostEvent) event; <START> fHistogram.addLostEvents(lostEvents.getTimeRange(), ((Long) event.getContent().getField(LOST_EVENTS_FIELD).getValue()).intValue()); <END> } } }</code><technical_language>for is a field in specific event. ITmfLostEvent.getNbLostEvents()</technical_language>

Target:
public void handleData(ITmfEvent event) { super.handleData(event); if (event != null) { if (!(event instanceof ITmfLostEvent)) { long timestamp = event.getTimestamp().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fHistogram.countEvent(getNbRead(), timestamp); } else { ITmfLostEvent lostEvents = (ITmfLostEvent) event; fHistogram.addLostEvents(lostEvents.getTimeRange(), (int)lostEvents.getNbLostEvents()); } } }
Source:
<code>public ServiceNotAvailableException(String message, Throwable cause) { super(message, cause); this.serviceHint = Optional.empty(); <START> this.serviceHintUrl = Optional.empty(); <END> }</code><technical_language>Yeah, ideal need a URL coming RetryOther right? do want manually hardcode https part there</technical_language>

Target:
public ServiceNotAvailableException(String message, Throwable cause) { super(message, cause); this.serviceHint = Optional.empty(); }
Source:
<code>public void testCargoTomlIsNotStudentFile() { <START> assertFalse(policy.isStudentSourceFile(Paths.get("src/Cargo.toml"))); <END> }</code><technical_language>NIT: Paths.get("src", "Cargo.toml")</technical_language>

Target:
public void testCargoTomlIsNotStudentFile() { assertFalse(policy.isStudentSourceFile(Paths.get("src", "Cargo.toml"))); }
Source:
<code>private List<PhoneBookWriter.User> readUsers(FilterPredicate filter, boolean useOtherFiltering, boolean useBloomFilter) throws IOException { FileDecryptionProperties fileDecryptionProperties = null; if (isEncrypted) { <START> DecryptionKeyRetriever decryptionKeyRetrieverMock = mock(DecryptionKeyRetriever.class); when(decryptionKeyRetrieverMock.getKey(FOOTER_ENCRYPTION_KEY_ID.getBytes(StandardCharsets.UTF_8))) .thenReturn(FOOTER_ENCRYPTION_KEY); when(decryptionKeyRetrieverMock.getKey(COLUMN_ENCRYPTION_KEY1_ID.getBytes(StandardCharsets.UTF_8))) .thenReturn(COLUMN_ENCRYPTION_KEY1); when(decryptionKeyRetrieverMock.getKey(COLUMN_ENCRYPTION_KEY2_ID.getBytes(StandardCharsets.UTF_8))) .thenReturn(COLUMN_ENCRYPTION_KEY2); <END> fileDecryptionProperties = FileDecryptionProperties.builder() .withKeyRetriever(decryptionKeyRetrieverMock) .build(); } return PhoneBookWriter.readUsers(ParquetReader.builder(new GroupReadSupport(), file) .withFilter(FilterCompat.get(filter)) .withDecryption(fileDecryptionProperties) .useDictionaryFilter(useOtherFiltering) .useStatsFilter(useOtherFiltering) .useRecordFilter(useOtherFiltering) .useBloomFilter(useBloomFilter) .useColumnIndexFilter(useOtherFiltering)); }</code><technical_language>Mocking objects a great if deal complex objects in tests. Mocking interface method a bit overkill I is more readable. I think, implementing interface anonymous class more readable shows a example</technical_language>

Target:
private List<PhoneBookWriter.User> readUsers(FilterPredicate filter, boolean useOtherFiltering, boolean useBloomFilter) throws IOException { FileDecryptionProperties fileDecryptionProperties = null; if (isEncrypted) { DecryptionKeyRetrieverMock decryptionKeyRetrieverMock = new DecryptionKeyRetrieverMock() .putKey(FOOTER_ENCRYPTION_KEY_ID, FOOTER_ENCRYPTION_KEY) .putKey(COLUMN_ENCRYPTION_KEY1_ID, COLUMN_ENCRYPTION_KEY1) .putKey(COLUMN_ENCRYPTION_KEY2_ID, COLUMN_ENCRYPTION_KEY2); fileDecryptionProperties = FileDecryptionProperties.builder() .withKeyRetriever(decryptionKeyRetrieverMock) .build(); } return PhoneBookWriter.readUsers(ParquetReader.builder(new GroupReadSupport(), file) .withFilter(FilterCompat.get(filter)) .withDecryption(fileDecryptionProperties) .useDictionaryFilter(useOtherFiltering) .useStatsFilter(useOtherFiltering) .useRecordFilter(useOtherFiltering) .useBloomFilter(useBloomFilter) .useColumnIndexFilter(useOtherFiltering)); }
Source:
<code>public Collection<byte[]> getTxChanges() { Collection<byte[]> txChanges = new TreeSet<byte[]>(UnsignedBytes.lexicographicalComparator()); <START> if (conflictLevel != TxConstants.ConflictDetection.NONE) { <END> for (ActionChange change : changeSet) { txChanges.add(getChangeKey(change.getRow(), change.getFamily(), change.getQualifier())); } } return txChanges; }</code><technical_language>check for return Collections.emptyList() avoid overhead of creating new TreeSet</technical_language>

Target:
public Collection<byte[]> getTxChanges() { if (conflictLevel == TxConstants.ConflictDetection.NONE) { return Collections.emptyList(); } Collection<byte[]> txChanges = new TreeSet<byte[]>(UnsignedBytes.lexicographicalComparator()); for (ActionChange change : changeSet) { txChanges.add(getChangeKey(change.getRow(), change.getFamily(), change.getQualifier())); } return txChanges; }
Source:
<code>public void setShowFilterControls(boolean showFilterControls) { <START> this.showFilterControls = showFilterControls; <END> }</code><technical_language>trigger hide / show of filter controls</technical_language>

Target:
public void setShowFilterControls(boolean showFilterControls) { this.showFilterControls = showFilterControls; if (filterComposite != null) { Object filterCompositeLayoutData = filterComposite.getLayoutData(); if (filterCompositeLayoutData instanceof GridData) { ((GridData) filterCompositeLayoutData).exclude = !isShowFilterControls(); } else if (filterCompositeLayoutData instanceof RowData) { ((RowData) filterCompositeLayoutData).exclude = !isShowFilterControls(); } filterComposite.setVisible(isShowFilterControls()); layout(); } }
Source:
<code>private Shape getScalarShape(Shape shape) throws OdataMetadataFieldsException { if(shape instanceof UnionShape){ UnionShape unionShape = (UnionShape) shape; for(Shape unionSubShape : unionShape.anyOf()){ if(unionSubShape instanceof ScalarShape){ <START> return (ScalarShape) unionSubShape; <END> } } throw new OdataMetadataFieldsException(format("Property %s cannot be just null.", shape.name())); } return shape; }</code><technical_language>Unneeded cast</technical_language>

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:
<code>private boolean allowedToEvict() { boolean allowed = evictionStrategy.allowedToEvict(expectedRegistrySize, eurekaRegistry.size()) >= 0; <START> moveHealthTo(allowed ? Status.UP : Status.DOWN); <END> return allowed; }</code><technical_language>discussion, mark servers in selfPreservation. redirect traffic a (possibly) smaller set of servers down</technical_language>

Target:
private boolean allowedToEvict() { boolean allowed = evictionStrategy.allowedToEvict(expectedRegistrySize, eurekaRegistry.size()) >= 0; return allowed; }
Source:
<code>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) { <START> log.warn("It took ms to poll the next pair for the load balancer", endMillis - startMillis); <END> } return next; }</code><technical_language>{} ms poll next pair for load balancer. reason: enough test data for selected load</technical_language>

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:
<code>public final boolean IsDynamicVariable(String strMessage) { <START> final String startsWithVariableDefinitionRegex = "^\\$[^{}\\s]+ .*"; <END> return strMessage.matches(startsWithVariableDefinitionRegex); }</code><technical_language>i if Pattern.compile() a static member hold compiled expression is more efficient</technical_language>

Target:
public final boolean IsDynamicVariable(String strMessage) { return startsWithVariableDefinitionPattern.matcher(strMessage).matches(); }
Source:
<code>public IrishSentenceBankDocument() { <START> sentences = new ArrayList<IrishSentenceBankSentence>(); <END> }</code><technical_language>need declare type RHS</technical_language>

Target:
public IrishSentenceBankDocument() { sentences = new ArrayList<>(); }
Source:
<code>private static Boolean interpret(String arg) { <START> if ("on".equals(arg) || "true".equals(arg) || "yes".equals(arg)) return true; <END> if ("off".equals(arg) || "false".equals(arg) || "no".equals(arg)) return false; throw new Error("Can't interpret the answer: " + arg); }</code><technical_language>replace lines in favor of BooleanUtils.toBooleanObject(String) throwing error null returned. I guess safer</technical_language>

Target:
private static Boolean interpret(String arg) { return BooleanUtils.toBooleanObject(arg); }
Source:
<code>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 <START> fMemberInfo : <END> 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(); } }</code><technical_language>rename memberInfo info</technical_language>

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:
<code>private void testNettyMessageClientDecoding( boolean hasEmptyBuffer, boolean hasBufferForReleasedChannel, boolean hasBufferForRemovedChannel) throws Exception { ByteBuf[] encodedMessages = null; List<NettyMessage> decodedMessages = null; try { List<BufferResponse> messages = createMessageList( hasEmptyBuffer, <START> hasBufferForRemovedChannel, <END> 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(); } } } } }</code><technical_language>naming errors in method parameters</technical_language>

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:
<code><START> public Entry(Map.Entry<String,String> e) { <END> this(e.getKey(), e.getValue()); }</code><technical_language>IMHO need public</technical_language>

Target:
private Entry(Map.Entry<String,String> e) { this(e.getKey(), e.getValue()); }
Source:
<code>public void close(TaskAttemptContext context) throws IOException, InterruptedException { try { if (!documentList.isEmpty()) { solrClient.add(documentList); solrClient.commit(); } } catch (SolrServerException e) { <START> e.printStackTrace(); <END> } finally { documentList.clear(); } solrClient.shutdown(); }</code><technical_language>Logger log print stack trace. LOG.error("Exception while...", e);</technical_language>

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:
<code>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) { <START> throw error; <END> } else if (rand >= 0.4) { throw new CancellationException(); } return null; } }); tasks.add(task); } return tasks; }</code><technical_language>create exception here</technical_language>

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:
<code>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) { <START> Utils.sendCaughtException(); <END> } }) .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; }</code><technical_language>please call CrashReporter.sendUnhandledCaughtException(); remove utility function</technical_language>

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:
<code>public boolean isNull(ByteBuffer buf, int position) { <START> return buf.get() == IS_NULL_BYTE; <END> }</code><technical_language>get(position)</technical_language>

Target:
public boolean isNull(ByteBuffer buf, int position) { return buf.get(position) == IS_NULL_BYTE || delegate.isNull(buf, position + Byte.BYTES); }
Source:
<code>public void onPlayerSlotChange(PlayerItemHeldEvent event) { Player player = event.getPlayer(); BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); int slot = event.getNewSlot() + 1; <START> <END> 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; } }</code><technical_language>This null check is needed, however, checking bPlayer.getAbilities() actual slot itself</technical_language>

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:
<code>public void frameworkMessage(ExecutorDriver driver, byte[] data) { <START> if(Arrays.equals(data, "FORCE_SHUTDOWN".getBytes())){ <END> forceShutdown = true; } }</code><technical_language>messaging needs more generic! a CrateMessage class for implementation details</technical_language>

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:
<code>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 { <START> s_logger.debug("Account (" + ldapGroupName + ") for LDAP group already exists not exist. Creating user (" + username + ")."); <END> _accountManager.createUser(username, "", user.getFirstname(), user.getLastname(), user.getEmail(), null, ldapGroupName, domainId, UUID.randomUUID().toString(), User.Source.LDAP); } }</code><technical_language>@miguelaferreira a bit strange "for LDAP group exists exist"... this; "for LDAP group exists, user exist"</technical_language>

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:
<code>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); } <START> if (sqlType == Types.CHAR || sqlType == Types.VARCHAR) { <END> 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); }</code><technical_language>check for types, more general check for null this: Integer maxLength = pColumn.getMaxLength(); Integer scale = pColumn.getScale(); return new ColumnInfo(pColumn.toString(), sqlType, maxLength, scale); ColumnInfo handles a null maxLength scale</technical_language>

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:
<code>public void requestReturnsBuildInfo() throws Exception { mockMvc.perform(get("/json/build")) <START> .andExpect(status().isOk()).andDo(print()) <END> .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))); }</code><technical_language>I guess this is aid in debugging</technical_language>

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:
<code>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); <START> message1.setFrom(new InternetAddress("from2@localhost")); <END> 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); }</code><technical_language>Avoid magic numbers</technical_language>

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:
<code>public StreamInfo<Object, Object> decode(List<Object> parts, State state) { <START> StreamInfoWrapper fields = new StreamInfoWrapper(parts); <END> 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; }</code><technical_language>need wrapper here. List converted map: java 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 -> e.get(0), e -> e.get(1)));</technical_language>

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:
<code>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); <START> perCrsMosaicProducers.put(granuleCRSCode, submosaicProducer); <END> } return submosaicProducer.accept(granuleDescriptor); }</code><technical_language>discussed voice synch up, this breaks sorting, data structure a list of crs bound producers, time a crs changes, a new bound producer added list</technical_language>

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:
<code>public static void assertOnlyContains(final Set<Issue> result, final String... expected) { if (result.isEmpty()) { fail("Data is empty."); <START> } <END> for (final Issue issue : result) { String title = ExplanationProvider.toTitle(issue); if (!contains(expected, title)) { fail("Should not find: " + title); } } }</code><technical_language>replace methods AssertJ call. (Perhaps converting Issues Strings a simple, clean stream.)</technical_language>

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:
<code>public void testRequestorUid() { final NetworkCapabilities nc = new NetworkCapabilities(); nc.setRequestorUid(1314); <START> assertEquals(1314, <END> new NetworkRequest.Builder().setCapabilities(nc).build() .getRequestorUid()); }</code><technical_language>verify a equal case</technical_language>

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:
<code>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); <START> doSort(stripOffLatestTag(installerFqn), sorted, pending); <END> } return new ArrayList<>(sorted.values()); }</code><technical_language>is defined interface sorting performed latest versions instead of specified. Please rename argument installer id do parse InstallerFqn</technical_language>

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:
<code>public void test() { List<Class> checks = CheckRepository.getCheckClasses(); for (Class cls : checks) { <START> if (!cls.getSimpleName().equals("ParsingErrorCheck")) { <END> String testName = '/' + cls.getName().replace('.', '/') + "Test.class"; assertThat(getClass().getResource(testName)) .overridingErrorMessage("No test for " + cls.getSimpleName()) .isNotNull(); } } }</code><technical_language>@ivandalbosco ParsingErrorCheck.class.getSimpleName()</technical_language>

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:
<code>DataLakePathAsyncClient getPathAsyncClient(String destinationFileSystem, String destinationPath) { if (CoreUtils.isNullOrEmpty(destinationFileSystem)) { <START> throw logger.logExceptionAsError(new IllegalArgumentException( <END> "'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()); }</code><technical_language>reason this default destinationFileSystem current file system? renameWithResponse pass current file system destinationFileSystem value. odd allow null in case in another similar case</technical_language>

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:
<code>public Response delete(@PathParam("path") String path) { ServerContext _serverContext = (ServerContext) _application.getProperties().get(ContextPropertyKeys.SERVER_CONTEXT.name()); _zkBaseDataAccessor = _serverContext.getByteArrayZkBaseDataAccessor(); <START> path = prependPath(path); <END> 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); }</code><technical_language>if set root path below, need prepend root slash, is clean. @Path("/zookeeper{path: /.+}") public class ZooKeeperAccessor extends AbstractResource {</technical_language>

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:
<code>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()){ <START> savingsAccount.setInterestRate(new BigDecimal(1.50)); <END> } final long time = new Date().getTime(); savingsAccount.setId(apiTestIdPrefix + time); savingsAccount.setNotes("Created by API on " + new Date()); return savingsAccount; }</code><technical_language>Do need skip setting interest rate for Offset savings here? Offset product savings support interest rate settings in usual way. OBS: Creating a valid savings account needs lots of checks. This is, of course, is optional in a future a more generic existent method in SavingsDemo enhanced provide helpers for creating a saving account meeting product restrictions</technical_language>

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:
<code>private void lockImageInDb() { <START> updateImageStatus(ImageStatus.LOCKED); <END> }</code><technical_language>done compensation, in engine crash disk remain locked</technical_language>

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:
<code>public Bullet shoot() { final SpriteSheet spritesheet = new SpriteSheet(getGame().getSpriteSheet()); final Bullet newBullet = new Bullet(getX() + 5, getY() + 2, spritesheet); <START> Game.logfile.writeShoot("Alien", getX(), getY()); <END> newBullet.setDownSpeed(6.6); newBullet.setSpritesheet(200,605,6,12); return newBullet; }</code><technical_language>in Alientype2.java (add type of alien)</technical_language>

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:
<code>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); <START> assertEquals(dataFile.getLocation(), "/var/folders/nt/486jzvcj5d3g9bgwg5x1kv_c0000gp/T/afinch/AFINCH.nc"); <END> } catch (java.io.IOException e) { e.printStackTrace(); fail(); } finally { if (dataFile != null) { try { dataFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } } FileUtils.deleteQuietly(ncFile); }</code><technical_language>this location from</technical_language>

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); }