auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ProjectGeneralPreferencesPane(Session session) { sessionInfo_ = session.getSessionInfo(); Grid grid = new Grid(6, 2); grid.addStyleName(RESOURCES.styles().workspaceGrid()); grid.setCellSpacing(8); Label infoLabel = new Label("Use (Default) to inherit the global default setting"); infoLabel.addStyleName(PreferencesDialogBaseResources.INSTANCE.styles().infoLabel()); grid.setWidget(0, 0, infoLabel); grid.setWidget(1, 0, new Label("Restore .RData into workspace at startup")); grid.setWidget(1, 1, restoreWorkspace_ = new YesNoAskDefault(false)); grid.setWidget(2, 0, new Label("Save workspace to .RData on exit")); grid.setWidget(2, 1, saveWorkspace_ = new YesNoAskDefault(true)); grid.setWidget(3, 0, new Label("Always save history (even if not saving .RData)")); grid.setWidget(3, 1, alwaysSaveHistory_ = new YesNoAskDefault(false)); grid.setWidget(4, 0, executeRprofile_ = new CheckBox("Execute .Rprofile on session start")); grid.setWidget(5, 0, quitChildProcessesOnExit_ = new CheckBox("Quit child processes on exit")); add(grid); }

Target:
public ProjectGeneralPreferencesPane(Session session) { sessionInfo_ = session.getSessionInfo(); Grid grid = new Grid(6, 2); grid.addStyleName(RESOURCES.styles().workspaceGrid()); grid.setCellSpacing(8); Label infoLabel = new Label("Use (Default) to inherit the global default setting"); infoLabel.addStyleName(PreferencesDialogBaseResources.INSTANCE.styles().infoLabel()); grid.setWidget(0, 0, infoLabel); grid.setWidget(1, 0, new Label("Restore .RData into workspace at startup")); grid.setWidget(1, 1, restoreWorkspace_ = new YesNoAskDefault(false)); grid.setWidget(2, 0, new Label("Save workspace to .RData on exit")); grid.setWidget(2, 1, saveWorkspace_ = new YesNoAskDefault(true)); grid.setWidget(3, 0, new Label("Always save history (even if not saving .RData)")); grid.setWidget(3, 1, alwaysSaveHistory_ = new YesNoAskDefault(false)); grid.setWidget(4, 0, disableExecuteRprofile_ = new CheckBox("Disable .Rprofile execution on session start/resume")); grid.setWidget(5, 0, quitChildProcessesOnExit_ = new CheckBox("Quit child processes on exit")); add(grid); }
Source:
private IRegisterGroupDescriptor createGroupDescriptor(final String groupName, final IRegisterDescriptor[] iSelectedRegisters) { IRegisterGroupDescriptor groupDescriptor = new IRegisterGroupDescriptor() { @Override public boolean isEnabled() { return true; } @Override public String getName() { return groupName; } @Override public String getContainerId() { return null; } @Override public IRegisterDescriptor[] getChildren() throws CoreException { return iSelectedRegisters; } }; return groupDescriptor; }

Target:
private IRegisterGroupDescriptor createGroupDescriptor(final String groupName, final IRegisterDescriptor[] iSelectedRegisters) { IRegisterGroupDescriptor groupDescriptor = new IRegisterGroupDescriptor() { @Override public boolean isEnabled() { return true; } @Override public String getName() { return groupName; } @Override public IRegisterDescriptor[] getChildren() throws CoreException { return iSelectedRegisters; } }; return groupDescriptor; }
Source:
protected void setValuesFromAlignment(final SAMRecord rec, final SAMRecord alignment, final boolean needsSafeReverseComplement) { alignment.getAttributes().stream() .filter(attr -> (!isReservedTag(attr.tag) || this.attributesToRetain.contains(attr.tag)) && !this.attributesToRemove.contains(attr.tag)) .forEach(attr -> rec.setAttribute(attr.tag, attr.value)); rec.setReadUnmappedFlag(alignment.getReadUnmappedFlag()); rec.setReferenceName(alignment.getReferenceName()); rec.setAlignmentStart(alignment.getAlignmentStart()); rec.setReadNegativeStrandFlag(alignment.getReadNegativeStrandFlag()); rec.setNotPrimaryAlignmentFlag(alignment.getNotPrimaryAlignmentFlag()); rec.setSupplementaryAlignmentFlag(alignment.getSupplementaryAlignmentFlag()); if (!alignment.getReadUnmappedFlag()) { rec.setCigar(alignment.getCigar()); rec.setMappingQuality(alignment.getMappingQuality()); } if (rec.getReadPairedFlag()) { rec.setProperPairFlag(alignment.getProperPairFlag()); } if (rec.getReadNegativeStrandFlag()) { if(needsSafeReverseComplement) { rec.reverseComplement(); } else { rec.reverseComplement(true); } } }

Target:
protected void setValuesFromAlignment(final SAMRecord rec, final SAMRecord alignment, final boolean needsSafeReverseComplement) { for (final SAMRecord.SAMTagAndValue attr : alignment.getAttributes()) { if ((!isReservedTag(attr.tag) || this.attributesToRetain.contains(attr.tag)) && !this.attributesToRemove.contains(attr.tag)) { rec.setAttribute(attr.tag, attr.value); } } rec.setReadUnmappedFlag(alignment.getReadUnmappedFlag()); rec.setReferenceName(alignment.getReferenceName()); rec.setAlignmentStart(alignment.getAlignmentStart()); rec.setReadNegativeStrandFlag(alignment.getReadNegativeStrandFlag()); rec.setNotPrimaryAlignmentFlag(alignment.getNotPrimaryAlignmentFlag()); rec.setSupplementaryAlignmentFlag(alignment.getSupplementaryAlignmentFlag()); if (!alignment.getReadUnmappedFlag()) { rec.setCigar(alignment.getCigar()); rec.setMappingQuality(alignment.getMappingQuality()); } if (rec.getReadPairedFlag()) { rec.setProperPairFlag(alignment.getProperPairFlag()); } if (rec.getReadNegativeStrandFlag()) { if(needsSafeReverseComplement) { rec.reverseComplement(); } else { rec.reverseComplement(true); } } }
Source:
public BeanDefinition getOAuth2AuthorizationRequestRedirectFilter() { return oauth2AuthorizationRequestRedirectFilter; }

