auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void fetchRemoteData() { fetchCategories(); WordPress.getRestClientUtils().getGeneralSettings( mSite.getSiteId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { AppLog.d(AppLog.T.API, "Received response to Settings REST request."); credentialsVerified(true); mRemoteSettings.localTableId = mSite.getId(); deserializeDotComRestResponse(mSite, response); if (!mRemoteSettings.equals(mSettings)) { final Map<String, String> currentPostFormats = mSettings.postFormats; boolean location = mSettings.location; <START> boolean optimizeImaged = mSettings.optimizedImage; <END> mSettings.copyFrom(mRemoteSettings); mSettings.postFormats = currentPostFormats; mSettings.location = location; mSettings.optimizedImage = optimizeImaged; SiteSettingsTable.saveSettings(mSettings); notifyUpdatedOnUiThread(null); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error response to Settings REST request: " + error); notifyUpdatedOnUiThread(error); } }); }</code><technical_language>is a small typo in optimizeImaged</technical_language>

Target:
protected void fetchRemoteData() { fetchCategories(); WordPress.getRestClientUtils().getGeneralSettings( mSite.getSiteId(), new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { AppLog.d(AppLog.T.API, "Received response to Settings REST request."); credentialsVerified(true); mRemoteSettings.localTableId = mSite.getId(); deserializeDotComRestResponse(mSite, response); if (!mRemoteSettings.equals(mSettings)) { final Map<String, String> currentPostFormats = mSettings.postFormats; boolean location = mSettings.location; boolean optimizedImage = mSettings.optimizedImage; mSettings.copyFrom(mRemoteSettings); mSettings.postFormats = currentPostFormats; mSettings.location = location; mSettings.optimizedImage = optimizedImage; SiteSettingsTable.saveSettings(mSettings); notifyUpdatedOnUiThread(null); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { AppLog.w(AppLog.T.API, "Error response to Settings REST request: " + error); notifyUpdatedOnUiThread(error); } }); }
Source:
<code>public void onReceive(Context context, Intent data) { DataHandler dh = KissApplication.getDataHandler(context); ShortcutProvider sp = dh.getShortcutProvider(); if (sp == null) return; String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); Log.d("onReceive", "Received shortcut " + name); if (sp.findByName(name) != null || dh.getContactProvider().findByName(name) != null || dh.getAppProvider().findByName(name) != null ) { Log.d("onReceive", "Duplicated shortcut " + name + ", ignoring"); return; } Intent target = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); if (target.getAction() == null) { target.setAction(Intent.ACTION_VIEW); } ShortcutPojo pojo = createPojo(name); pojo.intentUri = target.toUri(0); Bitmap icon = (Bitmap) data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON); if (icon != null) { Log.d("onReceive", "Shortcut " + name + " has embedded icon"); pojo.icon = icon; } else { ShortcutIconResource sir = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE); if (sir != null) { Log.d("onReceive", "Received icon package name " + sir.packageName); Log.d("onReceive", "Received icon resource name " + sir.resourceName); pojo.packageName = sir.packageName; pojo.resourceName = sir.resourceName; } else { Log.d("onReceive", "Invalid shortcut " + name + ", ignoring"); return; } } <START> dh.addShortcut(pojo); <END> }</code><technical_language>Hum, I understand this Shortcut Provider? put DataHandler</technical_language>

Target:
public void onReceive(Context context, Intent data) { DataHandler dh = KissApplication.getDataHandler(context); ShortcutsProvider sp = dh.getShortcutsProvider(); if (sp == null) return; String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); Log.d("onReceive", "Received shortcut " + name); if (sp != null && sp.findByName(name) != null || dh.getContactsProvider().findByName(name) != null || dh.getAppProvider().findByName(name) != null ) { Log.d("onReceive", "Duplicated shortcut " + name + ", ignoring"); return; } Intent target = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); if (target.getAction() == null) { target.setAction(Intent.ACTION_VIEW); } ShortcutsPojo pojo = createPojo(name); pojo.intentUri = target.toUri(0); Bitmap icon = (Bitmap) data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON); if (icon != null) { Log.d("onReceive", "Shortcut " + name + " has embedded icon"); pojo.icon = icon; } else { ShortcutIconResource sir = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE); if (sir != null) { Log.d("onReceive", "Received icon package name " + sir.packageName); Log.d("onReceive", "Received icon resource name " + sir.resourceName); pojo.packageName = sir.packageName; pojo.resourceName = sir.resourceName; } else { Log.d("onReceive", "Invalid shortcut " + name + ", ignoring"); return; } } dh.addShortcut(pojo); }
Source:
<code>public void sendsHttpRequestAndProcessesHttpBinaryResponse() throws Exception { new FakeRequest() .withStatus(HttpURLConnection.HTTP_OK) .withReason(REASON_OK) .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN) <START> .withBody(BODY_HOW_ARE_YOU.getBytes()) <END> .uri().path(PATH_HELLO_ALL).back() .method(Request.POST) .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertHeader(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN) .assertBinary(Matchers.equalTo(BODY_HOW_ARE_YOU.getBytes())); }</code><technical_language>@antonini if lines in other test case extract method more DRY</technical_language>

Target:
public void sendsHttpRequestAndProcessesHttpBinaryResponse() throws Exception { final byte[] content = "Binary body content".getBytes(); this.generateMainRequest() .withBody(content) .uri().path("/binContent").back() .method(Request.POST) .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertHeader(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_PLAIN) .assertBinary(Matchers.equalTo(content)); }
Source:
<code>protected void clearContent() { <START> fXYPresentationProvider.clear(); <END> getSwtChart().getAxisSet().getXAxis(0).getTick().setFormat(null); super.clearContent(); }</code><technical_language>order of colors is changed content is changed (e.g. checking/unchecking a counter)</technical_language>

