auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void bytesRead(long bytes) { <START> ioStatisticsStore.incrementCounter(STREAM_READ_BYTES, bytes); <END> }</code><technical_language>consider is cost of map lookup IOP. ask IOStatisticsStore for a reference atomic counter, direct. for output stream, reviewing this patch realise I for read well. read byte counters incremented read. bytesUploaded = store.getCounterReference( STREAM_WRITE_TOTAL_DATA.getSymbol()); bytesWritten = store.getCounterReference( StreamStatisticNames.STREAM_WRITE_BYTES);</technical_language>

Target:
public void bytesRead(long bytes) { bytesRead.addAndGet(bytes); }
Source:
<code><START> public static XBeePacket parsePacket(byte[] packet) throws PacketParsingException { <END> if (packet.length > 1 && ((packet[0] &0xFF) != SpecialByte.HEADER_BYTE.getValue())) throw new PacketParsingException("Invalid start delimiter."); if (packet.length < 4) throw new PacketParsingException("Packet length is too short."); int length = ByteUtils.byteArrayToInt(new byte[] {packet[1], packet[2]}); if (length != packet.length - 4) throw new PacketParsingException("Invalid packet length."); byte[] data = new byte[length]; System.arraycopy(packet, 3, data, 0, length); byte packetChecksum = packet[packet.length - 1]; XBeeChecksum checksum = new XBeeChecksum(); checksum.add(data); byte generatedChecksum = (byte)(checksum.generate() & 0xFF); if (packetChecksum != generatedChecksum) throw new PacketParsingException("Invalid '" + packetChecksum + "' checksum. It should be " + generatedChecksum); XBeePacketParser parser = new XBeePacketParser(new ByteArrayInputStream(packet, 1, packet.length - 1), XBeeMode.API); XBeePacket xbeePacket = parser.parsePacket(); return xbeePacket; }</code><technical_language>If packet is null throw a NullPointerException</technical_language>

Target:
public static XBeePacket parsePacket(byte[] packet) throws PacketParsingException { if (packet == null) throw new NullPointerException("Packet byte array cannot be null."); if (packet.length > 1 && ((packet[0] &0xFF) != SpecialByte.HEADER_BYTE.getValue())) throw new PacketParsingException("Invalid start delimiter."); if (packet.length < 4) throw new PacketParsingException("Packet length is too short."); int length = ByteUtils.byteArrayToInt(new byte[] {packet[1], packet[2]}); if (length != packet.length - 4) throw new PacketParsingException("Invalid packet length."); byte[] data = new byte[length]; System.arraycopy(packet, 3, data, 0, length); byte packetChecksum = packet[packet.length - 1]; XBeeChecksum checksum = new XBeeChecksum(); checksum.add(data); byte generatedChecksum = (byte)(checksum.generate() & 0xFF); if (packetChecksum != generatedChecksum) throw new PacketParsingException("Invalid '" + packetChecksum + "' checksum. It should be " + generatedChecksum); XBeePacketParser parser = new XBeePacketParser(new ByteArrayInputStream(packet, 1, packet.length - 1), OperatingMode.API); XBeePacket xbeePacket = parser.parsePacket(); return xbeePacket; }
Source:
<code>private KeyValPair<String, ? extends Class<?>> getGetterForVariable(String var, Class<?> inputClassType) { try { final Field field = inputClassType.getField(var); if (Modifier.isPublic(field.getModifiers())) { return new KeyValPair<>(var, field.getType()); } logger.debug("Field is not publicly accessible. Proceeding to locate a getter method.", var); } catch (NoSuchFieldException | SecurityException ex) { logger.debug("{} does not have field {}. Proceeding to locate a getter method.", inputClassType.getName(), var); } String methodName = GET + var.substring(0, 1).toUpperCase() + var.substring(1); try { Method method = inputClassType.getMethod(methodName); if (Modifier.isPublic(method.getModifiers())) { return new KeyValPair<>(methodName + "()", method.getReturnType()); } logger.debug("Method of is not accessible. Proceeding to locate another getter method.", methodName, inputClassType.getName()); <START> } catch (NoSuchMethodException | SecurityException ex) { <END> logger.debug("{} does not have method {}. Proceeding to locate another getter method", inputClassType.getName(), methodName); } methodName = IS + var.substring(0, 1).toUpperCase() + var.substring(1); try { Method method = inputClassType.getMethod(methodName); if (Modifier.isPublic(method.getModifiers())) { return new KeyValPair<>(methodName + "()", method.getReturnType()); } logger.debug("Method of is not accessible. Proceeding to locate another getter method.", methodName, inputClassType.getName()); } catch (NoSuchMethodException | SecurityException ex) { logger.debug("{} does not have method {}. Proceeding to locate another getter method", inputClassType.getName(), methodName); } return new KeyValPair<>(var, inputClassType); }</code><technical_language>Swallow required exception. SecurityException be</technical_language>

Target:
private KeyValPair<String, ? extends Class<?>> getGetterForVariable(String var, Class<?> inputClassType) { try { final Field field = inputClassType.getField(var); if (Modifier.isPublic(field.getModifiers())) { return new KeyValPair<>(var, field.getType()); } logger.debug("Field is not publicly accessible. Proceeding to locate a getter method.", var); } catch (NoSuchFieldException ex) { logger.debug("{} does not have field {}. Proceeding to locate a getter method.", inputClassType.getName(), var); } String[] methodAccessors = new String[]{GET, IS}; for (String m : methodAccessors) { String methodName = m + var.substring(0, 1).toUpperCase() + var.substring(1); try { Method method = inputClassType.getMethod(methodName); if (Modifier.isPublic(method.getModifiers())) { return new KeyValPair<>(methodName + "()", method.getReturnType()); } logger.debug("Method of is not accessible. Proceeding to locate another getter method.", methodName, inputClassType.getName()); } catch (NoSuchMethodException ex) { logger.debug("{} does not have method {}. Proceeding to locate another getter method", inputClassType.getName(), methodName); } } return new KeyValPair<>(var, inputClassType); }
Source:
<code>UpdatesFromMixpanel constructUpdatesFromMixpanel(final Context context, final String token) { if (Build.VERSION.SDK_INT < MPConfig.UI_FEATURES_MIN_API) { Log.i(LOGTAG, "Web Configuration, A/B Testing, and Dynamic Tweaks are not supported on this Android OS Version"); return new NoOpUpdatesFromMixpanel(sSharedTweaks); <START> } else if (mConfig.getDisableViewCrawler()) { <END> return new NoOpUpdatesFromMixpanel(sSharedTweaks); } else { return new ViewCrawler(mContext, mToken, this, sSharedTweaks); } }</code><technical_language>if (Build.VERSION.SDK_INT < MPConfig.UI_FEATURES_MIN_API || mConfig.getDisableViewCrawler()) { return new NoOpUpdatesFromMixpanel(sSharedTweaks); }</technical_language>