Target:
BeanDefinition getOAuth2AuthorizationRequestRedirectFilter() { return oauth2AuthorizationRequestRedirectFilter; }
Source:
protected Vector<String> getAllMatchingTests(String match) { Class<? extends AbstractJDITest> theClass = this.getClass(); java.lang.reflect.Method[] methods = theClass.getDeclaredMethods(); Vector<String> result = new Vector<>(); for (int i = 0; i < methods.length; i++) { java.lang.reflect.Method m = methods[i]; String name = m.getName(); Class<?>[] parameters = m.getParameterTypes(); if (parameters.length == 0 && name.startsWith(match)) { if (!isExcludedTest(name)) { result.add(name); } else { System.out.println(name + " is excluded."); } } } return result; }

Target:
protected Vector<String> getAllMatchingTests(String match) { Class<? extends AbstractJDITest> theClass = this.getClass(); java.lang.reflect.Method[] methods = theClass.getDeclaredMethods(); Vector<String> result = new Vector<>(); for (int i = 0; i < methods.length; i++) { java.lang.reflect.Method m = methods[i]; String name = m.getName(); Class<?>[] parameters = m.getParameterTypes(); if (parameters.length == 0 && name.startsWith(match)) { if (!isExcludedTest(name)) { result.add(name); } else System.out.println(name + " is excluded."); } } return result; }
Source:
static void setDefaultLocales(Locales locales) { Locale.setDefault(locales.locale); Locale.setDefault(DISPLAY, locales.displayLocale); Locale.setDefault(FORMAT, locales.formatLocale); }

Target:
static void setDefaultLocales(Locales locales) { Locale.setDefault(locales.uncategorizedLocale); Locale.setDefault(DISPLAY, locales.displayLocale); Locale.setDefault(FORMAT, locales.formatLocale); assertEquals(locales, getDefaultLocales()); }
Source:
public void assemble(ByteBuffer udfBuffer, int udafIndex) throws Throwable { assert(m_paramCount == 1); int argNum = udfBuffer.getInt(); while (argNum-- > 0) { Object[] paramsIn = new Object[m_paramCount]; for (int i = 0; i < m_paramCount; i++) { paramsIn[i] = getValueFromBuffer(udfBuffer, m_paramTypes[i]); if (m_boxUpByteArray[i]) { paramsIn[i] = SerializationHelper.boxUpByteArray((byte[])paramsIn[i]); } } m_assembleMethod.invoke(m_functionInstances.get(udafIndex), paramsIn); } }

Target:
public void assemble(ByteBuffer udfBuffer, int udafIndex) throws Throwable { assert(m_paramCount == 1); int argNum = udfBuffer.getInt(); while (argNum-- > 0) { Object[] paramsIn = new Object[m_paramCount]; paramsIn[0] = getValueFromBuffer(udfBuffer, m_paramTypes[0]); if (m_boxUpByteArray[0]) { paramsIn[0] = SerializationHelper.boxUpByteArray((byte[])paramsIn[0]); } m_assembleMethod.invoke(m_functionInstances.get(udafIndex), paramsIn); } }
Source:
private BucketMeta processPurge(Bucket bucket, BucketMeta bmeta, HashSet<String> filesToDelete) throws IOException { if (bmeta.files.isEmpty()) return bmeta; WriteCache frozen = bucket.frozenWriteCache; if (frozen.getPurges() == null || frozen.getPurges().isEmpty()) return bmeta; BucketMeta bucketMetaCopy = kryo.copy(getMeta(bucket.bucketKey)); Iterator<BucketFileMeta> fileIter = bmeta.files.values().iterator(); while (fileIter.hasNext()) { BucketFileMeta fmeta = fileIter.next(); Range<Slice> frange = new Range<>(fmeta.startKey, getEndKey(bucket.bucketKey, fmeta)); RangeSet<Slice> rset = frozen.getPurges().getOverlappingRanges(frange); if (rset.isEmpty()) continue; writeFileWithPurge(bucket, fmeta, rset, filesToDelete, bucketMetaCopy); } return bucketMetaCopy; }

Target:
private BucketMeta processPurge(Bucket bucket, BucketMeta bmeta, HashSet<String> filesToDelete) throws IOException { if (bmeta.files.isEmpty()) { LOG.debug("No existing files to purge data from bucket {}", bucket); return bmeta; } WriteCache frozen = bucket.frozenWriteCache; if (frozen.getPurges() == null || frozen.getPurges().isEmpty()) { LOG.debug("No Pending purge requests for bucket {}", bucket); return bmeta; } BucketMeta bucketMetaCopy = kryo.copy(getMeta(bucket.bucketKey)); Iterator<BucketFileMeta> fileIter = bmeta.files.values().iterator(); Slice last = frozen.getPurges().getLast(); while (fileIter.hasNext()) { BucketFileMeta fmeta = fileIter.next(); if (keyComparator.compare(fmeta.startKey, last) > 0) break; Range<Slice> frange = new Range<>(fmeta.startKey, getEndKey(bucket.bucketKey, fmeta, frozen.getPurges())); RangeSet<Slice> rset = frozen.getPurges().getOverlappingRanges(frange); if (rset.isEmpty()) continue; writeFileWithPurge(bucket, fmeta, rset, filesToDelete, bucketMetaCopy); } return bucketMetaCopy; }
Source:
public void setVariants( Set<BaseVariantData> variants) { mVariants = variants; }

Target:
public void setVariants(Set<BaseVariantData> variants) { this.variants = variants; }
Source:
public CbclReader(final List<File> cbcls, final Map<Integer, File> filterFileMap, final int[] outputLengths, int tileNum, List<AbstractIlluminaPositionFileReader.PositionInfo> locs, boolean headerOnly) { super(outputLengths); surfaceToTileToCbclMap = sortCbcls(cbcls); this.filterFileMap = filterFileMap; cycleData = new CycleData[cycles]; cachedTile = new byte[cycles][]; cachedTilePosition = new int[cycles]; for (int i = 1; i <= cycles; i++) { allTiles.put(i, new ArrayList<>()); } readSurfaceTile(tileNum, locs, headerOnly); close(); }

