auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static Set<String> getWorkerNodeIDs(Collection<Worker> workers, WorkerBehaviorConfig workerConfig) { <START> return Sets.<String>newHashSet(workerConfig.getAutoScaler().ipToIdLookup( <END> Lists.newArrayList( Iterables.transform( workers, new Function<Worker, String>() { @Override public String apply(Worker input) { return input.getIp(); } } ) ) )); }</code><technical_language>creating a set necessary, a collection enough for cases getWorkerNodeIDs</technical_language>

Target:
private static Collection<String> getWorkerNodeIDs(Collection<Worker> workers, WorkerBehaviorConfig workerConfig) { return workerConfig.getAutoScaler().ipToIdLookup( Lists.newArrayList( Iterables.transform( workers, new Function<Worker, String>() { @Override public String apply(Worker input) { return input.getIp(); } } ) ) ); }
Source:
<code>public LogicalNode visitProjection(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitProjection(context, plan, block, node, stack); ExecutionBlock execBlock = context.execBlockMap.remove(child.getPID()); if (child.getType() == NodeType.TABLE_SUBQUERY && ((TableSubQueryNode)child).getSubQuery().getType() == NodeType.UNION) { MasterPlan masterPlan = context.plan; for (DataChannel dataChannel : masterPlan.getIncomingChannels(execBlock.getId())) { <START> dataChannel.setStoreType(BuiltinStorages.DRAW); <END> ExecutionBlock subBlock = masterPlan.getExecBlock(dataChannel.getSrcId()); ProjectionNode copy = PlannerUtil.clone(plan, node); copy.setChild(subBlock.getPlan()); subBlock.setPlan(copy); } execBlock.setPlan(null); } else { node.setChild(execBlock.getPlan()); node.setInSchema(execBlock.getPlan().getOutSchema()); execBlock.setPlan(node); } context.execBlockMap.put(node.getPID(), execBlock); return node; }</code><technical_language>adding a final variable for default store type in class</technical_language>

Target:
public LogicalNode visitProjection(GlobalPlanContext context, LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode node, Stack<LogicalNode> stack) throws TajoException { LogicalNode child = super.visitProjection(context, plan, block, node, stack); ExecutionBlock execBlock = context.execBlockMap.remove(child.getPID()); if (child.getType() == NodeType.TABLE_SUBQUERY && ((TableSubQueryNode)child).getSubQuery().getType() == NodeType.UNION) { MasterPlan masterPlan = context.plan; for (DataChannel dataChannel : masterPlan.getIncomingChannels(execBlock.getId())) { dataChannel.setStoreType(finalOutputStoreType); ExecutionBlock subBlock = masterPlan.getExecBlock(dataChannel.getSrcId()); ProjectionNode copy = PlannerUtil.clone(plan, node); copy.setChild(subBlock.getPlan()); subBlock.setPlan(copy); } execBlock.setPlan(null); } else { node.setChild(execBlock.getPlan()); node.setInSchema(execBlock.getPlan().getOutSchema()); execBlock.setPlan(node); } context.execBlockMap.put(node.getPID(), execBlock); return node; }
Source:
<code>private boolean canHandle(DataObject dataObject) { DataStore dataStore = dataObject.getDataStore(); if (dataStore.getRole() == DataStoreRole.Primary) { Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities == null) { return false; } if (dataObject instanceof VolumeInfo || dataObject instanceof SnapshotInfo) { String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()); Boolean supportsStorageSystemSnapshots = new Boolean(value); if (supportsStorageSystemSnapshots) { s_logger.info("Using 'StorageSystemDataMotionStrategy'"); return true; } } else if (dataObject instanceof TemplateInfo) { String value = mapCapabilities.get(DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_VOLUME.toString()); <START> Boolean canCloneVolume = new Boolean(value); <END> if (canCloneVolume) { s_logger.info("Using 'StorageSystemDataMotionStrategy'"); return true; } } } return false; }</code><technical_language>new Boolean skips constant pool -- placing unnecessary pressure garbage collector. Please Boolean.valueOf instead</technical_language>

Target:
private boolean canHandle(DataObject dataObject) { Preconditions.checkArgument(dataObject != null, "Passing 'null' to dataObject of canHandle(DataObject) is not supported."); DataStore dataStore = dataObject.getDataStore(); if (dataStore.getRole() == DataStoreRole.Primary) { Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities(); if (mapCapabilities == null) { return false; } if (dataObject instanceof VolumeInfo || dataObject instanceof SnapshotInfo) { String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()); Boolean supportsStorageSystemSnapshots = Boolean.valueOf(value); if (supportsStorageSystemSnapshots) { LOGGER.info("Using 'StorageSystemDataMotionStrategy' (dataObject is a volume or snapshot and the storage system supports snapshots)"); return true; } } else if (dataObject instanceof TemplateInfo) { String value = mapCapabilities.get(DataStoreCapabilities.CAN_CREATE_VOLUME_FROM_VOLUME.toString()); Boolean canCloneVolume = Boolean.valueOf(value); if (canCloneVolume) { LOGGER.info("Using 'StorageSystemDataMotionStrategy' (dataObject is a template and the storage system can create a volume from a volume)"); return true; } } } return false; }
Source:
<code>public Serializer getImplementation() { Serializer obj; try { obj = implementationClass.getDeclaredConstructor().newInstance(); } catch (NoSuchMethodException e) { throw new NuxeoException("Serializer Contribution NoDefaultConstructorDefined: " + name, e); } catch (IllegalAccessException e) { throw new NuxeoException("Serializer Contribution DefaultConstructorHidden: " + name, e); } catch (InstantiationException | InvocationTargetException e) { <START> throw new NuxeoException("Serializer Contribution ErrorOnInstanciation: " + name, e); <END> } return obj; }</code><technical_language>Catch ReflectiveOperationException instead of a bunch of catches</technical_language>