Target:
protected void clearContent() { getSwtChart().getAxisSet().getXAxis(0).getTick().setFormat(null); super.clearContent(); }
Source:
<code>public boolean isProcessable(final long wallClockTime) { if (state() == State.CLOSED || state() == State.CLOSING) { <START> log.info("Stream task is already in state, skip adding records to it.", id(), state()); <END> return false; } if (partitionGroup.allPartitionsBuffered()) { idleStartTime = RecordQueue.UNKNOWN; return true; } else if (partitionGroup.numBuffered() > 0) { if (idleStartTime == RecordQueue.UNKNOWN) { idleStartTime = wallClockTime; } if (wallClockTime - idleStartTime >= maxTaskIdleMs) { enforcedProcessingSensor.record(); return true; } else { return false; } } else { idleStartTime = RecordQueue.UNKNOWN; return false; } }</code><technical_language>Is this meant? suggestion log.info("Stream task is in state, skip processing it.", id(), state());</technical_language>

Target:
public boolean isProcessable(final long wallClockTime) { if (state() == State.CLOSED || state() == State.CLOSING) { log.info("Stream task is already in state, skip processing it.", id(), state()); return false; } if (partitionGroup.allPartitionsBuffered()) { idleStartTime = RecordQueue.UNKNOWN; return true; } else if (partitionGroup.numBuffered() > 0) { if (idleStartTime == RecordQueue.UNKNOWN) { idleStartTime = wallClockTime; } if (wallClockTime - idleStartTime >= maxTaskIdleMs) { enforcedProcessingSensor.record(); return true; } else { return false; } } else { idleStartTime = RecordQueue.UNKNOWN; return false; } }
Source:
<code>public T setTosAndPrivacyPolicyUrls(@NonNull String tosUrl, <START> @NonNull String privacyPolicyUrl) { <END> mTosUrl = tosUrl; mPrivacyPolicyUrl = privacyPolicyUrl; return (T) this; }</code><technical_language>add a Preconditions check in check non-null-ness @NonNull is IDE hint</technical_language>

Target:
public T setTosAndPrivacyPolicyUrls(@NonNull String tosUrl, @NonNull String privacyPolicyUrl) { Preconditions.checkNotNull(tosUrl, "tosUrl cannot be null"); Preconditions.checkNotNull(privacyPolicyUrl, "privacyPolicyUrl cannot be null"); mTosUrl = tosUrl; mPrivacyPolicyUrl = privacyPolicyUrl; return (T) this; }
Source:
<code>public long nextRowGroupSize(long outPos) { if (maxPaddingSize <= 0) { return rowGroupSize; } long remaining = dfsBlockSize - (outPos % dfsBlockSize); if (isPaddingNeeded(remaining)) { remaining = dfsBlockSize; } if (rowGroupSize < remaining - maxPaddingSize) { <START> return rowGroupSize - maxPaddingSize/2; <END> } else { return remaining - maxPaddingSize/2; } }</code><technical_language>I think, correction maxPaddingSize/2 is required here</technical_language>

Target:
public long nextRowGroupSize(long outPos) { if (maxPaddingSize <= 0) { return rowGroupSize; } long remaining = dfsBlockSize - (outPos % dfsBlockSize); if (isPaddingNeeded(remaining)) { remaining = dfsBlockSize; } if (rowGroupSize < remaining - maxPaddingSize) { return rowGroupSize; } else { return remaining - maxPaddingSize/2; } }
Source:
<code>public Map<String, String[]> getParameterMap() { if (body == null) { return super.getParameterMap(); } Map<String, String[]> params = new HashMap<>(); if (RequestMethod.POST.name().equals(getMethod()) || RequestMethod.PUT.name().equals(getMethod())) { <START> if (getContentType() != null && getContentType().contains("application/x-www-form-urlencoded")) { <END> fillParams(params, new String(body, Charset.forName(Citrus.CITRUS_FILE_ENCODING))); } else { return super.getParameterMap(); } } else { fillParams(params, getQueryString()); } return params; }</code><technical_language>contains() is insufficient for check. This allow foo-application/x-www-form-urlencoded-bar. getContentType().startsWith("application/x-www-form-urlencoded") here</technical_language>

Target:
public Map<String, String[]> getParameterMap() { if (body == null) { return super.getParameterMap(); } Map<String, String[]> params = new HashMap<>(); if (RequestMethod.POST.name().equals(getMethod()) || RequestMethod.PUT.name().equals(getMethod())) { if (getContentType() != null && getContentType().startsWith("application/x-www-form-urlencoded")) { fillParams(params, new String(body, Charset.forName(Citrus.CITRUS_FILE_ENCODING))); } else { return super.getParameterMap(); } } else { fillParams(params, getQueryString()); } return params; }
Source:
<code>public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, List<String> messages) { if (vm.isHostedEngine()) { List<VDS> hostsToRunOn = new ArrayList<VDS>(); for (VDS host : hosts) { <START> int haScore = host.getDynamicData().getHighlyAvailableScore(); <END> if (haScore > 0) { hostsToRunOn.add(host); log.debugFormat("Host {0} wasn't filtered out as it has a score of {1}", host.getName(), haScore); } else { log.debugFormat("Host {0} was filtered out as it doesn't have a positive score (the score is {1})", host.getName(), haScore); } } if (hostsToRunOn.isEmpty()) { messages.add(VdcBllMessages.ACTION_TYPE_FAILED_NO_HA_VDS.name()); } return hostsToRunOn; } else { return hosts; } }</code><technical_language>host.getHighlyAvailableScore()</technical_language>

Target:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, List<String> messages) { if (vm.isHostedEngine()) { List<VDS> hostsToRunOn = new ArrayList<VDS>(); for (VDS host : hosts) { int haScore = host.getHighlyAvailableScore(); if (haScore > 0) { hostsToRunOn.add(host); log.debugFormat("Host {0} wasn't filtered out as it has a score of {1}", host.getName(), haScore); } else { log.debugFormat("Host {0} was filtered out as it doesn't have a positive score (the score is {1})", host.getName(), haScore); } } if (hostsToRunOn.isEmpty()) { messages.add(VdcBllMessages.ACTION_TYPE_FAILED_NO_HA_VDS.name()); } return hostsToRunOn; } else { return hosts; } }
Source:
<code>private void updateFavorites() { ObservableList<SelectableResource> lst = FXCollections.observableArrayList(); if (ps.getMetadata() != null) { lst.addAll(ps.getMetadata().getAvailableTypes() .stream() .map(r -> new SelectableResource(r, null)) .collect(Collectors.toList())); } lst.forEach(sr -> sr.selectedProperty().addListener( (p, o, n) -> cs.getSelectedTypes().setAll( favoritesList.getItems() .filtered(SelectableResource::getSelected))) ); <START> favoritesList.setItems(lst); <END> }</code><technical_language>If create observable list in constructor set items of list view in initialize() method completely testable UI framework</technical_language>

