auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public double[] getGranulesNativeResolutionIfSame(GranuleSource granuleSource) throws IOException { Map<String, DimensionDescriptor> descriptors = crsRequestHandler.getDescriptors(); DimensionDescriptor resDescriptor = descriptors.get(DimensionDescriptor.RESOLUTION); DimensionDescriptor resXDescriptor = descriptors.get(DimensionDescriptor.RESOLUTION_X); DimensionDescriptor resYDescriptor = descriptors.get(DimensionDescriptor.RESOLUTION_Y); final String resXAttribute = hasBothResolutions ? resXDescriptor.getStartAttribute() : resDescriptor.getStartAttribute(); final String resYAttribute = hasBothResolutions ? resYDescriptor.getStartAttribute() : resDescriptor.getStartAttribute(); <START> SimpleFeatureCollection granules = granuleSource.getGranules(Query.ALL); <END> SimpleFeatureIterator iterator = granules.features(); TreeSet<Double> resolutionsX = new TreeSet<>(); TreeSet<Double> resolutionsY = new TreeSet<>(); while (iterator.hasNext()) { SimpleFeature feature = iterator.next(); resolutionsX.add((Double) feature.getAttribute(resXAttribute)); resolutionsY.add((Double) feature.getAttribute(resYAttribute)); } if (resolutionsX.size() > 1 || resolutionsY.size() > 1) return null; return new double[] {resolutionsX.first(), resolutionsY.first()}; }</code><technical_language>careful. This query return granules DB. thousands/millions for a country. I refine query a bbox ROI similar in other methods around</technical_language>

Target:
public double[] getGranulesNativeResolutionIfSame(GranuleSource granuleSource) throws IOException, TransformException, FactoryException { Query query = initQuery(granuleSource); SimpleFeatureCollection granules = granuleSource.getGranules(query); return getGranulesNativeResolutionIfSame(granules); }
Source:
<code>private static WorkProcessor<Page> buildPage( WorkProcessor<PageWithPosition> pageWithPositions, List<Integer> outputChannels, List<Type> outputTypes, BiPredicate<PageBuilder, PageWithPosition> pageBreakPredicate, boolean updateMemoryAfterEveryPosition, AggregatedMemoryContext aggregatedMemoryContext, DriverYieldSignal yieldSignal) { LocalMemoryContext memoryContext = aggregatedMemoryContext.newLocalMemoryContext(MergeSortedPages.class.getSimpleName()); PageBuilder pageBuilder = new PageBuilder(outputTypes); return pageWithPositions.transform(pageWithPositionOptional -> { if (yieldSignal.isSet()) { <START> return TransformationState.yield(); <END> } boolean finished = !pageWithPositionOptional.isPresent(); if (finished && pageBuilder.isEmpty()) { memoryContext.close(); return TransformationState.finished(); } if (finished || pageBreakPredicate.test(pageBuilder, pageWithPositionOptional.get())) { if (!updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } Page page = pageBuilder.build(); pageBuilder.reset(); if (!finished) { pageWithPositionOptional.get().appendTo(pageBuilder, outputChannels, outputTypes); } if (updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } return TransformationState.ofResult(page, !finished); } pageWithPositionOptional.get().appendTo(pageBuilder, outputChannels, outputTypes); if (updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } return TransformationState.needsMoreData(); }); }</code><technical_language>need TransformationState prefix here, do we</technical_language>

Target:
private static WorkProcessor<Page> buildPage( WorkProcessor<PageWithPosition> pageWithPositions, List<Integer> outputChannels, List<Type> outputTypes, BiPredicate<PageBuilder, PageWithPosition> pageBreakPredicate, boolean updateMemoryAfterEveryPosition, AggregatedMemoryContext aggregatedMemoryContext, DriverYieldSignal yieldSignal) { LocalMemoryContext memoryContext = aggregatedMemoryContext.newLocalMemoryContext(MergeSortedPages.class.getSimpleName()); PageBuilder pageBuilder = new PageBuilder(outputTypes); return pageWithPositions .yielding(yieldSignal::isSet) .transform(pageWithPositionOptional -> { boolean finished = !pageWithPositionOptional.isPresent(); if (finished && pageBuilder.isEmpty()) { memoryContext.close(); return TransformationState.finished(); } if (finished || pageBreakPredicate.test(pageBuilder, pageWithPositionOptional.get())) { if (!updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } Page page = pageBuilder.build(); pageBuilder.reset(); if (!finished) { pageWithPositionOptional.get().appendTo(pageBuilder, outputChannels, outputTypes); } if (updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } return TransformationState.ofResult(page, !finished); } pageWithPositionOptional.get().appendTo(pageBuilder, outputChannels, outputTypes); if (updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } return TransformationState.needsMoreData(); }); }
Source:
<code>static StreamsAddressResponse aggregateLogAddressSpace(Set<StreamsAddressResponse> responses) { <START> Map<UUID, StreamAddressSpace> streamAddressSpaceMap = new HashMap<>(); <END> long logTail = Address.NON_ADDRESS; for (StreamsAddressResponse res : responses) { logTail = Math.max(logTail, res.getLogTail()); streamAddressSpaceMap = aggregateStreamAddressMap(res.getAddressMap(), streamAddressSpaceMap); } return new StreamsAddressResponse(logTail, streamAddressSpaceMap); }</code><technical_language>suffix map is redundant, adds cognitive complexity</technical_language>

Target:
static StreamsAddressResponse aggregateLogAddressSpace(Set<StreamsAddressResponse> responses) { Map<UUID, StreamAddressSpace> streamAddressSpace = new HashMap<>(); long logTail = Address.NON_ADDRESS; for (StreamsAddressResponse res : responses) { logTail = Math.max(logTail, res.getLogTail()); streamAddressSpace = aggregateStreamAddressMap(res.getAddressMap(), streamAddressSpace); } return new StreamsAddressResponse(logTail, streamAddressSpace); }
Source:
<code>private void removeDuplicates(List<TaggedValuePointable> pointables) { int size = pointables.size(); for (int i = 0; i < size - 1; i++) { for (int j = i + 1; j < size; j++) { if (!FunctionHelper.arraysEqual(pointables.get(j), pointables.get(i))) <START> continue; <END> pointables.remove(j); j--; size--; } } }</code><technical_language>Wrap line if curly braces</technical_language>