Target:
UpdatesFromMixpanel constructUpdatesFromMixpanel(final Context context, final String token) { if (Build.VERSION.SDK_INT < MPConfig.UI_FEATURES_MIN_API || mConfig.getDisableViewCrawler()) { Log.i(LOGTAG, "Web Configuration, A/B Testing, and Dynamic Tweaks are disabled."); return new NoOpUpdatesFromMixpanel(sSharedTweaks); } else { return new ViewCrawler(mContext, mToken, this, sSharedTweaks); } }
Source:
<code>} catch (IOException e) { Activator.getDefault().logError("Cannot read the file from <START> URL due to <END> ", e); }</code><technical_language>necessary add "due to"</technical_language>

Target:
} catch (IOException e) { Activator.getDefault().logError("Cannot read the file from URL ", e); }
Source:
<code>protected void updatePotionEffectsMetadata() { <START> metadata.set(MetadataIndex.POTION_COLOR, potionEffects.size() > 0 ? 1 : 0); END> metadata.set(MetadataIndex.POTION_AMBIENT, potionEffects.values().stream().allMatch(PotionEffect::isAmbient)); }</code><technical_language>I Color.mixColors(), mapping potionEffect.getColor() array, calling Color#asRGB resulting mixed color work here</technical_language>

Target:
protected void updatePotionEffectsMetadata() { int color = 0; if (this.potionEffects.size() > 0) { Color[] colors = this.potionEffects.values().stream() .filter(PotionEffect::hasParticles) .map(effect -> effect.getColor() != null ? effect.getColor() : effect.getType().getColor()) .toArray(Color[]::new); color = Color.BLACK.mixColors(colors).asRGB(); } metadata.set(MetadataIndex.POTION_COLOR, color); metadata.set(MetadataIndex.POTION_AMBIENT, this.potionEffects.values().stream().allMatch(PotionEffect::isAmbient)); }
Source:
<code>public ProcessedClaimCollection retrieveClaimValues( ClaimCollection claims, ClaimsParameters parameters) { ProcessedClaimCollection claimsColl = new ProcessedClaimCollection(); Principal principal = parameters.getPrincipal(); Map<String, Object> additionalProperties = parameters.getAdditionalProperties(); if (additionalProperties != null) { if (LOGGER.isTraceEnabled()) { <START> StringBuffer output = new StringBuffer(); <END> String prefix = "\n"; output.append("CAS attributes returned: {"); for (Map.Entry<String, Object> entry : additionalProperties.entrySet()) { output.append(prefix); prefix = ", \n"; output.append(entry.getKey()); output.append("="); output.append(entry.getValue()); } output.append("\n}"); LOGGER.trace(output.toString()); } claims .stream() .distinct() .forEach( claim -> { URI claimType = claim.getClaimType(); String claimTypeString = claimType.toString(); String mappedClaimType = attributeMap.getOrDefault(claimTypeString, claimTypeString); buildClaim( claimsColl, principal, claimType, additionalProperties.get(mappedClaimType)); }); } if (LOGGER.isTraceEnabled()) { StringBuffer output = new StringBuffer(); output.append("Claims map returned: {"); String prefix = "\n"; for (ProcessedClaim claim : claimsColl) { output.append(prefix); prefix = ", \n"; output.append(claim.toString()); } output.append("\n}"); LOGGER.trace(output.toString()); } return claimsColl; }</code><technical_language>StringBuilder instead</technical_language>

Target:
public ProcessedClaimCollection retrieveClaimValues( ClaimCollection claims, ClaimsParameters parameters) { ProcessedClaimCollection claimsColl = new ProcessedClaimCollection(); Principal principal = parameters.getPrincipal(); Map<String, Object> additionalProperties = parameters.getAdditionalProperties(); if (additionalProperties != null) { if (LOGGER.isTraceEnabled()) { StringBuilder output = new StringBuilder(); String prefix = "\n"; output.append("CAS attributes returned: {"); for (Map.Entry<String, Object> entry : additionalProperties.entrySet()) { output.append(prefix); prefix = ", \n"; output.append(entry.getKey()); output.append("="); output.append(entry.getValue()); } output.append("\n}"); LOGGER.trace(output.toString()); } claims .stream() .distinct() .forEach( claim -> { URI claimType = claim.getClaimType(); String claimTypeString = claimType.toString(); String mappedClaimType = attributeMap.getOrDefault(claimTypeString, claimTypeString); buildClaim( claimsColl, principal, claimType, additionalProperties.get(mappedClaimType)); }); } if (LOGGER.isTraceEnabled()) { StringBuilder output = new StringBuilder(); output.append("Claims map returned: {"); String prefix = "\n"; for (ProcessedClaim claim : claimsColl) { output.append(prefix); prefix = ", \n"; output.append(claim.toString()); } output.append("\n}"); LOGGER.trace(output.toString()); } return claimsColl; }
Source:
<code><START> public @Nullable StateDescription getStateDescription(Channel channel, @Nullable StateDescription original, <END> @Nullable Locale locale) { List<StateOption> options = channelOptionsMap.get(channel.getUID()); if (options == null) { return null; } if (original != null) { return new StateDescription(original.getMinimum(), original.getMaximum(), original.getStep(), original.getPattern(), original.isReadOnly(), options); } return new StateDescription(null, null, null, null, false, options); }</code><technical_language>want return null in this case</technical_language>