Target:
private void updateFavorites() { if (ps.getMetadata() != null) { items.setAll(ps.getMetadata().getAvailableTypes() .stream() .map(r -> new ResourceAdapter(r, null)) .collect(Collectors.toList())); } }
Source:
<code>public Object postProcess(Object bean, String beanName, Method method, List<Annotation> annotations) { String channelName = MessagingAnnotationUtils.resolveAttribute(annotations, AnnotationUtils.VALUE, String.class); Assert.hasText(channelName, "The channel ('value' attribute of @InboundChannelAdapter) can't be empty."); MessageSource<?> messageSource = null; try { messageSource = createMessageSource(bean, beanName, method); } catch (NoSuchBeanDefinitionException e) { if (this.logger.isDebugEnabled()) { this.logger.debug("Skipping endpoint creation; " + e.getMessage() + "; perhaps due to some '@Conditional' annotation."); } return null; } MessageChannel channel; try { channel = this.channelResolver.resolveDestination(channelName); } catch (DestinationResolutionException e) { channel = new DirectChannel(); this.beanFactory.registerSingleton(channelName, channel); channel = (MessageChannel) this.beanFactory.initializeBean(channel, channelName); } <START> Assert.notNull(channel, "failed to resolve channel '" + channelName + "'"); <END> SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); adapter.setOutputChannel(channel); adapter.setSource(messageSource); configurePollingEndpoint(adapter, annotations); return adapter; }</code><technical_language>I if inject channel name SPCA resolve runtime. "yet-to-be-declared" channel a DirectChannel. Thoughts</technical_language>

Target:
public Object postProcess(Object bean, String beanName, Method method, List<Annotation> annotations) { String channelName = MessagingAnnotationUtils.resolveAttribute(annotations, AnnotationUtils.VALUE, String.class); Assert.hasText(channelName, "The channel ('value' attribute of @InboundChannelAdapter) can't be empty."); MessageSource<?> messageSource = null; try { messageSource = createMessageSource(bean, beanName, method); } catch (NoSuchBeanDefinitionException e) { if (this.logger.isDebugEnabled()) { this.logger.debug("Skipping endpoint creation; " + e.getMessage() + "; perhaps due to some '@Conditional' annotation."); } return null; } SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); adapter.setOutputChannelName(channelName); adapter.setSource(messageSource); configurePollingEndpoint(adapter, annotations); return adapter; }
Source:
<code>public static Deserializer getDeserializer(Configuration configuration, Properties schema) { String name = getDeserializerClassName(schema); Deserializer deserializer = createDeserializer(getDeserializerClass(name)); <START> configuration = copy(configuration); END> initializeDeserializer(configuration, deserializer, schema); return deserializer; }</code><technical_language>why</technical_language>

Target:
public static Deserializer getDeserializer(Configuration configuration, Properties schema) { String name = getDeserializerClassName(schema); Deserializer deserializer = createDeserializer(getDeserializerClass(name)); initializeDeserializer(configuration, deserializer, schema); return deserializer; }
Source:
<code>protected AbstractDownlinkRequest(LwM2mPath path) { <START> if (path == null){ <END> throw new InvalidRequestException("path is mandatory"); } if (path.isRoot()) { throw new InvalidRequestException("downlink request cannot target root path: " + path.toString()); } if (path.isResourceInstance()) { throw new InvalidRequestException( "downlink request cannot target resource instance path: " + path.toString()); } this.path = path; }</code><technical_language>Bad format. remove brackets ;)</technical_language>

Target:
protected AbstractDownlinkRequest(LwM2mPath path) { if (path == null) throw new InvalidRequestException("path is mandatory"); if (path.isRoot()) throw new InvalidRequestException("downlink request cannot target root path: " + path.toString()); if (path.isResourceInstance()) throw new InvalidRequestException( "downlink request cannot target resource instance path: " + path.toString()); this.path = path; }
Source:
<code>public String extractClusterManagerAddress(Stack stack) { if (stack.getLoadBalancers() != null && stack.getLoadBalancers().size() != 0) { return (stack.getLoadBalancers().stream() .filter(lb -> lb.getType() == LoadBalancerType.PUBLIC).findAny() <START> .orElse(stack.getLoadBalancers().iterator().next())) <END> .getFqdn(); } String fqdn = stack.getFqdn(); if (fqdn != null) { return fqdn; } String clusterManagerIp = stack.getClusterManagerIp(); if (clusterManagerIp != null) { return clusterManagerIp; } return extractClusterManagerIp(stack.getId()); }</code><technical_language>note indentation here. this code other code block, worth pulling out a common method. putting in Stack, call stack.getLoadBalancerUserFacingFQDN()</technical_language>

Target:
public String extractClusterManagerAddress(Stack stack) { String fqdn = loadBalancerConfigService.getLoadBalancerUserFacingFQDN(stack.getId()); fqdn = isEmpty(fqdn) ? stack.getFqdn() : fqdn; if (isNotEmpty(fqdn)) { return fqdn; } String clusterManagerIp = stack.getClusterManagerIp(); if (isNotEmpty(clusterManagerIp)) { return clusterManagerIp; } return extractClusterManagerIp(stack.getId()); }
Source:
<code>private GcsStorageService googleCloudStorageService( Storage storage, String dataFilename, GcsProperties gcsProperties) { <START> GcsStorageService service; <END> ExecutorService executor = Executors.newCachedThreadPool( new ThreadFactoryBuilder() .setNameFormat(GcsStorageService.class.getName() + "-%s") .build()); service = new GcsStorageService( storage, gcsProperties.getBucket(), gcsProperties.getBucketLocation(), gcsProperties.getRootFolder(), dataFilename, new ObjectMapper(), executor); service.ensureBucketExists(); log.info( "Using Google Cloud Storage bucket={} in project={}", value("bucket", gcsProperties.getBucket()), value("project", gcsProperties.getProject())); log.info( "Bucket versioning is {}.", value("versioning", service.supportsVersioning() ? "enabled" : "DISABLED")); return service; }</code><technical_language>reason declare this time of initialization a lines below</technical_language>