Target:
private void removeDuplicates(List<TaggedValuePointable> pointables) { int size = pointables.size(); for (int i = 0; i < size - 1; i++) { for (int j = i + 1; j < size; j++) { if (!FunctionHelper.arraysEqual(pointables.get(j), pointables.get(i))) { continue; } pointables.remove(j); j--; size--; } } }
Source:
<code>public Schema inferSchema(CSVRecord record) { Schema schema = Schema.createRecord(RECORD_NAME, "", NAMESPACE, false); <START> List<Schema.Field> fields = new ArrayList(); <END> if (runtimeHeaders != null) { for (Entry<String, Integer> f : runtimeHeaders.entrySet()) { Schema.Field field = new Schema.Field(f.getKey(), AvroUtils._string(), "", null); fields.add(field); } } else { for (int i = 0; i < record.size(); i++) { Schema.Field field = new Schema.Field("newColumn" + i, AvroUtils._string(), "", null); fields.add(field); } } schema.setFields(fields); return schema; }</code><technical_language>diamond operator missed: ArrayList<></technical_language>

Target:
public Schema inferSchema(CSVRecord record) { final Schema schema = Schema.createRecord(RECORD_NAME, "", NAMESPACE, false); final Schema nullableString = SchemaBuilder.nullable().stringType(); List<Schema.Field> fields = new ArrayList<>(); if (runtimeHeaders != null) { for (Entry<String, Integer> f : runtimeHeaders.entrySet()) { Schema.Field field = new Schema.Field(normalizeName(f.getKey()), nullableString, "", null); fields.add(field); } } else { for (int i = 0; i < record.size(); i++) { Schema.Field field = new Schema.Field("newColumn" + i, nullableString, "", null); fields.add(field); } } schema.setFields(fields); return schema; }
Source:
<code>private void sendToSocket(Socket socket, String cmdString) throws IOException { byte[] sendBytes = ("A" + cmdString.trim().replaceAll("\\s+", " ") + "\n").getBytes(); <START> socket.getInputStream().skip(tcpSocket.getInputStream().available()); <END> socket.getOutputStream().write(sendBytes); socket.getOutputStream().flush(); AstericsErrorHandling.instance.reportInfo(this, "IRTrans sent data: " + cmdString); }</code><technical_language>member variable tcpSocket, shouldnt parameter socket</technical_language>

Target:
private void sendToSocket(Socket socket, String cmdString) throws IOException { byte[] sendBytes = ("A" + cmdString.trim().replaceAll("\\s+", " ") + "\n").getBytes(); socket.getInputStream().skip(socket.getInputStream().available()); socket.getOutputStream().write(sendBytes); socket.getOutputStream().flush(); AstericsErrorHandling.instance.reportInfo(this, "IRTrans sent data: " + cmdString); }
Source:
<code>private void addCustomMapping(final String indexName) { final RelationshipAPI relationshipAPI = APILocator.getRelationshipAPI(); final Set<String> mappedRelationships = addCustomMappingFromFieldVariables(indexName, relationshipAPI); <START> <END> addCustomMappingForRelationships(indexName, relationshipAPI, mappedRelationships); }</code><technical_language>passing relationshipAPI attribute</technical_language>

Target:
private void addCustomMapping(final String indexName) { final Set<String> mappedRelationships = addCustomMappingFromFieldVariables(indexName); addCustomMappingForRelationships(indexName, mappedRelationships); }
Source:
<code>public void thenTheyAreEquals() { <START> assertEquals("they are equals", first, second); <END> }</code><technical_language>prefer this Hamcrest assertThat for consistency</technical_language>

Target:
public void thenTheyAreEquals() { assertThat(first, is(equalTo(second))); }
Source:
<code>private void layoutWikiDataDescription(String description) { pageDescriptionText.setText(description); pageDescriptionText.post(new Runnable() { @Override public void run() { if (!parentFragment.isAdded()) { return; } if (pageDescriptionText.getLineCount() > 2) { <START> pageDescriptionText.setVisibility(View.GONE); <END> } else { pageDescriptionText.setVisibility(View.VISIBLE); } } }); }</code><technical_language>consider pageDescriptionText.setVisibility(pageDescriptionText.getLineCount() > 2 > View.VISIBLE : View.GONE); emphasize conditional effects function input other logic</technical_language>

Target:
private void layoutWikiDataDescription(String description) { pageDescriptionText.setText(description); pageDescriptionText.post(new Runnable() { @Override public void run() { if (!parentFragment.isAdded()) { return; } pageDescriptionText.setVisibility(pageDescriptionText.getLineCount() > 2 ? View.GONE : View.VISIBLE); } }); }
Source:
<code>private void deselectParentIfNoChildSelected(final CheckStateChangedEvent event, final FieldToContractInputMapping mapping, final CheckboxTreeViewer checkboxTreeViewer) { <START> if (!event.getChecked() && mapping.getParent() != null) { <END> boolean deselect = true; for (final FieldToContractInputMapping m : mapping.getParent().getChildren()) { if (checkboxTreeViewer.getChecked(m)) { deselect = false; } } if (deselect) { checkboxTreeViewer.setChecked(mapping.getParent(), false); } } }</code><technical_language>extract mapping.getPrent in a variable is called 3 times</technical_language>