Target:
public CbclReader(final List<File> cbcls, final Map<Integer, File> filterFileMap, final int[] outputLengths, int tileNum, List<AbstractIlluminaPositionFileReader.PositionInfo> locs, boolean headerOnly) { super(outputLengths); surfaceToTileToCbclMap = sortCbcls(cbcls); this.filterFileMap = filterFileMap; cycleData = new CycleData[cycles]; cachedTile = new byte[cycles][]; cachedTilePosition = new int[cycles]; for (int i = 1; i <= cycles; i++) { allTiles.put(i, new ArrayList<>()); } try { readSurfaceTile(tileNum, locs, headerOnly); } finally { close(); } }
Source:
public void decoratePillarWithClouderaManagerSettings(Map<String, SaltPillarProperties> servicePillar, ClouderaManagerRepo clouderaManagerRepo, Stack stack) { ServiceLocationMap serviceLocations = clusterApiConnectors.getConnector(stack.getCluster()).getServiceLocations(); String cmVersion = clouderaManagerRepo.getVersion(); servicePillar.put("cloudera-manager-settings", new SaltPillarProperties("/cloudera-manager/settings.sls", singletonMap("cloudera-manager", Map.of( "settings", Map.of( "heartbeat_interval", cmHeartbeatInterval, "missed_heartbeat_interval", cmMissedHeartbeatInterval, "set_cdp_env", isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_0_2), "deterministic_uid_gid", isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_1), "cloudera_scm_sudo_access", CMRepositoryVersionUtil.isSudoAccessNeededForHostCertRotation(clouderaManagerRepo)), "directories", serviceLocations.getAllVolumePath())))); }

Target:
public void decoratePillarWithClouderaManagerSettings(Map<String, SaltPillarProperties> servicePillar, ClouderaManagerRepo clouderaManagerRepo, Stack stack) { ServiceLocationMap serviceLocations = clusterApiConnectors.getConnector(stack.getCluster()).getServiceLocations(); String cmVersion = clouderaManagerRepo.getVersion(); servicePillar.put("cloudera-manager-settings", new SaltPillarProperties("/cloudera-manager/settings.sls", singletonMap("cloudera-manager", Map.of( "settings", Map.of( "heartbeat_interval", cmHeartbeatInterval, "missed_heartbeat_interval", cmMissedHeartbeatInterval, "set_cdp_env", isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_0_2), "deterministic_uid_gid", isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_1), "cloudera_scm_sudo_access", CMRepositoryVersionUtil.isSudoAccessNeededForHostCertRotation(clouderaManagerRepo)), "mgmt_service_directories", serviceLocations.getAllVolumePath())))); }
Source:
public FileUtils.FileCopyResult getSegmentFiles(String region, String container, String path, File outDir) throws SegmentLoadingException { CloudFilesObjectApiProxy objectApi = new CloudFilesObjectApiProxy(cloudFilesApi, region, container); CloudFilesObject cloudFilesObject = objectApi.get(path); try { final InputStream inputStream = cloudFilesObject.getPayload().openStream(); final FileUtils.FileCopyResult result = CompressionUtils.unzip(inputStream, outDir); log.info("Loaded %d bytes from [%s] to [%s]", result.size(), cloudFilesObject.getPath(), outDir.getAbsolutePath()); return result; } catch (Exception e) { try { org.apache.commons.io.FileUtils.deleteDirectory(outDir); } catch (IOException ioe) { log.warn(ioe, "Failed to remove output directory [%s] for segment pulled from [%s]", outDir.getAbsolutePath(), cloudFilesObject.getPath()); } throw new SegmentLoadingException(e, e.getMessage()); } }

Target:
public FileUtils.FileCopyResult getSegmentFiles(String region, String container, String path, File outDir) throws SegmentLoadingException { CloudFilesObjectApiProxy objectApi = new CloudFilesObjectApiProxy(cloudFilesApi, region, container); final CloudFilesByteSource byteSource = new CloudFilesByteSource(objectApi, path); try { final FileUtils.FileCopyResult result = CompressionUtils.unzip( byteSource, outDir, CloudFilesUtils.CLOUDFILESRETRY, true ); log.info("Loaded %d bytes from [%s] to [%s]", result.size(), path, outDir.getAbsolutePath()); return result; } catch (Exception e) { try { org.apache.commons.io.FileUtils.deleteDirectory(outDir); } catch (IOException ioe) { log.warn( ioe, "Failed to remove output directory [%s] for segment pulled from [%s]", outDir.getAbsolutePath(), path ); } throw new SegmentLoadingException(e, e.getMessage()); } finally { try { byteSource.closeStream(); } catch (IOException ioe) { log.warn(ioe, "Failed to close payload for segmente pulled from [%s]", path); } } }
Source:
public void initialise() { addDesiredStateChange(new BindFBO(DefaultDynamicFBOs.READ_ONLY_GBUFFER.getName(), dynamicFBOsManager)); }

Target:
public void initialise() { addDesiredStateChange(new BindFBO(READ_ONLY_GBUFFER.getName(), displayResolutionDependentFBOs)); }
Source:
private void logIncompatibleRegistration(String path, Type existingType, Type type) { if ( LOG.isTraceEnabled() ) { LOG.tracev( "Skipped adding same named type incompatible property to base type [{0}] for property [{1}], existing type = [{2}], incoming type = [{3}]", getEntityName(), path, existingType, type ); } }

Target:
private void logIncompatibleRegistration(String path, Type existingType, Type type) { if ( LOG.isTraceEnabled() ) { LOG.tracev( "Skipped adding attribute [{1}] to base-type [{0}] as more than one sub-type defined the attribute using incompatible types (strictly speaking the attributes are not inherited); existing type = [{2}], incoming type = [{3}]", getEntityName(), path, existingType, type ); } }
Source:
public Data deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final JsonNode root = jp.readValueAsTree(); if (root.isArray()) { final List<Data> list = stream(spliteratorUnknownSize(root.elements(), Spliterator.ORDERED), false) .map(elem -> { try { final Class<? extends Data> clazz = elem.isArray() ? DataList.class : DataValue.class; return ctxt.readValue(elem.traverse(jp.getCodec()), clazz); } catch (IOException e) { throw new UncheckedIOException(e); } }).collect(Collectors.toList()); return new DataList(list); } else if (root.isTextual()) { return new DataValue(root.textValue()); } else if (root.isNull()) { return NULL; } else { throw from(jp, "Unknown value of type: " + root.getNodeType()); } }