Target:
private GcsStorageService googleCloudStorageService( Storage storage, String dataFilename, GcsProperties gcsProperties) { ExecutorService executor = Executors.newCachedThreadPool( new ThreadFactoryBuilder() .setNameFormat(GcsStorageService.class.getName() + "-%s") .build()); GcsStorageService service = new GcsStorageService( storage, gcsProperties.getBucket(), gcsProperties.getBucketLocation(), gcsProperties.getRootFolder(), dataFilename, new ObjectMapper(), executor); log.info( "Using Google Cloud Storage bucket={} in project={}", value("bucket", gcsProperties.getBucket()), value("project", gcsProperties.getProject())); return service; }
Source:
<code>private String lookupVolume(String volumeIdOrName) { <START> if(! Utils.isEmptyOrWhitespaces(volumeIdOrName)) { <END> DescribeVolumesRequest dvs = new DescribeVolumesRequest(Collections.singletonList(volumeIdOrName)); DescribeVolumesResult dvsresult = null; try { dvsresult = this.ec2Api.describeVolumes(dvs); } catch(Exception e) { dvsresult = null; } if(dvsresult == null || dvsresult.getVolumes() == null || dvsresult.getVolumes().size() < 1) { dvs = new DescribeVolumesRequest().withFilters(new Filter().withName("tag:Name").withValues(volumeIdOrName)); try { dvsresult = this.ec2Api.describeVolumes(dvs); } catch(Exception e) { dvsresult = null; } } if(dvsresult == null || dvsresult.getVolumes() == null || dvsresult.getVolumes().size() < 1) return null; else return dvsresult.getVolumes().get(0).getVolumeId(); } return null; }</code><technical_language>Refactor class a single return statement. If debug this function (in Eclipse else), more easier</technical_language>

Target:
private String lookupVolume(String volumeIdOrName) { String ret = null; if(! Utils.isEmptyOrWhitespaces(volumeIdOrName)) { DescribeVolumesRequest dvs = new DescribeVolumesRequest(Collections.singletonList(volumeIdOrName)); DescribeVolumesResult dvsresult = null; try { dvsresult = this.ec2Api.describeVolumes(dvs); } catch(Exception e) { dvsresult = null; } if(dvsresult == null || dvsresult.getVolumes() == null || dvsresult.getVolumes().size() < 1) { dvs = new DescribeVolumesRequest().withFilters(new Filter().withName("tag:Name").withValues(volumeIdOrName)); try { dvsresult = this.ec2Api.describeVolumes(dvs); } catch(Exception e) { dvsresult = null; } } if(dvsresult != null && dvsresult.getVolumes() != null && dvsresult.getVolumes().size() > 0) ret = dvsresult.getVolumes().get(0).getVolumeId(); } return ret; }
Source:
<code>void save(@RequestParam(value = "version", required = false) String version, @RequestBody PipelineTemplate pipelineTemplate) { <START> String templateId = StringUtils.isNotEmpty(version) ? String.format("%s:%s", pipelineTemplate.getId(), version) : pipelineTemplate.getId(); <END> checkForDuplicatePipelineTemplate(templateId); getPipelineTemplateDAO().create(templateId, pipelineTemplate); saveDigest(pipelineTemplate); }</code><technical_language>version set latest if empty</technical_language>

Target:
void save(@RequestParam(value = "version", required = false) String version, @RequestBody PipelineTemplate pipelineTemplate) { if (StringUtils.isNotEmpty(version)) { validatePipelineTemplateVersion(version); } String templateId = StringUtils.isNotEmpty(version) ? String.format("%s:%s", pipelineTemplate.getId(), version) : String.format("%s:%s", pipelineTemplate.getId(), "latest"); try { checkForDuplicatePipelineTemplate(templateId); } catch (DuplicateEntityException dee) { log.debug("Updating latest version for template with id: {}", templateId); return; } getPipelineTemplateDAO().create(templateId, pipelineTemplate); saveDigest(pipelineTemplate); }
Source:
<code>public Docket api() { return new Docket(DocumentationType.SWAGGER_2).select() <START> .apis(RequestHandlerSelectors.basePackage("org.activiti.services")) <END> .paths(PathSelectors.any()) .build(); }</code><technical_language>@ryandawsonuk check @erdemedeiros org.activiti.services.audit right</technical_language>

Target:
public Docket api() { return new Docket(DocumentationType.SWAGGER_2).select() .apis(RequestHandlerSelectors.basePackage("org.activiti.services.audit")) .paths(PathSelectors.any()) .build(); }
Source:
<code>public InputStream getContent() throws IOException { InputStream in; try { in = connection.getInputStream(); } catch (IOException e) { in = connection.getErrorStream(); if (in == null) { throw e; } } statusCode = connection.getResponseCode(); successful = statusCode < 400; <START> headers = new HashMap<String, Collection<String>>(); <END> for (Entry<String, List<String>> entry : connection.getHeaderFields().entrySet()) { headers.put(entry.getKey(), entry.getValue()); } String encoding = connection.getHeaderField("Content-Encoding"); if (config.getMaxResponseSize() > 0) { in = new LimitingInputStream(config.getMaxResponseSize(), in); } if ("gzip".equals(encoding)) { in = new GZIPInputStream(in); } if (config.hasMessageHandlers() || config.isTraceMessage()) { byte[] bytes = FileUtil.toBytes(in); in = new ByteArrayInputStream(bytes); if (config.hasMessageHandlers()) { Iterator<MessageHandler> it = config.getMessagerHandlers(); while(it.hasNext()) { MessageHandler handler = it.next(); if (handler instanceof MessageHandlerWithHeaders) { ((MessageHandlerWithHeaders) handler).handleResponse(url, bytes, connection.getHeaderFields()); } else { handler.handleResponse(url, bytes); } } } if (config.isTraceMessage()) { Map<String, List<String>> headers = connection.getHeaderFields(); for (Map.Entry header : headers.entrySet()) { config.getTraceStream().print(header.getKey()); config.getTraceStream().print("="); config.getTraceStream().println(header.getValue()); } config.teeInputStream(bytes); } } return in; }</code><technical_language>new HashMap<String, ? extends Collection<String>>(connection.getHeaderFields())</technical_language>