Target:
private void deselectParentIfNoChildSelected(final CheckStateChangedEvent event, final FieldToContractInputMapping mapping, final CheckboxTreeViewer checkboxTreeViewer) { final FieldToContractInputMapping parentMapping = mapping.getParent(); if (!event.getChecked() && parentMapping != null) { boolean deselect = true; for (final FieldToContractInputMapping m : parentMapping.getChildren()) { if (checkboxTreeViewer.getChecked(m)) { deselect = false; } } if (deselect) { checkboxTreeViewer.setChecked(parentMapping, false); } } }
Source:
<code>private static void bindPositional(ParsedParameters params, Binding binding, PreparedStatement statement, StatementContext context) { boolean moreArgumentsProvidedThanDeclared = binding.findForPosition(params.getParameterCount()).isPresent(); if (moreArgumentsProvidedThanDeclared && !context.getConfig(SqlStatements.class).isUnusedBindingAllowed()) { throw new UnableToCreateStatementException("Superfluous positional param at (0 based) position " + params.getParameterCount(), context); } for (int i = 0; i < params.getParameterCount(); i++) { Optional<Argument> argument = binding.findForPosition(i); <START> if (argument.isPresent()) { <END> try { argument.get().apply(i + 1, statement, context); } catch (SQLException e) { throw new UnableToCreateStatementException("Exception while binding positional param at (0 based) position " + i, e, context); } } else { throw new UnableToCreateStatementException("Missing positional param at (0 based) position " + i, context); } } }</code><technical_language>Do argument.orElseThrow(...) nicer? isPresent is a discouraged usage of optional</technical_language>

Target:
private static void bindPositional(ParsedParameters params, Binding binding, PreparedStatement statement, StatementContext context) { boolean moreArgumentsProvidedThanDeclared = binding.findForPosition(params.getParameterCount()).isPresent(); if (moreArgumentsProvidedThanDeclared && !context.getConfig(SqlStatements.class).isUnusedBindingAllowed()) { throw new UnableToCreateStatementException("Superfluous positional param at (0 based) position " + params.getParameterCount(), context); } for (int i = 0; i < params.getParameterCount(); i++) { Optional<Argument> argument = binding.findForPosition(i); try { int index = i; argument.orElseThrow(() -> new UnableToCreateStatementException("Missing positional param at (0 based) position " + index, context)).apply(i + 1, statement, context); } catch (SQLException e) { throw new UnableToCreateStatementException("Exception while binding positional param at (0 based) position " + i, e, context); } } }
Source:
<code>private Object metadata() throws IOException { if (metadata == null && !resolved) { try { switch (info) { case DIRECTORY_ASSUMED: metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.DIRECTORY_CONFIRMED; resolved = true; break; case DIRECTORY_CONFIRMED: metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); resolved = true; break; case NON_DIRECTORY_CONFIRMED: metadata = repo.getFileContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); resolved = true; break; case UNRESOLVED: checkOpen(); try { metadata = repo.getFileContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.NON_DIRECTORY_CONFIRMED; resolved = true; } catch (IOException e) { if (e.getCause() instanceof JsonMappingException <START> || e.getCause().getCause() instanceof JsonMappingException ) { <END> metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.DIRECTORY_CONFIRMED; resolved = true; } else { throw e; } } break; } } catch (FileNotFoundException e) { metadata = null; resolved = true; } } return metadata; }</code><technical_language>I need a null check here: suggestion || e.getCause() != null && e.getCause().getCause() instanceof JsonMappingException ) {</technical_language>

Target:
private Object metadata() throws IOException { if (metadata == null && !resolved) { try { switch (info) { case DIRECTORY_ASSUMED: metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.DIRECTORY_CONFIRMED; resolved = true; break; case DIRECTORY_CONFIRMED: metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); resolved = true; break; case NON_DIRECTORY_CONFIRMED: metadata = repo.getFileContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); resolved = true; break; case UNRESOLVED: checkOpen(); try { metadata = repo.getFileContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.NON_DIRECTORY_CONFIRMED; resolved = true; } catch (IOException e) { if (e.getCause() instanceof JsonMappingException || e.getCause() != null && e.getCause().getCause() instanceof JsonMappingException ) { metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.DIRECTORY_CONFIRMED; resolved = true; } else { throw e; } } break; } } catch (FileNotFoundException e) { metadata = null; resolved = true; } } return metadata; }
Source:
<code>public NewGTFSError setSequence(String sequenceAsString) { <START> Integer sequence = null; <END> try { sequence = Integer.parseInt(sequenceAsString); } catch (NumberFormatException e) { e.printStackTrace(); } this.entitySequenceNumber = sequence; return this; }</code><technical_language>I this a primitive int a boxed object</technical_language>

Target:
public NewGTFSError setSequence(String sequenceAsString) { try { this.entitySequenceNumber = Integer.parseInt(sequenceAsString); } catch (NumberFormatException e) { e.printStackTrace(); this.entitySequenceNumber = null; } return this; }
Source:
<code>public SpongePagedData(List<Text> pages) { super(PagedData.class); <START> this.pages = pages; <END> registerGettersAndSetters(); }</code><technical_language>applies of lore data</technical_language>