Target:
public @Nullable StateDescription getStateDescription(Channel channel, @Nullable StateDescription original, @Nullable Locale locale) { List<StateOption> options = channelOptionsMap.get(channel.getUID()); if (options == null) { return original; } if (original != null) { return new StateDescription(original.getMinimum(), original.getMaximum(), original.getStep(), original.getPattern(), original.isReadOnly(), options); } return new StateDescription(null, null, null, null, false, options); }
Source:
<code>public MergedByteBuffers encrypt(final MergedByteBuffers lmbb) { final MergedByteBuffers mbb = new MergedByteBuffers(false); if(!startedHandshake.get()){ <START> mbb.add(lmbb); <END> return mbb; } tempBuffers.add(lmbb); ByteBuffer oldBB = tempBuffers.pull(tempBuffers.remaining()); ByteBuffer newBB; ByteBuffer tmpBB; boolean gotFinished = false; while (ssle.getHandshakeStatus() == NEED_WRAP || oldBB.remaining() > 0) { newBB = getAppWriteBuffer(); tmpBB = newBB.duplicate(); try { final SSLEngineResult res = ssle.wrap(oldBB, newBB); if(!finishedHandshake.get() && oldBB.remaining() > 0) { tempBuffers.add(oldBB); oldBB.position(oldBB.limit()); } if(!finishedHandshake.get() && res.getHandshakeStatus() == FINISHED) { gotFinished = true; } else { while (ssle.getHandshakeStatus() == NEED_TASK) { runTasks(); } } } catch (SSLHandshakeException e) { this.handshakeFuture.setFailure(e); client.close(); break; } catch (SSLException e) { throw new EncryptionException(e); } if(tmpBB.hasRemaining()) { tmpBB.limit(newBB.position()); mbb.add(tmpBB); } if(client.isClosed()) { break; } } writeBuffer = null; if(gotFinished && finishedHandshake.compareAndSet(false, true)) { handshakeFuture.setResult(ssle.getSession()); if(tempBuffers.remaining() > 0) { mbb.add(encrypt(IOUtils.EMPTY_BYTEBUFFER)); } } return mbb; }</code><technical_language>return passed in lmbb in this case? If move mbb construction this check</technical_language>

Target:
public MergedByteBuffers encrypt(final MergedByteBuffers lmbb) { if(!startedHandshake.get()){ return lmbb; } final MergedByteBuffers mbb = new MergedByteBuffers(false); tempBuffers.add(lmbb); ByteBuffer oldBB = tempBuffers.pull(tempBuffers.remaining()); ByteBuffer newBB; ByteBuffer tmpBB; boolean gotFinished = false; while (ssle.getHandshakeStatus() == NEED_WRAP || oldBB.remaining() > 0) { newBB = getAppWriteBuffer(); tmpBB = newBB.duplicate(); try { final SSLEngineResult res = ssle.wrap(oldBB, newBB); if(!finishedHandshake.get() && oldBB.remaining() > 0) { tempBuffers.add(oldBB); oldBB.position(oldBB.limit()); } if(!finishedHandshake.get() && res.getHandshakeStatus() == FINISHED) { gotFinished = true; } else { while (ssle.getHandshakeStatus() == NEED_TASK) { runTasks(); } } } catch (SSLHandshakeException e) { this.handshakeFuture.setFailure(e); client.close(); break; } catch (SSLException e) { throw new EncryptionException(e); } if(tmpBB.hasRemaining()) { tmpBB.limit(newBB.position()); mbb.add(tmpBB); } if(client.isClosed()) { break; } } writeBuffer = null; if(gotFinished && finishedHandshake.compareAndSet(false, true)) { handshakeFuture.setResult(ssle.getSession()); if(tempBuffers.remaining() > 0) { mbb.add(encrypt(IOUtils.EMPTY_BYTEBUFFER)); } } return mbb; }
Source:
<code>private Iterator<Row> useLegacyTableFactory(StreamExecutionEnvironment env, StreamTableEnvironment tEnv) { Table t = tEnv.fromDataStream(env.fromCollection(Arrays.asList( new Tuple2<>(1, "1"), new Tuple2<>(1, "1"), new Tuple2<>(2, "3"), new Tuple2<>(2, "5"), new Tuple2<>(3, "5"), new Tuple2<>(3, "8") )), $("id1"), $("id2")); tEnv.registerTable("T", t); JdbcTableSource.Builder builder = JdbcTableSource.builder() .setOptions(JdbcOptions.builder() .setDBUrl(DB_URL) .setTableName(LOOKUP_TABLE) .build()) .setSchema(TableSchema.builder().fields( new String[]{"id1", "comment1", "comment2", "id2"}, new DataType[]{DataTypes.INT(), DataTypes.STRING(), DataTypes.STRING(), DataTypes.STRING()}) .build()); <START> if (useCache) { <END> builder.setLookupOptions(JdbcLookupOptions.builder() .setCacheMaxSize(1000).setCacheExpireMs(1000 * 1000).setMaxRetryTimes(0).build()); } tEnv.registerFunction("jdbcLookup", builder.build().getLookupFunction(t.getSchema().getFieldNames())); String sqlQuery = "SELECT id1, id2, comment1, comment2 FROM T, " + "LATERAL TABLE(jdbcLookup(id1, id2)) AS S(l_id1, comment1, comment2, l_id2)"; return tEnv.executeSql(sqlQuery).collect(); }</code><technical_language>following, > JdbcLookupOptions.Builder lookupOptionsBuilder = JdbcLookupOptions.builder().setMaxRetryTimes(0); if (useCache) { lookupOptionsBuilder.setCacheMaxSize(1000).setCacheExpireMs(1000 * 1000); } builder.setLookupOptions(lookupOptionsBuilder.build());</technical_language>