Target:
public InputStream getContent() throws IOException { InputStream in; try { in = connection.getInputStream(); } catch (IOException e) { in = connection.getErrorStream(); if (in == null) { throw e; } } statusCode = connection.getResponseCode(); successful = statusCode < 400; headers = new HashMap<String, Collection<String>>(connection.getHeaderFields()); String encoding = connection.getHeaderField("Content-Encoding"); if (config.getMaxResponseSize() > 0) { in = new LimitingInputStream(config.getMaxResponseSize(), in); } if ("gzip".equals(encoding)) { in = new GZIPInputStream(in); } if (config.hasMessageHandlers() || config.isTraceMessage()) { byte[] bytes = FileUtil.toBytes(in); in = new ByteArrayInputStream(bytes); if (config.hasMessageHandlers()) { Iterator<MessageHandler> it = config.getMessagerHandlers(); while(it.hasNext()) { MessageHandler handler = it.next(); if (handler instanceof MessageHandlerWithHeaders) { ((MessageHandlerWithHeaders) handler).handleResponse(url, bytes, connection.getHeaderFields()); } else { handler.handleResponse(url, bytes); } } } if (config.isTraceMessage()) { Map<String, List<String>> headers = connection.getHeaderFields(); for (Map.Entry header : headers.entrySet()) { config.getTraceStream().print(header.getKey()); config.getTraceStream().print("="); config.getTraceStream().println(header.getValue()); } config.teeInputStream(bytes); } } return in; }
Source:
<code>private PhoenixJson getPhoenixJsonInternal(String[] paths) { JsonNode node = this.rootNode; for (String path : paths) { JsonNode nodeTemp = null; if (node.isArray()) { int index = Integer.parseInt(path); nodeTemp = node.path(index); } else { nodeTemp = node.path(path); } if (nodeTemp == null || nodeTemp.isMissingNode()) { return null; } node = nodeTemp; } <START> return new PhoenixJson(node, null); <END> }</code><technical_language>call node.toString() instead of passing in null. Otherwise, getJsonAsString() toString() methods allocate a big string call</technical_language>

Target:
private PhoenixJson getPhoenixJsonInternal(String[] paths) { JsonNode node = this.rootNode; for (String path : paths) { JsonNode nodeTemp = null; if (node.isArray()) { int index = Integer.parseInt(path); nodeTemp = node.path(index); } else { nodeTemp = node.path(path); } if (nodeTemp == null || nodeTemp.isMissingNode()) { return null; } node = nodeTemp; } return new PhoenixJson(node, node.toString()); }
Source:
<code><START> public int getNumberOfTestGroups(String sessionId) { <END> getData(sessionId); int numberOfTestGroups = 0; Integer groupIndex = null; for (TestEntity testEntity : metricsPerTest.keySet()) { if (groupIndex == null) { groupIndex = testEntity.getTestGroupIndex(); numberOfTestGroups ++; } if (!groupIndex.equals(testEntity.getTestGroupIndex())) { numberOfTestGroups ++; } } return numberOfTestGroups; }</code><technical_language>please refactor</technical_language>

Target:
public int getNumberOfTestGroups(String sessionId) { getData(sessionId); Set<Integer> testGroupsIndexes = new HashSet<Integer>(); for (TestEntity testEntity : metricsPerTest.keySet()) { testGroupsIndexes.add(testEntity.getTestGroupIndex()); } return testGroupsIndexes.size(); }
Source:
<code>public void testReleaseCheckpoint() throws Exception { Handle h = db.openHandle(); h.begin(); h.checkpoint("first"); h.insert("insert into something (id, name) values (:id, :name)", 1, "Martin"); h.release("first"); try { h.rollback("first"); fail("Should have thrown an exception of some kind"); } catch (TransactionException e) { <START> assertThat(e).isNotNull(); <END> h.rollback(); } }</code><technical_language>Redundant assertion</technical_language>

Target:
public void testReleaseCheckpoint() throws Exception { Handle h = db.openHandle(); h.begin(); h.checkpoint("first"); h.insert("insert into something (id, name) values (:id, :name)", 1, "Martin"); h.release("first"); assertThatExceptionOfType(TransactionException.class) .isThrownBy(() -> h.rollback("first")); }
Source:
<code>private void transfer(EmbeddedChannel outChannel, EmbeddedChannel inChannel) { <START> while (true) { <END> ByteBuf encoded = outChannel.readOutbound(); if (encoded == null) { return; } inChannel.writeInbound(encoded); } }</code><technical_language>please style do in Netty: for (;;) { ... }</technical_language>

Target:
private void transfer(EmbeddedChannel outChannel, EmbeddedChannel inChannel) { for (;;) { ByteBuf encoded = outChannel.readOutbound(); if (encoded == null) { return; } inChannel.writeInbound(encoded); } }
Source:
<code>public void mappingFunctionReturnsIterableOfEntriesForEachInputEntry() throws Exception { <START> kvStore = factory.newStore(factory.newConfiguration(factory.getKeyType(), factory.getValueType(), null, null, null)); <END> Set<K> inputKeys = new HashSet<K>(); int nbElements = 10; for (long i = 0; i < nbElements; i++) { K k = factory.createKey(i); V v = factory.createValue(i); inputKeys.add(k); kvStore.put(k, v); } try { kvStore.bulkComputeIfAbsent(inputKeys, new Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>>() { @Override public Iterable<? extends Map.Entry<? extends K, ? extends V>> apply(Iterable<? extends K> entries) { assertThat(entries.iterator().hasNext(), is(false)); return new HashMap<K, V>().entrySet(); } } ); } catch (CacheAccessException e) { System.err.println("Warning, an exception is thrown due to the SPI test"); e.printStackTrace(); } }</code><technical_language>introduction of @Before allows this code refactored a setUp method</technical_language>