Target:
public SpongePagedData(List<Text> pages) { super(PagedData.class); this.pages = Lists.newArrayList(pages); registerGettersAndSetters(); }
Source:
<code>private IType findNonPrimaryType(String fullyQualifiedName, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException { SearchPattern p= SearchPattern.createPattern(fullyQualifiedName, IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE); final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(p); engine.setFiltering(true, true); engine.setScope(RefactoringScopeFactory.create(fCtorBinding.getDeclaringClass().getJavaElement().getJavaProject())); engine.setStatus(status); engine.searchPattern(new SubProgressMonitor(pm, 1)); SearchResultGroup[] groups= (SearchResultGroup[]) engine.getResults(); if (groups.length != 0) { for (SearchResultGroup <START> group : <END> groups) { for (SearchMatch match : group.getSearchResults()) { if (match.getAccuracy() == SearchMatch.A_ACCURATE) { return (IType) match.getElement(); } } } } return null; }</code><technical_language>rename rg, matches group</technical_language>

Target:
private IType findNonPrimaryType(String fullyQualifiedName, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException { SearchPattern p= SearchPattern.createPattern(fullyQualifiedName, IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchUtils.GENERICS_AGNOSTIC_MATCH_RULE); final RefactoringSearchEngine2 engine= new RefactoringSearchEngine2(p); engine.setFiltering(true, true); engine.setScope(RefactoringScopeFactory.create(fCtorBinding.getDeclaringClass().getJavaElement().getJavaProject())); engine.setStatus(status); engine.searchPattern(new SubProgressMonitor(pm, 1)); SearchResultGroup[] groups= (SearchResultGroup[]) engine.getResults(); if (groups.length != 0) { for (SearchResultGroup rg : groups) { for (SearchMatch match : rg.getSearchResults()) { if (match.getAccuracy() == SearchMatch.A_ACCURATE) { return (IType) match.getElement(); } } } } return null; }
Source:
<code>public Builder hostSelectors(final List<HostSelector> hostSelectors) { <START> this.hostSelectors = hostSelectors; <END> return this; }</code><technical_language>a defensive copy of this list, ImmutableList.copyOf()</technical_language>

Target:
public Builder hostSelectors(final List<HostSelector> hostSelectors) { this.hostSelectors = ImmutableList.copyOf(hostSelectors); return this; }
Source:
<code>CreateReviewNotes(@GerritPersonIdent final PersonIdent gerritIdent, final AccountCache accountCache, final @AnonymousCowardName String anonymousCowardName, final ProjectCache projectCache, final LabelNormalizer labelNormalizer, final NotesBranchUtil.Factory notesBranchUtilFactory, final @Nullable @CanonicalWebUrl String canonicalWebUrl, final @Assisted ReviewDb reviewDb, final @Assisted Project.NameKey project, final @Assisted Repository git) { this.gerritServerIdent = gerritIdent; this.accountCache = accountCache; this.anonymousCowardName = anonymousCowardName; ProjectState projectState = projectCache.get(project); if (projectState == null) { log.error("Could not obtain available labels for project " <START> + project.get() + ". Expect missing labels its review notes."); <END> this.labelTypes = new LabelTypes(Collections.<LabelType> emptyList()); } else { this.labelTypes = projectState.getLabelTypes(); } this.labelNormalizer = labelNormalizer; this.notesBranchUtilFactory = notesBranchUtilFactory; this.canonicalWebUrl = canonicalWebUrl; this.reviewDb = reviewDb; this.project = project; this.git = git; }</code><technical_language>"missing labels in its"</technical_language>

Target:
CreateReviewNotes(@GerritPersonIdent final PersonIdent gerritIdent, final AccountCache accountCache, final @AnonymousCowardName String anonymousCowardName, final ProjectCache projectCache, final LabelNormalizer labelNormalizer, final NotesBranchUtil.Factory notesBranchUtilFactory, final @Nullable @CanonicalWebUrl String canonicalWebUrl, final @Assisted ReviewDb reviewDb, final @Assisted Project.NameKey project, final @Assisted Repository git) { this.gerritServerIdent = gerritIdent; this.accountCache = accountCache; this.anonymousCowardName = anonymousCowardName; ProjectState projectState = projectCache.get(project); if (projectState == null) { log.error("Could not obtain available labels for project " + project.get() + ". Expect missing labels in its review notes."); this.labelTypes = new LabelTypes(Collections.<LabelType> emptyList()); } else { this.labelTypes = projectState.getLabelTypes(); } this.labelNormalizer = labelNormalizer; this.notesBranchUtilFactory = notesBranchUtilFactory; this.canonicalWebUrl = canonicalWebUrl; this.reviewDb = reviewDb; this.project = project; this.git = git; }
Source:
<code>public void run() { if (log.isDebugEnabled()) { log.debug("Format of the email:" + " " + to + "->" + type); } MimeMessage message = new MimeMessage(session); StringBuilder stringBuilder = new StringBuilder(); if (type.equals(EmailEventAdapterConstants.MAIL_TEXT_PLAIN)) { stringBuilder.append(body); } else if (type.equals(EmailEventAdapterConstants.MAIL_TEXT_HTML)) { stringBuilder.append("<b>"); stringBuilder.append("<u>"); stringBuilder.append(body); stringBuilder.append("</u>"); stringBuilder.append("</b>"); <START> } <END> String finalString = stringBuilder.toString(); try { message.setFrom(smtpFromAddress); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject(subject); message.setSentDate(new Date()); message.setContent(finalString, type); if (log.isDebugEnabled()) { log.debug("Meta data of the email configured successfully"); } Transport.send(message); if (log.isDebugEnabled()) { log.debug("Mail sent to the EmailID" + " " + to + " " + "Successfully"); } } catch (MessagingException e) { log.error("Message format error in sending the Email from : " + smtpFromAddress, e); } catch (Exception e) { log.error("Error in sending the Email : " + to, e); } }</code><technical_language>Kasun, code segement ?? u clean code sending a pull request ??</technical_language>

Target:
public void run() { if (log.isDebugEnabled()) { log.debug("Format of the email:" + " " + to + "->" + type); } MimeMessage message = new MimeMessage(session); try { message.setFrom(smtpFromAddress); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject(subject); message.setSentDate(new Date()); message.setContent(body, type); if (log.isDebugEnabled()) { log.debug("Meta data of the email configured successfully"); } Transport.send(message); if (log.isDebugEnabled()) { log.debug("Mail sent to the EmailID" + " " + to + " " + "Successfully"); } } catch (MessagingException e) { log.error("Message format error in sending the Email from : " + smtpFromAddress, e); } catch (Exception e) { log.error("Error in sending the Email : " + to, e); } }
Source:
<code>public CXFSAMLCallbackHandler(final HOKSAMLAssertionBuilder builder) { this.builder = builder; <START> accessor = PropertyAccessor.getInstance(); <END> }</code><technical_language>prevent code duplication, change body of this constructor following? this(); this.builder = builder;</technical_language>

Target:
public CXFSAMLCallbackHandler(final HOKSAMLAssertionBuilder builder) { this(); this.builder = builder; }
Source:
<code>public InputStream call() throws Exception { try { ReportListenerThreadHolder.setListener( listener ); final long start = System.currentTimeMillis(); AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass() .getName(), MessageTypes.INSTANCE_START, instanceId, "", 0, null ); if ( reportComponent.execute() ) { <START> listener.setStatus( AsyncExecutionStatus.FINISHED ); <END> return handler.getStagingContent(); } listener.setStatus( AsyncExecutionStatus.FAILED ); AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass() .getName(), MessageTypes.FAILED, instanceId, "", 0, null ); return new NullInputStream( 0 ); } finally { ReportListenerThreadHolder.clear(); } }</code><technical_language>is reason longer log Audit information for success of execution</technical_language>