Target:
public Data deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final JsonNode root = jp.readValueAsTree(); if (root.isArray()) { final List<Data> list = stream(spliteratorUnknownSize(root.elements(), Spliterator.ORDERED), false) .map(elem -> { try { return ctxt.readValue(elem.traverse(jp.getCodec()), Data.class); } catch (IOException e) { throw new UncheckedIOException(e); } }).collect(Collectors.toList()); return new DataList(list); } else if (root.isTextual()) { return new DataValue(root.textValue()); } else if (root.isNull()) { return NULL; } else { throw JsonMappingException.from(jp, "Unknown value of type: " + root.getNodeType()); } }
Source:
public String streamingPredict(int tenantId, String userName, long modelId, String dataFormat, InputStream dataStream) throws MLModelHandlerException { List<String[]> data = new ArrayList<String[]>(); CSVFormat csvFormat = DataTypeFactory.getCSVFormat(dataFormat); BufferedReader br = new BufferedReader(new InputStreamReader(dataStream)); try { String line; while ((line = br.readLine()) != null) { String[] dataRow = line.split(csvFormat.getDelimiter() + ""); data.add(dataRow); } List<String[]> unencodedData = new ArrayList<String[]>(data.size()); for (String[] item : data) { unencodedData.add(item.clone()); } List<?> predictions = predict(tenantId, userName, modelId, data); StringBuilder predictionsWithData = new StringBuilder(); for (int i = 0; i < predictions.size(); i++) { predictionsWithData.append(MLUtils.arrayToCsvString(unencodedData.get(i), csvFormat.getDelimiter()) + String.valueOf(predictions.get(i)) + MLConstants.NEW_LINE); } return predictionsWithData.toString(); } catch (IOException e) { String msg = "Failed to read the data points for prediction for model [id] " + modelId; log.error(msg, e); throw new MLModelHandlerException(msg, e); } finally { try { if (dataStream != null && br != null) { dataStream.close(); br.close(); } } catch (IOException ignore) { } } }

Target:
public String streamingPredict(int tenantId, String userName, long modelId, String dataFormat, InputStream dataStream) throws MLModelHandlerException { List<String[]> data = new ArrayList<String[]>(); CSVFormat csvFormat = DataTypeFactory.getCSVFormat(dataFormat); BufferedReader br = new BufferedReader(new InputStreamReader(dataStream)); try { String line; while ((line = br.readLine()) != null) { String[] dataRow = line.split(csvFormat.getDelimiter() + ""); data.add(dataRow); } List<String[]> unencodedData = new ArrayList<String[]>(data.size()); for (String[] item : data) { unencodedData.add(item.clone()); } List<?> predictions = predict(tenantId, userName, modelId, data); StringBuilder predictionsWithData = new StringBuilder(); for (int i = 0; i < predictions.size(); i++) { predictionsWithData.append(MLUtils.arrayToCsvString(unencodedData.get(i), csvFormat.getDelimiter())) .append(String.valueOf(predictions.get(i))) .append(MLConstants.NEW_LINE); } return predictionsWithData.toString(); } catch (IOException e) { String msg = "Failed to read the data points for prediction for model [id] " + modelId; log.error(msg, e); throw new MLModelHandlerException(msg, e); } finally { try { if (dataStream != null && br != null) { dataStream.close(); br.close(); } } catch (IOException ignore) { } } }
Source:
private void write(SelectionKey key, Transmission transmission) throws IOException { long startTimeToWriteInMs = time.milliseconds(); try { boolean sendComplete = transmission.write(); if (sendComplete) { logger.trace("Finished writing, registering for read on connection {}", transmission.getSocketChannel().socket().getRemoteSocketAddress()); transmission.getNetworkSend().onSendComplete(); this.completedSends.add(transmission.getNetworkSend()); metrics.sendInFlight.dec(); transmission.clearSend(); key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE | SelectionKey.OP_READ); } } finally { long writeTime = time.milliseconds() - startTimeToWriteInMs; logger.trace("SocketServer time spent on write per key = {}", transmission.getConnectionId(), writeTime); } }

Target:
private void write(SelectionKey key, Transmission transmission) throws IOException { long startTimeToWriteInMs = time.milliseconds(); try { boolean sendComplete = transmission.write(); if (sendComplete) { logger.trace("Finished writing, registering for read on connection {}", transmission.getRemoteSocketAddress()); transmission.onSendComplete(); this.completedSends.add(transmission.getNetworkSend()); metrics.sendInFlight.dec(); transmission.clearSend(); key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE | SelectionKey.OP_READ); } } finally { long writeTime = time.milliseconds() - startTimeToWriteInMs; logger.trace("SocketServer time spent on write per key = {}", transmission.getConnectionId(), writeTime); } }
Source:
private void checkNoSearchResults(String result,int length){ if (length>0) { textView.setText(getString(R.string.null_search_result) + " " + '"' + result + '"'); textView.setTextColor(getTextColor()); textView.setVisibility(View.VISIBLE); } else textView.setVisibility(View.INVISIBLE); }

Target:
private void checkNoSearchResults(String result,int length){ if (length>0) { textView.setText(getString(R.string.null_search_result) + " " + '"' + result + '"'); textView.setTextColor(getTextColor()); textView.setVisibility(View.VISIBLE); } else textView.setVisibility(View.GONE); }
Source:
public void activate(OperatorContext context) { scanDirService.scheduleAtFixedRate(new DirectoryScannerThread(), 0, scanIntervalMillis, TimeUnit.MILLISECONDS); }

Target:
public void activate(OperatorContext context) { scanDirService.scheduleWithFixedDelay(new DirectoryScannerTask(), 0, scanIntervalMillis, TimeUnit.MILLISECONDS); }
Source:
private void validate(APIUpdateVmInstanceMsg msg) { new SQLBatch() { @Override protected void scripts() { VmInstanceVO vo = Q.New(VmInstanceVO.class).eq(VmInstanceVO_.uuid, msg.getVmInstanceUuid()).find(); Integer cpuSum = msg.getCpuNum(); Long memorySize = msg.getMemorySize(); if ((cpuSum == null && memorySize == null)) { return; } VmInstanceState vmState = Q.New(VmInstanceVO.class).select(VmInstanceVO_.state).eq(VmInstanceVO_.uuid, msg.getVmInstanceUuid()).findValue(); if (!VmGlobalConfig.NUMA.value(Boolean.class) && !VmInstanceState.Stopped.equals(vmState)) { throw new ApiMessageInterceptionException(argerr( "cannot do cpu or memory update because numa not allowed when vm not in the state of %s", vmState )); } if (!VmInstanceState.Stopped.equals(vo.getState()) && !VmInstanceState.Running.equals(vo.getState())) { throw new OperationFailureException(operr("The state of vm[uuid:%s] is %s. Only these state[%s] is allowed to update cpu or memory.", vo.getUuid(), vo.getState(), StringUtils.join(list(VmInstanceState.Running, VmInstanceState.Stopped), ","))); } if (VmInstanceState.Stopped.equals(vmState)) { return; } if (msg.getCpuNum() != null && msg.getCpuNum() < vo.getCpuNum()) { throw new ApiMessageInterceptionException(argerr( "can't not decrease cpu of vm[:uuid] when it is running", vo.getUuid() )); } if (msg.getMemorySize() != null && msg.getMemorySize() < vo.getMemorySize()) { throw new ApiMessageInterceptionException(argerr( "can't not decrease memory size of vm[:uuid] when it is running", vo.getUuid() )); } } }.execute(); }