Target:
private Iterator<Row> useLegacyTableFactory(StreamExecutionEnvironment env, StreamTableEnvironment tEnv) { Table t = tEnv.fromDataStream(env.fromCollection(Arrays.asList( new Tuple2<>(1, "1"), new Tuple2<>(1, "1"), new Tuple2<>(2, "3"), new Tuple2<>(2, "5"), new Tuple2<>(3, "5"), new Tuple2<>(3, "8") )), $("id1"), $("id2")); tEnv.registerTable("T", t); JdbcTableSource.Builder builder = JdbcTableSource.builder() .setOptions(JdbcOptions.builder() .setDBUrl(DB_URL) .setTableName(LOOKUP_TABLE) .build()) .setSchema(TableSchema.builder().fields( new String[]{"id1", "comment1", "comment2", "id2"}, new DataType[]{DataTypes.INT(), DataTypes.STRING(), DataTypes.STRING(), DataTypes.STRING()}) .build()); JdbcLookupOptions.Builder lookupOptionsBuilder = JdbcLookupOptions.builder().setMaxRetryTimes(0); if (useCache) { lookupOptionsBuilder.setCacheMaxSize(1000).setCacheExpireMs(1000 * 1000); } builder.setLookupOptions(lookupOptionsBuilder.build()); tEnv.registerFunction("jdbcLookup", builder.build().getLookupFunction(t.getSchema().getFieldNames())); String sqlQuery = "SELECT id1, id2, comment1, comment2 FROM T, " + "LATERAL TABLE(jdbcLookup(id1, id2)) AS S(l_id1, comment1, comment2, l_id2)"; return tEnv.executeSql(sqlQuery).collect(); }
Source:
<code>public Collection<GoogleComputeInstance> find(GoogleComputeInstanceTemplate template, Collection<String> instanceIds) throws InterruptedException { List<GoogleComputeInstance> result = new ArrayList<GoogleComputeInstance>(); for (String currentId : instanceIds) { Compute compute = credentials.getCompute(); String projectId = credentials.getProjectId(); String zone = getConfigurationValue(GoogleComputeProviderConfigurationProperty.ZONE); String decoratedInstanceName = decorateInstanceName(template, currentId); try { Instance instance = compute.instances().get(projectId, zone, decoratedInstanceName).execute(); result.add(new GoogleComputeInstance(template, instance.getName(), getInetAddressFromInstance(instance))); <START> } catch (GoogleJsonResponseException e) { <END> if (e.getStatusCode() == 404) { LOG.info("Instance '" + decoratedInstanceName + "' not found."); } else { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } } return result; }</code><technical_language>exception propagate external layer automatically retry needed</technical_language>

Target:
public Collection<GoogleComputeInstance> find(GoogleComputeInstanceTemplate template, Collection<String> instanceIds) throws InterruptedException { List<GoogleComputeInstance> result = new ArrayList<GoogleComputeInstance>(); for (String currentId : instanceIds) { Compute compute = credentials.getCompute(); String projectId = credentials.getProjectId(); String zone = getConfigurationValue(GoogleComputeInstanceTemplateConfigurationProperty.ZONE); String decoratedInstanceName = decorateInstanceName(template, currentId); try { Instance instance = compute.instances().get(projectId, zone, decoratedInstanceName).execute(); result.add(new GoogleComputeInstance(template, instance.getName(), getInetAddressFromInstance(instance))); } catch (GoogleJsonResponseException e) { if (e.getStatusCode() == 404) { LOG.info("Instance '" + decoratedInstanceName + "' not found."); } else { throw new RuntimeException(e); } } catch (IOException e) { throw new RuntimeException(e); } } return result; }
Source:
<code>private void updateSuggestedRepositories(String query) { suggestedRepositories.clear(); repositories.stream().forEach(repo -> { if (isMatching(repo, query)) { suggestedRepositories.add(repo); } }); Optional<PickerRepository> possibleExactMatch = getPickerRepositoryById(suggestedRepositories, query); if (!possibleExactMatch.isPresent() && !query.isEmpty()) { PickerRepository newRepository = new PickerRepository(query); newRepository.setSelected(true); suggestedRepositories.add(0, newRepository); } else if (!query.isEmpty()) { PickerRepository exactMatch = possibleExactMatch.get(); exactMatch.setSelected(true); } else { assert !suggestedRepositories.isEmpty(); PickerRepository firstMatching = suggestedRepositories.get(0); firstMatching.setSelected(true); <START> } <END> }</code><technical_language>This if/else block is a bit convoluted, possibly due compound conditionals. try rearrange flow more natural, dealing exceptional cases putting attention main flow e.g. java if (query.isEmpty()) { assert !suggestedRepositories.isEmpty(); PickerRepository firstMatching = suggestedRepositories.get(0); firstMatching.setSelected(true); return; } if (!possibleExactMatch.isPresent()) { PickerRepository newRepository = new PickerRepository(query); newRepository.setSelected(true); suggestedRepositories.add(0, newRepository); return; } PickerRepository exactMatch = possibleExactMatch.get(); exactMatch.setSelected(true);</technical_language>

Target:
private void updateSuggestedRepositories(String query) { suggestedRepositories.clear(); repositories.stream().forEach(repo -> { if (isMatching(repo, query)) { suggestedRepositories.add(repo); } }); Optional<PickerRepository> possibleExactMatch = getPickerRepositoryById(suggestedRepositories, query); if (query.isEmpty()) { assert !suggestedRepositories.isEmpty(); PickerRepository firstMatching = suggestedRepositories.get(0); firstMatching.setSelected(true); return; } if (!possibleExactMatch.isPresent()) { PickerRepository newRepository = new PickerRepository(query); newRepository.setSelected(true); suggestedRepositories.add(0, newRepository); return; } PickerRepository exactMatch = possibleExactMatch.get(); exactMatch.setSelected(true); }
Source:
<code>public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { if (!Objects.isNull(requestIdPolicyOptions)) { HttpHeaders httpHeaders = requestIdPolicyOptions.getIdHeaderSupplier().get(); <START> if (!Objects.isNull(httpHeaders)) { <END> httpHeaders.stream().forEach(httpHeader -> context.getHttpRequest().getHeaders().put(httpHeader.getName(), httpHeader.getValue()) ); } } else { context.getHttpRequest().getHeaders().put(REQUEST_ID_HEADER, UUID.randomUUID().toString()); } return next.process(); }</code><technical_language>A random header id added if httpHeaders is null</technical_language>

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { String requestId = context.getHttpRequest().getHeaders().getValue(REQUEST_ID_HEADER); if (!Objects.isNull(requestIdPolicyOptions)) { HttpHeaders httpHeaders = requestIdPolicyOptions.getIdHeaderSupplier().get(); if (!Objects.isNull(httpHeaders)) { httpHeaders.stream().forEach(httpHeader -> { String requestIdHeaderValue = context.getHttpRequest().getHeaders().getValue(httpHeader.getName()); if (requestIdHeaderValue == null) { context.getHttpRequest().getHeaders().put(httpHeader.getName(), httpHeader.getValue()); } }); }else { if (requestId == null) { context.getHttpRequest().getHeaders().put(REQUEST_ID_HEADER, UUID.randomUUID().toString()); } } } else { if (requestId == null) { context.getHttpRequest().getHeaders().put(REQUEST_ID_HEADER, UUID.randomUUID().toString()); } } return next.process(); }
Source:
<code>private Identity fetch(final String token) throws IOException { final String uri = new Href( String.format( <START> "%s/user", <END> this.getUrl("<LINK_0>") ) ).with("access_token", token).toString(); return PsGithub.parse( new JdkRequest(uri) .header("accept", "application/json") .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(JsonResponse.class).json().readObject() ); }</code><technical_language>@dmzaytsev This is a confusing design. changing Github URI? Instead pass a fake request check originally in #42</technical_language>

Target:
private Identity fetch(final String token) throws IOException { final String uri = new Href(this.api).path("user") .with("access_token", token).toString(); return PsGithub.parse( new JdkRequest(uri) .header("accept", "application/json") .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(JsonResponse.class).json().readObject() ); }
Source:
<code>public void spec104_mustSignalOnErrorWhenFails() throws Throwable { try { errorPublisherTest(new PublisherTestRun<T>() { @Override public void run(final Publisher<T> pub) throws InterruptedException { final Latch latch = new Latch(env); pub.subscribe(new TestEnvironment.TestSubscriber<T>(env) { @Override public void onError(Throwable cause) { latch.assertOpen(String.format("Error-state Publisher %s called `onError` twice on new Subscriber", pub)); latch.close(); } }); latch.expectClose(String.format("Error-state Publisher %s did not call `onError` on new Subscriber", pub)); env.verifyNoAsyncErrors(env.defaultTimeoutMillis()); } }); } catch (Throwable ex) { if (ex instanceof SkipException) { <START> throw ex; <END> } else { throw new RuntimeException(String.format("Publisher threw exception (%s) instead of signalling error via onError!", ex.getMessage()), ex); } } }</code><technical_language>catch clauses instead: java } catch(SkipException se) { throw se; } catch(Throwable ex) { }</technical_language>