Target:
@Override public InputStream call() throws Exception { listener.setStatus( AsyncExecutionStatus.WORKING ); try { ReportListenerThreadHolder.setListener( listener ); final long start = System.currentTimeMillis(); AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass().getName(), MessageTypes.INSTANCE_START, instanceId, "", 0, null ); if ( reportComponent.execute() ) { final long end = System.currentTimeMillis(); AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass().getName(), MessageTypes.INSTANCE_END, instanceId, "", ( (float) ( end - start ) / 1000 ), null ); listener.setStatus( AsyncExecutionStatus.FINISHED ); return handler.getStagingContent(); } if ( listener.getStatus() != AsyncExecutionStatus.CANCELED ) { listener.setStatus( AsyncExecutionStatus.FAILED ); } AuditHelper.audit( userSession, userSession, url, getClass().getName(), getClass().getName(), MessageTypes.FAILED, instanceId, "", 0, null ); return new NullInputStream( 0 ); } finally { ReportListenerThreadHolder.clear(); } }
Source:
<code>public void put(final K key, final V value) { final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { try { if (cacheWriter != null) { cacheWriter.write(key, value); } } catch (RuntimeException e) { throw new CacheWriterException(e); } return value; } }); try { store.compute(key, remappingFunction); } catch (CacheAccessException e) { try { <START> remappingFunction.apply(key, value); <END> store.remove(key); resilienceStrategy.recoveredFrom(key, e); } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } } catch(CacheWriterException e) { try { store.remove(key); resilienceStrategy.recoveredFrom(key, e); throw e; } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e1, e); } } }</code><technical_language>This fishy - attempting write new SOR again, removing key store line - this introduce inconsistency</technical_language>

Target:
public void put(final K key, final V value) { checkNonNull(key, value); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { try { if (cacheWriter != null) { cacheWriter.write(key, value); } } catch (RuntimeException e) { throw new CacheWriterException(e); } return value; } }); try { store.compute(key, remappingFunction); } catch (CacheAccessException e) { try { remappingFunction.apply(key, value); store.remove(key); resilienceStrategy.recoveredFrom(key, e); } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e, e1); } } catch(CacheWriterException e) { try { store.remove(key); resilienceStrategy.recoveredFrom(key, e); throw e; } catch (CacheAccessException e1) { resilienceStrategy.possiblyInconsistent(key, e1, e); } } }
Source:
<code>public void release(V bean) { K id = bean.getId(); Entry<V> entry = this.entries.get(id); if ((entry != null) && entry.done()) { if (this.timeout != null) { long value = this.timeout.getValue(); if (value > 0) { TimeUnit unit = this.timeout.getTimeUnit(); RemoveTask task = new RemoveTask(id); synchronized (task) { this.expirationFutures.put(id, this.executor.schedule(task, value, unit)); } } else if (value == 0) { remove(id); } } else { <START> remove(id); <END> } } }</code><technical_language>This right. This a SFSB retains state multiple invocations if define a @StatefulTimeout</technical_language>

Target:
public void release(V bean) { K id = bean.getId(); Entry<V> entry = this.entries.get(id); if ((entry != null) && entry.done()) { if (this.timeout != null) { long value = this.timeout.getValue(); if (value > 0) { TimeUnit unit = this.timeout.getTimeUnit(); RemoveTask task = new RemoveTask(id); synchronized (task) { this.expirationFutures.put(id, this.executor.schedule(task, value, unit)); } } else if (value == 0) { remove(id); } } } }
Source:
<code>public long concurrencyKey() { <START> return (key); <END> }</code><technical_language>Get rid of needed parenthesis</technical_language>

Target:
public long concurrencyKey() { return key; }
Source:
<code>public MetricsTableWrapperAggregateImpl(final HRegionServer regionServer) { this.regionServer = regionServer; this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor(); this.runnable = new TableMetricsWrapperRunnable(); <START> this.tableMetricsUpdateTask = this.executor.scheduleWithFixedDelay(this.runnable, PERIOD, <END> PERIOD, TimeUnit.SECONDS); }</code><technical_language>Is this a bug fix? (Like below) .. u explain .. Previously a config based hard coded</technical_language>

Target:
public MetricsTableWrapperAggregateImpl(final HRegionServer regionServer) { this.regionServer = regionServer; this.period = regionServer.getConfiguration().getLong(HConstants.REGIONSERVER_METRICS_PERIOD, HConstants.DEFAULT_REGIONSERVER_METRICS_PERIOD) + 1000; this.executor = CompatibilitySingletonFactory.getInstance(MetricsExecutor.class).getExecutor(); this.runnable = new TableMetricsWrapperRunnable(); this.tableMetricsUpdateTask = this.executor.scheduleWithFixedDelay(this.runnable, period, period, TimeUnit.MILLISECONDS); }
Source:
<code>public static WorkProcessor<Page> mergeSortedPages( List<WorkProcessor<Page>> pageProducers, PageWithPositionComparator comparator, List<Type> outputTypes, AggregatedMemoryContext aggregatedMemoryContext, DriverYieldSignal yieldSignal) { requireNonNull(pageProducers, "pageProducers is null"); requireNonNull(comparator, "comparator is null"); requireNonNull(outputTypes, "outputTypes is null"); requireNonNull(aggregatedMemoryContext, "aggregatedMemoryContext is null"); <START> requireNonNull(yieldSignal, "yieldSignal is null"); <END> return mergeSortedPages( pageProducers, comparator, IntStream.range(0, outputTypes.size()).boxed().collect(toImmutableList()), outputTypes, (pageBuilder, pageWithPosition) -> pageBuilder.isFull(), false, aggregatedMemoryContext, yieldSignal); }</code><technical_language>This passed mergeSortedPages, redundant check here</technical_language>