Target:
public Serializer getImplementation() { Serializer obj; try { obj = implementationClass.getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new NuxeoException("Serializer Contribution Exception on Serializer construction: " + name, e); } return obj; }
Source:
<code>private static String extractTargetRelease(Map<String, FlagStatus> streamStatus) { <START> return (streamStatus != null && streamStatus.size() > 0) ? streamStatus.keySet().iterator().next() : ""; <END> }</code><technical_language>_streamStatus != null_ is unnecessary Issue.java constructor _this.streamStatus = new HashMap<>();_</technical_language>

Target:
private static String extractTargetRelease(Map<String, FlagStatus> streamStatus) { return (streamStatus.size() > 0) ? streamStatus.keySet().iterator().next() : ""; }
Source:
<code>private List<Package> getPackages(final boolean includeDefaultPackage, final Set<Package> pkgs) { <START> final List<Package> sortedPackages = new ArrayList<>(); <END> sortedPackages.addAll(pkgs); Collections.sort(sortedPackages, (p1, p2) -> p1.getCaption().compareTo(p2.getCaption())); if (!includeDefaultPackage) { sortedPackages.remove(0); } return sortedPackages; }</code><technical_language>Optional nitpick aware of in future: simplify List<Package> sortedPackages = new ArrayList<>(); sortedPackages.addAll(pkgs) List<Package> sortedPackages = new ArrayList<>(pkgs);</technical_language>

Target:
private List<Package> getPackages(final boolean includeDefaultPackage, final Set<Package> pkgs) { final List<Package> sortedPackages = new ArrayList<>(pkgs); Collections.sort(sortedPackages, (p1, p2) -> p1.getCaption().compareTo(p2.getCaption())); if (!includeDefaultPackage && !sortedPackages.isEmpty() && "".equals(sortedPackages.get(0).getPackageName())) { sortedPackages.remove(0); } return sortedPackages; }
Source:
<code><START> static Predicate<ServerLocation> onlyAir() { <END> return Sponge.getRegistry().getFactoryRegistry().provideFactory(Factory.class).onlyAir(); }</code><technical_language>switch of returns (this method next method) a hair confusing here. is reasoning for that</technical_language>

Target:
static Predicate<LocatableBlock> onlyAir() { return Sponge.getRegistry().getFactoryRegistry().provideFactory(Factory.class).onlyAir(); }
Source:
<code>private boolean addExistingMediaToEditor(@NonNull AddExistingdMediaSource source, List<Long> mediaIdList) { ArrayMap<String, MediaFile> mediaMap = new ArrayMap<>(); for (Long mediaId : mediaIdList) { MediaModel media = mMediaStore.getSiteMediaWithId(mSite, mediaId); if (media == null) { AppLog.w(T.MEDIA, "Cannot add null media to post"); <START> return false; <END> } trackAddMediaEvent(source, media); MediaFile mediaFile = FluxCUtils.mediaFileFromMediaModel(media); String urlToUse = TextUtils.isEmpty(media.getUrl()) ? media.getFilePath() : media.getUrl(); mediaMap.put(urlToUse, mediaFile); } mEditorFragment.appendMediaFiles(mediaMap); return true; }</code><technical_language>Do want return here, continue instead, skipping put map? WDYT</technical_language>

Target:
private void addExistingMediaToEditor(@NonNull AddExistingdMediaSource source, List<Long> mediaIdList) { ArrayMap<String, MediaFile> mediaMap = new ArrayMap<>(); for (Long mediaId : mediaIdList) { MediaModel media = mMediaStore.getSiteMediaWithId(mSite, mediaId); if (media == null) { AppLog.w(T.MEDIA, "Cannot add null media to post"); } else { trackAddMediaEvent(source, media); MediaFile mediaFile = FluxCUtils.mediaFileFromMediaModel(media); String urlToUse = TextUtils.isEmpty(media.getUrl()) ? media.getFilePath() : media.getUrl(); mediaMap.put(urlToUse, mediaFile); } } mEditorFragment.appendMediaFiles(mediaMap); }
Source:
<code>public void put(final Feature feature) { final PutItemRequest putItemRequest = new PutItemRequest(); putItemRequest.withTableName(tableName) <START> .addItemEntry("ns",new AttributeValue().withS(namespace)) <END> .addItemEntry("name", new AttributeValue().withS(feature.name)) .addItemEntry("value", new AttributeValue().withS(feature.serialize())); amazonDynamoDB.putItem(putItemRequest); }</code><technical_language>Define strings class constant</technical_language>

Target:
public void put(final Feature feature) { final PutItemRequest putItemRequest = new PutItemRequest(); putItemRequest.withTableName(tableName) .addItemEntry(NAMESPACE_ATTRIBUTE_NAME,new AttributeValue().withS(namespace)) .addItemEntry(NAME_ATTRIBUTE_NAME, new AttributeValue().withS(feature.name)) .addItemEntry(VALUE_ATTRIBUTE_NAME, new AttributeValue().withS(feature.serialize())); amazonDynamoDB.putItem(putItemRequest); }
Source:
<code>private List<Object[]> convertIntegerToLong(List<Object[]> list, int index) { for (Object[] item : list) { <START> item[index] = new Long((long) item[index]); <END> } return list; }</code><technical_language>Is this superfluous casting</technical_language>

Target:
private List<Object[]> convertIntegerToLong(List<Object[]> list, int index) { for (Object[] item : list) { item[index] = (long) item[index]; } return list; }
Source:
<code>public void testFetchUnreachableBlobWithBitmap() throws Exception { RevBlob blob = remote.blob("foo"); RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob))); generateBitmaps(server); testProtocol = new TestProtocol<>( new UploadPackFactory<Object>() { @Override public UploadPack create(Object req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { UploadPack up = new UploadPack(db); up.setRequestPolicy(RequestPolicy.REACHABLE_COMMIT); return up; } }, null); uri = testProtocol.register(ctx, server); assertFalse(client.hasObject(blob.toObjectId())); try (Transport tn = testProtocol.open(uri, client, "server")) { <START> tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(blob.name()))); fail("expected TransportException"); } catch (TransportException exception) { assertTrue(exception.getMessage().contains("want " + blob.name() + " not valid")); } <END> }</code><technical_language>optional: org.junit.rules.ExpectedException instead of try-catch-fail pattern</technical_language>