Target:
public void spec104_mustSignalOnErrorWhenFails() throws Throwable { try { errorPublisherTest(new PublisherTestRun<T>() { @Override public void run(final Publisher<T> pub) throws InterruptedException { final Latch latch = new Latch(env); pub.subscribe(new TestEnvironment.TestSubscriber<T>(env) { @Override public void onError(Throwable cause) { latch.assertOpen(String.format("Error-state Publisher %s called `onError` twice on new Subscriber", pub)); latch.close(); } }); latch.expectClose(String.format("Error-state Publisher %s did not call `onError` on new Subscriber", pub)); env.verifyNoAsyncErrors(env.defaultTimeoutMillis()); } }); } catch (SkipException ex) { throw ex; } catch (Throwable ex) { throw new RuntimeException(String.format("Publisher threw exception (%s) instead of signalling error via onError!", ex.getMessage()), ex); } }
Source:
<code>private double computeRetryFactor() { <START> final long deltaBackoff = this.maxBackoff.minus(this.minBackoff).getSeconds(); <END> if (deltaBackoff <= 0 || super.maxRetryCount() <= 0) { return 0; } return Math.log(deltaBackoff) / Math.log(super.maxRetryCount()); }</code><technical_language>nit: need this. is other variable declared in this scope name</technical_language>

Target:
private double computeRetryFactor() { final long deltaBackoff = maxBackoff.minus(minBackoff).getSeconds(); if (deltaBackoff <= 0 || super.maxRetryCount() <= 0) { return 0; } return Math.log(deltaBackoff) / Math.log(super.maxRetryCount()); }
Source:
<code>protected void sendJsonMessage(ChatRoom chatRoom, T jsonMessage) { if (chatRoom == null) { logger.error("Cannot sent message as chatRoom is null"); return; } String messageString = jsonMessage.toString(); Message chatRoomMessage = chatRoom.createMessage(null); try { if(chatRoom instanceof ChatRoomJabberImpl) ((ChatRoomJabberImpl)chatRoom).sendJsonMessage(chatRoomMessage, messageString); <START> <END> if (logger.isDebugEnabled()) logger.debug("Sending json message: \"" + messageString + "\""); } catch (OperationFailedException e) { logger.warn("Failed to send json message " + messageString, e); } }</code><technical_language>This more a trace log instead of debug log in opinion. Feel free disagree</technical_language>

Target:
protected void sendJsonMessage(ChatRoom chatRoom, T jsonMessage) { if (chatRoom == null) { logger.error("Cannot sent message as chatRoom is null"); return; } if (!(chatRoom instanceof ChatRoomJabberImpl)) { logger.error("Cannot sent message as chatRoom is not an" + "instance of ChatRoomJabberImpl"); return; } String messageString = jsonMessage.toString(); try { ((ChatRoomJabberImpl)chatRoom).sendJsonMessage(messageString); if (logger.isTraceEnabled()) logger.trace("Sending json message: \"" + messageString + "\""); } catch (OperationFailedException e) { logger.warn("Failed to send json message " + messageString, e); } }
Source:
<code>Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener, RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats, boolean indicatorsEnabled, boolean loggingEnabled) { this.context = context; this.dispatcher = dispatcher; this.cache = cache; this.listener = listener; this.requestTransformer = requestTransformer; final List<RequestHandler> allRequestHandlers = new ArrayList<RequestHandler>(7); allRequestHandlers.add(new ResourceRequestHandler(context)); allRequestHandlers.add(new ContactsPhotoRequestHandler(context)); allRequestHandlers.add(new MediaStoreRequestHandler(context)); allRequestHandlers.add(new ContentStreamRequestHandler(context)); allRequestHandlers.add(new AssetRequestHandler(context)); allRequestHandlers.add(new FileRequestHandler(context)); allRequestHandlers.add(new NetworkRequestHandler(dispatcher.downloader, stats)); <START> if (extraRequestHandlers != null && !extraRequestHandlers.isEmpty()) { <END> allRequestHandlers.addAll(extraRequestHandlers); } requestHandlers = Collections.unmodifiableList(allRequestHandlers); this.stats = stats; this.targetToAction = new WeakHashMap<Object, Action>(); this.targetToDeferredRequestCreator = new WeakHashMap<ImageView, DeferredRequestCreator>(); this.indicatorsEnabled = indicatorsEnabled; this.loggingEnabled = loggingEnabled; this.referenceQueue = new ReferenceQueue<Object>(); this.cleanupThread = new CleanupThread(referenceQueue, HANDLER); this.cleanupThread.start(); }</code><technical_language>list empty null check is needed</technical_language>