Target:
public static WorkProcessor<Page> mergeSortedPages( List<WorkProcessor<Page>> pageProducers, PageWithPositionComparator comparator, List<Type> outputTypes, AggregatedMemoryContext aggregatedMemoryContext, DriverYieldSignal yieldSignal) { return mergeSortedPages( pageProducers, comparator, IntStream.range(0, outputTypes.size()).boxed().collect(toImmutableList()), outputTypes, (pageBuilder, pageWithPosition) -> pageBuilder.isFull(), false, aggregatedMemoryContext, yieldSignal); }
Source:
<code>public void start(BundleContext context) throws Exception { super.start(context); setDefault(this); try { <START> XmlUtils.clearXmlDirectory(); <END> } catch (Throwable e) { } }</code><technical_language>remove export button is implemented</technical_language>

Target:
public void start(BundleContext context) throws Exception { super.start(context); setDefault(this); }
Source:
<code>private StackTraceWriter getStackTraceWriter( TestIdentifier testIdentifier, Throwable throwable ) { String className = getClassName( testIdentifier ); String methodName = getMethodName( testIdentifier ).orElse( "" ); <START> return new LegacyPojoStackTraceWriter( className, methodName, throwable ); <END> }</code><technical_language>Do time for this? talked Slack</technical_language>

Target:
private StackTraceWriter getStackTraceWriter( TestIdentifier testIdentifier, Throwable throwable ) { String className = getClassName( testIdentifier ); String methodName = getMethodName( testIdentifier ).orElse( "" ); return new PojoStackTraceWriter( className, methodName, throwable ); }
Source:
<code><START> @Override public ScoredCandidates<Item> score(Item subject, Set<? extends Item> candidates, <END> ResultDescription desc) { DefaultScoredCandidates.Builder<Item> equivalents = DefaultScoredCandidates.fromSource(NAME); for (Item candidate : candidates) { equivalents.addEquivalent(candidate, score(subject, candidate)); } return equivalents.build(); }</code><technical_language>style: put @override line for method declarations, if parameters line long list parameters line line e.g. public ScoredCandidates<Item> score( Item subject, Set<? extends Item> candidates, ResultDescription desc ) { ...</technical_language>

Target:
public ScoredCandidates<Item> score( Item subject, Set<? extends Item> candidates, ResultDescription desc) { DefaultScoredCandidates.Builder<Item> equivalents = DefaultScoredCandidates.fromSource(NAME); candidates.forEach(candidate -> equivalents.addEquivalent(candidate, score(subject, candidate))); return equivalents.build(); }
Source:
<code>public void put(final K key, final V value) throws CacheWritingException { putObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key, value); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { try { if (cacheLoaderWriter != null) { cacheLoaderWriter.write(key, value); } } catch (Exception e) { throw newCacheWritingException(e); } if (newValueAlreadyExpired(key, previousValue, value)) { return null; } eventNotificationService.onEvent(previousValue == null ? CacheEvents.creation(key, value, Ehcache.this) : CacheEvents.update(key, previousValue, value, Ehcache.this)); return value; } }); try { ValueHolder<V> computed = store.compute(key, remappingFunction); if (computed != null) { putObserver.end(PutOutcome.ADDED); <START> eventNotificationService.fireEvents(); <END> } else { putObserver.end(PutOutcome.NOOP); } } catch (CacheAccessException e) { try { if (cacheLoaderWriter == null) { resilienceStrategy.putFailure(key, value, e); } else { try { remappingFunction.apply(key, value); } catch (CacheWritingException f) { resilienceStrategy.putFailure(key, value, e, f); return; } resilienceStrategy.putFailure(key, value, e); } } finally { putObserver.end(PutOutcome.FAILURE); eventNotificationService.fireSuccessfulEvents(); } } }</code><technical_language>this in branch? if expiry evictions triggered logic</technical_language>

Target:
public void put(final K key, final V value) throws CacheWritingException { putObserver.begin(); statusTransitioner.checkAvailable(); checkNonNull(key, value); final BiFunction<K, V, V> remappingFunction = memoize(new BiFunction<K, V, V>() { @Override public V apply(final K key, final V previousValue) { try { if (cacheLoaderWriter != null) { cacheLoaderWriter.write(key, value); } } catch (Exception e) { throw newCacheWritingException(e); } if (newValueAlreadyExpired(key, previousValue, value)) { return null; } eventNotificationService.onEvent(previousValue == null ? CacheEvents.creation(key, value, Ehcache.this) : CacheEvents.update(key, previousValue, value, Ehcache.this)); return value; } }); try { ValueHolder<V> computed = store.compute(key, remappingFunction); if (computed != null) { putObserver.end(PutOutcome.ADDED); } else { putObserver.end(PutOutcome.NOOP); } eventNotificationService.fireAllEvents(); } catch (CacheAccessException e) { try { if (cacheLoaderWriter == null) { resilienceStrategy.putFailure(key, value, e); } else { try { remappingFunction.apply(key, value); } catch (CacheWritingException f) { resilienceStrategy.putFailure(key, value, e, f); return; } resilienceStrategy.putFailure(key, value, e); } } finally { putObserver.end(PutOutcome.FAILURE); } } finally { eventNotificationService.processAndFireRemainingEvents(); } }
Source:
<code>public boolean isGetterMethod() { <START> return ReflectionHelper.isGetterMethod( executable ); <END> }</code><technical_language>add a final attribute for this</technical_language>

Target:
public boolean isGetterMethod() { return isGetterMethod; }
Source:
<code>public void setColumnWidthPercentageByPosition(int columnPosition, int width, boolean fireEvent) { this.columnWidthConfig.setPercentage(columnPosition, width); if <START> (fireEvent) <END> fireLayerEvent(new ColumnResizeEvent(this, columnPosition)); }</code><technical_language>add { }</technical_language>