Target:
public void testFetchUnreachableBlobWithBitmap() throws Exception { RevBlob blob = remote.blob("foo"); RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob))); generateBitmaps(server); testProtocol = generateReachableCommitUploadPackProtocol(); uri = testProtocol.register(ctx, server); assertFalse(client.hasObject(blob.toObjectId())); thrown.expect(TransportException.class); thrown.expectMessage(Matchers.containsString("want " + blob.name() + " not valid")); try (Transport tn = testProtocol.open(uri, client, "server")) { tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(blob.name()))); } }
Source:
<code>public static VirtualDevice prepareNicOpaque(VirtualMachineMO vmMo, VirtualEthernetCardType deviceType, String portGroupName, String macAddress, int deviceNumber, int contextNumber, boolean conntected, boolean connectOnStart) throws Exception { assert(vmMo.getRunningHost().hasOpaqueNSXNetwork()); VirtualEthernetCard nic; switch (deviceType) { case E1000: nic = new VirtualE1000(); break; case PCNet32: nic = new VirtualPCNet32(); break; case Vmxnet2: nic = new VirtualVmxnet2(); break; case Vmxnet3: nic = new VirtualVmxnet3(); break; default: <START> assert (false); <END> nic = new VirtualE1000(); } VirtualEthernetCardOpaqueNetworkBackingInfo nicBacking = new VirtualEthernetCardOpaqueNetworkBackingInfo(); nicBacking.setOpaqueNetworkId("br-int"); nicBacking.setOpaqueNetworkType("nsx.network"); nic.setBacking(nicBacking); VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo(); connectInfo.setAllowGuestControl(true); connectInfo.setConnected(conntected); connectInfo.setStartConnected(connectOnStart); nic.setAddressType("Manual"); nic.setConnectable(connectInfo); nic.setMacAddress(macAddress); nic.setUnitNumber(deviceNumber); nic.setKey(-contextNumber); return nic; }</code><technical_language>this "assert (false);" here? Asserting false problems. assertion contains a boolean expression true assertion executes. If is true, system throw error. Source: <LINK_0> user os assertion in this is irrelevant error-prone. please remove push a new commit? Cheers, Wilder</technical_language>

Target:
public static VirtualDevice prepareNicOpaque(VirtualMachineMO vmMo, VirtualEthernetCardType deviceType, String portGroupName, String macAddress, int deviceNumber, int contextNumber, boolean conntected, boolean connectOnStart) throws Exception { assert(vmMo.getRunningHost().hasOpaqueNSXNetwork()); VirtualEthernetCard nic; switch (deviceType) { case E1000: nic = new VirtualE1000(); break; case PCNet32: nic = new VirtualPCNet32(); break; case Vmxnet2: nic = new VirtualVmxnet2(); break; case Vmxnet3: nic = new VirtualVmxnet3(); break; default: nic = new VirtualE1000(); } VirtualEthernetCardOpaqueNetworkBackingInfo nicBacking = new VirtualEthernetCardOpaqueNetworkBackingInfo(); nicBacking.setOpaqueNetworkId("br-int"); nicBacking.setOpaqueNetworkType("nsx.network"); nic.setBacking(nicBacking); VirtualDeviceConnectInfo connectInfo = new VirtualDeviceConnectInfo(); connectInfo.setAllowGuestControl(true); connectInfo.setConnected(conntected); connectInfo.setStartConnected(connectOnStart); nic.setAddressType("Manual"); nic.setConnectable(connectInfo); nic.setMacAddress(macAddress); nic.setUnitNumber(deviceNumber); nic.setKey(-contextNumber); return nic; }
Source:
<code>private static void checkPropertyTester(IProject project, String fileName, boolean javaExpected) throws PartInitException{ if(!project.exists()){ fail("project does not exist"); <START> } <END> IFile file = project.getFile(fileName); IEditorPart editor = null; if (file.exists()) { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); editor = IDE.openEditor(page, file); }else{ fail("File - "+file.getFullPath()+" not found"); } NaturePropertyTester tester = new NaturePropertyTester(); boolean result = tester.test(editor, NaturePropertyTester.PROPERTY_NAME, null, "org.eclipse.jdt.core.javanature"); assertEquals("Wrong nature detection for project -"+project.getName(), javaExpected, result); }</code><technical_language>assertTrue("project exist", project.exists());</technical_language>

Target:
private static void checkPropertyTester(IProject project, String fileName, boolean javaExpected) throws PartInitException{ assertTrue("project does not exist", project.exists()); IFile file = project.getFile(fileName); assertTrue("File - "+file.getFullPath()+" not found", file.exists()); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IEditorPart editor = IDE.openEditor(page, file); NaturePropertyTester tester = new NaturePropertyTester(); boolean result = tester.test(editor, NaturePropertyTester.PROPERTY_NAME, null, "org.eclipse.jdt.core.javanature"); assertEquals("Wrong nature detection for project -"+project.getName(), javaExpected, result); }
Source:
<code>private String getPackageName(DotName name) { String packageName; if (name.isComponentized()) { <START> packageName = name.prefix().toString(); <END> } else { packageName = name.local().substring(0, name.local().lastIndexOf(".")); } return packageName; }</code><technical_language>return directly, need for packageName variable</technical_language>

Target:
private String getPackageName(DotName name) { if (name.isComponentized()) { return name.prefix().toString(); } else { return name.local().substring(0, name.local().lastIndexOf(".")); } }
Source:
<code>public UnhandledServerException(String exceptionMessage) { <START> super(Response.Status.UNSUPPORTED_MEDIA_TYPE, String.format(MESSAGE, exceptionMessage)); <END> }</code><technical_language>Is status code Response.Status.INTERNAL_SERVER_ERROR</technical_language>