Target:
public void mappingFunctionReturnsIterableOfEntriesForEachInputEntry() throws Exception { Set<K> inputKeys = new HashSet<K>(); int nbElements = 10; for (long i = 0; i < nbElements; i++) { K k = factory.createKey(i); V v = factory.createValue(i); inputKeys.add(k); kvStore.put(k, v); } try { kvStore.bulkComputeIfAbsent(inputKeys, new Function<Iterable<? extends K>, Iterable<? extends Map.Entry<? extends K, ? extends V>>>() { @Override public Iterable<? extends Map.Entry<? extends K, ? extends V>> apply(Iterable<? extends K> entries) { assertThat(entries.iterator().hasNext(), is(false)); return new HashMap<K, V>().entrySet(); } } ); } catch (CacheAccessException e) { System.err.println("Warning, an exception is thrown due to the SPI test"); e.printStackTrace(); } }
Source:
<code>private InetSocketAddress getAddress() { for (InetSocketAddress address : mConnectDetails.getAddresses()) { try { LOG.debug("Checking whether is listening for RPCs", address); pingMetaService(address); LOG.debug("Successfully connected to {}", address); return address; } catch (UnavailableException e) { LOG.debug("Failed to connect to {}", address); continue; } catch (DeadlineExceededException e) { LOG.debug("Timeout while connecting to {}", address); continue; } catch (AlluxioStatusException e) { <START> LOG.debug("Exception while connecting to {}. error: {}", address, e.getMessage()); <END> continue; } } return null; }</code><technical_language>Is a aggregate error log/throw if valid master is selected</technical_language>

Target:
private InetSocketAddress getAddress() { for (InetSocketAddress address : mConnectDetails.getAddresses()) { try { LOG.debug("Checking whether is listening for RPCs", address); pingMetaService(address); LOG.debug("Successfully connected to {}", address); return address; } catch (UnavailableException e) { LOG.debug("Failed to connect to {}", address); continue; } catch (DeadlineExceededException e) { LOG.debug("Timeout while connecting to {}", address); continue; } catch (AlluxioStatusException e) { throw new RuntimeException( String.format("Received exception from %s. message: %s", address, e.getMessage()), e); } } return null; }
Source:
<code>public void deleteAllGroups(PerunSession sess, Vo vo) throws InternalErrorException, GroupAlreadyRemovedException, GroupAlreadyRemovedFromResourceException, GroupRelationDoesNotExist, GroupRelationCannotBeRemoved { for(Group group: getGroupsManagerImpl().getGroups(sess, vo)) { if (group.getName().equals(VosManager.MEMBERS_GROUP)) { continue; } List<Resource> assignedResources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, group); try { for(Resource resource : assignedResources) { getPerunBl().getResourcesManagerBl().removeGroupFromResource(sess, group, resource); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, resource, group); } getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, group); } catch(GroupNotDefinedOnResourceException ex) { throw new ConsistencyErrorException(ex); } catch(AttributeValueException ex) { throw new ConsistencyErrorException("All resources was removed from this group. So all attributes values can be removed.", ex); } catch (GroupResourceMismatchException ex) { throw new InternalErrorException(ex); } try { this.deleteGroup(sess, group, true); } catch (RelationExistsException | GroupNotExistsException e) { throw new ConsistencyErrorException(e); } } <START> getPerunBl().getAuditer().log(sess, new AllGroupsFromVoDeleted(vo)); <END> }</code><technical_language>Is this new message necessary? before</technical_language>

Target:
public void deleteAllGroups(PerunSession sess, Vo vo) throws InternalErrorException, GroupAlreadyRemovedException, GroupAlreadyRemovedFromResourceException, GroupRelationDoesNotExist, GroupRelationCannotBeRemoved { for(Group group: getGroupsManagerImpl().getGroups(sess, vo)) { if (group.getName().equals(VosManager.MEMBERS_GROUP)) { continue; } List<Resource> assignedResources = getPerunBl().getResourcesManagerBl().getAssignedResources(sess, group); try { for(Resource resource : assignedResources) { getPerunBl().getResourcesManagerBl().removeGroupFromResource(sess, group, resource); getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, resource, group); } getPerunBl().getAttributesManagerBl().removeAllAttributes(sess, group); } catch(GroupNotDefinedOnResourceException ex) { throw new ConsistencyErrorException(ex); } catch(AttributeValueException ex) { throw new ConsistencyErrorException("All resources was removed from this group. So all attributes values can be removed.", ex); } catch (GroupResourceMismatchException ex) { throw new InternalErrorException(ex); } try { this.deleteGroup(sess, group, true); } catch (RelationExistsException | GroupNotExistsException e) { throw new ConsistencyErrorException(e); } } }
Source:
<code>public Expression<?> visit(Path<?> expr, @Nullable Void context) { expr = (Path<?>) super.visit(expr, null); <START> PathMetadata<?> pathMetadata = expr.getMetadata(); <END> if (pathMetadata.getPathType() == PathType.MAPVALUE || pathMetadata.getPathType() == PathType.MAPVALUE_CONSTANT) { Path<?> replacement = replacements.get(expr); if (replacement == null) { Path parent = pathMetadata.getParent(); ParametrizedExpression parExpr = (ParametrizedExpression) parent; replacement = new PathImpl(parExpr.getParameter(1), ExpressionUtils.createRootVariable(parent)); metadata.addJoin(JoinType.JOIN, ExpressionUtils.as(parent, replacement)); metadata.addJoinCondition(ExpressionUtils.eq( Expressions.operation(parExpr.getParameter(0), JPQLOps.KEY, replacement), ExpressionUtils.toExpression(pathMetadata.getElement()))); replacements.put(expr, replacement); } return replacement; } else { return super.visit(expr, context); } }</code><technical_language>remove this? this clashes #1145</technical_language>

