auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void importPackage(String name) { Package p = Package.getPackage(name); String rqpath = ServletRequestsAttr.getCurrentURL(); if (p == null) { ClassLoader cl = ClassUtil.getContextClassLoader(ImportHandler.class); String path = name.replace('.', '/'); URL url = cl.getResource(path); if (url == null) { throw new ELException(Util.message( null, "importHandler.invalidPackage", name)); } } <START> List packageList = importPackages.get(rqpath); <END> if (packageList == null) { packageList = new ArrayList<String>(Arrays.asList(JAVA_LANG_PACKAGE)); } if (!packageList.contains(name)) { packageList.add(name); } importPackages.put(rqpath , packageList); }</code><technical_language>1. Move rqpath 2. List<String></technical_language>

Target:
public void importPackage(String name) { String rqpath = ServletRequestsAttr.getCurrentURL(); List<String> packages = importPackages.get(rqpath); if (packages == null) { packages = new ArrayList(Arrays.asList(JAVA_LANG_PACKAGE)); } packages.add(name); importPackages.put(rqpath , packages); }
Source:
<code>private String getKey() { <START> if (this.key == null && this.rememberMeServices instanceof AbstractRememberMeServices) { <END> this.key = ((AbstractRememberMeServices) rememberMeServices).getKey(); } if (this.key == null) { this.key = UUID.randomUUID().toString(); } return this.key; }</code><technical_language>Please move this check null check bellow, checking if this.key == null</technical_language>

Target:
private String getKey() { if (this.key == null) { if (this.rememberMeServices instanceof AbstractRememberMeServices) { this.key = ((AbstractRememberMeServices) rememberMeServices).getKey(); } else { this.key = UUID.randomUUID().toString(); } } return this.key; }
Source:
<code>protected boolean set(TileEntityFurnace container, Integer value) { <START> container.setField(3, value); <END> return true; }</code><technical_language>here, check max cook time instead</technical_language>

Target:
protected boolean set(TileEntityFurnace container, Integer value) { if(container.getStackInSlot(0) == null || value > container.getField(3)){ return false; } container.setField(2, value); return true; }
Source:
<code>public void testSetErrorInResponseWhenNoUserFoundForProvidedToken() throws Exception { when(userManagerMock.getById(anyString())).thenThrow(new NotFoundException("User not found")); machineLoginFilter.doFilter(getRequestMock(), responseMock, chainMock); verify(keyManagerMock, atLeastOnce()).getOrCreateKeyPair(eq(WORKSPACE_ID)); verify(userManagerMock).getById(anyString()); verify(responseMock) .sendError( 401, <START> "Authentication with machine token failed cause: User for this token no longer exist."); <END> }</code><technical_language>Machine token authentication failed. user exist</technical_language>

Target:
public void testSetErrorInResponseWhenNoUserFoundForProvidedToken() throws Exception { when(userManagerMock.getById(anyString())).thenThrow(new NotFoundException("User not found")); machineLoginFilter.doFilter(getRequestMock(), responseMock, chainMock); verify(keyManagerMock, atLeastOnce()).getOrCreateKeyPair(eq(WORKSPACE_ID)); verify(userManagerMock).getById(anyString()); verify(responseMock) .sendError(401, "Machine token authentication failed: Corresponding user doesn't exist."); }
Source:
<code>void verifyPartLinkFilesExist(List<String> theMultiPartLinkFiles, String theSinglePartLinkFile) { List<String> notFoundMulti = notFound(theMultiPartLinkFiles); List<String> notFoundSingle = notFound(Arrays.asList(theSinglePartLinkFile)); boolean multiPartFilesFound = notFoundMulti.isEmpty(); boolean singlePartFilesFound = notFoundSingle.isEmpty(); if (!LogicUtil.multiXor(multiPartFilesFound, singlePartFilesFound)) { String msg; if (!multiPartFilesFound && !singlePartFilesFound) { <START> msg = "Could not find any of the PartLink files: " + notFoundMulti + " or " + notFoundSingle; <END> } else { msg = "Found both the single PartLink file, " + theSinglePartLinkFile + ", and the split PartLink files: " + theMultiPartLinkFiles; } throw new UnprocessableEntityException(msg); } }</code><technical_language>Nitpick. suggestion msg = "Could find of PartLink files: " + notFoundMulti + " " + notFoundSingle;</technical_language>