Target:
public UnhandledServerException(String exceptionMessage) { super(Response.Status.INTERNAL_SERVER_ERROR, String.format(MESSAGE, exceptionMessage)); }
Source:
<code>public static Integer parsePageNum(String searchStr) { if (searchStr.toLowerCase().indexOf("page ") == -1) { return null; } else { int pos = searchStr.toLowerCase().indexOf("page ") + 5; StringBuilder pageNumberStr = new StringBuilder(); char c = searchStr.charAt(pos); while (Character.isDigit(c) && pos < searchStr.length()) { pageNumberStr.append(c); pos += 1; if (pos < searchStr.length()) { c = searchStr.charAt(pos); } } <START> int pageNum = pageNumberStr.length()==0 <END> ? 1 : Integer.valueOf(pageNumberStr.toString()); return pageNum; } }</code><technical_language>Formatting :-) int pageNum = pageNumberStr.length() == 0</technical_language>

Target:
public static Integer parsePageNum(String searchStr) { if (searchStr.toLowerCase().indexOf("page ") == -1) { return null; } else { int pos = searchStr.toLowerCase().indexOf("page ") + 5; StringBuilder pageNumberStr = new StringBuilder(); char c = searchStr.charAt(pos); while (Character.isDigit(c) && pos < searchStr.length()) { pageNumberStr.append(c); pos += 1; if (pos < searchStr.length()) { c = searchStr.charAt(pos); } } int pageNum = pageNumberStr.length() == 0 ? 1 : Integer.parseInt(pageNumberStr.toString()); return pageNum; } }
Source:
<code>public ExtensionCallback() { <START> super(NAME); <END> proxyServer = new ProxyServer("ZAP-CallbackServer"); proxyServer .addOverrideMessageProxyListener(new CallbackProxyListener()); }</code><technical_language>change of name break code is relying "older" name (this introduced in 2.6.0, if add-on name break in 2.7.0; a problem for zap-extensions add-ons though, class instead of name)</technical_language>

Target:
public ExtensionCallback() { proxyServer = new ProxyServer("ZAP-CallbackServer"); proxyServer .addOverrideMessageProxyListener(new CallbackProxyListener()); }
Source:
<code>private CuEinvoiceDao getCuEinvoiceDao() { <START> if (ObjectUtils.isNull(null)) { <END> cuEinvoiceDao = SpringContext.getBean(CuEinvoiceDaoOjb.class); } return cuEinvoiceDao; }</code><technical_language>This return true, want cuEinvoiceDao instead of null</technical_language>

Target:
private CuEinvoiceDao getCuEinvoiceDao() { if (ObjectUtils.isNull(cuEinvoiceDao)) { cuEinvoiceDao = SpringContext.getBean(CuEinvoiceDaoOjb.class); } return cuEinvoiceDao; }
Source:
<code>public void pingResultIsJavaSerializable() throws IOException, ClassNotFoundException { OrderableSlsVersion timeLockVersion = OrderableSlsVersion.valueOf("0.0.0"); PingResult pr = PingResult.builder().timeLockVersion(timeLockVersion) .isLeader(true).build(); FileOutputStream fileOut = new FileOutputStream("test.ser"); ObjectOutputStream out = new ObjectOutputStream(fileOut); <START> out.writeObject(pr); <END> out.close(); fileOut.close(); FileInputStream fileIn = new FileInputStream("test.ser"); ObjectInputStream in = new ObjectInputStream(fileIn); PingResult deserializedPingResult = (PingResult) in.readObject(); in.close(); fileIn.close(); assertThat(deserializedPingResult.isLeader()).isEqualTo(true); assertThat(deserializedPingResult.timeLockVersion()).isEqualTo(Optional.of(timeLockVersion)); }</code><technical_language>Please try-with-resources: try (FileOutputStream fileOut = new FileOutputStream(...); <same for ObjectOutputStream>) { ... }</technical_language>

Target:
public void pingResultIsJavaSerializable() throws IOException, ClassNotFoundException { OrderableSlsVersion timeLockVersion = OrderableSlsVersion.valueOf("0.27.0"); PingResult pr = PingResult.builder().timeLockVersion(timeLockVersion) .isLeader(true).build(); File file = tempFolder.newFile(); try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file))) { out.writeObject(pr); } try (ObjectInputStream in = new ObjectInputStream(new FileInputStream(file))) { PingResult deserializedPingResult = (PingResult) in.readObject(); assertThat(deserializedPingResult.isLeader()).isEqualTo(true); assertThat(deserializedPingResult.timeLockVersion()).isEqualTo(Optional.of(timeLockVersion)); } }
Source:
<code>public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt.getCompoundTag("node")); sixNodeCacheBlock = Block.getBlockById(nbt.getInteger("cacheBlockId")); sixNodeCacheBlockMeta = nbt.getByte("cacheBlockMeta"); int idx; for (idx = 0; idx < 6; idx++) { short sideElementId = nbt.getShort("EID" + idx); if (sideElementId == 0) { sideElementList[idx] = null; sideElementIdList[idx] = 0; } else { try { SixNodeDescriptor descriptor = Eln.sixNodeItem.getDescriptor(sideElementId); sideElementIdList[idx] = sideElementId; <START> sideElementList[idx] = (SixNodeElement) descriptor.ElementClass.getConstructor(SixNode.class, Direction.class, SixNodeDescriptor.class).newInstance(this, Direction.fromInt(idx), descriptor); <END> sideElementList[idx].readFromNBT(nbt.getCompoundTag("ED" + idx)); sideElementList[idx].initialize(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } } } initializeFromNBT(); }</code><technical_language>.. removed system is broke</technical_language>