Target:
private void validate(APIUpdateVmInstanceMsg msg) { new SQLBatch() { @Override protected void scripts() { VmInstanceVO vo = Q.New(VmInstanceVO.class).eq(VmInstanceVO_.uuid, msg.getVmInstanceUuid()).find(); Integer cpuSum = msg.getCpuNum(); Long memorySize = msg.getMemorySize(); if ((cpuSum == null && memorySize == null)) { return; } VmInstanceState vmState = Q.New(VmInstanceVO.class).select(VmInstanceVO_.state).eq(VmInstanceVO_.uuid, msg.getVmInstanceUuid()).findValue(); if (!VmGlobalConfig.NUMA.value(Boolean.class) && !VmInstanceState.Stopped.equals(vmState)) { throw new ApiMessageInterceptionException(argerr( "the VM cannot do online cpu/memory update because it is not of NUMA architecture. Please stop the VM then do the cpu/memory update again" )); } if (!VmInstanceState.Stopped.equals(vo.getState()) && !VmInstanceState.Running.equals(vo.getState())) { throw new OperationFailureException(operr("The state of vm[uuid:%s] is %s. Only these state[%s] is allowed to update cpu or memory.", vo.getUuid(), vo.getState(), StringUtils.join(list(VmInstanceState.Running, VmInstanceState.Stopped), ","))); } if (VmInstanceState.Stopped.equals(vmState)) { return; } if (msg.getCpuNum() != null && msg.getCpuNum() < vo.getCpuNum()) { throw new ApiMessageInterceptionException(argerr( "can't not decrease cpu of vm[:uuid] when it is running", vo.getUuid() )); } if (msg.getMemorySize() != null && msg.getMemorySize() < vo.getMemorySize()) { throw new ApiMessageInterceptionException(argerr( "can't not decrease memory size of vm[:uuid] when it is running", vo.getUuid() )); } } }.execute(); }
Source:
public static void indexXmlFiles(File collectionDirectory, IndexWriter writer, boolean isElementPath, TaggedValuePointable nodep, ArrayBackedValueStorage abvsFileNode, ITreeNodeIdProvider nodeIdProvider, SequenceBuilder sb, ByteBufferInputStream bbis, DataInputStream di, String nodeId) throws SystemException, IOException { for (File file : collectionDirectory.listFiles()) { if (readableXmlFile(file.getPath())) { abvsFileNode.reset(); IndexDocumentBuilder ibuilder = getIndexBuilder(file, writer, nodep, abvsFileNode, nodeIdProvider, bbis, di, nodeId); ibuilder.printStart(); if (!isMetaFilePresent) { XmlMetadata xmlMetadata = new XmlMetadata(); xmlMetadata.setPath(file.getCanonicalPath()); xmlMetadata.setFileName(file.getName()); try { xmlMetadata.setMd5(metaFileUtil.generateMD5(file)); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } metadataMap.put(file.getCanonicalPath(), xmlMetadata); } } else if (file.isDirectory()) { indexXmlFiles(file, writer, isElementPath, nodep, abvsFileNode, nodeIdProvider, sb, bbis, di, nodeId); } } }

Target:
public static void indexXmlFiles(File collectionDirectory, IndexWriter writer, boolean isElementPath, TaggedValuePointable nodep, ArrayBackedValueStorage abvsFileNode, ITreeNodeIdProvider nodeIdProvider, SequenceBuilder sb, ByteBufferInputStream bbis, DataInputStream di, String nodeId) throws SystemException, IOException { for (File file : collectionDirectory.listFiles()) { if (readableXmlFile(file.getPath())) { abvsFileNode.reset(); IndexDocumentBuilder ibuilder = getIndexBuilder(file, writer, nodep, abvsFileNode, nodeIdProvider, bbis, di, nodeId); ibuilder.printStart(); if (!isMetaFilePresent) { XmlMetadata xmlMetadata = new XmlMetadata(); xmlMetadata.setPath(file.getCanonicalPath()); xmlMetadata.setFileName(file.getName()); try { xmlMetadata.setMd5(metaFileUtil.generateMD5(file)); } catch (NoSuchAlgorithmException e) { throw new SystemException(ErrorCode.SYSE0001, e); } metadataMap.put(file.getCanonicalPath(), xmlMetadata); } } else if (file.isDirectory()) { indexXmlFiles(file, writer, isElementPath, nodep, abvsFileNode, nodeIdProvider, sb, bbis, di, nodeId); } } }
Source:
public void dispose() { fTraceMap.clear(); }

Target:
public void dispose() { fTraceMap.clear(); fTrace = null; }
Source:
public void stopMotor() { for (CustomSpeedController motor : motors) { motor.stopMotor(); } }

Target:
public void stopMotor() { for (SpeedController motor : motors) { motor.stopMotor(); } }
Source:
protected Object removeUnnecessaryInfo(Object entity) { String methodName; Object nullObj = null; for (Method m : entity.getClass().getMethods()) { methodName = m.getName(); if (methodName.startsWith("set") && !methodName.equals("setId") && !methodName.equals("setHref") && !methodName.equals("setLinks")) { try { m.invoke(entity, nullObj); } catch (IllegalAccessException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } catch (IllegalArgumentException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } catch (InvocationTargetException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } } } return entity; }

Target:
protected Object removeUnnecessaryInfo(Object entity) throws InstantiationException, IllegalAccessException, NoSuchMethodException { String methodName; Object newEntity = entity.getClass().newInstance(); for (Method m : newEntity.getClass().getMethods()) { methodName = m.getName(); if (methodName.startsWith("set") && (methodName.equals("setId") || methodName.equals("setHref"))) { try { m.invoke(newEntity, getEntityValue(entity, getCorrespondingGetMethod(methodName))); } catch (IllegalAccessException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } catch (IllegalArgumentException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } catch (InvocationTargetException ex) { LOG.error("Entity Null value assignment failure "+methodName, ex); } } } return entity; }
Source:
public Matrix subi(final Matrix matrix) { if (matrix.isDense()) { throw new UnsupportedOperationException(); } else { ((NumericOps) breezeMatrix).$minus$eq(((CSCMatrix) matrix).breezeMatrix, MatrixOps.SUBI_SS); return this; } }