Target:
public void setColumnWidthPercentageByPosition(int columnPosition, int width, boolean fireEvent) { this.columnWidthConfig.setPercentage(columnPosition, width); if (fireEvent){ fireLayerEvent(new ColumnResizeEvent(this, columnPosition)); } }
Source:
<code>public boolean allowsStyleAttributeWithHash(@Nonnull HashAlgorithm algorithm, @Nonnull Base64Value hashValue) { if (!this.haveUnsafeStyleHashes()) { return false; } StyleSrcAttrDirective styleSrcAttrDirective = this.getDirectiveByType(StyleSrcAttrDirective.class); if (styleSrcAttrDirective == null) { StyleSrcDirective styleSrcDirective = this.getDirectiveByType(StyleSrcDirective.class); if (styleSrcDirective == null) { <START> return this.defaultsAllowScriptAttributeWithHash(algorithm, hashValue); <END> } return styleSrcDirective.matchesHash(algorithm, hashValue); } return styleSrcAttrDirective.matchesHash(algorithm, hashValue); }</code><technical_language>defaultsAllowStyleAttributeWithHash</technical_language>

Target:
public boolean allowsStyleAttributeWithHash(@Nonnull HashAlgorithm algorithm, @Nonnull Base64Value hashValue) { if (!this.haveUnsafeStyleHashes()) { return false; } StyleSrcAttrDirective styleSrcAttrDirective = this.getDirectiveByType(StyleSrcAttrDirective.class); if (styleSrcAttrDirective == null) { StyleSrcDirective styleSrcDirective = this.getDirectiveByType(StyleSrcDirective.class); if (styleSrcDirective == null) { return this.defaultsAllowAttributeWithHash(algorithm, hashValue); } return styleSrcDirective.matchesHash(algorithm, hashValue); } return styleSrcAttrDirective.matchesHash(algorithm, hashValue); }
Source:
<code>public void onMessageReceived(MessageEvent messageEvent) { super.onMessageReceived(messageEvent); if (!messageEvent.getPath().equals(WearableConfigurationUtil.PATH_ANALOG)) { return; } byte[] rawData = messageEvent.getData(); DataMap configKeys = DataMap.fromByteArray(rawData); <START> Log.d(TAG, "configKeys = [" + configKeys + "]"); <END> if (mGoogleApiClient == null) { mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(Wearable.API).build(); } if (!mGoogleApiClient.isConnected()) { ConnectionResult connectionResult = mGoogleApiClient.blockingConnect(30, TimeUnit.SECONDS); if (!connectionResult.isSuccess()) { Log.e(TAG, "Failed to connect to GoogleApiClient."); return; } } WearableConfigurationUtil.updateKeysInConfigDataMap(mGoogleApiClient, messageEvent.getPath(), configKeys); }</code><technical_language>log debug builds. Timber nice</technical_language>

Target:
public void onMessageReceived(MessageEvent messageEvent) { super.onMessageReceived(messageEvent); if (!messageEvent.getPath().equals(WearableConfigurationUtil.PATH_ANALOG)) { return; } byte[] rawData = messageEvent.getData(); DataMap configKeys = DataMap.fromByteArray(rawData); Timber.d("configKeys = [" + configKeys + "]"); if (mGoogleApiClient == null) { mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(Wearable.API).build(); } if (!mGoogleApiClient.isConnected()) { ConnectionResult connectionResult = mGoogleApiClient.blockingConnect(30, TimeUnit.SECONDS); if (!connectionResult.isSuccess()) { Log.e(TAG, "Failed to connect to GoogleApiClient."); return; } } WearableConfigurationUtil.updateKeysInConfigDataMap(mGoogleApiClient, messageEvent.getPath(), configKeys); }
Source:
<code>static boolean areInSameParent(final Element parent, final Node[] children) { return Stream.of(children) .map(GraphUtils::getParent) <START> .filter(childParent -> !Objects.equals(parent, childParent)) <END> .count() == 0; }</code><technical_language>noneMatch method</technical_language>

Target:
static boolean areInSameParent(final Element parent, final Node[] children) { return Stream.of(children) .map(GraphUtils::getParent) .noneMatch(childParent -> !Objects.equals(parent, childParent)); }
Source:
<code>private CartQuery decorateQueryWithAdditionalInfo(final CartQuery query) { return query .plusPredicates(cart -> cart.cartState().is(CartState.ACTIVE)) <START> .plusExpansionPaths(cartExpansionModel -> cartExpansionModel.discountCodes().discountCode()) <END> .withSort(cart -> cart.lastModifiedAt().sort().desc()) .withLimit(1); }</code><technical_language>Need consider if this is place, expand update actions, right</technical_language>

Target:
private CartQuery decorateQueryWithAdditionalInfo(final CartQuery query) { return query .plusPredicates(cart -> cart.cartState().is(CartState.ACTIVE)) .withSort(cart -> cart.lastModifiedAt().sort().desc()) .withLimit(1); }
Source:
<code>public Serializable convertToEntityAttribute(String dbData) { try { Serializable[] arr = objectMapper.readValue(dbData, Serializable[].class); <START> return (arr.length == 1) ? arr[0] : arr; <END> } catch (IOException e) { throw new RuntimeException("Unable to deserialize preference value:" + e.getMessage(), e); } }</code><technical_language>legit 1 element arrays</technical_language>