Target:
void verifyPartLinkFilesExist(List<String> theMultiPartLinkFiles, String theSinglePartLinkFile) { List<String> notFoundMulti = notFound(theMultiPartLinkFiles); List<String> notFoundSingle = notFound(Arrays.asList(theSinglePartLinkFile)); boolean multiPartFilesFound = notFoundMulti.isEmpty(); boolean singlePartFilesFound = notFoundSingle.isEmpty(); if (!LogicUtil.multiXor(multiPartFilesFound, singlePartFilesFound)) { String msg; if (!multiPartFilesFound && !singlePartFilesFound) { msg = "Could not find any of the PartLink files: " + notFoundMulti + " nor " + notFoundSingle; } else { msg = "Only either the single PartLink file or the split PartLink files can be present. Found both the single PartLink file, " + theSinglePartLinkFile + ", and the split PartLink files: " + theMultiPartLinkFiles; } throw new UnprocessableEntityException(msg); } }
Source:
<code><START> @Override public GridCursor<Row> find(Row lower, Row upper, BPlusTree.TreeRowClosure<Row, Row> filterC) { return find(lower, upper); <END> }</code><technical_language>suggestion @Override public GridCursor<Row> find(Row lower, Row upper, BPlusTree.TreeRowClosure<Row, Row> filterC) { assert filterC == null; return find(lower, upper);</technical_language>

Target:
@Override public GridCursor<Row> find(Row lower, Row upper, BPlusTree.TreeRowClosure<Row, Row> filterC) { assert filterC == null; int firstCol = F.first(collation.getKeys()); if (ectx.rowHandler().get(firstCol, lower) != null && ectx.rowHandler().get(firstCol, upper) != null) return new Cursor(rows.subMap(lower, true, upper, true)); else if (ectx.rowHandler().get(firstCol, lower) == null && ectx.rowHandler().get(firstCol, upper) != null) return new Cursor(rows.headMap(upper, true)); else if (ectx.rowHandler().get(firstCol, lower) != null && ectx.rowHandler().get(firstCol, upper) == null) return new Cursor(rows.tailMap(lower, true)); else return new Cursor(rows); }
Source:
<code>public EhcacheEntityResponse decode(byte[] payload) { ByteBuffer buffer = ByteBuffer.wrap(payload); byte opCode = buffer.get(); EhcacheEntityResponse.Type type = EhcacheEntityResponse.Type.responseType(opCode); byte[] payArr = new byte[buffer.remaining()]; buffer.get(payArr); switch (type) { case SUCCESS: return EhcacheEntityResponse.Success.INSTANCE; case FAILURE: Exception exception = (Exception)Util.unmarshall(payArr); return new EhcacheEntityResponse.Failure(exception); case GET_RESPONSE: <START> return new EhcacheEntityResponse.GetResponse(ChainCodec.decode(payArr)); <END> default: throw new UnsupportedOperationException("The operation is not supported with opCode : " + opCode); } }</code><technical_language>another static hiding there. this simply flattened in this class I else ChainCodec</technical_language>

Target:
public EhcacheEntityResponse decode(byte[] payload) { ByteBuffer buffer = ByteBuffer.wrap(payload); byte opCode = buffer.get(); EhcacheEntityResponse.Type type = EhcacheEntityResponse.Type.responseType(opCode); byte[] payArr = new byte[buffer.remaining()]; buffer.get(payArr); switch (type) { case SUCCESS: return EhcacheEntityResponse.Success.INSTANCE; case FAILURE: Exception exception = (Exception)Util.unmarshall(payArr); return new EhcacheEntityResponse.Failure(exception); case GET_RESPONSE: return new EhcacheEntityResponse.GetResponse(chainCodec.decode(payArr)); default: throw new UnsupportedOperationException("The operation is not supported with opCode : " + opCode); } }
Source:
<code>private static String readCurrentNL() { FileInputStream fin = null; try { URL url = Platform.getConfigurationLocation().getURL(); Properties p = new Properties(); File iniFile = new File(url.getFile(), "config.ini"); fin = new FileInputStream(iniFile); p.load(fin); return p.getProperty(OSGI_NL); } catch (IOException ex) { <START> LOG.error(ex.getMessage(), ex); <END> return null; } finally { IOUtils.closeQuietly(fin); } }</code><technical_language>add a self-defined message here? LOG.error("self-defined message", ex) better</technical_language>

Target:
private static String readCurrentNL() { FileInputStream fin = null; try { URL url = Platform.getConfigurationLocation().getURL(); Properties p = new Properties(); File iniFile = new File(url.getFile(), "config.ini"); fin = new FileInputStream(iniFile); p.load(fin); return p.getProperty(OSGI_NL); } catch (IOException ex) { LOG.error("Fail in reading config.ini file", ex); return null; } finally { IOUtils.closeQuietly(fin); } }
Source:
<code>void dump(final IndentingPrintWriter pw) { <START> pw.println("mPotentialConflictPrefixesMap:"); <END> for (int i = 0; i < mPotentialConflictPrefixesMap.size(); i++) { pw.println(mPotentialConflictPrefixesMap.keyAt(i) + " - " + mPotentialConflictPrefixesMap.valueAt(i)); } pw.println("mDownstreamPrefixMap:"); for (int i = 0; i < mDownstreamPrefixMap.size(); i++) { pw.println(mDownstreamPrefixMap.keyAt(i) + " - " + mDownstreamPrefixMap.valueAt(i)); } }</code><technical_language>Nit: increase indent</technical_language>

Target:
void dump(final IndentingPrintWriter pw) { pw.println("mUpstreamPrefixMap:"); pw.increaseIndent(); for (int i = 0; i < mUpstreamPrefixMap.size(); i++) { pw.println(mUpstreamPrefixMap.keyAt(i) + " - " + mUpstreamPrefixMap.valueAt(i)); } pw.println("mDownstreamPrefixMap:"); for (int i = 0; i < mDownstreamPrefixMap.size(); i++) { pw.println(mDownstreamPrefixMap.keyAt(i) + " - " + mDownstreamPrefixMap.valueAt(i)); } pw.decreaseIndent(); }
Source:
<code>public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) { Context context = ReactiveSecurityContextHolder.getContext() <START> .filter(Objects::isNull) <END> .switchIfEmpty(Mono.fromSupplier(() -> { SecurityContext securityContext = new SecurityContextImpl(); securityContext.setAuthentication(createAuthentication(exchange)); return securityContext; })) .as(ReactiveSecurityContextHolder::withSecurityContext); return Mono.subscriberContext() .subscriberContext(context) .then(chain.filter(exchange)); }</code><technical_language>I get a null empty</technical_language>

Target:
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) { return ReactiveSecurityContextHolder.getContext() .switchIfEmpty(Mono.defer(() -> { SecurityContext securityContext = new SecurityContextImpl(); securityContext.setAuthentication(createAuthentication(exchange)); return chain.filter(exchange) .subscriberContext(ReactiveSecurityContextHolder.withSecurityContext(Mono.just(securityContext))) .then(Mono.empty()); })).flatMap(securityContext -> chain.filter(exchange)); }
Source:
<code>public static PluginMessage fromString(String channel, String text) { ByteBuf buf = Unpooled.buffer(5 + text.length()); try { <START> try { <END> ByteBufUtils.writeUTF8(buf, text); } catch (NullPointerException e) { ByteBufUtils.writeUTF8(buf, "Glowstone"); } } catch (IOException e) { GlowServer.logger.log(Level.WARNING, "Error converting to PluginMessage: \"" + channel + "\", \"" + text + "\"", e); } byte[] array = buf.array(); buf.release(); return new PluginMessage(channel, array); }</code><technical_language>I in GlowServer.getName(). for clear</technical_language>

Target:
public static PluginMessage fromString(String channel, String text) { ByteBuf buf = Unpooled.buffer(5 + text.length()); try { ByteBufUtils.writeUTF8(buf, text); } catch (IOException e) { GlowServer.logger.log(Level.WARNING, "Error converting to PluginMessage: \"" + channel + "\", \"" + text + "\"", e); } byte[] array = buf.array(); buf.release(); return new PluginMessage(channel, array); }
Source:
<code>public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { try { this.cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults); } catch (JSONException ex) { LOG.d(TAG, "JSONException: Parameters fed into the method are not valid"); <START> ex.printStackTrace(); <END> } }</code><technical_language>P</technical_language>