Target:
public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt.getCompoundTag("node")); sixNodeCacheBlock = Block.getBlockById(nbt.getInteger("cacheBlockId")); sixNodeCacheBlockMeta = nbt.getByte("cacheBlockMeta"); int idx; for (idx = 0; idx < 6; idx++) { short sideElementId = nbt.getShort("EID" + idx); if (sideElementId == 0) { sideElementList[idx] = null; sideElementIdList[idx] = 0; } else { try { SixNodeDescriptor descriptor = null; sideElementIdList[idx] = sideElementId; sideElementList[idx] = (SixNodeElement) descriptor.ElementClass.getConstructor(SixNode.class, Direction.class, SixNodeDescriptor.class).newInstance(this, Direction.fromInt(idx), descriptor); sideElementList[idx].readFromNBT(nbt.getCompoundTag("ED" + idx)); sideElementList[idx].initialize(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } } } initializeFromNBT(); }
Source:
<code>public Map<String, List<String>> getRequestMetadata(URI uri) throws IOException { if (uri == null) { if (defaultAudience != null) { uri = defaultAudience; } else { throw new IOException("JwtAccess requires Audience uri to be passed in or the " + "defaultAudience to be specified"); } } String assertion = getJwtAccess(uri); <START> Map<String, List<String>> newRequestMetadata = new HashMap<String, List<String>>(); <END> List<String> newAuthorizationHeaders = new ArrayList<String>(); String authorizationHeader = "Bearer #" + assertion; newAuthorizationHeaders.add(authorizationHeader); newRequestMetadata.put("Authorization", newAuthorizationHeaders); return newRequestMetadata; }</code><technical_language>Collections.singletonMap()</technical_language>

Target:
public Map<String, List<String>> getRequestMetadata(URI uri) throws IOException { if (uri == null) { if (defaultAudience != null) { uri = defaultAudience; } else { throw new IOException("JwtAccess requires Audience uri to be passed in or the " + "defaultAudience to be specified"); } } String assertion = getJwtAccess(uri); String authorizationHeader = "Bearer #" + assertion; List<String> newAuthorizationHeaders = Collections.singletonList(authorizationHeader); Map<String, List<String>> newRequestMetadata = Collections.singletonMap("Authorization", newAuthorizationHeaders); return newRequestMetadata; }
Source:
<code>public void testStateLocationsWillBeReturnedIfExist() { final TaskManagerLocation stateLocation = new LocalTaskManagerLocation(); final TestingInputsLocationsRetriever.Builder locationRetrieverBuilder = new TestingInputsLocationsRetriever.Builder(); final ExecutionVertexID consumerId = new ExecutionVertexID(new JobVertexID(), 0); final ExecutionVertexID producerId = new ExecutionVertexID(new JobVertexID(), 0); locationRetrieverBuilder.connectConsumerToProducer(consumerId, producerId); final TestingInputsLocationsRetriever inputsLocationsRetriever = locationRetrieverBuilder.build(); inputsLocationsRetriever.markScheduled(producerId); <START> final DefaultPreferredLocationsRetriever locationsRetriever = new DefaultPreferredLocationsRetriever( <END> id -> Optional.of(stateLocation), inputsLocationsRetriever); final CompletableFuture<Collection<TaskManagerLocation>> preferredLocations = locationsRetriever.getPreferredLocations(consumerId, Collections.emptySet()); assertThat(preferredLocations.getNow(null), contains(stateLocation)); }</code><technical_language>suggestion final PreferredLocationsRetriever locationsRetriever = new DefaultPreferredLocationsRetriever(</technical_language>

Target:
public void testStateLocationsWillBeReturnedIfExist() { final TaskManagerLocation stateLocation = new LocalTaskManagerLocation(); final TestingInputsLocationsRetriever.Builder locationRetrieverBuilder = new TestingInputsLocationsRetriever.Builder(); final ExecutionVertexID consumerId = new ExecutionVertexID(new JobVertexID(), 0); final ExecutionVertexID producerId = new ExecutionVertexID(new JobVertexID(), 0); locationRetrieverBuilder.connectConsumerToProducer(consumerId, producerId); final TestingInputsLocationsRetriever inputsLocationsRetriever = locationRetrieverBuilder.build(); inputsLocationsRetriever.markScheduled(producerId); final PreferredLocationsRetriever locationsRetriever = new DefaultPreferredLocationsRetriever( id -> Optional.of(stateLocation), inputsLocationsRetriever); final CompletableFuture<Collection<TaskManagerLocation>> preferredLocations = locationsRetriever.getPreferredLocations(consumerId, Collections.emptySet()); assertThat(preferredLocations.getNow(null), contains(stateLocation)); }
Source:
<code>protected List<String> getLocales(File manualDir) { List<String> locales = new ArrayList<>(); if (!manualDir.exists() || !manualDir.canRead()) { log.error("manual directory doesn't exist: " + manualDir); return locales; } for (File dir : manualDir.listFiles()) { if (dir.isDirectory() && dir.canRead()) { String name = dir.getName(); <START> if (name.length() == 5 && name.indexOf("-") == 2) { END> locales.add(name); } } } return locales; }</code><technical_language>do a regex of \w\w\-\w\w something, I a file name 12-23 matches this</technical_language>

Target:
protected List<String> getLocales(File manualDir) { List<String> locales = new ArrayList<>(); if (!manualDir.exists() || !manualDir.canRead()) { log.error("manual directory doesn't exist: " + manualDir); return locales; } for (File dir : manualDir.listFiles()) { if (dir.isDirectory() && dir.canRead()) { String name = dir.getName(); Matcher m = LOCALE_PATTERN.matcher(name); if (m.matches()) { locales.add(name); } } } return locales; }
Source:
<code>public OpenShiftClient create() { <START> return new DefaultOpenShiftClient(configBuilder.build()); <END> }</code><technical_language>try build config in constructor, save in a field here</technical_language>

Target:
public OpenShiftClient create() { return new DefaultOpenShiftClient(config); }
Source:
<code>public Expression getComputedNameExpression() { <START> return spelExpressionParser.parseExpression(nameExpression != null ? nameExpression : ("'" + name + "'")); <END> }</code><technical_language>LiteralExpression for this. Also, nameExpression Expression</technical_language>

Target:
public Expression getComputedNameExpression() { return (nameExpression != null ? nameExpression : new LiteralExpression(name)); }
Source:
<code>private boolean nextFromTxState() { if ( txTypeIterator == null && !txTypes.isEmpty() ) { txTypeIterator = txTypes.iterator(); } if ( txTypeIterator != null && txTypeIterator.hasNext() ) { setType( txTypeIterator.next() ); <START> return true; <END> } return false; }</code><technical_language>I noticed, tested fixed in next commit. Nice</technical_language>

Target:
private boolean nextFromTxState() { if ( txTypeIterator == null && !txTypes.isEmpty() ) { txTypeIterator = txTypes.iterator(); } if ( txTypeIterator != null && txTypeIterator.hasNext() ) { setType( txTypeIterator.next() ); setFirstOut( NO_ID ); setFirstIn( NO_ID ); setFirstLoop( NO_ID ); return true; } return false; }
Source:
<code>public JSONObject fetchDiff() throws IOException, ConduitAPIException { Map params = new HashMap<String, String>(); <START> params.put("ids[]", diffID); <END> JSONObject query = this.callConduit("differential.querydiffs", params); JSONObject response; try { response = query.getJSONObject("result"); } catch (JSONException e) { throw new ConduitAPIException( String.format("No 'result' object found in conduit call: (%s) %s", e.getMessage(), query.toString(2))); } try { return response.getJSONObject(diffID); } catch (JSONException e) { throw new ConduitAPIException( String.format("Unable to find '%s' key in response: (%s) %s", diffID, e.getMessage(), response.toString(2))); } }</code><technical_language>Typo</technical_language>

Target:
public JSONObject fetchDiff() throws IOException, ConduitAPIException { Map params = new HashMap<String, String>(); params.put("ids[]", diffID); JSONObject query = this.callConduit("differential.querydiffs", params); JSONObject response; try { response = query.getJSONObject("result"); } catch (JSONException e) { throw new ConduitAPIException( String.format("No 'result' object found in conduit call: (%s) %s", e.getMessage(), query.toString(2))); } try { return response.getJSONObject(diffID); } catch (JSONException e) { throw new ConduitAPIException( String.format("Unable to find '%s' key in 'result': (%s) %s", diffID, e.getMessage(), response.toString(2))); } }
Source:
<code>@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_main, container, false); unbinder = ButterKnife.bind(this, view); disposables.add(WikipediaApp.getInstance().getBus().subscribe(new EventBusConsumer())); viewPager.setUserInputEnabled(false); viewPager.setAdapter(new NavTabFragmentPagerAdapter(this)); viewPager.registerOnPageChangeCallback(pageChangeCallback); FeedbackUtil.setButtonLongPressToast(moreContainer); tabLayout.setOnNavigationItemSelectedListener(item -> { if (getCurrentFragment() instanceof FeedFragment && item.getOrder() == 0) { ((FeedFragment) getCurrentFragment()).scrollToTop(); } if (getCurrentFragment() instanceof HistoryFragment && item.getOrder() == NavTab.SEARCH.code()) { <START> openSearchActivity(NAV_MENU, null); <END> } viewPager.setCurrentItem(item.getOrder(), false); return true; }); maybeShowEditsTooltip(); if (savedInstanceState == null) { handleIntent(requireActivity().getIntent()); } return view; }</code><technical_language>add return openSearchActivity() prevent unexpected action of scrolling top in history page</technical_language>