Target:
Picasso(Context context, Dispatcher dispatcher, Cache cache, Listener listener, RequestTransformer requestTransformer, List<RequestHandler> extraRequestHandlers, Stats stats, boolean indicatorsEnabled, boolean loggingEnabled) { this.context = context; this.dispatcher = dispatcher; this.cache = cache; this.listener = listener; this.requestTransformer = requestTransformer; final int extraCount = (extraRequestHandlers != null ? extraRequestHandlers.size() : 0); final List<RequestHandler> allRequestHandlers = new ArrayList<RequestHandler>(7 + extraCount); allRequestHandlers.add(new ResourceRequestHandler(context)); allRequestHandlers.add(new ContactsPhotoRequestHandler(context)); allRequestHandlers.add(new MediaStoreRequestHandler(context)); allRequestHandlers.add(new ContentStreamRequestHandler(context)); allRequestHandlers.add(new AssetRequestHandler(context)); allRequestHandlers.add(new FileRequestHandler(context)); allRequestHandlers.add(new NetworkRequestHandler(dispatcher.downloader, stats)); if (extraRequestHandlers != null) { allRequestHandlers.addAll(extraRequestHandlers); } requestHandlers = Collections.unmodifiableList(allRequestHandlers); this.stats = stats; this.targetToAction = new WeakHashMap<Object, Action>(); this.targetToDeferredRequestCreator = new WeakHashMap<ImageView, DeferredRequestCreator>(); this.indicatorsEnabled = indicatorsEnabled; this.loggingEnabled = loggingEnabled; this.referenceQueue = new ReferenceQueue<Object>(); this.cleanupThread = new CleanupThread(referenceQueue, HANDLER); this.cleanupThread.start(); }
Source:
<code>public void test_singleMarketData() { MarketData marketDataCalibrated = StandardComponents.marketDataFactory().create( REQUIREMENTS, CONFIG, MARKET_DATA, REF_DATA); Results results = CALC_RUNNER.calculate(RULES, TARGETS, COLUMN, marketDataCalibrated, REF_DATA); <START> CurrencyAmount computed = (CurrencyAmount) results.get(0, 0).getValue(); <END> CurrencyAmount expected = PRICER.presentValue(OPTION_TRADE.resolve(REF_DATA), EXP_RATES, EXP_VOLS) .convertedTo(USD, EXP_RATES); assertEquals(computed, expected); }</code><technical_language>results.get(0, 0, CurrencyAmount.class) avoids cast</technical_language>

Target:
public void test_singleMarketData() { MarketData marketDataCalibrated = StandardComponents.marketDataFactory().create( REQUIREMENTS, CONFIG, MARKET_DATA, REF_DATA); Results results = CALC_RUNNER.calculate(RULES, TARGETS, COLUMN, marketDataCalibrated, REF_DATA); CurrencyAmount computed = results.get(0, 0, CurrencyAmount.class).getValue(); CurrencyAmount expected = PRICER.presentValue(OPTION_TRADE.resolve(REF_DATA), EXP_RATES, EXP_VOLS) .convertedTo(USD, EXP_RATES); assertEquals(computed, expected); }
Source:
<code>public MultipartSupportImpl(ExtendedServletDTO servletDTO, ServletContext servletContext) { this.servletDTO = servletDTO; File baseStorage = (File)servletContext.getAttribute(ServletContext.TEMPDIR); if (servletDTO.multipartLocation.length() > 0) { File storage = new File(servletDTO.multipartLocation); if (!storage.isAbsolute()) { storage = new File(baseStorage, storage.getPath()); } baseStorage = storage; } <START> if (System.getSecurityManager() != null) { BundleContext bundleContext = (BundleContext)servletContext.getAttribute("osgi-bundlecontext"); Bundle bundle = bundleContext.getBundle(); bundle.hasPermission(new FilePermission(baseStorage.getAbsolutePath(), "read,write")); } <END> baseStorage.mkdirs(); DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setRepository(baseStorage); if (servletDTO.multipartFileSizeThreshold > 0) { factory.setSizeThreshold(servletDTO.multipartFileSizeThreshold); } upload = new ServletFileUpload(factory); if (servletDTO.multipartMaxFileSize > -1L) { upload.setFileSizeMax(servletDTO.multipartMaxFileSize); } if (servletDTO.multipartMaxRequestSize > -1L) { upload.setSizeMax(servletDTO.multipartMaxRequestSize); } }</code><technical_language>bundle.hasPermission returns boolean. throw exception if bundle permission. I check for a security manager here. instead have: if (!bundle.hasPermission()) { throw new SecurityException(...); } need verify exception captured. For example, result in error DTO? instead this result in error log a null MultipartSupport? I a alternative initialize ServletRegistration.multipartSupport lazily part of ServletRegistration.parseRequest(HttpServletRequest) ensure application code is stack construct MultipartSupport</technical_language>

Target:
public MultipartSupportImpl(ExtendedServletDTO servletDTO, ServletContext servletContext) { this.servletDTO = servletDTO; File baseStorage = (File)servletContext.getAttribute(ServletContext.TEMPDIR); if (servletDTO.multipartLocation.length() > 0) { File storage = new File(servletDTO.multipartLocation); if (!storage.isAbsolute()) { storage = new File(baseStorage, storage.getPath()); } baseStorage = storage; } checkPermission(baseStorage, servletContext); baseStorage.mkdirs(); DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setRepository(baseStorage); if (servletDTO.multipartFileSizeThreshold > 0) { factory.setSizeThreshold(servletDTO.multipartFileSizeThreshold); } upload = new ServletFileUpload(factory); if (servletDTO.multipartMaxFileSize > -1L) { upload.setFileSizeMax(servletDTO.multipartMaxFileSize); } if (servletDTO.multipartMaxRequestSize > -1L) { upload.setSizeMax(servletDTO.multipartMaxRequestSize); } }
Source:
<code>public InternationalizationToggleState() { lastSelectedProject = null; lastSelectedPapyrusProjectName = null; pageSelectionListener = new ISelectionListener() { @Override public void selectionChanged(final IWorkbenchPart part, final ISelection selection) { if(part instanceof IEditorPart){ EObject selectedEObject = null; if(selection instanceof StructuredSelection){ Object firstSelectedElement = ((StructuredSelection) selection).getFirstElement(); if(firstSelectedElement instanceof EObject){ selectedEObject = (EObject) firstSelectedElement; } } if(null != selectedEObject){ final Resource resource = selectedEObject.eResource(); if(null != resource){ final IFile resourceFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(CommonPlugin.resolve(resource.getURI()).toFileString())); if(null != resourceFile){ lastSelectedProject = resourceFile.getProject(); lastSelectedPapyrusProjectName = resource.getURI().lastSegment().replace("."+resource.getURI().fileExtension(), ""); } } } } } }; currentPage = <START> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); <END> currentPage.addSelectionListener(pageSelectionListener); }</code><technical_language>is a shorcut in a utils</technical_language>