Target:
public Matrix subi(final Matrix matrix) { if (matrix.isDense()) { ((NumericOps) breezeMatrix).$minus$eq(((DenseMatrix) matrix).getBreezeMatrix(), MatrixOps.SUBI_MM); } else { ((NumericOps) breezeMatrix).$minus$eq(((CSCMatrix) matrix).breezeMatrix, MatrixOps.SUBI_SS); } return this; }
Source:
public void update() { Stock updatedStock = (Stock) subject.getUpdate(); if (m.getStockForSymbol(updatedStock.getSymbol()) == null) { return; } if (history.containsKey(updatedStock.getSymbol())) { List<Double> priceList = history.get(updatedStock.getSymbol()); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } else { List<Double> priceList = new ArrayList<Double>(); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } }

Target:
public void update() { Stock updatedStock = (Stock) subject.getUpdate(); if (m.getStockForSymbol(updatedStock.getSymbol()) == null) { return; } if (history.containsKey(updatedStock.getSymbol())) { List<Double> priceList = history.get(updatedStock.getSymbol()); priceList.add(updatedStock.getPrice()); history.put(updatedStock.getSymbol(), priceList); } else { updateExistingStock(updatedStock); } }
Source:
public void initialise() { UILabel subtitle2 = find("subtitle2", UILabel.class); if (subtitle2 != null) { subtitle2.bindText(new ReadOnlyBinding<String>() { @Override public String get() { if (loadingAsServer) { return "Multiplayer"; } return "Singleplayer"; } }); } final UIList<GameInfo> gameList = find("gameList", UIList.class); refreshList(gameList); gameList.subscribe((widget, item) -> loadGame(item)); WidgetUtil.trySubscribe(this, "create", button -> { CreateGameScreen createGameScreen = getManager().pushScreen("engine:createGameScreen", CreateGameScreen.class); createGameScreen.setLoadingAsServer(loadingAsServer); }); WidgetUtil.trySubscribe(this, "load", button -> { GameInfo gameInfo = gameList.getSelection(); if (gameInfo != null) { loadGame(gameInfo); } }); WidgetUtil.trySubscribe(this, "delete", button -> { GameInfo gameInfo = gameList.getSelection(); if (gameInfo != null) { Path world = PathManager.getInstance().getSavePath(gameInfo.getManifest().getTitle()); try { FilesUtil.recursiveDelete(world); gameList.getList().remove(gameInfo); gameList.setSelection(null); } catch (Exception e) { logger.error("Failed to delete saved game", e); getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error Deleting Game", e.getMessage()); } } }); WidgetUtil.trySubscribe(this, "close", button -> getManager().popScreen()); }

Target:
public void initialise() { UILabel gameTypeTitle = find("gameTypeTitle", UILabel.class); if (gameTypeTitle != null) { gameTypeTitle.bindText(new ReadOnlyBinding<String>() { @Override public String get() { if (loadingAsServer) { return translationSystem.translate("${engine:menu#select-multiplayer-game-sub-title}"); } else { return translationSystem.translate("${engine:menu#select-singleplayer-game-sub-title}"); } } }); } final UIList<GameInfo> gameList = find("gameList", UIList.class); refreshList(gameList); gameList.subscribe((widget, item) -> loadGame(item)); WidgetUtil.trySubscribe(this, "create", button -> { CreateGameScreen createGameScreen = getManager().pushScreen("engine:createGameScreen", CreateGameScreen.class); createGameScreen.setLoadingAsServer(loadingAsServer); }); WidgetUtil.trySubscribe(this, "load", button -> { GameInfo gameInfo = gameList.getSelection(); if (gameInfo != null) { loadGame(gameInfo); } }); WidgetUtil.trySubscribe(this, "delete", button -> { GameInfo gameInfo = gameList.getSelection(); if (gameInfo != null) { Path world = PathManager.getInstance().getSavePath(gameInfo.getManifest().getTitle()); try { FilesUtil.recursiveDelete(world); gameList.getList().remove(gameInfo); gameList.setSelection(null); } catch (Exception e) { logger.error("Failed to delete saved game", e); getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class).setMessage("Error Deleting Game", e.getMessage()); } } }); WidgetUtil.trySubscribe(this, "close", button -> getManager().popScreen()); }
Source:
protected static void updateCompactionMetrics(ShowCompactResponse showCompactResponse) { Map<String, ShowCompactResponseElement> lastElements = new HashMap<>(); for(ShowCompactResponseElement element : showCompactResponse.getCompacts()) { String key = element.getDbname() + "/" + element.getTablename() + "/" + element.getPartitionname(); lastElements.compute(key, (k, old) -> (old == null) ? element : (element.getId() > old.getId() ? element : old)); } Map<String, Long> counts = lastElements.values().stream() .collect(Collectors.groupingBy(e -> e.getState(), Collectors.counting())); for (int i = 0; i < TxnStore.COMPACTION_STATES.length; ++i) { String key = MetricsConstants.COMPACTION_STATUS_PREFIX + TxnStore.COMPACTION_STATES[i]; Long count = counts.get(TxnStore.COMPACTION_STATES[i]); if (count != null) { Metrics.getOrCreateGauge(key).set(count.intValue()); } else { Metrics.getOrCreateGauge(key).set(0); } } }

Target:
protected static void updateCompactionMetrics(ShowCompactResponse showCompactResponse) { Map<String, ShowCompactResponseElement> lastElements = new HashMap<>(); for(ShowCompactResponseElement element : showCompactResponse.getCompacts()) { String key = element.getDbname() + "/" + element.getTablename() + (element.getPartitionname() != null ? "/" + element.getPartitionname() : ""); lastElements.compute(key, (k, old) -> (old == null) ? element : (element.getId() > old.getId() ? element : old)); } Map<String, Long> counts = lastElements.values().stream() .collect(Collectors.groupingBy(e -> e.getState(), Collectors.counting())); for (int i = 0; i < TxnStore.COMPACTION_STATES.length; ++i) { String key = MetricsConstants.COMPACTION_STATUS_PREFIX + TxnStore.COMPACTION_STATES[i]; Long count = counts.get(TxnStore.COMPACTION_STATES[i]); if (count != null) { Metrics.getOrCreateGauge(key).set(count.intValue()); } else { Metrics.getOrCreateGauge(key).set(0); } } }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: System.out.println("[jls] this was unexpected"); this.onBackPressed(); return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { this.onBackPressed(); return true; } return super.onOptionsItemSelected(item); }
Source:
private Map<String, List<String>> computeLiveDocumentRefsToRenditionRefs() { Map<String, List<String>> liveDocumentRefsToRenditionRefs = new HashMap<>(); String query = String.format( "SELECT ecm:uuid, %s, %s FROM Document WHERE %s IS NOT NULL AND ecm:isVersion = 0", RENDITION_SOURCE_ID_PROPERTY, RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY, RENDITION_SOURCE_ID_PROPERTY); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> res : result) { String renditionRef = res.get("ecm:uuid").toString(); String sourceId = res.get(RENDITION_SOURCE_ID_PROPERTY).toString(); Serializable sourceVersionableId = res.get(RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY); String key = sourceVersionableId != null ? sourceVersionableId.toString() : sourceId; List<String> renditionRefs = liveDocumentRefsToRenditionRefs.get(key); if (renditionRefs == null) { renditionRefs = new ArrayList<>(); liveDocumentRefsToRenditionRefs.put(key, renditionRefs); } renditionRefs.add(renditionRef); } } return liveDocumentRefsToRenditionRefs; }

Target:
private Map<String, List<String>> computeLiveDocumentRefsToRenditionRefs() { Map<String, List<String>> liveDocumentRefsToRenditionRefs = new HashMap<>(); String query = String.format("SELECT %s, %s, %s FROM Document WHERE %s IS NOT NULL AND ecm:isVersion = 0", NXQL.ECM_UUID, RENDITION_SOURCE_ID_PROPERTY, RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY, RENDITION_SOURCE_ID_PROPERTY); try (IterableQueryResult result = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> res : result) { String renditionRef = res.get(NXQL.ECM_UUID).toString(); String sourceId = res.get(RENDITION_SOURCE_ID_PROPERTY).toString(); Serializable sourceVersionableId = res.get(RENDITION_SOURCE_VERSIONABLE_ID_PROPERTY); String key = sourceVersionableId != null ? sourceVersionableId.toString() : sourceId; liveDocumentRefsToRenditionRefs.computeIfAbsent(key, k -> new ArrayList<>()).add(renditionRef); } } return liveDocumentRefsToRenditionRefs; }
Source:
public IEntityGroup find(String name) throws GroupsException { List<IPersonAttributesGroupDefinition> groups = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(name); IPersonAttributesGroupDefinition pagsGroup = groups.get(0); GroupDefinition groupDef = initGroupDef(pagsGroup); IEntityGroup group = new EntityTestingGroupImpl(groupDef.getKey(), IPERSON_CLASS); group.setName(groupDef.getName()); group.setDescription(groupDef.getDescription()); return group; }