Target:
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_main, container, false); unbinder = ButterKnife.bind(this, view); disposables.add(WikipediaApp.getInstance().getBus().subscribe(new EventBusConsumer())); viewPager.setUserInputEnabled(false); viewPager.setAdapter(new NavTabFragmentPagerAdapter(this)); viewPager.registerOnPageChangeCallback(pageChangeCallback); FeedbackUtil.setButtonLongPressToast(moreContainer); tabLayout.setOnNavigationItemSelectedListener(item -> { if (getCurrentFragment() instanceof FeedFragment && item.getOrder() == 0) { ((FeedFragment) getCurrentFragment()).scrollToTop(); } if (getCurrentFragment() instanceof HistoryFragment && item.getOrder() == NavTab.SEARCH.code()) { openSearchActivity(NAV_MENU, null); return true; } viewPager.setCurrentItem(item.getOrder(), false); return true; }); maybeShowEditsTooltip(); if (savedInstanceState == null) { handleIntent(requireActivity().getIntent()); } return view; }
Source:
<code>public ModuleDefinition getModuleDefinition() { if (moduleDefinition == null) { <START> moduleDefinition = ModuleDefinitions.dummy(moduleName, type); <END> } return moduleDefinition; }</code><technical_language>I wrong (which nth time today ;-) )By adding this code hit filehandle issue before</technical_language>

Target:
public ModuleDefinition getModuleDefinition() { if (moduleDefinition == null) { moduleDefinition = new ModuleDefinition(moduleName, type) { @Override public boolean isComposed() { return false; } }; } return moduleDefinition; }
Source:
<code>public void initialize() { try { address = new BluetoothAddress(getConfig().get(BluetoothBindingConstants.CONFIGURATION_ADDRESS).toString()); } catch (IllegalArgumentException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getLocalizedMessage()); return; } Bridge bridge = getBridge(); if (bridge == null) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Not associated with any bridge"); return; } BridgeHandler bridgeHandler = bridge.getHandler(); if (!(bridgeHandler instanceof BluetoothAdapter)) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Associated with an unsupported bridge"); return; } adapter = (BluetoothAdapter) bridgeHandler; <START> deviceLock.lock(); <END> device = adapter.getDevice(address); device.addListener(this); deviceLock.unlock(); updateStatus(ThingStatus.UNKNOWN); }</code><technical_language>locks generally guarded try finally {}-blocks - especially some (foreign) non-trivial code is called while lock is in place</technical_language>

Target:
public void initialize() { try { address = new BluetoothAddress(getConfig().get(BluetoothBindingConstants.CONFIGURATION_ADDRESS).toString()); } catch (IllegalArgumentException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getLocalizedMessage()); return; } Bridge bridge = getBridge(); if (bridge == null) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Not associated with any bridge"); return; } BridgeHandler bridgeHandler = bridge.getHandler(); if (!(bridgeHandler instanceof BluetoothAdapter)) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Associated with an unsupported bridge"); return; } adapter = (BluetoothAdapter) bridgeHandler; try { deviceLock.lock(); device = adapter.getDevice(address); device.addListener(this); } finally { deviceLock.unlock(); } updateStatus(ThingStatus.UNKNOWN); }
Source:
<code>public static Builder builder(String packageName, TypeSpec typeSpec) { Objects.requireNonNull(packageName, "packageName == null"); <START> Objects.requireNonNull(typeSpec, "typeSpec == null"); <END> return new Builder(packageName, typeSpec); }</code><technical_language>Static import</technical_language>