Target:
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { try { this.cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults); } catch (JSONException ex) { LOG.d(TAG, "JSONException: Parameters fed into the method are not valid"); } }
Source:
<code>boolean isProjectStyle() { if (myIsFrameworkStyle) { return false; } ProjectResourceRepository repository = ProjectResourceRepository.getProjectResources(myConfiguration.getModule(), true); assert repository != null : <START> repository.getDisplayName(); <END> return repository.hasResourceItem(ResourceType.STYLE, myStyleName); }</code><technical_language>if repository is null, this throw NPE</technical_language>

Target:
boolean isProjectStyle() { if (myIsFrameworkStyle) { return false; } ProjectResourceRepository repository = ProjectResourceRepository.getProjectResources(myConfiguration.getModule(), true); assert repository != null : myConfiguration.getModule().getName(); return repository.hasResourceItem(ResourceType.STYLE, myStyleName); }
Source:
<code>protected Command getCommand(IEvaluationContext context) { TransactionalEditingDomain editingDomain = getEditingDomain(context); List<Diagram> diagrams = getSelectedDiagrams(); if (editingDomain != null && diagrams.size() == 1) { final Diagram diag = diagrams.get(0); final String diagramLabel = LabelInternationalization.getInstance().getDiagramLabelWithoutName(diag); if (null != diagramLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(diag)) { AbstractTransactionalCommand cmd = new RenameDiagramLabelCommand( <START> editingDomain, <END> "ChangeDiagramLabelCommand", diag, diagramLabel, "Rename diagram label...", "New label:"); return new GMFtoEMFCommandWrapper(cmd); } else { final String currentName = diag.getName(); if (currentName != null) { return new RenameElementCommand( editingDomain, "RenameDiagramCommand", diag, currentName, Messages.RenameDiagramHandler_RenameAnExistingDiagram, Messages.RenameDiagramHandler_NewName); } } } return UnexecutableCommand.INSTANCE; }</code><technical_language>discuss Nicolas, this class is useless. LabelInternationalizationUtils.getSetLabelCommand I</technical_language>

Target:
protected Command getCommand(IEvaluationContext context) { TransactionalEditingDomain editingDomain = getEditingDomain(context); List<Diagram> diagrams = getSelectedDiagrams(); if (editingDomain != null && diagrams.size() == 1) { final Diagram diag = diagrams.get(0); final String diagramLabel = LabelInternationalization.getInstance().getDiagramLabelWithoutName(diag); if (null != diagramLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(diag)) { AbstractTransactionalCommand cmd = new RenameDiagramLabelCommand(editingDomain, "ChangeDiagramLabelCommand", diag, diagramLabel, Messages.RenameDiagramHandler_Label_DialogTitle); return new GMFtoEMFCommandWrapper(cmd); } else { final String currentName = diag.getName(); if (currentName != null) { EStructuralFeature nameFeature = diag.eClass().getEStructuralFeature("name"); return new RenameElementCommand(editingDomain, "RenameDiagramCommand", diag, currentName, nameFeature, Messages.RenameDiagramHandler_RenameAnExistingDiagram, Messages.RenameDiagramHandler_NewName); } } } return UnexecutableCommand.INSTANCE; }
Source:
<code>private static Block spatialPartitions(KdbTree kdbTree, Rectangle envelope) { Map<Integer, Rectangle> partitions = kdbTree.findIntersectingLeaves(envelope); if (partitions.isEmpty()) { return EMPTY_ARRAY_OF_INTS; } boolean point = (envelope.getWidth() == 0 && envelope.getHeight() == 0); if (point) { for (Map.Entry<Integer, Rectangle> partition : partitions.entrySet()) { if (envelope.getXMin() < partition.getValue().getXMax() && envelope.getYMin() < partition.getValue().getYMax()) { BlockBuilder blockBuilder = IntegerType.INTEGER.createFixedSizeBlockBuilder(1); blockBuilder.writeInt(partition.getKey()); return blockBuilder.build(); } } throw new VerifyException(format("Cannot find half-open partition extent for a point: (%s, %s)", envelope.getXMin(), envelope.getYMin())); } BlockBuilder blockBuilder = IntegerType.INTEGER.createFixedSizeBlockBuilder(partitions.size()); <START> for (Integer id : partitions.keySet()) { <END> blockBuilder.writeInt(id); } return blockBuilder.build(); }</code><technical_language>int</technical_language>

Target:
private static Block spatialPartitions(KdbTree kdbTree, Rectangle envelope) { Map<Integer, Rectangle> partitions = kdbTree.findIntersectingLeaves(envelope); if (partitions.isEmpty()) { return EMPTY_ARRAY_OF_INTS; } boolean point = (envelope.getWidth() == 0 && envelope.getHeight() == 0); if (point) { for (Map.Entry<Integer, Rectangle> partition : partitions.entrySet()) { if (envelope.getXMin() < partition.getValue().getXMax() && envelope.getYMin() < partition.getValue().getYMax()) { BlockBuilder blockBuilder = IntegerType.INTEGER.createFixedSizeBlockBuilder(1); blockBuilder.writeInt(partition.getKey()); return blockBuilder.build(); } } throw new VerifyException(format("Cannot find half-open partition extent for a point: (%s, %s)", envelope.getXMin(), envelope.getYMin())); } BlockBuilder blockBuilder = IntegerType.INTEGER.createFixedSizeBlockBuilder(partitions.size()); for (int id : partitions.keySet()) { blockBuilder.writeInt(id); } return blockBuilder.build(); }
Source:
<code><START> public CompletableFuture<?> execute() { <END> CompletableFuture<Void> counter = new CompletableFuture<>(); delete(builderLedgerId, new SyncDeleteCallback(), counter); return counter; }</code><technical_language>please validate ledger id</technical_language>