Target:
public IEntityGroup find(String name) throws GroupsException { Set<IPersonAttributesGroupDefinition> groups = personAttributesGroupDefinitionDao.getPersonAttributesGroupDefinitionByName(name); IPersonAttributesGroupDefinition pagsGroup = groups.iterator().next(); GroupDefinition groupDef = initGroupDef(pagsGroup); IEntityGroup group = new EntityTestingGroupImpl(groupDef.getKey(), IPERSON_CLASS); group.setName(groupDef.getName()); group.setDescription(groupDef.getDescription()); return group; }
Source:
public void setBeanResolver(BeanResolver beanResolver) { this.beanResolver = beanResolver; }

Target:
public void setBeanResolver(BeanResolver beanResolver) { Assert.notNull(beanResolver, "beanResolver cannot be null"); this.beanResolver = beanResolver; }
Source:
public void waitingForShards() throws IOException{ try (ElasticsearchContainer container = new ElasticsearchContainer(new ImageFromDockerfile() .withFileFromClasspath("data.zip", "elasticsearch-preload/data.zip") .withFileFromClasspath("Dockerfile", "elasticsearch-preload/Dockerfile") ).waitingForShards()) { container.start(); Response response = getClient(container).performRequest(new Request("GET", "/_cat/shards")); assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(EntityUtils.toString(response.getEntity()), containsString("STARTED")); } }

Target:
public void waitingForShards() throws IOException{ try (ElasticsearchContainer container = new ElasticsearchContainer() .withClasspathResourceMapping("elasticsearch-preload/6.4.1/data", "/usr/share/elasticsearch/data", BindMode.READ_WRITE) .waitingForShards() ) { container.start(); Response response = getClient(container).performRequest(new Request("GET", "/index/_doc/1")); assertThat(response.getStatusLine().getStatusCode(), is(200)); assertThat(EntityUtils.toString(response.getEntity()), containsString("testcontainer")); } }
Source:
public void install() { LOG.info("Installing Node.JS {}", getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION)); List<String> commands = MutableList.<String>builder() .add(BashCommands.INSTALL_CURL) .add(BashCommands.ifExecutableElse0("apt-get", BashCommands.chain( BashCommands.installPackage("software-properties-common python-software-properties python g++ make"), BashCommands.sudo("add-apt-repository ppa:chris-lea/node.js")))) .add(BashCommands.installPackage(MutableMap.of("yum", "git nodejs npm", "apt", "git-core nodejs"), null)) .add("npm install n") .add(BashCommands.sudo("npm install -g n")) .add(BashCommands.sudo("n " + getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION))) .build(); newScript(INSTALLING) .body.append(commands) .execute(); }

Target:
public void install() { LOG.info("Installing Node.JS {}", getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION)); List<String> commands = MutableList.<String>builder() .add(BashCommands.INSTALL_CURL) .add(BashCommands.ifExecutableElse0("apt-get", BashCommands.chain( BashCommands.installPackage("software-properties-common python-software-properties python g++ make"), BashCommands.sudo("add-apt-repository ppa:chris-lea/node.js")))) .add(BashCommands.installPackage(MutableMap.of("yum", "git nodejs npm", "apt", "git-core nodejs"), null)) .add("mkdir \"$HOME/.npm\"") .add(BashCommands.sudo("npm install -g n")) .add(BashCommands.sudo("n " + getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION))) .build(); newScript(INSTALLING) .body.append(commands) .execute(); }
Source:
public static Config parse(Map<String, Object> opts) { int cacheSize = (int)(opts.containsKey("--sequencer-cache-size") ? Long.parseLong((String) opts.get("--sequencer-cache-size")) : DEFAULT_CACHE_SIZE); return Config.builder() .cacheSize(cacheSize) .build(); }

