[jira] [Commented] (GEOMETRY-32) BSPTree Updates

2019-09-18 Thread Gilles (Jira)


[ 
https://issues.apache.org/jira/browse/GEOMETRY-32?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16932844#comment-16932844
 ] 

Gilles commented on GEOMETRY-32:


bq. This is not just a matter of intuition, but also of the properties of the 
region. The points that are in the interior of the region must remain in the 
interior when everything is transformed.

Really?  This is actually a question: I don't know why it is a requirement (nor 
where it is defined). :-)
Pending your answer, I could imagine that in the same way that a reflection 
transforms "left" to "right", it could also transform "in" to "out".

bq. What do you mean here?

I'm not sure! ;-)
An interface to transform coordinates, and an interface to transform oriented 
shapes (?).
Maybe that does not make any sense, and I'm missing some basics about all of 
this (I couldn't find an opportunity to study the code, despite having some 
potential use-case...).


> BSPTree Updates
> ---
>
> Key: GEOMETRY-32
> URL: https://issues.apache.org/jira/browse/GEOMETRY-32
> Project: Apache Commons Geometry
>  Issue Type: Improvement
>  Components: core
>Reporter: Matt Juntunen
>Priority: Major
>  Labels: pull-request-available
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> The following updates should be made to the BSPTree class:
> - add an {{isLeaf()}} method to replace all of the {{node.getCut() == null}} 
> expressions
> - add unit tests
> _Edit [2019-02-17]:_
> Additional goals:
> - Refactor the API to split the idea of a general BSPTree and a BSPTree used 
> for defining in/out regions. This could result in a BSPTree interface and a 
> RegionBSPTree interface. The goal here is to allow end-users to create their 
> own extensions of these classes and specialize them for their own 
> applications (for example, to implement spatial sorting or other algorithms). 
> This will be one of the only planned extension points in the library.
> - Make the API easier to use and extend and reduce the necessity of casting 
> (especially unchecked casting) as much as possible.
> - Add the idea of convex subhyperplanes to allow for more efficient tree 
> construction.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (RNG-111) Jenkins Small Fast generator

2019-09-18 Thread Alex D Herbert (Jira)


[ 
https://issues.apache.org/jira/browse/RNG-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16932841#comment-16932841
 ] 

Alex D Herbert commented on RNG-111:


I don't have a strong argument either. At least JSF has more characters than SF 
so reduces name clash potential. I will leave them as SFC and JSF in the enums 
for now as these are:
 * SFC: the original author's name for the generator
 * JSF: a name based on the original author (Jenkins) and his description of 
the unnamed generator (Small Fast)