Target:
public InternationalizationToggleState() { lastSelectedProject = null; lastSelectedPapyrusProjectName = null; pageSelectionListener = new ISelectionListener() { @Override public void selectionChanged(final IWorkbenchPart part, final ISelection selection) { if(part instanceof IEditorPart){ EObject selectedEObject = null; if(selection instanceof StructuredSelection){ Object firstSelectedElement = ((StructuredSelection) selection).getFirstElement(); if(firstSelectedElement instanceof EObject){ selectedEObject = (EObject) firstSelectedElement; } } if(null != selectedEObject){ final Resource resource = selectedEObject.eResource(); if(null != resource){ final IFile resourceFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(CommonPlugin.resolve(resource.getURI()).toFileString())); if(null != resourceFile){ lastSelectedProject = resourceFile.getProject(); lastSelectedPapyrusProjectName = resource.getURI().lastSegment().replace("."+resource.getURI().fileExtension(), ""); } } } } } }; currentPage = EditorHelper.getActiveWindow().getActivePage(); currentPage.addSelectionListener(pageSelectionListener); }
Source:
<code>public Action<?, ?> databaseBackupFailedAction() { return new AbstractDatabaseBackupAction<>(DatabaseBackupFailedEvent.class) { @Override protected BackupRestoreContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, DatabaseBackupFailedEvent payload) { Flow flow = getFlow(flowParameters.getFlowId()); Stack stack = stackService.getById(payload.getResourceId()); MDCBuilder.buildMdcContext(stack); flow.setFlowFailed(payload.getException()); return BackupRestoreContext.from(flowParameters, payload, null, null); } @Override protected void doExecute(BackupRestoreContext context, DatabaseBackupFailedEvent payload, Map<Object, Object> variables) throws Exception { backupRestoreStatusService.handleDatabaseBackupFailure(context.getStackId(), payload.getException().getMessage(), payload.getDetailedStatus()); sendEvent(context, DATABASE_BACKUP_FAILED_EVENT.event(), payload); } @Override <START> protected Object getFailurePayload(DatabaseBackupFailedEvent payload, Optional<BackupRestoreContext> flowContext, Exception ex) { <END> return null; } }; }</code><technical_language>same, I this is necessary</technical_language>

Target:
public Action<?, ?> databaseBackupFailedAction() { return new AbstractBackupRestoreActions<>(DatabaseBackupFailedEvent.class) { @Override protected BackupRestoreContext createFlowContext(FlowParameters flowParameters, StateContext<FlowState, FlowEvent> stateContext, DatabaseBackupFailedEvent payload) { Flow flow = getFlow(flowParameters.getFlowId()); flow.setFlowFailed(payload.getException()); return BackupRestoreContext.from(flowParameters, payload, null, null); } @Override protected void doExecute(BackupRestoreContext context, DatabaseBackupFailedEvent payload, Map<Object, Object> variables) { backupRestoreStatusService.handleDatabaseBackupFailure(context.getStackId(), payload.getException().getMessage(), payload.getDetailedStatus()); sendEvent(context, DATABASE_BACKUP_FAIL_HANDLED_EVENT.event(), payload); } }; }
Source:
<code>public static TupleDomainFilter toFilter(Domain domain) { ValueSet values = domain.getValues(); checkArgument(values instanceof SortedRangeSet, "Unexpected domain type: " + values.getClass().getSimpleName()); List<Range> ranges = ((SortedRangeSet) values).getOrderedRanges(); boolean nullAllowed = domain.isNullAllowed(); if (ranges.isEmpty() && nullAllowed) { return IS_NULL; } Type type = domain.getType(); if (ranges.size() == 1) { return createRangeFilter(type, ranges.get(0), nullAllowed); } if (type == BOOLEAN) { return createBooleanFilter(ranges, nullAllowed); } List<TupleDomainFilter> rangeFilters = ranges.stream() <START> .map(r -> createRangeFilter(type, r, false)) <END> .filter(not(ALWAYS_FALSE::equals)) .collect(toImmutableList()); if (rangeFilters.isEmpty()) { return nullAllowed ? IS_NULL : ALWAYS_FALSE; } if (rangeFilters.get(0) instanceof TupleDomainFilter.BigintRange) { List<TupleDomainFilter.BigintRange> bigintRanges = rangeFilters.stream() .map(TupleDomainFilter.BigintRange.class::cast) .collect(toImmutableList()); if (bigintRanges.stream().allMatch(TupleDomainFilter.BigintRange::isSingleValue)) { return new TupleDomainFilter.BigintValues( bigintRanges.stream() .mapToLong(TupleDomainFilter.BigintRange::getLower) .toArray(), nullAllowed); } return new TupleDomainFilter.BigintMultiRange(bigintRanges, nullAllowed); } return new TupleDomainFilter.MultiRange(rangeFilters, nullAllowed); }</code><technical_language>nit: range instead of r</technical_language>

Target:
public static TupleDomainFilter toFilter(Domain domain) { ValueSet values = domain.getValues(); checkArgument(values instanceof SortedRangeSet, "Unexpected domain type: " + values.getClass().getSimpleName()); List<Range> ranges = ((SortedRangeSet) values).getOrderedRanges(); boolean nullAllowed = domain.isNullAllowed(); if (ranges.isEmpty() && nullAllowed) { return IS_NULL; } Type type = domain.getType(); if (ranges.size() == 1) { return createRangeFilter(type, ranges.get(0), nullAllowed); } if (type == BOOLEAN) { return createBooleanFilter(ranges, nullAllowed); } List<TupleDomainFilter> rangeFilters = ranges.stream() .map(range -> createRangeFilter(type, range, false)) .filter(not(ALWAYS_FALSE::equals)) .collect(toImmutableList()); if (rangeFilters.isEmpty()) { return nullAllowed ? IS_NULL : ALWAYS_FALSE; } if (rangeFilters.get(0) instanceof BigintRange) { List<BigintRange> bigintRanges = rangeFilters.stream() .map(BigintRange.class::cast) .collect(toImmutableList()); if (bigintRanges.stream().allMatch(BigintRange::isSingleValue)) { return BigintValues.of( bigintRanges.stream() .mapToLong(BigintRange::getLower) .toArray(), nullAllowed); } return BigintMultiRange.of(bigintRanges, nullAllowed); } return MultiRange.of(rangeFilters, nullAllowed); }
Source:
<code>public void createRealmLists(long reps) { for (long i = 0; i < reps; i++) { <START> AllTypes allTypes = realm.where(AllTypes.class).findFirst(); <END> if (allTypes != null) { allTypes.getColumnRealmList(); } } }</code><technical_language>This moved test</technical_language>