Target:
public CompletableFuture<Void> execute() { CompletableFuture<Void> future = new CompletableFuture<>(); SyncDeleteCallback result = new SyncDeleteCallback(future); delete(builderLedgerId, result); return future; }
Source:
<code>public NotificationsPrefs() { soundsEnabled = new SimpleBooleanProperty(true); mentionSoundEnabled = new SimpleBooleanProperty(true); infoSoundEnabled = new SimpleBooleanProperty(true); warnSoundEnabled = new SimpleBooleanProperty(true); errorSoundEnabled = new SimpleBooleanProperty(true); <START> eventNotificationsEnabled = new SimpleBooleanProperty(true); <END> toastPosition = new SimpleObjectProperty<>(ToastPosition.BOTTOM_RIGHT); friendOnlineToastEnabled = new SimpleBooleanProperty(true); friendOfflineToastEnabled = new SimpleBooleanProperty(true); ladder1v1ToastEnabled = new SimpleBooleanProperty(true); friendOnlineSoundEnabled = new SimpleBooleanProperty(true); friendOfflineSoundEnabled = new SimpleBooleanProperty(true); friendJoinsGameSoundEnabled = new SimpleBooleanProperty(true); friendPlaysGameSoundEnabled = new SimpleBooleanProperty(true); friendPlaysGameToastEnabled = new SimpleBooleanProperty(true); friendJoinsGameToastEnabled = new SimpleBooleanProperty(true); privateMessageSoundEnabled = new SimpleBooleanProperty(true); privateMessageToastEnabled = new SimpleBooleanProperty(true); notifyOnAtMentionOnlyEnabled = new SimpleBooleanProperty(false); toastScreen = new SimpleIntegerProperty(0); toastDisplayTime = new SimpleIntegerProperty(5000); afterGameReviewEnabled = new SimpleBooleanProperty(true); }</code><technical_language>rename this? Semantically, this is a step</technical_language>

Target:
public NotificationsPrefs() { soundsEnabled = new SimpleBooleanProperty(true); mentionSoundEnabled = new SimpleBooleanProperty(true); infoSoundEnabled = new SimpleBooleanProperty(true); warnSoundEnabled = new SimpleBooleanProperty(true); errorSoundEnabled = new SimpleBooleanProperty(true); transientNotificationsEnabled = new SimpleBooleanProperty(true); toastPosition = new SimpleObjectProperty<>(ToastPosition.BOTTOM_RIGHT); friendOnlineToastEnabled = new SimpleBooleanProperty(true); friendOfflineToastEnabled = new SimpleBooleanProperty(true); ladder1v1ToastEnabled = new SimpleBooleanProperty(true); friendOnlineSoundEnabled = new SimpleBooleanProperty(true); friendOfflineSoundEnabled = new SimpleBooleanProperty(true); friendJoinsGameSoundEnabled = new SimpleBooleanProperty(true); friendPlaysGameSoundEnabled = new SimpleBooleanProperty(true); friendPlaysGameToastEnabled = new SimpleBooleanProperty(true); friendJoinsGameToastEnabled = new SimpleBooleanProperty(true); privateMessageSoundEnabled = new SimpleBooleanProperty(true); privateMessageToastEnabled = new SimpleBooleanProperty(true); notifyOnAtMentionOnlyEnabled = new SimpleBooleanProperty(false); toastScreen = new SimpleIntegerProperty(0); toastDisplayTime = new SimpleIntegerProperty(5000); afterGameReviewEnabled = new SimpleBooleanProperty(true); }
Source:
<code>public String eventDlOpen() { <START> return "lttng_ust_dl:dlopen"; <END> }</code><technical_language>is this LTTNG_UST</technical_language>

Target:
public String eventDlOpen() { return "ust_dl:dlopen"; }
Source:
<code><START> public void deleteMarkers(IMarker[] markers) { <END> for (IMarker marker : markers) { removeMarker(marker); } }</code><technical_language>removeMarker, deleteMarkers: word for</technical_language>

Target:
public void deleteMarkers(IMarker[] markers) { for (IMarker marker : markers) { deleteMarker(marker); } }
Source:
<code>private DBCursor getOrderedCursor(DBObject query) { <START> return collection.find(query).addSpecial("$orderby", new BasicDBObject(MongoConstants.ID, 1)); <END> }</code><technical_language>Check out MongoSortBuilder</technical_language>

Target:
private DBCursor getOrderedCursor(DBObject query) { return collection.find(query).sort(new MongoSortBuilder().ascending(MongoConstants.ID).build()); }
Source:
<code><START> public static Member getMember(Class<?> clazz, String property, ElementType elementType) { <END> Contracts.assertNotNull( clazz, MESSAGES.classCannotBeNull() ); if ( property == null || property.length() == 0 ) { throw log.getPropertyNameCannotBeNullOrEmptyException(); } if ( !( ElementType.FIELD.equals( elementType ) || ElementType.METHOD.equals( elementType ) ) ) { throw log.getElementTypeHasToBeFieldOrMethodException(); } Member member = null; if ( ElementType.FIELD.equals( elementType ) ) { GetDeclaredField action = GetDeclaredField.action( clazz, property ); if ( System.getSecurityManager() != null ) { member = AccessController.doPrivileged( action ); } else { member = action.run(); } } else { String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 ); for ( String prefix : ReflectionHelper.PROPERTY_ACCESSOR_PREFIXES ) { GetMethod action = GetMethod.action( clazz, prefix + methodName ); if ( System.getSecurityManager() != null ) { member = AccessController.doPrivileged( action ); } else { member = action.run(); } if ( member != null ) { break; } } } return member; }</code><technical_language>This public</technical_language>

Target:
private Member getMember(Class<?> clazz, String property, ElementType elementType) { Contracts.assertNotNull( clazz, MESSAGES.classCannotBeNull() ); if ( property == null || property.length() == 0 ) { throw log.getPropertyNameCannotBeNullOrEmptyException(); } if ( !( ElementType.FIELD.equals( elementType ) || ElementType.METHOD.equals( elementType ) ) ) { throw log.getElementTypeHasToBeFieldOrMethodException(); } Member member = null; if ( ElementType.FIELD.equals( elementType ) ) { GetDeclaredField action = GetDeclaredField.action( clazz, property ); if ( System.getSecurityManager() != null ) { member = AccessController.doPrivileged( action ); } else { member = action.run(); } } else { String methodName = property.substring( 0, 1 ).toUpperCase() + property.substring( 1 ); for ( String prefix : ReflectionHelper.PROPERTY_ACCESSOR_PREFIXES ) { GetMethod action = GetMethod.action( clazz, prefix + methodName ); if ( System.getSecurityManager() != null ) { member = AccessController.doPrivileged( action ); } else { member = action.run(); } if ( member != null ) { break; } } } return member; }
Source:
<code>public long length() throws IOException { <START> return exists() ? writeRaf().length() : -1; <END> }</code><technical_language>Conceptually, this readRaf() querying length is a "read" operation. (I realize in practice, matter due exists() check beforehand, code strange/wrong writeRaf() here.)</technical_language>