> Jenkins Small Fast generator
> 
>
> Key: RNG-111
> URL: https://issues.apache.org/jira/browse/RNG-111
> Project: Commons RNG
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 1.3
>Reporter: Alex D Herbert
>Assignee: Alex D Herbert
>Priority: Minor
> Fix For: 1.3
>
>
> Implement Bob Jenkins' Small/Fast Chaotic PRNG.
> [A small noncryptographic 
> PRNG|http://burtleburtle.net/bob/rand/smallprng.html]
> Variants are provided for 32-bit and 64-bit output. The generators use bit 
> shifts to avalanche state and many variants are provided for different shift 
> combinations. However there is a recommended variant that has been more 
> extensively tested. A seeding routine is provided to ensure that generators 
> with short cycles are avoided.
> This generator has no name but appears in PractRand as JSF (Jenkins Small 
> Fast).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (RNG-111) Jenkins Small Fast generator

2019-09-18 Thread Gilles (Jira)


[ 
https://issues.apache.org/jira/browse/RNG-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16932818#comment-16932818
 ] 

Gilles commented on RNG-111:


Actually, I thought that your proposal implied that it's unlikely that name 
clashes will occur later.
Besides trying to anticipatively minimize the possibility of a name clash, I 
have no strong argument.

> Jenkins Small Fast generator
> 
>
> Key: RNG-111
> URL: https://issues.apache.org/jira/browse/RNG-111
> Project: Commons RNG
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 1.3
>Reporter: Alex D Herbert
>Assignee: Alex D Herbert
>Priority: Minor
> Fix For: 1.3
>
>
> Implement Bob Jenkins' Small/Fast Chaotic PRNG.
> [A small noncryptographic 
> PRNG|http://burtleburtle.net/bob/rand/smallprng.html]
> Variants are provided for 32-bit and 64-bit output. The generators use bit 
> shifts to avalanche state and many variants are provided for different shift 
> combinations. However there is a recommended variant that has been more 
> extensively tested. A seeding routine is provided to ensure that generators 
> with short cycles are avoided.
> This generator has no name but appears in PractRand as JSF (Jenkins Small 
> Fast).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (RNG-111) Jenkins Small Fast generator

2019-09-18 Thread Alex D Herbert (Jira)


[ 
https://issues.apache.org/jira/browse/RNG-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16932767#comment-16932767
 ] 

Alex D Herbert commented on RNG-111:


Is that a +1 to changing JSF_32 to SF_32 etc?

 

> Jenkins Small Fast generator
> 
>
> Key: RNG-111
> URL: https://issues.apache.org/jira/browse/RNG-111
> Project: Commons RNG
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 1.3
>Reporter: Alex D Herbert
>Assignee: Alex D Herbert
>Priority: Minor
> Fix For: 1.3
>
>
> Implement Bob Jenkins' Small/Fast Chaotic PRNG.
> [A small noncryptographic 
> PRNG|http://burtleburtle.net/bob/rand/smallprng.html]
> Variants are provided for 32-bit and 64-bit output. The generators use bit 
> shifts to avalanche state and many variants are provided for different shift 
> combinations. However there is a recommended variant that has been more 
> extensively tested. A seeding routine is provided to ensure that generators 
> with short cycles are avoided.
> This generator has no name but appears in PractRand as JSF (Jenkins Small 
> Fast).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=314558=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314558
 ]

ASF GitHub Bot logged work on LANG-1480:


Author: ASF GitHub Bot
Created on: 18/Sep/19 18:36
Start Date: 18/Sep/19 18:36
Worklog Time Spent: 10m 
  Work Description: verhas commented on pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325831427
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,83 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string. The abbreviated name may be
+ * longer than the desired length if it cannot be abbreviated to the 
desired length.
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
-  if (len <= 0) {
-throw new IllegalArgumentException("len must be > 0");
-  }
-  if (className == null) {
-return StringUtils.EMPTY;
-  }
-
-  int availableSpace = len;
-  final int packageLevels = StringUtils.countMatches(className, '.');
-  final String[] output = new String[packageLevels + 1];
-  int endIndex = className.length() - 1;
-  for (int level = packageLevels; level >= 0; level--) {
-final int startIndex = className.lastIndexOf('.', endIndex);
-final String part = className.substring(startIndex + 1, endIndex + 1);
-availableSpace -= part.length();
-if (level > 0) {
-  // all elements except top level require an additional char space
-  availableSpace--;
+if (len <= 0) {
+throw new IllegalArgumentException("len must be > 0");
 }
-if (level == packageLevels) {
-  // ClassName is always complete
-  output[level] = part;
-} else {
-  if (availableSpace > 0) {
-output[level] = part;
-  } else {
-// if no space is left still the first char is used
-output[level] = part.substring(0, 1);
-  }
+if (className == null) {
+return StringUtils.EMPTY;
 }
 
 Review comment:
   Makes sense.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 314558)
Remaining Estimate: 19h  (was: 19h 10m)
Time Spent: 5h  (was: 4h 50m)

> ClassUtils. getAbbreviatedName(String ,int) returns too long result
> ---
>
> Key: LANG-1480
> URL: https://issues.apache.org/jira/browse/LANG-1480
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.*
>Affects Versions: 3.9
> Environment: Environment independent.
>Reporter: Peter Verhas
>Assignee: Bruno P. Kinoshita
>Priority: Major
>   Original Estimate: 24h
>  Time Spent: 5h
>  Remaining Estimate: 19h
>
> In some cases, the algorithm decides incorrectly when to which package names 
> to abbreviate. For example, abbreviating
> {{org.apache.commons.lang3.ClassUtils}} to the length 18 will result 
> {{o.a.c.lang3.ClassUtils}} (22 characters) instead of {{o.a.c.l.ClassUtils}} 
> (18 characters as requested). The reason for this is that the algorithm 
> starts from the right and goes to the left abbreviating the packages and 
> starts to abbreviate the packages when it runs out of the available space.
> Instead, the algorithm should start from the left and abbreviate all packages 
> that would result in a too-long string without abbreviating the package name.



--
This message 

[GitHub] [commons-lang] verhas commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …

2019-09-18 Thread GitBox
verhas commented on a change in pull request #446: LANG-1480 getAbbreviatedName 
refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325831427
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,83 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string. The abbreviated name may be
+ * longer than the desired length if it cannot be abbreviated to the 
desired length.
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
-  if (len <= 0) {
-throw new IllegalArgumentException("len must be > 0");
-  }
-  if (className == null) {
-return StringUtils.EMPTY;
-  }
-
-  int availableSpace = len;
-  final int packageLevels = StringUtils.countMatches(className, '.');
-  final String[] output = new String[packageLevels + 1];
-  int endIndex = className.length() - 1;
-  for (int level = packageLevels; level >= 0; level--) {
-final int startIndex = className.lastIndexOf('.', endIndex);
-final String part = className.substring(startIndex + 1, endIndex + 1);
-availableSpace -= part.length();
-if (level > 0) {
-  // all elements except top level require an additional char space
-  availableSpace--;
+if (len <= 0) {
+throw new IllegalArgumentException("len must be > 0");
 }
-if (level == packageLevels) {
-  // ClassName is always complete
-  output[level] = part;
-} else {
-  if (availableSpace > 0) {
-output[level] = part;
-  } else {
-// if no space is left still the first char is used
-output[level] = part.substring(0, 1);
-  }
+if (className == null) {
+return StringUtils.EMPTY;
 }
 
 Review comment:
   Makes sense.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=314555=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314555
 ]

ASF GitHub Bot logged work on LANG-1480:


Author: ASF GitHub Bot
Created on: 18/Sep/19 18:32
Start Date: 18/Sep/19 18:32
Worklog Time Spent: 10m 
  Work Description: verhas commented on pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325830080
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,83 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string. The abbreviated name may be
+ * longer than the desired length if it cannot be abbreviated to the 
desired length.
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
 
 Review comment:
   I can live with that. Makes sense.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 314555)
Remaining Estimate: 19h 10m  (was: 19h 20m)
Time Spent: 4h 50m  (was: 4h 40m)

> ClassUtils. getAbbreviatedName(String ,int) returns too long result
> ---
>
> Key: LANG-1480
> URL: https://issues.apache.org/jira/browse/LANG-1480
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.*
>Affects Versions: 3.9
> Environment: Environment independent.
>Reporter: Peter Verhas
>Assignee: Bruno P. Kinoshita
>Priority: Major
>   Original Estimate: 24h
>  Time Spent: 4h 50m
>  Remaining Estimate: 19h 10m
>
> In some cases, the algorithm decides incorrectly when to which package names 
> to abbreviate. For example, abbreviating
> {{org.apache.commons.lang3.ClassUtils}} to the length 18 will result 
> {{o.a.c.lang3.ClassUtils}} (22 characters) instead of {{o.a.c.l.ClassUtils}} 
> (18 characters as requested). The reason for this is that the algorithm 
> starts from the right and goes to the left abbreviating the packages and 
> starts to abbreviate the packages when it runs out of the available space.
> Instead, the algorithm should start from the left and abbreviate all packages 
> that would result in a too-long string without abbreviating the package name.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-lang] verhas commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …

2019-09-18 Thread GitBox
verhas commented on a change in pull request #446: LANG-1480 getAbbreviatedName 
refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325830080
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,83 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string. The abbreviated name may be
+ * longer than the desired length if it cannot be abbreviated to the 
desired length.
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
 
 Review comment:
   I can live with that. Makes sense.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-vfs] michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration 
based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#discussion_r325819789
 
 

 ##
 File path: 
commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/smb2/SMB2FileName.java
 ##
 @@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.vfs2.provider.smb2;
+
+import org.apache.commons.vfs2.FileName;
+import org.apache.commons.vfs2.FileType;
+import org.apache.commons.vfs2.provider.GenericFileName;
+
+/**
+ * Using an explicit fileName for SMB2 since the uri must contain a share 
name.  
+ * 
+ * The share name belongs to the rootURI, whereas the AbsPath must not contain 
the share
+ */
+public class SMB2FileName extends GenericFileName
+{
+   private final String shareName;
+   private String rootUri;
+   private String uri;
+
+   protected SMB2FileName(String scheme, String hostName, int port, int 
defaultPort, String userName, String password,
+   String path, FileType type, String shareName)
+   {
+   super(scheme, hostName, port, defaultPort, userName, password, 
path, type);
+   this.shareName = shareName;
+   createURI();
+   }
+
+   public String getShareName()
+   {
+   return shareName;
+   }
+
+   @Override
+   public String getFriendlyURI()
+   {
+   return createURI(false, false);
+   }
+
+   @Override
+   public String getURI()
+   {
+   if (uri == null)
+   {
+   uri = createURI();
+   }
+   return uri;
+   }
+
+   protected String createURI()
+   {
+   return createURI(false, true);
+   }
+
+   //the share needs to be inserted since it has been extracted from 
absPath (getPath())
+   private String createURI(final boolean useAbsolutePath, final boolean 
usePassword)
+   {
+   StringBuilder sb = new StringBuilder();
+   appendRootUri(sb, usePassword);
+   if(sb.charAt(sb.length() -1 ) != '/')
+   {
+   sb.append('/');
+   }
+   sb.append(shareName);
+   
+   if(!(getPath() == null || getPath().equals("/")))
+   {
+   if(!getPath().startsWith("/"))
+   {
+   sb.append('/');
+   }
+   sb.append(getPath());
+   }
+
+   return sb.toString();
+   }
+
+   @Override
+   public String getRootURI()
+   {
+   if (this.rootUri == null)
+   {
+   String uri = super.getRootURI();
+   this.rootUri = uri + shareName;
+   }
+   return this.rootUri;
+   }
+
+   @Override
+   public FileName getParent()
+   {
+
+   if (this.rootUri == null)
+   {
+   getRootURI();
+   }
+
+   if (getPath().replaceAll("/", "").equals(shareName) || 
getPath().equals("/") || getPath().equals(""))
+   {
+   return null; //if this method is called from the root 
name, return null because there is no parent
+   } 
+   else
+   {
+   SMB2FileName name = new SMB2FileName(this.getScheme(), 
this.getHostName(), this.getPort(),
+   this.getDefaultPort(), 
this.getUserName(), this.getPassword(),
+   getPath().substring(0, 
getPath().lastIndexOf("/")), this.getType(), shareName);
+   return name;
+   }
+   }
+
+   //inserting the share name since it has been extracted from the absPath
+   @Override
+   public String toString()
+   {
+   StringBuilder sb = new StringBuilder();
+   sb.append(getScheme());
+   sb.append("://");
+   sb.append(getUserName());
 
 Review comment:
   What if this is 

[GitHub] [commons-vfs] michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration 
based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#discussion_r325819122
 
 

 ##
 File path: 
commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/smb2/.gitignore
 ##
 @@ -0,0 +1 @@
+/SMB3FileNameParser.java
 
 Review comment:
   Why?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-vfs] michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration 
based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#discussion_r325819709
 
 

 ##
 File path: 
commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/smb2/SMB2FileName.java
 ##
 @@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.vfs2.provider.smb2;
+
+import org.apache.commons.vfs2.FileName;
+import org.apache.commons.vfs2.FileType;
+import org.apache.commons.vfs2.provider.GenericFileName;
+
+/**
+ * Using an explicit fileName for SMB2 since the uri must contain a share 
name.  
+ * 
+ * The share name belongs to the rootURI, whereas the AbsPath must not contain 
the share
+ */
+public class SMB2FileName extends GenericFileName
+{
+   private final String shareName;
+   private String rootUri;
+   private String uri;
+
+   protected SMB2FileName(String scheme, String hostName, int port, int 
defaultPort, String userName, String password,
+   String path, FileType type, String shareName)
+   {
+   super(scheme, hostName, port, defaultPort, userName, password, 
path, type);
+   this.shareName = shareName;
+   createURI();
+   }
+
+   public String getShareName()
+   {
+   return shareName;
+   }
+
+   @Override
+   public String getFriendlyURI()
+   {
+   return createURI(false, false);
+   }
+
+   @Override
+   public String getURI()
+   {
+   if (uri == null)
+   {
+   uri = createURI();
+   }
+   return uri;
+   }
+
+   protected String createURI()
+   {
+   return createURI(false, true);
+   }
+
+   //the share needs to be inserted since it has been extracted from 
absPath (getPath())
+   private String createURI(final boolean useAbsolutePath, final boolean 
usePassword)
+   {
+   StringBuilder sb = new StringBuilder();
+   appendRootUri(sb, usePassword);
+   if(sb.charAt(sb.length() -1 ) != '/')
+   {
+   sb.append('/');
+   }
+   sb.append(shareName);
+   
+   if(!(getPath() == null || getPath().equals("/")))
+   {
+   if(!getPath().startsWith("/"))
+   {
+   sb.append('/');
+   }
+   sb.append(getPath());
+   }
+
+   return sb.toString();
+   }
+
+   @Override
+   public String getRootURI()
+   {
+   if (this.rootUri == null)
+   {
+   String uri = super.getRootURI();
+   this.rootUri = uri + shareName;
+   }
+   return this.rootUri;
+   }
+
+   @Override
+   public FileName getParent()
+   {
+
+   if (this.rootUri == null)
+   {
+   getRootURI();
+   }
+
+   if (getPath().replaceAll("/", "").equals(shareName) || 
getPath().equals("/") || getPath().equals(""))
+   {
+   return null; //if this method is called from the root 
name, return null because there is no parent
+   } 
+   else
+   {
+   SMB2FileName name = new SMB2FileName(this.getScheme(), 
this.getHostName(), this.getPort(),
+   this.getDefaultPort(), 
this.getUserName(), this.getPassword(),
+   getPath().substring(0, 
getPath().lastIndexOf("/")), this.getType(), shareName);
+   return name;
+   }
+   }
+
+   //inserting the share name since it has been extracted from the absPath
+   @Override
+   public String toString()
+   {
+   StringBuilder sb = new StringBuilder();
+   sb.append(getScheme());
+   sb.append("://");
+   sb.append(getUserName());
+   sb.append(':');
+ 

[GitHub] [commons-vfs] michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration 
based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#discussion_r325818729
 
 

 ##
 File path: commons-vfs2/pom.xml
 ##
 @@ -135,6 +134,18 @@
   jackrabbit-standalone
   test
 
+
+
+com.hierynomus
+smbj
+0.5.1
+
+
+   
+   org.slf4j
+   slf4j-simple
 
 Review comment:
   Just no.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-vfs] michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration 
based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#discussion_r325820784
 
 

 ##
 File path: 
commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/smb2/SMB2FileNameParser.java
 ##
 @@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.vfs2.provider.smb2;
+
+import java.net.URI;
+
+import org.apache.commons.vfs2.FileName;
+import org.apache.commons.vfs2.FileSystemException;
+import org.apache.commons.vfs2.provider.HostFileNameParser;
+import org.apache.commons.vfs2.provider.VfsComponentContext;
+
+public class SMB2FileNameParser extends HostFileNameParser {
+
+   private static final SMB2FileNameParser INSTANCE = new 
SMB2FileNameParser();
+   
+   private static final int PORT = 443;
+   
+   public SMB2FileNameParser()
+   {
+   super(PORT);
+   }
+   
+   public static SMB2FileNameParser getInstance()
+   {
+   return INSTANCE;
+   }
+   
+   protected String extractShareName(URI uri) throws FileSystemException
+   {
+   String s = uri.getPath().startsWith("/") ? 
uri.getPath().substring(1) : uri.getPath();
+   String[] pathParts = s.split("/");
+   String share  = pathParts[0];
+   if(share == null || share.equals(""))
+   {
+   throw new 
FileSystemException("vfs.provider.smb2/missing-share-name.error", 
uri.toString());
+   }
+   
+   return pathParts[0]; //TODO check share given by uri
+   }
+   
+   @Override
+   public FileName parseUri(final VfsComponentContext context, final 
FileName base, final String uri) throws FileSystemException
+{
+   FileName parsedFileName = super.parseUri(context, base, uri);
+   String share;
+   if(base == null)
+   {
+   share = 
extractShareName(parseURIString(parsedFileName.toString()));
+   }
+   else
+   {
+   share = 
extractShareName(parseURIString(base.toString()));
+   }
+
+   StringBuilder sb = new StringBuilder();
+   Authority auth = extractToPath(parsedFileName.toString(), sb);
+   
+   String path;
+   
+   if(sb.length() == 0 || (sb.length() == 1 && sb.charAt(0) == 
'/'))
+   {
+   //this must point to the share root
+   path = "/" + share;
+   }
+   else
+   {
+   path = parsedFileName.getPath();
+   }
+   
+   String relPathFromShare;
+   try
+   {
+   relPathFromShare = removeShareFromAbsPath(path, share);
+   }
+   catch(Exception e)
+   {
+   throw new 
FileSystemException("vfs.provider.smb2/share-path-extraction.error", path, 
e.getCause());
+   }
+   
+   SMB2FileName fileName = new SMB2FileName(auth.getScheme(), 
auth.getHostName(), auth.getPort(), PORT, auth.getUserName(), 
auth.getPassword(), relPathFromShare, parsedFileName.getType(), share);
+   
+   
+   return fileName;
+}
+   
+   public URI parseURIString(String uriString) throws FileSystemException
+   {
+   try
+   {
+   return new URI(uriString);
+   }
+   catch (Exception e)
+   {
+   throw new 
FileSystemException("vfs.provider.url/badly-formed-uri.error", uriString, 
e.getCause());
+   }
+   }
+   
+   public String removeShareFromAbsPath(String path, String shareName) 
throws Exception
+   {
+   if(shareName == null || shareName.length() == 0)
+   {
+   throw new Exception("No path provided!");
+   }
+   
+   String tmp = 

[GitHub] [commons-vfs] michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration 
based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#discussion_r325818665
 
 

 ##
 File path: commons-vfs2/pom.xml
 ##
 @@ -135,6 +134,18 @@
   jackrabbit-standalone
   test
 
+
+
+com.hierynomus
+smbj
+0.5.1
+
+
+   
+   org.slf4j
+   slf4j-simple
+   1.5.11
 
 Review comment:
   Just no.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Commented] (RNG-111) Jenkins Small Fast generator

2019-09-18 Thread Gilles (Jira)


[ 
https://issues.apache.org/jira/browse/RNG-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16932725#comment-16932725
 ] 

Gilles commented on RNG-111:


bq. deal with name clashes in the future.

OK.

> Jenkins Small Fast generator
> 
>
> Key: RNG-111
> URL: https://issues.apache.org/jira/browse/RNG-111
> Project: Commons RNG
>  Issue Type: Improvement
>  Components: core
>Affects Versions: 1.3
>Reporter: Alex D Herbert
>Assignee: Alex D Herbert
>Priority: Minor
> Fix For: 1.3
>
>
> Implement Bob Jenkins' Small/Fast Chaotic PRNG.
> [A small noncryptographic 
> PRNG|http://burtleburtle.net/bob/rand/smallprng.html]
> Variants are provided for 32-bit and 64-bit output. The generators use bit 
> shifts to avalanche state and many variants are provided for different shift 
> combinations. However there is a recommended variant that has been more 
> extensively tested. A seeding routine is provided to ensure that generators 
> with short cycles are avoided.
> This generator has no name but appears in PractRand as JSF (Jenkins Small 
> Fast).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-vfs] michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration 
based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#discussion_r325819036
 
 

 ##
 File path: 
commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/providers.xml
 ##
 @@ -1,144 +1,125 @@
-

[GitHub] [commons-vfs] michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration 
based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#discussion_r325820647
 
 

 ##
 File path: 
commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/smb2/SMB2FileNameParser.java
 ##
 @@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.vfs2.provider.smb2;
+
+import java.net.URI;
+
+import org.apache.commons.vfs2.FileName;
+import org.apache.commons.vfs2.FileSystemException;
+import org.apache.commons.vfs2.provider.HostFileNameParser;
+import org.apache.commons.vfs2.provider.VfsComponentContext;
+
+public class SMB2FileNameParser extends HostFileNameParser {
+
+   private static final SMB2FileNameParser INSTANCE = new 
SMB2FileNameParser();
+   
+   private static final int PORT = 443;
+   
+   public SMB2FileNameParser()
+   {
+   super(PORT);
+   }
+   
+   public static SMB2FileNameParser getInstance()
+   {
+   return INSTANCE;
+   }
+   
+   protected String extractShareName(URI uri) throws FileSystemException
+   {
+   String s = uri.getPath().startsWith("/") ? 
uri.getPath().substring(1) : uri.getPath();
+   String[] pathParts = s.split("/");
+   String share  = pathParts[0];
+   if(share == null || share.equals(""))
+   {
+   throw new 
FileSystemException("vfs.provider.smb2/missing-share-name.error", 
uri.toString());
+   }
+   
+   return pathParts[0]; //TODO check share given by uri
+   }
+   
+   @Override
+   public FileName parseUri(final VfsComponentContext context, final 
FileName base, final String uri) throws FileSystemException
+{
+   FileName parsedFileName = super.parseUri(context, base, uri);
+   String share;
+   if(base == null)
+   {
+   share = 
extractShareName(parseURIString(parsedFileName.toString()));
+   }
+   else
+   {
+   share = 
extractShareName(parseURIString(base.toString()));
+   }
+
+   StringBuilder sb = new StringBuilder();
+   Authority auth = extractToPath(parsedFileName.toString(), sb);
+   
+   String path;
+   
+   if(sb.length() == 0 || (sb.length() == 1 && sb.charAt(0) == 
'/'))
+   {
+   //this must point to the share root
+   path = "/" + share;
+   }
+   else
+   {
+   path = parsedFileName.getPath();
+   }
+   
+   String relPathFromShare;
+   try
+   {
+   relPathFromShare = removeShareFromAbsPath(path, share);
+   }
+   catch(Exception e)
+   {
+   throw new 
FileSystemException("vfs.provider.smb2/share-path-extraction.error", path, 
e.getCause());
+   }
+   
+   SMB2FileName fileName = new SMB2FileName(auth.getScheme(), 
auth.getHostName(), auth.getPort(), PORT, auth.getUserName(), 
auth.getPassword(), relPathFromShare, parsedFileName.getType(), share);
+   
+   
+   return fileName;
+}
+   
+   public URI parseURIString(String uriString) throws FileSystemException
+   {
+   try
+   {
+   return new URI(uriString);
+   }
+   catch (Exception e)
+   {
+   throw new 
FileSystemException("vfs.provider.url/badly-formed-uri.error", uriString, 
e.getCause());
+   }
+   }
+   
+   public String removeShareFromAbsPath(String path, String shareName) 
throws Exception
+   {
+   if(shareName == null || shareName.length() == 0)
+   {
+   throw new Exception("No path provided!");
 
 Review comment:
   NullPointerException and 

[GitHub] [commons-vfs] michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
michael-o commented on a change in pull request #26: SMB v. 2 / 3 integration 
based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#discussion_r325820453
 
 

 ##
 File path: 
commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/smb2/SMB2FileNameParser.java
 ##
 @@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.vfs2.provider.smb2;
+
+import java.net.URI;
+
+import org.apache.commons.vfs2.FileName;
+import org.apache.commons.vfs2.FileSystemException;
+import org.apache.commons.vfs2.provider.HostFileNameParser;
+import org.apache.commons.vfs2.provider.VfsComponentContext;
+
+public class SMB2FileNameParser extends HostFileNameParser {
+
+   private static final SMB2FileNameParser INSTANCE = new 
SMB2FileNameParser();
+   
+   private static final int PORT = 443;
 
 Review comment:
   Since when does SMB use HTTPS?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=314495=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314495
 ]

ASF GitHub Bot logged work on LANG-1480:


Author: ASF GitHub Bot
Created on: 18/Sep/19 17:15
Start Date: 18/Sep/19 17:15
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325792045
 
 

 ##
 File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
 ##
 @@ -47,7 +47,7 @@
  * Unit tests {@link org.apache.commons.lang3.ClassUtils}.
  */
 @SuppressWarnings("boxing") // JUnit4 does not support primitive equality 
testing apart from long
-public class ClassUtilsTest  {
+class ClassUtilsTest  {
 
 Review comment:
   Let's not change the visibility of test classes please.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 314495)
Remaining Estimate: 19.5h  (was: 19h 40m)
Time Spent: 4.5h  (was: 4h 20m)

> ClassUtils. getAbbreviatedName(String ,int) returns too long result
> ---
>
> Key: LANG-1480
> URL: https://issues.apache.org/jira/browse/LANG-1480
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.*
>Affects Versions: 3.9
> Environment: Environment independent.
>Reporter: Peter Verhas
>Assignee: Bruno P. Kinoshita
>Priority: Major
>   Original Estimate: 24h
>  Time Spent: 4.5h
>  Remaining Estimate: 19.5h
>
> In some cases, the algorithm decides incorrectly when to which package names 
> to abbreviate. For example, abbreviating
> {{org.apache.commons.lang3.ClassUtils}} to the length 18 will result 
> {{o.a.c.lang3.ClassUtils}} (22 characters) instead of {{o.a.c.l.ClassUtils}} 
> (18 characters as requested). The reason for this is that the algorithm 
> starts from the right and goes to the left abbreviating the packages and 
> starts to abbreviate the packages when it runs out of the available space.
> Instead, the algorithm should start from the left and abbreviate all packages 
> that would result in a too-long string without abbreviating the package name.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=314494=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314494
 ]

ASF GitHub Bot logged work on LANG-1480:


Author: ASF GitHub Bot
Created on: 18/Sep/19 17:15
Start Date: 18/Sep/19 17:15
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325794173
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,83 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string. The abbreviated name may be
+ * longer than the desired length if it cannot be abbreviated to the 
desired length.
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
-  if (len <= 0) {
-throw new IllegalArgumentException("len must be > 0");
-  }
-  if (className == null) {
-return StringUtils.EMPTY;
-  }
-
-  int availableSpace = len;
-  final int packageLevels = StringUtils.countMatches(className, '.');
-  final String[] output = new String[packageLevels + 1];
-  int endIndex = className.length() - 1;
-  for (int level = packageLevels; level >= 0; level--) {
-final int startIndex = className.lastIndexOf('.', endIndex);
-final String part = className.substring(startIndex + 1, endIndex + 1);
-availableSpace -= part.length();
-if (level > 0) {
-  // all elements except top level require an additional char space
-  availableSpace--;
+if (len <= 0) {
+throw new IllegalArgumentException("len must be > 0");
 }
-if (level == packageLevels) {
-  // ClassName is always complete
-  output[level] = part;
-} else {
-  if (availableSpace > 0) {
-output[level] = part;
-  } else {
-// if no space is left still the first char is used
-output[level] = part.substring(0, 1);
-  }
+if (className == null) {
+return StringUtils.EMPTY;
 }
 
 Review comment:
   I was expecting a short-circuit here when the length hint is greater or 
equal than the input string, then return the input string to avoid creating a 
new String.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 314494)
Remaining Estimate: 19h 40m  (was: 19h 50m)
Time Spent: 4h 20m  (was: 4h 10m)

> ClassUtils. getAbbreviatedName(String ,int) returns too long result
> ---
>
> Key: LANG-1480
> URL: https://issues.apache.org/jira/browse/LANG-1480
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.*
>Affects Versions: 3.9
> Environment: Environment independent.
>Reporter: Peter Verhas
>Assignee: Bruno P. Kinoshita
>Priority: Major
>   Original Estimate: 24h
>  Time Spent: 4h 20m
>  Remaining Estimate: 19h 40m
>
> In some cases, the algorithm decides incorrectly when to which package names 
> to abbreviate. For example, abbreviating
> {{org.apache.commons.lang3.ClassUtils}} to the length 18 will result 
> {{o.a.c.lang3.ClassUtils}} (22 characters) instead of {{o.a.c.l.ClassUtils}} 
> (18 characters as requested). The reason for this is that the algorithm 
> starts from the right and goes to the left abbreviating the packages and 
> starts to abbreviate the packages when it runs out of the available space.
> 

[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=314497=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314497
 ]

ASF GitHub Bot logged work on LANG-1480:


Author: ASF GitHub Bot
Created on: 18/Sep/19 17:15
Start Date: 18/Sep/19 17:15
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325791889
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,82 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
-  if (len <= 0) {
-throw new IllegalArgumentException("len must be > 0");
-  }
-  if (className == null) {
-return StringUtils.EMPTY;
-  }
-
-  int availableSpace = len;
-  final int packageLevels = StringUtils.countMatches(className, '.');
-  final String[] output = new String[packageLevels + 1];
-  int endIndex = className.length() - 1;
-  for (int level = packageLevels; level >= 0; level--) {
-final int startIndex = className.lastIndexOf('.', endIndex);
-final String part = className.substring(startIndex + 1, endIndex + 1);
-availableSpace -= part.length();
-if (level > 0) {
-  // all elements except top level require an additional char space
-  availableSpace--;
+if (len <= 0) {
+throw new IllegalArgumentException("len must be > 0");
 }
-if (level == packageLevels) {
-  // ClassName is always complete
-  output[level] = part;
-} else {
-  if (availableSpace > 0) {
-output[level] = part;
-  } else {
-// if no space is left still the first char is used
-output[level] = part.substring(0, 1);
-  }
+if (className == null) {
+return StringUtils.EMPTY;
 }
-endIndex = startIndex - 1;
-  }
 
-  return StringUtils.join(output, '.');
+final char[] abbreviated = className.toCharArray();
+int target = 0;
+int source = 0;
+while (source < abbreviated.length) {
+// copy the next part
+int runAheadTarget = target;
+while (source < abbreviated.length && abbreviated[source] != '.') {
+abbreviated[runAheadTarget++] = abbreviated[source++];
+}
+
+++target;
+if (useFull(runAheadTarget, source, abbreviated.length, len)
+|| target > runAheadTarget) {
+target = runAheadTarget;
+}
+
+// copy the '.' unless it was the last part
+if (source < abbreviated.length) {
+abbreviated[target++] = abbreviated[source++];
+}
+}
+return new String(abbreviated, 0, target);
+}
+
+/**
+ * Decides if the part that was just copied to its destination
+ * location in the work array can be kept as it was copied or must be
+ * abbreviated. It must be kept when the part is the last one, which
+ * is the simple name of the class. In this case the {@code source}
+ * index, from where the characters are copied points one position
+ * after the last character, a.k.a. {@code source ==
+ * originalLength}
+ *
+ * If the part is not the last one then it can be kept
+ * unabridged if the number of the characters copied so far plus
+ * the character that are to be copied is less than or equal to the
+ * desired length.
+ *
+ * @param runAheadTarget the target index (where the characters were
+ *   copied to) pointing after the last character
+ *   copied when the current part was copied
+ * @param source the source index (where the 

[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=314496=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314496
 ]

ASF GitHub Bot logged work on LANG-1480:


Author: ASF GitHub Bot
Created on: 18/Sep/19 17:15
Start Date: 18/Sep/19 17:15
Worklog Time Spent: 10m 
  Work Description: garydgregory commented on pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325794728
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,83 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string. The abbreviated name may be
+ * longer than the desired length if it cannot be abbreviated to the 
desired length.
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
 
 Review comment:
   I am starting to wonder if `len` would be better named `lengthHint` to make 
it clearer that this length is not a guarantee in any shape or form of the 
length of the returned string.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 314496)
Remaining Estimate: 19h 20m  (was: 19.5h)
Time Spent: 4h 40m  (was: 4.5h)

> ClassUtils. getAbbreviatedName(String ,int) returns too long result
> ---
>
> Key: LANG-1480
> URL: https://issues.apache.org/jira/browse/LANG-1480
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.*
>Affects Versions: 3.9
> Environment: Environment independent.
>Reporter: Peter Verhas
>Assignee: Bruno P. Kinoshita
>Priority: Major
>   Original Estimate: 24h
>  Time Spent: 4h 40m
>  Remaining Estimate: 19h 20m
>
> In some cases, the algorithm decides incorrectly when to which package names 
> to abbreviate. For example, abbreviating
> {{org.apache.commons.lang3.ClassUtils}} to the length 18 will result 
> {{o.a.c.lang3.ClassUtils}} (22 characters) instead of {{o.a.c.l.ClassUtils}} 
> (18 characters as requested). The reason for this is that the algorithm 
> starts from the right and goes to the left abbreviating the packages and 
> starts to abbreviate the packages when it runs out of the available space.
> Instead, the algorithm should start from the left and abbreviate all packages 
> that would result in a too-long string without abbreviating the package name.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-lang] garydgregory commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …

2019-09-18 Thread GitBox
garydgregory commented on a change in pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325794728
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,83 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string. The abbreviated name may be
+ * longer than the desired length if it cannot be abbreviated to the 
desired length.
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
 
 Review comment:
   I am starting to wonder if `len` would be better named `lengthHint` to make 
it clearer that this length is not a guarantee in any shape or form of the 
length of the returned string.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-lang] garydgregory commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …

2019-09-18 Thread GitBox
garydgregory commented on a change in pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325792045
 
 

 ##
 File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
 ##
 @@ -47,7 +47,7 @@
  * Unit tests {@link org.apache.commons.lang3.ClassUtils}.
  */
 @SuppressWarnings("boxing") // JUnit4 does not support primitive equality 
testing apart from long
-public class ClassUtilsTest  {
+class ClassUtilsTest  {
 
 Review comment:
   Let's not change the visibility of test classes please.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-lang] garydgregory commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …

2019-09-18 Thread GitBox
garydgregory commented on a change in pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325794173
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,83 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string. The abbreviated name may be
+ * longer than the desired length if it cannot be abbreviated to the 
desired length.
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
-  if (len <= 0) {
-throw new IllegalArgumentException("len must be > 0");
-  }
-  if (className == null) {
-return StringUtils.EMPTY;
-  }
-
-  int availableSpace = len;
-  final int packageLevels = StringUtils.countMatches(className, '.');
-  final String[] output = new String[packageLevels + 1];
-  int endIndex = className.length() - 1;
-  for (int level = packageLevels; level >= 0; level--) {
-final int startIndex = className.lastIndexOf('.', endIndex);
-final String part = className.substring(startIndex + 1, endIndex + 1);
-availableSpace -= part.length();
-if (level > 0) {
-  // all elements except top level require an additional char space
-  availableSpace--;
+if (len <= 0) {
+throw new IllegalArgumentException("len must be > 0");
 }
-if (level == packageLevels) {
-  // ClassName is always complete
-  output[level] = part;
-} else {
-  if (availableSpace > 0) {
-output[level] = part;
-  } else {
-// if no space is left still the first char is used
-output[level] = part.substring(0, 1);
-  }
+if (className == null) {
+return StringUtils.EMPTY;
 }
 
 Review comment:
   I was expecting a short-circuit here when the length hint is greater or 
equal than the input string, then return the input string to avoid creating a 
new String.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-lang] garydgregory commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …

2019-09-18 Thread GitBox
garydgregory commented on a change in pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325791889
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,82 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
-  if (len <= 0) {
-throw new IllegalArgumentException("len must be > 0");
-  }
-  if (className == null) {
-return StringUtils.EMPTY;
-  }
-
-  int availableSpace = len;
-  final int packageLevels = StringUtils.countMatches(className, '.');
-  final String[] output = new String[packageLevels + 1];
-  int endIndex = className.length() - 1;
-  for (int level = packageLevels; level >= 0; level--) {
-final int startIndex = className.lastIndexOf('.', endIndex);
-final String part = className.substring(startIndex + 1, endIndex + 1);
-availableSpace -= part.length();
-if (level > 0) {
-  // all elements except top level require an additional char space
-  availableSpace--;
+if (len <= 0) {
+throw new IllegalArgumentException("len must be > 0");
 }
-if (level == packageLevels) {
-  // ClassName is always complete
-  output[level] = part;
-} else {
-  if (availableSpace > 0) {
-output[level] = part;
-  } else {
-// if no space is left still the first char is used
-output[level] = part.substring(0, 1);
-  }
+if (className == null) {
+return StringUtils.EMPTY;
 }
-endIndex = startIndex - 1;
-  }
 
-  return StringUtils.join(output, '.');
+final char[] abbreviated = className.toCharArray();
+int target = 0;
+int source = 0;
+while (source < abbreviated.length) {
+// copy the next part
+int runAheadTarget = target;
+while (source < abbreviated.length && abbreviated[source] != '.') {
+abbreviated[runAheadTarget++] = abbreviated[source++];
+}
+
+++target;
+if (useFull(runAheadTarget, source, abbreviated.length, len)
+|| target > runAheadTarget) {
+target = runAheadTarget;
+}
+
+// copy the '.' unless it was the last part
+if (source < abbreviated.length) {
+abbreviated[target++] = abbreviated[source++];
+}
+}
+return new String(abbreviated, 0, target);
+}
+
+/**
+ * Decides if the part that was just copied to its destination
+ * location in the work array can be kept as it was copied or must be
+ * abbreviated. It must be kept when the part is the last one, which
+ * is the simple name of the class. In this case the {@code source}
+ * index, from where the characters are copied points one position
+ * after the last character, a.k.a. {@code source ==
+ * originalLength}
+ *
+ * If the part is not the last one then it can be kept
+ * unabridged if the number of the characters copied so far plus
+ * the character that are to be copied is less than or equal to the
+ * desired length.
+ *
+ * @param runAheadTarget the target index (where the characters were
+ *   copied to) pointing after the last character
+ *   copied when the current part was copied
+ * @param source the source index (where the characters were
+ *   copied from) pointing after the last
+ *   character copied when the current part was
+ *   copied
+ * @param originalLength the original length of the class full name,
+ *   which is abbreviated
+ * @param desiredLength  the desired length of the abbreviated class
+ *  

[GitHub] [commons-vfs] markt-asf commented on issue #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
markt-asf commented on issue #26: SMB v. 2 / 3 integration based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#issuecomment-532771281
 
 
   It was closed automatically when the trunk branch was removed. I've 
re-opened the PR. Please re-base it against master.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-vfs] ahbonsu opened a new pull request #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
ahbonsu opened a new pull request #26: SMB v. 2 / 3 integration based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26
 
 
   Hi,
   
   based on this issue: 
[https://issues.apache.org/jira/browse/VFS-635](https://issues.apache.org/jira/browse/VFS-635)
 I created an implementation of [https://github.com/hierynomus/smbj](SMBJ) into 
vfs 2.2
   
   I named the provider SMB2, so the scheme I used is also smb2. I dont know if 
it's better to rename the existing smb to cifs and use smb for the smb v2+ 
implementation.
   
   All the tests from the ProviderTests pass (except known issues with 
classLoader ans sealedClass).
   
   Thanks for any feedback or further advice how to proceed with this pr,
   André


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Created] (JEXL-315) JxltEngine literal string strings ending in \ $ or # throw JxltEngine$Exception

2019-09-18 Thread Mike Bartlett (Jira)
Mike Bartlett created JEXL-315:
--

 Summary: JxltEngine literal string strings ending in \ $ or # 
throw JxltEngine$Exception
 Key: JEXL-315
 URL: https://issues.apache.org/jira/browse/JEXL-315
 Project: Commons JEXL
  Issue Type: Bug
Affects Versions: 3.1
Reporter: Mike Bartlett


When parsing literal strings with the JxltEngine, if the string ends with \ $ 
or # a JxltEngine$Exception is thrown. Escaping the ending character works, but 
seems an unnecessary burden on the user.

Example:

JxltEngine jxltEngine = (new JexlBuilder()).create().createJxltEngine();
 Expression exp = jxltEngine.createExpression("Testing$");
 Object value = exp.evaluate(new MapContext());

Stack Trace:

org.apache.commons.jexl3.JxltEngine$Exception: 
com.openmarket.workflow.el.ElEngineTest.testBug@40 failed to parse 
'Testing$'org.apache.commons.jexl3.JxltEngine$Exception: 
com.openmarket.workflow.el.ElEngineTest.testBug@40 failed to parse 'Testing$' 
at 
org.apache.commons.jexl3.internal.TemplateEngine.createExpression(TemplateEngine.java:668)
 at org.apache.commons.jexl3.JxltEngine.createExpression(JxltEngine.java:217) 
at com.openmarket.workflow.el.ElEngineTest.testBug(ElEngineTest.java:40) at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498) at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
 at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
 at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
 at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at 
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at 
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at 
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at 
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at 
org.junit.runners.ParentRunner.run(ParentRunner.java:363) at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
 at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) 
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
 at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)Caused
 by: org.apache.commons.jexl3.JxltEngine$Exception: 
com.openmarket.workflow.el.ElEngineTest.testBug@40 malformed expression: 
Testing$ at 
org.apache.commons.jexl3.internal.TemplateEngine.parseExpression(TemplateEngine.java:886)
 at 
org.apache.commons.jexl3.internal.TemplateEngine.createExpression(TemplateEngine.java:664)
 ... 25 more

 

Simple Fix in the code:

org.apache.commons.jexl3.internal.TemplateEngine

In method:
{quote}{{TemplateExpression parseExpression(JexlInfo info, String expr, Scope 
scope) { // CSOFF: MethodLength}}

 

{{for (int column = 0; column < size; ++column) {}}

{{  ...}}

{{}}}

{{// Add this code at the end of the for loop to h}}{{andle strings ending in 
\, # or $}}
{{ if (state == ParseState.ESCAPE) {}}

{{    strb.append('\\');}}

{{    state = ParseState.CONST;}}
{{ } else if (state == ParseState.DEFERRED0) {}}
{{    strb.append(deferredChar);}}
{{    state = ParseState.CONST;}}
{{ } else if (state == ParseState.IMMEDIATE0) {}}
{{    strb.append(immediateChar);}}
{{    state = ParseState.CONST;}}
{{ }}}

{{...}}
{quote}
 

 

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-vfs] ilang commented on issue #26: SMB v. 2 / 3 integration based on SMBJ

2019-09-18 Thread GitBox
ilang commented on issue #26: SMB v. 2 / 3 integration based on SMBJ
URL: https://github.com/apache/commons-vfs/pull/26#issuecomment-532735992
 
 
   @markt-asf , can I ask why did you close it ? was it integrated in some 
other way to this repository ?
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-lang] garydgregory commented on issue #459: (doc): Document public RandomStringUtils exploit

2019-09-18 Thread GitBox
garydgregory commented on issue #459: (doc): Document public RandomStringUtils 
exploit
URL: https://github.com/apache/commons-lang/pull/459#issuecomment-532732156
 
 
   > @chtompki Because many people don't read the documentation. Especially on 
the top of classes.
   uh? That's where this kind of information belongs IMO. "Because many people 
don't" also implies that many people do. So it's not saying much IMO ;-) Don't 
assume other folks' brain work like yours or or colleagues'.
   
   My POV here is that this is Javadoc for a util class, we don't need to link 
to articles on a "proof" on reasons to not use it; if we want to discourage use 
cases in certain scenarios, we just say so and we're done. If there is a CVE to 
deal with, let's link to that CVE.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Comment Edited] (COMPRESS-494) ZipArchieveInputStream component is throwing "Invalid Entry Size"

2019-09-18 Thread Gary Gregory (Jira)


[ 
https://issues.apache.org/jira/browse/COMPRESS-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16932525#comment-16932525
 ] 

Gary Gregory edited comment on COMPRESS-494 at 9/18/19 3:09 PM:


What about 1.19?

Also please use the Jira field "Fix Version/s:".


was (Author: garydgregory):
What about 1.19?

> ZipArchieveInputStream component is throwing "Invalid Entry Size"
> -
>
> Key: COMPRESS-494
> URL: https://issues.apache.org/jira/browse/COMPRESS-494
> Project: Commons Compress
>  Issue Type: Bug
>Reporter: Anvesh Mora
>Priority: Critical
>
> I've observed in my development in certain zip files which we are able to 
> extract with with unzip utility on linux is failing with our Compress library.
>  
> As of now I've stack-trace to share, I'm gonna add more in here as on when 
> discussion begins on this:
>  
> {code:java}
> Caused by: java.lang.IllegalArgumentException: invalid entry size
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
> nputStream.java:702)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
> hiveInputStream.java:805)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
> tStream.java:758)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
> am.java:407)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
> a:382)
> {code}
> I missed to add version info, below are those:
> version of lib I'm using is: 1.9
> And I did try version 1.18, issue is observed in this version too.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-lang] JLLeitschuh commented on issue #459: (doc): Document public RandomStringUtils exploit

2019-09-18 Thread GitBox
JLLeitschuh commented on issue #459: (doc): Document public RandomStringUtils 
exploit
URL: https://github.com/apache/commons-lang/pull/459#issuecomment-532721967
 
 
   @chtompki Because many people don't read the documentation. Especially on 
the top of classes.
   
   I've found this class of vulnerability in other places because of similar 
issues around not reading the documentation:
   
   - https://nvd.nist.gov/vuln/detail/CVE-2019-11808?cpeVersion=2.2
   
   I've got 3 outstanding undisclosed vulnerabilities I've reported due to 
insecure RNG caused by this class.
   
   The problem is, in security, defaults really matter. Unfortunately, by 
defaulting to insecure RNG, this class is exposing a lot of projects to this 
vulnerability.
   
   Want some examples? Just GitHub search for "RandomStringUtils token" or 
"RandomStringUtils key" on github. You'll find tens of thousands of examples.
   
   https://github.com/search?q=RandomStringUtils+token=Code


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Commented] (COMPRESS-494) ZipArchieveInputStream component is throwing "Invalid Entry Size"

2019-09-18 Thread Gary Gregory (Jira)


[ 
https://issues.apache.org/jira/browse/COMPRESS-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16932525#comment-16932525
 ] 

Gary Gregory commented on COMPRESS-494:
---

What about 1.19?

> ZipArchieveInputStream component is throwing "Invalid Entry Size"
> -
>
> Key: COMPRESS-494
> URL: https://issues.apache.org/jira/browse/COMPRESS-494
> Project: Commons Compress
>  Issue Type: Bug
>Reporter: Anvesh Mora
>Priority: Critical
>
> I've observed in my development in certain zip files which we are able to 
> extract with with unzip utility on linux is failing with our Compress library.
>  
> As of now I've stack-trace to share, I'm gonna add more in here as on when 
> discussion begins on this:
>  
> {code:java}
> Caused by: java.lang.IllegalArgumentException: invalid entry size
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
> nputStream.java:702)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
> hiveInputStream.java:805)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
> tStream.java:758)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
> am.java:407)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
> a:382)
> {code}
> I missed to add version info, below are those:
> version of lib I'm using is: 1.9
> And I did try version 1.18, issue is observed in this version too.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=314359=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314359
 ]

ASF GitHub Bot logged work on LANG-1480:


Author: ASF GitHub Bot
Created on: 18/Sep/19 14:46
Start Date: 18/Sep/19 14:46
Worklog Time Spent: 10m 
  Work Description: coveralls commented on issue #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#issuecomment-523879388
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/25785956/badge)](https://coveralls.io/builds/25785956)
   
   Coverage decreased (-0.01%) to 95.202% when pulling 
**58a852fafc2e02d1622c43d4ce4d25452854682c on verhas:LANG-1480** into 
**24f66b175fdbc37c02ac234f1f3d7b2a5f13cc57 on apache:master**.
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 314359)
Remaining Estimate: 19h 50m  (was: 20h)
Time Spent: 4h 10m  (was: 4h)

> ClassUtils. getAbbreviatedName(String ,int) returns too long result
> ---
>
> Key: LANG-1480
> URL: https://issues.apache.org/jira/browse/LANG-1480
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.*
>Affects Versions: 3.9
> Environment: Environment independent.
>Reporter: Peter Verhas
>Assignee: Bruno P. Kinoshita
>Priority: Major
>   Original Estimate: 24h
>  Time Spent: 4h 10m
>  Remaining Estimate: 19h 50m
>
> In some cases, the algorithm decides incorrectly when to which package names 
> to abbreviate. For example, abbreviating
> {{org.apache.commons.lang3.ClassUtils}} to the length 18 will result 
> {{o.a.c.lang3.ClassUtils}} (22 characters) instead of {{o.a.c.l.ClassUtils}} 
> (18 characters as requested). The reason for this is that the algorithm 
> starts from the right and goes to the left abbreviating the packages and 
> starts to abbreviate the packages when it runs out of the available space.
> Instead, the algorithm should start from the left and abbreviate all packages 
> that would result in a too-long string without abbreviating the package name.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (COMPRESS-494) ZipArchieveInputStream component is throwing "Invalid Entry Size"

2019-09-18 Thread Anvesh Mora (Jira)


[ 
https://issues.apache.org/jira/browse/COMPRESS-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16932518#comment-16932518
 ] 

Anvesh Mora commented on COMPRESS-494:
--

[~ggregory], I just added it, apologies for missing it.

> ZipArchieveInputStream component is throwing "Invalid Entry Size"
> -
>
> Key: COMPRESS-494
> URL: https://issues.apache.org/jira/browse/COMPRESS-494
> Project: Commons Compress
>  Issue Type: Bug
>Reporter: Anvesh Mora
>Priority: Critical
>
> I've observed in my development in certain zip files which we are able to 
> extract with with unzip utility on linux is failing with our Compress library.
>  
> As of now I've stack-trace to share, I'm gonna add more in here as on when 
> discussion begins on this:
>  
> {code:java}
> Caused by: java.lang.IllegalArgumentException: invalid entry size
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
> nputStream.java:702)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
> hiveInputStream.java:805)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
> tStream.java:758)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
> am.java:407)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
> a:382)
> {code}
> I missed to add version info, below are those:
> version of lib I'm using is: 1.9
> And I did try version 1.18, issue is observed in this version too.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-lang] coveralls edited a comment on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …

2019-09-18 Thread GitBox
coveralls edited a comment on issue #446: LANG-1480 getAbbreviatedName 
refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#issuecomment-523879388
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/25785956/badge)](https://coveralls.io/builds/25785956)
   
   Coverage decreased (-0.01%) to 95.202% when pulling 
**58a852fafc2e02d1622c43d4ce4d25452854682c on verhas:LANG-1480** into 
**24f66b175fdbc37c02ac234f1f3d7b2a5f13cc57 on apache:master**.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Updated] (COMPRESS-494) ZipArchieveInputStream component is throwing "Invalid Entry Size"

2019-09-18 Thread Anvesh Mora (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anvesh Mora updated COMPRESS-494:
-
Description: 
I've observed in my development in certain zip files which we are able to 
extract with with unzip utility on linux is failing with our Compress library.

 

As of now I've stack-trace to share, I'm gonna add more in here as on when 
discussion begins on this:

 
{code:java}
Caused by: java.lang.IllegalArgumentException: invalid entry size
at 
org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
nputStream.java:702)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
hiveInputStream.java:805)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
tStream.java:758)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
am.java:407)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
a:382)
{code}

I missed to add version info, below are those:
version of lib I'm using is: 1.9
And I did try version 1.18, issue is observed in this version too.

  was:
I've observed in my development in certain zip files which we are able to 
extract with with unzip utility on linux is failing with our Compress library.

 

As of now I've stack-trace to share, I'm gonna add more in here as on when 
discussion begins on this:

 
{code:java}
Caused by: java.lang.IllegalArgumentException: invalid entry size
at 
org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
nputStream.java:702)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
hiveInputStream.java:805)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
tStream.java:758)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
am.java:407)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
a:382)
{code}


> ZipArchieveInputStream component is throwing "Invalid Entry Size"
> -
>
> Key: COMPRESS-494
> URL: https://issues.apache.org/jira/browse/COMPRESS-494
> Project: Commons Compress
>  Issue Type: Bug
>Reporter: Anvesh Mora
>Priority: Critical
>
> I've observed in my development in certain zip files which we are able to 
> extract with with unzip utility on linux is failing with our Compress library.
>  
> As of now I've stack-trace to share, I'm gonna add more in here as on when 
> discussion begins on this:
>  
> {code:java}
> Caused by: java.lang.IllegalArgumentException: invalid entry size
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
> nputStream.java:702)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
> hiveInputStream.java:805)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
> tStream.java:758)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
> am.java:407)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
> a:382)
> {code}
> I missed to add version info, below are those:
> version of lib I'm using is: 1.9
> And I did try version 1.18, issue is observed in this version too.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=314350=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314350
 ]

ASF GitHub Bot logged work on LANG-1480:


Author: ASF GitHub Bot
Created on: 18/Sep/19 14:29
Start Date: 18/Sep/19 14:29
Worklog Time Spent: 10m 
  Work Description: verhas commented on pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325709633
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,82 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
 
 Review comment:
   It is not and it is described in details in the above text.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 314350)
Remaining Estimate: 20h  (was: 20h 10m)
Time Spent: 4h  (was: 3h 50m)

> ClassUtils. getAbbreviatedName(String ,int) returns too long result
> ---
>
> Key: LANG-1480
> URL: https://issues.apache.org/jira/browse/LANG-1480
> Project: Commons Lang
>  Issue Type: Bug
>  Components: lang.*
>Affects Versions: 3.9
> Environment: Environment independent.
>Reporter: Peter Verhas
>Assignee: Bruno P. Kinoshita
>Priority: Major
>   Original Estimate: 24h
>  Time Spent: 4h
>  Remaining Estimate: 20h
>
> In some cases, the algorithm decides incorrectly when to which package names 
> to abbreviate. For example, abbreviating
> {{org.apache.commons.lang3.ClassUtils}} to the length 18 will result 
> {{o.a.c.lang3.ClassUtils}} (22 characters) instead of {{o.a.c.l.ClassUtils}} 
> (18 characters as requested). The reason for this is that the algorithm 
> starts from the right and goes to the left abbreviating the packages and 
> starts to abbreviate the packages when it runs out of the available space.
> Instead, the algorithm should start from the left and abbreviate all packages 
> that would result in a too-long string without abbreviating the package name.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-lang] verhas commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …

2019-09-18 Thread GitBox
verhas commented on a change in pull request #446: LANG-1480 getAbbreviatedName 
refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325709633
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,82 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
 
 Review comment:
   It is not and it is described in details in the above text.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=314347=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314347
 ]

ASF GitHub Bot logged work on LANG-1480:


Author: ASF GitHub Bot
Created on: 18/Sep/19 14:20
Start Date: 18/Sep/19 14:20
Worklog Time Spent: 10m 
  Work Description: verhas commented on pull request #446: LANG-1480 
getAbbreviatedName refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325703983
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,82 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
-  if (len <= 0) {
-throw new IllegalArgumentException("len must be > 0");
-  }
-  if (className == null) {
-return StringUtils.EMPTY;
-  }
-
-  int availableSpace = len;
-  final int packageLevels = StringUtils.countMatches(className, '.');
-  final String[] output = new String[packageLevels + 1];
-  int endIndex = className.length() - 1;
-  for (int level = packageLevels; level >= 0; level--) {
-final int startIndex = className.lastIndexOf('.', endIndex);
-final String part = className.substring(startIndex + 1, endIndex + 1);
-availableSpace -= part.length();
-if (level > 0) {
-  // all elements except top level require an additional char space
-  availableSpace--;
+if (len <= 0) {
+throw new IllegalArgumentException("len must be > 0");
 }
-if (level == packageLevels) {
-  // ClassName is always complete
-  output[level] = part;
-} else {
-  if (availableSpace > 0) {
-output[level] = part;
-  } else {
-// if no space is left still the first char is used
-output[level] = part.substring(0, 1);
-  }
+if (className == null) {
+return StringUtils.EMPTY;
 }
-endIndex = startIndex - 1;
-  }
 
-  return StringUtils.join(output, '.');
+final char[] abbreviated = className.toCharArray();
+int target = 0;
+int source = 0;
+while (source < abbreviated.length) {
+// copy the next part
+int runAheadTarget = target;
+while (source < abbreviated.length && abbreviated[source] != '.') {
+abbreviated[runAheadTarget++] = abbreviated[source++];
+}
+
+++target;
+if (useFull(runAheadTarget, source, abbreviated.length, len)
+|| target > runAheadTarget) {
+target = runAheadTarget;
+}
+
+// copy the '.' unless it was the last part
+if (source < abbreviated.length) {
+abbreviated[target++] = abbreviated[source++];
+}
+}
+return new String(abbreviated, 0, target);
+}
+
+/**
+ * Decides if the part that was just copied to its destination
+ * location in the work array can be kept as it was copied or must be
+ * abbreviated. It must be kept when the part is the last one, which
+ * is the simple name of the class. In this case the {@code source}
+ * index, from where the characters are copied points one position
+ * after the last character, a.k.a. {@code source ==
+ * originalLength}
+ *
+ * If the part is not the last one then it can be kept
+ * unabridged if the number of the characters copied so far plus
+ * the character that are to be copied is less than or equal to the
+ * desired length.
+ *
+ * @param runAheadTarget the target index (where the characters were
+ *   copied to) pointing after the last character
+ *   copied when the current part was copied
+ * @param source the source index (where the 

[GitHub] [commons-lang] verhas commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …

2019-09-18 Thread GitBox
verhas commented on a change in pull request #446: LANG-1480 getAbbreviatedName 
refactored to create appropriate length …
URL: https://github.com/apache/commons-lang/pull/446#discussion_r325703983
 
 

 ##
 File path: src/main/java/org/apache/commons/lang3/ClassUtils.java
 ##
 @@ -433,48 +440,82 @@ public static String getAbbreviatedName(final Class 
cls, final int len) {
  * "java.lang.String" 5"j.l.String"
  * "java.lang.String"15"j.lang.String"
  * 
"java.lang.String"30"java.lang.String"
+ * 
"org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils"
  * 
- * @param className  the className to get the abbreviated name for, may be 
{@code null}
- * @param len  the desired length of the abbreviated name
- * @return the abbreviated name or an empty string
- * @throws IllegalArgumentException if len = 0
+ *
+ * @param className the className to get the abbreviated name for, may be 
{@code null}
+ * @param len   the desired length of the abbreviated name
+ * @return the abbreviated name or an empty string if the specified
+ * class name is {@code null} or empty string
+ * @throws IllegalArgumentException if {@code len <= 0}
  * @since 3.4
  */
 public static String getAbbreviatedName(final String className, final int 
len) {
-  if (len <= 0) {
-throw new IllegalArgumentException("len must be > 0");
-  }
-  if (className == null) {
-return StringUtils.EMPTY;
-  }
-
-  int availableSpace = len;
-  final int packageLevels = StringUtils.countMatches(className, '.');
-  final String[] output = new String[packageLevels + 1];
-  int endIndex = className.length() - 1;
-  for (int level = packageLevels; level >= 0; level--) {
-final int startIndex = className.lastIndexOf('.', endIndex);
-final String part = className.substring(startIndex + 1, endIndex + 1);
-availableSpace -= part.length();
-if (level > 0) {
-  // all elements except top level require an additional char space
-  availableSpace--;
+if (len <= 0) {
+throw new IllegalArgumentException("len must be > 0");
 }
-if (level == packageLevels) {
-  // ClassName is always complete
-  output[level] = part;
-} else {
-  if (availableSpace > 0) {
-output[level] = part;
-  } else {
-// if no space is left still the first char is used
-output[level] = part.substring(0, 1);
-  }
+if (className == null) {
+return StringUtils.EMPTY;
 }
-endIndex = startIndex - 1;
-  }
 
-  return StringUtils.join(output, '.');
+final char[] abbreviated = className.toCharArray();
+int target = 0;
+int source = 0;
+while (source < abbreviated.length) {
+// copy the next part
+int runAheadTarget = target;
+while (source < abbreviated.length && abbreviated[source] != '.') {
+abbreviated[runAheadTarget++] = abbreviated[source++];
+}
+
+++target;
+if (useFull(runAheadTarget, source, abbreviated.length, len)
+|| target > runAheadTarget) {
+target = runAheadTarget;
+}
+
+// copy the '.' unless it was the last part
+if (source < abbreviated.length) {
+abbreviated[target++] = abbreviated[source++];
+}
+}
+return new String(abbreviated, 0, target);
+}
+
+/**
+ * Decides if the part that was just copied to its destination
+ * location in the work array can be kept as it was copied or must be
+ * abbreviated. It must be kept when the part is the last one, which
+ * is the simple name of the class. In this case the {@code source}
+ * index, from where the characters are copied points one position
+ * after the last character, a.k.a. {@code source ==
+ * originalLength}
+ *
+ * If the part is not the last one then it can be kept
+ * unabridged if the number of the characters copied so far plus
+ * the character that are to be copied is less than or equal to the
+ * desired length.
+ *
+ * @param runAheadTarget the target index (where the characters were
+ *   copied to) pointing after the last character
+ *   copied when the current part was copied
+ * @param source the source index (where the characters were
+ *   copied from) pointing after the last
+ *   character copied when the current part was
+ *   copied
+ * @param originalLength the original length of the class full name,
+ *   which is abbreviated
+ * @param desiredLength  the desired length of the abbreviated class
+ *

[jira] [Commented] (COMPRESS-494) ZipArchieveInputStream component is throwing "Invalid Entry Size"

2019-09-18 Thread Gary Gregory (Jira)


[ 
https://issues.apache.org/jira/browse/COMPRESS-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16932481#comment-16932481
 ] 

Gary Gregory commented on COMPRESS-494:
---

[~anveshmora] 

Please specify which version you are using.

Gary

> ZipArchieveInputStream component is throwing "Invalid Entry Size"
> -
>
> Key: COMPRESS-494
> URL: https://issues.apache.org/jira/browse/COMPRESS-494
> Project: Commons Compress
>  Issue Type: Bug
>Reporter: Anvesh Mora
>Priority: Critical
>
> I've observed in my development in certain zip files which we are able to 
> extract with with unzip utility on linux is failing with our Compress library.
>  
> As of now I've stack-trace to share, I'm gonna add more in here as on when 
> discussion begins on this:
>  
> {code:java}
> Caused by: java.lang.IllegalArgumentException: invalid entry size
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
> nputStream.java:702)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
> hiveInputStream.java:805)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
> tStream.java:758)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
> am.java:407)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
> a:382)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-lang] chtompki commented on issue #459: (doc): Document public RandomStringUtils exploit

2019-09-18 Thread GitBox
chtompki commented on issue #459: (doc): Document public RandomStringUtils 
exploit
URL: https://github.com/apache/commons-lang/pull/459#issuecomment-532689260
 
 
   I'm still mildly confused how:
   
   
https://github.com/apache/commons-lang/blob/commons-lang-3.9/src/main/java/org/apache/commons/lang3/RandomStringUtils.java#L36-L37
   
   > Caveat: Instances of 
[Random](https://docs.oracle.com/javase/8/docs/api/java/util/Random.html), upon 
which the implementation of this class relies, are not cryptographically secure.
   
   doesn't lead the reader to conclude the class is not to be used for the 
purpose of security and in turn minimally use `SecureRandom` (as stipulated in 
the `java.util.Random` javadoc, to which we've linked).
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Work logged] (MATH-1486) Add Automatic-Module-Name

2019-09-18 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/MATH-1486?focusedWorklogId=314300=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314300
 ]

ASF GitHub Bot logged work on MATH-1486:


Author: ASF GitHub Bot
Created on: 18/Sep/19 13:15
Start Date: 18/Sep/19 13:15
Worklog Time Spent: 10m 
  Work Description: asfgit commented on pull request #107: MATH-1486: Add 
Automatic-Module-Name to MANIFEST
URL: https://github.com/apache/commons-math/pull/107
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 314300)
Time Spent: 20m  (was: 10m)

> Add Automatic-Module-Name
> -
>
> Key: MATH-1486
> URL: https://issues.apache.org/jira/browse/MATH-1486
> Project: Commons Math
>  Issue Type: Task
>Affects Versions: 3.6.1
>Reporter: Stephen Colebourne
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> Add an 'Automatic-Module-Name' to the manifest to support projects on Java 9 
> or later.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-math] asfgit merged pull request #107: MATH-1486: Add Automatic-Module-Name to MANIFEST

2019-09-18 Thread GitBox
asfgit merged pull request #107: MATH-1486: Add Automatic-Module-Name to 
MANIFEST
URL: https://github.com/apache/commons-math/pull/107
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Updated] (COMPRESS-494) ZipArchieveInputStream component is throwing "Invalid Entry Size"

2019-09-18 Thread Anvesh Mora (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anvesh Mora updated COMPRESS-494:
-
Description: 
I've observed in my development in certain zip files which we are able to 
extract with with unzip utility on linux is failing with our Compress library.

 

As of now I've stack-trace to share, I'm gonna add more in here as on when 
discussion begins on this:

 
{code:java}
Caused by: java.lang.IllegalArgumentException: invalid entry size
at 
org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
nputStream.java:702)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
hiveInputStream.java:805)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
tStream.java:758)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
am.java:407)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
a:382)
{code}

  was:
I've observed in my development in certain zip files which we are able to 
extract with with unzip utility on linux is failing with our Compress library.

 

As of now I've stack-trace to share, I'm gonna add it here. But I can add  more 
information as discussion on this begins:

 
{code:java}
Caused by: java.lang.IllegalArgumentException: invalid entry size
at 
org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
nputStream.java:702)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
hiveInputStream.java:805)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
tStream.java:758)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
am.java:407)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
a:382)
{code}


> ZipArchieveInputStream component is throwing "Invalid Entry Size"
> -
>
> Key: COMPRESS-494
> URL: https://issues.apache.org/jira/browse/COMPRESS-494
> Project: Commons Compress
>  Issue Type: Bug
>Reporter: Anvesh Mora
>Priority: Critical
>
> I've observed in my development in certain zip files which we are able to 
> extract with with unzip utility on linux is failing with our Compress library.
>  
> As of now I've stack-trace to share, I'm gonna add more in here as on when 
> discussion begins on this:
>  
> {code:java}
> Caused by: java.lang.IllegalArgumentException: invalid entry size
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
> nputStream.java:702)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
> hiveInputStream.java:805)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
> tStream.java:758)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
> am.java:407)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
> a:382)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (COMPRESS-494) ZipArchieveInputStream component is throwing "Invalid Entry Size"

2019-09-18 Thread Anvesh Mora (Jira)


 [ 
https://issues.apache.org/jira/browse/COMPRESS-494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anvesh Mora updated COMPRESS-494:
-
Summary: ZipArchieveInputStream component is throwing "Invalid Entry Size"  
(was: ZipInputStream component is throwing "Invalid Entry Size")

> ZipArchieveInputStream component is throwing "Invalid Entry Size"
> -
>
> Key: COMPRESS-494
> URL: https://issues.apache.org/jira/browse/COMPRESS-494
> Project: Commons Compress
>  Issue Type: Bug
>Reporter: Anvesh Mora
>Priority: Critical
>
> I've observed in my development in certain zip files which we are able to 
> extract with with unzip utility on linux is failing with our Compress library.
>  
> As of now I've stack-trace to share, I'm gonna add it here. But I can add  
> more information as discussion on this begins:
>  
> {code:java}
> Caused by: java.lang.IllegalArgumentException: invalid entry size
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
> nputStream.java:702)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
> hiveInputStream.java:805)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
> tStream.java:758)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
> am.java:407)
> at 
> org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
> a:382)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (COMPRESS-494) ZipInputStream component is throwing "Invalid Entry Size"

2019-09-18 Thread Anvesh Mora (Jira)
Anvesh Mora created COMPRESS-494:


 Summary: ZipInputStream component is throwing "Invalid Entry Size"
 Key: COMPRESS-494
 URL: https://issues.apache.org/jira/browse/COMPRESS-494
 Project: Commons Compress
  Issue Type: Bug
Reporter: Anvesh Mora


I've observed in my development in certain zip files which we are able to 
extract with with unzip utility on linux is failing with our Compress library.

 

As of now I've stack-trace to share, I'm gonna add it here. But I can add  more 
information as discussion on this begins:

 
{code:java}
Caused by: java.lang.IllegalArgumentException: invalid entry size
at 
org.apache.commons.compress.archivers.zip.ZipArchiveEntry.setSize(ZipArchiveEntry.java:550)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readDataDescriptor(ZipArchiveI
nputStream.java:702)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.bufferContainsSignature(ZipArc
hiveInputStream.java:805)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStoredEntry(ZipArchiveInpu
tStream.java:758)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.readStored(ZipArchiveInputStre
am.java:407)
at 
org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.read(ZipArchiveInputStream.jav
a:382)
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [commons-collections] garydgregory edited a comment on issue #83: WIP: Initial bloom filter code contribution

2019-09-18 Thread GitBox
garydgregory edited a comment on issue #83: WIP: Initial bloom filter code 
contribution
URL: 
https://github.com/apache/commons-collections/pull/83#issuecomment-532628344
 
 
   Enjoy your trip,  there is no rush here.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-collections] garydgregory commented on issue #83: WIP: Initial bloom filter code contribution

2019-09-18 Thread GitBox
garydgregory commented on issue #83: WIP: Initial bloom filter code contribution
URL: 
https://github.com/apache/commons-collections/pull/83#issuecomment-532628344
 
 
   Enjoy your trip,  thete is no rush here.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [commons-collections] Claudenw commented on issue #83: WIP: Initial bloom filter code contribution

2019-09-18 Thread GitBox
Claudenw commented on issue #83: WIP: Initial bloom filter code contribution
URL: 
https://github.com/apache/commons-collections/pull/83#issuecomment-532544787
 
 
   Sorry.  I was working at the airport and clicked the wronv commit button
   before boarding a flight.  I did not intend to push that.
   
   Claude
   
   On 23:01, Tue 17 Sep 2019 Gary Gregory  In Javadoc, use {@code ...} instead of a code HTML tag.
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > 
,
   > or mute the thread
   > 

   > .
   >
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services