Target:
public void createRealmLists(long reps) { AllTypes allTypes = realm.where(AllTypes.class).findFirst(); for (long i = 0; i < reps; i++) { allTypes.getColumnRealmList(); } }
Source:
<code>public boolean canAuthenticate(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { OAuth2AccessTokenReqDTO oAuth2AccessTokenReqDTO = tokReqMsgCtx.getOauth2AccessTokenReqDTO(); if (!StringUtils.isEmpty(oAuth2AccessTokenReqDTO.getClientId()) && <START> !StringUtils.isEmpty(oAuth2AccessTokenReqDTO.getClientSecret())) { <END> return true; } else { if (org.wso2.carbon.identity.oauth.common.GrantType.SAML20_BEARER.toString().equals( oAuth2AccessTokenReqDTO.getGrantType())) { Properties confProperties = getProperties(); String authConfig = confProperties.getProperty( OAuthConstants.CLIENT_AUTH_CREDENTIAL_VALIDATION); if (StringUtils.isNotEmpty(authConfig) && JavaUtils.isFalseExplicitly(authConfig)) { return true; } } } return false; }</code><technical_language>Instead of !StringUtils.isEmpty StringUtils.isNotEmpty method</technical_language>

Target:
public boolean canAuthenticate(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { OAuth2AccessTokenReqDTO oAuth2AccessTokenReqDTO = tokReqMsgCtx.getOauth2AccessTokenReqDTO(); if (StringUtils.isNotEmpty(oAuth2AccessTokenReqDTO.getClientId()) && StringUtils.isNotEmpty(oAuth2AccessTokenReqDTO.getClientSecret())) { return true; } else { if (org.wso2.carbon.identity.oauth.common.GrantType.SAML20_BEARER.toString().equals( oAuth2AccessTokenReqDTO.getGrantType())) { authConfig = properties.getProperty( OAuthConstants.CLIENT_AUTH_CREDENTIAL_VALIDATION); if (StringUtils.isNotEmpty(authConfig) && JavaUtils.isFalseExplicitly(authConfig)) { return true; } } } return false; }
Source:
<code>public GenericJBossMarshaller(ClassLoader classLoader, ClassWhiteList classWhiteList) { super(); <START> this.classLoader = classLoader == null ? getClass().getClassLoader() : classLoader; <END> baseCfg.setClassResolver(classWhiteList == null ? new DefaultContextClassResolver(classLoader) : new CheckedClassResolver(classWhiteList, classLoader) ); }</code><technical_language>getClass().getClassLoader() leaving null default TCCL. is best</technical_language>

Target:
public GenericJBossMarshaller(ClassLoader classLoader, ClassWhiteList classWhiteList) { super(); if (classLoader == null) { classLoader = getClass().getClassLoader(); } baseCfg.setClassResolver(classWhiteList == null ? new DefaultContextClassResolver(classLoader) : new CheckedClassResolver(classWhiteList, classLoader) ); }
Source:
<code><START> static Set<Guid> <END> mapDisks(DiskAttachments diskAttachments) { Set<Guid> diskIds = null; if (diskAttachments.isSetDiskAttachments()) { diskIds = mapDisksToSetOfGuids(diskAttachments.getDiskAttachments().stream() .map(DiskAttachment::getDisk)); } return diskIds; }</code><technical_language>public</technical_language>

Target:
public static Set<Guid> mapDisks(DiskAttachments diskAttachments) { Set<Guid> diskIds = null; if (diskAttachments.isSetDiskAttachments()) { diskIds = mapDisksToSetOfGuids(diskAttachments.getDiskAttachments().stream() .map(DiskAttachment::getDisk)); } return diskIds; }
Source:
<code><START> private void processAttributes(Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean multipleArtifacts, boolean publishInLine) throws OseeCoreException { <END> String attribName = (String) renderer.getOption("AttributeName"); boolean onlyAttrib = false; for (AttributeElement attributeElement : attributeElements) { String attributeName = attributeElement.getAttributeName(); if (renderer.getBooleanOption("AllAttributes") || ((attribName == null) && (attributeName.equals("*")))) { for (IAttributeType attributeType : RendererManager.getAttributeTypeOrderList(artifact)) { if (!outlining || !attributeType.equals(headingAttributeType)) { processAttribute(artifact, wordMl, attributeElement, attributeType, true, presentationType, multipleArtifacts, publishInLine); } } } else { if (attribName != null) { attributeName = attribName; onlyAttrib = true; } AttributeType attributeType = AttributeTypeManager.getType(attributeName); if (artifact.isAttributeTypeValid(attributeType)) { processAttribute(artifact, wordMl, attributeElement, attributeType, false, presentationType, multipleArtifacts, publishInLine); } if (onlyAttrib) { break; } } } wordMl.setPageLayout(artifact); }</code><technical_language>tests for this method. complex enough a test useful</technical_language>

Target:
private void processAttributes(Artifact artifact, WordMLProducer wordMl, PresentationType presentationType, boolean multipleArtifacts, boolean publishInLine) throws OseeCoreException { String attribName = (String) renderer.getOption(ATTRIBUTE_NAME); boolean onlyAttrib = false; for (AttributeElement attributeElement : attributeElements) { String attributeName = attributeElement.getAttributeName(); if (renderer.getBooleanOption(ALL_ATTRIBUTES) || ((attribName == null) && (attributeName.equals("*")))) { for (IAttributeType attributeType : RendererManager.getAttributeTypeOrderList(artifact)) { if (!outlining || !attributeType.equals(headingAttributeType)) { processAttribute(artifact, wordMl, attributeElement, attributeType, true, presentationType, multipleArtifacts, publishInLine); } } } else { if (attribName != null) { attributeName = attribName; onlyAttrib = true; } AttributeType attributeType = AttributeTypeManager.getType(attributeName); if (artifact.isAttributeTypeValid(attributeType)) { processAttribute(artifact, wordMl, attributeElement, attributeType, false, presentationType, multipleArtifacts, publishInLine); } if (onlyAttrib) { break; } } } wordMl.setPageLayout(artifact); }