Target:
public long length() throws IOException { return exists() ? reader().length() : -1; }
Source:
<code>public void visitClass(ClassTree tree) { ClassType classType = ((ClassTreeImpl) tree).classType(); if (tree.name() != null) { tree.name().symbol().get().addType(classType); } <START> <END> for (MethodDeclarationTree methodDeclarationTree : tree.methods()) { Tree name = methodDeclarationTree.name(); if (name.is(Tree.Kind.IDENTIFIER_NAME)) { Scope classScope = getContext().getSymbolModel().getScope(tree); classType.addMethod((IdentifierTree) name, FunctionType.create(methodDeclarationTree), classScope); } } super.visitClass(tree); }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Call "Optional#isPresent()" accessing value. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public void visitClass(ClassTree tree) { ClassType classType = ((ClassTreeImpl) tree).classType(); if (tree.name() != null) { tree.name().symbol().get().addType(classType); } for (Tree element : tree.elements()) { Tree name; if (element.is(Tree.Kind.GET_METHOD, Tree.Kind.SET_METHOD)) { name = ((AccessorMethodDeclarationTree) element).name(); } else if (element.is(Tree.Kind.METHOD, Tree.Kind.GENERATOR_METHOD)) { name = ((MethodDeclarationTree) element).name(); } else { continue; } if (name.is(Tree.Kind.PROPERTY_IDENTIFIER)) { Scope classScope = getContext().getSymbolModel().getScope(tree); classType.addMethod((IdentifierTree) name, FunctionType.create((FunctionTree) element), classScope); } } super.visitClass(tree); }
Source:
<code>public void bindView(View view, Context context, Cursor cursor) { <START> view.setBackgroundResource(R.drawable.selectable_item_background); <END> TextView title = (TextView) view.findViewById(R.id.page_list_item_title); ImageView thumbnail = (ImageView) view.findViewById(R.id.page_list_item_image); SavedPage entry = SavedPage.PERSISTENCE_HELPER.fromCursor(cursor); title.setText(entry.getTitle().getDisplayText()); view.setTag(entry); if (app.isImageDownloadEnabled()) { Picasso.with(getActivity()) .load(cursor.getString(SavedPageContentProvider.COL_INDEX_IMAGE)) .placeholder(R.drawable.ic_pageimage_placeholder) .error(R.drawable.ic_pageimage_placeholder) .into(thumbnail); } else { Picasso.with(getActivity()) .load(R.drawable.ic_pageimage_placeholder) .into(thumbnail); } }</code><technical_language>is this needed in newView bindView</technical_language>

Target:
public void bindView(View view, Context context, Cursor cursor) { TextView title = (TextView) view.findViewById(R.id.page_list_item_title); ImageView thumbnail = (ImageView) view.findViewById(R.id.page_list_item_image); SavedPage entry = SavedPage.PERSISTENCE_HELPER.fromCursor(cursor); title.setText(entry.getTitle().getDisplayText()); view.setTag(entry); if (app.isImageDownloadEnabled()) { Picasso.with(getActivity()) .load(cursor.getString(SavedPageContentProvider.COL_INDEX_IMAGE)) .placeholder(R.drawable.ic_pageimage_placeholder) .error(R.drawable.ic_pageimage_placeholder) .into(thumbnail); } else { Picasso.with(getActivity()) .load(R.drawable.ic_pageimage_placeholder) .into(thumbnail); } }
Source:
<code>private void cancelCurrentBuilds(AbstractProject<?, ?> project, Integer prId) { if (overrideGlobal) { return; } <START> Queue queue = Jenkins.getInstance().getQueue(); <END> for (Queue.Item item : queue.getItems(project)) { GhprbCause cause = Ghprb.getCause(item); if (cause == null) { continue; } if (cause.getPullID() == prId) { queue.cancel(item); } } RunList<?> runs = project.getBuilds(); for (Run<?, ?> run : runs) { if (!run.isBuilding() && !run.hasntStartedYet()) { break; } GhprbCause cause = Ghprb.getCause(run); if (cause == null) { continue; } if (cause.getPullID() == prId) { run.addAction(this); run.getExecutor().interrupt(Result.ABORTED); } } }</code><technical_language>queue need locked here? protocol is editing queue. if queue item is cancelled is building</technical_language>

Target:
private void cancelCurrentBuilds(AbstractProject<?, ?> project, Integer prId) { if (overrideGlobal) { return; } Queue queue = Jenkins.getInstance().getQueue(); for (Queue.Item item : queue.getItems(project)) { GhprbCause qcause = null; for (Cause cause : item.getCauses()){ if (cause instanceof GhprbCause) { qcause = (GhprbCause) cause; } } if (qcause == null) { continue; } if (qcause.getPullID() == prId) { try { queue.cancel(item); } catch (Exception e) { logger.log(Level.SEVERE, "Unable to cancel queued build", e); } } } RunList<?> runs = project.getBuilds(); for (Run<?, ?> run : runs) { if (!run.isBuilding() && !run.hasntStartedYet()) { break; } GhprbCause cause = Ghprb.getCause(run); if (cause == null) { continue; } if (cause.getPullID() == prId) { try { run.addAction(this); run.getExecutor().interrupt(Result.ABORTED); } catch (Exception e) { run.getActions().remove(this); logger.log(Level.SEVERE, "Unable to interrupt build!", e); } } } }
Source:
<code>public void render(Context context, U value, SafeHtmlBuilder sb) { if (value != null) { <START> sb.appendHtmlConstant("<span title=\"" + titleProvider_.get(value) + "\" " + <END> "style=\"cursor: pointer;\">"); sb.append(image_.getSafeHtml()); sb.appendHtmlConstant("</span>"); } }</code><technical_language>title HTML escaped if HTML constant (which is presumed safe)</technical_language>