Target:
public Serializable convertToEntityAttribute(String dbData) { try { JsonNode node = objectMapper.readTree(dbData); if (node.isValueNode()) { return serializableNodeValue(node); } else if (node.isArray()) { List<Serializable> values = new ArrayList<>(); node.elements().forEachRemaining(n -> values.add(serializableNodeValue(n))); return values.toArray(); } else { throw new RuntimeException("Unable to deserialize preference value:" + dbData); } } catch (IOException e) { throw new RuntimeException("Unable to deserialize preference value:" + e.getMessage(), e); } }
Source:
<code>public void testXmlAddAndRemoveFile() { IPath xmlPath = XmlUtils.getXmlFilesPath().addTrailingSeparator().append("test_valid.xml"); File destFile = xmlPath.toFile(); assertFalse(destFile.exists()); File testXmlFile = TmfXmlTestFiles.VALID_FILE.getFile(); if ((testXmlFile == null) || !testXmlFile.exists()) { fail("XML test file does not exist"); } assertNotNull(testXmlFile); XmlUtils.addXmlFile(testXmlFile); assertTrue(destFile.exists()); XmlUtils.removeXmlFile(testXmlFile); File[] xmlFiles = XmlUtils.getXmlFilesPath().toFile().listFiles(); boolean found = false; <START> for(int i = 0; i < xmlFiles.length; i++) { <END> if(xmlFiles[i].getName().equals(testXmlFile.getName())) { found = true; } } if(found) { fail("XML test file have not been remove"); } }</code><technical_language>ctrl-shift-f this file</technical_language>

Target:
public void testXmlAddAndRemoveFile() { IPath xmlPath = XmlUtils.getXmlFilesPath().addTrailingSeparator().append("test_valid.xml"); File destFile = xmlPath.toFile(); assertFalse(destFile.exists()); File testXmlFile = TmfXmlTestFiles.VALID_FILE.getFile(); assertTrue(testXmlFile.exists()); assertNotNull(testXmlFile); XmlUtils.addXmlFile(testXmlFile); assertTrue(destFile.exists()); XmlUtils.removeXmlFile(testXmlFile); File[] xmlFiles = XmlUtils.getXmlFilesPath().toFile().listFiles(); boolean found = false; for (int i = 0; i < xmlFiles.length; i++) { if (xmlFiles[i].getName().equals(testXmlFile.getName())) { found = true; } } assertFalse(found); }
Source:
<code>public void addModifiedColumns( GlobalConfiguration globalCfg, Value value, Element parent, PropertyAuditingData propertyAuditingData) { String columnName = propertyAuditingData.getModifiedFlagName(); if ( propertyAuditingData.isModifiedFlagNameExplicitlySpecified() ) { columnName = propertyAuditingData.getExplicitModifiedFlagName(); <START> } <END> MetadataTools.addModifiedFlagProperty( parent, propertyAuditingData.getName(), globalCfg.getModifiedFlagSuffix(), columnName ); }</code><technical_language>is change String columnName; if ( propertyAuditingData.isModifiedFlagNameExplicitlySpecified() ) { columnName = propertyAuditingData.getExplicitModifiedFlagName(); } else { columnName = propertyAuditingData.getModifiedFlagName(); }</technical_language>

Target:
public void addModifiedColumns( GlobalConfiguration globalCfg, Value value, Element parent, PropertyAuditingData propertyAuditingData) { final String columnName; if ( propertyAuditingData.isModifiedFlagNameExplicitlySpecified() ) { columnName = propertyAuditingData.getExplicitModifiedFlagName(); } else { columnName = propertyAuditingData.getModifiedFlagName(); } MetadataTools.addModifiedFlagProperty( parent, propertyAuditingData.getName(), globalCfg.getModifiedFlagSuffix(), columnName ); }
Source:
<code>public int getSort() { <START> return sort; <END> }</code><technical_language>please follow [our style guide](<LINK_0> mySort. I recommend boolean (better) enum for sorting. getSort() == SortOrder.ASC is more readable getSort() == 1</technical_language>

Target:
public SortOrder getSort() { return mySort; }
Source:
<code>public String stripPrefixIfPresent(String path) { String stripedKey = CommonUtils.stripPrefixIfPresent( path, PathUtils.normalizePath(mRootKeySupplier.get(), PATH_SEPARATOR)); if (!stripedKey.equals(path)) { return stripedKey; } final String normalizedPath = PathUtils.normalizePath(path, PATH_SEPARATOR); if (!path.equals(normalizedPath)) { stripedKey = CommonUtils.stripPrefixIfPresent( normalizedPath, <START> PathUtils.normalizePath(mRootKeySupplier.get(), PATH_SEPARATOR)); <END> if (!stripedKey.equals(normalizedPath)) { return stripedKey; } } return CommonUtils.stripPrefixIfPresent(path, PATH_SEPARATOR); }</code><technical_language>save this normalized root top, branches re-use it</technical_language>

Target:
public String stripPrefixIfPresent(String path) { if (mRootKeySupplier.get().equals(path)) { return ""; } String stripedKey = CommonUtils.stripPrefixIfPresent( path, PathUtils.normalizePath(mRootKeySupplier.get(), PATH_SEPARATOR)); if (!stripedKey.equals(path)) { return stripedKey; } return CommonUtils.stripPrefixIfPresent(path, PATH_SEPARATOR); }
Source:
<code>public static void createTaskTable(final DBI dbi, final String taskTableName) { createTable( dbi, taskTableName, String.format( "CREATE TABLE `%s` (\n" + " `id` varchar(255) NOT NULL,\n" + " `created_date` tinytext NOT NULL,\n" + " `datasource` varchar(255) NOT NULL,\n" <START> + " `payload` longtext NOT NULL,\n" <END> + " `status_payload` longtext NOT NULL,\n" + " `version` tinytext,\n" + " `active` tinyint(1) NOT NULL DEFAULT '0',\n" + " PRIMARY KEY (`id`)\n" + ")", taskTableName ) ); }</code><technical_language>do making longtext fields bytes instead? prefer character encoding issues in code in db..</technical_language>

Target:
public static void createTaskTable(final DBI dbi, final String taskTableName) { createTable( dbi, taskTableName, String.format( "CREATE TABLE `%s` (\n" + " `id` varchar(255) NOT NULL,\n" + " `created_date` tinytext NOT NULL,\n" + " `datasource` varchar(255) NOT NULL,\n" + " `payload` longblob NOT NULL,\n" + " `status_payload` longblob NOT NULL,\n" + " `active` tinyint(1) NOT NULL DEFAULT '0',\n" + " PRIMARY KEY (`id`)\n" + ")", taskTableName ) ); }