Target:
public static Builder builder(String packageName, TypeSpec typeSpec) { requireNonNull(packageName, "packageName == null"); requireNonNull(typeSpec, "typeSpec == null"); return new Builder(packageName, typeSpec); }
Source:
<code>private Pair<View, TreeReference> loadTile(Activity activity) { AndroidSessionWrapper asw; try { asw = CommCareApplication._().getCurrentSessionWrapper(); } catch (SessionStateUninitException e) { return null; } CommCareSession session = asw.getSession(); StackFrameStep stepToFrame = null; Vector<StackFrameStep> v = session.getFrame().getSteps(); for(int i = v.size() -1 ; i >= 0; i--){ StackFrameStep step = v.elementAt(i); if(SessionFrame.STATE_DATUM_VAL.equals(step.getType())) { SessionDatum d = asw.getSession().findDatumDefinition(step.getId()); <START> if(d.getPersistentDetail() != null) { <END> stepToFrame = step; } } } Pair<View, TreeReference> tile = buildContextTile(stepToFrame, asw); if(tile == null && activity instanceof CommCareActivity) { Pair<Detail, TreeReference> entityContext = ((CommCareActivity)activity).requestEntityContext(); if(entityContext != null) { tile = buildContextTile(entityContext.first, entityContext.second, asw); } } return tile; }</code><technical_language>d null, want add a null check in</technical_language>

Target:
private Pair<View, TreeReference> loadTile(Activity activity) { AndroidSessionWrapper asw; try { asw = CommCareApplication._().getCurrentSessionWrapper(); } catch (SessionStateUninitException e) { return null; } CommCareSession session = asw.getSession(); StackFrameStep stepToFrame = null; Vector<StackFrameStep> v = session.getFrame().getSteps(); for(int i = v.size() -1 ; i >= 0; i--){ StackFrameStep step = v.elementAt(i); if(SessionFrame.STATE_DATUM_VAL.equals(step.getType())) { SessionDatum d = asw.getSession().findDatumDefinition(step.getId()); if(d != null && d.getPersistentDetail() != null) { stepToFrame = step; } } } Pair<View, TreeReference> tile = buildContextTile(stepToFrame, asw); if(tile == null && activity instanceof CommCareActivity) { Pair<Detail, TreeReference> entityContext = ((CommCareActivity)activity).requestEntityContext(); if(entityContext != null) { tile = buildContextTile(entityContext.first, entityContext.second, asw); } } return tile; }
Source:
<code>public static UserProvider login(Map<String, Object> conf, Configuration hbaseConfig) throws IOException { if (UserGroupInformation.isSecurityEnabled()) { List<String> autoCredentials = (List) conf.get(TOPOLOGY_AUTO_CREDENTIALS); if ((autoCredentials == null) || (!autoCredentials.contains(AutoHBase.class.getName()) && !autoCredentials.contains(AutoTGT.class.getName()))) { <START> LOG.info("Logging in using keytab as either AutoHBase or AutoTGT is specified for " + TOPOLOGY_AUTO_CREDENTIALS); <END> if (legacyProvider == null) { synchronized (HBaseSecurityUtil.class) { if (legacyProvider == null) { legacyProvider = UserProvider.instantiate(hbaseConfig); String keytab = (String) conf.get(STORM_KEYTAB_FILE_KEY); if (keytab != null) { hbaseConfig.set(STORM_KEYTAB_FILE_KEY, keytab); } String userName = (String) conf.get(STORM_USER_NAME_KEY); if (userName != null) { hbaseConfig.set(STORM_USER_NAME_KEY, userName); } legacyProvider.login(STORM_KEYTAB_FILE_KEY, STORM_USER_NAME_KEY, InetAddress.getLocalHost().getCanonicalHostName()); } } } } return legacyProvider; } else { return null; } }</code><technical_language>nit: I instead of</technical_language>

Target:
public static UserProvider login(Map<String, Object> conf, Configuration hbaseConfig) throws IOException { if (UserGroupInformation.isSecurityEnabled()) { List<String> autoCredentials = (List) conf.get(TOPOLOGY_AUTO_CREDENTIALS); if ((autoCredentials == null) || (!autoCredentials.contains(AutoHBase.class.getName()) && !autoCredentials.contains(AutoTGT.class.getName()))) { LOG.info("Logging in using keytab as neither AutoHBase or AutoTGT is specified for " + TOPOLOGY_AUTO_CREDENTIALS); if (legacyProvider == null) { synchronized (HBaseSecurityUtil.class) { if (legacyProvider == null) { legacyProvider = UserProvider.instantiate(hbaseConfig); String keytab = (String) conf.get(STORM_KEYTAB_FILE_KEY); if (keytab != null) { hbaseConfig.set(STORM_KEYTAB_FILE_KEY, keytab); } String userName = (String) conf.get(STORM_USER_NAME_KEY); if (userName != null) { hbaseConfig.set(STORM_USER_NAME_KEY, userName); } legacyProvider.login(STORM_KEYTAB_FILE_KEY, STORM_USER_NAME_KEY, InetAddress.getLocalHost().getCanonicalHostName()); } } } } return legacyProvider; } else { return null; } }
Source:
<code>public void shouldLogAuditIfRequestAreMade() throws IOException { MotechEvent motechEvent = new MotechEvent(EventSubjects.HTTP_REQUEST, new HashMap<String, Object>() {{ put(EventDataKeys.URL, url); put(EventDataKeys.DATA, data); put(EventDataKeys.METHOD, Method.DELETE); put(EventDataKeys.HEADERS, headers); }}); HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.add("key1", "value1"); httpHeaders.add("key2", "value2"); request = new HttpEntity<String>(data,httpHeaders); responseEntity = new ResponseEntity<String>(body,HttpStatus.OK); when(restTempate.exchange(eq(url),eq(HttpMethod.DELETE),eq(request), eq(String.class))).thenReturn((ResponseEntity<String>) responseEntity); httpClientEventListener.handle(motechEvent); HTTPActionAudit httpActionAudit = new HTTPActionAudit(url, request.toString(), responseEntity.getBody().toString(), responseEntity.getStatusCode().toString()); <START> verify(httpActionService,times(1)).create(eq(httpActionAudit)); <END> }</code><technical_language>execution is default calling verify argument</technical_language>