Target:
public Expression<?> visit(Path<?> expr, @Nullable Void context) { expr = (Path<?>) super.visit(expr, null); PathMetadata pathMetadata = expr.getMetadata(); if (pathMetadata.getPathType() == PathType.MAPVALUE || pathMetadata.getPathType() == PathType.MAPVALUE_CONSTANT) { Path<?> replacement = replacements.get(expr); if (replacement == null) { Path parent = pathMetadata.getParent(); ParametrizedExpression parExpr = (ParametrizedExpression) parent; replacement = new PathImpl(parExpr.getParameter(1), ExpressionUtils.createRootVariable(parent)); metadata.addJoin(JoinType.JOIN, ExpressionUtils.as(parent, replacement)); metadata.addJoinCondition(ExpressionUtils.eq( Expressions.operation(parExpr.getParameter(0), JPQLOps.KEY, replacement), ExpressionUtils.toExpression(pathMetadata.getElement()))); replacements.put(expr, replacement); } return replacement; } else { return super.visit(expr, context); } }
Source:
<code>private DashboardInfo findProjectDefaultDashboard(ProjectState projectState) { final Project.NameKey projectName = projectState.getProject().getNameKey(); Project.NameKey parent; DashboardInfo info; Set<Project.NameKey> seen = new HashSet<Project.NameKey>(); seen.add(projectName); boolean considerLocal = true; do { info = loadProjectDefaultDashboard(projectState, considerLocal); if (info != null) { return info; } <START> parent = projectState.getProject().getParent(); <END> if (parent == null || !seen.add(parent)) { break; } projectState = projectCache.get(parent); considerLocal = false; } while (projectState != null); projectState = projectCache.getAllProjects(); parent = projectState.getProject().getNameKey(); if (seen.add(parent)) { info = loadProjectDefaultDashboard(projectState, considerLocal); } return info; }</code><technical_language>projectState.getProject().getParent(allProjectsName) here? need special handling for All-Projects project below</technical_language>

Target:
private DashboardInfo findProjectDefaultDashboard(ProjectState projectState) { final Project.NameKey projectName = projectState.getProject().getNameKey(); Project.NameKey parent; DashboardInfo info; Set<Project.NameKey> seen = new HashSet<Project.NameKey>(); seen.add(projectName); boolean considerLocal = true; do { info = loadProjectDefaultDashboard(projectState, considerLocal); if (info != null) { return info; } considerLocal = false; parent = projectState.getProject().getParent(allProjects); projectState = projectCache.get(parent); } while (projectState != null && seen.add(parent)); return info; }
Source:
<code>public static void GetClustersWithPermittedAction(AsyncQuery aQuery, ActionGroup actionGroup, final boolean supportsVirtService, final boolean supportsGlusterService) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { if (source != null) { ArrayList<VDSGroup> list = (ArrayList<VDSGroup>) source; <START> final ArrayList<VDSGroup> filteredList = new ArrayList<VDSGroup>(); <END> for(VDSGroup cluster : list) { if ((supportsVirtService && cluster.supportsVirtService()) || (supportsGlusterService && cluster.supportsGlusterService())) { filteredList.add(cluster); } } Collections.sort(filteredList, new Linq.VdsGroupByNameComparer()); return filteredList; } return new ArrayList<VDSGroup>(); } }; GetEntitiesWithPermittedActionParameters getEntitiesWithPermittedActionParameters = new GetEntitiesWithPermittedActionParameters(); getEntitiesWithPermittedActionParameters.setActionGroup(actionGroup); Frontend.RunQuery(VdcQueryType.GetClustersWithPermittedAction, getEntitiesWithPermittedActionParameters, aQuery); }</code><technical_language>filtering..</technical_language>

Target:
public static void GetClustersWithPermittedAction(AsyncQuery aQuery, ActionGroup actionGroup, final boolean supportsVirtService, final boolean supportsGlusterService) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { if (source != null) { ArrayList<VDSGroup> list = (ArrayList<VDSGroup>) source; return getClusterByServiceList(list, supportsVirtService, supportsGlusterService); } return new ArrayList<VDSGroup>(); } }; GetEntitiesWithPermittedActionParameters getEntitiesWithPermittedActionParameters = new GetEntitiesWithPermittedActionParameters(); getEntitiesWithPermittedActionParameters.setActionGroup(actionGroup); Frontend.RunQuery(VdcQueryType.GetClustersWithPermittedAction, getEntitiesWithPermittedActionParameters, aQuery); }
Source:
<code>private void closeWriters(String source, Map<String, AzureBlobWriter> sourceWriterMap) throws Exception { Set<CompletableFuture<Void>> pendingClose = ConcurrentHashMap.newKeySet(); try { sourceWriterMap.forEach((stream, writer) -> { LOG.info("Closing topic:{}", stream); CompletableFuture<Void> future = CompletableFuture.runAsync(new Runnable() { @Override public void run() { try { writer.close(); <START> } catch (Throwable e) { <END> throw new SystemProducerException("Close failed for topic " + stream, e); } } }, asyncBlobThreadPool); pendingClose.add(future); future.handle((aVoid, throwable) -> { sourceWriterMap.remove(writer); if (throwable != null) { throw new SystemProducerException("Close failed for topic " + stream, throwable); } else { LOG.info("Blob close finished for stream " + stream); return aVoid; } }); }); CompletableFuture<Void> future = CompletableFuture.allOf(pendingClose.toArray(new CompletableFuture[0])); LOG.info("Flush source: has pending closes: ", source, pendingClose.size()); future.get((long) closeTimeout, TimeUnit.MILLISECONDS); } finally { pendingClose.clear(); } }</code><technical_language>Minor: catch Exception instead of Throwable. includes fatal errors OOM, stack overflow, classloading errors typically caught</technical_language>