Target:
public void render(Context context, U value, SafeHtmlBuilder sb) { if (value != null) { sb.append(TEMPLATES.render(image_.getSafeHtml(), titleProvider_.get(value))); } }
Source:
<code>void setEmailUserId(@NonNull String id) { <START> boolean changed = id != null && !id.equals(emailUserId); <END> emailUserId = id; if (changed) observable.notifyChange(this); }</code><technical_language>changed true if setting email null set. This cover this. logic OSSubscriptionState.setUserId</technical_language>

Target:
void setEmailUserId(@NonNull String id) { boolean changed = false; if (id == null) changed = emailUserId != null; else if (!id.equals(emailUserId)) changed = true; emailUserId = id; if (changed) observable.notifyChange(this); }
Source:
<code>public ProcessedPoms process(final InternalNIOCompilationRequest req) { Path mainPom = Paths.get(req.getInfo().getPrjPath().toString(), POM_NAME); if (!Files.isReadable(mainPom)) { return new ProcessedPoms(Boolean.FALSE, Collections.emptyList()); } PomPlaceHolder placeHolder = editor.readSingle(mainPom); Boolean isPresent = isPresent(placeHolder); if (placeHolder.isValid() && !isPresent) { <START> List<String> pomsList = new ArrayList(); <END> InternalNIOMavenUtils.searchPoms(Paths.get(req.getInfo().getPrjPath().toString()), pomsList); if (pomsList.size() > 0) { processFoundedPoms(pomsList, req); } return new ProcessedPoms(Boolean.TRUE, pomsList); } else { return new ProcessedPoms(Boolean.FALSE, Collections.emptyList()); } }</code><technical_language>Please search for "new ArrayList(" in this PR fix occurences diamond operator avoid 8 unnecesary compiler warnings</technical_language>

Target:
public ProcessedPoms process(final InternalNIOCompilationRequest req) { Path mainPom = Paths.get(req.getInfo().getPrjPath().toString(), POM_NAME); if (!Files.isReadable(mainPom)) { return new ProcessedPoms(Boolean.FALSE, Collections.emptyList()); } PomPlaceHolder placeHolder = editor.readSingle(mainPom); Boolean isPresent = isPresent(placeHolder); if (placeHolder.isValid() && !isPresent) { List<String> pomsList = new ArrayList<>(); InternalNIOMavenUtils.searchPoms(Paths.get(req.getInfo().getPrjPath().toString()), pomsList); if (pomsList.size() > 0) { processFoundPoms(pomsList, req); } return new ProcessedPoms(Boolean.TRUE, pomsList); } else { return new ProcessedPoms(Boolean.FALSE, Collections.emptyList()); } }
Source:
<code>public void destroy(long entityId) { if (!entityManager.idLoaded(entityId)) { return; } EntityRef ref = createEntityRef(entityId); <START> if (entityManager.getEventSystem() != null) { <END> entityManager.getEventSystem().send(ref, BeforeDeactivateComponent.newInstance()); entityManager.getEventSystem().send(ref, BeforeRemoveComponent.newInstance()); } entityManager.notifyComponentRemovalAndEntityDestruction(entityId, ref); destroy(ref); }</code><technical_language>Introduce local field for entityManager.getEventSystem()</technical_language>

Target:
public void destroy(long entityId) { if (!entityManager.idLoaded(entityId)) { return; } EntityRef ref = createEntityRef(entityId); EventSystem eventSystem = entityManager.getEventSystem(); if (eventSystem != null) { eventSystem.send(ref, BeforeDeactivateComponent.newInstance()); eventSystem.send(ref, BeforeRemoveComponent.newInstance()); } entityManager.notifyComponentRemovalAndEntityDestruction(entityId, ref); destroy(ref); }
Source:
<code>private static boolean isValidExternalPath(IPath path) { if (path != null) { <START> if (UNCPathConverter.isUNC(path.toString())) { <END> return true; } File file = path.toFile(); if (file != null) { return file.exists(); } } return false; }</code><technical_language>sense introduce UNCPathConverter.isUNC(IPath) method operates path calling toString()</technical_language>

Target:
private static boolean isValidExternalPath(IPath path) { if (path != null) { if (path.isUNC()) { return true; } File file = path.toFile(); if (file != null) { return file.exists(); } } return false; }
Source:
<code>public void configure(Map stormConf, JsonNode paramNode) { JsonNode node = paramNode.get("urlFilters"); if (node != null && node.isArray()) { rules = new ArrayList<RegexRule>(); ArrayNode array = (ArrayNode) node; for (JsonNode urlFilterNode : array) { try { RegexRule rule = createRule(urlFilterNode.asText()); if (rule != null) { rules.add(rule); } } catch (IOException e) { LOG.error("There was an error reading regex filter {}", urlFilterNode.asText()); e.printStackTrace(); <START> } <END> } } else { JsonNode filenameNode = paramNode.get("regexFilterFile"); String rulesFileName; if (filenameNode != null) { rulesFileName = filenameNode.textValue(); } else { rulesFileName = "default-regex-filters.txt"; } rules = readRules(rulesFileName); } }</code><technical_language>I configure method lean, a readRules method takes ArrayNode</technical_language>

Target:
public void configure(Map stormConf, JsonNode paramNode) { JsonNode node = paramNode.get("urlFilters"); if (node != null && node.isArray()) { rules = readRules((ArrayNode) node); } else { JsonNode filenameNode = paramNode.get("regexFilterFile"); String rulesFileName; if (filenameNode != null) { rulesFileName = filenameNode.textValue(); } else { rulesFileName = "default-regex-filters.txt"; } rules = readRules(rulesFileName); } }
Source:
<code>public static void afterClass() { try { if (ConfigUtils.isDomain()) { CLI.reloadServers(); } else { CLI.reload(); } } finally { <START> CLI.closeClient(); <END> } }</code><technical_language>CLI methods static, CLI class contains state</technical_language>

Target:
public static void afterClass() { cli.closeClient(); }
Source:
<code>public void unbind( DataServiceClientService service ) { if ( dataServiceClientService.compareAndSet( service, null ) ) { <START> dataServiceClientService.set( null ); <END> ThinConnection.localClient = null; } }</code><technical_language>@nantunes compareAndSet do line 41 is doing</technical_language>