Target:
public void shouldLogAuditIfRequestAreMade() throws IOException { MotechEvent motechEvent = new MotechEvent(EventSubjects.HTTP_REQUEST, new HashMap<String, Object>() {{ put(EventDataKeys.URL, url); put(EventDataKeys.DATA, data); put(EventDataKeys.METHOD, Method.DELETE); put(EventDataKeys.HEADERS, headers); }}); HttpHeaders httpHeaders = new HttpHeaders(); httpHeaders.add("key1", "value1"); httpHeaders.add("key2", "value2"); request = new HttpEntity<String>(data,httpHeaders); responseEntity = new ResponseEntity<String>(body,HttpStatus.OK); when(restTempate.exchange(eq(url),eq(HttpMethod.DELETE),eq(request), eq(String.class))).thenReturn((ResponseEntity<String>) responseEntity); httpClientEventListener.handle(motechEvent); HTTPActionAudit httpActionAudit = new HTTPActionAudit(url, request.toString(), responseEntity.getBody().toString(), responseEntity.getStatusCode().toString()); verify(httpActionService).create(eq(httpActionAudit)); }
Source:
<code><START> private List<String> filterStopwords(List<String> terms, IndexReader reader, boolean tweetsearch, int numDocs) throws IOException { <END> List<String> filteredTerms = new LinkedList<>(); for (String term: terms){ if (isStopword(term,reader,tweetsearch,numDocs)){ continue; }else{ filteredTerms.add(term); } } return filteredTerms; }</code><technical_language>this nicely rewritten? terms.stream().filter(term -> ...).collect(Collectors.toList())</technical_language>

Target:
private List<String> filterStopwords(List<String> terms, IndexReader reader, boolean tweetsearch, int numDocs) throws IOException { return terms.stream().filter(term -> { try { return !isStopword(term, reader, tweetsearch, numDocs); } catch (IOException e) { e.printStackTrace(); LOG.warn("Fail to test " + term ); return false; } } ).collect(Collectors.toList()); }
Source:
<code>public long putFile(File sourceFile, ContentReference targetContentReference) throws ContentIOException { if (! isContentReferenceSupported(targetContentReference)) { throw new ContentIOException("ContentReference not supported"); } long startTime = System.currentTimeMillis(); String remotePath = getRelativePath(targetContentReference.getUri()); try { Long contentLength = sourceFile.length(); try { Upload xfer = tm.upload(s3BucketName, remotePath, sourceFile); xfer.waitForCompletion(); } catch (InterruptedException e) { logger.error("Upload was interrupted: "+e.getMessage()); Thread.currentThread().interrupt(); throw new ContentIOException("Failed to write content", e); } ObjectMetadata metadata = s3.getObjectMetadata( new GetObjectMetadataRequest(s3BucketName, remotePath)); long storedContentLength = metadata.getContentLength(); if (logger.isWarnEnabled()) { <START> if ((contentLength != null) && (storedContentLength != contentLength)) <END> { logger.warn("Metadata length differs - expected " + contentLength + ", actual "+ storedContentLength); } } if (logger.isDebugEnabled()) { logger.debug("Upload file: " + s3BucketName + ":" + remotePath + " (in "+(System.currentTimeMillis()-startTime)+" msecs)"); } return storedContentLength; } catch (AmazonClientException e) { throw new ContentIOException("Failed to write content", e); } }</code><technical_language>**contentLength** is **null**. In fact declared a '**long**' (primitive), type returned _sourceFile.length()_</technical_language>

Target:
public long putFile(File sourceFile, ContentReference targetContentReference) throws ContentIOException { if (! isContentReferenceSupported(targetContentReference)) { throw new ContentIOException("ContentReference not supported"); } long startTime = System.currentTimeMillis(); String remotePath = getRelativePath(targetContentReference.getUri()); try { long contentLength = sourceFile.length(); try { Upload xfer = tm.upload(s3BucketName, remotePath, sourceFile); xfer.waitForCompletion(); } catch (InterruptedException e) { logger.error("Upload was interrupted: "+e.getMessage()); Thread.currentThread().interrupt(); throw new ContentIOException("Failed to write content", e); } ObjectMetadata metadata = s3.getObjectMetadata( new GetObjectMetadataRequest(s3BucketName, remotePath)); long storedContentLength = metadata.getContentLength(); if (logger.isWarnEnabled()) { if (storedContentLength != contentLength) { logger.warn("Metadata length differs - expected " + contentLength + ", actual "+ storedContentLength); } } if (logger.isDebugEnabled()) { logger.debug("Upload file: " + s3BucketName + ":" + remotePath + " (in "+(System.currentTimeMillis()-startTime)+" msecs)"); } return storedContentLength; } catch (AmazonClientException e) { throw new ContentIOException("Failed to write content", e); } }
Source:
<code>static <R> CompletableFuture<R> toCompletableFuture(Future<R> future, Executor executor) { Supplier<R> supplier = () -> { try { return future.get(); } catch (InterruptedException | ExecutionException e) { <START> throw new RuntimeException(e); <END> } }; if (executor != null) { return CompletableFuture.supplyAsync(supplier, executor); } else { return CompletableFuture.supplyAsync(supplier); } }</code><technical_language>CompletionException more I think. end longer ex-> RuntimeException(ex) -> CompletionException chain of causes</technical_language>

Target:
static <R> CompletableFuture<R> toCompletableFuture(Future<R> future, Executor executor) { Supplier<R> supplier = () -> { try { return future.get(); } catch (InterruptedException | ExecutionException e) { throw new CompletionException(e); } }; if (executor != null) { return CompletableFuture.supplyAsync(supplier, executor); } else { return CompletableFuture.supplyAsync(supplier); } }