Target:
private void closeWriters(String source, Map<String, AzureBlobWriter> sourceWriterMap) throws Exception { Set<CompletableFuture<Void>> pendingClose = ConcurrentHashMap.newKeySet(); try { sourceWriterMap.forEach((stream, writer) -> { LOG.info("Closing topic:{}", stream); CompletableFuture<Void> future = CompletableFuture.runAsync(new Runnable() { @Override public void run() { try { writer.close(); } catch (Exception e) { throw new SystemProducerException("Close failed for topic " + stream, e); } } }, asyncBlobThreadPool); pendingClose.add(future); future.handle((aVoid, throwable) -> { sourceWriterMap.remove(writer); if (throwable != null) { throw new SystemProducerException("Close failed for topic " + stream, throwable); } else { LOG.info("Blob close finished for stream " + stream); return aVoid; } }); }); CompletableFuture<Void> future = CompletableFuture.allOf(pendingClose.toArray(new CompletableFuture[0])); LOG.info("Flush source: has pending closes: ", source, pendingClose.size()); future.get((long) closeTimeout, TimeUnit.MILLISECONDS); } finally { pendingClose.clear(); } }
Source:
<code>public void testRandomStrings() throws IOException { DeltaLengthByteArrayValuesWriter writer = new DeltaLengthByteArrayValuesWriter(64 * 1024, 64 * 1024, new DirectByteBufferAllocator()); DeltaLengthByteArrayValuesReader reader = new DeltaLengthByteArrayValuesReader(); String[] values = Utils.getRandomStringSamples(1000, 32); Utils.writeData(writer, values); Binary[] bin = Utils.readData(reader, writer.getBytes().toByteArray(), values.length); for(int i =0; i< bin.length ; i++) { <START> Assert.assertEquals(Binary.fromString(values[i]).toStringUsingUTF8(), bin[i].toStringUsingUTF8()); <END> } }</code><technical_language>is Binary.equals() broken</technical_language>

Target:
public void testRandomStrings() throws IOException { DeltaLengthByteArrayValuesWriter writer = getDeltaLengthByteArrayValuesWriter(); DeltaLengthByteArrayValuesReader reader = new DeltaLengthByteArrayValuesReader(); String[] values = Utils.getRandomStringSamples(1000, 32); Utils.writeData(writer, values); Binary[] bin = Utils.readData(reader, writer.getBytes().toByteArray(), values.length); for(int i =0; i< bin.length ; i++) { Assert.assertEquals(Binary.fromString(values[i]), bin[i]); } }
Source:
<code>public Optional<String> getLocalHadoopConfigurationDirectory() { final String[] possibleHadoopConfPaths = new String[] { System.getenv(Constants.ENV_HADOOP_CONF_DIR), <START> System.getenv(Constants.ENV_HADOOP_HOME + "/etc/hadoop"), END> System.getenv(Constants.ENV_HADOOP_HOME + "/conf") }; for (String hadoopConfPath: possibleHadoopConfPaths) { if (StringUtils.isNotBlank(hadoopConfPath)) { return Optional.of(hadoopConfPath); } } return Optional.empty(); }</code><technical_language>I assume System.getenv(Constants.ENV_HADOOP_HOME) + "/etc/hadoop" here. next line</technical_language>

Target:
public Optional<String> getLocalHadoopConfigurationDirectory() { final String[] possibleHadoopConfPaths = new String[] { System.getenv(Constants.ENV_HADOOP_CONF_DIR), System.getenv(Constants.ENV_HADOOP_HOME) + "/etc/hadoop", System.getenv(Constants.ENV_HADOOP_HOME) + "/conf" }; for (String hadoopConfPath: possibleHadoopConfPaths) { if (StringUtils.isNotBlank(hadoopConfPath)) { return Optional.of(hadoopConfPath); } } return Optional.empty(); }
Source:
<code>private void doInit(String scheme, String hostname, int port, String loginUsername, String password, ConnectOptions connectOptions) { CouchDbProperties props = new CouchDbProperties(scheme, hostname, port); <START> if (loginUsername != null && password != null) { <END> CookieInterceptor cookieInterceptor = new CookieInterceptor(loginUsername, password); props.addRequestInterceptors(cookieInterceptor); props.addResponseInterceptors(cookieInterceptor); } if (connectOptions != null) { props.addRequestInterceptors(new TimeoutCustomizationInterceptor(connectOptions .getConnectionTimeout(), connectOptions.getReadTimeout())); props.setMaxConnections(connectOptions.getMaxConnections()); props.setProxyURL(connectOptions.getProxyURL()); if (connectOptions.getProxyUser() != null) { props.addRequestInterceptors(new ProxyAuthInterceptor(connectOptions.getProxyUser (), connectOptions.getProxyPassword())); } if (connectOptions.isSSLAuthenticationDisabled()) { props.addRequestInterceptors(SSLCustomizerInterceptor .SSL_AUTH_DISABLED_INTERCEPTOR); } else { if (connectOptions.getAuthenticatedModeSSLSocketFactory() != null) { props.addRequestInterceptors(new SSLCustomizerInterceptor(connectOptions .getAuthenticatedModeSSLSocketFactory())); } } } this.client = new CouchDbClient(props); setGsonBuilder(new GsonBuilder()); }</code><technical_language>warn/error if user is null password vice-versa</technical_language>

Target:
private void doInit(String scheme, String hostname, int port, String loginUsername, String password, ConnectOptions connectOptions) { CouchDbProperties props = new CouchDbProperties(scheme, hostname, port); if (loginUsername != null && password != null) { CookieInterceptor cookieInterceptor = new CookieInterceptor(loginUsername, password); props.addRequestInterceptors(cookieInterceptor); props.addResponseInterceptors(cookieInterceptor); } else { if (loginUsername != null || password != null) { throw new CouchDbException("Either a username and password must be provided, or " + "both values must be null. Please check the credentials and try again."); } } if (connectOptions != null) { props.addRequestInterceptors(new TimeoutCustomizationInterceptor(connectOptions .getConnectionTimeout(), connectOptions.getReadTimeout())); props.setMaxConnections(connectOptions.getMaxConnections()); props.setProxyURL(connectOptions.getProxyURL()); if (connectOptions.getProxyUser() != null) { props.addRequestInterceptors(new ProxyAuthInterceptor(connectOptions.getProxyUser (), connectOptions.getProxyPassword())); } if (connectOptions.isSSLAuthenticationDisabled()) { props.addRequestInterceptors(SSLCustomizerInterceptor .SSL_AUTH_DISABLED_INTERCEPTOR); } else { if (connectOptions.getAuthenticatedModeSSLSocketFactory() != null) { props.addRequestInterceptors(new SSLCustomizerInterceptor(connectOptions .getAuthenticatedModeSSLSocketFactory())); } } } this.client = new CouchDbClient(props); setGsonBuilder(new GsonBuilder()); }