Target:
public void unbind( DataServiceClientService service ) { if ( dataServiceClientService.compareAndSet( service, null ) ) { ThinConnection.localClient = null; } }
Source:
<code>public CisConversionResult convertToPdf(InputStream inputStream, String filename, ConversionOption conversionOption) throws IOException { if (inputStream == null) { throw new IllegalArgumentException("inputStream == null"); } File tmpFile = null; try { tmpFile = getUniqueFile(); <START> Files.copy(inputStream, tmpFile.toPath()); <END> return convertToPdf(tmpFile, filename, conversionOption); } catch (IOException e) { LOGGER.error("Fout bij conversie van bestand " + filename + "naar PDF", e); throw createCisConversionException(e); } finally { FileUtil.deleteFile(tmpFile); tmpFile = null; } }</code><technical_language>Is necessary copy file here? This bad for performance. read a file multiple times concurrently</technical_language>

Target:
public CisConversionResult convertToPdf(InputStream inputStream, String filename, ConversionOption conversionOption) throws IOException { if (inputStream == null) { throw new IllegalArgumentException("inputStream == null"); } File tmpFile = null; try { tmpFile = getUniqueFile(); Files.copy(inputStream, tmpFile.toPath()); return convertToPdf(tmpFile, filename, conversionOption); } catch (IOException e) { LOGGER.error("Fout bij conversie van bestand " + filename + "naar PDF", e); throw createCisConversionException(e); } finally { com.aspose.pdf.MemoryCleaner.clearAllTempFiles(); FileUtil.deleteFile(tmpFile); tmpFile = null; } }
Source:
<code>public static Department findDepartment(HttpServletRequest request) <START> throws ServiceException{ <END> did = Integer.parseInt(request.getParameter("did")); return SQLSource.interact(new SQLInteractionInterface<Department>() { @Override public Department run(Connection connection) throws ServiceException, SQLException{ return Department.lookup(connection, did); } }); }</code><technical_language>_nitpick_: Space exception name curly brace</technical_language>

Target:
public static Department findDepartment(HttpServletRequest request) throws ServiceException { String deptID = request.getParameter("did"); if (deptID == null) { throw new ServiceException(ServiceStatus.MALFORMED_REQUEST); } final int did = Integer.parseInt(deptID); return SQLSource.interact(new SQLInteractionInterface<Department>() { @Override public Department run(Connection connection) throws ServiceException, SQLException { return Department.lookup(connection, did); } }); }
Source:
<code>protected void sendAppendRequest(Connection connection, MemberState member, AppendRequest request) { <START> long timestamp = System.currentTimeMillis(); <END> connection.<AppendRequest, AppendResponse>send(request).whenComplete((response, error) -> { context.checkThread(); if (!request.entries().isEmpty()) { member.completeAppend(System.currentTimeMillis() - timestamp); } else { member.completeAppend(); } if (open) { if (error == null) { LOGGER.debug("{} - Received from {}", context.getCluster().member().address(), response, member.getMember().address()); handleAppendResponse(member, request, response); } else { handleAppendResponseFailure(member, request, error); } } }); updateNextIndex(member, request); if (!request.entries().isEmpty() && hasMoreEntries(member)) { appendEntries(member); } }</code><technical_language>System.nanoTime() for resolution</technical_language>

Target:
protected void sendAppendRequest(Connection connection, MemberState member, AppendRequest request) { long timestamp = System.nanoTime(); connection.<AppendRequest, AppendResponse>send(request).whenComplete((response, error) -> { context.checkThread(); if (!request.entries().isEmpty()) { member.completeAppend(System.nanoTime() - timestamp); } else { member.completeAppend(); } if (open) { if (error == null) { LOGGER.debug("{} - Received from {}", context.getCluster().member().address(), response, member.getMember().address()); handleAppendResponse(member, request, response); } else { handleAppendResponseFailure(member, request, error); } } }); updateNextIndex(member, request); if (!request.entries().isEmpty() && hasMoreEntries(member)) { appendEntries(member); } }
Source:
<code>public void setUp() { converterWithPrefix = new EventConverter(new ObjectMapper(), null, "druid"); <START> converterWithSpacePrefix = new EventConverter(new ObjectMapper(), null, "legendary druid"); <END> converterWithoutPrefix = new EventConverter(new ObjectMapper(), null, null); }</code><technical_language>Space prefix ? change "legendary druid" "" rename variable</technical_language>

Target:
public void setUp() { converterWithNamespacePrefix = new EventConverter(new ObjectMapper(), null, "druid"); converterWithNamespacePrefixContainingSpace = new EventConverter(new ObjectMapper(), null, "legendary druid"); converterWithoutNamespacePrefix = new EventConverter(new ObjectMapper(), null, null); }
Source:
<code>public void testStopSequenceValidation() { StopTimeSequanceValidator stopSequenceValidator = new StopTimeSequanceValidator(); stopTimeUpdate.setStopSequence(1); tripUpdate.addStopTimeUpdate(stopTimeUpdate); <START> stopTimeUpdate.setStopSequence(5); <END> tripUpdate.addStopTimeUpdate(stopTimeUpdate); feedEntity.setTripUpdate(tripUpdate); feedMessage.setEntity(0, feedEntity); errors = stopSequenceValidator.validate(gtfsData, feedMessage.build()); assertNull(errors); stopTimeUpdate.setStopSequence(3); tripUpdate.addStopTimeUpdate(stopTimeUpdate); feedEntity.setTripUpdate(tripUpdate); feedMessage.setEntity(0, feedEntity); errors = stopSequenceValidator.validate(gtfsData, feedMessage.build()); assertEquals(1, errors.getOccurrenceList().size()); clearAndInitRequiredFeedFields(); }</code><technical_language>I building a new stopTimeUpdate for added list of tripUpdates, instead of updating stopTimeUpdate new stopSequences. add assertion for number of stopTimeUpdates exist in tripUpdate, is 2 total here? (and 3 total in next section unordered stopTimeUpdates)</technical_language>