Target:
public static Config parse(Map<String, Object> opts) { int cacheSize = (int)(opts.containsKey("--sequencer-cache-size") ? Integer.parseInt((String)opts.get("--sequencer-cache-size")) : DEFAULT_CACHE_SIZE); return Config.builder() .cacheSize(cacheSize) .build(); }
Source:
public static void createSecureConfiguration(Properties properties, AuthenticationMethod authType) { switch (authType) { case KERBEROS: Configuration conf = new org.apache.hadoop.conf.Configuration(); conf.set("hadoop.security.authentication", KERBEROS.toString()); UserGroupInformation.setConfiguration(conf); try { if (!UserGroupInformation.isSecurityEnabled() || UserGroupInformation.getCurrentUser().getAuthenticationMethod() != KERBEROS || !UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.loginUserFromKeytab( properties.getProperty("zeppelin.jdbc.principal"), properties.getProperty("zeppelin.jdbc.keytab.location")); } } catch (IOException e) { LOGGER.error("Failed to get either keytab location or principal name in the " + "interpreter", e); } } }

Target:
public static void createSecureConfiguration(Properties properties, AuthenticationMethod authType) { switch (authType) { case KERBEROS: Configuration conf = new org.apache.hadoop.conf.Configuration(); conf.set("hadoop.security.authentication", KERBEROS.toString()); UserGroupInformation.setConfiguration(conf); try { if (!UserGroupInformation.isSecurityEnabled() || UserGroupInformation.getCurrentUser().getAuthenticationMethod() != KERBEROS || !UserGroupInformation.isLoginKeytabBased()) { UserGroupInformation.loginUserFromKeytab( properties.getProperty("zeppelin.jdbc.principal"), properties.getProperty("zeppelin.jdbc.keytab.location")); } else { LOGGER.info("The user has already logged in using Keytab and principal, " + "no action required"); } } catch (IOException e) { LOGGER.error("Failed to get either keytab location or principal name in the " + "interpreter", e); } } }
Source:
public CompositeBiJoiner(List<SingleBiJoiner<A, B>> joinerList) { this.joinerList = joinerList; if (joinerList.isEmpty()) { throw new IllegalArgumentException("The joinerList (" + joinerList + ") must not be empty."); } }

Target:
public CompositeBiJoiner(List<SingleBiJoiner<A, B>> joinerList) { if (joinerList.isEmpty()) { throw new IllegalArgumentException("The joinerList (" + joinerList + ") must not be empty."); } this.joinerList = joinerList; }
Source:
public void testValidatesOtherStrandNotLonger() throws IllegalArgumentException { thrown.expect(IllegalArgumentException.class); Hamming.compute("AAA", "AAAG"); }

Target:
public void testValidatesOtherStrandNotLonger() { thrown.expect(IllegalArgumentException.class); Hamming.compute("AAA", "AAAG"); }
Source:
private ConditionalModule(Class<T> config, Predicate<T> predicate, Module module) { this.config = config; this.predicate = predicate; this.module = module; }

Target:
private ConditionalModule(Class<T> config, Predicate<T> predicate, Module module) { this.config = requireNonNull(config, "config is null"); this.predicate = requireNonNull(predicate, "predicate is null"); this.module = requireNonNull(module, "module is null"); }
Source:
InputStream getAssetFile() throws IOException { if (contextWeakRef != null) { Context context = contextWeakRef.get(); if (context != null) { return context.getAssets().open(assetFilePath); } } return null; }

Target:
InputStream getAssetFile() throws IOException { Context context = contextWeakRef.get(); if (context != null) { return context.getAssets().open(assetFilePath); } else { throw new IllegalArgumentException("Context should not be null. Use Application Context instead of Activity Context."); } }
Source:
default B with(int data) { return with( ByteBuffer.allocate(Integer.BYTES).putInt( data ).array()); }

Target:
default B with(int data) { return with(new byte[]{(byte) (data ), (byte) (data >> 8), (byte) (data >> 16), (byte) (data >> 24)}); }
Source:
public static DesignDocument fromFile(File file) { assertNotEmpty(file, "Design js file"); DesignDocument dd = new DesignDocument(); Gson gson = new Gson(); try { String contents = readURL(file.toURI().toURL()); dd = gson.fromJson(contents, DesignDocument.class); } catch (MalformedURLException e) { e.printStackTrace(); } return dd; }

Target:
public static DesignDocument fromFile(File file) throws FileNotFoundException { assertNotEmpty(file, "Design js file"); DesignDocument designDocument; Gson gson = new Gson(); designDocument = gson.fromJson(new FileReader(file), DesignDocument.class); return designDocument; }
Source:
private void fetchPerTestData(RootNode controlTree) { testIdToPlotsMap = new HashMap<Long, MetricPlotDTOs>(); Set<MetricNode> allMetrics = new HashSet<MetricNode>(); DetailsNode detailsNode = controlTree.getDetailsNode(); if (detailsNode.getChildren().isEmpty()) return; for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { allMetrics.addAll(testDetailsNode.getMetrics()); } try { Map<MetricNode, PlotIntegratedDto> dataMap = databaseService.getPlotDataByMetricNode(allMetrics); for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { getDetailsPlotsReport(testDetailsNode, testDetailsNode.getTaskDataDto().getId(), dataMap); } } catch (Exception e) { log.error("Unable to get plots information for metrics"); } }

Target:
private void fetchPerTestData(RootNode controlTree) { Set<MetricNode> allMetrics = new HashSet<MetricNode>(); DetailsNode detailsNode = controlTree.getDetailsNode(); if (detailsNode.getTests().isEmpty()) return; for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { allMetrics.addAll(testDetailsNode.getMetrics()); } try { Map<MetricNode, PlotIntegratedDto> dataMap = databaseService.getPlotDataByMetricNode(allMetrics); for (TestDetailsNode testDetailsNode : detailsNode.getTests()) { TaskDataDto taskDataDto = testDetailsNode.getTaskDataDto(); getPlotsReport( dataMap, testDetailsNode, new PerTestReportPlotHelper(taskDataDto.getId(), taskDataDto.getTaskName()) ); } } catch (Exception e) { log.error("Unable to get metrics plots information for session " + this.sessionId, e); } }