Target:
public void testStopSequenceValidation() { StopTimeSequanceValidator stopSequenceValidator = new StopTimeSequanceValidator(); GtfsRealtime.TripUpdate.StopTimeUpdate.Builder stopTimeUpdateBuilder = GtfsRealtime.TripUpdate.StopTimeUpdate.newBuilder(); GtfsRealtime.TripDescriptor.Builder tripDescriptorBuilder = GtfsRealtime.TripDescriptor.newBuilder(); tripUpdateBuilder.setTrip(tripDescriptorBuilder.build()); feedEntityBuilder.setTripUpdate(tripUpdateBuilder.build()); feedMessageBuilder.setEntity(0, feedEntityBuilder.build()); stopTimeUpdateBuilder.setStopSequence(1); tripUpdateBuilder.addStopTimeUpdate(stopTimeUpdateBuilder.build()); stopTimeUpdateBuilder.setStopSequence(5); tripUpdateBuilder.addStopTimeUpdate(stopTimeUpdateBuilder.build()); feedEntityBuilder.setTripUpdate(tripUpdateBuilder.build()); feedMessageBuilder.setEntity(0, feedEntityBuilder.build()); assertEquals(2, feedMessageBuilder.getEntity(0).getTripUpdate().getStopTimeUpdateCount()); errors = stopSequenceValidator.validate(gtfsData, feedMessageBuilder.build()); assertNull(errors); stopTimeUpdateBuilder.setStopSequence(3); tripUpdateBuilder.addStopTimeUpdate(stopTimeUpdateBuilder.build()); feedEntityBuilder.setTripUpdate(tripUpdateBuilder.build()); feedMessageBuilder.setEntity(0, feedEntityBuilder.build()); assertEquals(3, feedMessageBuilder.getEntity(0).getTripUpdate().getStopTimeUpdateCount()); errors = stopSequenceValidator.validate(gtfsData, feedMessageBuilder.build()); assertEquals(1, errors.getOccurrenceList().size()); clearAndInitRequiredFeedFields(); }
Source:
<code>public void testBuildConfigs() { ViewerSorter comparator = ProjectViewerComparator.createProjectTreeSorter(new OpenShiftExplorerLabelProvider()); IBuildConfig config1 = Mockito.mock(IBuildConfig.class); when(config1.getKind()).thenReturn(ResourceKind.BUILD_CONFIG); when(config1.getName()).thenReturn("n"); when(config1.getSourceURI()).thenReturn("c1"); when(config1.toString()).thenReturn("z"); ObservableTreeItem i1 = new ObservableTreeItem(config1); IBuildConfig config2 = Mockito.mock(IBuildConfig.class); when(config2.getKind()).thenReturn(ResourceKind.BUILD_CONFIG); when(config2.getName()).thenReturn("n"); when(config2.getSourceURI()).thenReturn("c2"); when(config2.toString()).thenReturn("x"); ObservableTreeItem i2 = new ObservableTreeItem(config2); <START> assertTrue(comparator.compare(null, i1, i2) < 0); END> }</code><technical_language>check comparator.compare(null, i2, i1) comparator.compare(null, i1, i1)</technical_language>

Target:
public void testBuildConfigs() { ViewerComparator comparator = ProjectViewerComparator.createProjectTreeSorter(new OpenShiftExplorerLabelProvider()); ObservableTreeItem i1 = new ObservableTreeItem(mockBuildConfig("n", "c1", "z")); ObservableTreeItem i2 = new ObservableTreeItem(mockBuildConfig("n", "c2", "x")); assertTrue(comparator.compare(null, i1, i2) < 0); assertTrue(comparator.compare(null, i2, i1) > 0); assertEquals(0, comparator.compare(null, i1, i1)); }
Source:
<code>public void GenericPacketTest() throws BadPacketException, IOException, BadPcapFileException { PcapTestTrace trace = PcapTestTrace.MOSTLY_TCP; assumeTrue(trace.exists()); <START> PcapFile dummy = trace.getTrace(); <END> ByteBuffer byteBuffer = fEthernetPacket; if (byteBuffer == null) { fail("GenericPacketTest has failed!"); return; } Packet packet = new EthernetIIPacket(dummy, null, byteBuffer); assertTrue(packet.hasProtocol(PcapProtocol.ETHERNET_II)); assertTrue(packet.hasProtocol(PcapProtocol.UNKNOWN)); assertFalse(packet.hasProtocol(PcapProtocol.TCP)); assertEquals(PcapProtocol.ETHERNET_II, packet.getProtocol()); assertEquals(packet, packet.getPacket(PcapProtocol.ETHERNET_II)); assertNull(packet.getPacket(PcapProtocol.TCP)); assertEquals(packet.getChildPacket(), packet.getPacket(PcapProtocol.UNKNOWN)); assertEquals(packet.getPacket(PcapProtocol.ETHERNET_II), packet.getMostEcapsulatedPacket()); assertNull(packet.getParentPacket()); assertFalse(packet.getPcapFile().equals(null)); Packet child = packet.getChildPacket(); if (child == null) { fail("GenericPacketTest has failed!"); return; } assertEquals(packet.getPayload(), child.getPayload()); assertEquals(packet.getGlobalSummaryString(), "Source MAC: 10:f8:82:b3:44:78 , Destination MAC: 34:67:0c:d2:91:51"); }</code><technical_language>I try</technical_language>

Target:
public void GenericPacketTest() throws BadPacketException, IOException, BadPcapFileException { PcapTestTrace trace = PcapTestTrace.MOSTLY_TCP; assumeTrue(trace.exists()); try (PcapFile dummy = trace.getTrace();) { ByteBuffer byteBuffer = fEthernetPacket; if (byteBuffer == null) { fail("GenericPacketTest has failed!"); return; } Packet packet = new EthernetIIPacket(dummy, null, byteBuffer); assertTrue(packet.hasProtocol(PcapProtocol.ETHERNET_II)); assertTrue(packet.hasProtocol(PcapProtocol.UNKNOWN)); assertFalse(packet.hasProtocol(PcapProtocol.TCP)); assertEquals(PcapProtocol.ETHERNET_II, packet.getProtocol()); assertEquals(packet, packet.getPacket(PcapProtocol.ETHERNET_II)); assertNull(packet.getPacket(PcapProtocol.TCP)); assertEquals(packet.getChildPacket(), packet.getPacket(PcapProtocol.UNKNOWN)); assertEquals(packet.getPacket(PcapProtocol.ETHERNET_II), packet.getMostEcapsulatedPacket()); assertNull(packet.getParentPacket()); assertFalse(packet.getPcapFile().equals(null)); Packet child = packet.getChildPacket(); if (child == null) { fail("GenericPacketTest has failed!"); return; } assertEquals(packet.getPayload(), child.getPayload()); assertEquals(packet.getGlobalSummaryString(), "Source MAC: 10:f8:82:b3:44:78 , Destination MAC: 34:67:0c:d2:91:51"); } }